import{r as p,k as e}from"./index-BVfpSx5Q.js";import{L as C}from"./layout-NiehYZnq.js";import{P as R,K as l,S as d,C as h}from"./ui-DGkmnhL-.js";import{g as k,C as S,L as t,F as g}from"./complianceFabric-CIzuJFiy.js";const a="#c9b787",y={fresh:"#22c55e",warning:"#f97316",stale:"#ef4444",critical:"#ef4444"};function u(o){return new Date(o).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})}function E({daysStale:o,thresholdDays:i,status:c}){const m=Math.min(o/i*100,100),r=y[c];return e.jsx("div",{className:"h-1.5 rounded-full w-full",style:{backgroundColor:"rgba(255,255,255,0.06)"},children:e.jsx("div",{className:"h-1.5 rounded-full transition-all",style:{width:`${m}%`,backgroundColor:r}})})}const I=[{title:"System Description",source:"System Cards",desc:"Intended purpose, capabilities, limitations, deployment context, and risk classification for each agent."},{title:"Affected Populations",source:"Agent Registry",desc:"Identification of groups affected by agent decisions — employees, customers, partners, regulated entities."},{title:"Risk Assessment",source:"Risk Reports + Behavioral Audit",desc:"Known risks, residual risks, mitigation measures, and ongoing monitoring commitments per agent."},{title:"Oversight Mechanisms",source:"Covenant Layer + Approval Queue",desc:"Human oversight structure — approval tiers, named approvers, escalation paths, override protections."},{title:"Data Protection",source:"Connector Firewall + Data Handling",desc:"PII handling, data minimization, consent gating, retention policies, and privacy impact."},{title:"Bias and Fairness",source:"MirrorEval + Code Behaviors",desc:"Bias detection scoring, demographic fairness checks, sycophancy resistance, and fairness-relevant eval dimensions."},{title:"Transparency Measures",source:"Glasswing Mode + Public Trust Portal",desc:"Public disclosure commitments — transparency reports, CAVD, constitution publication, robustness wall."},{title:"Remediation Plan",source:"CARE Engine + ARG",desc:"Procedures for addressing identified risks, updating constitutions, and re-evaluating agents post-remediation."}];function L(){const[o,i]=p.useState("all"),[c,m]=p.useState(!1),r=k(),v=o==="all"?r:r.filter(s=>s.framework===o),j=r.filter(s=>s.status==="fresh").length,b=r.filter(s=>s.status==="warning").length,f=r.filter(s=>s.status==="stale"||s.status==="critical").length;return e.jsxs(C,{children:[e.jsx(R,{label:"CARE — CONTINUOUS AUDIT READINESS",title:"Continuous Audit Readiness Engine",subtitle:"Always-on monitoring that tracks evidence freshness for every mapped regulatory control. Auto-flags stale evidence, verifies 6-month log retention per EU AI Act Article 12, and generates on-demand audit packages.",status:"LIVE"}),e.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-3 lg:grid-cols-6 gap-3 mb-8",children:[e.jsx(l,{label:"CONTROLS MONITORED",value:String(S.length),sub:"across 4 frameworks",accent:a}),e.jsx(l,{label:"FRESH",value:String(j),sub:"evidence current",accent:"#22c55e"}),e.jsx(l,{label:"WARNING",value:String(b),sub:"approaching threshold",accent:"#f97316"}),e.jsx(l,{label:"STALE",value:String(f),sub:"needs refresh",accent:"#ef4444"}),e.jsx(l,{label:"LOG RETENTION",value:`${t.currentRetentionMonths}mo`,sub:`required: ${t.requiredMonths}mo`,accent:"#22c55e"}),e.jsx(l,{label:"ART. 12 COMPLIANT",value:"YES",sub:"6-month retention",accent:"#22c55e"})]}),e.jsxs("div",{className:"grid lg:grid-cols-3 gap-6 mb-8",children:[e.jsxs("div",{className:"lg:col-span-2",children:[e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsx(d,{children:"Control Freshness Timeline"}),e.jsxs("div",{className:"flex gap-1",children:[e.jsx("button",{onClick:()=>i("all"),className:"text-xs px-2 py-0.5 rounded font-mono",style:{backgroundColor:o==="all"?"rgba(201,183,135,0.15)":"var(--color-a11oy-muted)",color:o==="all"?a:"var(--color-a11oy-text-ghost)",border:"none",cursor:"pointer"},children:"All"}),g.map(s=>e.jsx("button",{onClick:()=>i(s.id),className:"text-xs px-2 py-0.5 rounded font-mono",style:{backgroundColor:o===s.id?`${s.color}18`:"var(--color-a11oy-muted)",color:o===s.id?s.color:"var(--color-a11oy-text-ghost)",border:"none",cursor:"pointer"},children:s.shortName},s.id))]})]}),e.jsx("div",{className:"rounded-lg border overflow-hidden",style:{borderColor:"var(--color-a11oy-border)"},children:e.jsxs("table",{className:"w-full text-xs",children:[e.jsx("thead",{children:e.jsx("tr",{style:{backgroundColor:"var(--color-a11oy-deep)"},children:["Control","Framework","Last Refreshed","Days","Threshold","Freshness","Status"].map(s=>e.jsx("th",{className:"text-left px-3 py-2 font-mono uppercase tracking-wide",style:{color:"var(--color-a11oy-text-ghost)",fontSize:"10px"},children:s},s))})}),e.jsx("tbody",{children:v.map((s,N)=>{const n=g.find(A=>A.id===s.framework),x=y[s.status];return e.jsxs("tr",{style:{backgroundColor:N%2===0?"var(--color-a11oy-card)":"var(--color-a11oy-deep)",borderBottom:"1px solid var(--color-a11oy-border)"},children:[e.jsx("td",{className:"px-3 py-2 font-mono",style:{color:"var(--color-a11oy-text)"},children:s.controlRef}),e.jsx("td",{className:"px-3 py-2 font-mono",style:{color:(n==null?void 0:n.color)??a},children:n==null?void 0:n.shortName}),e.jsx("td",{className:"px-3 py-2",style:{color:"var(--color-a11oy-text-sub)"},children:u(s.lastRefreshedAt)}),e.jsxs("td",{className:"px-3 py-2 font-mono",style:{color:x},children:[s.daysStale,"d"]}),e.jsxs("td",{className:"px-3 py-2 font-mono",style:{color:"var(--color-a11oy-text-ghost)"},children:[s.thresholdDays,"d"]}),e.jsx("td",{className:"px-3 py-2 w-24",children:e.jsx(E,{daysStale:s.daysStale,thresholdDays:s.thresholdDays,status:s.status})}),e.jsx("td",{className:"px-3 py-2",children:e.jsx("span",{className:"text-xs font-mono px-1.5 py-0.5 rounded",style:{backgroundColor:`${x}15`,color:x},children:s.status.toUpperCase()})})]},s.controlId)})})]})})]}),e.jsxs("div",{children:[e.jsx(d,{children:"EU AI Act Article 12 — Log Retention"}),e.jsx(h,{children:e.jsxs("div",{className:"space-y-3 text-xs",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{style:{color:"var(--color-a11oy-text-ghost)"},children:"Required Retention"}),e.jsxs("span",{className:"font-mono font-bold",style:{color:"var(--color-a11oy-text)"},children:[t.requiredMonths," months"]})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{style:{color:"var(--color-a11oy-text-ghost)"},children:"Current Retention"}),e.jsxs("span",{className:"font-mono font-bold",style:{color:"#22c55e"},children:[t.currentRetentionMonths," months"]})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{style:{color:"var(--color-a11oy-text-ghost)"},children:"Oldest Log"}),e.jsx("span",{className:"font-mono",style:{color:"var(--color-a11oy-text-sub)"},children:u(t.oldestLogDate)})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{style:{color:"var(--color-a11oy-text-ghost)"},children:"Next Purge"}),e.jsx("span",{className:"font-mono",style:{color:"var(--color-a11oy-text-sub)"},children:u(t.nextPurgeDate)})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{style:{color:"var(--color-a11oy-text-ghost)"},children:"Compliance"}),e.jsx("span",{className:"font-mono font-bold",style:{color:"#22c55e"},children:"COMPLIANT"})]}),e.jsxs("div",{className:"pt-2 border-t",style:{borderColor:"var(--color-a11oy-border)"},children:[e.jsxs("div",{className:"font-mono mb-1",style:{color:"var(--color-a11oy-text-ghost)"},children:["HIGH-RISK AGENTS (",t.highRiskAgents.length,")"]}),e.jsx("div",{className:"flex flex-wrap gap-1",children:t.highRiskAgents.map(s=>e.jsx("span",{className:"text-xs font-mono px-1.5 py-0.5 rounded",style:{backgroundColor:"var(--color-a11oy-deep)",border:"1px solid var(--color-a11oy-border)",color:a},children:s},s))})]})]})}),e.jsxs("div",{className:"mt-4",children:[e.jsx(d,{children:"FRIA Generator"}),e.jsxs(h,{children:[e.jsx("p",{className:"text-xs mb-3",style:{color:"var(--color-a11oy-text-sub)"},children:"Generate a pre-populated Fundamental Rights Impact Assessment drawing from System Cards, Risk Reports, Behavioral Audit history, and agent constitutions."}),e.jsx("button",{onClick:()=>m(!c),className:"w-full text-xs font-medium py-2 rounded-lg mb-3",style:{backgroundColor:"rgba(201,183,135,0.12)",color:a,border:"1px solid rgba(201,183,135,0.25)",cursor:"pointer"},children:c?"Hide FRIA Template":"Generate FRIA Template"}),c&&e.jsx("div",{className:"space-y-2",children:I.map(s=>e.jsxs("div",{className:"p-2 rounded",style:{backgroundColor:"var(--color-a11oy-deep)",border:"1px solid var(--color-a11oy-border)"},children:[e.jsxs("div",{className:"flex items-center justify-between mb-1",children:[e.jsx("span",{className:"text-xs font-semibold",style:{color:"var(--color-a11oy-text)"},children:s.title}),e.jsx("span",{className:"text-xs font-mono",style:{color:a},children:s.source})]}),e.jsx("p",{className:"text-xs",style:{color:"var(--color-a11oy-text-ghost)"},children:s.desc})]},s.title))})]})]}),e.jsxs("div",{className:"mt-4",children:[e.jsx(d,{children:"Auto-Remediation"}),e.jsx(h,{children:e.jsx("div",{className:"space-y-2 text-xs",children:[{trigger:"Evidence > 80% of threshold",action:"Warning notification sent to control owner"},{trigger:"Evidence exceeds threshold",action:"Remediation task auto-created"},{trigger:"Log retention < 6 months",action:"Alert sent to compliance team"},{trigger:"New control mapping added",action:"Evidence collection initiated"}].map(s=>e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx("span",{style:{color:a,flexShrink:0},children:"→"}),e.jsxs("div",{children:[e.jsx("span",{style:{color:"var(--color-a11oy-text)"},children:s.trigger}),e.jsx("br",{}),e.jsx("span",{style:{color:"var(--color-a11oy-text-ghost)"},children:s.action})]})]},s.trigger))})})]})]})]}),e.jsxs("div",{className:"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 bg-[var(--color-a11oy-blue)] flex-shrink-0"})," CARE Engine — continuous audit readiness monitoring. Evidence freshness is tracked per control. FRIA templates are pre-populated from live governance data. EU AI Act Article 12 retention is verified."]})]})}export{L as CareEngine};