1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[4262],{84262:function(e,t,a){a.r(t),a.d(t,{default:function(){return u}});var s=a(85893),r=a(67294),l=a(87542),i=a(62190),n=a(43283),c=a(2553),o=a(60641),d=a(60493),x=a(43765),m=a(79298),p=a(67694);function u(e){let{onResumeData:t,onClose:a}=e,{theme:u}=(0,p.F)(),h="dark"===u,[f,g]=(0,r.useState)(null),[b,y]=(0,r.useState)(!1),[v,j]=(0,r.useState)(!1),[N,w]=(0,r.useState)(0),[D,C]=(0,r.useState)("idle"),[k,S]=(0,r.useState)(""),[E,A]=(0,r.useState)("idle"),F=(0,r.useRef)(E);(0,r.useEffect)(()=>{F.current=E},[E]);let[P,Z]=(0,r.useState)(!1),I={"validate-file":"Validating file","extract-text":"Extracting text","ai-parse":"AI parsing","fallback-parse":"Fallback parsing","upload-archive":"Uploading archive",done:"Completed"},_=["validate-file","extract-text","ai-parse","fallback-parse","upload-archive","done"],[T,R]=(0,r.useState)(()=>{let e={};return _.forEach(t=>e[t]="pending"),e}),O=(e,t)=>{R(a=>({...a,[e]:t}))},z=(0,r.useCallback)(e=>{e.preventDefault(),j(!0)},[]),U=(0,r.useCallback)(e=>{e.preventDefault(),j(!1)},[]),M=(0,r.useCallback)(e=>{e.preventDefault(),j(!1);let t=Array.from(e.dataTransfer.files).find(e=>"application/pdf"===e.type||"application/vnd.openxmlformats-officedocument.wordprocessingml.document"===e.type||e.name.toLowerCase().endsWith(".pdf")||e.name.toLowerCase().endsWith(".docx"));t?g(t):S("Please upload a PDF or DOCX file")},[]),L=(0,r.useCallback)(e=>{var t;let a=null===(t=e.target.files)||void 0===t?void 0:t[0];a&&(g(a),S(""))},[]),X=async()=>{if(!f)return;y(!0),C("parsing"),w(0),_.forEach(e=>O(e,"pending"));let e=null,s=null,r=null;try{var l;w(5),O("validate-file","in_progress");let i="undefined"!=typeof crypto&&crypto.randomUUID?crypto.randomUUID():"u-".concat(Date.now(),"-").concat(Math.random().toString(36).slice(2,8));r=setInterval(()=>{w(e=>Math.min(95,e+5))},300);let n=new FormData;n.append("resume",f),n.append("uploadId",i);try{await fetch("/api/parse-resume-init",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({uploadId:i})})}catch(e){}let c=()=>{let e=0;s=setInterval(async()=>{try{let e=await fetch("/api/parse-resume-status?id=".concat(encodeURIComponent(i)));if(!e.ok)return;let t=await e.json();if(Array.isArray(t.processSteps)){t.processSteps.forEach(e=>{let t="in_progress"===e.status?"in_progress":"failed"===e.status?"failed":"pending"===e.status?"pending":"done";_.includes(e.step)&&O(e.step,t)});let e=t.processSteps.find(e=>"done"===e.step&&"done"===e.status),a=t.processSteps.find(e=>"failed"===e.status);(e||a)&&(clearInterval(s),s=null)}}catch(e){}(e+=400)>=6e4&&(clearInterval(s),s=null)},400)};if(A("connecting"),window.EventSource)try{e=new EventSource("/api/parse-resume-stream?id=".concat(encodeURIComponent(i)));let t=setTimeout(()=>{if("connecting"===F.current||"idle"===F.current){A("polling");try{null==e||e.close()}catch(e){}e=null,c()}},800);e.addEventListener("update",e=>{A("sse");try{clearTimeout(t)}catch(e){}A("sse");try{let t=JSON.parse(e.data||"{}");Array.isArray(t.processSteps)&&t.processSteps.forEach(e=>{let t="in_progress"===e.status?"in_progress":"failed"===e.status?"failed":"pending"===e.status?"pending":"done";_.includes(e.step)&&O(e.step,t)})}catch(e){}}),e.addEventListener("done",()=>{try{clearTimeout(t)}catch(e){}A("idle");try{null==e||e.close()}catch(e){}e=null}),e.addEventListener("timeout",()=>{A("polling");try{clearTimeout(t)}catch(e){}A("polling");try{null==e||e.close()}catch(e){}e=null,c()}),e.onerror=a=>{try{clearTimeout(t)}catch(e){}A("polling");try{null==e||e.close()}catch(e){}e=null,c()}}catch(e){A("polling"),c()}else A("polling"),c();let o=await fetch("/api/parse-resume",{method:"POST",body:n});clearInterval(r),w(100);let d=await o.text().catch(()=>""),x=null;try{x=d?JSON.parse(d):null}catch(e){}if(x&&Array.isArray(x.processSteps)&&(_.forEach(e=>O(e,"pending")),x.processSteps.forEach(e=>{if(!e||!e.step)return;let t="in_progress"===e.status?"in_progress":"failed"===e.status?"failed":"pending"===e.status?"pending":"done";_.includes(e.step)&&O(e.step,t)})),!o.ok){let e=(null==x?void 0:x.error)||(null==x?void 0:x.details)||o.statusText||"Server error";throw{serverResult:x,message:e}}if(x.success&&(null===(l=x.data)||void 0===l?void 0:l.personal)){C("success");let r={name:x.data.personal.name||"",email:x.data.personal.email||"",phone:x.data.personal.phone||"",location:x.data.personal.location||"",linkedin:x.data.personal.linkedin||"",github:x.data.personal.github||"",website:"",bio:x.data.summary||"",experience:(Array.isArray(x.data.experience)?x.data.experience:[]).map((e,t)=>{var a;return{id:"exp-".concat(t),company:e.company,title:e.title||e.position||"",startDate:e.startDate||"",endDate:e.endDate||"",current:"boolean"==typeof e.current?e.current:"Present"===e.endDate,description:e.description,location:e.location||"",projects:(null===(a=e.projects)||void 0===a?void 0:a.map((e,a)=>({id:"proj-".concat(t,"-").concat(a),name:e.name||"",description:e.description||"",responsibilities:Array.isArray(e.responsibilities)?e.responsibilities:Array.isArray(e.bullets)?e.bullets:[],techStack:Array.isArray(e.techStack)?e.techStack:[]})))||[]}}),education:(Array.isArray(x.data.education)?x.data.education:[]).map((e,t)=>({id:"edu-".concat(t),institution:e.institution,degree:e.degree,field:e.field||"",startDate:e.startDate,endD
1ate:e.endDate,gpa:e.gpa||""})),skills:Array.isArray(x.data.skills)?x.data.skills:[],certifications:(Array.isArray(x.data.certifications)?x.data.certifications:[]).map((e,t)=>({id:"cert-".concat(t),name:e.name,issuer:e.issuer,date:e.date,expiryDate:e.expiryDate||"",credentialId:""})),languages:[]};Array.isArray(x.processSteps)?(_.forEach(e=>O(e,"pending")),x.processSteps.forEach(e=>{let t=e.step;if(!t)return;let a="in_progress"===e.status?"in_progress":"failed"===e.status?"failed":"done";_.includes(t)&&O(t,a)})):(O("validate-file","done"),O("extract-text","done"),O("ai-parse","done")),t(r),setTimeout(()=>{null==a||a()},1500);try{null==e||e.close()}catch(e){}try{clearInterval(s)}catch(e){}A("idle")}else throw x.processSteps&&x.processSteps.forEach(e=>{if(e&&e.step){let t="in_progress"===e.status?"in_progress":"failed"===e.status?"failed":"pending"===e.status?"pending":"done";O(e.step,t)}}),Error(x.error||x.details||"Failed to parse resume")}catch(t){console.error("Resume parsing error:",t),C("error");let e=t&&t.serverResult||null;(null==e?void 0:e.errorCode)==="IMAGE_OR_CORRUPTED_RESUME"?(S(e.friendlyMessage||e.error||e.details||"The file appears to be image-based or corrupted. Please try a different resume."),Z(!0)):S(t instanceof Error?t.message:(null==t?void 0:t.message)||"Failed to parse resume")}finally{try{clearInterval(s)}catch(e){}try{clearInterval(r)}catch(e){}y(!1),setTimeout(()=>w(100),250)}},B=()=>{g(null),C("idle"),w(0),S("")};return(0,s.jsx)(l.E.div,{initial:{opacity:0}
1,animate:{opacity:1},exit:{opacity:0},role:"presentation",className:"fixed inset-0 z-50 flex items-center justify-center bg-black/55 p-4 backdrop-blur-[1px]",onClick:()=>{!b&&"parsing"!==D&&a&&a()},children:(0,s.jsxs)(l.E.div,{initial:{scale:.96,opacity:0},animate:{scale:1,opacity:1},exit:{scale:.96,opacity:0},role:"dialog","aria-modal":"true","aria-labelledby":"resume-upload-title",onClick:e=>e.stopPropagation(),className:"flex max-h-[min(92vh,720px)] w-full max-w-[min(96vw,40rem)] flex-col overflow-hidden rounded-2xl border border-[var(--color-border)] bg-[var(--color-surface)] shadow-2xl sm:rounded-3xl lg:max-w-[44rem]",children:[(0,s.jsxs)("div",{className:"flex flex-col gap-3 border-b border-[var(--color-border)] bg-[var(--color-surface-hover)]/50 px-4 py-4 sm:flex-row sm:items-center sm:justify-between sm:px-6 sm:py-5",children:[(0,s.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,s.jsxs)("div",{className:"mb-1 flex flex-wrap items-center gap-2",children:[(0,s.jsx)("h2",{id:"resume-upload-title",className:"text-xl font-bold text-[var(--color-text)] sm:text-2xl",children:"Upload your resume \uD83D\uDCC4"}),(0,s.jsx)("span",{className:"rounded-full bg-gradient-to-r from-emerald-500 to-green-600 px-2.5 py-0.5 text-[11px] font-bold uppercase tracking-wide text-white shadow-sm",children:"⨠Easy fill"})]}),(0,s.jsxs)("p",{className:"text-sm leading-snug text-[var(--color-text-secondary)] sm:text-[15px]",children:[(0,s.jsx)("span",{className:"font-semibold text-[#0079D3] dark:text-[#5eb5f8]",children:"Save time"})," â we extract your profile with AI. PDF or DOCX, up to 10MB."]})]}),a?(0,s.jsx)("button",{type:"button",onClick:a,disabled:b||"parsing"===D,className:"self-end rounded-full p-2 text-[var(--color-text-secondary)] transition-colors hover:bg-[var(--color-surface-hover)] hover:text-[var(--color-text)] disabled:opacity-40","aria-label":"Close",children:(0,s.jsx)(i.Z,{className:"h-5 w-5"})}):null]}),(0,s.jsx)("div",{className:"min-h-0 flex-1 overflow-y-auto px-4 py-4 sm:px-6 sm:py-5",children:(0,s.jsxs)("div",{className:"space-y-6",children:[f?(0,s.jsxs)("div",{className:"space-y-4",children:[(0,s.jsx)("div",{className:"rounded-xl p-4 ".concat(h?"bg-[#272729] border border-[#343536]":"bg-gray-50 border border-gray-200"),children:(0,s.jsxs)("div",{className:"flex items-center justify-between",children:[(0,s.jsxs)("div",{className:"flex items-center space-x-3",children:[(0,s.jsx)(c.Z,{className:"w-8 h-8 text-blue-500"}),(0,s.jsxs)("div",{children:[(0,s.jsx)("p",{className:"font-semibold ".concat(h?"text-white":"text-gray-900"),children:f.name}),(0,s.jsxs)("p",{className:"text-sm ".concat(h?"text-[#818384]":"text-gray-500"),children:[(f.size/1024/1024).toFixed(2)," MB"]})]})]}),"idle"===D&&(0,s.jsx)("button",{onClick:B,className:"transition-colors p-1 ".concat(h?"text-[#818384] hover:text-red-400":"text-gray-400 hover:text-red-500"),children:(0,s.jsx)(i.Z,{className:"w-4 h-4"})})]})}),"parsing"===D&&(0,s.jsxs)("div",{className:"space-y-3",children:[(0,s.jsxs)("div",{className:"flex items-center space-x-3 justify-between",children:[(0,s.jsxs)("div",{className:"flex items-center space-x-3",children:[(0,s.jsx)(o.Z,{className:"w-5 h-5 text-blue-500 animate-spin"}),(0,s.jsx)("span",{className:h?"text-white":"text-gray-900",children:"Parsing your resume..."})]}),(0,s.jsxs)("div",{className:"text-xs ".concat(h?"text-[#818384]":"text-gray-500"),children:["connecting"===E&&(0,s.jsx)("span",{children:"Connectingâ¦"}),"sse"===E&&(0,s.jsx)("span",{className:"text-green-500",children:"Realtime"}),"polling"===E&&(0,s.jsx)("span",{className:"text-[#FF4500]",children:"Polling"}),"error"===E&&(0,s.jsx)("span",{className:"text-red-500",children:"Stream error"})]})]}),(0,s.jsx)("div",{className:"w-full rounded-full h-2 ".concat(h?"bg-[#343536]":"bg-gray-200"),children:(0,s.jsx)(l.E.div,{className:"bg-blue-500 h-2 rounded-full",initial:{width:0},animate:{width:"".concat(N,"%")},transition:{duration:.5}})}),(0,s.jsx)("p",{className:"text-sm ".concat(h?"text-[#818384]":"text-gray-500"),children:"Extracting information using AI..."}),(0,s.jsx)("div",{className:"mt-3 rounded-xl p-3 space-y-2 ".concat(h?"bg-[#272729] border border-[#343536]":"bg-gray-50 border border-gray-200"),children:_.map(e=>(0,s.jsxs)("div",{className:"flex items-center justify-between text-sm ".concat(h?"text-[#D7DADC]":"text-gray-700"),children:[(0,s.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,s.jsx)("div",{className:"w-6 h-6 flex items-center justify-center",children:"in_progress"===T[e]?(0,s.jsx)(o.Z,{className:"w-4 h-4 text-blue-400 animate-spin"}):"done"===T[e]?(0,s.jsx)(d.Z,{className:"w-4 h-4 text-green-400"}):"failed"===T[e]?(0,s.jsx)(x.Z,{className:"w-4 h-4 text-red-400"}):(0,s.jsx)("div",{className:"w-2 h-2 rounded-full ".concat(h?"bg-[#343536]":"bg-gray-400")})}),(0,s.jsx)("div",{children:I[e]||e})]}),(0,s.jsx)("div",{className:"text-xs ".concat(h?"text-[#818384]":"text-gray-400"),children:T[e]})]},e))})]}),"success"===D&&(0,s.jsx)(l.E.div,{initial:{opacity:0,y:10}
1,animate:{opacity:1,y:0},className:"bg-green-500/10 border border-green-500/20 rounded-xl p-4",children:(0,s.jsxs)("div",{className:"flex items-center space-x-3",children:[(0,s.jsx)(d.Z,{className:"w-5 h-5 text-green-500"}),(0,s.jsxs)("div",{children:[(0,s.jsx)("p",{className:"font-semibold text-green-500",children:"Resume Parsed Successfully!"}),(0,s.jsx)("p",{className:"text-sm ".concat(h?"text-[#818384]":"text-gray-500"),children:"Your profile has been automatically filled with the extracted information"}),(0,s.jsx)("div",{className:"mt-3 rounded-xl p-3 space-y-2 ".concat(h?"bg-[#272729] border border-[#343536]":"bg-gray-50 border border-gray-200"),children:_.map(e=>(0,s.jsxs)("div",{className:"flex items-center justify-between text-sm ".concat(h?"text-[#D7DADC]":"text-gray-700"),children:[(0,s.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,s.jsx)("div",{className:"w-6 h-6 flex items-center justify-center",children:"done"===T[e]?(0,s.jsx)(d.Z,{className:"w-4 h-4 text-green-400"}):"failed"===T[e]?(0,s.jsx)(x.Z,{className:"w-4 h-4 text-red-400"}):(0,s.jsx)("div",{className:"w-2 h-2 rounded-full ".concat(h?"bg-[#343536]":"bg-gray-400")})}),(0,s.jsx)("div",{children:I[e]||e})]}),(0,s.jsx)("div",{className:"text-xs ".concat(h?"text-[#818384]":"text-gray-400"),children:T[e]})]},e))})]})]})}),"error"===D&&(0,s.jsxs)(l.E.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},className:"bg-red-500/10 border border-red-500/20 rounded-xl p-4",children:[(0,s.jsxs)("div",{className:"flex items-center space-x-3",children:[(0,s.jsx)(x.Z,{className:"w-5 h-5 text-red-500"}),(0,s.jsxs)("div",{children:[(0,s.jsx)("p",{className:"font-semibold text-red-500",children:"Parsing Failed"}),(0,s.jsx)("p",{className:"text-sm ".concat(h?"text-[#818384]":"text-gray-500"),children:k}),(0,s.jsx)("div",{className:"mt-3 rounded-xl p-3 space-y-2 ".concat(h?"bg-[#272729] border border-[#343536]":"bg-gray-50 border border-gray-200"),children:_.map(e=>(0,s.jsxs)("div",{className:"flex items-center justify-between text-sm ".concat(h?"text-[#D7DADC]":"text-gray-700"),children:[(0,s.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,s.jsx)("div",{className:"w-6 h-6 flex items-center justify-center",children:"done"===T[e]?(0,s.jsx)(d.Z,{className:"w-4 h-4 text-green-400"}):"failed"===T[e]?(0,s.jsx)(x.Z,{className:"w-4 h-4 text-red-400"}):"in_progress"===T[e]?(0,s.jsx)(o.Z,{className:"w-4 h-4 text-blue-400 animate-spin"}):(0,s.jsx)("div",{className:"w-2 h-2 rounded-full ".concat(h?"bg-[#343536]":"bg-gray-400")})}),(0,s.jsx)("div",{children:I[e]||e})]}),(0,s.jsx)("div",{className:"text-xs ".concat(h?"text-[#818384]":"text-gray-400"),children:T[e]})]},e))})]})]}),(0,s.jsx)(m.zx,{onClick:()=>{C("idle"),S("")},variant:"danger",size:"sm",className:"btn-mobile-sm mt-3",children:"Try Again"})]}),"idle"===D&&(0,s.jsxs)("div",{className:"flex flex-col sm:flex-row gap-3",children:[(0,s.jsx)(m.zx,{onClick:X,disabled:b,variant:"primary",size:"lg",loading:b,className:"btn-mobile-lg flex-1 order-1",icon:b?o.Z:c.Z,children:b?"Processing...":"Parse Resume"}),(0,s.jsx)(m.zx,{onClick:B,variant:"outline",size:"lg",className:"btn-mobile-lg order-2",children:"Remove"})]})]}):(0,s.jsxs)("div",{onDragOver:z,onDragLeave:U,onDrop:M,className:"relative border-2 border-dashed rounded-xl sm:rounded-2xl p-6 sm:p-8 lg:p-12 text-center transition-all ".concat(v?"border-blue-500 bg-blue-500/5":h?"border-[#343536] hover:border-[#4F4F51]":"border-gray-300 hover:border-gray-400"),children:[(0,s.jsx)(n.Z,{className:"w-12 h-12 sm:w-16 sm:h-16 mx-auto mb-3 sm:mb-4 ".concat(v?"text-blue-500":h?"text-[#818384]":"text-gray-400")}),(0,s.jsx)("h3",{className:"text-lg sm:text-xl font-semibold mb-2 ".concat(h?"text-white":"text-gray-900"),children:v?"Drop your resume here":"Upload Your Resume"}),(0,s.jsx)("p",{className:"mb-4 sm:mb-6 text-sm sm:text-base ".concat(h?"text-[#818384]":"text-gray-500"),children:"Drag and drop your PDF or DOCX file here, or click to browse"}),(0,s.jsx)("input",{type:"file",accept:".pdf,.docx",onChange:L,className:"absolute inset-0 w-full h-full opacity-0 cursor-pointer"}),(0,s.jsx)(l.E.button,{whileHover:{scale:1.05},whileTap:{scale:.95},className:"bg-blue-600 hover:bg-blue-700 text-white px-6 py-3 rounded-full font-semibold transition-colors",children:"Choose File"}),(0,s.jsx)("p",{className:"text-xs mt-4 ".concat(h?"text-[#818384]":"text-gray-500"),children:"Supports PDF and DOCX files up to 10MB"})]}),(0,s.jsxs)("div",{className:"grid grid-cols-1 gap-4 border-t border-[var(--color-border)] pt-6 sm:grid-cols-3",children:[(0,s.jsxs)("div",{className:"group text-center transition-transform hover:scale-[1.02]",children:[(0,s.jsx)("div",{className:"mx-auto mb-3 flex h-12 w-12 items-center justify-center rounded-xl bg-gradient-to-br from-[#0079D3] to-blue-600 shadow-lg",children:(0,s.jsx)(c.Z,{className:"h-6 w-6 text-white"})}),(0,s.jsx)("h4",{className:"mb-1 font-semibold text-[var(--color-text)]",children:"\uD83C\uDFAF Smart AI parsing"}),(0,s.jsx)("p",{className:"text-xs text-[var(--color-text-secondary)]",children:"Structured fields with high fidelity"})]}),(0,s.jsxs)("div",{className:"group text-center transition-transform hover:scale-[1.02]",children:[(0,s.jsx)("div",{className:"mx-auto mb-3 flex h-12 w-12 items-center justify-center rounded-xl bg-gradient-to-br from-green-500 to-emerald-600 shadow-lg",children:(0,s.jsx)(d.Z,{className:"h-6 w-6 text-white"})}),(0,s.jsx)("h4",{className:"mb-1 font-semibold text-[var(--color-text)]",children:"â¡ Instant auto-fill"}),(0,s.jsx)("p",{className:"text-xs text-[var(--color-text-secondary)]",children:"Your wizard updates in seconds"})]}),(0,s.jsxs)("div",{className:"group text-center transition-transform hover:scale-[1.02]",children:[(0,s.jsx)("div",{className:"mx-auto mb-3 flex h-12 w-12 items-center justify-center rounded-xl bg-gradient-to-br from-[#FF4500] to-[#CC3700] shadow-lg",children:(0,s.jsx)(n.Z,{className:"h-6 w-6 text-white"})}),(0,s.jsx)("h4",{className:"mb-1 font-semibold text-[var(--color-text)]",children:"\uD83D\uDE80 Drag & drop"}),(0,s.jsx)("p",{className:"text-xs text-[var(--color-text-secondary)]",children:"PDF / DOCX â we handle the heavy lift"})]})]})]})}),P?(0,s.jsx)("div",{role:"presentation",className:"fixed inset-0 z-[70] flex items-center justify-center bg-black/55 p-4 backdrop-blur-[1px]",onClick:()=>Z(!1),children:(0,s.jsxs)("div",{role:"dialog","aria-modal":"true","aria-labelledby":"resume-extract-error-title",className:"w-full max-w-lg rounded-2xl border border-[var(--color-border)] bg-[var(--color-surface)] p-6 text-center shadow-2xl",onClick:e=>e.stopPropagation(),children:[(0,s.jsx)("div",{className:"flex justify-center",children:(0,s.jsx)(x.Z,{className:"h-10 w-10 text-red-500"})}),(0,s.jsx)("h3",{id:"resume-extract-error-title",className:"mt-4 text-lg font-semibold text-[var(--color-text)]",children:"Heads up â we could not parse this file \uD83D\uDCCE"}),(0,s.jsx)("p",{className:"mt-2 text-sm leading-relaxed text-[var(--color-text-secondary)]",children:k||"The file may be image-only or corrupted. Try a PDF with selectable text or an exported DOCX."}),(0,s.jsxs)("div",{className:"mt-6 flex flex-col justify-center gap-2 sm:flex-row sm:gap-3",children:[(0,s.jsx)(m.zx,{variant:"primary",onClick:()=>{Z(!1),C("idle"),S("")},children:"Try again"}),(0,s.jsx)(m.zx,{variant:"outline",onClick:()=>{Z(!1),B()},children:"Pick another file"})]})]})}):null]})})}}}]);
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.