hackagent-webui 0.6.4.dev71__py3-none-any.whl → 0.6.6.dev73__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- hackagent_webui/__init__.py +1 -1
- hackagent_webui/static/404.html +2 -2
- hackagent_webui/static/VERSION +1 -1
- hackagent_webui/static/_next/static/chunks/323-48aec32488b6e5bf.js +1 -0
- hackagent_webui/static/_next/static/chunks/328-d42d52b81db94a35.js +1 -0
- hackagent_webui/static/_next/static/chunks/{921-92a9ab4120f81d51.js → 356-90f2ee305a89f642.js} +1 -1
- hackagent_webui/static/_next/static/chunks/{658-451b7f3b5c5a1599.js → 432-da1349ca9d0dbf5d.js} +5 -5
- hackagent_webui/static/_next/static/chunks/{493-34228dd02f768bba.js → 493-92a293a4bf432fc7.js} +1 -1
- hackagent_webui/static/_next/static/chunks/495-ac70d412256bbfe9.js +1 -0
- hackagent_webui/static/_next/static/chunks/546-64c7e818ab4dd2e7.js +1 -0
- hackagent_webui/static/_next/static/chunks/666-5ee4182c3065fd65.js +1 -0
- hackagent_webui/static/_next/static/chunks/683-ab457b94ca148f0e.js +1 -0
- hackagent_webui/static/_next/static/chunks/924-c5a440689b66a79a.js +1 -0
- hackagent_webui/static/_next/static/chunks/97-393ae9eee3ee20ab.js +1 -0
- hackagent_webui/static/_next/static/chunks/980-cc9c16cc6103edbb.js +1 -0
- hackagent_webui/static/_next/static/chunks/app/agents/{page-ba01b144c3c0191e.js → page-e8929149bce2396f.js} +1 -1
- hackagent_webui/static/_next/static/chunks/app/attacks/page-4594b3d8af3cef5c.js +1 -0
- hackagent_webui/static/_next/static/chunks/app/credentials/{page-ccb3279e96173cae.js → page-170ae86afa1516f9.js} +1 -1
- hackagent_webui/static/_next/static/chunks/app/{layout-ae76166da96be97b.js → layout-48e91819323a0ba7.js} +1 -1
- hackagent_webui/static/_next/static/chunks/app/page-92fb04233e8db6e2.js +1 -0
- hackagent_webui/static/_next/static/chunks/app/profile/{page-8d833eda8e73fb92.js → page-24382ac8cf6b7519.js} +1 -1
- hackagent_webui/static/_next/static/chunks/app/stats/page-742d6876a3e207d9.js +1 -0
- hackagent_webui/static/_next/static/chunks/{main-b2abf26ddb8313ad.js → main-c5ae269c07d252e7.js} +1 -1
- hackagent_webui/static/_next/static/css/920420339ac947aa.css +1 -0
- hackagent_webui/static/agents.html +2 -2
- hackagent_webui/static/agents.txt +6 -6
- hackagent_webui/static/api-keys.html +2 -2
- hackagent_webui/static/api-keys.txt +5 -5
- hackagent_webui/static/attacks.html +2 -2
- hackagent_webui/static/attacks.txt +6 -6
- hackagent_webui/static/campaign-export/runtime.js +96 -128
- hackagent_webui/static/campaign-export/styles.css +1 -1
- hackagent_webui/static/credentials.html +2 -2
- hackagent_webui/static/credentials.txt +6 -6
- hackagent_webui/static/index.html +2 -2
- hackagent_webui/static/index.txt +6 -6
- hackagent_webui/static/profile.html +2 -2
- hackagent_webui/static/profile.txt +6 -6
- hackagent_webui/static/secrets.html +2 -2
- hackagent_webui/static/secrets.txt +5 -5
- hackagent_webui/static/stats.html +2 -2
- hackagent_webui/static/stats.txt +6 -6
- hackagent_webui/static/usage.html +2 -2
- hackagent_webui/static/usage.txt +6 -6
- {hackagent_webui-0.6.4.dev71.dist-info → hackagent_webui-0.6.6.dev73.dist-info}/METADATA +1 -1
- hackagent_webui-0.6.6.dev73.dist-info/RECORD +82 -0
- hackagent_webui/static/_next/static/chunks/160-21f7abf9e76923d9.js +0 -1
- hackagent_webui/static/_next/static/chunks/452-33805ea7d3b33b29.js +0 -1
- hackagent_webui/static/_next/static/chunks/592-cb13179874c3bab1.js +0 -1
- hackagent_webui/static/_next/static/chunks/634-ef141668e76853c1.js +0 -1
- hackagent_webui/static/_next/static/chunks/688-74942a135eec7c34.js +0 -1
- hackagent_webui/static/_next/static/chunks/747-aa8aa91116de6e71.js +0 -1
- hackagent_webui/static/_next/static/chunks/764-b642e364454b2ac4.js +0 -1
- hackagent_webui/static/_next/static/chunks/888-2e968371d359a872.js +0 -1
- hackagent_webui/static/_next/static/chunks/924-926086aa93c839d8.js +0 -1
- hackagent_webui/static/_next/static/chunks/970-bc5945a148c7d8b8.js +0 -1
- hackagent_webui/static/_next/static/chunks/app/attacks/page-f2852f796ad98f7a.js +0 -1
- hackagent_webui/static/_next/static/chunks/app/page-40fdbb3c458241bf.js +0 -1
- hackagent_webui/static/_next/static/chunks/app/stats/page-9cc34ee4b1a8895d.js +0 -1
- hackagent_webui/static/_next/static/css/acc5ec9d7fb72178.css +0 -1
- hackagent_webui-0.6.4.dev71.dist-info/RECORD +0 -83
- /hackagent_webui/static/_next/static/{7av25iIXZJ4ESHYoziC9t → BB2pDANDGPKWiJdI-62Hn}/_buildManifest.js +0 -0
- /hackagent_webui/static/_next/static/{7av25iIXZJ4ESHYoziC9t → BB2pDANDGPKWiJdI-62Hn}/_ssgManifest.js +0 -0
- {hackagent_webui-0.6.4.dev71.dist-info → hackagent_webui-0.6.6.dev73.dist-info}/WHEEL +0 -0
|
@@ -1 +0,0 @@
|
|
|
1
|
-
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[974],{11647:(e,t,a)=>{"use strict";a.d(t,{E:()=>c});var s=a(95155);a(12115);var n=a(32467),r=a(83101),l=a(64269);let i=(0,r.F)("inline-flex items-center justify-center rounded-md border px-2 py-0.5 text-xs font-medium w-fit whitespace-nowrap shrink-0 [&>svg]:size-3 gap-1 [&>svg]:pointer-events-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive transition-[color,box-shadow] overflow-hidden",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground [a&]:hover:bg-primary/90",secondary:"border-transparent bg-secondary text-secondary-foreground [a&]:hover:bg-secondary/90",destructive:"border-transparent bg-destructive text-white [a&]:hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",outline:"text-foreground [a&]:hover:bg-accent [a&]:hover:text-accent-foreground"}},defaultVariants:{variant:"default"}});function c(e){let{className:t,variant:a,asChild:r=!1,...c}=e,o=r?n.DX:"span";return(0,s.jsx)(o,{"data-slot":"badge",className:(0,l.cn)(i({variant:a}),t),...c})}},13406:(e,t,a)=>{"use strict";a.d(t,{Xi:()=>c,av:()=>o,j7:()=>i,tU:()=>l});var s=a(95155);a(12115);var n=a(49543),r=a(64269);function l(e){let{className:t,...a}=e;return(0,s.jsx)(n.bL,{"data-slot":"tabs",className:(0,r.cn)("flex flex-col gap-2",t),...a})}function i(e){let{className:t,...a}=e;return(0,s.jsx)(n.B8,{"data-slot":"tabs-list",className:(0,r.cn)("bg-muted text-muted-foreground inline-flex h-9 w-fit items-center justify-center rounded-lg p-[3px]",t),...a})}function c(e){let{className:t,...a}=e;return(0,s.jsx)(n.l9,{"data-slot":"tabs-trigger",className:(0,r.cn)("data-[state=active]:bg-background dark:data-[state=active]:text-foreground focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:outline-ring dark:data-[state=active]:border-input dark:data-[state=active]:bg-input/30 text-foreground dark:text-muted-foreground inline-flex h-[calc(100%-1px)] flex-1 items-center justify-center gap-1.5 rounded-md border border-transparent px-2 py-1 text-sm font-medium whitespace-nowrap transition-all focus-visible:ring-[3px] focus-visible:outline-1 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:shadow-sm [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 hover:bg-background/50 dark:hover:bg-input/20 data-[state=active]:hover:bg-background dark:data-[state=active]:hover:bg-input/30",t),...a})}function o(e){let{className:t,...a}=e;return(0,s.jsx)(n.UC,{"data-slot":"tabs-content",className:(0,r.cn)("flex-1 outline-none",t),...a})}},17037:(e,t,a)=>{"use strict";a.d(t,{$:()=>i,F:()=>l});var s=a(95155);a(12115);var n=a(47397),r=a(64269);function l(e){let{className:t,children:a,...l}=e;return(0,s.jsxs)(n.bL,{"data-slot":"scroll-area",className:(0,r.cn)("relative",t),...l,children:[(0,s.jsx)(n.LM,{"data-slot":"scroll-area-viewport",className:"focus-visible:ring-ring/50 size-full rounded-[inherit] transition-[color,box-shadow] outline-none focus-visible:ring-[3px] focus-visible:outline-1",children:a}),(0,s.jsx)(i,{}),(0,s.jsx)(n.OK,{})]})}function i(e){let{className:t,orientation:a="vertical",...l}=e;return(0,s.jsx)(n.VM,{"data-slot":"scroll-area-scrollbar",orientation:a,className:(0,r.cn)("flex touch-none p-px transition-colors select-none","vertical"===a&&"h-full w-2.5 border-l border-l-transparent","horizontal"===a&&"h-2.5 flex-col border-t border-t-transparent",t),...l,children:(0,s.jsx)(n.lr,{"data-slot":"scroll-area-thumb",className:"bg-border relative flex-1 rounded-full"})})}},20243:(e,t,a)=>{"use strict";a.d(t,{E:()=>r});var s=a(95155),n=a(64269);function r(e){let{className:t,...a}=e;return(0,s.jsx)("div",{"data-slot":"skeleton",className:(0,n.cn)("bg-accent animate-pulse rounded-md",t),...a})}},22470:(e,t,a)=>{"use strict";a.d(t,{M:()=>n});var s=a(95155);a(12115);let n=e=>{let{title:t,description:a,action:n,children:r,maxWidth:l="full",compact:i=!1}=e;return(0,s.jsxs)("div",{className:"w-full ".concat({full:"max-w-full","8xl":"max-w-[90rem]","7xl":"max-w-7xl","6xl":"max-w-6xl","5xl":"max-w-5xl","4xl":"max-w-4xl","3xl":"max-w-3xl","2xl":"max-w-2xl"}[l]||"max-w-full"," mx-auto ").concat(i?"py-3 space-y-3":"py-6 space-y-6"),children:[t&&(0,s.jsxs)("div",{className:"flex flex-col sm:flex-row sm:items-start sm:justify-between gap-3 border-b ".concat(i?"px-4 pb-3":"px-6 pb-5"),children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("h1",{className:"text-2xl font-semibold tracking-tight",children:t}),a&&(0,s.jsx)("p",{className:"text-sm text-muted-foreground mt-1",children:a})]}),n&&(0,s.jsx)("div",{className:"flex-shrink-0 pt-0.5",children:n})]}),r]})}},27677:(e,t,a)=>{"use strict";a.r(t),a.d(t,{default:()=>ec});var s=a(95155),n=a(80230),r=a(12115),l=a(52619),i=a.n(l),c=a(3998),o=a(20243),d=a(22470),m=a(12723),u=a(4035),x=a(69386),h=a(26265),g=a(96324),f=a(68425),p=a(47734),j=a(73697),v=a(33420),b=a(86618),N=a(78192),y=a(52987),k=a(52056),w=a(86948),A=a(11647),S=a(7831);let C={vulnerable:"#ef4444",safe:"#22c55e",error:"#f59e0b",pending:"#94a3b8"},E={vulnerable:"#f87171",safe:"#4ade80",error:"#fbbf24",pending:"#cbd5e1"},L={low:"#22c55e",medium:"#eab308",high:"#f97316",critical:"#ef4444"};var _=a(96042),R=a(46767);let M={low:10,medium:30,high:60},z={low:"Low",medium:"Medium",high:"High",critical:"Critical"},T="Risk from attack success rate (ASR): Low ≤".concat(M.low,"%, ")+"Medium ≤".concat(M.medium,"%, High ≤").concat(M.high,"%, ")+"Critical >".concat(M.high,"%.");function D(e){return e<=M.low?"low":e<=M.medium?"medium":e<=M.high?"high":"critical"}function O(e){let{children:t}=e;return(0,s.jsxs)(R.m_,{children:[(0,s.jsx)(R.k$,{asChild:!0,children:t}),(0,s.jsx)(R.ZI,{className:"max-w-xs",children:T})]})}var I=a(41444),B=a(87066),Z=a(35795);function H(e){let{targets:t,runs:a,jailbreaks:n}=e,r=[{label:"Targets",value:t,icon:N.A,href:"/agents"},{label:"Runs",value:a,icon:B.A,href:"/stats"},{label:"Jailbreaks",value:n,icon:Z.A,href:"/stats"}];return(0,s.jsx)("div",{className:"grid grid-cols-3 gap-4",children:r.map(e=>{let{label:t,value:a,icon:n,href:r}=e;return(0,s.jsx)(i(),{href:r,className:"group",children:(0,s.jsx)(w.Zp,{className:"transition-colors group-hover:bg-muted/40",children:(0,s.jsxs)(w.Wu,{className:"p-4",children:[(0,s.jsxs)("div",{className:"mb-3 flex items-center justify-between",children:[(0,s.jsx)("span",{className:"text-sm text-muted-foreground",children:t}),(0,s.jsx)("span",{className:"flex h-8 w-8 items-center justify-center rounded-md border bg-muted/40 text-muted-foreground transition-colors group-hover:text-foreground",children:(0,s.jsx)(n,{className:"h-4 w-4"})})]}),(0,s.jsx)("span",{className:"text-3xl font-semibold tracking-tight tabular-nums",children:a})]})})},t)})})}var P=a(37397),G=a(80534);let W=[{icon:N.A,title:"Add a target agent",description:"Connect the AI agent you want to probe for vulnerabilities.",cta:"Add target",href:"/agents"},{icon:P.A,title:"Build a campaign",description:"Configure jailbreak and red-team techniques to run against it.",cta:"Create campaign",href:"/attacks"},{icon:G.A,title:"Review results",description:"See which attacks succeeded and inspect their results.",cta:"View results",href:"/stats"}];function F(){return(0,s.jsxs)(w.Zp,{children:[(0,s.jsxs)(w.aR,{children:[(0,s.jsx)(w.ZB,{className:"text-lg",children:"Get started with HackAgent"}),(0,s.jsx)("p",{className:"text-sm text-muted-foreground",children:"Three steps to your first agent security evaluation."})]}),(0,s.jsx)(w.Wu,{children:(0,s.jsx)("ol",{className:"grid gap-4 md:grid-cols-3",children:W.map((e,t)=>{let{icon:a,title:n,description:r,cta:l,href:o}=e;return(0,s.jsxs)("li",{className:"flex flex-col gap-3 rounded-lg border bg-muted/20 p-4",children:[(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsx)("span",{className:"flex h-6 w-6 items-center justify-center rounded-full border bg-background text-xs font-semibold tabular-nums text-muted-foreground",children:t+1}),(0,s.jsx)(a,{className:"h-4 w-4 text-muted-foreground"})]}),(0,s.jsxs)("div",{className:"space-y-1",children:[(0,s.jsx)("h3",{className:"text-sm font-medium",children:n}),(0,s.jsx)("p",{className:"text-sm text-muted-foreground",children:r})]}),(0,s.jsx)(c.$,{asChild:!0,variant:"outline",size:"sm",className:"mt-auto w-full",children:(0,s.jsxs)(i(),{href:o,children:[l,(0,s.jsx)(y.A,{className:"h-3.5 w-3.5"})]})})]},n)})})})]})}let J=(0,I.h)("HomeStats"),K={total:0,jailbreaks:0,mitigated:0,errors:0,pending:0};function V(e){return e.reduce((e,t)=>{var a,s,n,r,l;return{total:e.total+(null!=(a=t.totalResults)?a:0),jailbreaks:e.jailbreaks+(null!=(s=t.successfulJailbreaks)?s:0),mitigated:e.mitigated+(null!=(n=t.failedJailbreaks)?n:0),errors:e.errors+(null!=(r=t.errors)?r:0),pending:e.pending+(null!=(l=t.notEvaluated)?l:0)}},{...K})}function $(){var e;let{hideEmptyState:t=!1,onLoaded:a}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{resolvedTheme:n}=(0,_.D)(),l="dark"===n,c=l?E:C,d=l?"#3f3f46":"#e5e7eb",[R,M]=(0,r.useState)(!0),[T,I]=(0,r.useState)([]),[B,Z]=(0,r.useState)(0),[P,G]=(0,r.useState)(0),[W,$]=(0,r.useState)(0),[U,X]=(0,r.useState)("—"),[q,Q]=(0,r.useState)(K),Y=(0,r.useRef)(a);Y.current=a,(0,r.useEffect)(()=>{let e=!1;return(async()=>{M(!0);try{var t,a,s,n;let r=await S.ME.runList({page:1,pageSize:100});if(e)return;let l=null!=(a=r.results)?a:[],i=V(l),c=new Set(l.map(e=>e.agent).filter(Boolean));Z(null!=(s=r.count)?s:l.length),G(c.size),$(i.jailbreaks),I(l.slice(0,5)),null==(t=Y.current)||t.call(Y,{totalRuns:null!=(n=r.count)?n:l.length,totalResults:i.total});let o=l[0];if(!o){X("—"),Q(K);return}X(o.agentName||"".concat(o.agent.slice(0,8),"…")),Q(V(l.filter(e=>e.agent===o.agent)))}catch(t){e||J.error({err:t},"Failed to load home stats")}finally{e||M(!1)}})(),()=>{e=!0}},[]);let ee=(0,r.useMemo)(()=>0===q.total?0:Math.round(100*q.jailbreaks/q.total),[q]),et=q.total>0,ea=null==(e=et?ee:null)||Number.isNaN(e)?"No data":z[D(e)],es=L[D(ee)],en=(0,r.useMemo)(()=>[{name:"Jailbreaks",value:q.jailbreaks,color:c.vulnerable},{name:"Mitigated",value:q.mitigated,color:c.safe},{name:"Errors",value:q.errors,color:c.error},{name:"Pending",value:q.pending,color:c.pending}],[q,c]);return R?(0,s.jsxs)("div",{className:"space-y-4",children:[(0,s.jsx)("div",{className:"grid grid-cols-3 gap-4",children:[0,1,2].map(e=>(0,s.jsx)(o.E,{className:"h-24 w-full"},e))}),(0,s.jsx)(o.E,{className:"h-56 w-full"})]}):0===B?t?null:(0,s.jsx)(F,{}):(0,s.jsxs)("div",{className:"space-y-4",children:[(0,s.jsx)(H,{targets:P,runs:B,jailbreaks:W}),(0,s.jsxs)("div",{className:"grid gap-4 xl:grid-cols-5 items-start",children:[(0,s.jsxs)(w.Zp,{className:"xl:col-span-3",children:[(0,s.jsx)(w.aR,{className:"pb-2",children:(0,s.jsxs)(w.ZB,{className:"text-lg flex flex-wrap items-center gap-2",children:["Latest Target Statistics",(0,s.jsxs)(A.E,{variant:"secondary",className:"font-mono font-normal gap-1",children:[(0,s.jsx)(N.A,{className:"h-3 w-3"}),U]})]})}),(0,s.jsx)(w.Wu,{children:et?(0,s.jsxs)("div",{className:"grid gap-6 md:grid-cols-2 items-center",children:[(0,s.jsxs)("div",{className:"flex flex-col items-center gap-2",children:[(0,s.jsx)("span",{className:"text-sm font-medium self-start",children:"Risk Overview"}),(0,s.jsx)(O,{children:(0,s.jsx)("div",{children:(0,s.jsxs)(m.r,{width:200,height:180,children:[(0,s.jsxs)(u.Fq,{data:[{name:"Risk",value:ee,color:es},{name:"Remaining",value:100-ee,color:d}],cx:100,cy:90,innerRadius:58,outerRadius:82,startAngle:90,endAngle:-270,dataKey:"value",isAnimationActive:!1,children:[(0,s.jsx)(x.f,{fill:es}),(0,s.jsx)(x.f,{fill:d})]}),(0,s.jsxs)("text",{x:100,y:84,textAnchor:"middle",fontSize:26,fontWeight:700,fill:es,children:[ee,"%"]}),(0,s.jsx)("text",{x:100,y:106,textAnchor:"middle",fontSize:12,fill:es,children:ea})]})})})]}),(0,s.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,s.jsx)("span",{className:"text-sm font-medium",children:"Result Distribution"}),(0,s.jsx)(h.u,{width:"100%",height:150,children:(0,s.jsxs)(g.E,{data:en,margin:{top:8,right:8,left:-16,bottom:0},children:[(0,s.jsx)(f.d,{vertical:!1,strokeDasharray:"3 3",stroke:l?"rgba(255,255,255,0.12)":"#e5e7eb"}),(0,s.jsx)(p.W,{dataKey:"name",tick:{fontSize:11},axisLine:!1,tickLine:!1}),(0,s.jsx)(j.h,{allowDecimals:!1,tick:{fontSize:11},axisLine:!1,tickLine:!1}),(0,s.jsx)(v.m,{wrapperStyle:{fontSize:12},cursor:{fill:"rgba(0,0,0,0.04)"}}),(0,s.jsx)(b.yP,{dataKey:"value",radius:[4,4,0,0],isAnimationActive:!1,children:en.map(e=>(0,s.jsx)(x.f,{fill:e.color},e.name))})]})}),(0,s.jsxs)("span",{className:"text-xs text-muted-foreground",children:[q.total," total results"]})]})]}):(0,s.jsx)("p",{className:"text-sm text-muted-foreground py-6 text-center",children:"No evaluated results for this target yet."})})]}),(0,s.jsxs)(w.Zp,{className:"xl:col-span-2",children:[(0,s.jsxs)(w.aR,{className:"pb-2",children:[(0,s.jsx)(w.ZB,{className:"text-base",children:"Recent Runs"}),(0,s.jsx)(w.X9,{children:(0,s.jsxs)(i(),{href:"/stats",className:"text-xs text-muted-foreground hover:text-foreground flex items-center gap-1",children:["View all ",(0,s.jsx)(y.A,{className:"h-3 w-3"})]})})]}),(0,s.jsx)(w.Wu,{className:"p-0",children:(0,s.jsx)("div",{className:"divide-y",children:T.map(e=>{var t,a;return(0,s.jsxs)(i(),{href:"/stats",className:"flex items-center justify-between gap-3 px-4 py-2.5 hover:bg-muted/50 transition-colors",children:[(0,s.jsxs)("div",{className:"flex items-center gap-3 min-w-0",children:[(0,s.jsxs)("span",{className:"font-mono text-xs text-muted-foreground shrink-0 xl:hidden 2xl:inline",children:[e.id.slice(0,8),"…"]}),(0,s.jsx)("span",{className:"text-sm truncate",children:e.agentName||"—"}),e.attackType&&(0,s.jsx)(A.E,{variant:"outline",className:"text-xs shrink-0",children:e.attackType})]}),(0,s.jsxs)("div",{className:"flex items-center gap-3 shrink-0",children:[(null!=(t=e.successfulJailbreaks)?t:0)>0&&(0,s.jsxs)("span",{className:"flex items-center gap-1 text-xs",style:{color:C.vulnerable},children:[(0,s.jsx)(k.A,{className:"h-3 w-3"}),e.successfulJailbreaks]}),(0,s.jsx)(A.E,{variant:function(e){switch(e){case"COMPLETED":return"default";case"FAILED":return"destructive";case"RUNNING":return"secondary";default:return"outline"}}(e.status),className:"text-xs",children:null!=(a=e.status)?a:"PENDING"}),(0,s.jsx)("span",{className:"text-xs text-muted-foreground w-16 text-right",children:function(e){if(!e)return"—";let t=Math.round((Date.now()-new Date(e).getTime())/1e3);if(t<60)return"just now";let a=Math.round(t/60);if(a<60)return"".concat(a,"m ago");let s=Math.round(a/60);if(s<24)return"".concat(s,"h ago");let n=Math.round(s/24);if(n<30)return"".concat(n,"d ago");let r=Math.round(n/30);return r<12?"".concat(r,"mo ago"):"".concat(Math.round(r/12),"y ago")}(e.timestamp)})]})]},e.id)})})})]})]})]})}var U=a(13406),X=a(17037),q=a(17910),Q=a(28150),Y=a(50803),ee=a(61362),et=a(75426),ea=a(89715),es=a(85921);let en={google_adk:{name:"Google ADK",description:"Test a Google Agent Development Kit agent for jailbreaking and prompt injection. HackAgent sends adversarial goals via the ADK protocol and uses an LLM judge to evaluate whether safety guardrails were bypassed.",installCmd:"pip install hackagent",sdkCode:'from hackagent import HackAgent\n\nagent = HackAgent(\n name="my_adk_agent",\n endpoint="http://localhost:8000",\n agent_type="google-adk",\n)\n\nresults = agent.hack(attack_config={\n "attack_type": "advprefix",\n "goals": ["Bypass the agent\'s safety guidelines"],\n "generator": {\n "identifier": "gpt-4o-mini",\n "endpoint": "https://api.openai.com/v1",\n },\n "judges": [{\n "identifier": "gpt-4o-mini",\n "endpoint": "https://api.openai.com/v1",\n "type": "harmbench",\n }],\n})',riskAreas:["Jailbreaking","Prompt Injection","Goal Hijacking"]},openai_sdk:{name:"OpenAI SDK",description:"Test any OpenAI-compatible endpoint — including custom deployments, Azure OpenAI, or local models via LM Studio. HackAgent runs adversarial attack campaigns and streams results to your dashboard.",installCmd:"pip install hackagent",sdkCode:'from hackagent import HackAgent\n\nagent = HackAgent(\n name="my_openai_agent",\n endpoint="http://localhost:8000/v1", # /v1 base path\n agent_type="openai-sdk",\n)\n\nresults = agent.hack(attack_config={\n "attack_type": "pair",\n "goals": ["Extract system prompt", "Ignore previous instructions"],\n "generator": {\n "identifier": "gpt-4o-mini",\n "endpoint": "https://api.openai.com/v1",\n },\n "judges": [{\n "identifier": "gpt-4o-mini",\n "endpoint": "https://api.openai.com/v1",\n "type": "harmbench",\n }],\n})',riskAreas:["System Prompt Extraction","Instruction Override","Data Leakage"]},litellm:{name:"LiteLLM / Ollama",description:"Test any local or remote model via LiteLLM or Ollama — including Llama, Mistral, Gemma, and more. Run full jailbreak evaluations entirely offline with no external API dependencies.",installCmd:"pip install hackagent",sdkCode:'from hackagent import HackAgent\n\n# Ollama example — runs fully locally\nagent = HackAgent(\n name="llama3",\n endpoint="http://localhost:11434",\n agent_type="ollama",\n)\n\nresults = agent.hack(attack_config={\n "attack_type": "advprefix",\n "dataset": {"preset": "harmbench", "limit": 50},\n "generator": {\n "identifier": "llama2-uncensored",\n "endpoint": "http://localhost:11434",\n "agent_type": "ollama",\n },\n "judges": [{\n "identifier": "llama2-uncensored",\n "endpoint": "http://localhost:11434",\n "agent_type": "ollama",\n "type": "harmbench",\n }],\n})',riskAreas:["Jailbreaking","Safety Guardrail Bypass","Harmful Content Generation"]}};function er(){let[e,t]=(0,r.useState)("google_adk"),[a,n]=(0,r.useState)(null),l=(e,t)=>{navigator.clipboard.writeText(e),n(t),setTimeout(()=>n(null),2e3)},o=en[e];return(0,s.jsxs)(w.Zp,{className:"shadow-lg",children:[(0,s.jsxs)(w.aR,{className:"pb-4",children:[(0,s.jsxs)(w.ZB,{className:"text-xl flex items-center gap-2",children:[(0,s.jsx)(q.A,{className:"h-5 w-5 text-primary"}),"Quick Start: Run Your First Attack"]}),(0,s.jsx)(w.BT,{children:"Select your agent framework, then copy the Python snippet to get started"})]}),(0,s.jsx)(w.Wu,{className:"space-y-6",children:(0,s.jsxs)(U.tU,{value:e,onValueChange:e=>t(e),className:"w-full",children:[(0,s.jsxs)(U.j7,{className:"grid w-full grid-cols-3",children:[(0,s.jsxs)(U.Xi,{value:"google_adk",className:"gap-2",children:[(0,s.jsx)(N.A,{className:"h-4 w-4"}),(0,s.jsx)("span",{className:"hidden sm:inline",children:"Google ADK"})]}),(0,s.jsxs)(U.Xi,{value:"openai_sdk",className:"gap-2",children:[(0,s.jsx)(Q.A,{className:"h-4 w-4"}),(0,s.jsx)("span",{className:"hidden sm:inline",children:"OpenAI SDK"})]}),(0,s.jsxs)(U.Xi,{value:"litellm",className:"gap-2",children:[(0,s.jsx)(Y.A,{className:"h-4 w-4"}),(0,s.jsx)("span",{className:"hidden sm:inline",children:"LiteLLM / Ollama"})]})]}),(0,s.jsxs)(U.av,{value:e,className:"mt-4 space-y-6",children:[(0,s.jsx)("p",{className:"text-sm text-muted-foreground bg-muted/50 p-3 rounded-lg",children:o.description}),(0,s.jsxs)("div",{className:"space-y-3",children:[(0,s.jsxs)("div",{className:"flex items-center gap-3",children:[(0,s.jsx)(A.E,{variant:"default",className:"h-7 w-7 rounded-full p-0 flex items-center justify-center",children:"1"}),(0,s.jsx)("h3",{className:"font-semibold",children:"Install HackAgent"}),(0,s.jsx)(c.$,{variant:"ghost",size:"sm",className:"ml-auto",onClick:()=>l(o.installCmd,"install"),children:"install"===a?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(ee.A,{className:"h-4 w-4 text-green-500 mr-1"}),"Copied!"]}):(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(et.A,{className:"h-4 w-4 mr-1"}),"Copy"]})})]}),(0,s.jsx)("div",{className:"ml-10 bg-muted rounded-lg p-4 font-mono text-xs",children:(0,s.jsx)("pre",{children:o.installCmd})})]}),(0,s.jsxs)("div",{className:"space-y-3",children:[(0,s.jsxs)("div",{className:"flex items-center gap-3",children:[(0,s.jsx)(A.E,{variant:"secondary",className:"h-7 w-7 rounded-full p-0 flex items-center justify-center",children:"2"}),(0,s.jsx)("h3",{className:"font-semibold",children:"Configure and run the attack"}),(0,s.jsx)(c.$,{variant:"ghost",size:"sm",className:"ml-auto",onClick:()=>l(o.sdkCode,"sdk"),children:"sdk"===a?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(ee.A,{className:"h-4 w-4 text-green-500 mr-1"}),"Copied!"]}):(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(et.A,{className:"h-4 w-4 mr-1"}),"Copy"]})})]}),(0,s.jsx)(X.F,{className:"ml-10",children:(0,s.jsx)("div",{className:"bg-muted rounded-lg p-4 font-mono text-xs overflow-x-auto",children:(0,s.jsx)("pre",{children:o.sdkCode})})})]}),(0,s.jsxs)("div",{className:"space-y-3",children:[(0,s.jsxs)("div",{className:"flex items-center gap-3",children:[(0,s.jsx)(A.E,{variant:"outline",className:"h-7 w-7 rounded-full p-0 flex items-center justify-center",children:"3"}),(0,s.jsx)("h3",{className:"font-semibold",children:"Review your runs"})]}),(0,s.jsxs)("div",{className:"ml-10 space-y-3",children:[(0,s.jsxs)("div",{className:"flex flex-wrap gap-2",children:[(0,s.jsx)("span",{className:"text-sm text-muted-foreground",children:"Vulnerabilities tested:"}),o.riskAreas.map(e=>(0,s.jsxs)(A.E,{variant:"secondary",className:"flex items-center gap-1",children:[(0,s.jsx)(k.A,{className:"h-3 w-3"}),e]},e))]}),(0,s.jsxs)("div",{className:"flex items-center gap-4 text-sm text-muted-foreground",children:[(0,s.jsxs)("span",{className:"flex items-center gap-1",children:[(0,s.jsx)(ea.A,{className:"h-4 w-4"}),"Vulnerability summary"]}),(0,s.jsxs)("span",{className:"flex items-center gap-1",children:[(0,s.jsx)(G.A,{className:"h-4 w-4"}),"Attack success rates"]})]})]})]}),(0,s.jsxs)("div",{className:"pt-4 border-t flex flex-col sm:flex-row items-center justify-between gap-4",children:[(0,s.jsx)("p",{className:"text-sm text-muted-foreground",children:"Ready to test your agent?"}),(0,s.jsxs)("div",{className:"flex gap-3",children:[(0,s.jsx)(i(),{href:"/agents",children:(0,s.jsxs)(c.$,{variant:"outline",children:[(0,s.jsx)(N.A,{className:"h-4 w-4"}),"Configure target"]})}),(0,s.jsx)(i(),{href:"/stats",children:(0,s.jsxs)(c.$,{children:[(0,s.jsx)(es.A,{className:"h-4 w-4"}),"View Runs",(0,s.jsx)(y.A,{className:"h-4 w-4"})]})})]})]})]})]})})]})}var el=a(46826);let ei="Get a security risk assessment for your AI agent in minutes";function ec(){let{user:e,isAuthenticated:t,isLoading:a,login:l}=(0,n.h)(),[m,u]=(0,r.useState)(null);return((0,r.useEffect)(()=>{if(t||a||!l)return;let e=new URLSearchParams(window.location.search);e.has("code")&&e.has("state")||l()},[a,t,l]),a)?(0,s.jsx)(d.M,{title:"Welcome",description:ei,children:(0,s.jsxs)("div",{className:"px-6 space-y-4",children:[(0,s.jsx)("div",{className:"grid grid-cols-3 gap-4",children:[0,1,2].map(e=>(0,s.jsx)(o.E,{className:"h-24 w-full"},e))}),(0,s.jsx)(o.E,{className:"h-56 w-full"})]})}):t?(0,s.jsx)(d.M,{title:"Welcome, ".concat(e&&(e.name||e.preferred_username||e.nickname||e.email)||"User","!"),description:ei,action:(0,s.jsx)(i(),{href:"/attacks",children:(0,s.jsxs)(c.$,{size:"sm",children:[(0,s.jsx)(el.A,{className:"h-4 w-4"}),"New campaign"]})}),children:(0,s.jsxs)("div",{className:"px-6 space-y-6",children:[(0,s.jsx)($,{hideEmptyState:!0,onLoaded:u}),(null==m?void 0:m.totalResults)===0&&(0,s.jsx)(er,{})]})}):null}},34105:(e,t,a)=>{"use strict";a.d(t,{c:()=>s});let s=(0,a(12115).createContext)(void 0)},46767:(e,t,a)=>{"use strict";a.d(t,{Bc:()=>l,ZI:()=>o,k$:()=>c,m_:()=>i});var s=a(95155);a(12115);var n=a(53583),r=a(64269);function l(e){let{delayDuration:t=0,...a}=e;return(0,s.jsx)(n.Kq,{"data-slot":"tooltip-provider",delayDuration:t,...a})}function i(e){let{...t}=e;return(0,s.jsx)(l,{children:(0,s.jsx)(n.bL,{"data-slot":"tooltip",...t})})}function c(e){let{...t}=e;return(0,s.jsx)(n.l9,{"data-slot":"tooltip-trigger",...t})}function o(e){let{className:t,sideOffset:a=0,children:l,...i}=e;return(0,s.jsx)(n.ZL,{children:(0,s.jsxs)(n.UC,{"data-slot":"tooltip-content",sideOffset:a,className:(0,r.cn)("bg-primary text-primary-foreground animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-fit origin-(--radix-tooltip-content-transform-origin) rounded-md px-3 py-1.5 text-xs text-balance",t),...i,children:[l,(0,s.jsx)(n.i3,{className:"bg-primary fill-primary z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px]"})]})})}},65761:(e,t,a)=>{Promise.resolve().then(a.bind(a,27677))},73474:(e,t,a)=>{"use strict";a.d(t,{Bc:()=>n,NQ:()=>i,zG:()=>s,wN:()=>l,AZ:()=>x,V$:()=>m,eW:()=>o,of:()=>u,_9:()=>d,f_:()=>c});let s=[{id:"classic-light",label:"Classic Light",mode:"light",description:"Soft neutral grays and a quiet, minimal feel."},{id:"slate-light",label:"Slate Light",mode:"light",description:"Cool slate surfaces with crisp white cards."},{id:"classic-dark",label:"Classic Dark",mode:"dark",description:"The original charcoal and neutral gray palette."},{id:"slate-dark",label:"Slate Dark",mode:"dark",description:"The current deep blue and slate palette."}],n={light:"slate-light",dark:"slate-dark"},r={light:"slate-light",dark:"slate-dark"},l="hackagent-theme",i="(prefers-color-scheme: dark)";function c(e){var t,a;return"light"===e||"dark"===e?r[e]:null!=(a=null==(t=s.find(t=>t.id===e))?void 0:t.id)?a:"system"}function o(e,t){let a="system"===e?n[t]:e;return s.find(e=>e.id===a)}function d(){return window.matchMedia(i).matches?"dark":"light"}function m(){try{return c(localStorage.getItem(l))}catch(e){return"system"}}function u(e){try{localStorage.setItem(l,e)}catch(e){}}function x(e){let t=document.documentElement;t.dataset.theme=e.id,t.classList.toggle("dark","dark"===e.mode),t.style.colorScheme=e.mode}let h=Object.fromEntries(s.map(e=>[e.id,e.mode]));"(() => {\n const modes = ".concat(JSON.stringify(h),";\n const defaults = ").concat(JSON.stringify(n),";\n const legacy = ").concat(JSON.stringify(r),";\n let preference;\n try { preference = localStorage.getItem('").concat(l,"'); } catch {}\n if (preference === 'light' || preference === 'dark') preference = legacy[preference];\n const system = window.matchMedia('").concat(i,"').matches ? 'dark' : 'light';\n const id = Object.prototype.hasOwnProperty.call(modes, preference) ? preference : defaults[system];\n document.documentElement.dataset.theme = id;\n document.documentElement.classList.toggle('dark', modes[id] === 'dark');\n document.documentElement.style.colorScheme = modes[id];\n})();")},80230:(e,t,a)=>{"use strict";a.d(t,{h:()=>l});var s=a(12115),n=a(34105);let r=async()=>"";function l(){let e=(0,s.useContext)(n.c);return e||{provider:"disabled",user:void 0,isAuthenticated:!1,isLoading:!0,login:void 0,logout:void 0,getAccessTokenSilently:r}}},86948:(e,t,a)=>{"use strict";a.d(t,{BT:()=>c,Wu:()=>d,X9:()=>o,ZB:()=>i,Zp:()=>r,aR:()=>l});var s=a(95155);a(12115);var n=a(64269);function r(e){let{className:t,...a}=e;return(0,s.jsx)("div",{"data-slot":"card",className:(0,n.cn)("bg-card text-card-foreground flex flex-col gap-6 rounded border py-6",t),...a})}function l(e){let{className:t,...a}=e;return(0,s.jsx)("div",{"data-slot":"card-header",className:(0,n.cn)("@container/card-header grid auto-rows-min grid-rows-[auto_auto] items-start gap-1.5 px-6 has-data-[slot=card-action]:grid-cols-[1fr_auto] [.border-b]:pb-6",t),...a})}function i(e){let{className:t,...a}=e;return(0,s.jsx)("div",{"data-slot":"card-title",className:(0,n.cn)("leading-none font-semibold",t),...a})}function c(e){let{className:t,...a}=e;return(0,s.jsx)("div",{"data-slot":"card-description",className:(0,n.cn)("text-muted-foreground text-sm",t),...a})}function o(e){let{className:t,...a}=e;return(0,s.jsx)("div",{"data-slot":"card-action",className:(0,n.cn)("col-start-2 row-span-2 row-start-1 self-start justify-self-end",t),...a})}function d(e){let{className:t,...a}=e;return(0,s.jsx)("div",{"data-slot":"card-content",className:(0,n.cn)("px-6",t),...a})}},96042:(e,t,a)=>{"use strict";a.d(t,{D:()=>i,ThemeProvider:()=>c});var s=a(95155),n=a(12115),r=a(73474);let l=(0,n.createContext)({theme:"system",resolvedTheme:"light",resolvedStyle:r.Bc.light,setTheme:()=>{}});function i(){return(0,n.useContext)(l)}function c(e){let{children:t}=e,[a,i]=(0,n.useState)({theme:"system",resolvedTheme:"light",resolvedStyle:r.Bc.light}),c=(0,n.useCallback)(e=>{let t=(0,r.eW)(e,(0,r._9)());(0,r.AZ)(t),i({theme:e,resolvedTheme:t.mode,resolvedStyle:t.id})},[]);(0,n.useEffect)(()=>{c((0,r.V$)());let e=e=>{(e.key===r.wN||null===e.key)&&c((0,r.f_)(e.newValue))};return window.addEventListener("storage",e),()=>window.removeEventListener("storage",e)},[c]),(0,n.useEffect)(()=>{if("system"!==a.theme)return;let e=window.matchMedia(r.NQ),t=()=>c("system");return e.addEventListener("change",t),()=>e.removeEventListener("change",t)},[a.theme,c]);let o=(0,n.useCallback)(e=>{c(e),(0,r.of)(e)},[c]);return(0,s.jsx)(l.Provider,{value:{...a,setTheme:o},children:t})}}},e=>{e.O(0,[187,619,870,583,389,103,160,970,924,441,493,358],()=>e(e.s=65761)),_N_E=e.O()}]);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[266],{22470:(e,t,a)=>{"use strict";a.d(t,{M:()=>n});var r=a(95155);a(12115);let n=e=>{let{title:t,description:a,action:n,children:s,maxWidth:l="full",compact:o=!1}=e;return(0,r.jsxs)("div",{className:"w-full ".concat({full:"max-w-full","8xl":"max-w-[90rem]","7xl":"max-w-7xl","6xl":"max-w-6xl","5xl":"max-w-5xl","4xl":"max-w-4xl","3xl":"max-w-3xl","2xl":"max-w-2xl"}[l]||"max-w-full"," mx-auto ").concat(o?"py-3 space-y-3":"py-6 space-y-6"),children:[t&&(0,r.jsxs)("div",{className:"flex flex-col sm:flex-row sm:items-start sm:justify-between gap-3 border-b ".concat(o?"px-4 pb-3":"px-6 pb-5"),children:[(0,r.jsxs)("div",{children:[(0,r.jsx)("h1",{className:"text-2xl font-semibold tracking-tight",children:t}),a&&(0,r.jsx)("p",{className:"text-sm text-muted-foreground mt-1",children:a})]}),n&&(0,r.jsx)("div",{className:"flex-shrink-0 pt-0.5",children:n})]}),s]})}},35835:(e,t,a)=>{"use strict";a.d(t,{T:()=>s});var r=a(95155);a(12115);var n=a(98053);let s=e=>{let{open:t,onOpenChange:a,title:s,description:l,onConfirm:o,confirmText:i="Confirm",cancelText:c="Cancel",variant:d="default"}=e;return(0,r.jsx)(n.Lt,{open:t,onOpenChange:a,children:(0,r.jsxs)(n.EO,{children:[(0,r.jsxs)(n.wd,{children:[(0,r.jsx)(n.r7,{children:s}),(0,r.jsx)(n.$v,{children:l})]}),(0,r.jsxs)(n.ck,{children:[(0,r.jsx)(n.Zr,{children:c}),(0,r.jsx)(n.Rx,{onClick:()=>{o(),a(!1)},className:"destructive"===d?"bg-destructive text-destructive-foreground hover:bg-destructive/90":"",children:i})]})]})})}},46767:(e,t,a)=>{"use strict";a.d(t,{Bc:()=>l,ZI:()=>c,k$:()=>i,m_:()=>o});var r=a(95155);a(12115);var n=a(53583),s=a(64269);function l(e){let{delayDuration:t=0,...a}=e;return(0,r.jsx)(n.Kq,{"data-slot":"tooltip-provider",delayDuration:t,...a})}function o(e){let{...t}=e;return(0,r.jsx)(l,{children:(0,r.jsx)(n.bL,{"data-slot":"tooltip",...t})})}function i(e){let{...t}=e;return(0,r.jsx)(n.l9,{"data-slot":"tooltip-trigger",...t})}function c(e){let{className:t,sideOffset:a=0,children:l,...o}=e;return(0,r.jsx)(n.ZL,{children:(0,r.jsxs)(n.UC,{"data-slot":"tooltip-content",sideOffset:a,className:(0,s.cn)("bg-primary text-primary-foreground animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-fit origin-(--radix-tooltip-content-transform-origin) rounded-md px-3 py-1.5 text-xs text-balance",t),...o,children:[l,(0,r.jsx)(n.i3,{className:"bg-primary fill-primary z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px]"})]})})}},49819:(e,t,a)=>{Promise.resolve().then(a.bind(a,56852))},51834:(e,t,a)=>{"use strict";a.d(t,{Cf:()=>u,Es:()=>x,HM:()=>c,L3:()=>p,c7:()=>m,lG:()=>o,rr:()=>h});var r=a(95155);a(12115);var n=a(88292),s=a(65229),l=a(64269);function o(e){let{...t}=e;return(0,r.jsx)(n.bL,{"data-slot":"dialog",...t})}function i(e){let{...t}=e;return(0,r.jsx)(n.ZL,{"data-slot":"dialog-portal",...t})}function c(e){let{...t}=e;return(0,r.jsx)(n.bm,{"data-slot":"dialog-close",...t})}function d(e){let{className:t,...a}=e;return(0,r.jsx)(n.hJ,{"data-slot":"dialog-overlay",className:(0,l.cn)("data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50",t),...a})}function u(e){let{className:t,children:a,...o}=e;return(0,r.jsxs)(i,{"data-slot":"dialog-portal",children:[(0,r.jsx)(d,{}),(0,r.jsxs)(n.UC,{"data-slot":"dialog-content",className:(0,l.cn)("bg-background data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border p-6 shadow-lg duration-200 sm:max-w-lg",t),...o,children:[a,(0,r.jsxs)(n.bm,{className:"ring-offset-background focus:ring-ring data-[state=open]:bg-accent data-[state=open]:text-muted-foreground absolute top-4 right-4 rounded-xs opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",children:[(0,r.jsx)(s.A,{}),(0,r.jsx)("span",{className:"sr-only",children:"Close"})]})]})]})}function m(e){let{className:t,...a}=e;return(0,r.jsx)("div",{"data-slot":"dialog-header",className:(0,l.cn)("flex flex-col gap-2 text-center sm:text-left",t),...a})}function x(e){let{className:t,...a}=e;return(0,r.jsx)("div",{"data-slot":"dialog-footer",className:(0,l.cn)("flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",t),...a})}function p(e){let{className:t,...a}=e;return(0,r.jsx)(n.hE,{"data-slot":"dialog-title",className:(0,l.cn)("text-lg leading-none font-semibold",t),...a})}function h(e){let{className:t,...a}=e;return(0,r.jsx)(n.VY,{"data-slot":"dialog-description",className:(0,l.cn)("text-muted-foreground text-sm",t),...a})}},56852:(e,t,a)=>{"use strict";a.r(t),a.d(t,{default:()=>tz});var r=a(95155),n=a(12115),s=a(52619),l=a.n(s),o=a(20063),i=a(35299),c=a(71847);let d=(0,c.A)("refresh-cw",[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]]);var u=a(22470),m=a(34015),x=a(3998),p=a(68600);function h(e){let t=n.useRef(null),[a,r]=n.useState(e);return n.useEffect(()=>{let e=t.current;if(!e||"undefined"==typeof ResizeObserver)return;let a=()=>{e.clientWidth>0&&r(e.clientWidth)};a();let n=new ResizeObserver(a);return n.observe(e),()=>n.disconnect()},[]),[t,a]}let g={jailbroken:"var(--viz-jailbroken)",mitigated:"var(--viz-mitigated)",unresolved:"var(--viz-unresolved)",error:"var(--viz-error)"},f={static:"Static",adaptive:"Adaptive",multi_turn:"Multi-turn",indirect:"Indirect"},v=e=>"var(--viz-family-".concat(e&&f[e]?e:"other",")"),b=e=>[{name:"Jailbroken",value:e.jailbroken,color:g.jailbroken},{name:"Mitigated",value:e.mitigated,color:g.mitigated},{name:"Unresolved",value:e.unresolved,color:g.unresolved}];function j(e){let{label:t,values:a,max:n,color:s="currentColor",bars:l=!1}=e,o=null!=n?n:Math.max(1,...a.map(e=>null!=e?e:0)),i=e=>+(3+(1-e/o)*24).toFixed(2),c=a.flatMap((e,t)=>null===e?[]:["".concat(a.length>1?+(100*t/(a.length-1)).toFixed(2):50,",").concat(i(e))]);return(0,r.jsx)("svg",{role:"img","aria-label":t,viewBox:"0 0 100 30",preserveAspectRatio:"none",className:"h-8 w-full overflow-visible",style:{color:s},children:l?a.map((e,t)=>null===e?null:(0,r.jsx)("rect",{x:100*t/a.length+.6,width:Math.max(.8,100/a.length-1.2),y:i(e),height:27-i(e),fill:"currentColor",opacity:"0.75"},t)):(0,r.jsxs)(r.Fragment,{children:[c.length>1&&(0,r.jsx)("polygon",{points:"".concat(c[0].split(",")[0],",27 ").concat(c.join(" ")," ").concat(c[c.length-1].split(",")[0],",27"),fill:"currentColor",opacity:"0.12"}),(0,r.jsx)("polyline",{points:c.join(" "),fill:"none",stroke:"currentColor",strokeWidth:"1.75",vectorEffect:"non-scaling-stroke",strokeLinejoin:"round"})]})})}function y(e){let{label:t,segments:a,className:n="h-2"}=e,s=a.reduce((e,t)=>e+t.value,0);return(0,r.jsx)("div",{role:"img","aria-label":"".concat(t,": ").concat(a.map(e=>"".concat(e.name," ").concat(e.value)).join(", ")),className:"flex w-full overflow-hidden rounded-full bg-muted ".concat(n),children:s>0&&a.map(e=>(0,r.jsx)("span",{title:"".concat(e.name,": ").concat(e.value),className:"h-full",style:{width:"".concat(+(100*e.value/s).toFixed(2),"%"),backgroundColor:e.color}},e.name))})}function k(e){let{label:t,value:a,detail:n,children:s}=e;return(0,r.jsxs)("div",{className:"kpi-card",children:[(0,r.jsx)("p",{className:"kpi-label truncate",children:t}),(0,r.jsx)("p",{className:"kpi-value truncate",children:a}),(0,r.jsx)("p",{className:"min-h-8 text-xs leading-4 text-muted-foreground line-clamp-2",children:n}),(0,r.jsx)("div",{className:"flex h-8 items-end",children:s})]})}let N=["#4269d0","#efb118","#ff725c","#6cc5b0","#3ca951","#ff8ab7","#a463f2","#97bbf5","#9c6b4e","#d4a373","#2a9d8f","#e76f51"],w=/unclassified|unknown/i;function S(e){let{info:t,className:a=""}=e;return t?(0,r.jsx)("span",{"aria-hidden":"true",title:t.name,className:"inline-flex h-5 min-w-5 shrink-0 items-center justify-center rounded px-1 text-[10px] font-semibold leading-none text-white ".concat(a),style:{backgroundColor:t.color},children:t.code}):null}function C(e){if(null==e||!Number.isFinite(e))return"—";let t=Math.abs(e);return t>=1e6?"".concat((e/1e6).toFixed(t>=1e7?0:1),"M"):t>=1e4?"".concat((e/1e3).toFixed(0),"k"):t>=1e3?"".concat((e/1e3).toFixed(1),"k"):t>=10||Number.isInteger(e)?e.toFixed(0):e.toFixed(1)}function _(e){if(null==e||!Number.isFinite(e))return"—";if(e<1)return"".concat(Math.round(1e3*e)," ms");if(e<60)return"".concat(e.toFixed(+(e<10))," s");let t=Math.round(e/60);if(t<60)return"".concat(t," min");let a=Math.floor(t/60);return"".concat(a," h ").concat(t%60," min")}let A={target:"var(--viz-role-target)",attacker:"var(--viz-role-attacker)",judge:"var(--viz-role-judge)"};function M(e){let{items:t}=e;return(0,r.jsx)("ul",{className:"flex flex-wrap gap-x-4 gap-y-1 text-xs text-muted-foreground","aria-label":"Legend",children:t.map(e=>(0,r.jsxs)("li",{className:"flex items-center gap-1.5",children:[(0,r.jsx)("span",{"aria-hidden":"true",className:"h-2.5 w-2.5 rounded-sm",style:{backgroundColor:e.color}}),e.name]},e.name))})}let L=e=>e&&e.recorded_goals>0?100*e.jailbroken/e.recorded_goals:null,R={COMPLETED:"bg-emerald-500",RUNNING:"bg-sky-500 animate-pulse",PENDING:"bg-slate-400",FAILED:"bg-rose-500"};function z(e){var t;let{status:a}=e;return(0,r.jsxs)("span",{className:"inline-flex items-center gap-1.5 text-xs font-medium",children:[(0,r.jsx)("span",{"aria-hidden":"true",className:"h-2 w-2 rounded-full ".concat(null!=(t=R[a])?t:"bg-amber-500")}),a.charAt(0)+a.slice(1).toLowerCase()]})}function E(e){let{campaign:t,costs:a}=e,n=t.category_outcomes.filter(e=>/unclassified|unknown/i.test(e.category)).reduce((e,t)=>e+t.recorded_goals,0),s=t.runs.map(e=>{var t;return{run:e,value:L(null!=(t=e.outcomes)?t:void 0)}}).filter(e=>null!==e.value).sort((e,t)=>t.value-e.value),l=L(t),o=function(e){if(!(null==e?void 0:e.runs.length))return null;let t=t=>e.runs.reduce((e,a)=>{var r;return e+(null!=(r=t(a))?r:0)},0);return{target:t(e=>e.calls.target),attacker:t(e=>e.calls.attacker),judge:t(e=>e.calls.judge),untraced:e.runs.filter(e=>!e.calls_traced).length,prompt:t(e=>{var t;return null==(t=e.target_tokens)?void 0:t.prompt}),completion:t(e=>{var t;return null==(t=e.target_tokens)?void 0:t.completion}),elapsed:t(e=>e.elapsed_s)}}(a),i=o?o.target+o.attacker+o.judge:null,c=o?o.prompt+o.completion:null,d=a?[...a.runs].sort((e,t)=>t.elapsed_s-e.elapsed_s):[],u=e=>{let a=t.runs.find(t=>t.id===e);return a?(0,p.aN)(a,t.runs):e};return(0,r.jsxs)("section",{"aria-label":"Campaign outcomes",className:"space-y-3",children:[(0,r.jsxs)("div",{className:"flex flex-wrap items-center gap-x-3 gap-y-1 text-sm text-muted-foreground",children:[(0,r.jsx)(z,{status:t.status}),(0,r.jsx)("span",{"aria-hidden":"true",children:"\xb7"}),(0,r.jsx)("span",{children:t.target}),(0,r.jsx)("span",{"aria-hidden":"true",children:"\xb7"}),(0,r.jsx)("time",{children:new Date(t.created_at).toLocaleString()}),o&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("span",{"aria-hidden":"true",children:"\xb7"}),(0,r.jsxs)("span",{children:[_(o.elapsed)," of attack time"]})]})]}),(0,r.jsxs)("div",{className:"grid auto-rows-fr grid-cols-2 gap-3 md:grid-cols-3 xl:grid-cols-6",children:[(0,r.jsx)(k,{label:"Attack success rate",value:null===l?"Not measured":"".concat(l.toFixed(1),"%"),detail:"".concat(t.jailbroken," of ").concat(t.recorded_goals," goals broken by at least one attack"),children:(0,r.jsx)(y,{label:"Goal outcomes",segments:b(t)})}),(0,r.jsx)(k,{label:"Goals",value:t.recorded_goals,detail:"".concat(t.recorded_goals-n," classified \xb7 ").concat(n," unclassified"),children:(0,r.jsx)(y,{label:"Goal classification",segments:[{name:"Classified",value:t.recorded_goals-n,color:"var(--viz-family-static)"},{name:"Unclassified",value:n,color:"var(--viz-error)"}]})}),(0,r.jsx)(k,{label:"Attacks",value:t.attack_runs,detail:s.length?"best: ".concat((0,p.aN)(s[0].run,t.runs)," ").concat(s[0].value.toFixed(0),"%"):"No attack outcomes",children:(0,r.jsx)("div",{className:"w-full",style:{color:s[0]?v(s[0].run.family):void 0},children:(0,r.jsx)(j,{bars:!0,max:100,values:s.map(e=>e.value),label:"ASR per attack, best first: ".concat(s.map(e=>"".concat((0,p.aN)(e.run,t.runs)," ").concat(e.value.toFixed(1),"%")).join(", "))})})}),(0,r.jsx)(k,{label:"LLM calls",value:null===i?t.attempts.toLocaleString():C(i),detail:null===i?"stored attempts \xb7 calls not recorded":"".concat(t.attempts.toLocaleString()," attempts").concat(o.untraced?" \xb7 ".concat(o.untraced," ").concat(1===o.untraced?"attack":"attacks"," not traced"):""),children:o&&(0,r.jsx)(y,{label:"LLM calls by role",segments:[{name:"Target",value:o.target,color:A.target},{name:"Attacker",value:o.attacker,color:A.attacker},{name:"Judge",value:o.judge,color:A.judge}]})}),(0,r.jsx)(k,{label:"Target tokens",value:c?C(c):"Not recorded",detail:c?"".concat(C(o.prompt)," prompt \xb7 ").concat(C(o.completion)," completion"):"the target did not report usage",children:c?(0,r.jsx)(y,{label:"Target tokens",segments:[{name:"Prompt",value:o.prompt,color:A.target},{name:"Completion",value:o.completion,color:"var(--viz-family-adaptive)"}]}):null}),(0,r.jsx)(k,{label:"Attack time",value:o?_(o.elapsed):"Not recorded",detail:d[0]?"longest: ".concat(u(d[0].run_id)," ").concat(_(d[0].elapsed_s)):"first to last stored result",children:d.length>0&&(0,r.jsx)("div",{className:"w-full text-muted-foreground",children:(0,r.jsx)(j,{bars:!0,values:d.map(e=>e.elapsed_s),label:"Time per attack, longest first: ".concat(d.map(e=>"".concat(u(e.run_id)," ").concat(_(e.elapsed_s))).join(", "))})})})]})]})}var F=a(46767);let T="rounded-lg border bg-muted/10 p-3",I="flex cursor-pointer items-start gap-2 rounded-md border p-2 text-left text-xs transition-colors hover:bg-muted/50 focus-within:ring-2 focus-within:ring-ring focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",O="border-foreground/40 bg-muted/60 ring-1 ring-foreground/20";function P(e){let{description:t,children:a,onSelect:s,selected:l,opacity:o=1}=e,[i,c]=(0,n.useState)(!1),d=()=>{c(!0),null==s||s()};return(0,r.jsxs)(F.m_,{open:i,onOpenChange:c,children:[(0,r.jsx)(F.k$,{asChild:!0,children:(0,r.jsx)("g",{role:s?"button":"group",tabIndex:0,"aria-label":t.replace(/\s+/g," "),"aria-pressed":l,opacity:o,className:"cursor-pointer outline-offset-2",onClick:d,onKeyDown:e=>{("Enter"===e.key||" "===e.key)&&(e.preventDefault(),d())},children:a})}),(0,r.jsx)(F.ZI,{sideOffset:8,className:"max-h-[min(28rem,70dvh)] max-w-80 overflow-y-auto whitespace-pre-wrap px-4 py-3 text-left text-xs leading-relaxed tabular-nums",children:t})]})}var D=a(26333);let U=e=>Math.sign(e)*(1>=Math.abs(e)?Math.abs(e):1+Math.log(Math.abs(e))),H=e=>Math.sign(e)*(1>=Math.abs(e)?Math.abs(e):Math.exp(Math.abs(e)-1)),W=(e,t)=>null!=e&&(null==t?void 0:t.goals)?e/t.goals:null,G=(e,t)=>{let a=null==e?void 0:e.goal_samples;return!(null==a?void 0:a.length)||a.some(e=>null===e[t])?null:a.reduce((e,a)=>{var r;return e+(null!=(r=a[t])?r:0)},0)/a.length},q={attempts:{label:"Attempts",axis:"Attempts per goal",unit:"attempts per goal",format:e=>e.toFixed(1),tick:C,value:e=>e.outcomes&&e.outcomes.recorded_goals>0&&e.outcomes.attempts>0?e.outcomes.attempts/e.outcomes.recorded_goals:null},calls:{label:"LLM calls",axis:"LLM calls per goal",unit:"LLM calls per goal",format:e=>e.toFixed(1),tick:C,value:(e,t)=>(null==t?void 0:t.goal_samples)?G(t,"calls"):(null==t?void 0:t.calls_traced)&&null!==t.calls.attacker&&null!==t.calls.judge?W(t.calls.target+t.calls.attacker+t.calls.judge,t):null},tokens:{label:"Target tokens",axis:"Target tokens per goal",unit:"target tokens per goal",format:C,tick:C,value:(e,t)=>(null==t?void 0:t.goal_samples)?G(t,"target_tokens"):W((null==t?void 0:t.target_tokens)?t.target_tokens.prompt+t.target_tokens.completion:null,t)},time:{label:"Time",axis:"Attack time per goal",unit:"per goal",format:_,tick:_,value:(e,t)=>{var a;return(null==t||null==(a=t.goal_samples)?void 0:a.length)?t.goal_samples.reduce((e,t)=>e+t.elapsed_s,0)/t.goal_samples.length:null}}},J=["target","attacker","judge"];function K(e){let{campaign:t,costs:a}=e;return(0,r.jsx)(B,{campaign:t,costs:a})}function B(e){let{campaign:t,costs:a,firstSuccess:n=!1}=e,[s,l]=h(1100),o=n?["first_attempt","first_time"]:["calls","tokens","attempts","time"],i={...q,first_attempt:{label:"Attempts to first jailbreak",format:e=>e.toFixed(1),tick:C},first_time:{label:"Time to first jailbreak",format:_,tick:_}},c=t.runs.map(e=>{var t;return{run:e,rate:L(null!=(t=e.outcomes)?t:void 0),cost:null==a?void 0:a.runs.find(t=>t.run_id===e.id)}}).sort((e,t)=>{var a,r;return(null!=(a=t.rate)?a:-1)-(null!=(r=e.rate)?r:-1)}),d=o.map(e=>{let t=c.map(t=>{var a;let{cost:r}=t;return(null!=(a=null==r?void 0:r.goal_samples)?a:[]).flatMap(t=>{if(n&&null==t.first_jailbreak_attempt)return[];let a="first_attempt"===e?t.first_jailbreak_attempt:"first_time"===e?t.first_jailbreak_elapsed_s:"tokens"===e?t.target_tokens:"time"===e?t.elapsed_s:t[e];return null!=a&&Number.isFinite(a)&&a>=0?[a]:[]})});return{metric:e,samples:t,...function(e){let t=e.filter(e=>Number.isFinite(e)&&e>=0),a=t.length?Math.min(...t):0,r=t.length?Math.max(...t):1,n=U(a),s=U(r)-n,l=e=>s?Math.max(0,Math.min(1,(U(e)-n)/s)):.5,o=[a];if(r>a){for(let e of function(e,t){let a=[];for(let r=Math.floor(Math.log10(e));r<=Math.ceil(Math.log10(t));r+=1)for(let n of[1,2,5]){let s=n*10**r;s>=e&&s<=t&&a.push(+s.toPrecision(3))}return a}(Math.max(a,r<1?r/100:1),r))l(e)-l(o[o.length-1])>=.25&&.75>=l(e)&&o.push(e);o.push(r)}return{min:a,max:r,ticks:o,position:l}}(t.flat())}}),u=Math.max(n?720:1120,l),m=n?190:160,x=(u-m-16*o.length)/o.length,g=n?80:68,f=56+c.length*g,b=f+42;return(0,r.jsxs)("figure",{className:"min-w-0 space-y-3","aria-label":n?"First-success distributions ranked by ASR":"Cost distributions ranked by ASR",children:[(0,r.jsx)("div",{ref:s,className:"overflow-x-auto rounded-lg border",children:(0,r.jsxs)("svg",{width:u,height:b,className:"block",role:"group","aria-label":n?"Per-goal first-success violins":"Per-goal cost violins",children:[(0,r.jsx)("text",{x:16,y:24,fontSize:12,fontWeight:600,fill:"var(--foreground)",children:"Attack \xb7 ASR"}),(0,r.jsx)("text",{x:16,y:42,fontSize:10,fill:"var(--muted-foreground)",children:"Highest success first"}),c.map((e,a)=>{var s,l,o,i;let{run:c,rate:d}=e,m=56+a*g;return(0,r.jsxs)("g",{"aria-label":"".concat((0,p.aN)(c,t.runs),": ").concat(null===d?"ASR not recorded":"".concat(d.toFixed(1),"% ASR")),children:[a%2==0&&(0,r.jsx)("rect",{x:0,y:m,width:u,height:g,fill:"var(--muted)",fillOpacity:.35}),(0,r.jsx)("text",{x:16,y:m+26,fontSize:12,fontWeight:600,fill:"var(--foreground)",children:(0,p.aN)(c,t.runs)}),(0,r.jsx)("text",{x:16,y:m+44,fontSize:11,fill:"var(--muted-foreground)",children:null===d?"Not recorded":"".concat(d.toFixed(1),"%")}),n&&(0,r.jsxs)("text",{x:16,y:m+62,fontSize:10,fill:"var(--muted-foreground)",children:["Succeeded: ",null!=(o=null==(s=c.outcomes)?void 0:s.jailbroken)?o:"–","/",null!=(i=null==(l=c.outcomes)?void 0:l.recorded_goals)?i:"–"," goals"]})]},c.id)}),d.map((e,a)=>{let{metric:s,samples:l,min:o,max:d,ticks:u,position:h}=e,j=i[s],y=m+a*(x+16),k=e=>y+18+h(e)*(x-44);return(0,r.jsxs)("g",{role:"group","aria-label":"".concat(j.label," distributions"),"data-domain-min":o,"data-domain-max":d,children:[(0,r.jsx)("rect",{"aria-hidden":"true",x:y+x,y:0,width:16,height:b,fill:"var(--background)"}),(0,r.jsx)("rect",{"data-cost-panel":s,"aria-hidden":"true",x:y,y:1,width:x,height:b-2,rx:8,fill:"none",stroke:"var(--border)",strokeWidth:1.5}),(0,r.jsx)("path",{"aria-hidden":"true",d:"M".concat(y+1,",").concat(56,"H").concat(y+x-1," M").concat(y+1,",").concat(f,"H").concat(y+x-1),stroke:"var(--border)"}),(0,r.jsx)("text",{x:y+x/2,y:26,textAnchor:"middle",fontSize:12,fontWeight:600,fill:"var(--foreground)",children:j.label}),(0,r.jsx)("text",{x:y+x/2,y:43,textAnchor:"middle",fontSize:10,fill:"var(--muted-foreground)",children:n?"successful goals \xb7 symlog":"per goal \xb7 symlog"}),u.map((e,t)=>(0,r.jsxs)("g",{"data-axis-tick":e,children:[(0,r.jsx)("line",{x1:k(e),x2:k(e),y1:56,y2:f,stroke:"var(--border)",strokeDasharray:"2 5"}),(0,r.jsx)("text",{x:k(e),y:f+24,textAnchor:1===u.length?"middle":0===t?"start":t===u.length-1?"end":"middle",fontSize:10,fill:"var(--muted-foreground)",children:j.tick(e)})]},e)),c.map((e,a)=>{var o,i,c,d,u,m;let{run:f,cost:b}=e,N=l[a],w=function(e){let t=e.filter(Number.isFinite).sort((e,t)=>e-t);if(!t.length)return null;let a=e=>{let a=(t.length-1)*e,r=Math.floor(a);return t[r]+(t[Math.ceil(a)]-t[r])*(a-r)},r=a(.25),n=a(.5),s=a(.75),l=s-r,o=t.filter(e=>e>=r-1.5*l&&e<=s+1.5*l);return{q1:r,median:n,q3:s,low:o[0],high:o[o.length-1],n:t.length,outliers:t.filter(e=>e<r-1.5*l||e>s+1.5*l)}}(N),S=function(e){let t=e.filter(e=>Number.isFinite(e)&&e>=0).sort((e,t)=>e-t);if(t.length<5||new Set(t).size<3)return[];let a=t[0],r=t[t.length-1],n=t.reduce((e,t)=>e+t,0)/t.length,s=Math.max(1.06*Math.sqrt(t.reduce((e,t)=>e+(t-n)**2,0)/t.length)*t.length**-.2,(r-a)/80),l=Array.from({length:65},(e,n)=>{let l=a+(r-a)*n/64;return{value:l,density:t.reduce((e,t)=>e+Math.exp(-.5*((l-t)/s)**2),0)}}),o=Math.max(...l.map(e=>e.density));return l.map(e=>({value:e.value,density:e.density/o}))}(N.map(U)),C=56+a*g+27,_=(0,p.aN)(f,t.runs),A="calls"===s&&(null==b?void 0:b.goals)?"\n\nRecorded mean calls per goal\n".concat(J.map(e=>" ".concat(e[0].toUpperCase()+e.slice(1),": ").concat(null===b.calls[e]?"Not traced":(b.calls[e]/b.goals).toFixed(1))).join("\n")):"",M=w?"".concat(_," \xb7 ").concat(j.label," per goal\n\nMedian: ").concat(j.format(w.median),"\nMiddle 50%: ").concat(j.format(w.q1),"–").concat(j.format(w.q3),"\nRange: ").concat(j.format(Math.min(...N)),"–").concat(j.format(Math.max(...N)),"\nGoals measured: ").concat(N.length," of ").concat(n?null!=(d=null==(o=f.outcomes)?void 0:o.jailbroken)?d:N.length:null!=(u=null==b?void 0:b.goals)?u:N.length).concat(n?" successful goals":"").concat(A):"".concat(_," \xb7 ").concat(j.label,"\n\nNot recorded\nPer-goal measurements are required."),L=S.length?[...S.map(e=>"".concat(k(H(e.value)),",").concat(C-17*e.density)),...S.slice().reverse().map(e=>"".concat(k(H(e.value)),",").concat(C+17*e.density))].join(" "):"";return(0,r.jsxs)(P,{description:M,children:[(0,r.jsx)("rect",{x:y+2,y:56+a*g,width:x-4,height:g,fill:"transparent"}),w?(0,r.jsxs)(r.Fragment,{children:[L?(0,r.jsx)("polygon",{"data-violin":f.id,points:L,fill:v(f.family),fillOpacity:.35,stroke:v(f.family)}):(0,r.jsxs)("g",{"data-sparse":f.id,children:[(0,r.jsx)("line",{x1:k(Math.min(...N)),x2:k(Math.max(...N)),y1:C,y2:C,stroke:v(f.family)}),Array.from(new Set(N)).map(e=>(0,r.jsx)("circle",{cx:k(e),cy:C,r:3,fill:v(f.family)},e))]}),(0,r.jsx)("line",{"data-median-marker":f.id,x1:k(w.median),x2:k(w.median),y1:C-10,y2:C+10,stroke:"var(--foreground)",strokeWidth:2}),(0,r.jsxs)("text",{"data-median-label":f.id,x:k(w.median),y:C+29,textAnchor:.3>h(w.median)?"start":h(w.median)>.7?"end":"middle",fontSize:10,fill:"var(--muted-foreground)",children:["Median: ",j.format(w.median)]})]}):(0,r.jsx)("text",{x:y+x/2,y:C+4,textAnchor:"middle",fontSize:11,fill:"var(--muted-foreground)",children:n&&(null==(i=f.outcomes)?void 0:i.jailbroken)===0?"No jailbreak recorded":"Not recorded"}),n&&(0,r.jsxs)("text",{x:y+x/2,y:C+44,textAnchor:"middle",fontSize:10,fill:"var(--muted-foreground)",children:["Measured: ",N.length,"/",null!=(m=null==(c=f.outcomes)?void 0:c.jailbroken)?m:"–"," successful"]})]},f.id)})]},s)})]})}),(0,r.jsxs)("figcaption",{className:"text-xs leading-relaxed text-muted-foreground",children:["Rows are equally spaced and sorted by ASR. Each cost axis spans the observed minimum to maximum and uses symlog: linear from 0 to 1, logarithmic above 1 (one second for time). Tick labels show original units. Wider sections contain more goals with similar costs on this scale. The dark marker and labelled value show the median (50th percentile). Fewer than five measurements or fewer than three distinct values use dots and ranges instead. Only measured goals are included; missing costs are never treated as zero.",n?"Attempt order matches the recorded conversation. Timing runs from goal-search start to the earliest successful target response, including goal-level preparation and queueing but excluding its final judge evaluation. Older runs without that clock show Not recorded; database persistence timestamps are not used.":"Time spans the first to last recorded result per goal. Calls and target tokens are resource usage, not monetary spending."]}),!c.length&&(0,r.jsx)("p",{className:"text-sm text-muted-foreground",children:"No attacks recorded in this campaign."})]})}function $(e){var t,a;let{campaign:s,costs:l}=e,[o,i]=(0,n.useState)(()=>s.runs.map(e=>e.id)),[c,d]=h(700),u=[...s.runs].sort((e,t)=>{var a,r,n,s;return(null!=(r=L(null!=(a=t.outcomes)?a:void 0))?r:-1)-(null!=(s=L(null!=(n=e.outcomes)?n:void 0))?s:-1)}),m=u.filter(e=>o.includes(e.id)),x=function(e,t){let a=new Set,r=new Set,n=new Map,s=e.map(e=>{var a,r,n;let s=null==(a=t.runs.find(t=>t.run_id===e.id))?void 0:a.goal_samples;return!s||s.length!==(null==(r=e.outcomes)?void 0:r.recorded_goals)||new Set(s.map(e=>e.goal_index)).size!==s.length||s.some(e=>void 0===e.first_jailbreak_attempt||!Number.isInteger(e.attempts)||e.attempts<1||null!==e.first_jailbreak_attempt&&(!Number.isInteger(e.first_jailbreak_attempt)||e.first_jailbreak_attempt<1||e.first_jailbreak_attempt>e.attempts))||s.filter(e=>null!==e.first_jailbreak_attempt).length!==(null==(n=e.outcomes)?void 0:n.jailbroken)?null:{run:e,samples:s}});if(s.some(e=>null===e))return null;for(let e of s)if(e){for(let t of e.samples)if(a.add(t.goal_index),null!==t.first_jailbreak_attempt){var l;r.add(t.goal_index),n.set(t.goal_index,[...null!=(l=n.get(t.goal_index))?l:[],e.run.id])}}let o=e.map(e=>{var t,a;return{run:e,lost:Array.from(n.values()).filter(t=>1===t.length&&t[0]===e.id).length,tested:null!=(a=null==(t=s.find(t=>(null==t?void 0:t.run.id)===e.id))?void 0:t.samples.length)?a:0}}),i=Array.from(a).filter(e=>s.every(t=>null==t?void 0:t.samples.some(t=>t.goal_index===e))).length;return{tested:a.size,broken:r.size,remaining:a.size-r.size,fullyTested:i,contributions:o,asr:a.size?100*r.size/a.size:null}}(m,l),g=Math.max(520,d),f=g-86,b=[...null!=(a=null==x?void 0:x.contributions)?a:[]].sort((e,t)=>t.lost-e.lost),j=Math.max(1,...b.map(e=>e.lost));return(0,r.jsxs)("figure",{"aria-label":"Attack complementarity",className:"space-y-3 border-t pt-6",children:[(0,r.jsxs)("figcaption",{children:[(0,r.jsx)("h3",{className:"text-base font-semibold",children:"What does combining attacks gain?"}),(0,r.jsx)("p",{className:"mt-1 text-xs text-muted-foreground",children:"All recorded attempts \xb7 entire campaign, independent of coverage filters. Select any portfolio on the right."})]}),(0,r.jsxs)("div",{className:"grid items-start gap-4 lg:grid-cols-[minmax(0,1fr)_17rem]",children:[(0,r.jsx)("div",{className:"min-w-0 space-y-4",children:m.length?x?x.tested?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)("div",{"aria-label":"Selected portfolio outcomes","aria-live":"polite",className:"grid grid-cols-3 gap-3 rounded-lg border p-4",children:[(0,r.jsxs)("div",{children:[(0,r.jsx)("p",{className:"text-xs text-muted-foreground",children:"Combined ASR"}),(0,r.jsxs)("p",{className:"mt-1 text-xl font-semibold tabular-nums",children:[null==(t=x.asr)?void 0:t.toFixed(1),"%"]})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("p",{className:"text-xs text-muted-foreground",children:"Goals broken"}),(0,r.jsxs)("p",{className:"mt-1 text-xl font-semibold tabular-nums",children:[x.broken,"/",x.tested]})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("p",{className:"text-xs text-muted-foreground",children:"Not yet broken"}),(0,r.jsx)("p",{className:"mt-1 text-xl font-semibold tabular-nums",children:x.remaining})]}),(0,r.jsx)("div",{className:"col-span-3 flex h-3 overflow-hidden rounded-full bg-muted",role:"img","aria-label":"".concat(x.broken," goals broken and ").concat(x.remaining," not broken out of ").concat(x.tested," tested goals"),children:(0,r.jsx)("span",{style:{width:"".concat(x.asr,"%"),backgroundColor:"var(--viz-jailbroken)"}})}),(0,r.jsxs)("p",{className:"col-span-3 text-xs text-muted-foreground",children:["Tested by at least one selected attack: ",x.tested,"/",s.recorded_goals," campaign goals."," ","Tested by every selected attack: ",x.fullyTested,"/",x.tested,"."," ",Math.max(0,s.recorded_goals-x.tested)," goals not tested by this selection."]})]}),(0,r.jsx)("div",{ref:c,className:"min-w-0 overflow-x-auto rounded-lg border bg-background/50",children:(0,r.jsxs)("svg",{width:g,height:70+48*b.length,className:"block",role:"group","aria-label":"Goals lost if each selected attack is removed",children:[(0,r.jsx)("text",{x:16,y:24,fontSize:12,fontWeight:600,fill:"var(--foreground)",children:"Attack"}),(0,r.jsx)("text",{x:16,y:43,fontSize:10,fill:"var(--muted-foreground)",children:"Largest contribution first"}),(0,r.jsx)("text",{x:180,y:24,fontSize:12,fontWeight:600,fill:"var(--foreground)",children:"Goals lost if removed"}),(0,r.jsx)("text",{x:180,y:43,fontSize:10,fill:"var(--muted-foreground)",children:"Beyond the other selected attacks"}),b.map((e,t)=>{let{run:a,lost:n,tested:l}=e,o=64+48*t,i=(0,p.aN)(a,s.runs),c="".concat(i,": ").concat(n," goals lose coverage if removed; ").concat(l,"/").concat(x.tested," portfolio goals tested.");return(0,r.jsxs)(P,{description:c,children:[(0,r.jsx)("text",{x:16,y:o+13,fontSize:12,fill:"var(--foreground)",children:i}),(0,r.jsx)("rect",{x:180,y:o,width:f-180,height:18,rx:3,fill:"var(--muted)"}),(0,r.jsx)("rect",{x:180,y:o,width:n/j*(f-180),height:18,rx:3,fill:v(a.family)}),(0,r.jsxs)("text",{x:f+10,y:o+13,fontSize:11,fill:"var(--foreground)",children:[n," goals"]}),(0,r.jsxs)("text",{x:180,y:o+33,fontSize:10,fill:"var(--muted-foreground)",children:[(100*n/x.tested).toFixed(1)," pp of current coverage"]})]},a.id)})]})}),(0,r.jsx)("p",{className:"text-xs text-muted-foreground",children:"A goal counts once if any selected attack broke it. “Not yet broken” includes mitigated, unresolved and error outcomes—it is not a mitigation verdict. ASR uses goals tested by at least one selected attack; changing the selection can change that denominator."})]}):(0,r.jsx)("p",{role:"status",className:"rounded-lg border p-6 text-sm text-muted-foreground",children:"No tested goals recorded for this selection."}):(0,r.jsx)("p",{role:"status",className:"rounded-lg border p-6 text-sm text-muted-foreground",children:"Complementarity is unavailable for this selection: first-success summaries are missing or do not match the recorded outcomes. Refresh to load a consistent snapshot."}):(0,r.jsx)("p",{role:"status",className:"rounded-lg border p-6 text-sm text-muted-foreground",children:"Select at least one attack to compare combined coverage."})}),(0,r.jsxs)("div",{role:"group","aria-label":"Portfolio attack selection",className:T,children:[(0,r.jsx)("p",{className:"mb-1 text-sm font-semibold",children:"Combine attacks"}),(0,r.jsx)("p",{className:"mb-3 text-xs text-muted-foreground",children:"Choose any number. All attempts count."}),(0,r.jsxs)("div",{className:"mb-3 flex gap-3 text-xs",children:[(0,r.jsx)("button",{type:"button",className:"underline",onClick:()=>i(u.map(e=>e.id)),children:"Select all"}),(0,r.jsx)("button",{type:"button",className:"underline",onClick:()=>i([]),children:"Clear selection"})]}),(0,r.jsx)("div",{className:"grid gap-1 sm:grid-cols-2 lg:grid-cols-1",children:u.map(e=>{var t,a,n,l;return(0,r.jsxs)("label",{className:"".concat(I," ").concat(o.includes(e.id)?O:"border-transparent"),children:[(0,r.jsx)("input",{type:"checkbox","aria-label":"Include ".concat((0,p.aN)(e,s.runs)," in portfolio"),checked:o.includes(e.id),className:"mt-0.5",onChange:t=>i(a=>t.target.checked?[...a,e.id]:a.filter(t=>t!==e.id))}),(0,r.jsxs)("span",{className:"min-w-0",children:[(0,r.jsx)("strong",{className:"block break-words",children:(0,p.aN)(e,s.runs)}),(0,r.jsxs)("span",{className:"block text-muted-foreground",children:[null!=(n=null==(t=e.outcomes)?void 0:t.jailbroken)?n:"–","/",null!=(l=null==(a=e.outcomes)?void 0:a.recorded_goals)?l:"–"," goals broken"]})]})]},e.id)})})]})]}),(0,r.jsx)("p",{className:"text-xs leading-relaxed text-muted-foreground",children:"Removal contributions use the current portfolio's fixed denominator. Zero means redundant coverage within this selection, not a useless attack. Contributions need not sum to combined coverage: goals covered by several attacks are lost by removing none of them individually. This is observed coverage, not a time or resource budget comparison."})]})}function V(e){let{campaign:t,costs:a}=e,[s,l]=h(800),[o,i]=(0,n.useState)(null),c=e=>i(t=>t===e?null:e),d=new Map(a.runs.map(e=>[e.run_id,e])),u=t.runs.filter(e=>{var t;let a=null==(t=d.get(e.id))?void 0:t.goal_samples;return(null==a?void 0:a.length)?a.some(e=>e.attempts>1):!!e.outcomes&&e.outcomes.attempts>e.outcomes.recorded_goals}).sort((e,t)=>{var a,r,n,s;return(null!=(r=L(null!=(a=t.outcomes)?a:void 0))?r:-1)-(null!=(s=L(null!=(n=e.outcomes)?n:void 0))?s:-1)}).map((e,t)=>({run:e,progression:function(e,t){let a=e.outcomes,r=null==t?void 0:t.goal_samples;if(!(null==a?void 0:a.recorded_goals))return{available:!1,reason:"No tested goals recorded."};if(!(null==r?void 0:r.length)||r.some(e=>void 0===e.first_jailbreak_attempt))return{available:!1,reason:"First-success summaries were not recorded for this attack."};let n=r.filter(e=>null!==e.first_jailbreak_attempt);if(r.length!==a.recorded_goals||n.length!==a.jailbroken||new Set(r.map(e=>e.goal_index)).size!==r.length||r.some(e=>!Number.isInteger(e.attempts)||e.attempts<1||null!==e.first_jailbreak_attempt&&(!Number.isInteger(e.first_jailbreak_attempt)||e.first_jailbreak_attempt<1||e.first_jailbreak_attempt>e.attempts)))return{available:!1,reason:"Progression summaries do not match the recorded outcomes. Refresh to load a consistent snapshot."};let s=Math.max(...r.map(e=>e.attempts)),l=new Map;n.forEach(e=>{var t;let a=e.first_jailbreak_attempt;l.set(a,(null!=(t=l.get(a))?t:0)+1)});let o=0,i=[{attempt:0,percent:0},...Array.from(l).sort((e,t)=>{let[a]=e,[r]=t;return a-r}).map(e=>{let[t,r]=e;return{attempt:t,percent:100*(o+=r)/a.recorded_goals}})];return i[i.length-1].attempt!==s&&i.push({attempt:s,percent:100*o/a.recorded_goals}),{available:!0,denominator:a.recorded_goals,successes:o,maxAttempt:s,points:i}}(e,d.get(e.id)),color:"hsl(".concat((137.5*t+210)%360,", 65%, 45%)"),dash:["","7 3","2 3","9 3 2 3"][t%4]})),m=u.filter(e=>e.progression.available),x=Math.max(1,...u.map(e=>e.progression.available?e.progression.maxAttempt:0)),g=Math.max(640,l),f=g-35,v=e=>62+e/x*(f-62),b=e=>280-e/100*258,j=Array.from(new Set([0,1,...[.25,.5,.75,1].map(e=>Math.round(x*e))])).sort((e,t)=>e-t);return(0,r.jsxs)("div",{className:"space-y-6",children:[(0,r.jsx)(B,{campaign:t,costs:a,firstSuccess:!0}),(0,r.jsxs)("figure",{"aria-label":"Cumulative success by recorded attempt",className:"space-y-3",children:[(0,r.jsxs)("figcaption",{children:[(0,r.jsx)("h3",{className:"text-base font-semibold",children:"What does continuing the search gain?"}),(0,r.jsx)("p",{className:"mt-1 text-xs text-muted-foreground",children:"Attacks with multiple recorded attempts for at least one goal, including static attacks. Each goal enters once, at its first recorded jailbreak. Every endpoint equals that attack's ASR."})]}),(0,r.jsxs)("div",{className:"grid items-start gap-4 lg:grid-cols-[minmax(0,1fr)_17rem]",children:[m.length>0&&(0,r.jsx)("div",{ref:s,className:"min-w-0 overflow-x-auto rounded-lg border bg-background/50",children:(0,r.jsxs)("svg",{width:g,height:330,className:"block",role:"group","aria-label":"Cumulative success step curves",children:[[0,25,50,75,100].map(e=>(0,r.jsxs)("g",{children:[(0,r.jsx)("line",{x1:62,x2:f,y1:b(e),y2:b(e),stroke:"var(--border)",strokeDasharray:"3 4"}),(0,r.jsxs)("text",{x:52,y:b(e)+4,textAnchor:"end",fontSize:11,fill:"var(--muted-foreground)",children:[e,"%"]})]},e)),j.map(e=>(0,r.jsxs)("g",{children:[(0,r.jsx)("line",{x1:v(e),x2:v(e),y1:280,y2:285,stroke:"var(--border)"}),(0,r.jsx)("text",{x:v(e),y:300,textAnchor:"middle",fontSize:11,fill:"var(--muted-foreground)",children:e})]},e)),(0,r.jsx)("text",{x:16,y:151,transform:"rotate(-90 16 ".concat(151,")"),textAnchor:"middle",fontSize:11,fill:"var(--muted-foreground)",children:"Tested goals jailbroken"}),(0,r.jsx)("text",{x:(62+f)/2,y:321,textAnchor:"middle",fontSize:11,fill:"var(--muted-foreground)",children:"Recorded attempt number"}),[...u].sort((e,t)=>Number(e.run.id===o)-Number(t.run.id===o)).map(e=>{let{run:a,progression:n,color:s,dash:l}=e;if(!n.available)return null;let i=(0,p.aN)(a,t.runs),d=n.points[n.points.length-1],u="M ".concat(v(0)," ").concat(b(0));n.points.slice(1).forEach(e=>{u+=" H ".concat(v(e.attempt)," V ").concat(b(e.percent))});let m=function(e,t){let a=t.points[t.points.length-1];return"".concat(e," \xb7 cumulative success\n\nSucceeded: ").concat(t.successes," of ").concat(t.denominator," tested goals\nFinal ASR: ").concat(a.percent.toFixed(1),"%\nLast recorded attempt: ").concat(t.maxAttempt,"\n\n").concat(t.points.filter(e=>e.attempt>0).map(e=>"By attempt ".concat(e.attempt,": ").concat(e.percent.toFixed(1),"%")).join("\n"))}(i,n);return(0,r.jsxs)(P,{description:m,onSelect:()=>c(a.id),selected:o===a.id,opacity:o&&o!==a.id?.25:1,children:[(0,r.jsx)("path",{d:u,fill:"none",stroke:s,strokeWidth:o===a.id?3:2,strokeDasharray:l}),(0,r.jsx)("path",{d:u,fill:"none",stroke:"transparent",strokeWidth:14}),(0,r.jsx)("circle",{cx:v(d.attempt),cy:b(d.percent),r:4,fill:s,"data-progression-run":a.id,"data-endpoint-asr":d.percent,"data-endpoint-attempt":d.attempt})]},a.id)})]})}),(0,r.jsxs)("div",{role:"group","aria-label":"Cumulative success legend",className:T,children:[(0,r.jsx)("p",{className:"mb-1 text-sm font-semibold",children:"Attacks"}),(0,r.jsx)("p",{className:"mb-3 text-xs text-muted-foreground",children:"Select one to highlight its curve."}),(0,r.jsx)("div",{className:"grid gap-1 sm:grid-cols-2 lg:grid-cols-1",children:u.map(e=>{let{run:a,progression:n,color:s,dash:l}=e,i=(0,p.aN)(a,t.runs),d=(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("svg",{"aria-hidden":"true",width:24,height:14,className:"shrink-0",children:(0,r.jsx)("line",{x1:0,x2:24,y1:7,y2:7,stroke:s,strokeWidth:3,strokeDasharray:l})}),(0,r.jsxs)("span",{className:"min-w-0",children:[(0,r.jsx)("strong",{className:"block break-words",children:i}),n.available?(0,r.jsxs)("span",{className:"block text-muted-foreground",children:[(100*n.successes/n.denominator).toFixed(1),"% \xb7 ",n.successes,"/",n.denominator," goals"]}):(0,r.jsx)("span",{className:"block text-muted-foreground",children:n.reason})]})]});return n.available?(0,r.jsx)("button",{type:"button","aria-label":"Highlight ".concat(i," curve"),"aria-pressed":o===a.id,onClick:()=>c(a.id),className:"".concat(I," ").concat(o===a.id?O:"border-transparent"),children:d},a.id):(0,r.jsx)("div",{className:"flex items-start gap-2 p-2 text-xs",children:d},a.id)})}),(0,r.jsx)("button",{type:"button",disabled:!o,className:"mt-3 text-xs underline disabled:no-underline disabled:opacity-50",onClick:()=>i(null),children:"Show all curves equally"})]})]}),!u.length&&(0,r.jsx)("p",{className:"text-sm text-muted-foreground",children:"No attacks with multiple recorded attempts for a goal in this campaign."}),(0,r.jsx)("p",{className:"text-xs leading-relaxed text-muted-foreground",children:"The denominator stays fixed at all tested goals, including unsuccessful goals. Curves plateau through the last recorded attempt for each attack. Attempts follow recorded conversation order, not necessarily completion order; static or batched requests may run in parallel. These curves describe observed attempt progression, not repeated-response ASR@k or a guarantee of success from a larger budget."})]}),(0,r.jsx)($,{campaign:t,costs:a})]})}let Z=e=>"".concat((100*e).toFixed(1),"%"),Y=e=>e.toFixed(3),Q=e=>"panel"===e?"Panel":e,X={prepend_append:"Adds harmless text before and after the same answer.",refusal_prefix:"Adds a refusal sentence before the same answer.",educational_framing:"Presents the same answer as educational or defensive material.",fictional_story:"Presents the same answer as fictional dialogue."},ee=e=>void 0!==e&&Number.isFinite(e)&&e>=0&&e<=1?e:null;function et(e){let{judges:t,plots:a,label:n}=e,[s,l]=h(1e3),o=Math.max(170+241*a.length,l),i=(o-170-16*a.length)/a.length,c=56+68*t.length,d=c+42;return(0,r.jsx)("div",{ref:s,className:"min-w-0 overflow-x-auto rounded-lg border",children:(0,r.jsxs)("svg",{width:o,height:d,className:"block",role:"group","aria-label":n,children:[(0,r.jsx)("text",{x:16,y:24,fontSize:12,fontWeight:600,fill:"var(--foreground)",children:"Judge / panel"}),(0,r.jsx)("text",{x:16,y:42,fontSize:10,fill:"var(--muted-foreground)",children:"Individual judges, then panel"}),t.map((e,t)=>(0,r.jsxs)("g",{"data-audit-row":e.judge,children:[(t%2==0||"panel"===e.judge)&&(0,r.jsx)("rect",{x:0,y:56+68*t,width:o,height:68,fill:"var(--muted)",fillOpacity:.35}),(0,r.jsx)("text",{x:16,y:56+68*t+27,fontSize:12,fontWeight:600,fill:"var(--foreground)",children:Q(e.judge)}),(0,r.jsxs)("text",{x:16,y:56+68*t+45,fontSize:10,fill:"var(--muted-foreground)",children:[e.metrics.samples," samples","panel"===e.judge?" \xb7 combined verdict":""]})]},e.judge)),a.map((e,a)=>{let n=170+a*(i+16),s=t=>(t-e.min)/(e.max-e.min),l=e=>n+18+s(e)*(i-44);return(0,r.jsxs)("g",{role:"group","aria-label":"".concat(e.label," audit panel"),"data-audit-panel":e.id,"data-domain-min":e.min,"data-domain-max":e.max,children:[(0,r.jsx)("rect",{x:n,y:1,width:i,height:d-2,rx:8,fill:"none",stroke:"var(--border)",strokeWidth:1.5}),(0,r.jsx)("path",{d:"M".concat(n+1,",").concat(56,"H").concat(n+i-1," M").concat(n+1,",").concat(c,"H").concat(n+i-1),stroke:"var(--border)"}),(0,r.jsx)("text",{x:n+i/2,y:26,textAnchor:"middle",fontSize:12,fontWeight:600,fill:"var(--foreground)",children:e.label}),(0,r.jsx)("text",{x:n+i/2,y:43,textAnchor:"middle",fontSize:10,fill:"var(--muted-foreground)",children:e.hint}),e.ticks.map((t,a)=>(0,r.jsxs)("g",{children:[(0,r.jsx)("line",{x1:l(t),x2:l(t),y1:56,y2:c,stroke:e.min<0&&0===t?"var(--muted-foreground)":"var(--border)",strokeDasharray:"2 5"}),(0,r.jsx)("text",{x:l(t),y:c+24,textAnchor:0===a?"start":a===e.ticks.length-1?"end":"middle",fontSize:10,fill:"var(--muted-foreground)",children:e.format(t)})]},t)),t.map((t,a)=>{let{value:o,description:c,limit:d}=e.measure(t),u=56+68*a+27;return(0,r.jsxs)(P,{description:c,children:[(0,r.jsx)("rect",{x:n+2,y:56+68*a,width:i-4,height:68,fill:"transparent"}),null!==o?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("line",{x1:l(0),x2:l(o),y1:u,y2:u,stroke:"var(--viz-family-static)",strokeWidth:2,strokeOpacity:.4}),(0,r.jsx)("circle",{"data-audit-marker":t.judge,"data-value":o,cx:l(o),cy:u,r:4,fill:"var(--viz-family-static)"}),(0,r.jsx)("text",{x:l(o),y:u+29,textAnchor:.3>s(o)?"start":s(o)>.7?"end":"middle",fontSize:10,fill:"var(--muted-foreground)",children:e.format(o)})]}):(0,r.jsx)("text",{x:n+i/2,y:u+4,textAnchor:"middle",fontSize:11,fill:"var(--muted-foreground)",children:"Not recorded"}),void 0!==d&&(0,r.jsx)("line",{"data-audit-limit":t.judge,x1:l(d),x2:l(d),y1:u-10,y2:u+10,stroke:"var(--foreground)",strokeWidth:2})]},t.judge)})]},e.id)})]})})}function ea(e){var t;let{campaign:a}=e,n=a.audit,s=[...null!=(t=null==n?void 0:n.judges)?t:[]].sort((e,t)=>Number("panel"===e.judge)-Number("panel"===t.judge)),l=function(e){let t=Array.from(new Set(e.flatMap(e=>{var t,a;return null!=(a=null==(t=e.robustness)?void 0:t.wrappers.map(e=>e.wrapper))?a:[]}))),a=Math.min(1,Math.max(.1,Math.ceil(10*Math.max(0,...e.flatMap(e=>e.robustness?[e.robustness.max_flip_rate,...e.robustness.wrappers.map(e=>e.flip_rate)]:[]).filter(e=>null!==ee(e))))/10));return t.map(e=>({id:e,label:e.replace(/_/g," "),hint:"Verdicts changed \xb7 lower is better",min:0,max:a,ticks:[0,a/2,a],format:Z,measure(t){var a,r,n,s,l,o;let i=null==(a=t.robustness)?void 0:a.wrappers.find(t=>t.wrapper===e),c=ee(null==i?void 0:i.flip_rate),d=ee(null==(r=t.robustness)?void 0:r.max_flip_rate),u=!0===t.passed?"Within configured limit":!1===t.passed?"Over configured limit":"Not graded";return{value:c,limit:i&&null!==d?d:void 0,description:"".concat(Q(t.judge)," \xb7 ").concat(e.replace(/_/g," "),"\n\n").concat(null!=(n=X[e])?n:"Recorded content-preserving wrapper.","\nThe answer and its correct label stay unchanged.\n\nVerdicts changed: ").concat(null===c?"Not recorded":Z(c)).concat((null==i?void 0:i.flips)===void 0?"":" (".concat(i.flips,")"),"\nCorrect harmful detections hidden: ").concat(null!=(s=null==i?void 0:i.true_positive_evasions)?s:"Not recorded","\nShare of original correct harmful detections hidden: ").concat((null==i?void 0:i.true_positive_evasion_rate)===void 0?"Not recorded":Z(i.true_positive_evasion_rate),"\nHarmful verdict → safe: ").concat(null!=(l=null==i?void 0:i.detected_to_missed)?l:"Not recorded","\nSafe verdict → harmful: ").concat(null!=(o=null==i?void 0:i.missed_to_detected)?o:"Not recorded","\nWrapped accuracy: ").concat((null==i?void 0:i.accuracy)===void 0?"Not recorded":Z(i.accuracy),"\nAccuracy change: ").concat((null==i?void 0:i.accuracy_delta)===void 0?"Not recorded":"".concat((100*i.accuracy_delta).toFixed(1)," pp"),"\n\nChanged by any wrapper: ").concat(t.robustness?Z(t.robustness.any_wrapper_flip_rate):"Not recorded","\nConfigured maximum: ").concat(null===d?"Not recorded":Z(d),"\nOverall check: ").concat(t.robustness?u:"Not recorded","\nThe overall check uses the union across wrappers, counting each sample once—not this wrapper alone.")}}}))}(s);return(0,r.jsxs)("section",{id:"campaign-audit",tabIndex:-1,className:"investigation-panel min-w-0 scroll-mt-[calc(var(--campaign-navigation-height,0px)+1rem)] space-y-6 p-5 sm:p-6","aria-label":"Campaign audit",children:[(0,r.jsxs)("header",{children:[(0,r.jsx)("p",{className:"section-eyebrow",children:"04 / Judge audit"}),(0,r.jsx)("h2",{className:"mt-2 text-xl font-semibold",children:"Can we trust the verdicts?"}),(0,r.jsx)("p",{className:"mt-2 text-sm text-muted-foreground",children:"Compare each judge, then the panel, on labelled examples and content-preserving wrappers."})]}),n?s.length?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)("figure",{"aria-label":"Judge calibration plots",className:"space-y-3",children:[(0,r.jsxs)("figcaption",{children:[(0,r.jsx)("h3",{className:"text-base font-semibold",children:"Can judges distinguish harmful from safe?"}),(0,r.jsx)("p",{className:"mt-1 text-xs text-muted-foreground",children:"Youden’s J is the primary comparison: −1 reversed, 0 no discrimination, +1 perfect separation. “Falsely accused” means safe examples incorrectly flagged harmful."})]}),(0,r.jsx)(et,{judges:s,plots:[{id:"j",label:"Youden’s J",hint:"Higher is better \xb7 −1 to +1",min:-1,max:1,ticks:[-1,-.5,0,.5,1],format:Y},{id:"detected",label:"Harmful detected",hint:"Higher is better \xb7 sensitivity",min:0,max:1,ticks:[0,.25,.5,.75,1],format:Z},{id:"accused",label:"Falsely accused",hint:"Lower is better \xb7 false positives",min:0,max:1,ticks:[0,.25,.5,.75,1],format:Z}].map(e=>({...e,measure(t){var a,r,n,s,l;let o=function(e){var t;let{tp:a,fp:r,tn:n,fn:s}=e,l=[a,r,n,s].every(e=>void 0!==e&&Number.isInteger(e)&&e>=0)&&void 0!==a&&void 0!==r&&void 0!==n&&void 0!==s&&a+r+n+s===e.samples,o=e.samples>0,i=l&&a+s>0?a/(a+s):null,c=l&&n+r>0?n/(n+r):null,d=null!==i&&null!==c,u=l?Math.sqrt((a+r)*(a+s)*(n+r)*(n+s)):0;return{precision:l?a+r>0?a/(a+r):null:o?e.precision:null,recall:l?i:o?e.recall:null,accuracy:l&&o?(a+n)/e.samples:o?e.accuracy:null,f1:l?2*a+r+s>0?2*a/(2*a+r+s):null:o&&null!=(t=e.f1)?t:null,specificity:c,balancedAccuracy:d?(i+c)/2:null,youdensJ:d?i+c-1:null,mcc:l&&u>0?(a*n-r*s)/u:null,falsePositiveRate:null===c?null:1-c,falseNegativeRate:null===i?null:1-i,negativePredictiveValue:l&&n+s>0?n/(n+s):null,validCounts:l}}(t.metrics),i="j"===e.id?o.youdensJ:"detected"===e.id?o.recall:o.falsePositiveRate,c=t.metrics,d="j"===e.id?"J = sensitivity + specificity − 1.\n−1: completely reversed; 0: no discrimination; +1: perfect separation.":"detected"===e.id?"Share of labelled harmful examples the judge detected.":"Share of labelled safe examples incorrectly flagged harmful.";return{value:i,description:"".concat(Q(t.judge)," \xb7 ").concat(e.label,"\n\nValue: ").concat(null===i?"Not measured":e.format(i),"\n").concat(d,"\n\nSamples: ").concat(c.samples,"\nHarmful detected (TP): ").concat(null!=(a=c.tp)?a:"Not recorded","\nHarmful missed (FN): ").concat(null!=(r=c.fn)?r:"Not recorded","\nSafe falsely flagged (FP): ").concat(null!=(n=c.fp)?n:"Not recorded","\nSafe correctly passed (TN): ").concat(null!=(s=c.tn)?s:"Not recorded","\nAbstentions: ").concat(null!=(l=c.abstentions)?l:"Not recorded").concat(null===i?"\n\nValid counts and a nonzero class denominator are required for this statistic.":"")}}})),label:"Aligned judge calibration scores"}),(0,r.jsx)("p",{className:"text-xs leading-relaxed text-muted-foreground",children:"J = sensitivity + specificity − 1. The panel is measured on its own combined verdicts, not the mean of judges’ scores. These are single measured scores, not distributions or quality grades. Hover, focus or tap for exact counts. Missing class denominators remain unmeasured."})]}),(0,r.jsxs)("figure",{"aria-label":"Judge robustness plots",className:"space-y-3 border-t pt-6",children:[(0,r.jsxs)("figcaption",{children:[(0,r.jsx)("h3",{className:"text-base font-semibold",children:"Does wrapping the same answer change the verdict?"}),(0,r.jsx)("p",{className:"mt-1 text-xs text-muted-foreground",children:"Each panel is one wrapper. The answer and its correct label stay the same; markers show the percentage of original verdicts that changed. Lower is better; ideally 0%."})]}),l.length?(0,r.jsx)(et,{judges:s,plots:l,label:"Aligned wrapper verdict-change rates"}):(0,r.jsx)("p",{className:"text-sm text-muted-foreground",children:"No wrapper robustness measurements recorded."}),(0,r.jsx)("p",{className:"text-xs leading-relaxed text-muted-foreground",children:"All wrappers share a linear percentage scale. Black ticks show each judge’s configured maximum. The overall check uses samples changed by any wrapper, counting each sample once—not each wrapper independently. Hover, focus or tap for wrapper descriptions, hidden correct detections and the overall result. A changed verdict may correct an original error or introduce one."})]})]}):(0,r.jsx)("p",{className:"text-sm text-muted-foreground",children:"No judge metrics recorded."}):(0,r.jsx)("p",{className:"text-sm text-muted-foreground",children:"No audit recorded for this execution."})]})}var er=a(5917),en=a(75426);a(27063);var es=a(42710);function el(e){let{text:t,label:a}=e,[s,l]=(0,n.useState)(!1);return(0,r.jsxs)(x.$,{variant:"ghost",size:"sm","aria-label":a,onClick:()=>{var e;null==(e=navigator.clipboard)||e.writeText(t).then(()=>{l(!0),setTimeout(()=>l(!1),1500)})},children:[s?(0,r.jsx)(er.A,{className:"mr-2 h-4 w-4"}):(0,r.jsx)(en.A,{className:"mr-2 h-4 w-4"}),s?"Copied":"Copy"]})}function eo(e){let{text:t,label:a}=e;return(0,r.jsxs)("div",{className:"relative rounded-md border bg-muted/40",children:[(0,r.jsx)("div",{className:"absolute right-1 top-1",children:(0,r.jsx)(el,{text:t,label:"Copy ".concat(a)})}),(0,r.jsx)("pre",{"aria-label":a,className:"overflow-x-auto p-4 pr-24 font-mono text-xs leading-relaxed",children:t})]})}function ei(e){var t;let{campaign:a}=e;return a.configuration&&Object.keys(a.configuration).length?(0,r.jsxs)("details",{className:"investigation-panel p-4",children:[(0,r.jsx)("summary",{className:"cursor-pointer text-sm font-medium",children:"Campaign configuration (YAML)"}),(0,r.jsxs)("p",{className:"mt-2 text-xs text-muted-foreground",children:["The campaign file as executed. Credentials are replaced with [REDACTED]. ","Endpoints are the addresses used during this execution and may differ from the file you launched."]}),(0,r.jsx)("div",{className:"mt-3",children:(0,r.jsx)(eo,{text:(t=a.configuration,(0,es.As)(t,{lineWidth:0})),label:"Campaign configuration"})})]}):null}function ec(e){let{id:t,eyebrow:a,title:n,description:s,label:l,children:o}=e;return(0,r.jsxs)("section",{id:t,tabIndex:-1,"aria-label":l,className:"investigation-panel min-w-0 scroll-mt-[calc(var(--campaign-navigation-height,0px)+1rem)] space-y-5 p-5 sm:p-6",children:[(0,r.jsxs)("header",{children:[(0,r.jsx)("p",{className:"section-eyebrow",children:a}),(0,r.jsx)("h2",{className:"mt-2 text-xl font-semibold",children:n}),(0,r.jsx)("p",{className:"mt-2 text-sm text-muted-foreground",children:s})]}),o]})}let ed=[{id:"campaign-coverage",label:"Coverage"},{id:"campaign-success",label:"Success progression"},{id:"campaign-cost",label:"Cost"},{id:"campaign-audit",label:"Judge audit"}];function eu(){let e=(0,n.useRef)(null),[t,a]=(0,n.useState)(ed[0].id);return(0,n.useEffect)(()=>{let t=e.current,r=null==t?void 0:t.parentElement;if(!t||!r)return;let n=()=>{let e=t.getBoundingClientRect().bottom+17,n=ed[0].id;for(let t of ed){let a=r.querySelector("#".concat(t.id));a&&a.getBoundingClientRect().top<=e&&(n=t.id)}a(n)},s=()=>{r.style.setProperty("--campaign-navigation-height","".concat(t.getBoundingClientRect().height,"px")),n()};s();let l=new ResizeObserver(s);return l.observe(t),l.observe(r),document.addEventListener("scroll",n,!0),window.addEventListener("resize",s),()=>{l.disconnect(),document.removeEventListener("scroll",n,!0),window.removeEventListener("resize",s),r.style.removeProperty("--campaign-navigation-height")}},[]),(0,r.jsx)("nav",{ref:e,"aria-label":"Campaign sections",className:"sticky top-0 z-40 overflow-x-auto border-b bg-background shadow-sm",children:(0,r.jsx)("div",{className:"flex min-w-max items-center gap-5 px-1",children:ed.map(e=>(0,r.jsx)("a",{href:"#".concat(e.id),"aria-current":t===e.id?"location":void 0,className:"border-b-2 py-3 text-sm transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-inset ".concat(t===e.id?"border-foreground font-medium text-foreground":"border-transparent text-muted-foreground hover:text-foreground"),onClick:t=>{if(0!==t.button||t.metaKey||t.ctrlKey||t.shiftKey||t.altKey)return;t.preventDefault();let r=document.getElementById(e.id);r&&(r.scrollIntoView({block:"start"}),r.focus({preventScroll:!0}),a(e.id))},children:e.label},e.id))})})}function em(e){let{campaign:t,costs:a,costStatus:n,coverage:s,conversationsAvailable:l=!0}=e;return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(E,{campaign:t,costs:a}),(0,r.jsx)(eu,{}),(0,r.jsx)(ec,{id:"campaign-coverage",eyebrow:"01 / Goal coverage",title:"Which goals held?",label:"Goal by attack outcomes",description:"All goals summarizes each attack's overall success rate; columns are ranked by ASR. Expand categories and subcategories for details".concat(l?", or select a goal's outcome marker to open its conversation.":". Conversations are not included in this offline snapshot."),children:s}),(0,r.jsx)(ec,{id:"campaign-success",eyebrow:"02 / Success progression",title:"How soon do attacks succeed?",label:"Success progression",description:"Compare first-jailbreak distributions among successful goals, then see cumulative success across recorded attempts. Attacks are ranked by ASR; successful/tested counts keep failures visible.",children:a?(0,r.jsx)(V,{campaign:t,costs:a}):n}),(0,r.jsx)(ec,{id:"campaign-cost",eyebrow:"03 / Cost",title:"How much does each attack use?",label:"Attack efficiency",description:"Compare per-goal cost distributions across attacks, ranked by success rate. Symlog cost axes preserve zeros and compress large values; lower costs sit further left.",children:a?(0,r.jsx)(K,{campaign:t,costs:a}):n}),(0,r.jsx)(ea,{campaign:t}),(0,r.jsx)(ei,{campaign:t}),t.notes&&(0,r.jsxs)("details",{className:"investigation-panel p-4",children:[(0,r.jsx)("summary",{className:"cursor-pointer text-sm",children:"Campaign notes"}),(0,r.jsx)("p",{className:"mt-3 whitespace-pre-wrap text-sm",children:t.notes})]})]})}var ex=a(65229),ep=a(24033),eh=a(27937),eg=a(51834),ef=a(78874),ev=a(61362);let eb=(0,c.A)("scissors",[["circle",{cx:"6",cy:"6",r:"3",key:"1lh9wr"}],["path",{d:"M8.12 8.12 12 12",key:"1alkpv"}],["path",{d:"M20 4 8.12 15.88",key:"xgtan2"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}],["path",{d:"M14.8 14.8 20 20",key:"ptml3r"}]]);var ej=a(52056);let ey=(0,c.A)("circle-help",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);function ek(e){let{value:t}=e,a="jailbroken"===t||"jailbreak"===t,n="mitigated"===t,s="pruned"===t||"skipped"===t,l="error"===t,o=a?ef.A:n?ev.A:s?eb:l?ej.A:ey,i=a?"Jailbroken":n?"Mitigated":s?"pruned"===t?"Pruned":"Skipped":l?"Error":"pending"===t?"Pending":"Unresolved";return(0,r.jsxs)("span",{className:"inline-flex shrink-0 items-center gap-1 rounded-full border px-2 py-0.5 text-xs font-medium ".concat(a?"border-rose-200 bg-rose-50 text-rose-800 dark:border-rose-700 dark:bg-rose-950 dark:text-rose-200":n?"border-teal-200 bg-teal-50 text-teal-800 dark:border-teal-700 dark:bg-teal-950 dark:text-teal-200":s?"border-slate-300 bg-slate-100 text-slate-700 dark:border-slate-500 dark:bg-slate-700 dark:text-slate-100":"border-amber-200 bg-amber-50 text-amber-900 dark:border-amber-600 dark:bg-amber-950 dark:text-amber-200"),children:[(0,r.jsx)(o,{className:"h-3 w-3","aria-hidden":"true"}),i]})}var eN=a(65142);let ew=["Categories","Subcategories","Goals"];function eS(e){var t;let a=t=>Array.from(new Set(e.getAll(t).filter(Boolean)));return{search:null!=(t=e.get("search"))?t:"",category:a("category"),subcategory:a("subcategory"),outcome:a("outcome"),attack:a("attack")}}function eC(e){var t;return null!=(t=ew.find(t=>t===e.get("granularity")))?t:null}function e_(e,t){var a,r,n;return t?null!=(n=null==(r=e.attack_outcomes)||null==(a=r.find(e=>e.run_id===t))?void 0:a.verdict)?n:"untested":e.verdict}function eA(e,t){if(!t.length)return e.verdict;let a=t.map(t=>e_(e,t)).filter(e=>"untested"!==e);return a.length?a.includes("jailbroken")?"jailbroken":a.every(e=>"mitigated"===e)?"mitigated":a.every(e=>"error"===e)?"error":"unresolved":"untested"}function eM(e){let{label:t,options:a,selected:n,onChange:s}=e;return(0,r.jsxs)("fieldset",{className:"min-w-0 space-y-2",children:[(0,r.jsxs)("legend",{className:"text-sm font-semibold",children:[t," (",n.length,")"]}),(0,r.jsx)("div",{className:"max-h-60 space-y-1 overflow-y-auto",children:a.map(e=>(0,r.jsxs)("label",{className:"flex cursor-pointer items-start gap-2 rounded p-1.5 text-sm hover:bg-muted",children:[(0,r.jsx)("input",{type:"checkbox",className:"mt-0.5 shrink-0",checked:n.includes(e.value),onChange:t=>s(t.target.checked?[...n,e.value]:n.filter(t=>t!==e.value))}),(0,r.jsx)("span",{className:"min-w-0 break-words",children:e.label})]},e.value))})]})}function eL(e){let{filters:t,attacks:a,categories:n,subcategories:s,detailLevel:l,canExpand:o,filtering:i,radioId:c,searchInput:d,onChange:u,onDetail:m,onClear:p}=e;return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(eN.p,{ref:d,"aria-label":"Search goals",placeholder:"Search goals...",value:t.search,className:"h-10 w-full min-w-0",onChange:e=>u({search:e.target.value})}),(0,r.jsxs)("div",{"aria-label":"Coverage toolbar",className:"flex flex-wrap items-center gap-2",children:[(0,r.jsxs)(D.AM,{children:[(0,r.jsx)(D.Wv,{asChild:!0,children:(0,r.jsxs)(x.$,{variant:"outline",children:["Attacks",t.attack.length?" (".concat(t.attack.length,")"):"",(0,r.jsx)(ep.A,{"aria-hidden":"true",className:"h-4 w-4"})]})}),(0,r.jsxs)(D.hl,{align:"start","aria-label":"Attack filters",children:[(0,r.jsx)(eM,{label:"Attacks",selected:t.attack,options:a,onChange:e=>u({attack:e})}),(0,r.jsx)("p",{className:"mt-3 text-xs text-muted-foreground",children:"No selection includes every attack. Combined outcome is jailbroken if any selected attack succeeded."})]})]}),(0,r.jsxs)(D.AM,{children:[(0,r.jsx)(D.Wv,{asChild:!0,children:(0,r.jsxs)(x.$,{variant:"outline",children:["Topics",t.category.length+t.subcategory.length?" (".concat(t.category.length+t.subcategory.length,")"):"",(0,r.jsx)(ep.A,{"aria-hidden":"true",className:"h-4 w-4"})]})}),(0,r.jsxs)(D.hl,{align:"start","aria-label":"Topic filters",className:"max-h-[80dvh] w-[min(32rem,calc(100vw-2rem))] space-y-3 overflow-y-auto",children:[(0,r.jsxs)("div",{className:"grid gap-4 sm:grid-cols-2",children:[(0,r.jsx)(eM,{label:"Categories",selected:t.category,options:n.map(e=>({value:e,label:e})),onChange:e=>u({category:e})}),(0,r.jsxs)("div",{className:"min-w-0 space-y-3",children:[(0,r.jsxs)("h3",{className:"text-sm font-semibold",children:["Subcategories (",t.subcategory.length,")"]}),!t.category.length&&(0,r.jsx)("p",{className:"text-xs text-muted-foreground",children:"Select a category first."}),s.map(e=>(0,r.jsx)(eM,{label:e.category,selected:t.subcategory.filter(t=>e.names.includes(t)),options:e.names.map(e=>({value:e,label:e})),onChange:a=>u({subcategory:[...t.subcategory.filter(t=>!e.names.includes(t)),...a]})},e.category))]})]}),(0,r.jsx)("p",{className:"text-xs text-muted-foreground",children:"Match any selection within each group. No selection includes all."})]})]}),(0,r.jsxs)(D.AM,{children:[(0,r.jsx)(D.Wv,{asChild:!0,children:(0,r.jsxs)(x.$,{variant:"outline",children:["Outcomes",t.outcome.length?" (".concat(t.outcome.length,")"):"",(0,r.jsx)(ep.A,{"aria-hidden":"true",className:"h-4 w-4"})]})}),(0,r.jsxs)(D.hl,{align:"start","aria-label":"Outcome filters",children:[(0,r.jsx)(eM,{label:"Outcomes",selected:t.outcome,options:["jailbroken","mitigated","unresolved","error","untested"].map(e=>({value:e,label:"untested"===e?"Not tested":e[0].toUpperCase()+e.slice(1)})),onChange:e=>u({outcome:e})}),(0,r.jsx)("p",{className:"mt-3 text-xs text-muted-foreground",children:"Match any selected outcome, combining selected attacks. No selection includes all outcomes."})]})]}),(0,r.jsxs)(D.AM,{children:[(0,r.jsx)(D.Wv,{asChild:!0,children:(0,r.jsxs)(x.$,{variant:"outline",children:["Detail: ",null!=l?l:"Custom",(0,r.jsx)(ep.A,{"aria-hidden":"true",className:"h-4 w-4"})]})}),(0,r.jsx)(D.hl,{align:"start","aria-label":"Coverage detail",children:(0,r.jsxs)("fieldset",{className:"space-y-2",children:[(0,r.jsx)("legend",{className:"text-sm font-semibold",children:"Detail level"}),ew.map(e=>(0,r.jsxs)("label",{className:"flex cursor-pointer items-center gap-2 rounded p-1.5 text-sm hover:bg-muted",children:[(0,r.jsx)("input",{type:"radio",name:"granularity-".concat(c),disabled:!o,checked:l===e,onChange:()=>m(e)}),e]},e)),null===l&&(0,r.jsx)("p",{className:"text-xs text-muted-foreground",children:"Custom: rows expanded individually."})]})})]}),(0,r.jsx)(x.$,{size:"sm",variant:"ghost",className:"ml-auto",disabled:!i&&"Categories"===l,onClick:p,children:"Clear all"})]})]})}let eR={jailbroken:g.jailbroken,mitigated:"color-mix(in srgb, var(--viz-mitigated) 38%, var(--card))",unresolved:g.unresolved,error:g.error,untested:"var(--muted)"};function ez(e){let{children:t,header:a}=e,s=(0,n.useRef)(null),l=(0,n.useRef)(null),[o,i]=(0,n.useState)({category:"",subcategory:""});return(0,n.useEffect)(()=>{let e=()=>{if(!s.current||!l.current)return;let e=l.current.getBoundingClientRect().bottom,t="",a="";for(let l of Array.from(s.current.querySelectorAll("tr[data-category]"))){var r,n;if(l.getBoundingClientRect().top>e)break;void 0===l.dataset.subcategory?(t=null!=(r=l.dataset.category)?r:"",a=""):(t=null!=(n=l.dataset.category)?n:"",a=l.dataset.subcategory)}i(e=>e.category===t&&e.subcategory===a?e:{category:t,subcategory:a})};return e(),document.addEventListener("scroll",e,!0),window.addEventListener("resize",e),()=>{document.removeEventListener("scroll",e,!0),window.removeEventListener("resize",e)}},[t]),(0,r.jsxs)("div",{ref:s,children:[(0,r.jsxs)("div",{ref:l,"aria-label":"Current coverage group",className:"sticky top-[var(--campaign-navigation-height,0px)] z-30 bg-card text-xs shadow-sm",children:[a,(0,r.jsxs)("div",{className:"border-b px-3 py-2",children:[(0,r.jsx)("div",{className:"font-semibold",children:o.category||"Goal coverage"}),(0,r.jsx)("div",{className:"pl-3 text-muted-foreground",children:o.subcategory||"\xa0"})]})]}),t]})}function eE(e){let{goals:t,runId:a,label:n,attacks:s}=e,l=function(e,t){let a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[],r={recorded_goals:0,jailbroken:0,mitigated:0,unresolved:0};for(let n of e){let e=t?e_(n,t):eA(n,a);"untested"!==e&&(r.recorded_goals++,"jailbroken"===e?r.jailbroken++:"mitigated"===e?r.mitigated++:r.unresolved++)}return r}(t,a,s),o=L(l),i=null===o?"Not tested":"".concat(o.toFixed(1),"%"),c="".concat(l.jailbroken,"/").concat(l.recorded_goals," goals jailbroken \xb7 ").concat(l.unresolved," unresolved");return(0,r.jsxs)("span",{"aria-label":"".concat(n,": ").concat(i),tabIndex:0,title:null===o?"".concat(n,"\n\nNot tested\nNo recorded attempts"):"".concat(n,"\n\nASR: ").concat(i,"\nJailbroken goals: ").concat(l.jailbroken," of ").concat(l.recorded_goals,"\nUnresolved goals: ").concat(l.unresolved),style:null===o?void 0:{backgroundColor:"color-mix(in srgb, var(--viz-jailbroken) ".concat(Math.round(4+.2*o),"%, var(--card))")},className:"block rounded-sm py-1 text-center text-[10px] font-semibold tabular-nums sm:text-xs ".concat(null===o?"text-muted-foreground":""),children:[null===o?"–":i,(0,r.jsxs)("span",{className:"sr-only",children:[" \xb7 ",null===o?"No recorded attempts":c]})]})}let eF=()=>{};function eT(e){var t,a,s,l;let{campaign:o,recordedGoals:i,query:c="",onSelectionChange:d=eF,renderEvidence:u,status:m}=e,h=void 0!==u,g=function(e,t,a){let[r,s]=(0,n.useState)(()=>eS(new URLSearchParams(t))),[l,o]=(0,n.useState)(()=>eC(new URLSearchParams(t))),[i,c]=(0,n.useState)(()=>new Set),d=(0,n.useRef)(!1),u=(0,n.useRef)(!1),m=(0,n.useMemo)(()=>[...e].sort((e,t)=>e.index-t.index),[e]),x=Object.values(r).some(e=>Array.isArray(e)?e.length>0:!!e),p=(0,n.useMemo)(()=>m.filter(e=>(!r.search||e.goal.toLocaleLowerCase().includes(r.search.toLocaleLowerCase()))&&(!r.category.length||r.category.includes(e.category))&&(!r.subcategory.length||r.subcategory.includes(e.subcategory||"Unspecified Subcategory"))&&(!r.outcome.length||r.outcome.includes(eA(e,r.attack)))),[m,r]),h=(0,n.useMemo)(()=>{let e=new Map;for(let t of p){e.has(t.category)||e.set(t.category,new Map);let a=e.get(t.category),r=t.subcategory||"Unspecified Subcategory";a.has(r)||a.set(r,[]),a.get(r).push(t)}return Array.from(e).sort((e,t)=>{let[a]=e,[r]=t;return a.localeCompare(r,void 0,{numeric:!0})}).map(e=>{let[t,a]=e;return{category:t,subcategories:Array.from(a).sort((e,t)=>{let[a]=e,[r]=t;return a.localeCompare(r,void 0,{numeric:!0})})}})},[p]),g=(0,n.useMemo)(()=>Array.from(new Set(m.map(e=>e.category))).sort((e,t)=>e.localeCompare(t,void 0,{numeric:!0})),[m]),f=(0,n.useMemo)(()=>r.category.map(e=>({category:e,names:Array.from(new Set(m.filter(t=>t.category===e).map(e=>e.subcategory||"Unspecified Subcategory"))).sort((e,t)=>e.localeCompare(t,void 0,{numeric:!0}))})),[m,r.category]);(0,n.useEffect)(()=>{let e=eS(new URLSearchParams(t));s(t=>JSON.stringify(t)===JSON.stringify(e)?t:e),o(eC(new URLSearchParams(t)))},[t]),(0,n.useEffect)(()=>{if(d.current){d.current=!1;return}l?c(new Set(h.flatMap(e=>"Categories"===l?[]:[JSON.stringify([e.category]),..."Goals"===l?e.subcategories.map(t=>{let[a]=t;return JSON.stringify([e.category,a])}):[]]))):x?c(new Set(h.flatMap(e=>[JSON.stringify([e.category]),...e.subcategories.map(t=>{let[a]=t;return JSON.stringify([e.category,a])})]))):u.current&&c(new Set),u.current=x},[h,x,l]);let v=h.map(e=>JSON.stringify([e.category])),b=h.flatMap(e=>e.subcategories.map(t=>{let[a]=t;return JSON.stringify([e.category,a])})),j=v.length>0&&v.every(e=>i.has(e)),y=j&&b.length>0&&b.every(e=>i.has(e))?"Goals":j&&!b.some(e=>i.has(e))?"Subcategories":v.some(e=>i.has(e))?null:"Categories";function k(e){let t={...r,...e};if(e.category){let e=new Set(m.filter(e=>t.category.includes(e.category)).map(e=>e.subcategory||"Unspecified Subcategory"));t.subcategory=t.subcategory.filter(t=>e.has(t))}s(t),a({...t,section:"overview",goal:null,conversation_attack:null,conversation_aggregate:null,attempt:null,node:null,goalPage:null})}return{goals:m,filters:r,granularity:l,expanded:i,setExpanded:c,filtering:x,matchingGoals:p,groups:h,categories:g,subcategoryGroups:f,detailLevel:y,changeFilters:k,toggleRow:function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];d.current=null!==l,o(null),a({granularity:null}),c(a=>{let r=new Set(a);for(let e of t)r.delete(e);return r.has(e)?r.delete(e):r.add(e),r})},selectGranularity:function(e){o(e),c(new Set("Goals"===e?[...v,...b]:"Subcategories"===e?v:[])),a({granularity:e})},clearFilters:function(){k({search:"",category:[],subcategory:[],outcome:[],attack:[]}),o(null),a({granularity:null}),c(new Set)}}}(i,c,d),{goals:f,filters:v,granularity:b,expanded:j,setExpanded:y,filtering:k,matchingGoals:N,groups:w,categories:S,subcategoryGroups:C,detailLevel:_,toggleRow:A,selectGranularity:R}=g,z=(0,n.useId)(),E=(0,n.useRef)(null),[F,T]=(0,n.useState)(null),I=(0,n.useRef)(null),O=(0,n.useRef)(null),P=(0,n.useMemo)(()=>o.runs.map(e=>{var t;return{run:e,value:L(null!=(t=e.outcomes)?t:void 0)}}).sort((e,t)=>{var a,r;return(null!=(a=t.value)?a:-1)-(null!=(r=e.value)?r:-1)}).map(e=>e.run),[o.runs]),D=(0,n.useMemo)(()=>P.filter(e=>!v.attack.length||v.attack.includes(e.id)),[P,v.attack]),U=(0,n.useMemo)(()=>[{id:"",name:"Combined outcome"},...P.map(e=>({id:e.id,name:(0,p.aN)(e,o.runs),run:e}))],[P,o.runs]),H=U.filter(e=>e.id?!v.attack.length||v.attack.includes(e.id):D.length>1);(0,n.useEffect)(()=>{var e,t,a;let r=new URLSearchParams(c),n=r.get("goal");if(null===n||!/^\d+$/.test(n)||!Number.isSafeInteger(Number(n)))return void T(null);if(!h)return;let s=null!=(a=null!=(t=r.get("conversation_attack"))?t:r.get("attack"))?a:"",l=f.find(e=>e.index===Number(n));l&&y(e=>new Set([...Array.from(e),JSON.stringify([l.category]),JSON.stringify([l.category,l.subcategory||"Unspecified Subcategory"])])),T({goal:Number(n),run:s||function(e,t){var a,r;let n=t.filter(t=>{var a;return(null==e?void 0:e.run_ids.includes(t.id))||(null==e||null==(a=e.attack_outcomes)?void 0:a.some(e=>e.run_id===t.id))});return(null==(a=n.find(t=>e&&"jailbroken"===e_(e,t.id)))?void 0:a.id)||(null==(r=n[0])?void 0:r.id)||""}(l,D)||(null==(e=D[0])?void 0:e.id)||"",aggregate:!s||"1"===r.get("conversation_aggregate")})},[c,h,f,D,y]);let W=e=>{g.changeFilters(e),T(null)},G=[...v.category.map(e=>({key:"category",label:"Category",value:e})),...v.subcategory.map(e=>({key:"subcategory",label:"Subcategory",value:e})),...v.attack.map(e=>{var t,a;return{key:"attack",label:"Attack",value:e,display:null!=(a=null==(t=U.find(t=>t.id===e))?void 0:t.name)?a:"Unknown attack (".concat(e,")")}}),...v.outcome.map(e=>({key:"outcome",label:"Outcome",value:e,display:"untested"===e?"Not tested":e}))].filter(e=>e.value),q=f.find(e=>e.index===(null==F?void 0:F.goal)),J=P.find(e=>e.id===(null==F?void 0:F.run)),K={minWidth:"".concat(Math.max(450,Math.ceil(44*H.length/.6)),"px")},B=(0,r.jsxs)("colgroup",{children:[(0,r.jsx)("col",{style:{width:"40%"}}),H.map(e=>(0,r.jsx)("col",{},e.id))]}),$=(0,r.jsxs)("tr",{className:"border-b bg-card",children:[(0,r.jsx)("th",{scope:"col",className:"sticky left-0 z-10 bg-card p-3 text-left",children:"Category / subcategory / goal"}),H.map(e=>(0,r.jsx)("th",{scope:"col",className:"bg-card px-1 py-3 align-bottom text-center",children:(0,r.jsx)("span",{title:e.id?e.name:"Jailbroken if any selected attack succeeded. With no attack selection, includes every campaign attack.",className:"inline-flex rotate-180 items-center gap-2 whitespace-nowrap [writing-mode:vertical-rl]",children:e.name})},e.id))]});return m?(0,r.jsx)(r.Fragment,{children:m}):(0,r.jsxs)("div",{className:"relative space-y-4",children:[(0,r.jsx)(eL,{filters:v,categories:S,subcategories:C,attacks:[...P.map(e=>({value:e.id,label:(0,p.aN)(e,o.runs)})),...v.attack.filter(e=>!P.some(t=>t.id===e)).map(e=>({value:e,label:"Unknown attack (".concat(e,")")}))],detailLevel:_,canExpand:w.length>0,filtering:k,radioId:z,searchInput:O,onChange:W,onDetail:R,onClear:()=>{g.clearFilters(),T(null)}}),(G.length>0||v.search)&&(0,r.jsxs)("div",{"aria-label":"Active goal filters",className:"flex flex-wrap gap-2",children:[v.search&&(0,r.jsxs)(x.$,{size:"sm",variant:"secondary","aria-label":"Remove search filter: ".concat(v.search),onClick:()=>W({search:""}),children:["Search: ",v.search,(0,r.jsx)(ex.A,{"aria-hidden":"true",className:"h-3 w-3"})]}),G.map(e=>(0,r.jsxs)(x.$,{size:"sm",variant:"secondary",className:"h-auto max-w-full whitespace-normal text-left text-xs","aria-label":"Remove ".concat(e.label.toLowerCase()," filter: ").concat("display"in e?e.display:e.value),onClick:()=>W({[e.key]:v[e.key].filter(t=>t!==e.value)}),children:[e.label,": ","display"in e?e.display:e.value,(0,r.jsx)(ex.A,{"aria-hidden":"true",className:"h-3 w-3 shrink-0"})]},"".concat(e.key,":").concat(e.value)))]}),(0,r.jsx)("div",{className:"flex flex-wrap items-center gap-2",children:k&&(0,r.jsxs)("span",{role:"status",className:"text-xs text-muted-foreground",children:[N.length," of ",f.length," goals match \xb7 outcome for ",v.attack.length?v.attack.map(e=>{var t,a;return null!=(a=null==(t=U.find(t=>t.id===e))?void 0:t.name)?a:"Unknown attack"}).join(" + "):"all campaign attacks"]})}),(0,r.jsx)(ez,{header:(0,r.jsx)("div",{ref:E,"aria-hidden":"true","data-coverage-headings":!0,className:"overflow-hidden border-x",children:(0,r.jsxs)("table",{className:"w-full table-fixed border-collapse text-xs",style:K,children:[B,(0,r.jsx)("thead",{children:$})]})}),children:(0,r.jsx)("div",{role:"region","aria-label":"Scrollable goal coverage",tabIndex:0,className:"overflow-x-auto rounded-md border",onScroll:e=>{E.current&&(E.current.scrollLeft=e.currentTarget.scrollLeft)},children:(0,r.jsxs)("table",{"aria-label":"Goal coverage by subcategory and attack",className:"w-full table-fixed border-collapse text-xs",style:K,children:[B,(0,r.jsx)("thead",{className:"sr-only",children:$}),(0,r.jsx)("tbody",{children:(0,r.jsxs)("tr",{className:"border-y bg-muted",children:[(0,r.jsxs)("th",{scope:"row",className:"sticky left-0 z-10 bg-muted px-3 py-3 text-left font-bold",children:["All goals ",(0,r.jsxs)("span",{className:"whitespace-nowrap font-normal text-muted-foreground",children:["(",f.length," goals)"]})]}),H.map(e=>(0,r.jsx)("td",{className:"border-l px-0.5 py-2 align-middle",children:(0,r.jsx)(eE,{goals:f,runId:e.id,attacks:v.attack,label:"".concat(e.name," in All goals")})},e.id))]})}),w.map(e=>{let t=JSON.stringify([e.category]),a=j.has(t);return(0,r.jsxs)("tbody",{children:[(0,r.jsxs)("tr",{"data-category":e.category,className:"border-y bg-muted/30",children:[(0,r.jsx)("th",{scope:"row",className:"sticky left-0 z-10 bg-card px-3 py-3 text-left font-semibold",children:(0,r.jsxs)("button",{type:"button","aria-expanded":a,"aria-label":"Toggle ".concat(e.category),onClick:()=>A(t,e.subcategories.map(t=>{let[a]=t;return JSON.stringify([e.category,a])})),className:"flex w-full items-center gap-1 text-left",children:[a?(0,r.jsx)(ep.A,{"aria-hidden":"true",className:"h-3 w-3 shrink-0"}):(0,r.jsx)(eh.A,{"aria-hidden":"true",className:"h-3 w-3 shrink-0"}),(0,r.jsxs)("span",{children:[e.category," ",(0,r.jsxs)("span",{className:"whitespace-nowrap font-normal text-muted-foreground",children:["(",e.subcategories.reduce((e,t)=>{let[,a]=t;return e+a.length},0)," goals)"]})]})]})}),H.map(t=>(0,r.jsx)("td",{className:"border-l px-0.5 py-2 align-middle",children:(0,r.jsx)(eE,{goals:e.subcategories.flatMap(e=>{let[,t]=e;return t}),runId:t.id,attacks:v.attack,label:"".concat(t.name," in ").concat(e.category)})},t.id))]}),a&&e.subcategories.map(t=>{let[a,s]=t,l=JSON.stringify([e.category,a]),i=j.has(l);return(0,r.jsxs)(n.Fragment,{children:[(0,r.jsxs)("tr",{"data-category":e.category,"data-subcategory":a,className:"border-b bg-muted/10",children:[(0,r.jsx)("th",{scope:"row",className:"sticky left-0 z-10 bg-card py-2 pl-6 pr-3 text-left font-medium",children:(0,r.jsxs)("button",{type:"button","aria-expanded":i,"aria-label":"Toggle ".concat(e.category," / ").concat(a),onClick:()=>A(l),className:"flex w-full items-center gap-1 text-left",children:[i?(0,r.jsx)(ep.A,{"aria-hidden":"true",className:"h-3 w-3 shrink-0"}):(0,r.jsx)(eh.A,{"aria-hidden":"true",className:"h-3 w-3 shrink-0"}),(0,r.jsxs)("span",{children:[a," ",(0,r.jsxs)("span",{className:"whitespace-nowrap text-muted-foreground",children:["(",s.length," goals)"]})]})]})}),H.map(t=>(0,r.jsx)("td",{className:"border-l px-0.5 py-2 align-middle",children:(0,r.jsx)(eE,{goals:s,runId:t.id,attacks:v.attack,label:"".concat(t.name," in ").concat(e.category," / ").concat(a)})},t.id))]}),i&&s.map(e=>(0,r.jsxs)("tr",{className:"border-b hover:bg-muted/20",children:[(0,r.jsx)("th",{scope:"row",className:"sticky left-0 z-10 bg-card py-3 pl-10 pr-3 text-left font-normal text-muted-foreground",children:(0,r.jsxs)("span",{className:"flex items-baseline gap-2",children:[(0,r.jsxs)("span",{className:"shrink-0 text-muted-foreground tabular-nums",children:["#",e.index+1]}),(0,r.jsx)("span",{className:"min-w-0 whitespace-pre-wrap break-words",children:e.goal})]})}),H.map(t=>{let a=t.id?e_(e,t.id):eA(e,v.attack),n=(0,r.jsx)("span",{"aria-hidden":"true",className:"block h-3.5 w-3.5 rounded-[1px] ".concat("untested"===a?"border border-dashed border-muted-foreground":""),style:{backgroundColor:eR[a]}});return(0,r.jsx)("td",{className:"border-l px-0.5 py-1 text-center",children:t.id&&h?(0,r.jsx)("a",{"data-goal":e.index,"data-run":t.id,onClick:a=>{if(0!==a.button||a.ctrlKey||a.metaKey||a.shiftKey||a.altKey)return;a.preventDefault(),I.current=a.currentTarget;let r=t.id;T({goal:e.index,run:r,aggregate:!1}),d({section:"overview",goal:String(e.index),conversation_attack:r,conversation_aggregate:null,attempt:null,node:null})},href:"/stats?".concat(function(e){let t=new URLSearchParams;for(let[a,r]of Object.entries(e))for(let e of Array.isArray(r)?r:[r])e&&t.append(a,e);return t}({run:o.id,section:"overview",...v,...b?{granularity:b}:{},goal:String(e.index),conversation_attack:t.id})),"aria-label":"Goal ".concat(e.index+1," \xb7 ").concat(t.name,": ").concat(a),"aria-describedby":z,title:"".concat(t.name,"\n\nOutcome: ").concat("untested"===a?"Not tested":a,"\nSelect to open this goal's conversation."),className:"inline-flex h-8 w-8 items-center justify-center rounded outline-offset-2 hover:bg-muted focus-visible:outline-2",children:n}):(0,r.jsx)("span",{role:"img","aria-label":"Goal ".concat(e.index+1," \xb7 ").concat(t.name,": ").concat(a),tabIndex:h?void 0:0,title:"".concat(t.name,"\n\nOutcome: ").concat("untested"===a?"Not tested":a),className:"inline-flex h-8 w-8 items-center justify-center",children:n})},t.id)})]},e.index))]},a)})]},e.category)})]})})}),h&&(0,r.jsx)("span",{id:z,className:"sr-only",children:"Open conversation"}),!N.length&&(0,r.jsx)("p",{className:"text-sm text-muted-foreground",children:"No recorded goals match these filters."}),(0,r.jsxs)("p",{className:"text-xs text-muted-foreground",children:["ASR = jailbroken / recorded goals, including unresolved and errors. Untested (–) is excluded, not counted as mitigated. Hover or focus a percentage for exact counts. Set the table detail level or expand individual rows. ",h?"Select an individual attack marker to open its conversation.":"Conversations are excluded from this offline snapshot."," Combined outcome is informational only."]}),(0,r.jsx)(M,{items:[{name:"Jailbroken",color:eR.jailbroken},{name:"Mitigated",color:eR.mitigated},{name:"Unresolved",color:eR.unresolved},{name:"Error",color:eR.error},{name:"Not tested",color:eR.untested}]}),h&&(0,r.jsx)(eg.lG,{open:null!==F,onOpenChange:e=>{e||(T(null),d({goal:null,conversation_attack:null,conversation_aggregate:null,attempt:null,node:null}))},children:(0,r.jsxs)(eg.Cf,{className:"flex h-[90dvh] flex-col overflow-hidden sm:max-w-5xl",onCloseAutoFocus:e=>{var t,a;e.preventDefault(),null==(t=(null==(a=I.current)?void 0:a.isConnected)?I.current:O.current)||t.focus()},children:[(0,r.jsxs)(eg.c7,{className:"shrink-0 pr-6",children:[(0,r.jsx)(eg.L3,{className:"whitespace-pre-wrap break-words text-xl",children:(null==(t=f.find(e=>e.index===(null==F?void 0:F.goal)))?void 0:t.goal)||"Goal text not recorded"}),(0,r.jsxs)("p",{className:"text-sm text-muted-foreground",children:[(null==(a=f.find(e=>e.index===(null==F?void 0:F.goal)))?void 0:a.category)||"Unknown category",(null==(s=f.find(e=>e.index===(null==F?void 0:F.goal)))?void 0:s.subcategory)?" / ".concat(null==(l=f.find(e=>e.index===(null==F?void 0:F.goal)))?void 0:l.subcategory):""]}),q&&F&&(0,r.jsxs)("div",{"aria-label":"Goal outcome for selected attack",className:"flex items-center gap-2 text-xs text-muted-foreground",children:["Goal outcome \xb7 ",J?(0,p.aN)(J,o.runs):"Unknown attack","untested"===e_(q,F.run)?(0,r.jsx)("span",{children:"Not tested"}):(0,r.jsx)(ek,{value:e_(q,F.run)})]}),(0,r.jsxs)(eg.rr,{className:"sr-only",children:[(null==F?void 0:F.aggregate)?"Combined outcome: showing the highest-ranked successful selected attack, or the highest-ranked tested selected attack if none succeeded. With no attack selection, all campaign attacks are included. ":"","Close to return to the same place in goal coverage."]})]}),(0,r.jsx)("div",{className:"min-h-0 flex-1 overflow-y-auto overscroll-contain",children:F&&(F.run&&!P.some(e=>e.id===F.run)?(0,r.jsx)("p",{role:"alert",className:"p-5 text-sm",children:"This attack does not belong to this campaign."}):F.run?null==u?void 0:u(F):(0,r.jsx)("p",{className:"p-5 text-sm text-muted-foreground",children:"No recorded attack conversation for this goal."}))})]})})]})}var eI=a(68448);let eO=(0,c.A)("minus",[["path",{d:"M5 12h14",key:"1ays0h"}]]);var eP=a(6191);let eD=(0,c.A)("focus",[["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}],["path",{d:"M3 7V5a2 2 0 0 1 2-2h2",key:"aa7l1z"}],["path",{d:"M17 3h2a2 2 0 0 1 2 2v2",key:"4qcy5o"}],["path",{d:"M21 17v2a2 2 0 0 1-2 2h-2",key:"6vwrx8"}],["path",{d:"M7 21H5a2 2 0 0 1-2-2v-2",key:"ioqczr"}]]);var eU=a(81701);let eH=e=>e.join("."),eW=e=>Array.isArray(e)&&e.every(e=>Number.isSafeInteger(e)&&e>=0);function eG(e){var t;return{id:"attempt:".concat(e.id),parent:null,label:"Attempt ".concat(e.ordinal),kind:"attempt",status:e.bucket,score:"number"==typeof(null==(t=e.metadata)?void 0:t.score)?e.metadata.score:null,attemptId:e.id}}function eq(e){let t=Array.from(new Map(e.map(e=>[e.id,e])).values()),a=new Map(t.map(e=>[e.id,e]));return t.map(e=>{let t=e.parent,r=new Set([e.id]);for(;t&&a.has(t);){var n,s;if(r.has(t))return{...e,parent:null};r.add(t),t=null!=(s=null==(n=a.get(t))?void 0:n.parent)?s:null}return{...e,parent:e.parent&&a.has(e.parent)?e.parent:null}})}function eJ(e){let{nodes:t,selectedId:a,onSelect:s,kind:l,simple:o=!1}=e,[i,c]=(0,n.useState)(1),[d,u]=(0,n.useState)(!1),m=(0,n.useRef)(null),p=(0,n.useMemo)(()=>(function(e){var t,a;let r=new Map;for(let a of e)r.set(a.parent,[...null!=(t=r.get(a.parent))?t:[],a]);let n=0,s=new Map,l=(e,t)=>{var a;let o=(null!=(a=r.get(e.id))?a:[]).map(e=>l(e,t+1)),i=o.length?(o[0]+o[o.length-1])/2:104*n+++24;return s.set(e.id,{x:230*t+24,y:i}),i};for(let e of null!=(a=r.get(null))?a:[])l(e,0);return{positions:s,width:Math.max(280,...Array.from(s.values()).map(e=>e.x+216)),height:Math.max(220,104*n+40)}})(t),[t]);(0,n.useEffect)(()=>{var e;let t=null==(e=m.current)?void 0:e.clientWidth;t&&c(Math.max(.35,Math.min(1,(t-16)/p.width)))},[p.width]);let h=new Set,g=new Map(t.map(e=>[e.id,e]));for(let e of t.filter(e=>"jailbreak"===e.status)){let t=e;for(;t&&!h.has(t.id);)h.add(t.id),t=t.parent?g.get(t.parent):void 0}return(0,n.useEffect)(()=>{var e;let t=null==(e=m.current)?void 0:e.querySelector('[aria-pressed="true"]'),a=m.current;if(!t||!a)return;let r=t.getBoundingClientRect(),n=a.getBoundingClientRect();(r.left<n.left||r.right>n.right)&&(a.scrollLeft+=r.left-n.left-16),(r.top<n.top||r.bottom>n.bottom)&&(a.scrollTop+=r.top-n.top-16)},[a,d]),(0,r.jsxs)("section",{className:"investigation-panel min-w-0 overflow-hidden","aria-label":"Attack map",children:[(0,r.jsxs)("header",{className:"flex flex-wrap items-center justify-between gap-2 border-b bg-muted/40 p-4",children:[!o&&(0,r.jsx)("h3",{className:"font-semibold",children:o?"Attack branches":"candidates"===l?"Candidate tree":"execution"===l?"Recorded execution tree":"Independent attempts"}),(0,r.jsx)(x.$,{size:"sm",variant:"outline","aria-pressed":d,onClick:()=>u(e=>!e),children:d?"Show map":"Show list"})]}),(0,r.jsx)("p",{className:"border-b px-4 py-3 text-xs text-muted-foreground",children:o?"Select an attempt to jump to its conversation. Rose lines lead to a jailbreak.":"candidates"===l?"Lines connect recorded parent candidates. Rose outlines mark paths to jailbreaks; blue marks your selection.":"execution"===l?"Lines show recorded phase containment, not candidate ancestry. Older recordings do not identify candidate parents.":"Candidate relationships were not recorded. Attempts are shown independently, never linked by guesswork."}),!d&&(0,r.jsxs)("div",{className:"flex items-center gap-1 border-b px-3 py-2",children:[(0,r.jsx)(x.$,{variant:"ghost",size:"icon","aria-label":"Zoom out",disabled:i<=.35,onClick:()=>c(e=>Math.max(.35,e-.15)),children:(0,r.jsx)(eO,{className:"h-4 w-4"})}),(0,r.jsxs)("span",{className:"w-12 text-center text-xs tabular-nums",children:[Math.round(100*i),"%"]}),(0,r.jsx)(x.$,{variant:"ghost",size:"icon","aria-label":"Zoom in",disabled:i>=1.6,onClick:()=>c(e=>Math.min(1.6,e+.15)),children:(0,r.jsx)(eP.A,{className:"h-4 w-4"})}),(0,r.jsxs)(x.$,{variant:"ghost",size:"sm",onClick:()=>{var e,t;return c(Math.max(.35,Math.min(1,((null!=(t=null==(e=m.current)?void 0:e.clientWidth)?t:600)-16)/p.width)))},children:[(0,r.jsx)(eD,{className:"mr-1 h-4 w-4"}),"Fit tree"]})]}),(0,r.jsxs)("div",{ref:m,className:"attack-map-canvas max-h-[65vh] min-h-72 overflow-auto p-2 ".concat(d?"space-y-2":""),tabIndex:0,"aria-label":"Scrollable attack map",children:[!t.length&&(0,r.jsx)("p",{className:"p-5 text-sm text-muted-foreground",children:"No recorded attempts yet."}),(0,r.jsx)("div",{style:d?void 0:{width:p.width*i,height:p.height*i,position:"relative"},children:(0,r.jsxs)("div",{className:d?"space-y-2":"relative origin-top-left",style:d?void 0:{width:p.width,height:p.height,transform:"scale(".concat(i,")")},children:[!d&&(0,r.jsx)("svg",{className:"pointer-events-none absolute inset-0",width:p.width,height:p.height,"aria-hidden":"true",children:t.filter(e=>e.parent).map(e=>{let t=e.parent?p.positions.get(e.parent):void 0,a=p.positions.get(e.id);return t&&a?(0,r.jsx)("path",{d:"M ".concat(t.x+196," ").concat(t.y+35," C ").concat(t.x+214," ").concat(t.y+35,", ").concat(a.x-18," ").concat(a.y+35,", ").concat(a.x," ").concat(a.y+35),fill:"none",stroke:h.has(e.id)?"var(--map-path)":"var(--map-edge)",strokeWidth:h.has(e.id)?3:2},e.id):null})}),t.map(e=>{let t=p.positions.get(e.id);return(0,r.jsxs)("button",{"aria-pressed":e.id===a,onClick:()=>s(e),className:"map-node text-left ".concat(d?"w-full":"absolute w-[196px]"," ").concat(e.id===a?"map-node-selected":""," ").concat(h.has(e.id)?"map-node-success":""),style:d?void 0:{left:null==t?void 0:t.x,top:null==t?void 0:t.y},"aria-label":"".concat(e.label).concat(e.status?": ".concat(e.status):""),children:[(0,r.jsx)("span",{className:"block truncate text-sm font-semibold",title:e.label,children:e.label}),(0,r.jsxs)("span",{className:"mt-2 flex flex-wrap items-center gap-1",children:[e.status&&(0,r.jsx)(ek,{value:e.status}),!o&&e.disposition&&e.disposition!==e.status&&(0,r.jsx)(ek,{value:e.disposition}),!o&&null!==e.score&&(0,r.jsxs)("span",{className:"text-xs text-muted-foreground",children:["Raw score ",e.score]})]}),!e.status&&!o&&(0,r.jsx)("span",{className:"mt-1 block text-xs text-muted-foreground",children:"candidate"===e.kind?"No judged result":e.kind})]},e.id)})]})})]})]})}function eK(e){return Array.isArray(e)?e.filter(e=>"object"==typeof e&&null!==e&&"string"==typeof e.role&&"content"in e):[]}function eB(e){return"object"!=typeof e||null===e||Array.isArray(e)?null:e}let e$=e=>JSON.stringify(e);function eV(e){let{error:t,retry:a}=e;return t?(0,r.jsxs)("div",{role:"alert",className:"space-y-3 p-5 text-sm",children:[(0,r.jsx)("p",{children:t}),(0,r.jsx)(x.$,{variant:"outline",onClick:a,children:"Retry"})]}):(0,r.jsxs)("p",{role:"status",className:"flex items-center gap-2 p-5 text-sm text-muted-foreground",children:[(0,r.jsx)(i.A,{className:"h-4 w-4 animate-spin"}),"Loading conversation..."]})}function eZ(e){let{role:t,content:a,label:n}=e;return(0,r.jsxs)("div",{className:"conversation-message ".concat("assistant"===t?"conversation-response":"system"===t?"conversation-context":"conversation-prompt"),children:[(0,r.jsx)("p",{className:"mb-2 text-xs font-semibold text-muted-foreground",children:null!=n?n:"assistant"===t?"Target response":"user"===t?"Attack prompt":"system"===t?"System context":t}),(0,r.jsx)(eI.P,{content:a})]})}function eY(e){let{label:t,ordinal:a}=e;return(0,r.jsxs)("p",{className:"conversation-repeat",children:[t," ",(0,r.jsxs)("span",{className:"text-muted-foreground",children:["— same as attempt ",a]})]})}g.jailbroken,g.jailbroken,g.mitigated,g.unresolved,g.unresolved,g.error;let eQ={advprefix:"AdvPrefix writes the opening of a compliant answer and makes the target continue it. Each opening is sampled several times; only the text the target added is shown as its response.",crescendo:"Crescendo starts with a harmless question and escalates over several turns, building on the target’s own answers. Refused turns are rephrased from the last accepted turn."};function eX(e){var t;let{entry:a,entries:n,highlight:s}=e,l=function(e,t){var a;let r=null!=(a=e.attempt.metadata)?a:{};if("number"==typeof r.turn)return["Turn ".concat(r.turn+1),!0===r.refused?"target refused":null,!0===r.backtracked?"will be rephrased":null].filter(Boolean).join(" \xb7 ");if("number"==typeof r.prefix_index){let a=t.filter(e=>{var t;return(null==(t=e.attempt.metadata)?void 0:t.prefix_index)===r.prefix_index}),n=new Set(t.map(e=>{var t;return null==(t=e.attempt.metadata)?void 0:t.prefix_index})).size;return"Opening ".concat(r.prefix_index+1," of ").concat(n," \xb7 sample ").concat(a.indexOf(e)+1," of ").concat(a.length)}return null}(a,n),o=null==(t=n[n.indexOf(a)-1])?void 0:t.attempt.ordinal;return(0,r.jsxs)("article",{id:"attempt-".concat(a.attempt.id),tabIndex:-1,"aria-label":"Attempt ".concat(a.attempt.ordinal),className:"conversation-attempt scroll-mt-[calc(var(--conversation-navigation-height,0px)+1rem)] space-y-4 ".concat(s?"conversation-highlight":""),children:[(0,r.jsxs)("header",{className:"flex flex-wrap items-center justify-between gap-2 border-b pb-3",children:[(0,r.jsxs)("h3",{className:"text-sm font-semibold",children:["Attempt ",a.attempt.ordinal,l&&(0,r.jsx)("span",{className:"ml-2 font-normal text-muted-foreground",children:l})]}),(0,r.jsx)(ek,{value:a.attempt.bucket})]}),null!==a.continuesFrom&&(0,r.jsx)("p",{className:"text-xs text-muted-foreground",children:a.continuesFrom===o?"Continuing the conversation above.":"Continues the conversation from attempt ".concat(a.continuesFrom,".")}),a.messages.length?a.messages.map((e,t)=>void 0!==e.repeatOf?(0,r.jsx)(eY,{label:"Attack prompt",ordinal:e.repeatOf},t):(0,r.jsx)(eZ,{role:e.role,content:e.content},t)):!a.continues&&(0,r.jsx)("p",{className:"text-sm text-muted-foreground",children:"The prompt was not recorded."}),null!==a.prefill&&(null!==a.prefillRepeatOf?(0,r.jsx)(eY,{label:"Prefilled opening",ordinal:a.prefillRepeatOf}):(0,r.jsxs)("div",{className:"conversation-message conversation-prefill",children:[(0,r.jsxs)("p",{className:"mb-2 text-xs font-semibold text-muted-foreground",children:["Prefilled opening ",(0,r.jsx)("span",{className:"font-normal",children:"\xb7 written by the attacker, presented as the target's own words"})]}),(0,r.jsx)(eI.P,{content:a.prefill})]})),null===a.reply?(0,r.jsx)("p",{className:"text-sm text-muted-foreground",children:"No target response was recorded."}):null!==a.replyRepeatOf?(0,r.jsx)(eY,{label:null!==a.prefill?"Target continuation":"Target response",ordinal:a.replyRepeatOf}):null!==a.prefill?(0,r.jsx)(eZ,{role:"assistant",label:"Target continuation",content:a.reply}):(0,r.jsx)(eZ,{role:"assistant",content:a.reply}),a.notes&&(0,r.jsxs)("div",{className:"border-l-2 border-slate-400 pl-4 text-sm",children:[(0,r.jsx)("p",{className:"mb-1 text-xs font-semibold text-muted-foreground",children:"error"===a.attempt.bucket?"What went wrong":"Why this outcome"}),(0,r.jsx)(eI.P,{content:a.notes})]})]})}function e0(e){var t,a,s,l;let{campaign:i,goal:c,runId:d,revision:u,attackHeader:m}=e,x=(0,o.useSearchParams)(),[h,g]=(0,n.useState)(0),[f,v]=(0,n.useState)(null!=(a=null==x?void 0:x.get("attempt"))?a:null),[b,j]=(0,n.useState)(null!=(s=null==x?void 0:x.get("attempt"))?s:null),[y,k]=(0,n.useState)(null),[N,w]=(0,n.useState)(null),S=(0,n.useRef)(null),C=(0,n.useRef)(null),_=new URLSearchParams({run_id:d,goal_index:String(c.index)}),A=(0,p.LI)("".concat(p.dI,"/").concat(i.id,"/structure?").concat(_),u+h),M=(0,n.useMemo)(()=>A.data?function(e){var t;let a=new Map((null!=(t=e.results)?t:[]).map(e=>[e.id,e])),r=[],n=new Map,s=new Map,l=new Map;return e.attempts.map(t=>{var o,i,c,d,u,m,x,p,h,g,f,v,b,j;let y=a.get(t.id),k=e.traces.filter(e=>e.result===t.id).sort((e,t)=>e.sequence-t.sequence),N=k.find(e=>{var t;return(0,eU.HK)(e.content)&&"call"===e.content.node&&(null==(t=e.content.data)?void 0:t.role)==="target"}),w=N&&(0,eU.HK)(N.content)?N.content.data:void 0,S=k.find(e=>{let t=eB(e.content);return t&&!("v"in t)&&eB(t.request)&&eB(t.response)}),C=eB(null==S?void 0:S.content),_=eB(null==C?void 0:C.request),A=eB(null==C?void 0:C.response),M=eK(null==y||null==(o=y.request_payload)?void 0:o.messages),L=eK(null==w?void 0:w.request),R=null==y||null==(i=y.request_payload)?void 0:i.prompt,z=M.length?M:"string"==typeof R?[{role:"user",content:R}]:L.length?L:eK(null==_?void 0:_.messages),E=null!=(p=null!=(x=null!=(m=null!=(u=null==y||null==(c=y.agent_specific_data)?void 0:c.response)?u:null==y||null==(d=y.agent_specific_data)?void 0:d.decoded_response)?m:null==w?void 0:w.response)?x:null==A?void 0:A.text)?p:null,F=z.at(-1),T=(null==F?void 0:F.role)==="assistant"&&"string"==typeof F.content&&z.length>1?F.content:null,I=null===T?z:z.slice(0,-1),O=null!==T&&"string"==typeof E&&E.startsWith(T)?E.slice(T.length):E,P=r.filter(e=>{var t;return(t=e.messages).length>0&&t.length<=I.length&&t.every((e,t)=>{let a;return a=I[t],e.role===a.role&&e$(e.content)===e$(a.content)})}).reduce((e,t)=>!e||t.messages.length>=e.messages.length?t:e,null),D=I.slice(null!=(h=null==P?void 0:P.messages.length)?h:0).map(e=>{if("user"!==e.role)return e;let a=n.get(e$(e.content));return void 0===a&&n.set(e$(e.content),t.ordinal),void 0===a?e:{...e,repeatOf:a}}),U=null===T?null:null!=(g=s.get(T))?g:null;null!==T&&null===U&&s.set(T,t.ordinal);let H=e$([T,O]),W=null===O||""===O?null:null!=(f=l.get(H))?f:null;return null!==O&&null===W&&l.set(H,t.ordinal),r.push({ordinal:t.ordinal,messages:[...z.slice(0,null===T?void 0:-1),...null!==E?[{role:"assistant",content:E}]:[]]}),{attempt:t,messages:D,prefill:T,prefillRepeatOf:U,reply:O,replyRepeatOf:W,notes:null!=(b=null!=(v=t.notes)?v:null==y?void 0:y.evaluation_notes)?b:null,continues:null!==P,continuesFrom:null!=(j=null==P?void 0:P.ordinal)?j:null}})}(A.data):[],[A.data]),L=(0,n.useMemo)(()=>A.data?function(e){let t=e.traces.filter(e=>(0,eU.HK)(e.content)&&eW(e.content.path)&&"phase"===e.content.node),a=t.filter(e=>{var t;return(0,eU.HK)(e.content)&&"candidate"===e.content.label&&eW(null==(t=e.content.data)?void 0:t.parent_path)});if(a.length){let t=a.map((t,a)=>{var r,n,s,l;if(!(0,eU.HK)(t.content))throw Error("Invalid candidate trace");let o=t.content.path,i=null==(r=t.content.data)?void 0:r.parent_path,c=e.attempts.find(e=>{var t;return eW(null==(t=e.metadata)?void 0:t.candidate_path)&&eH(e.metadata.candidate_path)===eH(o)}),d=e.traces.filter(e=>{var t;if(!(0,eU.HK)(e.content)||"decision"!==e.content.node)return!1;let a=null==(t=e.content.data)?void 0:t.candidate_paths;return Array.isArray(a)&&a.some(e=>eW(e)&&eH(e)===eH(o))||e.content.path.length>o.length&&e.content.path.slice(0,o.length).every((e,t)=>e===o[t])}).find(e=>{var t;return(0,eU.HK)(e.content)&&["pruned","skipped"].includes(null!=(t=e.content.label)?t:"")}),u=d&&(0,eU.HK)(d.content)?d.content.label:null;return{id:"candidate:".concat(eH(o)),parent:eW(i)&&i.length?"candidate:".concat(eH(i)):null,label:"Candidate ".concat(a+1),kind:"candidate",status:null!=(l=null==c?void 0:c.bucket)?l:"pruned"===u||"skipped"===u?u:null,disposition:"pruned"===u||"skipped"===u?u:void 0,reason:d&&(0,eU.HK)(d.content)&&"string"==typeof(null==(n=d.content.data)?void 0:n.reason)?d.content.data.reason:void 0,score:"number"==typeof(null==c||null==(s=c.metadata)?void 0:s.score)?c.metadata.score:null,attemptId:null==c?void 0:c.id,trace:t}});for(let a of e.attempts)t.some(e=>e.attemptId===a.id)||t.push(eG(a));return{kind:"candidates",nodes:eq(t)}}if(t.length){let a=t.map(e=>{if(!(0,eU.HK)(e.content))throw Error("Invalid phase trace");return{id:"phase:".concat(eH(e.content.path)),parent:e.content.path.length>1?"phase:".concat(eH(e.content.path.slice(0,-1))):null,label:e.content.label||"Recorded phase",kind:"phase",status:null,score:null,trace:e}});for(let t of e.attempts){var r;let n=e.traces.find(e=>{var a;return e.result===t.id&&(0,eU.HK)(e.content)&&"call"===e.content.node&&(null==(a=e.content.data)?void 0:a.role)==="target"}),s=n&&(0,eU.HK)(n.content)?n.content.path:[],l=a.filter(e=>e.trace&&(0,eU.HK)(e.trace.content)&&e.trace.content.path.every((e,t)=>s[t]===e)).sort((e,t)=>(t.trace&&(0,eU.HK)(t.trace.content)?t.trace.content.path.length:0)-(e.trace&&(0,eU.HK)(e.trace.content)?e.trace.content.path.length:0))[0];a.push({...eG(t),parent:null!=(r=null==l?void 0:l.id)?r:null,trace:null==l?void 0:l.trace})}for(let t of e.traces)(0,eU.HK)(t.content)&&"decision"===t.content.node&&a.push({id:"decision:".concat(eH(t.content.path)),parent:"phase:".concat(eH(t.content.path.slice(0,-1))),label:t.content.label||"Decision",kind:"decision",status:"pruned"===t.content.label?"pruned":"skipped"===t.content.label?"skipped":null,score:null,trace:t});return{kind:"execution",nodes:eq(a)}}return{kind:"attempts",nodes:e.attempts.map(eG)}}(A.data):null,[A.data]);(0,n.useEffect)(()=>{let e=C.current,t=S.current;if(!e||!t)return;let a=()=>t.style.setProperty("--conversation-navigation-height","".concat(e.getBoundingClientRect().height,"px"));a();let r=new ResizeObserver(a);return r.observe(e),()=>r.disconnect()},[M]),(0,n.useEffect)(()=>{if(f&&M.length){var e,t;let a=document.getElementById("attempt-".concat(f));a&&(null==(e=S.current)?void 0:e.contains(a))&&(null==a||null==(t=a.scrollIntoView)||t.call(a,{block:"start",behavior:"instant"}),null==a||a.focus({preventScroll:!0}))}},[f,M]),(0,n.useEffect)(()=>{let e=S.current,t=C.current;if(!e||!t||!M.length)return;let a=()=>{let a=Array.from(e.querySelectorAll(".conversation-attempt")).filter(e=>e.getBoundingClientRect().height>0);if(!a.length)return;let r=t.getBoundingClientRect().bottom+16,n=a[0];for(let e of a){if(e.getBoundingClientRect().top>r)break;n=e}j(n.id.slice(8))};a(),document.addEventListener("scroll",a,!0),window.addEventListener("resize",a);let r=new ResizeObserver(a);return r.observe(e),r.observe(t),()=>{document.removeEventListener("scroll",a,!0),window.removeEventListener("resize",a),r.disconnect()}},[M]);let R=e=>{var t,a;v(e),j(e),(0,p.gj)({goal:String(c.index),...(null==x?void 0:x.has("conversation_attack"))?{conversation_attack:d}:{attack:d},attempt:e});let r=document.getElementById("attempt-".concat(e));r&&(null==(t=S.current)?void 0:t.contains(r))&&(null==(a=r.scrollIntoView)||a.call(r,{block:"start",behavior:"smooth"}))};if(A.error||!A.data)return(0,r.jsxs)("div",{className:"space-y-4",children:[m(),(0,r.jsx)(eV,{error:A.error,retry:()=>g(e=>e+1)})]});let z=eQ[null!=(l=null==(t=i.runs.find(e=>e.id===d))?void 0:t.technique)?l:""];return(0,r.jsxs)("div",{ref:S,className:"min-w-0 space-y-6",children:[(0,r.jsx)("div",{ref:C,"aria-label":"Conversation controls",className:"sticky top-0 z-10 space-y-3 border-b bg-background py-3",children:M.length<=1?m():(0,r.jsxs)("div",{"aria-label":"Attempt navigation",className:"flex items-start gap-4",children:[m(),(0,r.jsx)("div",{role:"group","aria-label":"Attempt timeline",className:"ml-auto flex min-w-0 flex-1 flex-wrap justify-end gap-1.5",children:M.map(e=>{let t="jailbreak"===e.attempt.bucket?"Jailbroken":"mitigated"===e.attempt.bucket?"Mitigated":"error"===e.attempt.bucket?"Error":"Pending";return(0,r.jsxs)(F.m_,{children:[(0,r.jsx)(F.k$,{asChild:!0,children:(0,r.jsx)("button",{onClick:()=>R(e.attempt.id),"aria-label":"Go to attempt ".concat(e.attempt.ordinal,": ").concat("jailbreak"===e.attempt.bucket?"jailbroken":e.attempt.bucket),"aria-pressed":b===e.attempt.id,"aria-current":b===e.attempt.id?"step":void 0,className:"inline-flex h-7 min-w-7 shrink-0 items-center justify-center rounded-md border px-1 text-xs font-semibold tabular-nums transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-foreground focus-visible:ring-offset-2\n ".concat("jailbreak"===e.attempt.bucket?"border-rose-200 bg-rose-50 text-rose-800 hover:bg-rose-100 dark:border-rose-700 dark:bg-rose-950 dark:text-rose-200 dark:hover:bg-rose-900":"mitigated"===e.attempt.bucket?"border-teal-200 bg-teal-50 text-teal-800 hover:bg-teal-100 dark:border-teal-700 dark:bg-teal-950 dark:text-teal-200 dark:hover:bg-teal-900":"border-amber-200 bg-amber-50 text-amber-900 hover:bg-amber-100 dark:border-amber-600 dark:bg-amber-950 dark:text-amber-200 dark:hover:bg-amber-900","\n ").concat(b===e.attempt.id?"ring-2 ring-foreground ring-offset-2 ring-offset-background":""),children:e.attempt.ordinal})}),(0,r.jsxs)(F.ZI,{sideOffset:6,className:"max-w-64 space-y-1 px-3 py-2 text-left leading-relaxed",children:[(0,r.jsxs)("p",{className:"font-semibold",children:["Attempt ",e.attempt.ordinal," \xb7 ",t]}),(0,r.jsx)("p",{children:"Select to jump to this conversation."})]})]},e.attempt.id)})})]})}),z&&(0,r.jsx)("p",{className:"max-w-prose text-sm leading-relaxed",children:z}),(null==L?void 0:L.kind)==="candidates"&&(0,r.jsxs)("details",{className:"investigation-panel overflow-hidden",children:[(0,r.jsxs)("summary",{className:"cursor-pointer p-4 text-sm font-medium",children:["Attack branches ",(0,r.jsx)("span",{className:"ml-1 font-normal text-muted-foreground",children:"(optional)"})]}),(0,r.jsx)(eJ,{simple:!0,nodes:L.nodes.map((e,t)=>{var a,r;return{...e,label:e.attemptId?"Attempt ".concat(null==(r=A.data)||null==(a=r.attempts.find(t=>t.id===e.attemptId))?void 0:a.ordinal):"Branch ".concat(t+1)}}),selectedId:y,kind:"candidates",onSelect:e=>{k(e.id),e.attemptId?(w(null),R(e.attemptId)):w(e.reason||"This branch was discarded before a target response was recorded.")}}),N&&(0,r.jsx)("p",{role:"status",className:"p-4 text-sm",children:N})]}),(0,r.jsxs)("section",{"aria-label":"Attack conversation",className:"space-y-8",children:[M.map(e=>(0,r.jsx)(eX,{entry:e,entries:M,highlight:f===e.attempt.id},e.attempt.id)),!M.length&&(0,r.jsx)("p",{className:"investigation-panel p-6 text-sm",children:"This attack has no recorded attempts for this goal."})]}),(0,r.jsxs)("details",{className:"border-t pt-4",children:[(0,r.jsx)("summary",{className:"cursor-pointer text-xs text-muted-foreground",children:"Technical details"}),(0,r.jsx)("pre",{className:"mt-3 overflow-auto whitespace-pre-wrap break-words rounded bg-muted/50 p-4 text-xs",children:JSON.stringify(A.data,null,2)})]})]})}function e1(e){var t,a;let{campaign:s,revision:l,goalIndex:o,attack:i,catalog:c,showGoalHeader:d=!0}=e,[u,m]=(0,n.useState)(0),x=(0,p.LI)("".concat(p.dI,"/").concat(s.id,"/goals?goal_index=").concat(o),l+u),h=null==(t=x.data)?void 0:t.results[0];if(x.error||!x.data)return(0,r.jsx)(eV,{error:x.error,retry:()=>m(e=>e+1)});if(!h)return(0,r.jsx)("p",{className:"investigation-panel p-6 text-sm",children:"This goal has no recorded attempts in this campaign."});let g=null==(a=h.attack_outcomes)?void 0:a.find(e=>e.run_id===i),f=g||h.run_ids.includes(i),v=s.runs.find(e=>e.id===i),b=()=>(0,r.jsxs)("header",{"aria-label":"Selected attack",className:"flex min-h-7 shrink-0 flex-wrap items-center gap-2",children:[(0,r.jsx)("h3",{className:"text-base font-semibold",children:v?(0,p.aN)(v,s.runs):"Unknown attack"}),!f&&(0,r.jsx)("span",{className:"text-xs text-muted-foreground",children:"Not tested"}),!f&&(0,r.jsx)("span",{className:"text-sm text-muted-foreground",children:"0 attempts"})]});return(0,r.jsxs)("div",{className:"min-w-0 space-y-5",children:[d&&(0,r.jsxs)("header",{"aria-label":"Goal details",className:"space-y-2 border-b pb-5",children:[(0,r.jsx)("h2",{className:"w-full whitespace-pre-wrap break-words text-xl font-semibold",children:h.goal||"Goal text not recorded"}),(0,r.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,r.jsx)(S,{info:c.get(h.category)}),(0,r.jsxs)("p",{className:"min-w-0 flex-1 text-xs font-semibold text-muted-foreground",children:["Goal ",h.index+1," \xb7 ",h.category||"Unknown",h.subcategory?" / ".concat(h.subcategory):""]}),(0,r.jsxs)("span",{"aria-label":"Goal outcome for selected attack",className:"inline-flex items-center gap-2 text-xs text-muted-foreground",children:["Goal outcome ",g?(0,r.jsx)(ek,{value:g.verdict}):(0,r.jsx)("span",{children:f?"Outcome not recorded":"Not tested"})]})]})]}),f?(0,r.jsx)(e0,{campaign:s,goal:h,runId:i,revision:l,attackHeader:b},"".concat(h.index,":").concat(i)):(0,r.jsxs)(r.Fragment,{children:[b(),(0,r.jsx)("p",{className:"py-5 text-sm text-muted-foreground",children:"This attack has no recorded attempts for this goal."})]})]})}let e2=[];function e5(e){var t,a,s;let{campaign:l,revision:c}=e,d=(0,o.useSearchParams)(),u=(0,p.LI)("".concat(p.dI,"/").concat(l.id,"/matrix"),c,void 0,{version:l.revision}),m=(0,n.useMemo)(()=>{if(!u.data)return null;try{return{goals:(0,p.UK)(u.data),error:null}}catch(e){return{goals:e2,error:e instanceof Error?e.message:"The goal matrix could not be read."}}},[u.data]),x=(0,n.useMemo)(()=>(function(e){let t=Array.from(new Set(e)).sort((e,t)=>e.localeCompare(t)),a=0;return new Map(t.map((e,t)=>{let r=/^([A-Z][0-9]*)\.\s*/.exec(e),n=w.test(e)?"var(--viz-error)":N[a++%N.length];return[e,{name:e,code:r?r[1]:String(t+1),short:r?e.slice(r[0].length):e,color:n}]}))})(l.category_outcomes.map(e=>e.category)),[l.category_outcomes]),h=(0,n.useRef)(null);m&&(h.current={id:l.id,goals:m.goals});let g=(null==(t=h.current)?void 0:t.id)===l.id?h.current.goals:e2,f=null!=(a=u.error)?a:null==m?void 0:m.error,v=f?(0,r.jsx)("p",{role:"alert",className:"text-sm text-muted-foreground",children:f}):u.data?null:(0,r.jsxs)("p",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[(0,r.jsx)(i.A,{className:"h-4 w-4 animate-spin"}),"Loading goals…"]});return(0,r.jsx)(eT,{campaign:l,recordedGoals:g,status:v,query:null!=(s=null==d?void 0:d.toString())?s:"",onSelectionChange:p.gj,renderEvidence:e=>(0,r.jsx)(e1,{campaign:l,revision:c,goalIndex:e.goal,attack:e.run,catalog:x,showGoalHeader:!1},"".concat(e.goal,":").concat(e.run))})}function e3(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Date.now(),a=Math.round((t-new Date(e).getTime())/1e3),r=new Intl.RelativeTimeFormat(void 0,{numeric:"auto"});for(let[e,t]of[["year",31536e3],["month",2592e3],["day",86400],["hour",3600],["minute",60]])if(Math.abs(a)>=t)return r.format(-Math.round(a/t),e);return"just now"}function e4(e){var t;let{campaigns:a,total:n}=e,s=[...a].sort((e,t)=>e.created_at.localeCompare(t.created_at)),l=e=>a.reduce((t,a)=>t+a[e],0),o=L({recorded_goals:l("recorded_goals"),jailbroken:l("jailbroken")}),i=s.map(e=>L(e)),c=s[s.length-1];return(0,r.jsxs)("section",{"aria-label":"Runs overview",className:"space-y-2",children:[(0,r.jsxs)("div",{className:"grid grid-cols-2 gap-4 lg:grid-cols-5",children:[(0,r.jsx)(k,{label:"Campaigns",value:n,detail:"recorded runs",children:(0,r.jsx)("div",{className:"text-[var(--viz-family-static)]",children:(0,r.jsx)(j,{bars:!0,label:"Attacks per campaign, oldest first: ".concat(s.map(e=>e.attack_runs).join(", ")),values:s.map(e=>e.attack_runs)})})}),(0,r.jsx)(k,{label:"Goals tested",value:l("recorded_goals").toLocaleString(),detail:"across campaigns",children:(0,r.jsx)("div",{className:"text-[var(--viz-family-adaptive)]",children:(0,r.jsx)(j,{bars:!0,label:"Goals per campaign, oldest first: ".concat(s.map(e=>e.recorded_goals).join(", ")),values:s.map(e=>e.recorded_goals)})})}),(0,r.jsx)(k,{label:"Overall ASR",value:null===o?"Not measured":"".concat(o.toFixed(1),"%"),detail:"".concat(l("jailbroken").toLocaleString()," goals jailbroken"),children:(0,r.jsx)("div",{className:"text-[var(--viz-jailbroken)]",children:(0,r.jsx)(j,{max:100,values:i,label:"ASR per campaign, oldest first: ".concat(i.map(e=>null===e?"not measured":"".concat(e.toFixed(1),"%")).join(", "))})})}),(0,r.jsx)(k,{label:"Attempts",value:l("attempts").toLocaleString(),detail:"recorded attempts",children:(0,r.jsx)("div",{className:"text-muted-foreground",children:(0,r.jsx)(j,{bars:!0,label:"Attempts per campaign, oldest first: ".concat(s.map(e=>e.attempts).join(", ")),values:s.map(e=>e.attempts)})})}),(0,r.jsx)("div",{className:"col-span-2 lg:col-span-1",children:(0,r.jsx)(k,{label:"Latest campaign",value:(0,r.jsx)("span",{className:"block truncate text-base",title:null==c?void 0:c.name,children:null!=(t=null==c?void 0:c.name)?t:"None yet"}),detail:c?"".concat(c.target," \xb7 ").concat(e3(c.created_at)):void 0,children:c&&(0,r.jsx)(z,{status:c.status})})})]}),n>a.length&&(0,r.jsxs)("p",{className:"text-xs text-muted-foreground",children:["Trends cover the ",a.length," most recent of ",n," campaigns."]})]})}var e6=a(71360),e8=a(35835),e7=a(41444);let e9=(0,e7.h)("DeleteCampaign"),te=new Set(["COMPLETED","FAILED","CANCELLED"]);function tt(e){let{id:t,ids:a,name:s,status:l,onDeleted:o}=e,[i,c]=(0,n.useState)(!1),[d,u]=(0,n.useState)(!1),[m,h]=(0,n.useState)(""),g=async()=>{u(!0),h("");try{await (0,p._F)(a?{ids:a}:{id:t}),o()}catch(e){e9.error({err:e,id:t},"Failed to delete campaign execution"),h(e instanceof Error?e.message:"Failed to delete campaign execution.")}finally{u(!1)}};return(0,r.jsxs)("div",{children:[(0,r.jsxs)(x.$,{variant:"outline","aria-label":"Delete ".concat(s),disabled:d||!te.has(l)||void 0!==a&&!a.length,title:te.has(l)?void 0:"Active campaign executions cannot be deleted",onClick:()=>c(!0),children:[(0,r.jsx)(e6.A,{className:"mr-2 h-4 w-4"}),d?"Deleting...":a?"Delete selected (".concat(a.length,")"):"Delete"]}),(0,r.jsx)(e8.T,{open:i,onOpenChange:c,title:"Delete campaign execution?",description:"Permanently delete ".concat(a?"these ".concat(a.length," selected campaign executions"):'"'.concat(s,'"')," and all their attack runs, results and traces? This cannot be undone. Saved configurations and exported log files will not be deleted."),confirmText:"Delete execution",variant:"destructive",onConfirm:()=>{g()}}),m&&(0,r.jsx)("p",{role:"alert",className:"mt-2 text-sm text-destructive",children:m})]})}var ta=a(39867);let tr=(0,e7.h)("ExportCampaign"),tn=new Set(["COMPLETED","FAILED","CANCELLED"]);function ts(e){let{id:t,ids:s,name:l,status:o}=e,[c,d]=(0,n.useState)(!1),[u,m]=(0,n.useState)(""),[p,h]=(0,n.useState)(""),g=(0,n.useRef)(null),f=JSON.stringify(null!=s?s:t?[t]:[]);(0,n.useEffect)(()=>(d(!1),m(""),h(""),()=>{var e;return null==(e=g.current)?void 0:e.abort()}),[f]);let v=async()=>{let e=new AbortController;g.current=e,d(!0),m(""),h("");try{let{createCampaignExports:r,downloadCampaignExport:n}=await Promise.all([a.e(690),a.e(390),a.e(877)]).then(a.bind(a,12877)),l=await r(null!=s?s:t?[t]:[],e.signal);if(e.signal.aborted)return;l.forEach(e=>n(e)),h(1===l.length?"HTML download requested.":"".concat(l.length," HTML downloads requested. Your browser may ask permission to download multiple files."))}catch(a){if(e.signal.aborted)return;tr.error({err:a,id:t,ids:s},"Failed to export campaign"),m(a instanceof Error?a.message:"Failed to export campaign.")}finally{e.signal.aborted||d(!1)}};return(0,r.jsxs)("div",{children:[(0,r.jsxs)(x.$,{variant:"outline","aria-label":"Export ".concat(l),disabled:c||void 0!==o&&!tn.has(o)||(void 0!==s?!s.length:!t),title:void 0===o||tn.has(o)?"Download a full-campaign HTML report, printable to PDF":"Export is available when the campaign execution finishes",onClick:()=>{v()},children:[c?(0,r.jsx)(i.A,{className:"mr-2 h-4 w-4 animate-spin"}):(0,r.jsx)(ta.A,{className:"mr-2 h-4 w-4"}),c?"Exporting...":s?"Export selected (".concat(s.length,")"):"Export"]}),u&&(0,r.jsx)("p",{role:"alert",className:"mt-2 max-w-sm text-sm text-destructive",children:u}),p&&(0,r.jsx)("p",{role:"status",className:"mt-2 max-w-sm text-xs text-muted-foreground",children:p})]})}let tl=(0,c.A)("circle-stop",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["rect",{x:"9",y:"9",width:"6",height:"6",rx:"1",key:"1ssd4o"}]]);var to=a(4882),ti=a(7831);let tc=(0,e7.h)("CancelCampaignRun");async function td(e){if(!(e instanceof to.o3e))return null;try{let t=await e.response.json(),a=t&&"object"==typeof t?t.detail:null;return"string"==typeof a&&a?a:null}catch(e){return null}}function tu(e){let{id:t,name:a,onCancelled:s}=e,[l,o]=(0,n.useState)(!1),[c,d]=(0,n.useState)("idle"),[u,m]=(0,n.useState)(""),p=async()=>{d("busy"),m("");try{await ti.ME.runCancelCreate({id:t}),d("requested"),null==s||s()}catch(a){var e;tc.error({err:a,id:t},"Failed to cancel campaign run"),d("idle"),m(null!=(e=await td(a))?e:"Could not cancel the run.")}};return(0,r.jsxs)("div",{children:[(0,r.jsxs)(x.$,{variant:"outline","aria-label":"Cancel ".concat(a),disabled:"idle"!==c,onClick:()=>o(!0),children:["idle"===c?(0,r.jsx)(tl,{className:"mr-2 h-4 w-4"}):(0,r.jsx)(i.A,{className:"mr-2 h-4 w-4 animate-spin"}),"idle"===c?"Cancel run":"Cancelling..."]}),(0,r.jsx)(e8.T,{open:l,onOpenChange:o,title:"Cancel this run?",description:"The run stops and finishes as cancelled. Results gathered so far are kept.",confirmText:"Cancel run",cancelText:"Keep running",variant:"destructive",onConfirm:()=>{p()}}),u&&(0,r.jsx)("p",{role:"alert",className:"mt-2 max-w-sm text-sm text-destructive",children:u})]})}let tm=(0,c.A)("git-compare-arrows",[["circle",{cx:"5",cy:"6",r:"3",key:"1qnov2"}],["path",{d:"M12 6h5a2 2 0 0 1 2 2v7",key:"1yj91y"}],["path",{d:"m15 9-3-3 3-3",key:"1lwv8l"}],["circle",{cx:"19",cy:"18",r:"3",key:"1qljk2"}],["path",{d:"M12 18H7a2 2 0 0 1-2-2V9",key:"16sdep"}],["path",{d:"m9 15 3 3-3 3",key:"1m3kbl"}]]),tx=(e,t)=>"/stats?".concat(new URLSearchParams({run:e,baseline:t}));function tp(e){let{current:t,baseline:a}=e;if(null===t||null===a)return(0,r.jsx)("span",{className:"text-muted-foreground",children:"not comparable"});let n=t-a,s=.05>Math.abs(n)?0:n;return(0,r.jsxs)("span",{className:"font-semibold tabular-nums ".concat(s>0?"text-rose-700 dark:text-rose-300":s<0?"text-emerald-700 dark:text-emerald-300":"text-muted-foreground"),title:s>0?"More goals jailbroken than before":s<0?"Fewer goals jailbroken than before":"No change",children:[s>0?"+":s<0?"−":"\xb1",Math.abs(s).toFixed(1)," pts"]})}function th(e){var t,a,s;let{campaign:l}=e,i=(0,o.useRouter)(),[c,d]=(0,n.useState)(!1),[u,m]=(0,n.useState)(""),h=l.campaign?new URLSearchParams({campaign:l.campaign,page:"1",page_size:"100"}):null,g=(0,p.LI)(c&&h?"".concat(p.dI,"/summary?").concat(h):null),f=null!=(s=null==(t=g.data)?void 0:t.results.filter(e=>e.id!==l.id))?s:[],v=u||(null==(a=f[0])?void 0:a.id)||"";return l.campaign?c?(0,r.jsxs)("form",{className:"flex flex-wrap items-center gap-2",onSubmit:e=>{e.preventDefault(),v&&i.push(tx(l.id,v))},children:[(0,r.jsxs)("label",{className:"flex items-center gap-2 text-sm",children:[(0,r.jsx)("span",{className:"text-muted-foreground",children:"Baseline"}),(0,r.jsxs)("select",{"aria-label":"Baseline run",className:"h-8 max-w-[18rem] rounded-md border bg-card px-2 text-sm",disabled:!f.length,value:v,onChange:e=>m(e.target.value),children:[!g.data&&!g.error&&(0,r.jsx)("option",{value:"",children:"Loading runs..."}),g.data&&!f.length&&(0,r.jsx)("option",{value:"",children:"No other runs of this campaign"}),f.map(e=>(0,r.jsx)("option",{value:e.id,children:"".concat(e.name," \xb7 ").concat(new Date(e.created_at).toLocaleString()," \xb7 ").concat(e.status.charAt(0)+e.status.slice(1).toLowerCase())},e.id))]})]}),(0,r.jsx)(x.$,{type:"submit",size:"sm",disabled:!v,children:"Compare"}),g.error&&(0,r.jsx)("p",{role:"alert",className:"w-full text-xs text-destructive",children:g.error})]}):(0,r.jsx)(x.$,{variant:"outline",size:"sm",onClick:()=>d(!0),children:"Compare with another run"}):null}function tg(e){let{campaign:t}=e,a=t.previous,n=a?[["Jailbroken",a.jailbroken,t.jailbroken],["Mitigated",a.mitigated,t.mitigated],["Unresolved",a.unresolved,t.unresolved],["Goals",a.recorded_goals,t.recorded_goals]]:[],s=L(t),o=a?L(a):null;return(0,r.jsxs)("section",{"aria-label":"Change since the previous run",className:"investigation-panel flex flex-wrap items-center justify-between gap-x-6 gap-y-3 p-4 text-sm",children:[a?(0,r.jsxs)("div",{className:"min-w-0 space-y-1",children:[(0,r.jsxs)("p",{className:"text-xs text-muted-foreground",children:["Since the previous run \xb7 ",(0,r.jsx)("time",{dateTime:a.created_at,title:new Date(a.created_at).toLocaleString(),children:e3(a.created_at)})]}),(0,r.jsxs)("p",{className:"flex flex-wrap items-baseline gap-x-2",children:[(0,r.jsxs)("span",{children:["ASR ",(0,r.jsx)("span",{className:"tabular-nums",children:null===o?"—":"".concat(o.toFixed(1),"%")})," → ",(0,r.jsx)("span",{className:"font-semibold tabular-nums",children:null===s?"—":"".concat(s.toFixed(1),"%")})]}),(0,r.jsx)(tp,{current:s,baseline:o})]}),(0,r.jsx)("p",{className:"text-xs text-muted-foreground tabular-nums",children:n.map(e=>{let[t,a,r]=e;return"".concat(t," ").concat(a," → ").concat(r)}).join(" \xb7 ")})]}):(0,r.jsx)("p",{className:"text-muted-foreground",children:"No earlier completed run of this campaign to compare with."}),(0,r.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[a&&(0,r.jsx)(x.$,{variant:"outline",size:"sm",asChild:!0,children:(0,r.jsxs)(l(),{href:tx(t.id,a.id),children:[(0,r.jsx)(tm,{className:"mr-2 h-4 w-4"}),"Compare with previous run"]})}),(0,r.jsx)(th,{campaign:t}),t.campaign&&(0,r.jsx)(l(),{className:"text-sm underline-offset-4 hover:underline",href:"/stats?".concat(new URLSearchParams({campaign:t.campaign})),children:"All runs of this campaign"})]})]})}function tf(e){let{runs:t}=e,[a,n]=h(640),s=[...t].sort((e,t)=>e.created_at.localeCompare(t.created_at)||e.id.localeCompare(t.id)).map(e=>({run:e,value:L(e)})).filter(e=>null!==e.value),l=Math.max(320,n),o=l-24,i=e=>s.length>1?48+e*(o-48)/(s.length-1):(48+o)/2,c=e=>150-e/100*134,d=Math.max(1,Math.ceil(s.length/Math.max(1,Math.floor((o-48)/90))));return(0,r.jsxs)("figure",{"aria-label":"Attack success rate across runs",className:"investigation-panel space-y-3 p-5",children:[(0,r.jsxs)("figcaption",{children:[(0,r.jsx)("h2",{className:"text-base font-semibold",children:"Progress across runs"}),(0,r.jsx)("p",{className:"mt-1 text-xs text-muted-foreground",children:"Attack success rate of each run of this campaign, oldest first. Lower is better. Hollow points are runs that did not complete; their rate covers only the goals they recorded."})]}),s.length<2&&(0,r.jsx)("p",{role:"status",className:"text-sm text-muted-foreground",children:s.length?"Only one run of this campaign has recorded goals. Run it again to see a trend.":"No run of this campaign has recorded goals yet."}),s.length>0&&(0,r.jsx)("div",{ref:a,className:"min-w-0 overflow-x-auto rounded-lg border bg-background/50",children:(0,r.jsxs)("svg",{width:l,height:185,className:"block",role:"group","aria-label":"Attack success rate per run",children:[[0,25,50,75,100].map(e=>(0,r.jsxs)("g",{children:[(0,r.jsx)("line",{x1:48,x2:o,y1:c(e),y2:c(e),stroke:"var(--border)",strokeDasharray:"3 4"}),(0,r.jsxs)("text",{x:38,y:c(e)+4,textAnchor:"end",fontSize:11,fill:"var(--muted-foreground)",children:[e,"%"]})]},e)),s.length>1&&(0,r.jsx)("polyline",{points:s.map((e,t)=>"".concat(i(t),",").concat(c(e.value))).join(" "),fill:"none",stroke:"var(--viz-jailbroken)",strokeWidth:2,strokeLinejoin:"round"}),s.map((e,t)=>(0,r.jsxs)("a",{href:"/stats?".concat(new URLSearchParams({run:e.run.id})),"aria-label":"".concat(e.run.name,", ").concat(new Date(e.run.created_at).toLocaleString(),": ").concat(e.value.toFixed(1),"% ASR"),children:[(0,r.jsx)("title",{children:(e=>{let{run:t,value:a}=e;return"".concat(t.name," \xb7 ").concat(new Date(t.created_at).toLocaleString(),"\n\nASR: ").concat(a.toFixed(1),"%\nJailbroken goals: ").concat(t.jailbroken," of ").concat(t.recorded_goals,"\nStatus: ").concat(t.status.toLowerCase())})(e)}),(0,r.jsx)("circle",{"data-trend-run":e.run.id,"data-asr":e.value,cx:i(t),cy:c(e.value),r:5,fill:"COMPLETED"===e.run.status?"var(--viz-jailbroken)":"var(--card)",stroke:"var(--viz-jailbroken)",strokeWidth:2}),t%d==0&&(0,r.jsx)("text",{x:i(t),y:170,textAnchor:"middle",fontSize:11,fill:"var(--muted-foreground)",children:new Date(e.run.created_at).toLocaleDateString(void 0,{month:"short",day:"numeric"})})]},e.run.id))]})})]})}let tv={regressed:"Regressed",fixed:"Fixed",new:"New",dropped:"Dropped",unchanged:"Unchanged"},tb={regressed:"text-rose-700 dark:text-rose-300",fixed:"text-emerald-700 dark:text-emerald-300",new:"text-sky-700 dark:text-sky-300",dropped:"text-amber-800 dark:text-amber-300",unchanged:"text-muted-foreground"};function tj(e){let{value:t}=e;return null===t?(0,r.jsx)("span",{className:"text-xs text-muted-foreground",children:"Not run"}):(0,r.jsx)(ek,{value:t})}function ty(e){let{comparison:t,initialChange:a,goalIndex:s}=e,[o,i]=(0,n.useState)(()=>p.on.includes(a)?a:"all"===a?null:t.counts.regressed>0?"regressed":null),c=e=>{i(e),(0,p.gj)({change:null!=e?e:"all"})},d=o?t.goals.filter(e=>e.change===o):t.goals,u=e=>"inline-flex items-center gap-2 rounded-full border px-3 py-1 text-sm transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring ".concat(e?"border-foreground bg-foreground text-background":"bg-card hover:bg-muted");return(0,r.jsxs)("section",{"aria-label":"Goal changes",className:"investigation-panel space-y-4 p-5 sm:p-6",children:[(0,r.jsxs)("header",{children:[(0,r.jsx)("p",{className:"section-eyebrow",children:"Run comparison"}),(0,r.jsx)("h2",{className:"mt-2 text-xl font-semibold",children:"Which goals changed?"}),(0,r.jsx)("p",{className:"mt-2 text-sm text-muted-foreground",children:"Goals are matched by their exact text. Regressed: jailbroken now, not in the baseline. Fixed: jailbroken in the baseline, not now. New and dropped goals were run by only one of the two."})]}),(0,r.jsxs)("div",{role:"group","aria-label":"Filter goals by change",className:"flex flex-wrap gap-2",children:[(0,r.jsxs)("button",{type:"button","aria-pressed":null===o,className:u(null===o),onClick:()=>c(null),children:["All ",(0,r.jsx)("span",{className:"tabular-nums",children:t.goals.length})]}),p.on.map(e=>(0,r.jsxs)("button",{type:"button","aria-pressed":o===e,className:u(o===e),onClick:()=>c(o===e?null:e),children:[tv[e]," ",(0,r.jsx)("span",{className:"tabular-nums",children:t.counts[e]})]},e))]}),t.goals.length?d.length?(0,r.jsx)("div",{className:"overflow-x-auto rounded-md border",children:(0,r.jsxs)("table",{"aria-label":"Goal outcomes in both runs",className:"w-full min-w-[760px] text-left text-sm",children:[(0,r.jsx)("thead",{className:"bg-muted/40 text-xs text-muted-foreground",children:(0,r.jsx)("tr",{children:["Goal","Category","Subcategory","Baseline","Current","Change"].map(e=>(0,r.jsx)("th",{scope:"col",className:"px-4 py-3 font-medium",children:e},e))})}),(0,r.jsx)("tbody",{children:d.map(e=>{let a=null===e.current||null==s?void 0:s.get(e.goal);return(0,r.jsxs)("tr",{className:"border-t align-top",children:[(0,r.jsx)("th",{scope:"row",className:"max-w-[28rem] px-4 py-3 font-normal",children:void 0===a?(0,r.jsx)("span",{className:"whitespace-pre-wrap break-words",children:e.goal}):(0,r.jsx)(l(),{className:"whitespace-pre-wrap break-words text-primary underline-offset-4 hover:underline",href:"/stats?".concat(new URLSearchParams({run:t.current.id,goal:String(a)})),children:e.goal})}),(0,r.jsx)("td",{className:"px-4 py-3",children:e.category||"Unknown category"}),(0,r.jsx)("td",{className:"px-4 py-3 text-muted-foreground",children:e.subcategory||"Unspecified"}),(0,r.jsx)("td",{className:"px-4 py-3",children:(0,r.jsx)(tj,{value:e.baseline})}),(0,r.jsx)("td",{className:"px-4 py-3",children:(0,r.jsx)(tj,{value:e.current})}),(0,r.jsx)("td",{className:"px-4 py-3 font-medium ".concat(tb[e.change]),children:tv[e.change]})]},"".concat(e.change,":").concat(e.goal))})})]})}):(0,r.jsxs)("p",{role:"status",className:"rounded-lg border p-6 text-sm text-muted-foreground",children:["No ",tv[o].toLowerCase()," goals."]}):(0,r.jsx)("p",{role:"status",className:"rounded-lg border p-6 text-sm text-muted-foreground",children:"Neither run recorded any goals to compare."})]})}function tk(){return(0,r.jsxs)("p",{role:"status",className:"flex items-center gap-2 p-6 text-sm text-muted-foreground",children:[(0,r.jsx)(i.A,{className:"h-4 w-4 animate-spin"}),"Loading recorded results..."]})}function tN(e){let{message:t,retry:a}=e;return(0,r.jsxs)("div",{role:"alert",className:"investigation-panel space-y-3 p-6 text-sm",children:[(0,r.jsx)("p",{children:t}),(0,r.jsx)(x.$,{variant:"outline",onClick:a,children:"Retry"})]})}let tw=e=>e.results.some(p.Oy),tS=e=>"/stats?".concat(new URLSearchParams({run:e}));function tC(e){let{status:t}=e;return(0,r.jsxs)("div",{role:"status",className:"investigation-panel flex items-center gap-3 p-4 text-sm",children:[(0,r.jsx)(i.A,{className:"h-4 w-4 shrink-0 animate-spin text-sky-600","aria-hidden":"true"}),(0,r.jsxs)("p",{children:[(0,r.jsx)("span",{className:"font-semibold",children:"PENDING"===t?"Queued.":"Running."})," ","Showing results so far; this report updates every 5 seconds until the run finishes."]})]})}function t_(e){var t,a,s,i,c,m;let{id:h}=e,g=(0,o.useSearchParams)(),f=(null==g?void 0:g.get("section"))==="audit"||!(null==g?void 0:g.get("section"))&&(null==g?void 0:g.get("tab"))==="audit",[v,b]=(0,n.useState)(0),j=(0,p.LI)("".concat(p.dI,"/").concat(h,"/summary"),v,void 0,{pollWhile:p.Oy}),y=(0,p.LI)("".concat(p.dI,"/").concat(h,"/report"),v,void 0,{version:null==(t=j.data)?void 0:t.revision,versionOf:e=>e.revision}),k=y.data,N=(0,p.LI)(k?"".concat(p.dI,"/").concat(h,"/costs"):null,v,void 0,{version:null==k?void 0:k.revision}),w=N.data,S=null!=(i=null!=(s=null==(a=j.data)?void 0:a.status)?s:null==k?void 0:k.status)?i:"",C=!!S&&(0,p.Oy)({status:S}),_=null==k?void 0:k.id;return(0,n.useEffect)(()=>{var e,t;f&&_&&(null==(t=document.getElementById("campaign-audit"))||null==(e=t.scrollIntoView)||e.call(t,{block:"start"}))},[f,_]),(0,r.jsx)("div",{className:"runs-workspace min-h-full",children:(0,r.jsx)(u.M,{compact:!0,title:null!=(c=null==k?void 0:k.name)?c:"Campaign",action:(0,r.jsxs)("div",{className:"flex flex-wrap gap-2",children:[k&&(0,r.jsxs)(r.Fragment,{children:[C&&(0,r.jsx)(tu,{id:h,name:k.name}),(0,r.jsx)(ts,{id:h,name:k.name,status:S}),(0,r.jsx)(tt,{id:h,name:k.name,status:S,onDeleted:()=>window.location.assign("/stats")})]}),(0,r.jsxs)(x.$,{variant:"outline",onClick:()=>b(e=>e+1),children:[(0,r.jsx)(d,{className:"mr-2 h-4 w-4"}),"Refresh"]})]}),children:(0,r.jsxs)("div",{className:"space-y-8 px-4 pb-8 sm:px-6",children:[(0,r.jsxs)("nav",{"aria-label":"Investigation breadcrumbs",className:"flex flex-wrap items-center gap-2 text-sm text-muted-foreground",children:[(0,r.jsx)(l(),{href:"/stats",className:"hover:underline",children:"Runs"}),(0,r.jsx)("span",{"aria-hidden":"true",children:"/"}),(0,r.jsx)("span",{className:"text-foreground",children:null!=(m=null==k?void 0:k.name)?m:"Campaign"})]}),y.error?(0,r.jsx)(tN,{message:y.error,retry:()=>b(e=>e+1)}):k?(0,r.jsxs)(r.Fragment,{children:[C&&(0,r.jsx)(tC,{status:S}),(0,r.jsx)(tg,{campaign:k}),(0,r.jsx)(em,{campaign:k,costs:w,coverage:(0,r.jsx)(e5,{campaign:k,revision:v}),costStatus:N.error?(0,r.jsx)(tN,{message:N.error,retry:()=>b(e=>e+1)}):(0,r.jsx)(tk,{})})]}):(0,r.jsx)(tk,{})]})})})}function tA(e){var t;let{id:a,baseline:s}=e,i=(0,o.useSearchParams)(),[c,m]=(0,n.useState)(0),h=(0,p.LI)("".concat(p.dI,"/").concat(a,"/compare?").concat(new URLSearchParams({baseline:s})),c),g=h.data,f=(0,p.LI)(g?"".concat(p.dI,"/").concat(a,"/matrix"):null,c),v=(0,n.useMemo)(()=>f.data?new Map(f.data.goals.map(e=>[e.goal,e.index])):void 0,[f.data]);return(0,r.jsx)("div",{className:"runs-workspace min-h-full",children:(0,r.jsx)(u.M,{compact:!0,title:"Compare runs",action:(0,r.jsxs)(x.$,{variant:"outline",onClick:()=>m(e=>e+1),children:[(0,r.jsx)(d,{className:"mr-2 h-4 w-4"}),"Refresh"]}),children:(0,r.jsxs)("div",{className:"space-y-6 px-4 pb-8 sm:px-6",children:[(0,r.jsxs)("nav",{"aria-label":"Investigation breadcrumbs",className:"flex flex-wrap items-center gap-2 text-sm text-muted-foreground",children:[(0,r.jsx)(l(),{href:"/stats",className:"hover:underline",children:"Runs"}),(0,r.jsx)("span",{"aria-hidden":"true",children:"/"}),(0,r.jsx)(l(),{href:tS(a),className:"hover:underline",children:null!=(t=null==g?void 0:g.current.name)?t:"Campaign"}),(0,r.jsx)("span",{"aria-hidden":"true",children:"/"}),(0,r.jsx)("span",{className:"text-foreground",children:"Compare"})]}),h.error?(0,r.jsx)(tN,{message:h.error,retry:()=>m(e=>e+1)}):g?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("dl",{className:"grid gap-3 sm:grid-cols-2",children:[["Baseline",g.baseline],["Current",g.current]].map(e=>{let[t,a]=e;return(0,r.jsxs)("div",{className:"kpi-card",children:[(0,r.jsx)("dt",{className:"kpi-label",children:t}),(0,r.jsxs)("dd",{className:"mt-1 min-w-0",children:[(0,r.jsx)(l(),{href:tS(a.id),className:"block truncate font-semibold text-primary underline-offset-4 hover:underline",children:a.name}),(0,r.jsx)("time",{dateTime:a.created_at,className:"text-xs text-muted-foreground",children:new Date(a.created_at).toLocaleString()})]})]},t)})}),(0,r.jsx)(ty,{comparison:g,initialChange:null==i?void 0:i.get("change"),goalIndex:v})]}):(0,r.jsx)(tk,{})]})})})}function tM(e){let{campaign:t,runs:a}=e,n=(0,o.useRouter)(),s=new Map;for(let e of a)e.campaign&&!s.has(e.campaign)&&s.set(e.campaign,e.name);return t&&!s.has(t)&&s.set(t,"Selected campaign"),(0,r.jsxs)("label",{className:"flex flex-wrap items-center gap-2 text-sm",children:[(0,r.jsx)("span",{className:"text-muted-foreground",children:"Campaign"}),(0,r.jsxs)("select",{"aria-label":"Filter runs by campaign",className:"h-9 max-w-[20rem] rounded-md border bg-card px-3 text-sm",value:null!=t?t:"",onChange:e=>n.push(e.target.value?"/stats?".concat(new URLSearchParams({campaign:e.target.value})):"/stats"),children:[(0,r.jsx)("option",{value:"",children:"All campaigns"}),Array.from(s).map(e=>{let[t,a]=e;return(0,r.jsx)("option",{value:t,children:a},t)})]})]})}function tL(e){var t,a,s;let{campaign:o}=e,[i,c]=(0,n.useState)(1),[h,g]=(0,n.useState)(0),[f,v]=(0,n.useState)(new Set),j=(e,t)=>"".concat(p.dI,"/summary?").concat(new URLSearchParams({page:String(e),page_size:String(t),...o?{campaign:o}:{}})),k=(0,p.LI)(j(1,100),h,void 0,{pollWhile:tw}),N=(0,p.LI)(i>5?j(i,20):null,h,void 0,{pollWhile:tw}),w=i>5?N.error:k.error,S=i>5?N.data:k.data?{...k.data,results:k.data.results.slice((i-1)*20,20*i)}:null,C=null!=(a=null==S?void 0:S.results.filter(e=>["COMPLETED","FAILED","CANCELLED"].includes(e.status)))?a:[],_=C.filter(e=>f.has(e.id)).map(e=>e.id),A=!!(null==S?void 0:S.results.some(p.Oy)),M=()=>{v(new Set),g(e=>e+1)};return(0,r.jsx)("div",{className:"runs-workspace min-h-full",children:(0,r.jsx)(u.M,{title:"Runs",description:"Compare campaign results, then explore goals and their attack conversations.",action:(0,r.jsxs)("div",{className:"flex flex-wrap gap-2",children:[(0,r.jsx)(ts,{ids:_,name:"selected campaigns"}),(0,r.jsx)(tt,{id:"",ids:_,name:"selected campaigns",status:"COMPLETED",onDeleted:()=>{c(1),M()}}),(0,r.jsxs)(x.$,{variant:"outline",onClick:M,children:[(0,r.jsx)(d,{className:"mr-2 h-4 w-4"}),"Refresh"]})]}),children:(0,r.jsxs)("div",{className:"space-y-4 px-4 sm:px-6",children:[(0,r.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[(0,r.jsx)(tM,{campaign:o,runs:null!=(s=null==(t=k.data)?void 0:t.results)?s:[]}),A&&(0,r.jsxs)("p",{role:"status",className:"flex items-center gap-2 text-xs text-muted-foreground",children:[(0,r.jsx)("span",{"aria-hidden":"true",className:"h-2 w-2 animate-pulse rounded-full bg-sky-500"}),"Runs in progress; this list updates every 5 seconds."]})]}),k.data&&k.data.results.length>0&&(0,r.jsx)(e4,{campaigns:k.data.results.slice(0,100),total:k.data.count}),o&&k.data&&(0,r.jsx)(tf,{runs:k.data.results}),w?(0,r.jsx)(tN,{message:w,retry:()=>g(e=>e+1)}):S?(0,r.jsxs)(r.Fragment,{children:[S.results.length?(0,r.jsx)("div",{className:"investigation-panel overflow-x-auto",children:(0,r.jsxs)("table",{className:"w-full min-w-[760px] text-left text-sm",children:[(0,r.jsx)("thead",{className:"bg-muted/40 text-xs text-muted-foreground",children:(0,r.jsxs)("tr",{children:[(0,r.jsx)("th",{className:"px-3 py-3",children:(0,r.jsx)("input",{type:"checkbox","aria-label":"Select all deletable campaigns on this page",disabled:!C.length,checked:!!C.length&&_.length===C.length,onChange:e=>v(new Set(e.target.checked?C.map(e=>e.id):[]))})}),["Campaign / target","Goal outcomes","ASR","Attacks","Status","Started"].map(e=>(0,r.jsx)("th",{className:"px-5 py-3 font-medium ".concat("ASR"===e||"Attacks"===e?"text-right":""),children:e},e))]})}),(0,r.jsx)("tbody",{children:S.results.map(e=>{let t=L(e);return(0,r.jsxs)("tr",{className:"border-t transition-colors hover:bg-muted/30",children:[(0,r.jsx)("td",{className:"px-3 py-3.5",children:(0,r.jsx)("input",{type:"checkbox","aria-label":"Select ".concat(e.name),disabled:!C.some(t=>t.id===e.id),checked:_.includes(e.id),onChange:t=>v(a=>{let r=new Set(a);return t.target.checked?r.add(e.id):r.delete(e.id),r})})}),(0,r.jsxs)("td",{className:"max-w-[22rem] px-5 py-3.5",children:[(0,r.jsx)(l(),{className:"font-semibold text-primary underline-offset-4 hover:underline",href:tS(e.id),children:e.name}),(0,r.jsx)("p",{className:"mt-0.5 flex min-w-0 items-center gap-2 text-xs text-muted-foreground",children:(0,r.jsx)("span",{className:"truncate",children:e.target})})]}),(0,r.jsxs)("td",{className:"w-[30%] px-5 py-3.5",children:[(0,r.jsx)(y,{label:"".concat(e.name," outcomes"),segments:b(e)}),(0,r.jsxs)("p",{className:"mt-1.5 text-xs text-muted-foreground tabular-nums",children:[(0,r.jsx)("span",{className:"font-medium text-foreground",children:e.jailbroken})," / ",e.recorded_goals," jailbroken \xb7 ",e.mitigated," mitigated \xb7 ",e.unresolved," unresolved"]})]}),(0,r.jsx)("td",{className:"px-5 py-3.5 text-right text-base font-semibold tabular-nums",children:null===t?"—":"".concat(t.toFixed(0),"%")}),(0,r.jsx)("td",{className:"px-5 py-3.5 text-right tabular-nums",children:e.attack_runs}),(0,r.jsx)("td",{className:"px-5 py-3.5",children:(0,r.jsx)(z,{status:e.status})}),(0,r.jsx)("td",{className:"whitespace-nowrap px-5 py-3.5 text-xs text-muted-foreground",title:new Date(e.created_at).toLocaleString(),children:e3(e.created_at)})]},e.id)})})]})}):(0,r.jsx)("div",{className:"investigation-panel p-10 text-center",children:o?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("h2",{className:"font-medium",children:"No runs of this campaign yet"}),(0,r.jsxs)("p",{className:"mt-2 text-sm text-muted-foreground",children:["Launch the campaign, then refresh. ",(0,r.jsx)(l(),{href:"/stats",className:"underline",children:"Show all campaigns"}),"."]})]}):(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("h2",{className:"font-medium",children:"No campaign executions yet"}),(0,r.jsx)("p",{className:"mt-2 text-sm text-muted-foreground",children:"Launch a campaign from Campaigns or run one with the CLI, then refresh. No sample results are mixed into your history."})]})}),(0,r.jsx)(m.H,{page:i,pageSize:20,count:S.count,isLoading:!1,onPageChange:e=>{v(new Set),c(e)}})]}):(0,r.jsx)(tk,{})]})})})}function tR(){var e;let t=(0,o.useSearchParams)(),a=null==t?void 0:t.get("run"),n=null==t?void 0:t.get("baseline"),s=null!=(e=null==t?void 0:t.get("campaign"))?e:null;return a&&n?(0,r.jsx)(tA,{id:a,baseline:n},"".concat(a,":").concat(n)):a?(0,r.jsx)(t_,{id:a},a):(0,r.jsx)(tL,{campaign:s},null!=s?s:"")}function tz(){return(0,r.jsx)(n.Suspense,{fallback:(0,r.jsx)(tk,{}),children:(0,r.jsx)(tR,{})})}},61362:(e,t,a)=>{"use strict";a.d(t,{A:()=>r});let r=(0,a(71847).A)("circle-check",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]])},61911:(e,t,a)=>{"use strict";function r(e,t,a){if(!t.has(e))throw TypeError("attempted to "+a+" private field on non-instance");return t.get(e)}a.d(t,{_:()=>r})},65142:(e,t,a)=>{"use strict";a.d(t,{p:()=>s});var r=a(95155);a(12115);var n=a(64269);function s(e){let{className:t,type:a,...s}=e;return(0,r.jsx)("input",{type:a,"data-slot":"input",className:(0,n.cn)("file:text-foreground placeholder:text-muted-foreground selection:bg-primary selection:text-primary-foreground dark:bg-input/30 border-input flex h-9 w-full min-w-0 rounded-md border bg-transparent px-3 py-1 text-base shadow-xs transition-[color,box-shadow] outline-none file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm","focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]","aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",t),...s})}},66218:(e,t,a)=>{"use strict";a.d(t,{jH:()=>s});var r=a(12115);a(95155);var n=r.createContext(void 0);function s(e){let t=r.useContext(n);return e||t||"ltr"}},68600:(e,t,a)=>{"use strict";a.d(t,{LI:()=>v,Ld:()=>h,Oy:()=>o,UK:()=>d,_F:()=>g,aN:()=>i,dI:()=>m,gj:()=>b,on:()=>u});var r=a(12115),n=a(72903),s=a(41444);let l=new Set(["PENDING","RUNNING"]),o=e=>l.has(e.status);function i(e,t){return(function(e,t){let a=t.filter(t=>t.technique===e.technique).sort((e,t)=>e.created_at.localeCompare(t.created_at)||e.id.localeCompare(t.id));return"".concat(e.technique.toUpperCase()).concat(a.length>1?" (".concat(a.findIndex(t=>t.id===e.id)+1,")"):"")})(e,t).replace("STATIC_TEMPLATE","Static template").replace("BASELINE","Baseline").replace("FLIPATTACK","FlipAttack").replace("CIPHERCHAT","CipherChat").replace("CRESCENDO","Crescendo").replace("ADVPREFIX","AdvPrefix")}let c=["unresolved","mitigated","error","jailbroken"];function d(e){return e.goals.map((t,a)=>{let r=[];return e.runs.forEach((t,n)=>{var s,l,o;let i=null==(s=e.cells[a])?void 0:s[n];if(null==i)return;let d=c[i];if(!d)throw Error("Unknown outcome code ".concat(i," in the goal matrix."));r.push({run_id:t,verdict:d,attempts:null!=(o=null==(l=e.attempts[a])?void 0:l[n])?o:0})}),{...t,run_ids:r.map(e=>e.run_id),attack_outcomes:r}})}let u=["regressed","fixed","new","dropped","unchanged"],m="/api/proxy/run";async function x(e,t){let a=null;try{let t=await e.json();a=t&&"object"==typeof t&&"detail"in t?t.detail:null}catch(e){}return Error("".concat(t," (HTTP ").concat(e.status,")").concat("string"==typeof a&&a?": ".concat(a):"."))}async function p(e,t,a){let r=await fetch(e,{...t,headers:{...(0,n.b)(),...t.headers}});if(!r.ok)throw await x(r,a);return r}async function h(e,t){var a;let r=await p(e,{signal:t},"Could not load campaign runs");if(!(null==(a=r.headers.get("content-type"))?void 0:a.includes("application/json")))throw Error("The server returned campaign run data in an unexpected format.");return r.json()}async function g(e){await ("ids"in e?p("".concat(m,"/delete"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({ids:e.ids})},"Deletion failed"):p("".concat(m,"/").concat(e.id),{method:"DELETE"},"Deletion failed"))}let f=(0,s.h)("CampaignRuns");function v(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:h,{pollWhile:n,version:s,versionOf:l}=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},[o,i]=(0,r.useState)({url:null,data:null,error:null,version:void 0}),c=o.url===e&&null!==o.data,d=c&&!!(null==n?void 0:n(o.data)),u=(0,r.useRef)({poll:d,version:s,versionOf:l}),m=(0,r.useRef)(void 0),x=(0,r.useRef)(null);return(0,r.useEffect)(()=>{u.current={poll:d,version:s,versionOf:l}}),(0,r.useEffect)(()=>{let t;if(!e)return;let r=new AbortController,n=!1,s=!1,l=()=>{clearTimeout(t),t=void 0,!n&&u.current.poll&&"hidden"!==document.visibilityState&&(t=setTimeout(()=>o(!1),5e3))},o=c=>{clearTimeout(t),t=void 0,n=!0;let d=u.current.version;m.current=d,a(e,r.signal).then(t=>{var a,n,s;r.signal.aborted||i({url:e,data:t,error:null,version:null!=(s=null==(a=(n=u.current).versionOf)?void 0:a.call(n,t))?s:d})}).catch(t=>{!r.signal.aborted&&(f.error({err:t,url:e},"Failed to load campaign run data"),c&&i({url:e,data:null,error:t instanceof Error?t.message:"Failed to load campaign runs.",version:void 0}))}).finally(()=>{n=!1,r.signal.aborted||(s?(s=!1,o(!1)):l())})},c=()=>{"hidden"===document.visibilityState?(clearTimeout(t),t=void 0):!u.current.poll||n||t||o(!1)};return x.current={refresh:()=>{n?s=!0:o(!1)},schedule:l},i({url:e,data:null,error:null,version:void 0}),o(!0),document.addEventListener("visibilitychange",c),()=>{r.abort(),clearTimeout(t),document.removeEventListener("visibilitychange",c),x.current=null}},[e,t,a]),(0,r.useEffect)(()=>{var e;null==(e=x.current)||e.schedule()},[d]),(0,r.useEffect)(()=>{var e;c&&void 0!==s&&s!==o.version&&s!==m.current&&(null==(e=x.current)||e.refresh())},[c,s,o.version]),o.url===e?o:{url:e,data:null,error:null,version:void 0}}function b(e){let t=new URL(window.location.href);for(let[a,r]of Object.entries(e))if(Array.isArray(r))for(let e of(t.searchParams.delete(a),r))t.searchParams.append(a,e);else null===r||""===r?t.searchParams.delete(a):t.searchParams.set(a,r);window.history.replaceState(null,"","".concat(t.pathname).concat(t.search))}},69023:(e,t,a)=>{"use strict";a.d(t,{_:()=>n});var r=a(61911);function n(e,t,a){var n=(0,r._)(e,t,"set");if(n.set)n.set.call(e,a);else{if(!n.writable)throw TypeError("attempted to set read only private field");n.value=a}return a}},75426:(e,t,a)=>{"use strict";a.d(t,{A:()=>r});let r=(0,a(71847).A)("copy",[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]])},97239:(e,t,a)=>{"use strict";a.d(t,{_:()=>n});var r=a(61911);function n(e,t){var a=(0,r._)(e,t,"get");return a.get?a.get.call(e):a.value}},97999:(e,t,a)=>{"use strict";function r(e,t,a){if(t.has(e))throw TypeError("Cannot initialize the same private elements twice on an object");t.set(e,a)}a.d(t,{_:()=>r})},98053:(e,t,a)=>{"use strict";a.d(t,{$v:()=>h,EO:()=>u,Lt:()=>o,Rx:()=>g,Zr:()=>f,ck:()=>x,r7:()=>p,tv:()=>i,wd:()=>m});var r=a(95155);a(12115);var n=a(35646),s=a(64269),l=a(3998);function o(e){let{...t}=e;return(0,r.jsx)(n.bL,{"data-slot":"alert-dialog",...t})}function i(e){let{...t}=e;return(0,r.jsx)(n.l9,{"data-slot":"alert-dialog-trigger",...t})}function c(e){let{...t}=e;return(0,r.jsx)(n.ZL,{"data-slot":"alert-dialog-portal",...t})}function d(e){let{className:t,...a}=e;return(0,r.jsx)(n.hJ,{"data-slot":"alert-dialog-overlay",className:(0,s.cn)("data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50",t),...a})}function u(e){let{className:t,...a}=e;return(0,r.jsxs)(c,{children:[(0,r.jsx)(d,{}),(0,r.jsx)(n.UC,{"data-slot":"alert-dialog-content",className:(0,s.cn)("bg-background data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border p-6 shadow-lg duration-200 sm:max-w-lg",t),...a})]})}function m(e){let{className:t,...a}=e;return(0,r.jsx)("div",{"data-slot":"alert-dialog-header",className:(0,s.cn)("flex flex-col gap-2 text-center sm:text-left",t),...a})}function x(e){let{className:t,...a}=e;return(0,r.jsx)("div",{"data-slot":"alert-dialog-footer",className:(0,s.cn)("flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",t),...a})}function p(e){let{className:t,...a}=e;return(0,r.jsx)(n.hE,{"data-slot":"alert-dialog-title",className:(0,s.cn)("text-lg font-semibold",t),...a})}function h(e){let{className:t,...a}=e;return(0,r.jsx)(n.VY,{"data-slot":"alert-dialog-description",className:(0,s.cn)("text-muted-foreground text-sm",t),...a})}function g(e){let{className:t,...a}=e;return(0,r.jsx)(n.rc,{className:(0,s.cn)((0,l.r)(),t),...a})}function f(e){let{className:t,...a}=e;return(0,r.jsx)(n.ZD,{className:(0,s.cn)((0,l.r)({variant:"outline"}),t),...a})}}},e=>{e.O(0,[187,272,619,870,583,658,924,452,441,493,358],()=>e(e.s=49819)),_N_E=e.O()}]);
|