1import{d as x,r as i,j as t,L as l,X as f}from"./index-BxMItG-b.js";import{L as g}from"./loader-circle-CRirUgms.js";import{F as p}from"./file-text-ByofHTwl.js";import{C as v}from"./circle-check-D9xMYh3n.js";const w=6e3;function C(){const{data:a=[]}=x({queryKey:["/api/candidates/processing"],refetchInterval:4e3,refetchIntervalInBackground:!1}),o=i.useRef(new Set),[n,m]=i.useState([]),[h,u]=i.useState(new Set);i.useEffect(()=>{const e=new Set(a.map(r=>r.id)),s=[];for(const r of o.current)e.has(r)||s.push({id:r,name:"Candidate",shownAt:Date.now()});s.length>0&&m(r=>[...r,...s]),o.current=e},[a]);const c=i.useRef(new Map);i.useEffect(()=>{for(const e of a){const s=`${e.firstName} ${e.lastName}`.trim()||e.cvFileName||"Candidate";c.current.set(e.id,s)}},[a]),i.useEffect(()=>{if(n.length===0)return;const e=setInterval(()=>{m(s=>s.filter(r=>Date.now()-r.shownAt<w))},1e3);return()=>clearInterval(e)},[n.length]);const d=a.filter(e=>!h.has(e.id));return d.length>0||n.length>0?t.jsxs("div",{className:"fixed bottom-4 right-4 z-50 w-80 max-w-[calc(100vw-2rem)] flex flex-col gap-2","data-testid":"widget-cv-upload-progress",children:[d.length>0&&t.jsxs("div",{className:"rounded-lg border border-border bg-card shadow-lg overflow-hidden",children:[t.jsxs("div",{className:"flex items-center justify-between gap-2 px-3 py-2 border-b border-border bg-muted/40",children:[t.jsxs("div",{className:"flex items-center gap-2 text-sm font-semibold",children:[t.jsx(g,{className:"h-3.5 w-3.5 animate-spin text-primary"}),"Importing ",d.length," CV",d.length===1?"":"s"]}),t.jsx(l,{href:"/candidates",className:"text-xs text-muted-foreground hover:text-foreground","data-testid":"link-view-candidates",children:"View all"})]}),t.jsx("ul",{className:"max-h-72 overflow-y-auto divide-y divide-border",children:d.map(e=>{const s=`${e.firstName} ${e.lastName}`.trim()||e.cvFileName||"Candidate";return t.jsxs("li",{className:"px-3 py-2.5 flex items-start gap-2.5","data-testid":`row-processing-${e.id}`,children:[t.jsx(p,{className:"h-3.5 w-3.5 text-muted-foreground mt-0.5 shrink-0"}),t.jsxs("div",{className:"flex-1 min-w-0",children:[t.jsx(l,{href:`/candidates/${e.id}`,className:"text-sm font-medium truncate block hover:underline","data-testid":`link-processing-${e.id}`,children:s}),t.jsx("div",{className:"text-xs text-muted-foreground mt-0.5",children:"Formatting CVâ¦"}),t.jsx("div",{className:"mt-1.5 h-1 w-full bg-muted rounded-full overflow-hidden",children:t.jsx("div",{className:"indeterminate-bar h-full bg-primary rounded-full"})})]}),t.jsx("button",{type:"button",onClick:()=>u(r=>new Set(r).add(e.id)),className:"text-muted-foreground hover:text-foreground p-0.5 -mr-1 -mt-1 shrink-0","aria-label":"Hide from this list","data-testid":`button-dismiss-processing-${e.id}`,children:t.jsx(f,{className:"h-3.5 w-3.5"})})]},e.id)})})]}),n.map(e=>{const s=c.current.get(e.id)||e.name;return t.jsxs("div",{className:"rounded-lg border border-border bg-card shadow-lg px-3 py-2.5 flex items-center gap-2.5 animate-in slide-in-from-right-4 fade-in","data-testid":`toast-finished-${e.id}`,children:[t.jsx(v,{className:"h-4 w-4 text-emerald-500 shrink-0"}),t.jsxs("div",{className:"flex-1 min-w-0",children:[t.jsxs("div",{className:"text-sm font-medium truncate",children:[s," added"]}),t.jsx("div",{className:"text-xs text-muted-foreground",children:"CV formatted successfully"})]}),t.jsx(l,{href:`/candidates/${e.id}`,className:"text-xs text-primary hover:underline shrink-0","data-testid":`link-finished-${e.id}`,children:"Open"})]},e.id)})]}):null}export{C as CvUploadProgressWidget};
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.