import{r as c,k as e}from"./index-BVfpSx5Q.js";import{L as S}from"./layout-NiehYZnq.js";import{P as T,K as u,C as I}from"./ui-DGkmnhL-.js";const r="#c9b787",m={Critical:"#ef4444",High:"#f97316",Medium:"#c9b787",Low:"#8a8a8a"},w={Maritime:"#8a8a8a",Legal:"#c9b787",Revenue:"#c9b787",Defense:"#f5f5f5",Finance:"#c9b787","Real Estate":"#8a8a8a"},y=[{id:"aq-001",title:"MV Cascade port standby authorization — 48h, $14,200/day",domain:"Maritime",agent:"Cascade Navigator",agentRole:"Domain Specialist — Vessels Maritime",risk:"High",urgency:"T-2h deadline",requestedAt:"2026-04-26T10:30:00Z",why:"MV Cascade is 18h behind schedule due to Tanjung Pelepas congestion. Port standby avoids demurrage exposure of $42,000 by repositioning to anchorage. Three alternatives evaluated; standby is optimal.",evidence:["sig-001","ais-feed-cascade","pol-maritime-002"],estimatedImpact:"Avoids $42,000 demurrage · Cost: $14,200/day · ETA improvement: 18h",requiresApprover:"VP Operations",mirrorEvalScore:94,status:"pending"},{id:"aq-002",title:"Talbot matter — escalate discovery to lead counsel and external co-counsel",domain:"Legal",agent:"Counsel Sentinel",agentRole:"Domain Specialist — Prism Counsel",risk:"Critical",urgency:"T-48h court deadline",requestedAt:"2026-04-26T08:00:00Z",why:"Discovery deadline is T-48h. 340 documents outstanding in the Talbot matter. Production delay risk: adverse inference motion. Escalation to co-counsel is required to meet production schedule.",evidence:["sig-002","clio-matter-4421","pol-legal-003"],estimatedImpact:"Avoids adverse inference motion · Risk exposure: $2.1M settlement range",requiresApprover:"General Counsel",mirrorEvalScore:98,status:"pending"},{id:"aq-003",title:"Pipeline intervention — engage 3 at-risk Q2 accounts with executive outreach",domain:"Revenue",agent:"Pipeline Oracle",agentRole:"Domain Specialist — Lyte Revenue",risk:"Medium",urgency:"Next 72h window",requestedAt:"2026-04-25T22:15:00Z",why:"Three accounts (Meridian, Apex, NovaTech) show 85%+ churn probability based on engagement signals. Executive-level outreach has 3.2x conversion rate vs. standard rep cadence for this segment.",evidence:["sig-003","salesforce-opp-2234","pol-revenue-001"],estimatedImpact:"Revenue at risk: $840K ARR · Recovery probability: 65% with exec outreach",requiresApprover:"VP Revenue",mirrorEvalScore:88,status:"pending"},{id:"aq-004",title:"Capex variance acknowledgment — Q1 $340K over budget in Tech Infrastructure",domain:"Finance",agent:"Fabric Watchdog",agentRole:"System — A11oy Core",risk:"Medium",urgency:"Board reporting T-5d",requestedAt:"2026-04-25T18:00:00Z",why:"Q1 capex variance of $340K (8.2%) in Tech Infrastructure category exceeds the 5% policy threshold. Board packet requires acknowledgment before report generation. No corrective action required.",evidence:["sig-007","erp-q1-variance","pol-finance-001"],estimatedImpact:"Board compliance · No financial action required · Acknowledge only",requiresApprover:"CFO Delegate",mirrorEvalScore:99,status:"pending"},{id:"aq-005",title:"Tier Omega property — authorize LOI submission at $28.5M",domain:"Real Estate",agent:"Terra Analyst",agentRole:"Domain Specialist — Terra Real Estate",risk:"High",urgency:"Seller deadline T-24h",requestedAt:"2026-04-25T14:30:00Z",why:"Cap rate analysis shows 7.8% yield at $28.5M — above fund threshold of 7.2%. Seller deadline is 24h. Comps support valuation. LOI is non-binding but secures exclusivity.",evidence:["sig-006","costar-prop-88821","pol-terra-004"],estimatedImpact:"Secures exclusivity · Cap rate: 7.8% · Fund hurdle: 7.2% · Non-binding LOI",requiresApprover:"Investment Committee Chair",mirrorEvalScore:82,status:"pending"}],O=["All","Maritime","Legal","Revenue","Finance","Real Estate","Defense"],q=["All","Critical","High","Medium","Low"];function M(){const[l,b]=c.useState("All"),[i,f]=c.useState("All"),[N,j]=c.useState("aq-001"),[v,C]=c.useState({}),[A,k]=c.useState({}),d=y.filter(o=>(l==="All"||o.domain===l)&&(i==="All"||o.risk===i)),E=d.filter(o=>!v[o.id]).length;function s(o,a){C(x=>({...x,[o]:a}))}const n={approved:"#22c55e",rejected:"#ef4444",escalated:"#f97316",deferred:"#8a8a8a",evidence_requested:"#c9b787"};return e.jsxs(S,{children:[e.jsx(T,{label:"HUMAN APPROVAL QUEUE",title:"Pending Action Approvals",subtitle:"Every material action proposed by A11oy operators awaits explicit human approval here. No action executes without your decision.",status:"LIVE"}),e.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-4 gap-3 mb-8",children:[e.jsx(u,{label:"PENDING DECISIONS",value:E,sub:"awaiting approval",accent:r}),e.jsx(u,{label:"CRITICAL RISK",value:y.filter(o=>o.risk==="Critical").length,sub:"highest priority",accent:"#ef4444"}),e.jsx(u,{label:"APPROVED TODAY",value:3,sub:"actions taken",accent:r}),e.jsx(u,{label:"AVG EVAL SCORE",value:"92%",sub:"MirrorEval confidence",accent:r})]}),e.jsxs("div",{className:"flex flex-wrap gap-3 mb-6",children:[e.jsxs("div",{className:"flex gap-1 flex-wrap",children:[e.jsx("span",{className:"text-xs self-center font-mono mr-1",style:{color:"var(--color-a11oy-text-ghost)"},children:"Domain:"}),O.map(o=>e.jsx("button",{onClick:()=>b(o),className:"text-xs px-2.5 py-1 rounded font-mono",style:{backgroundColor:l===o?"rgba(201,183,135,0.15)":"var(--color-a11oy-muted)",color:l===o?r:"var(--color-a11oy-text-ghost)",border:`1px solid ${l===o?"rgba(201,183,135,0.3)":"transparent"}`,cursor:"pointer"},children:o},o))]}),e.jsxs("div",{className:"flex gap-1 flex-wrap",children:[e.jsx("span",{className:"text-xs self-center font-mono mr-1",style:{color:"var(--color-a11oy-text-ghost)"},children:"Risk:"}),q.map(o=>e.jsx("button",{onClick:()=>f(o),className:"text-xs px-2.5 py-1 rounded font-mono",style:{backgroundColor:i===o?`${m[o]??"rgba(201,183,135,0.15)"}22`:"var(--color-a11oy-muted)",color:i===o?m[o]??r:"var(--color-a11oy-text-ghost)",border:`1px solid ${i===o?(m[o]??r)+"40":"transparent"}`,cursor:"pointer"},children:o},o))]}),e.jsxs("span",{className:"text-xs self-center",style:{color:"var(--color-a11oy-text-ghost)"},children:[d.length," actions"]})]}),e.jsxs("div",{className:"flex flex-col gap-3",children:[d.map(o=>{const a=m[o.risk]??r,x=w[o.domain]??r,h=N===o.id,t=v[o.id],g=!!t;return e.jsxs(I,{style:{borderLeft:`3px solid ${a}`,opacity:g?.65:1},children:[e.jsxs("div",{className:"flex items-start justify-between gap-4 cursor-pointer",onClick:()=>j(h?null:o.id),children:[e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1 flex-wrap",children:[e.jsxs("span",{className:"text-xs font-mono px-1.5 py-0.5 rounded",style:{backgroundColor:`${a}18`,color:a,border:`1px solid ${a}30`},children:[o.risk," risk"]}),e.jsx("span",{className:"text-xs font-mono px-1.5 py-0.5 rounded",style:{backgroundColor:`${x}12`,color:x},children:o.domain}),e.jsx("span",{className:"text-xs font-mono",style:{color:"var(--color-a11oy-text-ghost)"},children:o.urgency}),g&&e.jsx("span",{className:"text-xs font-mono px-1.5 py-0.5 rounded",style:{backgroundColor:`${n[t]??r}18`,color:n[t]??r},children:t.replace(/_/g," ")})]}),e.jsx("div",{className:"text-sm font-semibold",style:{color:"var(--color-a11oy-text)"},children:o.title}),e.jsxs("div",{className:"text-xs mt-1",style:{color:"var(--color-a11oy-text-ghost)"},children:["Requested by ",e.jsx("span",{style:{color:"var(--color-a11oy-text-sub)"},children:o.agent})," · ",o.agentRole," · MirrorEval: ",e.jsxs("span",{style:{color:r},children:[o.mirrorEvalScore,"%"]})]})]}),e.jsxs("div",{className:"text-xs font-mono flex-shrink-0 text-right",style:{color:"var(--color-a11oy-text-ghost)"},children:[e.jsxs("div",{children:["Approver: ",e.jsx("span",{style:{color:"var(--color-a11oy-text-sub)"},children:o.requiresApprover})]}),e.jsx("div",{className:"mt-0.5",children:new Date(o.requestedAt).toLocaleTimeString("en-US",{hour:"2-digit",minute:"2-digit"})})]})]}),h&&e.jsxs("div",{className:"mt-4 space-y-4 border-t pt-4",style:{borderColor:"var(--color-a11oy-border)"},children:[e.jsxs("div",{className:"grid sm:grid-cols-2 gap-4",children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-xs font-mono mb-1.5",style:{color:"var(--color-a11oy-text-ghost)"},children:"WHY THIS ACTION"}),e.jsx("p",{className:"text-xs leading-relaxed",style:{color:"var(--color-a11oy-text-sub)"},children:o.why})]}),e.jsxs("div",{children:[e.jsx("div",{className:"text-xs font-mono mb-1.5",style:{color:"var(--color-a11oy-text-ghost)"},children:"ESTIMATED IMPACT"}),e.jsx("div",{className:"text-xs p-2.5 rounded",style:{backgroundColor:"rgba(201,183,135,0.06)",border:"1px solid rgba(201,183,135,0.15)",color:r},children:o.estimatedImpact})]})]}),e.jsxs("div",{children:[e.jsx("div",{className:"text-xs font-mono mb-1.5",style:{color:"var(--color-a11oy-text-ghost)"},children:"EVIDENCE REFERENCES"}),e.jsx("div",{className:"flex flex-wrap gap-1.5",children:o.evidence.map(p=>e.jsx("span",{className:"text-xs font-mono px-2 py-1 rounded",style:{backgroundColor:"var(--color-a11oy-deep)",border:"1px solid var(--color-a11oy-border)",color:"var(--color-a11oy-text-ghost)"},children:p},p))})]}),e.jsxs("div",{children:[e.jsx("div",{className:"text-xs font-mono mb-1.5",style:{color:"var(--color-a11oy-text-ghost)"},children:"OPERATOR NOTES (OPTIONAL)"}),e.jsx("textarea",{value:A[o.id]??"",onChange:p=>k(R=>({...R,[o.id]:p.target.value})),placeholder:"Add context, conditions, or modifications to your decision...",className:"w-full text-xs px-3 py-2 rounded",rows:2,style:{backgroundColor:"var(--color-a11oy-deep)",border:"1px solid var(--color-a11oy-border)",color:"var(--color-a11oy-text)",resize:"vertical",outline:"none"}})]}),g?e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("span",{className:"text-xs font-mono px-3 py-1.5 rounded",style:{backgroundColor:`${n[t]}18`,color:n[t],border:`1px solid ${n[t]}30`},children:["Decision recorded: ",t.replace(/_/g," ")]}),e.jsx("button",{onClick:()=>s(o.id,null),className:"text-xs",style:{color:"var(--color-a11oy-text-ghost)",background:"none",border:"none",cursor:"pointer"},children:"Undo"})]}):e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsx("button",{onClick:()=>s(o.id,"approved"),className:"text-xs px-4 py-2 rounded font-medium",style:{backgroundColor:"rgba(34,197,94,0.12)",color:"#22c55e",border:"1px solid rgba(34,197,94,0.3)",cursor:"pointer"},children:"✓ Approve"}),e.jsx("button",{onClick:()=>s(o.id,"rejected"),className:"text-xs px-4 py-2 rounded font-medium",style:{backgroundColor:"rgba(239,68,68,0.1)",color:"#ef4444",border:"1px solid rgba(239,68,68,0.25)",cursor:"pointer"},children:"✕ Reject"}),e.jsx("button",{onClick:()=>s(o.id,"evidence_requested"),className:"text-xs px-4 py-2 rounded font-medium",style:{backgroundColor:"rgba(201,183,135,0.1)",color:r,border:"1px solid rgba(201,183,135,0.2)",cursor:"pointer"},children:"⊙ Request Evidence"}),e.jsx("button",{onClick:()=>s(o.id,"escalated"),className:"text-xs px-4 py-2 rounded font-medium",style:{backgroundColor:"rgba(249,115,22,0.1)",color:"#f97316",border:"1px solid rgba(249,115,22,0.2)",cursor:"pointer"},children:"↑ Escalate"}),e.jsx("button",{onClick:()=>s(o.id,"deferred"),className:"text-xs px-4 py-2 rounded font-medium",style:{backgroundColor:"var(--color-a11oy-muted)",color:"var(--color-a11oy-text-ghost)",border:"1px solid var(--color-a11oy-border)",cursor:"pointer"},children:"⏸ Defer"})]})]})]},o.id)}),d.length===0&&e.jsx("div",{className:"py-16 text-center text-sm",style:{color:"var(--color-a11oy-text-ghost)"},children:"No pending actions match the current filters."})]}),e.jsx("div",{className:"mt-6 p-3 rounded-lg text-xs",style:{backgroundColor:"rgba(201,183,135,0.04)",border:"1px solid rgba(201,183,135,0.12)",color:"var(--color-a11oy-text-ghost)"},children:"Approval decisions are cryptographically signed, logged to the Proof Ledger, and trigger governed execution immediately."})]})}export{M as ApprovalQueue};