1import{i as U,r as u,aM as $,aN as B,j as e,d as b,L as N,aP as v,aQ as J,aR as O}from"./index-BhKFgU4O.js";import{E as g}from"./EmailGate-aRCJ8UwW.js";import{F as V}from"./file-spreadsheet-CtCebq6G.js";import{E as y}from"./eye-CBQnVW0_.js";import{C as w}from"./circle-check-CH-Qgjsm.js";import{C as A}from"./circle-x-DOrGm-9f.js";import{T as M}from"./triangle-alert-D4WkTetw.js";import{C as k}from"./circle-question-mark-DAy0z5hz.js";import{S as I}from"./search-check-C_Y7u1Bm.js";import"./button-B8diw7lv.js";import"./utils-CT6uuaim.js";import"./download-CzKB72gp.js";const P={verified:"text-status-verified",invalid:"text-destructive","catch-all":"text-amber-500",catchall:"text-amber-500",unknown:"text-muted-foreground",found:"text-status-verified",not_found:"text-muted-foreground"};function ae(){const{token:t,info:l,leadEmail:n,setLeadEmail:i,refresh:d}=U(),[f,S]=u.useState([]),[p,L]=u.useState([]),[h,R]=u.useState([]),[C,_]=u.useState(!0);if(u.useEffect(()=>{l.link_type&&Promise.all([$(t).then(s=>S(s.items)),B(t).then(s=>{L(s.verify_jobs),R(s.finder_jobs)})]).catch(()=>{}).finally(()=>_(!1))},[t,l.link_type]),!l.link_type)return e.jsx("div",{className:"flex justify-center py-12",children:e.jsx(b,{className:"h-6 w-6 animate-spin text-muted-foreground"})});const j=async(s,r)=>{n||(await v(t,r),i(r),await d());const x=await J(t,s,r),a=URL.createObjectURL(x),c=document.createElement("a");c.href=a,c.download="filtrat-results.csv",c.click(),URL.revokeObjectURL(a)},E=async s=>{n||(await v(t,s),i(s),await d());const r=await O(t,s);if(!r.results.length)return;const x=[Object.keys(r.results[0]).join(","),...r.results.map(F=>Object.values(F).map(D=>`"${String(D??"").replace(/"/g,'""')}"`).join(","))],a=new Blob([x.join(` 2`)],{type:"text/csv"}),c=URL.createObjectURL(a),m=document.createElement("a");m.href=c,m.download="filtrat-single-results.csv",m.click(),URL.revokeObjectURL(c)},T=f.length>0||p.length>0||h.length>0;return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-xl font-bold tracking-tight text-foreground",children:"Results & Export"}),e.jsx("p",{className:"mt-0.5 text-sm text-muted-foreground",children:"All your verification and finder results in one place."})]}),C?e.jsx("div",{className:"flex justify-center py-12",children:e.jsx(b,{className:"h-6 w-6 animate-spin text-muted-foreground"})}):T?e.jsxs(e.Fragment,{children:[p.length>0&&e.jsxs("section",{className:"space-y-3",children:[e.jsx("h2",{className:"text-sm font-medium uppercase tracking-widest text-muted-foreground",children:"Bulk Verification Jobs"}),p.map(s=>e.jsx(Q,{job:s,token:t,leadEmail:n,onDownload:r=>j(s.id,r)},s.id))]}),h.length>0&&e.jsxs("section",{className:"space-y-3",children:[e.jsx("h2",{className:"text-sm font-medium uppercase tracking-widest text-muted-foreground",children:"Bulk Finder Jobs"}),h.map(s=>e.jsx(G,{job:s,token:t,leadEmail:n,onDownload:r=>j(s.id,r)},s.id))]}),f.length>0&&e.jsxs("section",{className:"space-y-3",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("h2",{className:"text-sm font-medium uppercase tracking-widest text-muted-foreground",children:["Single Results (",f.length,")"]}),e.jsx(g,{leadEmail:n,onSubmit:E})]}),e.jsx("div",{className:"rounded-2xl border border-border bg-card",children:e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"w-full text-sm",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"border-b border-border text-left text-xs font-medium uppercase tracking-widest text-muted-foreground",children:[e.jsx("th",{className:"px-4 py-3",children:"Email"}),e.jsx("th",{className:"px-4 py-3",children:"Status"}),e.jsx("th",{className:"px-4 py-3",children:"Confidence"}),e.jsx("th",{className:"px-4 py-3",children:"Time"})]})}),e.jsx("tbody",{children:[...f].reverse().map((s,r)=>{const x=s.action==="verify"?String(s.result.email||s.input_data):String(s.result.found_email||"â"),a=String(s.result.status||""),c=s.result.confidence!=null?`${s.result.confidence}%`:"â",m=a==="verified"?"Deliverable":a==="invalid"?"Invalid":a==="found"?"Found":a==="not_found"?"Not found":a==="catch-all"||a==="c
2atchall"?"Catch-All":a||"â";return e.jsxs("tr",{className:"border-b border-border/50 last:border-0",children:[e.jsx("td",{className:"px-4 py-2.5",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:`shrink-0 rounded-full px-2 py-0.5 text-[10px] font-medium ${s.action==="verify"?"bg-blue-500/10 text-blue-500":"bg-purple-500/10 text-purple-500"}`,children:s.action==="verify"?"V":"F"}),e.jsx("span",{className:"text-foreground",children:x})]})}),e.jsx("td",{className:"px-4 py-2.5",children:e.jsx("span",{className:`text-xs font-medium ${P[a]||"text-muted-foreground"}`,children:m})}),e.jsx("td",{className:"px-4 py-2.5 text-xs text-muted-foreground",children:c}),e.jsx("td",{className:"px-4 py-2.5 text-xs text-muted-foreground",children:new Date(s.created_at).toLocaleString(void 0,{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})})]},r)})})]})})})]})]}):e.jsx("div",{className:"rounded-2xl border border-dashed border-border bg-card p-12 text-center",children:e.jsx("p",{className:"text-sm text-muted-foreground",children:"No results yet. Start by verifying emails or finding contacts."})})]})}function Q({job:t,token:l,leadEmail:n,onDownload:i}){const d=t.status==="completed";return e.jsxs("div",{className:"rounded-2xl border border-border bg-card p-5",children:[e.jsxs("div",{className:"flex items-start justify-between gap-3",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"rounded-lg bg-blue-500/10 p-2",children:e.jsx(V,{className:"h-5 w-5 text-blue-500"})}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium text-foreground",children:t.file_name}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:[t.total," emails · ",new Date(t.created_at).toLocaleDateString(),!d&&e.jsxs("span",{className:"ml-2 text-amber-500",children:["(",t.status,")"]})]})]})]}),e.jsx("div",{className:"flex items-center gap-2",children:d&&e.jsxs(e.Fragment,{children:[e.jsxs(N,{to:`/try/${l}/bulk-results/${t.id}`,className:"inline-flex items-center gap-1.5 rounded-lg border border-border px-3 py-1.5 text-xs font-medium text-foreground hover:bg-secondary",children:[e.jsx(y,{className:"h-3.5 w-3.5"})," View results"]}),e.jsx(g,{leadEmail:n,onSubmit:i})]})})]}),e.jsxs("div",{className:"mt-3 grid grid-cols-4 gap-2",children:[e.jsx(o,{icon:w,label:"Deliverable",value:t.verified,color:"text-status-verified"}),e.jsx(o,{icon:A,label:"Invalid",value:t.invalid,color:"text-destructive"}),e.jsx(o,{icon:M,label:"Catch-all",value:t.catchall,color:"text-amber-500"}),e.jsx(o,{icon:k,label:"Unknown",value:t.unknown,color:"text-muted-foreground"})]})]})}function G({job:t,token:l,leadEmail:n,onDownload:i}){const d=t.status==="completed";return e.jsxs("div",{className:"rounded-2xl border border-border bg-card p-5",children:[e.jsxs("div",{className:"flex items-start justify-between gap-3",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"rounded-lg bg-purple-500/10 p-2",children:e.jsx(I,{className:"h-5 w-5 text-purple-500"})}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium text-foreground",children:t.file_name}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:[t.total," contacts · ",new Date(t.created_at).toLocaleDateString(),!d&&e.jsxs("span",{className:"ml-2 text-amber-500",children:["(",t.status,")"]})]})]})]}),e.jsx("div",{className:"flex items-center gap-2",children:d&&e.jsxs(e.Fragment,{children:[e.jsxs(N,{to:`/try/${l}/bulk-results/${t.id}`,className:"inline-flex items-center gap-1.5 rounded-lg border border-border px-3 py-1.5 text-xs font-medium text-foreground hover:bg-secondary",children:[e.jsx(y,{className:"h-3.5 w-3.5"})," View results"]}),e.jsx(g,{leadEmail:n,onSubmit:i})]})})]}),e.jsxs("div",{className:"mt-3 grid grid-cols-2 gap-2",children:[e.jsx(o,{icon:w,label:"Found",value:t.found,color:"text-status-verified"}),e.jsx(o,{icon:k,label:"Not found",value:t.not_found,color:"text-muted-foreground"})]})]})}function o({icon:t,label:l,value:n,color:i}){return e.jsxs("div",{className:"flex items-center gap-1.5 rounded-lg bg-secondary/50 px-2.5 py-1.5",children:[e.jsx(t,{className:`h-3.5 w-3.5 ${i}`}),e.jsx("span",{className:"text-xs text-muted-foreground",children:l}),e.jsx("span",{className:`ml-auto text-sm font-semibold ${i}`,children:n})]})}export{ae as component};
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.