import{r as g,k as e}from"./index-BVfpSx5Q.js";import{L as h}from"./layout-NiehYZnq.js";import{P as f,K as r,C as y,a as b,A as i}from"./ui-DGkmnhL-.js";const d=[{id:"act-001",op:"PORT_STANDBY",priority:"urgent",title:"Authorize 48h port standby for MV Cascade",domain:"Maritime",signal:"sig-001",confidence:91,cost:"$14,200/day",approver:"VP Operations",rationale:"Cascade delay exceeds threshold. Alternative berth available at T+6h. Standby minimizes demurrage.",counterfactual:"Without action: $58,000 estimated demurrage exposure at 120h delay."},{id:"act-002",op:"ESCALATE_MATTER",priority:"high",title:"Escalate Talbot discovery package to lead counsel",domain:"Legal",signal:"sig-002",confidence:97,cost:"N/A",approver:"General Counsel",rationale:"3 key documents undelivered T-48h before deadline. Paralegal handoff insufficient.",counterfactual:"Without action: potential default judgment risk, estimated $2.4M exposure."},{id:"act-003",op:"PIPELINE_FLAG",priority:"medium",title:"Flag 3 enterprise deals for VP review call",domain:"Revenue",signal:"sig-003",confidence:85,cost:"N/A",approver:"VP Revenue",rationale:"Pipeline velocity drop is correlated with 3 stalled deals. Direct intervention has 73% success rate.",counterfactual:"Without action: Q2 forecast miss estimated at $1.1M."},{id:"act-004",op:"PORTFOLIO_REVIEW",priority:"low",title:"Schedule Plano portfolio cap rate review",domain:"Real Estate",signal:"sig-004",confidence:72,cost:"N/A",approver:"Asset Manager",rationale:"Cap rate compression of 18bps over 30 days warrants valuation reassessment.",counterfactual:"Deferred review may delay Q3 rebalancing by 6-8 weeks."}],p={urgent:"#f5f5f5",high:"#c9b787",medium:"#c9b787",low:"#c9b787"};function C(){const[s,c]=g.useState({}),l=(o,t)=>c(a=>({...a,[o]:t})),x=Object.values(s).filter(o=>o==="approved").length,m=d.length-Object.keys(s).length;return e.jsxs(h,{children:[e.jsx(f,{label:"ACTION RAIL",title:"Recommended Actions",subtitle:"A11oy's recommendation layer — every proposed action carries its rationale, confidence, counterfactual, and an explicit human approval gate.",status:"LIVE"}),e.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4 mb-8",children:[e.jsx(r,{label:"QUEUED ACTIONS",value:String(m),sub:"Awaiting decision",accent:"#c9b787"}),e.jsx(r,{label:"APPROVED TODAY",value:String(8+x),sub:"Execution complete",accent:"#c9b787"}),e.jsx(r,{label:"AVG CONFIDENCE",value:"86%",sub:"Recommendation score",accent:"#c9b787"}),e.jsx(r,{label:"AUTO-RESOLVED",value:"0",sub:"Human approval required for all",accent:"#8a8a8a"})]}),e.jsx("div",{className:"flex flex-col gap-4",children:d.map(o=>{const t=s[o.id],a={approved:"#22c55e",deferred:"#c9b787",rejected:"#ef4444"},u={approved:"✓ Approved — execution queued",deferred:"⏸ Deferred",rejected:"✕ Rejected"};return e.jsxs(y,{style:{opacity:t==="rejected"?.7:1},children:[e.jsxs("div",{className:"flex items-start justify-between gap-4 mb-3",children:[e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[e.jsx("span",{className:"text-xs font-mono px-1.5 py-0.5 rounded",style:{backgroundColor:`${p[o.priority]}20`,color:p[o.priority]},children:o.priority.toUpperCase()}),e.jsx("span",{className:"text-xs font-mono",style:{color:"var(--color-a11oy-gold)"},children:o.op}),e.jsx("span",{className:"text-xs",style:{color:"var(--color-a11oy-text-ghost)"},children:o.domain})]}),e.jsx("h3",{className:"text-sm font-semibold",style:{color:"var(--color-a11oy-text)"},children:o.title})]}),e.jsxs("div",{className:"text-right flex-shrink-0",children:[e.jsxs("div",{className:"text-xs font-mono",style:{color:"#c9b787"},children:[o.confidence,"% confidence"]}),e.jsxs("div",{className:"text-xs mt-0.5",style:{color:"var(--color-a11oy-text-ghost)"},children:["via Signal ",o.signal]})]})]}),e.jsxs("div",{className:"grid md:grid-cols-2 gap-3 mb-3",children:[e.jsxs("div",{className:"p-3 rounded",style:{backgroundColor:"var(--color-a11oy-deep)",border:"1px solid var(--color-a11oy-border)"},children:[e.jsx("div",{className:"text-xs font-mono mb-1",style:{color:"var(--color-a11oy-text-ghost)"},children:"RATIONALE"}),e.jsx("div",{className:"text-xs",style:{color:"var(--color-a11oy-text-sub)"},children:o.rationale})]}),e.jsxs("div",{className:"p-3 rounded",style:{backgroundColor:"rgba(245,245,245,0.04)",border:"1px solid rgba(245,245,245,0.15)"},children:[e.jsx("div",{className:"text-xs font-mono mb-1",style:{color:"#f5f5f5"},children:"COUNTERFACTUAL"}),e.jsx("div",{className:"text-xs",style:{color:"var(--color-a11oy-text-sub)"},children:o.counterfactual})]})]}),t?e.jsxs("div",{className:"text-xs font-mono px-3 py-2 rounded flex items-center gap-2",style:{backgroundColor:`${a[t]}12`,color:a[t],border:`1px solid ${a[t]}30`},children:[u[t],e.jsx("button",{onClick:()=>c(v=>{const n={...v};return delete n[o.id],n}),className:"ml-auto text-xs",style:{color:"var(--color-a11oy-text-ghost)",background:"none",border:"none",cursor:"pointer"},children:"Undo"})]}):e.jsxs(e.Fragment,{children:[e.jsx(b,{label:`Requires approval from: ${o.approver}`}),e.jsxs("div",{className:"flex gap-2 mt-2",children:[e.jsx(i,{variant:"primary",onClick:()=>l(o.id,"approved"),children:"Approve & Execute"}),e.jsx(i,{variant:"ghost",onClick:()=>l(o.id,"deferred"),children:"Defer"}),e.jsx(i,{variant:"danger",onClick:()=>l(o.id,"rejected"),children:"Reject"})]}),e.jsxs("div",{className:"text-xs mt-2",style:{color:"var(--color-a11oy-text-ghost)"},children:["No material action executes without human approval. Cost: ",o.cost]})]})]},o.id)})}),e.jsxs("div",{className:"mt-6 p-3 rounded-lg text-xs flex items-center gap-2",style:{backgroundColor:"rgba(201,183,135,0.06)",border:"1px solid rgba(201,183,135,0.15)",color:"var(--color-a11oy-text-ghost)"},children:[e.jsx("span",{className:"w-1.5 h-1.5 rounded-full flex-shrink-0 animate-pulse",style:{backgroundColor:"#c9b787"}})," Governed Environment — approval decisions are cryptographically signed and logged to the Proof Ledger."]})]})}export{C as ActionRail};