1import{w as F,r as i,j as e,al as I,T as k,bq as j,c6 as C,bG as S,C as E,R as A,e9 as U,au as V,av as L,dv as P,bK as M}from"./vendor-CJ3Pa3Ob.js";import{ao as f,cb as x,cc as m,cd as h,ce as u,cg as v}from"./index-CT7QwV5N.js";import{s as q}from"./screening-UloFvbJR.js";function z({verdict:r}){const s={go:{variant:"success",label:"GO",Icon:S},no_go:{variant:"destructive",label:"NO-GO",Icon:E},dig_deeper:{variant:"warning",label:"DIG DEEPER",Icon:j}},t=s[r.verdict]??s.dig_deeper,l=t.Icon;return e.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[e.jsxs(v,{variant:t.variant,className:"gap-1",children:[e.jsx(l,{className:"h-3 w-3"}),t.label]}),e.jsxs("span",{className:"text-xs text-app-text-muted",children:[Math.round(r.confidence*100),"%"]})]})}function H({tier:r}){if(!r)return e.jsx("span",{className:"text-app-text-muted",children:"--"});const s={A:"bg-emerald-500/20 text-emerald-400 border-emerald-500/30",B:"bg-blue-500/20 text-blue-400 border-theme-accent",C:"bg-amber-500/20 text-amber-400 border-amber-500/30",D:"bg-red-500/20 text-red-400 border-red-500/30",F:"bg-red-500/20 text-red-400 border-red-500/30"},t=s[r.toUpperCase()]??s.C;return e.jsx("span",{className:`inline-flex h-6 w-6 items-center justify-center rounded-md border text-xs font-bold ${t}`,children:r.toUpperCase()})}function K({value:r}){const s=Math.round(r*100);return e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"h-1.5 w-24 overflow-hidden rounded-full bg-white/5",children:e.jsx("div",{className:"h-full rounded-full bg-[var(--theme-button-primary-bg)] transition-all",style:{width:`${s}%`}})}),e.jsxs("span",{className:"text-xs text-app-text-muted",children:[s,"%"]})]})}function X({deal:r}){const s=r.playbook_verdict;return s?e.jsx("tr",{children:e.jsxs("td",{colSpan:7,className:"border-b border-app-border px-6 pb-4 pt-0",children:[e.jsxs("div",{className:"grid gap-4 md:grid-cols-2 lg:grid-cols-4",children:[s.triggered_rules&&s.triggered_rules.length>0&&e.jsxs("div",{children:[e.jsx("h4",{className:"mb-1.5 text-xs font-semibold uppercase tracking-wider text-app-text-muted",children:"Triggered Rules"}),e.jsx("ul",{className:"space-y-1",children:s.triggered_rules.map((t,l)=>e.jsxs("li",{className:"flex items-start gap-1.5 text-xs text-app-text",children:[e.jsx(P,{className:"mt-0.5 h-3 w-3 shrink-0 text-amber-400"}),e.jsx("span",{children:t.rule_name})]},l))})]}),s.red_flags&&s.red_flags.length>0&&e.jsxs("div",{children:[e.jsx("h4",{className:"mb-1.5 text-xs font-semibold uppercase tracking-wider text-app-text-muted",children:"Red Flags"}),e.jsx("ul",{className:"space-y-1",children:s.red_flags.map((t,l)=>e.jsxs("li",{className:"flex items-start gap-1.5 text-xs text-red-400",children:[e.jsx(k,{className:"mt-0.5 h-3 w-3 shrink-0"}),t]},l))})]}),s.opportunity_signals&&s.opportunity_signals.length>0&&e.jsxs("div",{children:[e.jsx("h4",{className:"mb-1.5 text-xs font-semibold uppercase tracking-wider text-app-text-muted",children:"Opportunities"}),e.jsx("ul",{className:"space-y-1",children:s.opportunity_signals.map((t,l)=>e.jsxs("li",{className:"flex items-start gap-1.5 text-xs text-emerald-400",children:[e.jsx(M,{className:"mt-0.5 h-3 w-3 shrink-0"}),t]},l))})]}),s.investigation_items&&s.investigation_items.length>0&&e.jsxs("div",{children:[e.jsx("h4",{className:"mb-1.5 text-xs font-semibold uppercase tracking-wider text-app-text-muted",children:"Investigation Items"}),e.jsx("ul",{className:"space-y-1",children:s.investigation_items.map((t,l)=>e.jsxs("li",{className:"flex items-start gap-1.5 text-xs text-app-text",children:[e.jsx(j,{className:"mt-0.5 h-3 w-3 shrink-0 text-blue-400"}),t]},l))})]})]}),s.confidence!=null&&e.jsxs("div",{className:"mt-3",children:[e.jsx("span",{className:"mr-2 text-xs text-app-text-muted",children:"Confidence"}),e.jsx(K,{value:s.confidence})]})]})}):null}const o={background:"var(--glass-bg)",borderColor:"var(--glass-border)",boxShadow:"var(--glass-shadow)"},Y=({batchId:r})=>{const s=F(),[t,l]=i.useState(null),[D,w]=i.useState(!0),[y,_]=i.useState(null),[R,T]=i.useState(new Set),g=i.useCallback(async()=>{w(!0),_(null);try{const a=await q.getDashboard(r);l(a)}catch(a){console.error("[ScreeningDashboard] Failed to load:",a),_(a instanceof Error?a.message:"Failed to load screening dashboard")}finally{w(!1)}},[r]);i.useEffect(()=>{g()},[g]);const B=a=>{T(p=>{const n=new Set(p);return n.has(a)?n.delete(a):n.add(a),n})};if(D)return e.jsx("div",{className:"flex h-96 items-center justify-center",children:e.jsx(I,{className:"h-8 w-8 animate-spin text-app-text-muted"})});if(y)return e.jsxs("div",{className:"flex h-96 flex-col items-center justify-center gap-4",children:[e.jsx(k,{className:"h-10 w-10 text-amber-400"}),e.jsx("p",{className:"text-app-text-muted",children:y}),e.jsx(f,{variant:"outline",onClick:g,children:"Retry"})]});if(!t||t.deals.length===0)return e.jsxs("div",{className:"flex h-96 flex-col items-center justify-center gap-3",children:[e.jsx(j,{className:"h-10 w-10 text-app-text-muted"}),e.jsx("p",{className:"text-app-text-muted",children:"No deals found in this batch."}),e.jsxs(f,{variant:"outline",onClick:()=>s("/search"),children:[e.jsx(C,{className:"mr-2 h-4 w-4"}),"Back to Search"]})]});const N=t.verdict_summary,G=N?.go??0,O=N?.no_go??0,$=N?.dig_deeper??0;return e.jsxs("div",{className:"space-y-6 p-6",children:[e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsxs(f,{variant:"ghost",size:"sm",onClick:()=>s("/search"),className:"text-app-text-muted hover:text-app-text",children:[e.jsx(C,{className:"mr-1 h-4 w-4"}),"Back"]}),e.jsxs("div",{children:[e.jsx("h1",{className:"text-xl font-semibold text-app-text",children:"Universe Triage"}),e.jsxs("p",{className:"text-sm text-app-text-muted",children:["Batch ",e.jsx("span",{className:"font-mono",children:r.slice(0,20)})," ·"," ",t.total," targets"]})]})]}),e.jsxs("div",{className:"grid gap-4 sm:grid-cols-2 lg:grid-cols-4",children:[e.jsxs(x,{className:"border-app-border",style:o,children:[e.jsx(m,{className:"pb-2",children:e.jsx(h,{className:"text-sm font-medium text-app-text-muted",children:"Total Targets"})}),e.jsxs(u,{children:[e.jsx("p",{className:"text-3xl font-bold text-app-text",children:t.total}),e.jsxs("p",{className:"mt-1 text-xs text-app-text-muted",children:[t.screened," screened · ",t.shortlisted," shortlisted"]})]})]}),e.jsxs(x,{className:"border-app-border",style:o,children:[e.jsx(m,{className:"pb-2",children:e.jsx(h,{className:"text-sm font-medium text-app-text-muted",children:e.jsxs("span",{className:"flex items-center gap-1.5",children:[e.jsx(S,{className:"h-4 w-4 text-emerald-400"}),"GO"]})})}),e.jsx(u,{children:e.jsx("p",{className:"text-3xl font-bold text-emerald-400",children:G})})]}),e.jsxs(x,{className:"border-app-border",style:o,children:[e.jsx(m,{className:"pb-2",children:e.jsx(h,{className:"text-sm font-medium text-app-text-muted",children:e.jsxs("span",{className:"flex items-center gap-1.5",children:[e.jsx(E,{className:"h-4 w-4 text-red-400"}),"NO-GO"]})})}),e.jsx(u,{children:e.jsx("p",{className:"text-3xl font-bold text-red-400",children:O})})]}),e.jsxs(x,{className:"border-app-border",style:o,children:[e.jsx(m,{className:"pb-2",children:e.jsx(h,{className:"text-sm font-medium text-app-text-muted",children:e.jsxs("span",{className:"flex items-center gap-1.5",children:[e.jsx(j,{className:"h-4 w-4 text-amber-400"}),"DIG DEEPER"]})})}),e.jsx(u,{children:e.jsx("p",{className:"text-3xl font-bold text-amber-400",children:$})})]})]}),e.jsx(x,{className:"overflow-hidden border-app-border",style:o,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-app-border text-left",children:[e.jsx("th",{className:"px-6 py-3 text-xs font-semibold uppercase tracking-wider text-app-text-muted",children:"Target"}),e.jsx("th",{className:"px-6 py-3 text-xs font-semibold uppercase tracking-wider text-app-text-muted",children:"Value"}),e.jsx("th",{className:"px-6 py-3 text-xs font-semibold uppercase tracking-wider text-app-text-muted",children:"Score"}),e.jsx("th",{className:"px-6 py-3 text-xs font-semibold uppercase tracking-wider text-app-text-muted",children:"Tier"}),e.jsx("th",{className:"px-6 py-3 text-xs font-semibold uppercase tracking-wider text-app-text-muted",children:"Verdict"}),e.jsx("th",{className:"px-6 py-3 text-xs font-semibold uppercase tracking-wider text-app-text-muted",children:"Signals"}),e.jsx("th",{className:"w-10 px-6 py-3"})]})}
1),e.jsx("tbody",{children:t.deals.map(a=>{const p=R.has(a.deal_id),n=p?V:L,d=a.playbook_verdict;return e.jsxs(A.Fragment,{children:[e.jsxs("tr",{className:"cursor-pointer border-b border-app-border transition-colors hover:bg-white/[0.03]",onClick:()=>s(`/deals/${a.deal_id}`),children:[e.jsx("td",{className:"px-6 py-3",children:e.jsxs("div",{className:"flex items-center gap-2",children:[a.is_shortlisted&&e.jsx(U,{className:"h-4 w-4 shrink-0 fill-amber-400 text-amber-400"}),e.jsx("span",{className:"font-medium text-app-text",children:a.name})]})}),e.jsx("td",{className:"px-6 py-3 text-app-text-muted",children:a.value||"--"}),e.jsx("td",{className:"px-6 py-3 font-mono text-app-text",children:a.overall_score!=null?a.overall_score:"--"}),e.jsx("td",{className:"px-6 py-3",children:e.jsx(H,{tier:a.tier})}),e.jsx("td",{className:"px-6 py-3",children:d?e.jsx(z,{verdict:d}):e.jsx("span",{className:"text-app-text-muted",children:"--"})}),e.jsx("td",{className:"px-6 py-3",children:e.jsxs("div",{className:"flex flex-wrap gap-1",children:[d?.red_flags?.slice(0,2).map((c,b)=>e.jsx(v,{variant:"destructive",className:"text-[10px]",children:c.length>25?`${c.slice(0,25)}...`:c},b)),d?.opportunity_signals?.slice(0,2).map((c,b)=>e.jsx(v,{variant:"success",className:"text-[10px]",children:c.length>25?`${c.slice(0,25)}...`:c},`opp-${b}`))]})}),e.jsx("td",{className:"px-6 py-3",children:d&&e.jsx("button",{onClick:c=>{c.stopPropagation(),B(a.deal_id)},className:"rounded p-1 text-app-text-muted transition-colors hover:bg-white/10 hover:text-app-text",children:e.jsx(n,{className:"h-4 w-4"})})})]}),p&&e.jsx(X,{deal:a})]},a.deal_id)})})]})})})]})};export{Y as default};
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.