PageSourceSearch

https://sohamrecruit.com/_next/static/chunks/app/candidates/bulk-upload/page-9c38fc927cfb68c6.js

js sohamrecruit.com collected 2026-09-24 14:19:59 UTC 11,950 bytes, 1 lines download raw bytes

1!function(){try{var e="u">typeof window?window:"u">typeof global?global:"u">typeof globalThis?globalThis:"u">typeof self?self:{},a=(new e.Error).stack;a&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[a]="1685d0af-ca91-4334-bb12-23dee1cea887",e._sentryDebugIdIdentifier="sentry-dbid-1685d0af-ca91-4334-bb12-23dee1cea887")}catch(e){}}(),(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[2808],{6296:(e,a,t)=>{"use strict";t.d(a,{A:()=>s});let s=(0,t(78340).A)("LoaderCircle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]])},12651:(e,a,t)=>{"use strict";t.d(a,{A:()=>s});let s=(0,t(78340).A)("CircleCheck",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]])},19215:(e,a,t)=>{"use strict";t.d(a,{d:()=>o,y:()=>c});var s=t(95155),r=t(12115),l=t(40980),i=t(52484),n=t(62791),d=t(33210);function c({message:e,type:a,onDismiss:t}){return(0,r.useEffect)(()=>{let e=setTimeout(t,4e3);return()=>clearTimeout(e)},[t]),(0,s.jsxs)("div",{className:(0,l.cn)("flex items-start gap-3 rounded-xl border px-4 py-3 text-sm shadow-sm","success"===a?"border-green-100 bg-green-50 text-green-800":"border-red-100 bg-red-50 text-red-800"),children:["success"===a?(0,s.jsx)(i.A,{size:16,className:"mt-0.5 shrink-0 text-green-600"}):(0,s.jsx)(n.A,{size:16,className:"mt-0.5 shrink-0 text-red-500"}),(0,s.jsx)("span",{className:"flex-1",children:e}),(0,s.jsx)("button",{onClick:t,"aria-label":"Dismiss",title:"Dismiss",className:"shrink-0 opacity-50 hover:opacity-100",children:(0,s.jsx)(d.A,{size:14})})]})}function o(){let[e,a]=(0,r.useState)(null);return{toast:e,show:(0,r.useCallback)((e,t="success")=>a({message:e,type:t}),[]),dismiss:(0,r.useCallback)(()=>a(null),[])}}},21975:(e,a,t)=>{"use strict";t.d(a,{A:()=>s});let s=(0,t(78340).A)("Upload",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"17 8 12 3 7 8",key:"t8dd8p"}],["line",{x1:"12",x2:"12",y1:"3",y2:"15",key:"widbto"}]])},41585:(e,a,t)=>{"use strict";t.d(a,{A:()=>s});let s=(0,t(78340).A)("TriangleAlert",[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]])},52484:(e,a,t)=>{"use strict";t.d(a,{A:()=>s});let s=(0,t(78340).A)("CircleCheckBig",[["path",{d:"M22 11.08V12a10 10 0 1 1-5.93-9.14",key:"g774vq"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]])},53580:(e,a,t)=>{"use strict";t.r(a),t.d(a,{default:()=>b});var s=t(95155),r=t(12115),l=t(98500),i=t.n(l),n=t(73321),d=t(97086),c=t(27529),o=t(19215),u=t(6296),m=t(12651),p=t(41585),h=t(62791),x=t(21975),f=t(33210),g=t(86901),y=t(40980);function b(){let e=(0,n.useRouter)(),{toast:a,show:t,dismiss:l}=(0,o.d)(),b=(0,r.useRef)(null),[k,j]=(0,r.useState)([]),[N,v]=(0,r.useState)(!1),[A,w]=(0,r.useState)(!1),[D,C]=(0,r.useState)(0),[z,_]=(0,r.useState)(null),$=async e=>{if(!e)return;let a=Array.from(e);if(0===a.length)return;let s=[],r=new Set(k.map(e=>`${e.file.name}::${e.file.size}`)),l=0;for(let e of a){let a=`${e.name}::${e.size}`;if(!r.has(a)){if(!await (0,y.SU)(e)){l+=1;continue}r.add(a),s.push({id:crypto.randomUUID(),file:e,status:"pending"})}}l>0&&t(`${l} file${l>1?"s were":" was"} skipped — only PDF and DOCX are allowed.`,"error"),j(e=>{let a=[...e,...s];return a.length>25?(t("Maximum 25 files at once. Extra files were skipped.","error"),a.slice(0,25)):a})},M=(e,a)=>{j(t=>t.map(t=>t.id===e?{...t,...a}:t))},U=async()=>{if(A||0===k.length)return;w(!0),_(null),C(0),j(e=>e.map(e=>({...e,status:"pending",error:void 0})));let e=[...k],a={total:0,created:0,duplicates:0,errors:0,cached:0},s=!1;for(let r=0;r<e.length&&!s;r+=3){let l=e.slice(r,r+3);l.forEach(e=>M(e.id,{status:"uploading"}));let i=null,n=null;for(let e=1;e<=2;e++)try{i=await c.Xi.bulkUploadResumes(l.map(e=>e.file)),n=null;break}catch(t){n=t;let a=t instanceof c.hD&&t.status>=500;if(console.error("[bulk-upload] chunk failed",{attempt:e,chunkSize:l.length,firstFile:l[0]?.file.name,status:t instanceof c.hD?t.status:"no-status",message:t instanceof Error?t.message:String(t),data:t instanceof c.hD?t.data:void 0}),!a||2===e)break;await new Promise(e=>
1setTimeout(e,1500)),l.forEach(e=>M(e.id,{status:"uploading"}))}if(i){let{results:e,summary:t}=i;e.forEach((e,a)=>{let t=l[a];if(!t)return;let s={candidateId:e.candidateId,candidateName:e.candidateName,fromCache:e.fromCache};"created"===e.action?s.status="created":"duplicate_exact"===e.action||"duplicate_ai"===e.action?(s.status="duplicate",s.duplicateKind="duplicate_exact"===e.action?"exact":"ai"):(s.status="error",s.error=e.error??"Unknown error"),M(t.id,s)}),a={total:a.total+t.total,created:a.created+t.created,duplicates:a.duplicates+t.duplicates,errors:a.errors+t.errors,cached:a.cached+(t.cached??0)}}else{let i=n,d=i instanceof c.hD?i.status:0,o=i instanceof c.hD?i.data?.error:void 0,u=i instanceof c.hD?i.message:"Upload failed — check your connection and try again";if(l.forEach(e=>M(e.id,{status:"error",error:u})),a={...a,total:a.total+l.length,errors:a.errors+l.length},"ai_quota_exceeded"===o){t("AI quota reached for this hour. Try again later.","error"),s=!0;for(let a=r+3;a<e.length;a++)M(e[a].id,{status:"error",error:"Skipped — AI quota reached"});a={...a,total:a.total+Math.max(0,e.length-(r+3)),errors:a.errors+Math.max(0,e.length-(r+3))}}else{let e=d>=500?" Server may be warming up — wait a few seconds and click Upload again to retry the failed files.":d>0?` (HTTP ${d})`:"";t(`Upload failed for batch starting at "${l[0].file.name}": ${u}.${e}`,"error")}}C(e=>e+l.length)}_(a),w(!1)},I=k.length;return(0,s.jsx)(d.A,{children:(0,s.jsxs)("div",{className:"p-6",children:[(0,s.jsxs)("div",{className:"mb-6 flex items-center gap-3",children:[(0,s.jsx)("button",{onClick:()=>e.back(),className:"btn text-xs",children:"← Back"}),(0,s.jsx)("h1",{className:"text-lg font-semibold",children:"Bulk upload resumes"})]}),a&&(0,s.jsx)("div",{className:"mb-4",children:(0,s.jsx)(o.y,{message:a.message,type:a.type,onDismiss:l})}),(0,s.jsxs)("div",{className:"max-w-2xl space-y-4",children:[(0,s.jsxs)("p",{className:"text-sm text-gray-600",children:["Drop up to ",25," PDF or DOCX resumes. We'll parse each one and create the candidate. Open the candidate to view AI job suggestions and scores."]}),(0,s.jsxs)("div",{className:"card",children:[(0,s.jsxs)("div",{onDragOver:e=>{e.preventDefault(),v(!0)},onDragLeave:()=>v(!1),onDrop:e=>{e.preventDefault(),v(!1),$(e.dataTransfer.files)},onClick:()=>!A&&b.current?.click(),className:(0,y.cn)("flex cursor-pointer flex-col items-center gap-2 rounded-lg border-2 border-dashed p-8 text-center transition-colors",N?"border-brand-400 bg-brand-50":"border-gray-200 hover:border-gray-300",A&&"cursor-not-allowed opacity-60"),children:[(0,s.jsx)(x.A,{size:20,className:"text-gray-300"}),(0,s.jsxs)("div",{children:[(0,s.jsx)("p",{className:"text-sm text-gray-600",children:"Drop resumes here or click to select files"}),(0,s.jsxs)("p",{className:"text-xs text-gray-400 mt-0.5",children:["PDF or DOCX \xb7 Max 10MB each \xb7 Up to ",25," files"]})]})]}),(0,s.jsx)("input",{ref:b,type:"file",multiple:!0,accept:".pdf,.docx,application/pdf,application/vnd.openxmlformats-officedocument.wordprocessingml.document",className:"hidden",onChange:e=>{$(e.target.files),b.current&&(b.current.value="")}})]}),k.length>0&&(0,s.jsxs)("div",{className:"card",children:[(0,s.jsxs)("div",{className:"flex items-center justify-between mb-3",children:[(0,s.jsxs)("h2",{className:"text-sm font-medium text-gray-700",children:[I," file",1===I?"":"s"," selected",A&&` \xb7 Processing ${D} of ${I}…`]}),!A&&(0,s.jsx)("button",{onClick:()=>{j([]),_(null),C(0)},className:"text-xs text-gray-400 hover:text-gray-600",children:"Clear all"})]}),(0,s.jsx)("ul",{className:"space-y-2",children:k.map(e=>{var a,t;return(0,s.jsxs)("li",{className:"flex items-start gap-3 rounded-md border border-gray-100 px-3 py-2 text-sm",children:[(0,s.jsx)("div",{className:"pt-0.5",children:"uploading"===(a=e.status)?(0,s.jsx)(u.A,{size:16,className:"animate-spin text-brand-500"}):"created"===a?(0,s.jsx)(m.A,{size:16,className:"text-green-600"}):"duplicate"===a?(0,s.jsx)(p.A,{size:16,className:"text-amber-500"}):"error"===a?(0,s.jsx)(h.A,{size:16,className:"text-red-500"}):(0,s.jsx)("span",{className:"inline-block w-2 h-2 rounded-full bg-gray-300"})}),(0,s.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[e.candidateId?(0,s.jsx)(i(),{href:`/candidates/${e.candidateId}`,className:"truncate font-medium text-brand-700 hover:underline",title:e.file.name,children:e.candidateName||e.file.name}):(0,s.jsx)("span",{className:"truncate font-medium text-gray-700",title:e.file.name,children:e.file.name}),(0,s.jsx)("span",{className:"text-xs text-gray-400 whitespace-nowrap",children:(t=e.file.size)<1024?`${t} B`:t<1048576?`${(t/1024).toFixed(1)} KB`:`${(t/1048576).toFixed(1)} MB`})]}),(0,s.jsx)("div",{className:"text-xs text-gray-500 mt-0.5",children:function(e){switch(e.status){case"pen
1ding":return"Waiting to upload";case"uploading":return"Uploading and parsing…";case"created":return"Added to talent pool";case"duplicate":return"Already exists — no changes";case"error":var a=e.error;switch(a){case"parse_failed":return"Couldn't read the resume — try a clearer PDF or DOCX, or re-upload later.";case"unsupported_type":return"Unsupported file type — only PDF and DOCX are accepted.";case"file_too_large":return"File too large — 10MB maximum.";case"empty_file":return"File is empty.";case"not_processed":return"Not processed.";default:return a??"Upload failed"}default:return""}}(e)})]}),!A&&"pending"===e.status&&(0,s.jsx)("button",{type:"button",onClick:()=>{var a;return a=e.id,void j(e=>e.filter(e=>e.id!==a))},className:"text-gray-400 hover:text-red-500","aria-label":"Remove file",children:(0,s.jsx)(f.A,{size:14})})]},e.id)})}),(0,s.jsx)("div",{className:"mt-4 flex justify-end gap-2",children:(0,s.jsx)("button",{type:"button",onClick:U,disabled:A||0===k.length,className:"btn-primary",children:A?(0,s.jsxs)("span",{className:"flex items-center gap-2",children:[(0,s.jsx)(u.A,{size:14,className:"animate-spin"})," Uploading…"]}):`Upload & create ${k.length} candidate${1===k.length?"":"s"}`})})]}),z&&!A&&(0,s.jsx)("div",{className:"card border border-brand-100 bg-brand-50/40",children:(0,s.jsxs)("div",{className:"flex items-start gap-2",children:[(0,s.jsx)(g.A,{size:16,className:"mt-0.5 text-brand-600"}),(0,s.jsxs)("div",{className:"text-sm",children:[(0,s.jsx)("p",{className:"font-medium text-gray-800",children:"Bulk upload complete"}),(0,s.jsxs)("p",{className:"text-gray-600 mt-0.5",children:[z.created," created \xb7 ",z.duplicates," duplicate",1===z.duplicates?"":"s"," \xb7 ",z.errors," error",1===z.errors?"":"s",z.cached?` \xb7 ${z.cached} from cache (0 tokens)`:""]}),z.created>0&&(0,s.jsx)("button",{type:"button",onClick:()=>e.push("/candidates?source=Bulk+Upload"),className:"mt-2 text-xs text-brand-700 hover:underline",children:"View uploaded candidates →"})]})]})})]})]})})}},61694:(e,a,t)=>{Promise.resolve().then(t.bind(t,53580))},62791:(e,a,t)=>{"use strict";t.d(a,{A:()=>s});let s=(0,t(78340).A)("CircleX",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]])},86901:(e,a,t)=>{"use strict";t.d(a,{A:()=>s});let s=(0,t(78340).A)("Sparkles",[["path",{d:"M9.937 15.5A2 2 0 0 0 8.5 14.063l-6.135-1.582a.5.5 0 0 1 0-.962L8.5 9.936A2 2 0 0 0 9.937 8.5l1.582-6.135a.5.5 0 0 1 .963 0L14.063 8.5A2 2 0 0 0 15.5 9.937l6.135 1.581a.5.5 0 0 1 0 .964L15.5 14.063a2 2 0 0 0-1.437 1.437l-1.582 6.135a.5.5 0 0 1-.963 0z",key:"4pj2yx"}],["path",{d:"M20 3v4",key:"1olli1"}],["path",{d:"M22 5h-4",key:"1gvqau"}],["path",{d:"M4 17v2",key:"vumght"}],["path",{d:"M5 18H3",key:"zchphs"}]])}},e=>{e.O(0,[8500,8437,9060,2917,7529,7086,9793,8441,2209,7358],()=>e(e.s=61694)),_N_E=e.O()}]);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.