diff --git a/pyproject.toml b/pyproject.toml
index 40828692..f25fc5f5 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -225,6 +225,9 @@ ignore = [
# Stdlib HTTP handler overrides (do_GET/do_POST) and lazy imports that avoid a
# circular dependency with strix.telemetry / strix.interface.viewer.report_pdf.
"strix/interface/viewer/server.py" = ["N802", "PLC0415"]
+# Lazy import of the TUI live-view projection so importing the viewer does not
+# eagerly pull in the Textual TUI.
+"strix/interface/viewer/transcript.py" = ["PLC0415"]
# Lazy telemetry import to avoid importing PostHog before the viewer starts.
"strix/interface/viewer/cli.py" = ["PLC0415"]
# Lazy imports inside functions to avoid circular dependency with
diff --git a/strix/interface/viewer/frontend/src/components/RunDetails.tsx b/strix/interface/viewer/frontend/src/components/RunDetails.tsx
index 918a185f..83c38dc5 100644
--- a/strix/interface/viewer/frontend/src/components/RunDetails.tsx
+++ b/strix/interface/viewer/frontend/src/components/RunDetails.tsx
@@ -101,7 +101,7 @@ export function RunDetails({
const totalTokens = num(usage.total_tokens);
const cost = num(usage.cost);
const subscription = str(raw.auth_mode) === "subscription";
- const subscriptionProvider = str(raw.subscription_provider) || "ChatGPT";
+ const subscriptionProvider = str(raw.subscription_provider);
const sub = (n: number, word: string) => (
({formatNumber(n)} {word})
@@ -181,7 +181,7 @@ export function RunDetails({
- {subscriptionProvider} subscription
+ {subscriptionProvider ? `${subscriptionProvider} subscription` : "Subscription"}
diff --git a/strix/interface/viewer/static/assets/index-BAP4-Z16.js b/strix/interface/viewer/static/assets/index-CbkcEEWn.js
similarity index 97%
rename from strix/interface/viewer/static/assets/index-BAP4-Z16.js
rename to strix/interface/viewer/static/assets/index-CbkcEEWn.js
index 389f7051..303d91b6 100644
--- a/strix/interface/viewer/static/assets/index-BAP4-Z16.js
+++ b/strix/interface/viewer/static/assets/index-CbkcEEWn.js
@@ -482,6 +482,6 @@ https://github.com/highlightjs/highlight.js/issues/2277`),Ht=ye,ft=Le),Qe===void
... more content available`:"")})})()]})}function x7({args:e,result:t}){const r=(e.method??"GET").toUpperCase(),a=e.url??"",s=e.headers,o=e.body,c=typeof o=="string"?o:"",d=t,h=d?d.error??null:null,f=d?d.status_code??null:null,m=d?d.response_time_ms??null:null,p=d?d.body:null,y=typeof p=="string"?p:null;return g.jsxs("div",{children:[g.jsx("span",{className:"text-purple-400/80 font-semibold text-sm",children:"request"}),g.jsxs("div",{className:"mt-1.5 font-mono text-[13px] space-y-0.5",children:[g.jsxs("div",{children:[g.jsx("span",{className:"text-[#555] select-none mr-1",children:">>"}),g.jsx("span",{className:`font-bold ${tS[r]??"text-[#888]"}`,children:r}),g.jsx("span",{className:"text-[#888] ml-1 break-all",children:Xr(a,180)})]}),s&&typeof s=="object"&&Object.entries(s).slice(0,5).map(([x,_])=>g.jsxs("div",{className:"text-[#555] pl-5",children:[x,": ",pp(String(_),150)]},x))]}),c&&g.jsx(wi,{className:"text-[#888]",children:gp(c,4)}),h&&g.jsx("div",{className:"text-red-400/70 text-[13px] mt-1.5",children:pp(h,150)}),f!=null&&g.jsxs("div",{className:"font-mono text-[13px] mt-1.5",children:[g.jsx("span",{className:"text-[#555] select-none mr-1",children:"<<"}),g.jsx("span",{className:`font-bold ${fg(f)}`,children:f}),m!=null&&g.jsxs("span",{className:"text-[#555] ml-2",children:[m,"ms"]})]}),y&&g.jsx(wi,{className:"text-[#666]",children:gp(y,6)})]})}function y7({args:e,result:t}){const r=e.request_id,a=e.modifications,s=t,o=s?s.status_code??null:null,c=s?s.response_time_ms??null:null,d=s?s.body:null,h=typeof d=="string"?d:null;return g.jsxs("div",{children:[g.jsxs("div",{className:"flex items-center gap-2",children:[g.jsx("span",{className:"text-purple-400/80 font-semibold text-sm",children:"repeating request"}),r!=null&&g.jsxs("span",{className:"text-[#888] text-[13px]",children:["#",r]})]}),a&&typeof a=="object"&&Object.keys(a).length>0&&g.jsx("div",{className:"mt-1.5 font-mono text-[13px] space-y-0.5",children:Object.entries(a).slice(0,5).map(([f,m])=>g.jsxs("div",{children:[g.jsxs("span",{className:"text-orange-400/60",children:[f,":"]})," ",g.jsx("span",{className:"text-[#777]",children:pp(typeof m=="string"?m:JSON.stringify(m),150)})]},f))}),o!=null&&g.jsxs("div",{className:"font-mono text-[13px] mt-1.5",children:[g.jsx("span",{className:"text-[#555] select-none mr-1",children:"<<"}),g.jsx("span",{className:`font-bold ${fg(o)}`,children:o}),c!=null&&g.jsxs("span",{className:"text-[#555] ml-2",children:[c,"ms"]})]}),h&&g.jsx(wi,{className:"text-[#666]",children:gp(h,5)})]})}const v7={get:"getting",list:"listing",create:"creating",update:"updating",delete:"deleting"};function _7({args:e}){const t=e.action??"",r=e.scope_name??"",a=v7[t]??(t||"managing");return g.jsxs("div",{className:"flex items-center gap-2",children:[g.jsxs("span",{className:"text-purple-400/80 font-semibold text-sm",children:[a," proxy scope"]}),r&&g.jsx("span",{className:"text-[#888] text-[13px]",children:Xr(r,50)})]})}function w7({args:e}){const t=e.parent_id;return g.jsxs("div",{className:"flex items-center gap-2",children:[g.jsx("span",{className:"text-purple-400/80 font-semibold text-sm",children:"listing sitemap"}),t&&g.jsxs("span",{className:"text-[#888] text-[13px]",children:["under #",Xr(String(t),20)]})]})}function E7({args:e}){const t=e.entry_id;return g.jsxs("div",{className:"flex items-center gap-2",children:[g.jsx("span",{className:"text-purple-400/80 font-semibold text-sm",children:"viewing sitemap entry"}),t&&g.jsxs("span",{className:"text-[#888] text-[13px]",children:["#",Xr(String(t),20)]})]})}function N7(e){switch(e.toolName){case"list_requests":return g.jsx(g7,{...e});case"view_request":return g.jsx(b7,{...e});case"send_request":return g.jsx(x7,{...e});case"repeat_request":return g.jsx(y7,{...e});case"scope_rules":return g.jsx(_7,{...e});case"list_sitemap":return g.jsx(w7,{...e});case"view_sitemap_entry":return g.jsx(E7,{...e});default:return g.jsx("span",{className:"text-purple-400/80 font-semibold text-sm",children:e.toolName.replace(/_/g," ")})}}function S7({args:e}){const t=e.thought??e.content??"";return t?g.jsxs("div",{children:[g.jsx("span",{className:"text-purple-400/80 font-semibold text-sm",children:"Agent is thinking"}),g.jsx("div",{className:"mt-1.5 italic text-[#888]",children:g.jsx(An,{text:t,maxLines:20})})]}):null}function k7({toolName:e,args:t}){if(e==="create_agent"){const r=t.name??t.agent_name??"",a=t.task??"";return g.jsxs("div",{children:[g.jsxs("div",{className:"flex items-center gap-2",children:[g.jsx("span",{className:"text-cyan-400/80 font-semibold text-sm",children:"spawning"}),r&&g.jsx("span",{className:"text-cyan-400 font-semibold text-sm",children:r})]}),a&&g.jsx("div",{className:"mt-1.5",children:g.jsx(An,{text:a,maxLines:15})})]})}if(e==="agent_finish"){const r=t.result_summary??"",a=t.success,s=t.findings,o=Array.isArray(s)?s:void 0;return g.jsxs("div",{children:[g.jsx("span",{className:`font-semibold text-sm ${a===!1?"text-red-400/80":"text-emerald-400/80"}`,children:a===!1?"Agent failed":"Agent completed"}),r&&g.jsx("div",{className:"mt-1.5",children:g.jsx(An,{text:r,maxLines:20})}),o&&o.length>0&&g.jsx("div",{className:"mt-1.5 space-y-0.5",children:o.map((c,d)=>g.jsxs("div",{className:"text-[13px] text-[#888]",children:[g.jsx("span",{className:"text-red-400/50 mr-1",children:"•"}),typeof c=="string"?c:JSON.stringify(c)]},d))})]})}if(e==="send_message_to_agent"){const r=t.message??"",a=t.target_agent_id??t.agent_id??"";return g.jsxs("div",{children:[g.jsxs("div",{className:"flex items-center gap-2",children:[g.jsx("span",{className:"text-cyan-400/80 font-semibold text-sm",children:"message"}),a&&g.jsxs("span",{className:"text-[#888] text-[13px]",children:["to ",a.slice(0,16)]})]}),r&&g.jsx("div",{className:"mt-1.5",children:g.jsx(An,{text:r,maxLines:20})})]})}if(e==="wait_for_message"){const r=t.reason??"";return g.jsxs("div",{className:"flex items-center gap-2",children:[g.jsx("span",{className:"text-cyan-400/80 font-semibold text-sm",children:"waiting"}),r&&g.jsx("span",{className:"text-[#888] text-[13px] truncate",children:r})]})}if(e==="stop_agent"){const r=t.target_agent_id??"",a=t.cascade!==!1,s=t.reason??"";return g.jsxs("div",{children:[g.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[g.jsx("span",{className:"text-red-400/80 font-semibold text-sm",children:"stopping"}),r&&g.jsx("span",{className:"text-[#888] text-[13px]",children:r.slice(0,16)}),a&&g.jsx("span",{className:"text-[#555] text-[13px] italic",children:"+ descendants"})]}),s&&g.jsx("div",{className:"mt-1.5 text-[#888] text-[13px]",children:s})]})}return e==="view_agent_graph"?g.jsx("span",{className:"text-cyan-400/80 font-semibold text-sm",children:"viewing agents graph"}):g.jsx("span",{className:"text-cyan-400/80 font-semibold text-sm",children:e.replace(/_/g," ")})}function C7({args:e,result:t}){const r=e.query??e.search_query??"",a=t,s=a?a.content??null:null,o=a&&!a.success?a.message??null:null;return g.jsxs("div",{children:[g.jsx("span",{className:"text-amber-400/80 font-semibold text-sm",children:"Searching the web"}),r&&g.jsx("div",{className:"text-[#888] text-[13px] mt-0.5",children:r}),o&&g.jsx("div",{className:"text-red-400/70 text-[13px] mt-1.5",children:o}),s&&g.jsx("div",{className:"mt-2",children:g.jsx(An,{text:s,maxLines:15})})]})}const T7=50,o_=200,c_=25,u_=24,A7=/\x1b(?:[@-Z\\-_]|\[[0-?]*[ -/]*[@-~]|\][^\x07]*\x07)/g,M7=/\.\.\. \[(stdout|stderr|result|output|error) truncated at \d+k? chars\]/g;function O7(e){return e.replace(A7,"")}function jm(e){const t=O7(e);return t.length>o_?t.slice(0,o_-3)+"...":t}function R7(e){return e.replace(M7,"").trim()}function j7(e){const t=e.split(`
`);if(t.length<=T7)return t.map(jm).join(`
`);const r=t.length-c_-u_;return[...t.slice(0,c_).map(jm),`... ${r} lines truncated ...`,...t.slice(-u_).map(jm)].join(`
-`)}function D7({args:e,result:t}){const r=e.action??"",a=e.code??e.script??"",s=t;let o=null;s&&typeof s=="object"?o=typeof s.stdout=="string"?s.stdout:null:typeof s=="string"&&(o=s);const c=r==="new_session"?"new session":r==="close"?"close session":r==="list_sessions"?"list sessions":null,d=o?j7(R7(o)):null;return g.jsxs("div",{children:[g.jsxs("div",{className:"flex items-center gap-2",children:[g.jsx("span",{className:"text-yellow-400/80 font-semibold text-sm",children:"Python"}),c&&g.jsx("span",{className:"text-[#888] text-[13px]",children:c})]}),a&&g.jsx(ug,{code:a,language:"python",collapsible:!0}),d&&g.jsx(wi,{className:"text-[#666]",children:d})]})}function L7({args:e}){const t=e.targets,a=(Array.isArray(t)?t:[]).map(s=>typeof s=="object"&&s?s.original??null:null).filter(Boolean);return g.jsxs("div",{children:[g.jsxs("div",{className:"flex items-center gap-2",children:[g.jsx("span",{className:"text-emerald-400/80 font-semibold text-sm",children:"Starting penetration test"}),a.length===1&&g.jsxs("span",{className:"text-[#888] text-[13px]",children:["on ",a[0]]})]}),a.length>1&&g.jsx("div",{className:"mt-1.5 space-y-0.5",children:a.map((s,o)=>g.jsxs("div",{className:"text-[13px] text-[#888]",children:[g.jsx("span",{className:"text-[#555] mr-1",children:"•"}),s]},o))})]})}function z7({args:e}){const t=e.name??"Unknown Agent",r=e.task??"";return g.jsxs("div",{children:[g.jsxs("div",{className:"flex items-center gap-2",children:[g.jsx("span",{className:"text-[#888] text-[13px]",children:"subagent"}),g.jsx("span",{className:"text-purple-400 font-semibold text-sm",children:t})]}),r&&g.jsx("div",{className:"mt-1.5",children:g.jsx(An,{text:r,maxLines:15})})]})}function I7(e){return e.toolName==="subagent_start_info"?g.jsx(z7,{...e}):g.jsx(L7,{...e})}function B7({args:e}){const t=e.executive_summary??"",r=e.methodology??"",a=e.technical_analysis??"",s=e.recommendations??"";return g.jsxs("div",{className:"space-y-3",children:[g.jsx("span",{className:"text-emerald-400/80 font-semibold text-sm",children:"Penetration test completed"}),t&&g.jsxs("div",{children:[g.jsx("span",{className:"text-emerald-400/60 text-sm font-semibold",children:"Executive Summary"}),g.jsx("div",{className:"mt-1",children:g.jsx(An,{text:t,maxLines:25})})]}),r&&g.jsxs("div",{children:[g.jsx("span",{className:"text-emerald-400/60 text-sm font-semibold",children:"Methodology"}),g.jsx("div",{className:"mt-1",children:g.jsx(An,{text:r,maxLines:25})})]}),a&&g.jsxs("div",{children:[g.jsx("span",{className:"text-emerald-400/60 text-sm font-semibold",children:"Technical Analysis"}),g.jsx("div",{className:"mt-1",children:g.jsx(An,{text:a,maxLines:25})})]}),s&&g.jsxs("div",{children:[g.jsx("span",{className:"text-emerald-400/60 text-sm font-semibold",children:"Recommendations"}),g.jsx("div",{className:"mt-1",children:g.jsx(An,{text:s,maxLines:25})})]}),!t&&!r&&!a&&!s&&g.jsx("div",{className:"text-[#555] text-xs",children:"Generating final report..."})]})}function U7({toolName:e,args:t,result:r}){if(e==="create_note"){const a=t.title??"",s=t.content??"",o=t.category??"general";return g.jsxs("div",{children:[g.jsxs("div",{className:"flex items-center gap-2",children:[g.jsx("span",{className:"text-amber-400/80 font-semibold text-sm",children:"note"}),g.jsxs("span",{className:"text-[#555] text-[13px]",children:["(",o,")"]})]}),a&&g.jsx("div",{className:"mt-1.5 text-[#999] text-[13px]",children:a}),s&&g.jsx("div",{className:"mt-1",children:g.jsx($a,{text:s})})]})}if(e==="delete_note")return g.jsx("span",{className:"text-amber-400/80 font-semibold text-sm",children:"note removed"});if(e==="update_note"){const a=t.title??"",s=t.content??"";return g.jsxs("div",{children:[g.jsx("span",{className:"text-amber-400/80 font-semibold text-sm",children:"note updated"}),a&&g.jsx("div",{className:"mt-1.5 text-[#999] text-[13px]",children:a}),s&&g.jsx("div",{className:"mt-1",children:g.jsx($a,{text:s})})]})}if(e==="get_note"){const a=r,s=a&&typeof a=="object"&&a.success?a.note:void 0;return g.jsxs("div",{children:[g.jsx("span",{className:"text-amber-400/80 font-semibold text-sm",children:"note read"}),s&&g.jsxs(g.Fragment,{children:[g.jsxs("div",{className:"mt-1.5 text-[#999] text-[13px]",children:[s.title??"(untitled)",g.jsxs("span",{className:"text-[#555] ml-1",children:["(",s.category??"general",")"]}),(s.by_you||s.agent_name)&&g.jsxs("span",{className:"text-[#666] ml-1 text-xs",children:["by ",s.by_you?"you":s.agent_name]})]}),s.content&&g.jsx("div",{className:"mt-1",children:g.jsx($a,{text:s.content})})]})]})}if(e==="list_notes"){const a=r;let s=[];if(a&&typeof a=="object"&&a.success){const o=a.notes;s=Array.isArray(o)?o:[]}return g.jsxs("div",{children:[g.jsx("span",{className:"text-amber-400/80 font-semibold text-sm",children:"notes"}),s.length>0?g.jsx("div",{className:"mt-1.5 space-y-0.5",children:s.map((o,c)=>g.jsxs("div",{className:"text-[13px]",children:[g.jsx("span",{className:"text-[#555] mr-1",children:"-"}),g.jsx("span",{className:"text-[#999]",children:o.title??"(untitled)"}),g.jsxs("span",{className:"text-[#555] ml-1",children:["(",o.category??"general",")"]}),(o.by_you||o.agent_name)&&g.jsxs("span",{className:"text-[#666] ml-1 text-xs",children:["by ",o.by_you?"you":o.agent_name]}),o.content&&g.jsx("div",{className:"ml-3",children:g.jsx($a,{text:o.content})})]},c))}):g.jsx("div",{className:"mt-1 text-[#555] text-xs",children:"No notes"})]})}return g.jsx("span",{className:"text-amber-400/80 font-semibold text-sm",children:"note"})}const H7={create_todo:{label:"Task added",Icon:VC},list_todos:{label:"Plan",Icon:Gk},update_todo:{label:"Task updated",Icon:qC},mark_todo_done:{label:"Task completed",Icon:R_},mark_todo_pending:{label:"Task reopened",Icon:eT},delete_todo:{label:"Task removed",Icon:hT}};function $7({status:e}){return e==="done"?g.jsx(R_,{className:"w-3.5 h-3.5 text-emerald-400/70 shrink-0"}):e==="in_progress"?g.jsx(rC,{className:"w-3.5 h-3.5 text-purple-400/70 shrink-0 animate-pulse"}):g.jsx(aC,{className:"w-3.5 h-3.5 text-[#444] shrink-0"})}function q7({todos:e,highlightId:t}){return g.jsx("div",{className:"space-y-0",children:e.map((r,a)=>{const s=r.status??"pending",o=t&&r.id===t;return g.jsxs("div",{className:`flex items-start gap-2.5 py-1.5 px-2 -mx-2 rounded-md transition-colors ${o?"bg-purple-500/[0.08]":""}`,children:[g.jsx("div",{className:"mt-[1px]",children:g.jsx($7,{status:s})}),g.jsx("span",{className:`text-[13px] leading-snug ${s==="done"?"text-[#555] line-through":s==="in_progress"?"text-[#bbb]":"text-[#999]"}`,children:r.title??"(untitled)"})]},r.id??a)})})}function P7({toolName:e,args:t,result:r}){const a=H7[e]??{label:"Plan",Icon:ZC},s=a.Icon,o=r;if(typeof o=="string"&&o.trim())return g.jsxs("div",{children:[g.jsxs("div",{className:"flex items-center gap-2",children:[g.jsx(s,{className:"w-3.5 h-3.5 text-purple-400/60"}),g.jsx("span",{className:"text-purple-400/80 font-semibold text-sm",children:a.label})]}),g.jsx("div",{className:"mt-1.5 text-[#888] text-[13px]",children:o.trim()})]});let c=[],d=null,h;if(o&&typeof o=="object"){if(d=o.error??null,o.success){const m=o.todos;c=Array.isArray(m)?m:[]}h=o.id??t.todo_id??void 0}const f=e!=="list_todos"?h:void 0;return c.length===0&&!d?g.jsxs("div",{className:"flex items-center gap-2",children:[g.jsx(s,{className:"w-3.5 h-3.5 text-purple-400/60"}),g.jsx("span",{className:"text-purple-400/80 font-semibold text-sm",children:a.label})]}):g.jsxs("div",{children:[g.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[g.jsx(s,{className:"w-3.5 h-3.5 text-purple-400/60"}),g.jsx("span",{className:"text-purple-400/80 font-semibold text-sm",children:a.label})]}),d&&g.jsx("div",{className:"text-red-400/70 text-[13px] mb-2",children:d}),c.length>0&&g.jsx("div",{className:"rounded-lg border border-white/[0.06] bg-white/[0.015] px-3 py-2",children:g.jsx(q7,{todos:c,highlightId:f})})]})}function d_(e){if(e==null)return null;if(typeof e=="string")return e.trim()?e:null;if(typeof e=="object"){const t=e;if(typeof t.__raw=="string")return t.__raw;if(Object.keys(t).length===0)return null;try{return JSON.stringify(e,null,2)}catch{return String(e)}}return String(e)}function nS({toolName:e,args:t,result:r}){const a=d_(t),s=d_(r);return g.jsxs("div",{children:[g.jsx("span",{className:"text-[#888] font-semibold text-sm",children:e.replace(/_/g," ")}),a&&g.jsx(wi,{className:"text-[#777]",children:a}),s&&g.jsx(wi,{className:"text-[#666]",children:s})]})}function F7({args:e}){const t=e.skills,r=(Array.isArray(t)?t:String(t??"").split(",")).map(a=>String(a).trim()).filter(Boolean);return g.jsxs("div",{className:"flex items-center gap-2",children:[g.jsx("span",{className:"text-emerald-400/80 font-semibold text-sm",children:"Loading skill"}),r.length>0&&g.jsx("span",{className:"text-[#888] text-[13px]",children:r.join(", ")})]})}const ad={terminal:{renderer:e7,icon:B_,color:"text-emerald-400"},python:{renderer:D7,icon:oC,color:"text-yellow-400"},browser:{renderer:n7,icon:z_,color:"text-blue-400"},filesystem:{renderer:r7,icon:gC,color:"text-sky-400"},proxy:{renderer:N7,icon:T_,color:"text-purple-400",match:/request|sitemap|scope/},reporting:{renderer:h7,icon:iT,color:"text-red-400"},thinking:{renderer:S7,icon:M_,color:"text-purple-400"},agents:{renderer:k7,icon:Ao,color:"text-cyan-400",match:/agent/},search:{renderer:C7,icon:nT,color:"text-amber-400"},lifecycle:{renderer:I7,icon:L_,color:"text-emerald-400"},notes:{renderer:U7,icon:uT,color:"text-amber-400",match:/note/},skills:{renderer:F7,icon:Um,color:"text-emerald-400"},todos:{renderer:P7,icon:jC,color:"text-purple-400",match:/todo/},telemetry:{renderer:nS,icon:Um,color:"text-[#555]"}},G7={terminal:["exec_command","write_stdin","terminal_execute"],python:["python_action"],browser:["browser_action"],filesystem:["apply_patch","view_image","str_replace_editor","list_files","search_files"],proxy:["list_requests","view_request","repeat_request","list_sitemap","view_sitemap_entry","scope_rules","send_request"],reporting:["create_vulnerability_report","list_reports","get_report"],thinking:["think"],agents:["create_agent","agent_finish","send_message_to_agent","wait_for_message","view_agent_graph","stop_agent"],search:["web_search"],lifecycle:["scan_start_info","subagent_start_info","finish_scan"],notes:["create_note","delete_note","update_note","list_notes","get_note"],skills:["load_skill"],todos:["create_todo","list_todos","update_todo","mark_todo_done","mark_todo_pending","delete_todo"],telemetry:["sandbox_error_details","llm_error_details"]},V7=Object.fromEntries(Object.entries(G7).flatMap(([e,t])=>t.map(r=>[r,e]))),Y7={finish_scan:B7,apply_patch:u7,view_image:d7,list_reports:l_,get_report:l_},X7={agent_finish:{icon:L_,color:"text-cyan-400"},send_message_to_agent:{icon:ry,color:"text-cyan-400"},wait_for_message:{icon:ry,color:"text-cyan-400"},view_agent_graph:{icon:mC,color:"text-cyan-400"},stop_agent:{icon:A_,color:"text-red-400"},scan_start_info:{icon:dC,color:"text-emerald-400"},subagent_start_info:{icon:Ao,color:"text-purple-400"},view_image:{icon:AC,color:"text-sky-400"}},K7=ad.telemetry;function rS(e){var r;const t=V7[e];if(t)return t;for(const[a,s]of Object.entries(ad))if((r=s.match)!=null&&r.test(e))return a;return null}function Z7(e){const t=Y7[e];if(t)return t;const r=rS(e);return r?ad[r].renderer:nS}function Q7(e){const t=X7[e];if(t)return t;const r=rS(e),a=r?ad[r]:K7;return{icon:a.icon,color:a.color}}const W7=30;function J7({role:e,content:t}){const r=e==="user"||e==="human";return g.jsxs("div",{children:[g.jsx("span",{className:`font-semibold text-sm ${r?"text-blue-400/80":"text-purple-400/80"}`,children:r?"User":"Thinking"}),g.jsx("div",{className:"mt-1.5 italic text-[#888]",children:g.jsx(An,{text:t,maxLines:W7})})]})}class eU extends ee.Component{constructor(t){super(t),this.state={hasError:!1}}static getDerivedStateFromError(){return{hasError:!0}}render(){return this.state.hasError?g.jsx("span",{className:"text-[#555] font-semibold text-sm",children:this.props.toolName.replace(/_/g," ")}):this.props.children}}function tU(e){const t=Z7(e.toolName);return g.jsx(eU,{toolName:e.toolName,children:g.jsx(t,{...e})})}function iS(e){if(e==null||typeof e!="string")return e;const t=e.trim();if(!t)return e;try{return JSON.parse(t)}catch{}try{const r=t.replace(/\bNone\b/g,"null").replace(/\bTrue\b/g,"true").replace(/\bFalse\b/g,"false").replace(/'/g,'"');return JSON.parse(r)}catch{return{__raw:e}}}function aS(e){const t=iS(e);return t&&typeof t=="object"&&!Array.isArray(t)?t:t==null?{}:{__raw:typeof t=="string"?t:JSON.stringify(t)}}function f_(e){const t=/(\d+)$/.exec(e);return t?parseInt(t[1],10):0}function hg(e){var r;const t=(r=e.data)==null?void 0:r.role;return e.type==="chat"&&(t==="user"||t==="human")}function nU(e){var t;return hg(e)&&String(((t=e.data)==null?void 0:t.content)??"").startsWith("[Message from ")}function rU(e){const t=new Set;let r=!1;for(const a of e)if(hg(a)){if(nU(a)){t.add(a.id);continue}r||(r=!0,t.add(a.id))}return t}const iU={completed:"text-emerald-400 border-emerald-500/30 bg-emerald-500/10",running:"text-blue-400 border-blue-500/30 bg-blue-500/10",waiting:"text-yellow-400 border-yellow-500/30 bg-yellow-500/10",stopped:"text-[#aaa] border-[#333] bg-[#1a1a1a]",crashed:"text-red-400 border-red-500/30 bg-red-500/10",failed:"text-red-400 border-red-500/30 bg-red-500/10"};function aU(e){return e==="completed"?"completed":e==="running"?"running":e==="failed"||e==="crashed"?"failed":e}function sU(e,t){var d;const r=new Map;for(const h of e)if(h.parent_id){const f=r.get(h.parent_id)??[];f.push(h.id),r.set(h.parent_id,f)}const a=new Map,s=new Map,o=new Map;for(const h of t)if(h.type==="tool"){if(a.set(h.agent_id,(a.get(h.agent_id)??0)+1),((d=h.data)==null?void 0:d.tool_name)==="create_agent"){const f=aS(h.data.args),m=f.name??f.agent_name??"",p=f.task??"";m&&p&&o.set(m,p)}}else hg(h)||s.set(h.agent_id,(s.get(h.agent_id)??0)+1);const c=new Map;for(const h of e)c.set(h.id,{id:h.id,name:h.name,task:o.get(h.name)??"",status:aU(h.status),parentId:h.parent_id,children:r.get(h.id)??[],createdAt:h.created_at,toolCount:a.get(h.id)??0,messageCount:s.get(h.id)??0});return c}function lU({agent:e,events:t,showHeader:r=!0}){const a=ee.useMemo(()=>{const c=t.filter(h=>h.agent_id===e.id).sort((h,f)=>f_(h.id)-f_(f.id)),d=rU(c);return c.filter(h=>!d.has(h.id))},[t,e.id]),s=a.filter(c=>c.type==="tool").length,o=a.length-s;return g.jsxs("div",{children:[r&&g.jsxs(g.Fragment,{children:[g.jsxs("div",{className:"flex items-center gap-2 flex-wrap mb-1",children:[g.jsx("span",{className:"text-base font-semibold text-white truncate",children:e.name}),g.jsx("span",{className:`flex-shrink-0 text-xs font-medium capitalize px-2 py-0.5 rounded-full border ${iU[e.status]??"text-[#aaa] border-[#333] bg-[#1a1a1a]"}`,children:e.status}),g.jsx("span",{className:"font-mono text-xs text-[#555]",children:e.id})]}),g.jsxs("p",{className:"text-xs text-[#666] mb-4",children:[o," message",o===1?"":"s"," · ",s," tool call",s===1?"":"s"]})]}),a.length===0?g.jsx("p",{className:"text-sm text-[#666]",children:"No recorded activity for this agent."}):g.jsx("div",{className:"py-1",children:a.map((c,d)=>{var N,S,w,k,E,M;const h=d===a.length-1,f=c.type==="tool",m=f?String(((N=c.data)==null?void 0:N.tool_name)??"tool"):"",p=f?"":String(((S=c.data)==null?void 0:S.role)??"assistant");let y,x;if(f){const I=Q7(m);y=I.icon,x=I.color}else{const I=p==="user"||p==="human";y=I?Ao:M_,x=I?"text-blue-400":"text-purple-400"}const _=f?String(((w=c.data)==null?void 0:w.status)??"completed"):"completed";return g.jsxs("div",{className:"flex gap-3",children:[g.jsxs("div",{className:"flex flex-col items-center shrink-0",children:[g.jsx("div",{className:`w-[30px] h-[30px] rounded-full bg-black border flex items-center justify-center shrink-0 ${f&&_==="running"?"border-blue-500/40 animate-pulse":f&&_==="failed"?"border-red-500/30":"border-[#222]"}`,children:g.jsx(y,{className:`w-3.5 h-3.5 ${x}`})}),!h&&g.jsx("div",{className:"w-px flex-1 bg-[#1a1a1a] mt-1"})]}),g.jsx("div",{className:"flex-1 min-w-0 pt-[5px] pb-6",children:f?g.jsx(tU,{toolName:m,args:aS((k=c.data)==null?void 0:k.args),result:iS((E=c.data)==null?void 0:E.result)??null,status:_}):g.jsx(J7,{role:p,content:String(((M=c.data)==null?void 0:M.content)??"")})})]},c.id)})})]})}class Iu extends Error{constructor(t){super(t),this.name="RunParseError"}}const oU=["critical","high","medium","low"];function cU(e){const t=String(e??"").toLowerCase().trim();return oU.includes(t)?t:"low"}function uU(e){if(typeof e=="string"&&e.trim()){const t=e.trim().replace(" UTC","Z").replace(" ","T"),r=new Date(t);if(!Number.isNaN(r.getTime()))return r.toISOString();const a=new Date(e);if(!Number.isNaN(a.getTime()))return a.toISOString()}return new Date().toISOString()}function Ot(e){return typeof e=="string"&&e.length>0?e:null}function dU(e){return typeof e=="number"&&Number.isFinite(e)?e:null}function sS(e,t){try{return JSON.parse(e)}catch{throw new Iu(`${t} isn't valid JSON. Make sure you selected a Strix run directory.`)}}function fU(e){const t=sS(e,"run.json");if(!t||typeof t!="object"||Array.isArray(t))throw new Iu("run.json is not an object.");const r=t,a=[],s=r.targets_info;if(Array.isArray(s)){for(const x of s)if(x&&typeof x=="object"){const _=x.original;typeof _=="string"&&_&&a.push(_)}}const o=Ot(r.start_time),c=Ot(r.end_time);let d=null;if(o&&c){const x=new Date(o).getTime(),_=new Date(c).getTime();!Number.isNaN(x)&&!Number.isNaN(_)&&_>=x&&(d=Math.round((_-x)/1e3))}let h=null,f=null,m=null,p=null;const y=r.scan_results;if(y&&typeof y=="object"){const x=y;h=Ot(x.executive_summary),f=Ot(x.technical_analysis),m=Ot(x.methodology),p=Ot(x.recommendations)}return{runId:Ot(r.run_id),runName:Ot(r.run_name),targets:a,scanMode:Ot(r.scan_mode),status:Ot(r.status),startTime:o,endTime:c,durationSeconds:d,executiveSummary:h,technicalAnalysis:f,methodology:m,recommendations:p}}function hU(){return{pr_review_id:null,cve:null,cvss:null,potential_risk_saving:null,risk_saving_description:null,impact:null,endpoint:null,method:null,target:null,technical_analysis:null,poc_description:null,poc_script_code:null,code_diff:null,code_file:null,code_before:null,code_after:null,cwe:null,code_locations:null,remediation_steps:null,fix_pr_body:null,evidence:null,assumptions:null,fix_effort:null,cvss_breakdown:null,status_changed_at:null,status_changed_by:null,status_note:null,snoozed_until:null,reopened_at:null,reopened_by:null,original_severity:null,severity_changed_at:null,severity_changed_by:null,severity_override_reason:null,retest_of_vulnerability_id:null}}function mU(e,t,r){const a=e.cwe,s=typeof a=="string"&&a.trim()?[a.trim()]:Array.isArray(a)?a.filter(c=>typeof c=="string"&&c):null;return{...hU(),id:Ot(e.id)??`vuln-${t+1}`,scan_id:r,title:Ot(e.title)??"Untitled finding",description:Ot(e.description)??"",severity:cU(e.severity),status:"open",created_at:uU(e.timestamp),cve:Ot(e.cve),cvss:dU(e.cvss),impact:Ot(e.impact),endpoint:Ot(e.endpoint),method:Ot(e.method),target:Ot(e.target),technical_analysis:Ot(e.technical_analysis),poc_description:Ot(e.poc_description),poc_script_code:Ot(e.poc_script_code),cwe:s,code_locations:Array.isArray(e.code_locations)?e.code_locations:null,remediation_steps:Ot(e.remediation_steps),fix_pr_body:Ot(e.fix_pr_body),evidence:Ot(e.evidence),assumptions:Ot(e.assumptions),fix_effort:Ot(e.fix_effort)??null,cvss_breakdown:e.cvss_breakdown??null}}function pU(e,t=null){const r=sS(e,"vulnerabilities.json");if(!Array.isArray(r))throw new Iu("vulnerabilities.json is not a JSON array.");return r.map((a,s)=>{if(!a||typeof a!="object")throw new Iu(`vulnerabilities.json entry #${s+1} is not an object.`);return mU(a,s,t)})}function gU(e){const t={critical:0,high:0,medium:0,low:0};for(const r of e)t[r.severity]+=1;return t}async function Ja(e){const t=await fetch(e,{cache:"no-store"});if(!t.ok)throw new Error(`${e} responded ${t.status}`);return t.json()}function sd(e){return e?`?run=${encodeURIComponent(e)}`:""}async function lS(e){const t=await Ja("/api/run"+sd(e)),r=fU(JSON.stringify(t)),a=t.finished===!0;return{summary:r,raw:t,finished:a}}async function oS(e,t){const r=await Ja("/api/vulnerabilities"+sd(t));return pU(JSON.stringify(r),e)}async function bU(e){const t=await Ja("/api/report"+sd(e));return(t==null?void 0:t.markdown)??null}async function cS(e){const t=await Ja("/api/transcript"+sd(e));return{agents:Array.isArray(t==null?void 0:t.agents)?t.agents:[],events:Array.isArray(t==null?void 0:t.events)?t.events:[]}}async function h_(e){const{summary:t,raw:r,finished:a}=await lS(e),[s,o,c]=await Promise.all([oS(t.runId,e).catch(()=>[]),bU(e).catch(()=>null),cS(e).catch(()=>({agents:[],events:[]}))]);return{summary:t,raw:r,finished:a,vulnerabilities:s,reportMarkdown:o,transcript:c}}async function rl(e,t){const r=await fetch(e,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t),cache:"no-store"});let a={};try{const s=await r.json();s&&typeof s=="object"&&(a=s)}catch{}return{ok:r.ok,status:r.status,data:a}}async function xU(){const e=await Ja("/api/runs");return{locked:(e==null?void 0:e.locked)??!0,count:typeof(e==null?void 0:e.count)=="number"?e.count:0,runs:Array.isArray(e==null?void 0:e.runs)?e.runs:[]}}async function yU(){const e=await Ja("/api/capabilities");return{can_steer:(e==null?void 0:e.can_steer)===!0}}async function vU(e,t){const{ok:r,data:a}=await rl("/api/agents/steer",{agent_id:e,message:t});return r&&a.ok===!0?{ok:!0}:{ok:!1,error:String(a.error??"unavailable")}}async function _U(e,t){const{ok:r,data:a}=await rl("/api/feedback",{message:e,email:t});return r&&a.ok===!0?{ok:!0}:{ok:!1,error:String(a.error??"unavailable")}}async function wU(){const e=await Ja("/api/auth/status");return{verified:(e==null?void 0:e.verified)===!0,email:(e==null?void 0:e.email)??null}}async function uS(e){const{ok:t,data:r}=await rl("/api/auth/otp/start",{email:e});return t&&r.ok===!0?{ok:!0}:{ok:!1,error:String(r.error??"unavailable")}}async function dS(e,t){const{ok:r,data:a}=await rl("/api/auth/otp/verify",{email:e,code:t});return r&&a.verified===!0?{verified:!0,email:String(a.email??e)}:{verified:!1,error:String(a.error??"invalid_code")}}async function EU(){await rl("/api/auth/forget",{})}async function NU(e){const{ok:t,data:r}=await rl("/api/report/send",e?{run:e}:{});return t&&r.ok===!0?{ok:!0,password:String(r.password??""),filename:String(r.filename??"strix-report.pdf")}:{ok:!1,error:String(r.error??"unavailable")}}const Bs="__root__";function fS({agents:e,fixedAgentId:t,className:r}){const a=ee.useRef(null),[s,o]=ee.useState(!1),[c,d]=ee.useState(!1),[h,f]=ee.useState(""),[m,p]=ee.useState(!1),[y,x]=ee.useState(null),_=t!=null,N=ee.useMemo(()=>e.find(z=>!z.parent_id)??e[0]??null,[e]),S=ee.useMemo(()=>e.filter(z=>z.parent_id&&z.status==="running"),[e]),[w,k]=ee.useState(Bs),[E,M]=ee.useState(!1);ee.useEffect(()=>{w!==Bs&&!S.some(z=>z.id===w)&&k(Bs)},[w,S]);const{targetId:I,targetName:R}=ee.useMemo(()=>{if(_){const G=e.find(V=>V.id===t)??null;return{targetId:t??null,targetName:(G==null?void 0:G.name)??"this agent"}}if(w===Bs)return{targetId:(N==null?void 0:N.id)??null,targetName:"Root agent"};const z=e.find(G=>G.id===w)??null;return{targetId:(z==null?void 0:z.id)??(N==null?void 0:N.id)??null,targetName:(z==null?void 0:z.name)??"Root agent"}},[e,t,_,N,w]),$=h.trim().length===0;ee.useLayoutEffect(()=>{const z=a.current;z&&(z.style.height="auto",z.style.height=`${z.scrollHeight}px`)},[h]);const B=ee.useCallback(()=>{o(!0),requestAnimationFrame(()=>{var z;return(z=a.current)==null?void 0:z.focus()})},[]),Z=ee.useCallback(()=>{o(!1),d(!1),M(!1)},[]),j=ee.useCallback(async()=>{if(m)return;const z=h.trim();if(!z||!I)return;p(!0),x(null);const G=R,V=await vU(I,z);p(!1),V.ok?(f(""),x(`Sent to ${G}`),Tr("agent_steered")):V.error==="not_delivered"?x("Could not reach that agent (it may have finished)."):x("Could not send that message. Try again.")},[m,h,I,R]);return s?g.jsxs("div",{className:Mr("mt-4 rounded-2xl border border-white/[0.08] bg-[#050505] overflow-hidden transition-colors duration-300",c?"border-white/[0.18]":"hover:border-white/[0.12]",r),children:[g.jsxs("div",{className:"flex items-center justify-between gap-3 border-b border-white/[0.06] px-5 py-3",children:[g.jsxs("div",{className:"min-w-0",children:[g.jsxs("div",{className:"flex items-center gap-2",children:[g.jsx(Bm,{className:"h-4 w-4 text-[#666]"}),g.jsx("p",{className:"text-sm font-medium text-white",children:"Live prompt"})]}),g.jsx("p",{className:"mt-0.5 text-xs text-[#777]",children:"Connected"})]}),g.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[_?g.jsxs("div",{className:"rounded-full border border-white/[0.08] bg-white/[0.03] px-3 py-1 text-xs text-[#aaa]",children:["Target: ",g.jsx("span",{className:"text-white",children:R})]}):g.jsxs("div",{className:"flex items-center gap-1.5",children:[g.jsx("span",{className:"text-xs text-[#aaa]",children:"Target:"}),g.jsxs("div",{className:"relative",children:[g.jsxs("button",{type:"button",onClick:()=>M(z=>!z),onBlur:()=>requestAnimationFrame(()=>M(!1)),className:"inline-flex h-7 items-center gap-1 rounded-full border border-white/[0.08] bg-white/[0.03] px-3 text-xs text-white transition-colors hover:border-white/[0.16] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-white/20","aria-haspopup":"listbox","aria-expanded":E,children:[g.jsx("span",{className:"max-w-[140px] truncate",children:R}),g.jsx(ho,{className:"h-3.5 w-3.5 text-[#999]"})]}),E&&g.jsxs("div",{className:"absolute right-0 z-10 mt-1 min-w-[160px] overflow-hidden rounded-lg border border-[#333] bg-[#0a0a0a] py-1 shadow-xl",role:"listbox",children:[g.jsx(m_,{label:"Root agent",active:w===Bs,onSelect:()=>{k(Bs),M(!1)}}),S.map(z=>g.jsx(m_,{label:z.name,active:w===z.id,onSelect:()=>{k(z.id),M(!1)}},z.id))]})]})]}),g.jsx("button",{type:"button",onClick:Z,className:"inline-flex h-7 w-7 items-center justify-center rounded-full text-[#777] transition-colors hover:bg-white/[0.06] hover:text-white focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-white/20","aria-label":"Collapse live prompt composer",children:g.jsx(ho,{className:"h-4 w-4"})})]})]}),g.jsx("div",{className:"px-5 pt-4 pb-3",children:g.jsx("textarea",{ref:a,rows:1,value:h,onChange:z=>f(z.target.value),onFocus:()=>d(!0),onBlur:()=>d(!1),onKeyDown:z=>{z.key==="Enter"&&!z.shiftKey&&(z.preventDefault(),j())},placeholder:"Send a live prompt to the running pentest…",maxLength:4e3,disabled:m,className:"block w-full resize-none border-0 bg-transparent p-0 text-[15px] leading-6 text-white placeholder:text-[#444] focus:outline-none disabled:opacity-60 max-h-[160px] overflow-y-auto"})}),g.jsxs("div",{className:"flex items-center justify-between gap-3 px-4 pb-4",children:[g.jsx("div",{className:"text-xs text-[#666]",children:y??"Press Enter to send."}),g.jsxs("button",{type:"button",onClick:z=>{z.stopPropagation(),j()},disabled:m||$,className:Mr("inline-flex h-10 min-w-[112px] items-center justify-center gap-2 rounded-full px-4 text-sm font-medium transition-colors",m||$?"bg-white/[0.08] text-[#666]":"bg-white text-black hover:bg-neutral-200"),children:[m?g.jsx(qs,{className:"h-4 w-4 animate-spin"}):g.jsx(zk,{className:"h-4 w-4",strokeWidth:2.5}),g.jsx("span",{children:"Send prompt"})]})]})]}):g.jsxs("button",{type:"button",onClick:B,className:Mr("mt-4 flex w-full items-center justify-between gap-3 rounded-2xl border border-white/[0.08] bg-[#050505] px-5 py-3 text-left transition-colors duration-300 hover:border-white/[0.12] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-white/20",r),"aria-expanded":!1,"aria-label":"Expand live prompt composer",children:[g.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[g.jsx(Bm,{className:"h-4 w-4 shrink-0 text-[#666]"}),g.jsx("span",{className:"truncate text-sm font-medium text-white",children:"Guide the agent"})]}),g.jsx(O_,{className:"h-4 w-4 shrink-0 text-[#777]"})]})}function m_({label:e,active:t,onSelect:r}){return g.jsx("button",{type:"button",role:"option","aria-selected":t,onMouseDown:a=>{a.preventDefault(),r()},className:Mr("block w-full truncate px-3 py-1.5 text-left text-xs transition-colors hover:bg-white/[0.06]",t?"text-white":"text-[#aaa]"),children:e})}const SU={completed:"bg-emerald-400",running:"bg-blue-400",waiting:"bg-yellow-400",stopped:"bg-[#888]",crashed:"bg-red-400",failed:"bg-red-400"},kU=80;function CU({open:e,agent:t,events:r,steerable:a,onClose:s}){const o=ee.useRef(null),c=ee.useRef(!1),[d,h]=ee.useState(e),[f,m]=ee.useState(e?"open":"closed"),[p,y]=ee.useState(!1),x=ee.useRef(t);ee.useEffect(()=>{t&&(x.current=t)},[t]);const _=t??x.current;ee.useEffect(()=>{if(e){h(!0),m("open");return}m("closed");const S=setTimeout(()=>h(!1),140);return()=>clearTimeout(S)},[e]),ee.useEffect(()=>{if(!d){y(!1);return}const S=requestAnimationFrame(()=>y(!0));return()=>cancelAnimationFrame(S)},[d]);const N=ee.useCallback(()=>{const S=o.current;S&&(c.current=S.scrollHeight-S.scrollTop-S.clientHeight{const S=o.current;!S||!c.current||requestAnimationFrame(()=>{S.scrollTo({top:S.scrollHeight,behavior:"smooth"})})},[r]),ee.useEffect(()=>{if(!d)return;const S=k=>{k.key==="Escape"&&s()};document.addEventListener("keydown",S);const w=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.removeEventListener("keydown",S),document.body.style.overflow=w}},[d,s]),!d||!_?null:g.jsx("div",{"data-state":f,className:"agent-modal fixed inset-0 z-50 flex items-center justify-center bg-black/80 p-4 sm:p-8",onClick:s,role:"dialog","aria-modal":"true","aria-label":`Agent ${_.name}`,children:g.jsxs("div",{className:"relative flex h-[60vh] w-[calc(100vw-4rem)] max-w-6xl flex-col overflow-hidden rounded-xl border border-[#222] bg-[#0a0a0a] shadow-2xl",onClick:S=>S.stopPropagation(),children:[g.jsxs("div",{className:"flex items-center justify-between gap-3 border-b border-[#222] px-5 py-3.5",children:[g.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[g.jsx("span",{className:`h-2 w-2 flex-shrink-0 rounded-full ${SU[_.status]??"bg-[#888]"}`}),g.jsx("span",{className:"truncate text-sm font-semibold text-white",children:_.name}),g.jsx("span",{className:"flex-shrink-0 font-mono text-xs text-[#555]",children:_.id})]}),g.jsx("button",{type:"button",onClick:s,"aria-label":"Close",className:"flex-shrink-0 rounded-md p-1 text-[#888] transition-colors hover:bg-[#1a1a1a] hover:text-white",children:g.jsx(yp,{className:"h-4 w-4"})})]}),g.jsx("div",{ref:o,onScroll:N,className:"flex-1 overflow-y-auto p-5",children:p&&g.jsx(lU,{agent:_,events:r,showHeader:!1})}),a&&g.jsx("div",{className:"border-t border-[#222] px-5 py-3",children:g.jsx(fS,{agents:[_],fixedAgentId:_.id,className:"mt-0"})})]})})}var hS={color:void 0,size:void 0,className:void 0,style:void 0,attr:void 0},p_=ua.createContext&&ua.createContext(hS),TU=["attr","size","title"];function AU(e,t){if(e==null)return{};var r,a,s=MU(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(a=0;aua.createElement(t.tag,Uu({key:r},t.attr),mS(t.child)))}function mg(e){return t=>ua.createElement(DU,Bu({attr:Uu({},e.attr)},t),mS(e.child))}function DU(e){var t=r=>{var a=e.attr,s=e.size,o=e.title,c=AU(e,TU),d=s||r.size||"1em",h;return r.className&&(h=r.className),e.className&&(h=(h?h+" ":"")+e.className),ua.createElement("svg",Bu({stroke:"currentColor",fill:"currentColor",strokeWidth:"0"},r.attr,a,c,{className:h,style:Uu(Uu({color:e.color||r.color},r.style),e.style),height:d,width:d,xmlns:"http://www.w3.org/2000/svg"}),o&&ua.createElement("title",null,o),e.children)};return p_!==void 0?ua.createElement(p_.Consumer,null,r=>t(r)):t(hS)}function LU(e){return mg({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"circle",attr:{cx:"5",cy:"6",r:"3"},child:[]},{tag:"path",attr:{d:"M5 9v12"},child:[]},{tag:"circle",attr:{cx:"19",cy:"18",r:"3"},child:[]},{tag:"path",attr:{d:"m15 9-3-3 3-3"},child:[]},{tag:"path",attr:{d:"M12 6h5a2 2 0 0 1 2 2v7"},child:[]}]})(e)}function zU(e){return mg({attr:{viewBox:"0 0 16 16",fill:"currentColor"},child:[{tag:"path",attr:{d:"M15 4.95703C15 4.58711 14.8563 4.24054 14.5949 3.97992L12.0096 1.39234C11.4879 0.86922 10.5788 0.86922 10.0571 1.39234L8 3.45119V3.32321C8 2.55068 7.37187 1.922 6.6 1.922H2.4C1.62813 1.922 1 2.55068 1 3.32321V13.5988C1 14.3713 1.62813 15 2.4 15H12.6667C13.4385 15 14.0667 14.3713 14.0667 13.5988V9.39514C14.0667 8.62261 13.4385 7.99393 12.6667 7.99393H12.5379L14.5949 5.93508C14.8553 5.67445 15 5.32602 15 4.95703ZM2.4 2.85521H6.6C6.85667 2.85521 7.06667 3.06446 7.06667 3.32228V7.99299H1.93333V3.32228C1.93333 3.06446 2.14333 2.85521 2.4 2.85521ZM1.93333 13.5979V8.92714H7.06667V14.0649H2.4C2.14333 14.0649 1.93333 13.8547 1.93333 13.5979ZM13.1333 9.39421V13.5979C13.1333 13.8547 12.9233 14.0649 12.6667 14.0649H8V8.92714H12.6667C12.9233 8.92714 13.1333 9.13638 13.1333 9.39421ZM8 7.99299V6.46287L9.5288 7.99299H8ZM13.9351 5.2737L11.3488 7.86221C11.1789 8.03223 10.8859 8.03223 10.716 7.86221L8.12973 5.2737C8.0448 5.18963 7.99813 5.07753 7.99813 4.95796C7.99813 4.83839 8.0448 4.7263 8.12973 4.64129L10.716 2.05278C10.8009 1.96777 10.9129 1.92106 11.0324 1.92106C11.1519 1.92106 11.2639 1.96777 11.3488 2.05278L13.9351 4.64129C14.02 4.72536 14.0667 4.83746 14.0667 4.95703C14.0667 5.0766 14.02 5.1887 13.9351 5.2737Z"},child:[]}]})(e)}function pS(e){return mg({attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{fill:"none",strokeLinecap:"round",strokeMiterlimit:"10",strokeWidth:"32",d:"M431 320.6c-1-3.6 1.2-8.6 3.3-12.2a34 34 0 0 1 2.1-3.1A162 162 0 0 0 464 215c.3-92.2-77.5-167-173.7-167-83.9 0-153.9 57.1-170.3 132.9a160.7 160.7 0 0 0-3.7 34.2c0 92.3 74.8 169.1 171 169.1 15.3 0 35.9-4.6 47.2-7.7s22.5-7.2 25.4-8.3a26.4 26.4 0 0 1 9.3-1.7 26 26 0 0 1 10.1 2l56.7 20.1a13.5 13.5 0 0 0 3.9 1 8 8 0 0 0 8-8 13 13 0 0 0-.5-2.7z"},child:[]},{tag:"path",attr:{fill:"none",strokeLinecap:"round",strokeMiterlimit:"10",strokeWidth:"32",d:"M66.46 232a146.23 146.23 0 0 0 6.39 152.67c2.31 3.49 3.61 6.19 3.21 8s-11.93 61.87-11.93 61.87a8 8 0 0 0 2.71 7.68A8.17 8.17 0 0 0 72 464a7.3 7.3 0 0 0 2.91-.6l56.21-22a15.7 15.7 0 0 1 12 .2c18.94 7.38 39.88 12 60.83 12A159.2 159.2 0 0 0 284 432.11"},child:[]}]})(e)}const IU=[{icon:_C,label:"PR security reviews"},{icon:lT,label:"Attack surface monitoring"},{icon:ET,label:"Real-time threat intelligence"},{icon:Pk,label:"Scheduled pentesting"},{icon:yT,label:"One-click autofix"},{icon:FC,label:"Jira, Linear & Slack integrations"}];function BU({open:e,onClose:t,description:r,source:a="sidebar"}){const[s,o]=ee.useState(e),[c,d]=ee.useState(e?"open":"closed");return ee.useEffect(()=>{if(e){o(!0),d("open");return}d("closed");const h=setTimeout(()=>o(!1),200);return()=>clearTimeout(h)},[e]),ee.useEffect(()=>{if(!s)return;const h=m=>{m.key==="Escape"&&t()};document.addEventListener("keydown",h);const f=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.removeEventListener("keydown",h),document.body.style.overflow=f}},[s,t]),s?g.jsx("div",{"data-state":c,className:"dialog-overlay fixed inset-0 z-50 flex items-center justify-center bg-black/80 p-4",onClick:t,role:"dialog","aria-modal":"true","aria-label":"Upgrade your plan",children:g.jsxs("div",{"data-state":c,className:"dialog-panel relative w-full max-w-md rounded-2xl border border-[#222] bg-black p-6 shadow-lg sm:rounded-lg",onClick:h=>h.stopPropagation(),children:[g.jsx("button",{type:"button",onClick:t,"aria-label":"Close",className:"absolute right-4 top-4 rounded-md p-1 text-[#888] transition-colors hover:bg-[#1a1a1a] hover:text-white",children:g.jsx(yp,{className:"h-4 w-4"})}),g.jsxs("div",{children:[g.jsx("h2",{className:"text-lg text-white",children:"Available in Strix Cloud"}),r&&g.jsx("p",{className:"mt-2 text-base leading-relaxed text-[#e5e5e5]",children:r})]}),g.jsxs("div",{className:"space-y-4 pt-4",children:[g.jsxs("div",{className:"rounded-xl border border-[#333] bg-[#0a0a0a] p-4 sm:rounded-lg",children:[g.jsxs("div",{className:"mb-3 flex items-center gap-2",children:[g.jsx(Bm,{className:"h-4 w-4 text-blue-400"}),g.jsx("span",{className:"text-sm font-medium text-white",children:"Strix Cloud also includes"})]}),g.jsx("ul",{className:"space-y-2 text-sm text-[#888]",children:IU.map(h=>g.jsxs("li",{className:"flex items-center gap-2",children:[g.jsx(h.icon,{className:"h-3.5 w-3.5 text-[#555]"}),h.label]},h.label))})]}),g.jsxs("div",{className:"flex flex-col gap-2",children:[g.jsxs("a",{href:fa($u,"upgrade_try_free"),target:"_blank",rel:"noopener noreferrer",onClick:()=>jr("upgrade_try_free",a),className:"flex h-10 w-full items-center justify-center gap-2 rounded-lg bg-white px-4 text-sm font-semibold text-black transition-colors hover:bg-neutral-200",children:["Open Strix Cloud",g.jsx(ny,{className:"h-3.5 w-3.5"})]}),g.jsxs("a",{href:fa(TT,"upgrade_view_plans"),target:"_blank",rel:"noopener noreferrer",onClick:()=>jr("upgrade_view_plans",a),className:"flex h-9 w-full items-center justify-center gap-1.5 rounded-lg border border-[#333] px-4 text-sm font-medium text-[#888] transition-colors hover:border-[#555] hover:text-white",children:["Learn more",g.jsx(ny,{className:"h-3 w-3"})]})]})]})]})}):null}const Dm=160,Lm=260,ro=400,UU=140,b_="strix_viewer_sidebar_width",x_="strix_viewer_sidebar_collapsed";function HU(e,t){try{const r=localStorage.getItem(e),a=r?parseInt(r,10):NaN;return Number.isFinite(a)?a:t}catch{return t}}function $U({view:e,onSelectView:t,issuesCount:r,agentCount:a,runCount:s,finished:o,verified:c,email:d,onOpenEmail:h,onOpenHistory:f,onForget:m}){var z;const[p,y]=ee.useState(()=>{const G=HU(b_,Lm);return Math.min(ro,Math.max(Dm,G))}),[x,_]=ee.useState(()=>{try{return localStorage.getItem(x_)==="1"}catch{return!1}}),[N,S]=ee.useState(!1),[w,k]=ee.useState(!1),[E,M]=ee.useState(null),I=ee.useRef(null),R=(G,V)=>{jr(G,"sidebar"),M(V)},$=ee.useCallback(G=>{y(G);try{localStorage.setItem(b_,String(G))}catch{}},[]),B=ee.useCallback(G=>{_(G);try{localStorage.setItem(x_,G?"1":"0")}catch{}},[]),Z=ee.useCallback(()=>{B(!1),$(Lm)},[B,$]),j=ee.useCallback(G=>{G.preventDefault(),S(!0)},[]);return ee.useEffect(()=>{if(!N||x)return;const G=T=>{const U=T.clientX;U>=Dm&&U<=ro?y(U):U>ro&&y(ro)},V=T=>{const U=T.clientX;U{window.removeEventListener("mousemove",G),window.removeEventListener("mouseup",V)}},[N,x,B,$]),ee.useEffect(()=>{if(!w)return;const G=V=>{I.current&&!I.current.contains(V.target)&&k(!1)};return document.addEventListener("mousedown",G),()=>document.removeEventListener("mousedown",G)},[w]),g.jsxs(g.Fragment,{children:[x&&g.jsx("div",{className:"fixed left-0 top-0 z-40 hidden h-full w-4 cursor-pointer transition-colors hover:bg-[rgba(255,255,255,0.08)] lg:block",onClick:Z,title:"Expand sidebar"}),g.jsxs("aside",{className:Mr("sticky top-0 z-20 hidden h-screen flex-shrink-0 flex-col overflow-hidden border-r border-[rgba(255,255,255,0.08)] bg-black lg:flex",!N&&"transition-[width] duration-200 ease-out"),style:{width:x?0:p},children:[g.jsx("header",{className:"relative flex flex-col gap-1 pt-1 min-w-[160px]",children:g.jsx("div",{className:"flex flex-row py-1 px-2",children:g.jsxs("div",{className:"flex h-10 w-full flex-row items-center",children:[g.jsxs("a",{href:fa("https://app.strix.ai","logo"),target:"_blank",rel:"noopener noreferrer",onClick:()=>jr("logo","sidebar"),className:"flex flex-1 flex-row items-center gap-2 rounded-md py-2 pl-2.5 pr-1 min-w-0 transition-colors hover:bg-[rgba(255,255,255,0.06)]",title:"Open Strix Cloud",children:[g.jsx("span",{className:"flex flex-shrink-0 items-center justify-center rounded-full bg-gradient-to-br from-emerald-400 to-cyan-500",style:{width:20,height:20},children:g.jsx("span",{className:"text-[10px] font-semibold text-white",children:"S"})}),g.jsxs("span",{className:"flex flex-1 flex-row items-center gap-2 min-w-0",children:[g.jsx("span",{className:"truncate min-w-0 text-[14px] font-medium text-[#ededed]",children:"Strix"}),g.jsx("span",{className:"flex h-5 flex-shrink-0 items-center rounded px-2 text-[11px] font-medium text-[#888] bg-[rgba(255,255,255,0.08)]",children:"Local"})]})]}),g.jsx("a",{href:fa("https://app.strix.ai","logo"),target:"_blank",rel:"noopener noreferrer",onClick:()=>jr("logo","sidebar"),className:"flex flex-none items-center rounded-md px-1.5 py-2 transition-colors hover:bg-[rgba(255,255,255,0.06)]","aria-label":"Open Strix Cloud",children:g.jsx(Wk,{className:"h-4 w-4 text-[#666]"})})]})})}),g.jsx("nav",{className:"relative min-w-[160px] flex-1 overflow-y-auto overflow-x-clip scrollbar-thin pb-10 pt-2",children:g.jsxs("div",{className:"relative flex flex-col gap-px px-2",children:[g.jsx(yi,{icon:g.jsx(qU,{}),label:"Pentest Overview",active:e==="overview",onClick:()=>t("overview")}),g.jsx(yi,{icon:g.jsx(pT,{className:"h-4 w-4"}),label:"Issues",count:r>0?r:void 0,active:e==="issues",onClick:()=>t("issues")}),a>0&&g.jsx(yi,{icon:g.jsx(Ao,{className:"h-4 w-4"}),label:"Agents",count:a,active:e==="agents",onClick:()=>t("agents")}),g.jsx(yi,{icon:g.jsx(Vs,{className:"h-4 w-4"}),label:"Past runs",count:s>0?s:void 0,active:e==="history",onClick:f}),o&&g.jsx(yi,{icon:g.jsx(xp,{className:"h-4 w-4"}),label:"Export report",active:e==="email",onClick:h}),g.jsx(yi,{icon:g.jsx(pS,{className:"h-4 w-4"}),label:"Feedback & support",active:e==="feedback",onClick:()=>t("feedback")}),g.jsx("hr",{className:"mx-0 my-1 h-px w-full border-0 bg-[rgba(255,255,255,0.08)]"}),g.jsx(yi,{icon:g.jsx(LU,{className:"h-4 w-4"}),label:"PR Security Reviews",active:!1,onClick:()=>R("pr_reviews","Strix reviews every pull request and flags exploitable changes before they merge.")}),g.jsx(yi,{icon:g.jsx(zU,{className:"h-4 w-4"}),label:"Integrations",active:!1,onClick:()=>R("integrations","Sync findings to Jira, Linear, and Slack so fixes happen where your team already works.")}),g.jsx(yi,{icon:g.jsx(bT,{className:"h-4 w-4"}),label:"Members",active:!1,onClick:()=>R("members","Invite your team, set roles, and share findings and run history across your org.")})]})}),g.jsx("section",{className:"flex min-w-[160px] flex-col gap-0.5",ref:I,children:g.jsxs("div",{className:"relative p-2",children:[c&&d?g.jsxs("button",{onClick:()=>k(G=>!G),className:"relative flex w-full cursor-pointer items-center gap-2 rounded-md bg-transparent px-2.5 py-2 transition-colors hover:bg-[rgba(255,255,255,0.06)]",children:[g.jsx("span",{className:"flex flex-shrink-0 items-center justify-center rounded-full bg-gradient-to-br from-emerald-400 to-cyan-500",style:{width:20,height:20},children:g.jsx("span",{className:"text-[9px] font-semibold text-white",children:((z=d[0])==null?void 0:z.toUpperCase())||"U"})}),g.jsxs("span",{className:"flex min-w-0 flex-1 flex-col text-left",children:[g.jsx("span",{className:"truncate text-[13px] font-medium text-[#ededed]",children:d}),g.jsx("span",{className:"truncate text-[11px] text-[#555]",children:"Linked to this machine"})]})]}):g.jsxs("div",{className:"flex items-center gap-2 rounded-md px-2.5 py-2",children:[g.jsx("span",{className:"flex flex-shrink-0 items-center justify-center rounded-full bg-gradient-to-br from-emerald-400 to-cyan-500",style:{width:20,height:20},children:g.jsx("span",{className:"text-[9px] font-semibold text-white",children:"S"})}),g.jsx("span",{className:"flex min-w-0 flex-1 flex-col text-left",children:g.jsx("span",{className:"truncate text-[13px] font-medium text-[#ededed]",children:"Local viewer"})})]}),w&&c&&d&&g.jsxs("div",{className:"absolute bottom-full left-2 right-2 z-50 mb-1 overflow-hidden rounded-lg border border-[#333] bg-black shadow-xl",children:[g.jsxs("div",{className:"border-b border-[#333] px-3 py-2",children:[g.jsx("p",{className:"truncate text-[13px] font-medium text-white",children:"Linked email"}),g.jsx("p",{className:"truncate text-[11px] text-[#666]",children:d})]}),g.jsxs("button",{onClick:()=>{k(!1),m()},className:"flex w-full items-center gap-2 px-3 py-2 text-[13px] text-[#888] transition-colors hover:bg-[rgba(255,255,255,0.06)] hover:text-red-400",children:[g.jsx(BC,{className:"h-4 w-4"}),"Forget this email"]})]})]})}),g.jsx("div",{className:"group absolute right-0 top-0 z-30 h-full w-1 cursor-col-resize",onMouseDown:j,children:g.jsx("div",{className:Mr("absolute right-0 top-0 h-full w-px bg-[rgba(255,255,255,0.08)] transition-all duration-100",N?"w-0.5 bg-[rgba(255,255,255,0.3)]":"group-hover:bg-[rgba(255,255,255,0.2)]")})})]}),N&&g.jsx("div",{className:"fixed inset-0 z-10 cursor-col-resize"}),g.jsx(BU,{open:E!==null,description:E??"",source:"sidebar",onClose:()=>M(null)})]})}function yi({icon:e,label:t,active:r,onClick:a,count:s}){return g.jsxs("button",{onClick:a,className:Mr("group flex h-9 w-full origin-left flex-row items-center rounded-md transition-colors",r?"bg-[rgba(255,255,255,0.12)] text-white":"text-[#888] hover:bg-[rgba(255,255,255,0.06)] hover:text-[#ededed]"),children:[g.jsx("div",{className:"grid flex-none place-content-center",style:{width:36,height:36},children:e}),g.jsx("span",{className:"min-w-0 flex-1 truncate text-left text-[14px] font-medium",children:t}),s!=null&&g.jsx("span",{className:"mr-2 flex-none rounded-full border border-white/10 px-2 py-0.5 text-[10px] tabular-nums leading-none text-[#777]",children:s})]})}function qU(){return g.jsx("svg",{style:{width:16,height:16,color:"currentcolor"},viewBox:"0 0 16 16",fill:"currentColor",children:g.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M2.5 5.5V2.5H5.5V5.5H2.5ZM1 2C1 1.44772 1.44772 1 2 1H6C6.55228 1 7 1.44772 7 2V6C7 6.55228 6.55228 7 6 7H2C1.44772 7 1 6.55228 1 6V2ZM2.5 13.5V10.5H5.5V13.5H2.5ZM1 10C1 9.44772 1.44772 9 2 9H6C6.55228 9 7 9.44772 7 10V14C7 14.5523 6.55228 15 6 15H2C1.44772 15 1 14.5523 1 14V10ZM10.5 2.5V5.5H13.5V2.5H10.5ZM10 1C9.44772 1 9 1.44772 9 2V6C9 6.55228 9.44772 7 10 7H14C14.5523 7 15 6.55228 15 6V2C15 1.44772 14.5523 1 14 1H10ZM10.5 13.5V10.5H13.5V13.5H10.5ZM9 10C9 9.44772 9.44772 9 10 9H14C14.5523 9 15 9.44772 15 10V14C15 14.5523 14.5523 15 14 15H10C9.44772 15 9 14.5523 9 14V10Z"})})}const y_={work_email_required:"Please use your work email, not a personal one.",rate_limited:"Too many requests. Wait a minute and try again.",invalid_email:"That email does not look right. Check it and try again.",unavailable:"The email service is unavailable right now. Try again shortly."},PU=new Set(["gmail.com","googlemail.com","yahoo.com","ymail.com","outlook.com","hotmail.com","live.com","icloud.com","me.com","aol.com","proton.me","protonmail.com","gmx.com","mail.com"]);function FU({onVerified:e}){const[t,r]=ee.useState("email"),[a,s]=ee.useState(""),[o,c]=ee.useState(""),[d,h]=ee.useState(!1),[f,m]=ee.useState(null),[p,y]=ee.useState(null),x=async()=>{const N=a.trim();if(!N){m("Enter your email to continue.");return}const S=N.slice(N.lastIndexOf("@")+1).toLowerCase();if(PU.has(S)){Tr("work_email_required"),m(y_.work_email_required);return}h(!0),m(null);const w=await uS(N);h(!1),w.ok?(Tr("email_submitted",{purpose:"verify"}),y(`We sent a 6-digit code to ${N}.`),r("code")):(w.error==="work_email_required"&&Tr("work_email_required"),m(y_[w.error]??"Could not send a code. Try again."))},_=async()=>{const N=o.trim();if(N.length<4){m("Enter the 6-digit code from your email.");return}h(!0),m(null);const S=await dS(a.trim(),N);if(h(!1),!S.verified){m("That code did not match. Check it and try again.");return}Tr("email_verified",{purpose:"verify"}),e()};return g.jsxs("div",{className:"mx-auto mt-5 max-w-sm text-left",children:[f&&g.jsxs("div",{className:"mb-3 flex items-start gap-2 rounded-lg border border-red-500/30 bg-red-500/5 px-3 py-2",children:[g.jsx(Hu,{className:"mt-0.5 h-4 w-4 flex-shrink-0 text-red-400","aria-hidden":"true"}),g.jsx("p",{className:"text-xs text-red-300",children:f})]}),p&&!f&&g.jsx("p",{className:"mb-3 text-xs text-[#888]",children:p}),t==="email"?g.jsxs("form",{className:"space-y-3",onSubmit:N=>{N.preventDefault(),x()},children:[g.jsxs("label",{className:"block",children:[g.jsx("span",{className:"mb-1.5 block text-xs text-[#888]",children:"Your work email"}),g.jsx("input",{type:"email",autoFocus:!0,value:a,onChange:N=>s(N.target.value),placeholder:"you@company.com",className:"w-full rounded-lg bg-black px-3 py-2.5 text-sm text-white outline-none transition-colors focus:border-[#444]",style:{border:"1px solid #2a2a2a"}}),g.jsx("span",{className:"mt-1.5 block text-[11px] text-[#666]",children:"Use your work email."})]}),g.jsxs("button",{type:"submit",disabled:d,className:"flex w-full cursor-pointer items-center justify-center gap-2 rounded-lg bg-white px-4 py-2.5 text-sm font-semibold text-black transition-opacity hover:opacity-90 disabled:opacity-60",children:[d&&g.jsx(qs,{className:"h-4 w-4 animate-spin","aria-hidden":"true"}),"Send me a code"]})]}):g.jsxs("form",{className:"space-y-3",onSubmit:N=>{N.preventDefault(),_()},children:[g.jsxs("label",{className:"block",children:[g.jsx("span",{className:"mb-1.5 block text-xs text-[#888]",children:"6-digit code"}),g.jsx("input",{inputMode:"numeric",autoFocus:!0,value:o,onChange:N=>c(N.target.value.replace(/\D/g,"").slice(0,6)),placeholder:"123456",className:"w-full rounded-lg bg-black px-3 py-2.5 text-center text-lg font-mono tracking-[0.4em] text-white outline-none transition-colors focus:border-[#444]",style:{border:"1px solid #2a2a2a"}})]}),g.jsxs("button",{type:"submit",disabled:d,className:"flex w-full cursor-pointer items-center justify-center gap-2 rounded-lg bg-white px-4 py-2.5 text-sm font-semibold text-black transition-opacity hover:opacity-90 disabled:opacity-60",children:[d&&g.jsx(qs,{className:"h-4 w-4 animate-spin","aria-hidden":"true"}),"Verify"]}),g.jsx("button",{type:"button",onClick:()=>{r("email"),m(null),y(null)},className:"w-full cursor-pointer text-center text-xs text-[#666] transition-colors hover:text-[#aaa]",children:"Use a different email"})]})]})}const GU=[{key:"critical",dot:"bg-red-500",text:"text-red-500"},{key:"high",dot:"bg-orange-500",text:"text-orange-500"},{key:"medium",dot:"bg-yellow-500",text:"text-yellow-500"},{key:"low",dot:"bg-blue-500",text:"text-blue-500"}];function VU({counts:e}){const t=GU.filter(r=>e[r.key]>0);return t.length===0?g.jsx("span",{className:"text-xs text-[#555]",children:"No findings"}):g.jsx("div",{className:"flex items-center gap-3",children:t.map(r=>g.jsxs("div",{className:"flex items-center gap-1.5",children:[g.jsx("span",{className:`h-2 w-2 rounded-full ${r.dot}`,"aria-hidden":"true"}),g.jsx("span",{className:`text-xs tabular-nums ${r.text}`,children:e[r.key]})]},r.key))})}function YU(e){if(!e)return null;const t=e.trim().replace(" UTC","Z").replace(" ","T"),r=new Date(t);return Number.isNaN(r.getTime())?null:r.toLocaleString(void 0,{month:"short",day:"numeric",hour:"numeric",minute:"2-digit"})}function v_(e){if(!e)return null;const t=e.trim().replace(" UTC","Z").replace(" ","T"),r=new Date(t);if(Number.isNaN(r.getTime()))return null;const a=Date.now()-r.getTime(),s=Math.floor(a/6e4);if(s<1)return"just now";if(s<60)return`${s}m ago`;const o=Math.floor(s/60);if(o<24)return`${o}h ago`;const c=Math.floor(o/24);return c<7?`${c}d ago`:YU(e)}function XU({runs:e,activeRun:t,onSelectRun:r,onVerified:a}){const s=(e==null?void 0:e.count)??0,[o,c]=ee.useState(!1);return!e||e.locked?g.jsxs("div",{className:"rounded-xl border border-[#222] bg-[rgba(255,255,255,0.02)] p-8 text-center",children:[g.jsx("div",{className:"mx-auto mb-4 flex h-11 w-11 items-center justify-center rounded-xl",style:{border:"1px solid #2a2a2a",background:"rgba(255,255,255,0.04)"},children:g.jsx(Vs,{className:"h-5 w-5 text-[#888]","aria-hidden":"true"})}),g.jsx("h2",{className:"text-base font-semibold text-white",children:"Browse every run on this machine"}),g.jsxs("p",{className:"mx-auto mt-1.5 max-w-md text-sm text-[#888]",children:["You have ",s," past ",s===1?"run":"runs"," on this machine."]}),o?g.jsxs(g.Fragment,{children:[g.jsx("p",{className:"mx-auto mt-3 max-w-sm text-xs text-[#666]",children:"Verify your email with a one-time code to unlock the full history."}),g.jsx(FU,{onVerified:a})]}):g.jsx("button",{onClick:()=>{jr("history_unlock","past_runs"),c(!0)},className:"mt-4 cursor-pointer rounded-lg bg-white px-4 py-2 text-sm font-semibold text-black transition-opacity hover:opacity-90",children:"View runs"}),g.jsxs("p",{className:"mt-4 flex items-center justify-center gap-1.5 text-xs text-[#555]",children:[g.jsx(B_,{className:"h-3.5 w-3.5","aria-hidden":"true"}),"Or open one from the CLI with"," ",g.jsx("code",{className:"font-mono text-[#888]",children:"strix view "})]})]}):e.runs.length===0?g.jsx("div",{className:"rounded-xl border border-[#222] bg-[rgba(255,255,255,0.02)] p-8 text-center text-sm text-[#888]",children:"No past runs found on this machine yet."}):g.jsx("div",{className:"space-y-2",children:e.runs.map(d=>{const h=d.name===t,f=v_(d.start_time)??v_(d.end_time),m=bo(d.target,d.name);return g.jsxs("button",{onClick:()=>r(d.name),className:`animate-card-in group flex w-full cursor-pointer items-center gap-4 rounded-lg border px-4 py-3 text-left transition-colors ${h?"border-[#444] bg-[rgba(255,255,255,0.04)]":"border-[#222] bg-[rgba(255,255,255,0.02)] hover:border-[#444]"}`,children:[g.jsxs("div",{className:"min-w-0 flex-1",children:[g.jsxs("div",{className:"flex items-center gap-2",children:[g.jsx("span",{className:"truncate text-sm font-medium text-white",children:m}),h&&g.jsx("span",{className:"rounded-full px-1.5 py-0.5 text-[10px] font-semibold uppercase tracking-wide text-emerald-400",style:{border:"1px solid rgba(16,185,129,0.3)"},children:"Active"})]}),g.jsxs("div",{className:"mt-0.5 flex flex-wrap items-center gap-x-2 gap-y-0.5 text-xs text-[#666]",children:[d.scan_mode&&g.jsx("span",{className:"capitalize",children:d.scan_mode}),d.scan_mode&&(f||d.status)&&g.jsx("span",{className:"text-[#333]",children:"·"}),f&&g.jsx("span",{children:f}),f&&d.status&&g.jsx("span",{className:"text-[#333]",children:"·"}),d.status&&g.jsx("span",{className:"capitalize",children:d.status})]})]}),g.jsx(VU,{counts:d.severity_counts}),g.jsx(Kk,{className:"h-4 w-4 flex-shrink-0 text-[#555] transition-colors group-hover:text-[#aaa]","aria-hidden":"true"})]},d.name)})})}const __={work_email_required:"Please use your work email, not a personal one.",rate_limited:"Too many requests. Wait a minute and try again.",invalid_email:"That email does not look right. Check it and try again.",unavailable:"The email service is unavailable right now. Try again shortly."},KU={forbidden:"This email was unsubscribed from Strix, so we cannot send to it.",too_large:"This report is too large to email. Try a smaller run.",unavailable:"The email service is unavailable right now. Try again shortly."},ZU=new Set(["gmail.com","googlemail.com","yahoo.com","ymail.com","outlook.com","hotmail.com","live.com","icloud.com","me.com","aol.com","proton.me","protonmail.com","gmx.com","mail.com"]);function QU({activeRun:e,auth:t,purpose:r,skipDisclosure:a=!1,onAuthChanged:s,onExit:o}){const c=(t==null?void 0:t.verified)===!0,d=r==="verify",[h,f]=ee.useState(()=>d?"email":a?c?"sending":"email":"disclosure"),[m,p]=ee.useState((t==null?void 0:t.email)??""),[y,x]=ee.useState(""),[_,N]=ee.useState(!1),[S,w]=ee.useState(null),[k,E]=ee.useState(null),[M,I]=ee.useState(""),[R,$]=ee.useState(""),[B,Z]=ee.useState(!1),[j,z]=ee.useState(""),G=ee.useRef(!1),V=async()=>{f("sending"),w(null);const K=await NU(e);if(K.ok){Tr("report_sent"),I(K.password),$(K.filename),f("password");return}if(K.error==="reverify"||K.error==="unverified"){E("Your verification expired. Enter your email to verify again."),f("email");return}w(KU[K.error]??"Could not send the report. Try again."),f("disclosure")},T=()=>{w(null),E(null),c?V():f("email")};ee.useEffect(()=>{!d&&a&&c&&!G.current&&(G.current=!0,V())},[]);const U=async()=>{const K=m.trim();if(!K){w("Enter your email to continue.");return}const C=K.slice(K.lastIndexOf("@")+1).toLowerCase();if(ZU.has(C)){Tr("work_email_required"),w(__.work_email_required);return}N(!0),w(null);const D=await uS(K);N(!1),D.ok?(Tr("email_submitted",{purpose:r}),E(`We sent a 6-digit code to ${K}.`),f("code")):(D.error==="work_email_required"&&Tr("work_email_required"),w(__[D.error]??"Could not send a code. Try again."))},O=async()=>{const K=y.trim();if(K.length<4){w("Enter the 6-digit code from your email.");return}N(!0),w(null);const C=await dS(m.trim(),K);if(N(!1),!C.verified){w("That code did not match. Check it and try again.");return}Tr("email_verified",{purpose:r}),z(C.email),s(),d?o("history"):V()},H=async()=>{try{await navigator.clipboard.writeText(M),Z(!0),setTimeout(()=>Z(!1),1500)}catch{}},X=j||(t==null?void 0:t.email)||m.trim();return g.jsxs("div",{className:"mx-auto max-w-xl space-y-4",children:[g.jsxs("button",{onClick:()=>o(d?"history":"overview"),className:"cursor-pointer inline-flex items-center gap-1.5 text-sm text-[#888] transition-colors hover:text-white",children:[g.jsx(bp,{className:"h-4 w-4"}),d?"Back to past runs":"Back to results"]}),g.jsxs("div",{className:"flex items-center gap-2",children:[g.jsx(xp,{className:"h-5 w-5 text-[#888]","aria-hidden":"true"}),g.jsx("h1",{className:"text-2xl font-semibold text-white",children:d?"Verify your email":"Export report to PDF"})]}),g.jsxs("div",{className:"w-full rounded-2xl bg-[rgba(255,255,255,0.02)] p-6",style:{border:"1px solid #2a2a2a"},children:[g.jsx("p",{className:"mb-4 text-xs text-[#666]",children:d?"We send a one-time code to confirm it is you.":"Verified by a one-time code sent to your email"}),S&&g.jsxs("div",{className:"mb-4 flex items-start gap-2 rounded-lg border border-red-500/30 bg-red-500/5 px-3 py-2",children:[g.jsx(Hu,{className:"mt-0.5 h-4 w-4 flex-shrink-0 text-red-400","aria-hidden":"true"}),g.jsx("p",{className:"text-xs text-red-300",children:S})]}),k&&!S&&h!=="password"&&g.jsx("p",{className:"mb-4 text-xs text-[#888]",children:k}),h==="disclosure"&&g.jsxs("div",{className:"space-y-4",children:[g.jsxs("div",{className:"space-y-2.5 rounded-lg p-3.5",style:{border:"1px solid #222",background:"rgba(255,255,255,0.02)"},children:[g.jsxs("div",{className:"flex items-start gap-2.5",children:[g.jsx(I_,{className:"mt-0.5 h-4 w-4 flex-shrink-0 text-emerald-400","aria-hidden":"true"}),g.jsxs("p",{className:"text-xs leading-relaxed text-[#aaa]",children:["We email an ",g.jsx("span",{className:"text-white",children:"encrypted PDF"}),". Nothing else leaves your machine."]})]}),g.jsxs("div",{className:"flex items-start gap-2.5",children:[g.jsx(zC,{className:"mt-0.5 h-4 w-4 flex-shrink-0 text-[#888]","aria-hidden":"true"}),g.jsx("p",{className:"text-xs leading-relaxed text-[#aaa]",children:"Only you hold the password; Strix can't read it."})]})]}),g.jsx("button",{onClick:T,className:"w-full cursor-pointer rounded-lg bg-white px-4 py-2.5 text-sm font-semibold text-black transition-opacity hover:opacity-90",children:"Export report"}),c&&(t==null?void 0:t.email)&&g.jsxs("p",{className:"text-center text-xs text-[#666]",children:["Sending to ",t.email]})]}),h==="email"&&g.jsxs("form",{className:"space-y-4",onSubmit:K=>{K.preventDefault(),U()},children:[g.jsxs("label",{className:"block",children:[g.jsx("span",{className:"mb-1.5 block text-xs text-[#888]",children:"Your work email"}),g.jsx("input",{type:"email",autoFocus:!0,value:m,onChange:K=>p(K.target.value),placeholder:"you@company.com",className:"w-full rounded-lg bg-black px-3 py-2.5 text-sm text-white outline-none transition-colors focus:border-[#444]",style:{border:"1px solid #2a2a2a"}})]}),g.jsxs("button",{type:"submit",disabled:_,className:"flex w-full cursor-pointer items-center justify-center gap-2 rounded-lg bg-white px-4 py-2.5 text-sm font-semibold text-black transition-opacity hover:opacity-90 disabled:opacity-60",children:[_&&g.jsx(qs,{className:"h-4 w-4 animate-spin","aria-hidden":"true"}),"Send me a code"]})]}),h==="code"&&g.jsxs("form",{className:"space-y-4",onSubmit:K=>{K.preventDefault(),O()},children:[g.jsxs("label",{className:"block",children:[g.jsx("span",{className:"mb-1.5 block text-xs text-[#888]",children:"6-digit code"}),g.jsx("input",{inputMode:"numeric",autoFocus:!0,value:y,onChange:K=>x(K.target.value.replace(/\D/g,"").slice(0,6)),placeholder:"123456",className:"w-full rounded-lg bg-black px-3 py-2.5 text-center text-lg font-mono tracking-[0.4em] text-white outline-none transition-colors focus:border-[#444]",style:{border:"1px solid #2a2a2a"}})]}),g.jsxs("button",{type:"submit",disabled:_,className:"flex w-full cursor-pointer items-center justify-center gap-2 rounded-lg bg-white px-4 py-2.5 text-sm font-semibold text-black transition-opacity hover:opacity-90 disabled:opacity-60",children:[_&&g.jsx(qs,{className:"h-4 w-4 animate-spin","aria-hidden":"true"}),d?"Verify":"Verify and send"]}),g.jsx("button",{type:"button",onClick:()=>{f("email"),w(null),E(null)},className:"w-full cursor-pointer text-center text-xs text-[#666] transition-colors hover:text-[#aaa]",children:"Use a different email"})]}),h==="sending"&&g.jsxs("div",{className:"flex flex-col items-center gap-3 py-8",children:[g.jsx(qs,{className:"h-6 w-6 animate-spin text-white","aria-hidden":"true"}),g.jsx("p",{className:"text-sm text-[#aaa]",children:"Generating and encrypting locally..."})]}),h==="password"&&g.jsxs("div",{className:"space-y-4",children:[g.jsxs("div",{className:"flex items-start gap-2.5 rounded-lg border border-emerald-500/30 bg-emerald-500/5 px-3 py-2.5",children:[g.jsx(Gs,{className:"mt-0.5 h-4 w-4 flex-shrink-0 text-emerald-400","aria-hidden":"true"}),g.jsxs("p",{className:"text-xs text-emerald-200",children:["Sent to ",X,". Open the attached PDF with this password."]})]}),g.jsxs("div",{children:[g.jsx("span",{className:"mb-1.5 block text-xs text-[#888]",children:"Your one-time password"}),g.jsxs("div",{className:"flex items-center gap-2 rounded-lg bg-black p-3",style:{border:"1px solid #2a2a2a"},children:[g.jsx("code",{className:"flex-1 break-all font-mono text-base text-white",children:M}),g.jsxs("button",{onClick:H,className:"flex cursor-pointer items-center gap-1 rounded-md px-2 py-1 text-xs text-[#aaa] transition-colors hover:bg-[rgba(255,255,255,0.06)] hover:text-white",style:{border:"1px solid #2a2a2a"},children:[B?g.jsx(Gs,{className:"h-3.5 w-3.5"}):g.jsx(mo,{className:"h-3.5 w-3.5"}),B?"Copied":"Copy"]})]}),g.jsxs("p",{className:"mt-2 text-xs text-[#666]",children:["Save this now. Strix never stores it, so we cannot show it again. File:"," ",g.jsx("span",{className:"font-mono text-[#888]",children:R})]})]}),g.jsx("button",{onClick:()=>o("overview"),className:"w-full cursor-pointer rounded-lg px-4 py-2.5 text-sm font-semibold text-white transition-colors hover:bg-[rgba(255,255,255,0.06)]",style:{border:"1px solid #2a2a2a"},children:"Done"})]})]})]})}function la(e){return e&&typeof e=="object"&&!Array.isArray(e)?e:{}}function io(e){return Array.isArray(e)?e:[]}function Fn(e){return typeof e=="string"&&e.trim()?e:null}function Ia(e){return typeof e=="number"&&Number.isFinite(e)?e:null}function WU(e){return e.replace(/_/g," ")}function w_(e){return e&&e.charAt(0).toUpperCase()+e.slice(1)}function JU(e){if(e==null||e<0)return"n/a";const t=Math.floor(e/3600),r=Math.floor(e%3600/60),a=e%60;return t?`${t}h ${r}m ${a}s`:r?`${r}m ${a}s`:`${a}s`}function wn({label:e,children:t}){return g.jsxs("div",{className:"grid grid-cols-[7rem_1fr] gap-3 items-baseline",children:[g.jsx("dt",{className:"text-[11px] uppercase tracking-wide text-[#666]",children:e}),g.jsx("dd",{className:"min-w-0 break-words text-sm text-[#ddd]",children:t})]})}function eH({raw:e,durationSeconds:t}){const[r,a]=ee.useState(!0),s=io(e.targets_info).map(T=>{const U=la(T),O=Fn(U.original)??Fn(la(U.details).target_url)??"unknown target",H=Fn(U.type);return{display:O,type:H?WU(H):null}}),o=Fn(e.instruction),c=w_(Fn(e.scan_mode)),d=Fn(e.scope_mode),h=la(e.diff_scope),f=h.active===!0,m=Fn(h.mode),p=Fn(e.diff_base),y=e.non_interactive===!0,x=io(e.local_sources).map(T=>{if(typeof T=="string")return T;const U=la(T);return Fn(U.source_path)??Fn(U.target_path)??""}).filter(Boolean),_=w_(Fn(e.status));let N=d??"auto";f&&(N+=` (diff${m?`: ${m}`:""}${p?` vs ${p}`:""})`);const S=la(e.llm_usage),w=Object.keys(S).length>0,k=io(S.agents).map(la),E=Array.from(new Set(k.map(T=>Fn(T.model)).filter(T=>!!T))),M=Ia(S.requests),I=Ia(S.input_tokens),R=Ia(la(io(S.input_tokens_details)[0]).cached_tokens),$=Ia(S.output_tokens),B=Ia(la(io(S.output_tokens_details)[0]).reasoning_tokens),Z=Ia(S.total_tokens),j=Ia(S.cost),z=Fn(e.auth_mode)==="subscription",G=Fn(e.subscription_provider)||"ChatGPT",V=(T,U)=>g.jsxs("span",{className:"text-[#666]",children:[" (",Ds(T)," ",U,")"]});return g.jsxs("div",{className:"rounded-xl border border-[#222] bg-[rgba(255,255,255,0.02)] p-5",children:[g.jsxs("button",{type:"button",onClick:()=>a(T=>!T),"aria-expanded":r,className:"flex w-full cursor-pointer items-center gap-2 text-left",children:[g.jsx(OC,{className:"h-4 w-4 text-[#888]","aria-hidden":"true"}),g.jsx("h2",{className:"text-sm font-semibold text-white",children:"Run details"}),r?g.jsx(O_,{className:"ml-auto h-4 w-4 text-[#666]","aria-hidden":"true"}):g.jsx(ho,{className:"ml-auto h-4 w-4 text-[#666]","aria-hidden":"true"})]}),r&&g.jsxs("div",{className:"mt-4 grid grid-cols-1 gap-x-8 gap-y-6 md:grid-cols-2",children:[g.jsxs("section",{children:[g.jsx("h3",{className:"mb-3 text-[11px] font-semibold uppercase tracking-wide text-[#555]",children:"Configuration"}),g.jsxs("dl",{className:"space-y-2.5",children:[s.length>0&&g.jsx(wn,{label:"Targets",children:g.jsx("div",{className:"space-y-1",children:s.map((T,U)=>g.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[g.jsx("span",{className:"font-mono text-[#ddd]",children:T.display}),T.type&&g.jsx("span",{className:"rounded-full border border-[#2a2a2a] px-1.5 py-0.5 text-[10px] text-[#888]",children:T.type})]},U))})}),g.jsx(wn,{label:"Instruction",children:o?g.jsx("span",{className:"whitespace-pre-wrap",children:o}):g.jsx("span",{className:"text-[#666]",children:"None"})}),c&&g.jsx(wn,{label:"Pentest mode",children:c}),g.jsx(wn,{label:"Scope",children:N}),g.jsx(wn,{label:"Mode",children:y?"Non-interactive":"Interactive"}),x.length>0&&g.jsx(wn,{label:"Local sources",children:g.jsx("div",{className:"space-y-0.5 font-mono text-[#ddd]",children:x.map((T,U)=>g.jsx("div",{children:T},U))})}),_&&g.jsx(wn,{label:"Status",children:_})]})]}),g.jsxs("section",{children:[g.jsx("h3",{className:"mb-3 text-[11px] font-semibold uppercase tracking-wide text-[#555]",children:"Usage & cost"}),w?g.jsxs("dl",{className:"space-y-2.5 tabular-nums",children:[g.jsx(wn,{label:"Model",children:E.length?E.join(", "):"n/a"}),z&&g.jsx(wn,{label:"Provider",children:g.jsx("span",{className:"inline-flex items-center gap-1.5",children:g.jsxs("span",{className:"rounded-full border border-[#22c55e]/40 bg-[#22c55e]/10 px-2 py-0.5 text-[11px] text-[#22c55e]",children:[G," subscription"]})})}),g.jsx(wn,{label:"Run time",children:JU(t)}),M!=null&&g.jsx(wn,{label:"Requests",children:Ds(M)}),I!=null&&g.jsxs(wn,{label:"Input tokens",children:[Ds(I),R!=null&&V(R,"cached")]}),$!=null&&g.jsxs(wn,{label:"Output tokens",children:[Ds($),B!=null&&V(B,"reasoning")]}),Z!=null&&g.jsx(wn,{label:"Total tokens",children:Ds(Z)}),z?g.jsxs(wn,{label:"Cost",children:[g.jsx("span",{className:"text-[#22c55e]",children:"$0.00"}),g.jsx("span",{className:"text-[#666]",children:" (subscription)"})]}):j!=null&&g.jsxs(wn,{label:"Cost",children:["$",j.toFixed(2)]}),k.length>0&&g.jsx(wn,{label:"Agents",children:Ds(k.length)})]}):g.jsx("p",{className:"text-sm text-[#666]",children:"Not available yet."})]})]})]})}const E_="strix_viewer_trust_dismissed";function tH({message:e}){const[t,r]=ee.useState(()=>{try{return localStorage.getItem(E_)==="1"}catch{return!1}});if(t)return null;const a=()=>{try{localStorage.setItem(E_,"1")}catch{}r(!0)};return g.jsx("div",{className:"fixed bottom-3 left-3 z-[60] max-w-xs rounded-lg bg-[#0a0a0a] p-3 shadow-2xl",style:{border:"1px solid #2a2a2a"},role:"status",children:g.jsxs("div",{className:"flex gap-2.5",children:[g.jsx(I_,{className:"mt-0.5 h-4 w-4 flex-shrink-0 text-emerald-400","aria-hidden":"true"}),g.jsx("p",{className:"text-xs leading-relaxed text-[#aaa]",children:e}),g.jsx("button",{onClick:a,"aria-label":"Dismiss",className:"-mr-0.5 -mt-0.5 flex-shrink-0 cursor-pointer rounded p-0.5 text-[#666] transition-colors hover:text-white",children:g.jsx(yp,{className:"h-3.5 w-3.5"})})]})})}const nH=5e3,N_={invalid_email:"That email doesn't look right.",invalid_message:"Please write a little more.",unavailable:"Couldn't send that just now. Try again."};function rH({defaultEmail:e,onExit:t}){const[r,a]=ee.useState(""),[s,o]=ee.useState(e??""),[c,d]=ee.useState("form"),[h,f]=ee.useState(null),m=r.trim().length>0&&s.trim().length>0&&c!=="sending",p=async()=>{if(!m)return;d("sending"),f(null);const y=await _U(r.trim(),s.trim());if(y.ok){d("sent");return}d("form"),f(N_[y.error]??N_.unavailable)};return g.jsxs("div",{className:"mx-auto max-w-xl space-y-4",children:[g.jsxs("button",{onClick:()=>t("overview"),className:"cursor-pointer inline-flex items-center gap-1.5 text-sm text-[#888] transition-colors hover:text-white",children:[g.jsx(bp,{className:"h-4 w-4"}),"Back to results"]}),g.jsxs("div",{className:"flex items-center gap-2",children:[g.jsx(pS,{className:"h-5 w-5 text-[#888]","aria-hidden":"true"}),g.jsx("h1",{className:"text-2xl font-semibold text-white",children:"Feedback & support"})]}),g.jsx("div",{className:"w-full rounded-2xl bg-[rgba(255,255,255,0.02)] p-6",style:{border:"1px solid #2a2a2a"},children:c==="sent"?g.jsxs("div",{className:"flex items-start gap-3",children:[g.jsx(j_,{className:"mt-0.5 h-5 w-5 flex-shrink-0 text-emerald-400","aria-hidden":"true"}),g.jsxs("div",{className:"min-w-0",children:[g.jsx("p",{className:"text-sm font-semibold text-white",children:"Thanks, we got it."}),g.jsx("p",{className:"mt-1 text-xs text-[#888]",children:"We read every message. If it needs a reply, we'll reach out to the email you gave."}),g.jsx("button",{onClick:()=>{a(""),d("form")},className:"mt-4 cursor-pointer text-xs text-[#888] transition-colors hover:text-white",children:"Send more feedback"})]})]}):g.jsxs(g.Fragment,{children:[g.jsx("p",{className:"mb-4 text-xs text-[#666]",children:"Bugs, feature requests, or anything else. Tell us what's on your mind."}),h&&g.jsxs("div",{className:"mb-4 flex items-start gap-2 rounded-lg border border-red-500/30 bg-red-500/5 px-3 py-2",children:[g.jsx(Hu,{className:"mt-0.5 h-4 w-4 flex-shrink-0 text-red-400","aria-hidden":"true"}),g.jsx("p",{className:"text-xs text-red-300",children:h})]}),g.jsxs("label",{className:"block",children:[g.jsx("span",{className:"mb-1.5 block text-xs text-[#888]",children:"Your feedback"}),g.jsx("textarea",{autoFocus:!0,value:r,maxLength:nH,onChange:y=>a(y.target.value),rows:5,placeholder:"What's working, what's not, what you'd love to see…",className:"w-full resize-y rounded-lg border border-[#2a2a2a] bg-black px-3 py-2.5 text-sm text-white outline-none transition-colors focus:border-white/50 focus:ring-2 focus:ring-white/10"})]}),g.jsxs("label",{className:"mt-4 block",children:[g.jsx("span",{className:"mb-1.5 block text-xs text-[#888]",children:"Your work email"}),g.jsx("input",{type:"email",value:s,onChange:y=>o(y.target.value),placeholder:"you@company.com",className:"w-full rounded-lg border border-[#2a2a2a] bg-black px-3 py-2.5 text-sm text-white outline-none transition-colors focus:border-white/50 focus:ring-2 focus:ring-white/10"})]}),g.jsx("button",{onClick:()=>void p(),disabled:!m,className:"mt-4 flex w-full cursor-pointer items-center justify-center gap-2 rounded-lg bg-white px-4 py-2.5 text-sm font-semibold text-black transition-opacity hover:opacity-90 disabled:opacity-60",children:c==="sending"?"Sending…":"Send feedback"})]})})]})}function iH({text:e,children:t,className:r=""}){const[a,s]=ee.useState(!1);return g.jsxs("span",{className:`relative inline-flex ${r}`,onMouseEnter:()=>s(!0),onMouseLeave:()=>s(!1),onFocus:()=>s(!0),onBlur:()=>s(!1),children:[t,a&&g.jsx("span",{role:"tooltip",className:"pointer-events-none absolute bottom-full left-1/2 z-50 mb-2 w-max max-w-[240px] -translate-x-1/2 rounded-md px-2.5 py-1.5 text-xs text-[#ddd] shadow-lg",style:{border:"1px solid #2a2a2a",background:"#0a0a0a"},children:e})]})}function gS({label:e,desc:t,slug:r,icon:a,surface:s}){return g.jsx(iH,{text:t,children:g.jsxs("a",{href:fa($u,r),target:"_blank",rel:"noopener noreferrer",onClick:()=>jr(r,s),className:"group inline-flex items-center gap-2 rounded-lg border border-[#222] bg-[rgba(255,255,255,0.02)] px-3 py-2 text-sm text-[#aaa] transition-colors hover:border-[#444] hover:text-white",children:[g.jsx(a,{className:"h-4 w-4 text-[#888] transition-colors group-hover:text-white","aria-hidden":"true"}),g.jsx("span",{children:e})]})})}const aH="Your findings stay on your machine. They're rendered here locally in your browser and never uploaded or stored by Strix.",S_=["critical","high","medium","low"],sH=500;function lH(){const[e,t]=ee.useState(null),[r,a]=ee.useState(null),[s,o]=ee.useState(null),[c,d]=ee.useState(null),[h,f]=ee.useState("overview"),[m,p]=ee.useState(null),[y,x]=ee.useState(null),[_,N]=ee.useState("report"),[S,w]=ee.useState(!1),[k,E]=ee.useState(!1),M=ee.useCallback(async()=>{try{p(await wU())}catch{}},[]),I=ee.useCallback(async()=>{try{x(await xU())}catch{}},[]);ee.useEffect(()=>{M(),I(),yU().then(C=>E(C.can_steer)).catch(()=>{})},[M,I]);const R=ee.useRef(!1);ee.useEffect(()=>{let C=!1,D;R.current=!1;const Y=()=>{D=setTimeout(L,sH)},L=async()=>{if(!C)try{const{summary:F,raw:q,finished:Q}=await lS(e);if(C)return;if(Q&&!R.current){R.current=!0;const te=await h_(e);C||a(te);return}const[J,W]=await Promise.all([cS(e).catch(()=>({agents:[],events:[]})),oS(F.runId,e).catch(()=>[])]);if(C)return;a(te=>({summary:F,raw:q,finished:Q,transcript:J,vulnerabilities:W,reportMarkdown:(te==null?void 0:te.reportMarkdown)??null})),Y()}catch(F){if(C)return;o(F instanceof Error?F.message:"Could not load run data."),Y()}};return(async()=>{try{const F=await h_(e);if(C)return;a(F),F.finished?R.current=!0:Y()}catch(F){if(C)return;o(F instanceof Error?F.message:"Could not load run data."),Y()}})(),()=>{C=!0,D&&clearTimeout(D)}},[e]);const $=ee.useMemo(()=>r?gU(r.vulnerabilities):null,[r]),B=(r==null?void 0:r.vulnerabilities.find(C=>C.id===c))??null,Z=(r==null?void 0:r.transcript.agents.length)??0,j=(m==null?void 0:m.verified)===!0,z=ee.useRef(!1);ee.useEffect(()=>{z.current=!1},[e]),ee.useEffect(()=>{z.current||!r||(r.finished?(z.current=!0,f("overview")):Z>0&&(z.current=!0,f("agents")))},[r,Z]);const G=ee.useCallback(C=>{z.current=!0,f(C)},[]),V=ee.useCallback(C=>{t(C),d(null),a(null),o(null),z.current=!1},[]),T=ee.useCallback((C,D)=>{jr("email_report",D),N("report"),w(C),G("email")},[G]),U=ee.useCallback(()=>T(!1,"sidebar"),[T]),O=ee.useCallback(()=>T(!0,"overview"),[T]),H=ee.useCallback(()=>{I(),G("history")},[I,G]),X=ee.useCallback(async()=>{await M(),await I()},[M,I]),K=ee.useCallback(async()=>{await EU(),await M(),await I()},[M,I]);return g.jsxs("div",{className:"min-h-screen bg-black text-white flex",children:[g.jsx($U,{view:h,onSelectView:C=>{d(null),C==="history"?H():G(C)},issuesCount:(r==null?void 0:r.vulnerabilities.length)??0,agentCount:Z,runCount:(y==null?void 0:y.count)??0,finished:(r==null?void 0:r.finished)??!1,verified:j,email:(m==null?void 0:m.email)??null,onOpenEmail:U,onOpenHistory:H,onForget:()=>void K()}),g.jsxs("div",{className:"flex-1 min-w-0",children:[g.jsx("div",{className:"border-b border-[#222]",children:g.jsxs("div",{className:"max-w-[88rem] mx-auto px-3 sm:px-6 py-4 flex items-center gap-1.5",children:[g.jsxs("a",{href:fa("https://app.strix.ai","logo"),target:"_blank",rel:"noopener noreferrer",onClick:()=>jr("logo","topbar"),className:"flex items-center gap-1.5 opacity-90 transition-opacity hover:opacity-100 lg:hidden",title:"Open Strix Cloud",children:[g.jsx("img",{src:"./logo.png",alt:"Strix",className:"w-10 h-8 object-cover"}),g.jsx("div",{className:"text-base text-white font-medium tracking-tight",children:"Strix"})]}),r&&g.jsx(cH,{finished:r.finished}),g.jsxs("div",{className:"ml-auto flex items-center gap-3",children:[j&&y&&!y.locked&&y.runs.length>0&&g.jsx(oH,{runs:y,activeRun:e,launchedName:bo((r==null?void 0:r.summary.targets[0])??null,(r==null?void 0:r.summary.runName)??(r==null?void 0:r.summary.runId)??"Current run"),onSelect:V}),g.jsxs("a",{href:fa($u,"run_in_cloud"),target:"_blank",rel:"noopener noreferrer",onClick:()=>jr("run_in_cloud","topbar"),className:"inline-flex items-center gap-1 rounded-lg bg-white px-3 py-1.5 text-xs font-semibold text-black transition-opacity hover:opacity-90",children:["Run in the cloud",g.jsx(T_,{className:"w-3 h-3","aria-hidden":"true"})]})]})]})}),g.jsxs("div",{className:"max-w-[88rem] mx-auto px-3 sm:px-6 py-8 sm:py-12 space-y-6",children:[s&&!r&&h!=="history"&&h!=="email"&&g.jsxs("div",{className:"rounded-lg px-4 py-3 flex gap-3 items-start border border-red-500/30 bg-red-500/5",children:[g.jsx(Hu,{className:"w-5 h-5 flex-shrink-0 mt-0.5 text-red-400","aria-hidden":"true"}),g.jsx("p",{className:"text-sm text-red-300",children:s})]}),g.jsx("div",{className:"animate-page-in space-y-6",children:h==="email"?g.jsx(QU,{activeRun:e,auth:m,purpose:_,skipDisclosure:S,onAuthChanged:()=>{M(),I()},onExit:C=>f(C==="history"?"history":"overview")}):h==="feedback"?g.jsx(rH,{defaultEmail:(m==null?void 0:m.email)??null,onExit:C=>f(C)}):h==="history"?g.jsxs("div",{className:"space-y-4",children:[g.jsxs("div",{className:"flex items-center gap-2",children:[g.jsx(Vs,{className:"w-5 h-5 text-[#888]","aria-hidden":"true"}),g.jsx("h1",{className:"text-2xl font-semibold text-white",children:"Past runs"})]}),g.jsx(XU,{runs:y,activeRun:e,onSelectRun:V,onVerified:()=>void X()})]}):!r&&!s?g.jsxs("div",{className:"rounded-xl border border-[#222] bg-[rgba(255,255,255,0.02)] p-10 text-center",children:[g.jsx("div",{className:"w-6 h-6 mx-auto mb-3 rounded-full border-2 border-[#333] border-t-white animate-spin"}),g.jsx("p",{className:"text-sm text-[#888]",children:"Loading run data…"})]}):r&&$?g.jsxs(g.Fragment,{children:[g.jsx(dH,{summary:r.summary}),g.jsxs("div",{className:"flex gap-5 border-b border-[#2a2a2a] lg:hidden",children:[g.jsx(Im,{active:h==="overview",onClick:()=>G("overview"),children:"Pentest Overview"}),g.jsxs(Im,{active:h==="issues",onClick:()=>G("issues"),children:["Issues",r.vulnerabilities.length>0?` (${r.vulnerabilities.length})`:""]}),Z>0&&g.jsxs(Im,{active:h==="agents",onClick:()=>G("agents"),children:["Agents (",Z,")"]})]}),h==="overview"?g.jsx(gH,{summary:r.summary,counts:$,total:r.vulnerabilities.length,reportMarkdown:r.reportMarkdown,raw:r.raw,finished:r.finished,onOpenEmail:O}):h==="agents"&&Z>0?g.jsx(bH,{run:r,canSteer:k}):B?g.jsxs("div",{className:"space-y-4",children:[g.jsxs("button",{onClick:()=>d(null),className:"cursor-pointer inline-flex items-center gap-1.5 text-sm text-[#888] hover:text-white transition-colors",children:[g.jsx(bp,{className:"w-4 h-4"})," Back to all findings"]}),g.jsx(tD,{vulnerability:B})]}):g.jsx(fH,{vulnerabilities:r.vulnerabilities,finished:r.finished,onSelect:C=>d(C)})]}):null},`${e??"launched"}:${h}:${c??""}`)]})]}),g.jsx(tH,{message:aH})]})}function oH({runs:e,activeRun:t,launchedName:r,onSelect:a}){const[s,o]=ee.useState(!1),c=e.runs.find(h=>h.name===t),d=c?bo(c.target,c.name):r;return g.jsxs("div",{className:"relative",children:[g.jsxs("button",{onClick:()=>o(h=>!h),onBlur:()=>setTimeout(()=>o(!1),150),"aria-label":"Switch pentest",className:"flex items-center gap-2 rounded-lg border border-[#3a3a3a] bg-[rgba(255,255,255,0.05)] px-3 py-2 text-sm text-white transition-colors hover:border-[#555] hover:bg-[rgba(255,255,255,0.09)]",children:[g.jsx(Vs,{className:"h-4 w-4 flex-shrink-0 text-[#888]","aria-hidden":"true"}),g.jsx("span",{className:"flex-shrink-0 text-[#888]",children:"Pentest"}),g.jsx("span",{className:"max-w-[260px] truncate font-medium",children:d}),g.jsx(ho,{className:"h-4 w-4 flex-shrink-0 text-[#aaa]","aria-hidden":"true"})]}),s&&g.jsxs("div",{className:"absolute right-0 z-50 mt-2 max-h-96 w-96 overflow-y-auto rounded-xl py-1.5 shadow-2xl",style:{border:"1px solid #3a3a3a",background:"#0a0a0a"},children:[g.jsx("div",{className:"border-b border-[#222] px-3 py-2 text-[11px] font-semibold uppercase tracking-wide text-[#666]",children:"Switch pentest"}),e.runs.map(h=>{const f=h.name===t;return g.jsxs("button",{onMouseDown:()=>a(h.name),className:`flex w-full items-center gap-2 px-3 py-2.5 text-left text-sm transition-colors hover:bg-[rgba(255,255,255,0.06)] ${f?"bg-[rgba(255,255,255,0.04)] text-white":"text-[#aaa]"}`,children:[g.jsxs("span",{className:"min-w-0 flex-1",children:[g.jsx("span",{className:"block truncate font-medium",children:bo(h.target,h.name)}),h.target&&g.jsx("span",{className:"block truncate font-mono text-xs text-[#666]",children:h.target})]}),f&&g.jsx("span",{className:"h-2 w-2 flex-shrink-0 rounded-full bg-emerald-400"})]},h.name)})]})]})}function cH({finished:e}){return e?g.jsxs("span",{className:"ml-3 inline-flex items-center gap-1.5 text-xs text-[#888]",children:[g.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-[#555]"}),"Complete"]}):g.jsxs("span",{className:"ml-3 inline-flex items-center gap-1.5 text-xs text-emerald-400",children:[g.jsxs("span",{className:"relative flex h-1.5 w-1.5",children:[g.jsx("span",{className:"absolute inline-flex h-full w-full rounded-full bg-emerald-400 opacity-75 animate-ping"}),g.jsx("span",{className:"relative inline-flex h-1.5 w-1.5 rounded-full bg-emerald-400"})]}),"Live"]})}function uH(e){if(e==null)return null;if(e<60)return`${e}s`;const t=Math.floor(e/60);return t<60?`${t}m`:`${Math.floor(t/60)}h ${t%60}m`}function dH({summary:e}){const t=uH(e.durationSeconds);return g.jsxs("div",{children:[g.jsx("h1",{className:"text-2xl font-semibold text-white",children:bo(e.targets[0]??null,e.runName??e.runId??"Pentest results")}),g.jsxs("div",{className:"mt-1 flex flex-wrap items-center gap-x-3 gap-y-1 text-sm text-[#888]",children:[e.targets.length>0&&g.jsx("span",{className:"font-mono text-[#aaa]",children:e.targets.join(", ")}),e.scanMode&&g.jsx(zm,{label:e.scanMode}),t&&g.jsx(zm,{label:t}),e.status&&g.jsx(zm,{label:e.status})]})]})}function zm({label:e}){return g.jsxs(g.Fragment,{children:[g.jsx("span",{className:"text-[#333]",children:"·"}),g.jsx("span",{className:"capitalize",children:e})]})}function fH({vulnerabilities:e,finished:t,onSelect:r}){const a=[...e].sort((s,o)=>S_.indexOf(s.severity)-S_.indexOf(o.severity));return a.length===0?g.jsxs("div",{className:"space-y-4",children:[g.jsx("div",{className:"rounded-xl border border-[#222] bg-[rgba(255,255,255,0.02)] p-8 text-center text-sm text-[#888]",children:t?"No findings in this run.":"No findings yet. The pentest is still running…"}),t&&g.jsxs("div",{className:"rounded-xl border border-[#222] bg-[rgba(255,255,255,0.02)] p-5",children:[g.jsx("p",{className:"text-sm font-medium text-white",children:"Stay ahead of new exposures"}),g.jsx("p",{className:"mt-0.5 mb-3 text-xs text-[#666]",children:"Attack surface monitoring catches new exposures for your org over time."}),g.jsx(gS,{label:"Attack surface monitoring",desc:"Continuous coverage for your whole org.",slug:"asm",surface:"empty_state",icon:XC})]})]}):g.jsx("div",{className:"space-y-2",children:a.map(s=>g.jsxs("button",{onClick:()=>r(s.id),className:"animate-card-in cursor-pointer w-full text-left rounded-lg border border-[#222] hover:border-[#444] bg-[rgba(255,255,255,0.02)] px-4 py-3 transition-colors flex items-center gap-3",children:[g.jsx("span",{className:`w-2.5 h-2.5 rounded-full flex-shrink-0 ${vp(s.severity)}`,"aria-hidden":"true"}),g.jsxs("span",{className:"flex-1 min-w-0",children:[g.jsx("span",{className:"block text-sm font-medium text-white truncate",children:s.title}),s.target&&g.jsx("span",{className:"block text-xs text-[#666] font-mono truncate",children:s.target})]}),g.jsx("span",{className:`text-xs font-semibold px-2 py-0.5 rounded-full border capitalize ${U_[s.severity]}`,children:s.severity})]},s.id))})}function hH(e){return e.replace(/^\s*#{1,6}[ \t]+.*(?:\r?\n)+/,"").trimStart()}function mH(e){const t=[];let r=null;for(const a of e.split(`
+`)}function D7({args:e,result:t}){const r=e.action??"",a=e.code??e.script??"",s=t;let o=null;s&&typeof s=="object"?o=typeof s.stdout=="string"?s.stdout:null:typeof s=="string"&&(o=s);const c=r==="new_session"?"new session":r==="close"?"close session":r==="list_sessions"?"list sessions":null,d=o?j7(R7(o)):null;return g.jsxs("div",{children:[g.jsxs("div",{className:"flex items-center gap-2",children:[g.jsx("span",{className:"text-yellow-400/80 font-semibold text-sm",children:"Python"}),c&&g.jsx("span",{className:"text-[#888] text-[13px]",children:c})]}),a&&g.jsx(ug,{code:a,language:"python",collapsible:!0}),d&&g.jsx(wi,{className:"text-[#666]",children:d})]})}function L7({args:e}){const t=e.targets,a=(Array.isArray(t)?t:[]).map(s=>typeof s=="object"&&s?s.original??null:null).filter(Boolean);return g.jsxs("div",{children:[g.jsxs("div",{className:"flex items-center gap-2",children:[g.jsx("span",{className:"text-emerald-400/80 font-semibold text-sm",children:"Starting penetration test"}),a.length===1&&g.jsxs("span",{className:"text-[#888] text-[13px]",children:["on ",a[0]]})]}),a.length>1&&g.jsx("div",{className:"mt-1.5 space-y-0.5",children:a.map((s,o)=>g.jsxs("div",{className:"text-[13px] text-[#888]",children:[g.jsx("span",{className:"text-[#555] mr-1",children:"•"}),s]},o))})]})}function z7({args:e}){const t=e.name??"Unknown Agent",r=e.task??"";return g.jsxs("div",{children:[g.jsxs("div",{className:"flex items-center gap-2",children:[g.jsx("span",{className:"text-[#888] text-[13px]",children:"subagent"}),g.jsx("span",{className:"text-purple-400 font-semibold text-sm",children:t})]}),r&&g.jsx("div",{className:"mt-1.5",children:g.jsx(An,{text:r,maxLines:15})})]})}function I7(e){return e.toolName==="subagent_start_info"?g.jsx(z7,{...e}):g.jsx(L7,{...e})}function B7({args:e}){const t=e.executive_summary??"",r=e.methodology??"",a=e.technical_analysis??"",s=e.recommendations??"";return g.jsxs("div",{className:"space-y-3",children:[g.jsx("span",{className:"text-emerald-400/80 font-semibold text-sm",children:"Penetration test completed"}),t&&g.jsxs("div",{children:[g.jsx("span",{className:"text-emerald-400/60 text-sm font-semibold",children:"Executive Summary"}),g.jsx("div",{className:"mt-1",children:g.jsx(An,{text:t,maxLines:25})})]}),r&&g.jsxs("div",{children:[g.jsx("span",{className:"text-emerald-400/60 text-sm font-semibold",children:"Methodology"}),g.jsx("div",{className:"mt-1",children:g.jsx(An,{text:r,maxLines:25})})]}),a&&g.jsxs("div",{children:[g.jsx("span",{className:"text-emerald-400/60 text-sm font-semibold",children:"Technical Analysis"}),g.jsx("div",{className:"mt-1",children:g.jsx(An,{text:a,maxLines:25})})]}),s&&g.jsxs("div",{children:[g.jsx("span",{className:"text-emerald-400/60 text-sm font-semibold",children:"Recommendations"}),g.jsx("div",{className:"mt-1",children:g.jsx(An,{text:s,maxLines:25})})]}),!t&&!r&&!a&&!s&&g.jsx("div",{className:"text-[#555] text-xs",children:"Generating final report..."})]})}function U7({toolName:e,args:t,result:r}){if(e==="create_note"){const a=t.title??"",s=t.content??"",o=t.category??"general";return g.jsxs("div",{children:[g.jsxs("div",{className:"flex items-center gap-2",children:[g.jsx("span",{className:"text-amber-400/80 font-semibold text-sm",children:"note"}),g.jsxs("span",{className:"text-[#555] text-[13px]",children:["(",o,")"]})]}),a&&g.jsx("div",{className:"mt-1.5 text-[#999] text-[13px]",children:a}),s&&g.jsx("div",{className:"mt-1",children:g.jsx($a,{text:s})})]})}if(e==="delete_note")return g.jsx("span",{className:"text-amber-400/80 font-semibold text-sm",children:"note removed"});if(e==="update_note"){const a=t.title??"",s=t.content??"";return g.jsxs("div",{children:[g.jsx("span",{className:"text-amber-400/80 font-semibold text-sm",children:"note updated"}),a&&g.jsx("div",{className:"mt-1.5 text-[#999] text-[13px]",children:a}),s&&g.jsx("div",{className:"mt-1",children:g.jsx($a,{text:s})})]})}if(e==="get_note"){const a=r,s=a&&typeof a=="object"&&a.success?a.note:void 0;return g.jsxs("div",{children:[g.jsx("span",{className:"text-amber-400/80 font-semibold text-sm",children:"note read"}),s&&g.jsxs(g.Fragment,{children:[g.jsxs("div",{className:"mt-1.5 text-[#999] text-[13px]",children:[s.title??"(untitled)",g.jsxs("span",{className:"text-[#555] ml-1",children:["(",s.category??"general",")"]}),(s.by_you||s.agent_name)&&g.jsxs("span",{className:"text-[#666] ml-1 text-xs",children:["by ",s.by_you?"you":s.agent_name]})]}),s.content&&g.jsx("div",{className:"mt-1",children:g.jsx($a,{text:s.content})})]})]})}if(e==="list_notes"){const a=r;let s=[];if(a&&typeof a=="object"&&a.success){const o=a.notes;s=Array.isArray(o)?o:[]}return g.jsxs("div",{children:[g.jsx("span",{className:"text-amber-400/80 font-semibold text-sm",children:"notes"}),s.length>0?g.jsx("div",{className:"mt-1.5 space-y-0.5",children:s.map((o,c)=>g.jsxs("div",{className:"text-[13px]",children:[g.jsx("span",{className:"text-[#555] mr-1",children:"-"}),g.jsx("span",{className:"text-[#999]",children:o.title??"(untitled)"}),g.jsxs("span",{className:"text-[#555] ml-1",children:["(",o.category??"general",")"]}),(o.by_you||o.agent_name)&&g.jsxs("span",{className:"text-[#666] ml-1 text-xs",children:["by ",o.by_you?"you":o.agent_name]}),o.content&&g.jsx("div",{className:"ml-3",children:g.jsx($a,{text:o.content})})]},c))}):g.jsx("div",{className:"mt-1 text-[#555] text-xs",children:"No notes"})]})}return g.jsx("span",{className:"text-amber-400/80 font-semibold text-sm",children:"note"})}const H7={create_todo:{label:"Task added",Icon:VC},list_todos:{label:"Plan",Icon:Gk},update_todo:{label:"Task updated",Icon:qC},mark_todo_done:{label:"Task completed",Icon:R_},mark_todo_pending:{label:"Task reopened",Icon:eT},delete_todo:{label:"Task removed",Icon:hT}};function $7({status:e}){return e==="done"?g.jsx(R_,{className:"w-3.5 h-3.5 text-emerald-400/70 shrink-0"}):e==="in_progress"?g.jsx(rC,{className:"w-3.5 h-3.5 text-purple-400/70 shrink-0 animate-pulse"}):g.jsx(aC,{className:"w-3.5 h-3.5 text-[#444] shrink-0"})}function q7({todos:e,highlightId:t}){return g.jsx("div",{className:"space-y-0",children:e.map((r,a)=>{const s=r.status??"pending",o=t&&r.id===t;return g.jsxs("div",{className:`flex items-start gap-2.5 py-1.5 px-2 -mx-2 rounded-md transition-colors ${o?"bg-purple-500/[0.08]":""}`,children:[g.jsx("div",{className:"mt-[1px]",children:g.jsx($7,{status:s})}),g.jsx("span",{className:`text-[13px] leading-snug ${s==="done"?"text-[#555] line-through":s==="in_progress"?"text-[#bbb]":"text-[#999]"}`,children:r.title??"(untitled)"})]},r.id??a)})})}function P7({toolName:e,args:t,result:r}){const a=H7[e]??{label:"Plan",Icon:ZC},s=a.Icon,o=r;if(typeof o=="string"&&o.trim())return g.jsxs("div",{children:[g.jsxs("div",{className:"flex items-center gap-2",children:[g.jsx(s,{className:"w-3.5 h-3.5 text-purple-400/60"}),g.jsx("span",{className:"text-purple-400/80 font-semibold text-sm",children:a.label})]}),g.jsx("div",{className:"mt-1.5 text-[#888] text-[13px]",children:o.trim()})]});let c=[],d=null,h;if(o&&typeof o=="object"){if(d=o.error??null,o.success){const m=o.todos;c=Array.isArray(m)?m:[]}h=o.id??t.todo_id??void 0}const f=e!=="list_todos"?h:void 0;return c.length===0&&!d?g.jsxs("div",{className:"flex items-center gap-2",children:[g.jsx(s,{className:"w-3.5 h-3.5 text-purple-400/60"}),g.jsx("span",{className:"text-purple-400/80 font-semibold text-sm",children:a.label})]}):g.jsxs("div",{children:[g.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[g.jsx(s,{className:"w-3.5 h-3.5 text-purple-400/60"}),g.jsx("span",{className:"text-purple-400/80 font-semibold text-sm",children:a.label})]}),d&&g.jsx("div",{className:"text-red-400/70 text-[13px] mb-2",children:d}),c.length>0&&g.jsx("div",{className:"rounded-lg border border-white/[0.06] bg-white/[0.015] px-3 py-2",children:g.jsx(q7,{todos:c,highlightId:f})})]})}function d_(e){if(e==null)return null;if(typeof e=="string")return e.trim()?e:null;if(typeof e=="object"){const t=e;if(typeof t.__raw=="string")return t.__raw;if(Object.keys(t).length===0)return null;try{return JSON.stringify(e,null,2)}catch{return String(e)}}return String(e)}function nS({toolName:e,args:t,result:r}){const a=d_(t),s=d_(r);return g.jsxs("div",{children:[g.jsx("span",{className:"text-[#888] font-semibold text-sm",children:e.replace(/_/g," ")}),a&&g.jsx(wi,{className:"text-[#777]",children:a}),s&&g.jsx(wi,{className:"text-[#666]",children:s})]})}function F7({args:e}){const t=e.skills,r=(Array.isArray(t)?t:String(t??"").split(",")).map(a=>String(a).trim()).filter(Boolean);return g.jsxs("div",{className:"flex items-center gap-2",children:[g.jsx("span",{className:"text-emerald-400/80 font-semibold text-sm",children:"Loading skill"}),r.length>0&&g.jsx("span",{className:"text-[#888] text-[13px]",children:r.join(", ")})]})}const ad={terminal:{renderer:e7,icon:B_,color:"text-emerald-400"},python:{renderer:D7,icon:oC,color:"text-yellow-400"},browser:{renderer:n7,icon:z_,color:"text-blue-400"},filesystem:{renderer:r7,icon:gC,color:"text-sky-400"},proxy:{renderer:N7,icon:T_,color:"text-purple-400",match:/request|sitemap|scope/},reporting:{renderer:h7,icon:iT,color:"text-red-400"},thinking:{renderer:S7,icon:M_,color:"text-purple-400"},agents:{renderer:k7,icon:Ao,color:"text-cyan-400",match:/agent/},search:{renderer:C7,icon:nT,color:"text-amber-400"},lifecycle:{renderer:I7,icon:L_,color:"text-emerald-400"},notes:{renderer:U7,icon:uT,color:"text-amber-400",match:/note/},skills:{renderer:F7,icon:Um,color:"text-emerald-400"},todos:{renderer:P7,icon:jC,color:"text-purple-400",match:/todo/},telemetry:{renderer:nS,icon:Um,color:"text-[#555]"}},G7={terminal:["exec_command","write_stdin","terminal_execute"],python:["python_action"],browser:["browser_action"],filesystem:["apply_patch","view_image","str_replace_editor","list_files","search_files"],proxy:["list_requests","view_request","repeat_request","list_sitemap","view_sitemap_entry","scope_rules","send_request"],reporting:["create_vulnerability_report","list_reports","get_report"],thinking:["think"],agents:["create_agent","agent_finish","send_message_to_agent","wait_for_message","view_agent_graph","stop_agent"],search:["web_search"],lifecycle:["scan_start_info","subagent_start_info","finish_scan"],notes:["create_note","delete_note","update_note","list_notes","get_note"],skills:["load_skill"],todos:["create_todo","list_todos","update_todo","mark_todo_done","mark_todo_pending","delete_todo"],telemetry:["sandbox_error_details","llm_error_details"]},V7=Object.fromEntries(Object.entries(G7).flatMap(([e,t])=>t.map(r=>[r,e]))),Y7={finish_scan:B7,apply_patch:u7,view_image:d7,list_reports:l_,get_report:l_},X7={agent_finish:{icon:L_,color:"text-cyan-400"},send_message_to_agent:{icon:ry,color:"text-cyan-400"},wait_for_message:{icon:ry,color:"text-cyan-400"},view_agent_graph:{icon:mC,color:"text-cyan-400"},stop_agent:{icon:A_,color:"text-red-400"},scan_start_info:{icon:dC,color:"text-emerald-400"},subagent_start_info:{icon:Ao,color:"text-purple-400"},view_image:{icon:AC,color:"text-sky-400"}},K7=ad.telemetry;function rS(e){var r;const t=V7[e];if(t)return t;for(const[a,s]of Object.entries(ad))if((r=s.match)!=null&&r.test(e))return a;return null}function Z7(e){const t=Y7[e];if(t)return t;const r=rS(e);return r?ad[r].renderer:nS}function Q7(e){const t=X7[e];if(t)return t;const r=rS(e),a=r?ad[r]:K7;return{icon:a.icon,color:a.color}}const W7=30;function J7({role:e,content:t}){const r=e==="user"||e==="human";return g.jsxs("div",{children:[g.jsx("span",{className:`font-semibold text-sm ${r?"text-blue-400/80":"text-purple-400/80"}`,children:r?"User":"Thinking"}),g.jsx("div",{className:"mt-1.5 italic text-[#888]",children:g.jsx(An,{text:t,maxLines:W7})})]})}class eU extends ee.Component{constructor(t){super(t),this.state={hasError:!1}}static getDerivedStateFromError(){return{hasError:!0}}render(){return this.state.hasError?g.jsx("span",{className:"text-[#555] font-semibold text-sm",children:this.props.toolName.replace(/_/g," ")}):this.props.children}}function tU(e){const t=Z7(e.toolName);return g.jsx(eU,{toolName:e.toolName,children:g.jsx(t,{...e})})}function iS(e){if(e==null||typeof e!="string")return e;const t=e.trim();if(!t)return e;try{return JSON.parse(t)}catch{}try{const r=t.replace(/\bNone\b/g,"null").replace(/\bTrue\b/g,"true").replace(/\bFalse\b/g,"false").replace(/'/g,'"');return JSON.parse(r)}catch{return{__raw:e}}}function aS(e){const t=iS(e);return t&&typeof t=="object"&&!Array.isArray(t)?t:t==null?{}:{__raw:typeof t=="string"?t:JSON.stringify(t)}}function f_(e){const t=/(\d+)$/.exec(e);return t?parseInt(t[1],10):0}function hg(e){var r;const t=(r=e.data)==null?void 0:r.role;return e.type==="chat"&&(t==="user"||t==="human")}function nU(e){var t;return hg(e)&&String(((t=e.data)==null?void 0:t.content)??"").startsWith("[Message from ")}function rU(e){const t=new Set;let r=!1;for(const a of e)if(hg(a)){if(nU(a)){t.add(a.id);continue}r||(r=!0,t.add(a.id))}return t}const iU={completed:"text-emerald-400 border-emerald-500/30 bg-emerald-500/10",running:"text-blue-400 border-blue-500/30 bg-blue-500/10",waiting:"text-yellow-400 border-yellow-500/30 bg-yellow-500/10",stopped:"text-[#aaa] border-[#333] bg-[#1a1a1a]",crashed:"text-red-400 border-red-500/30 bg-red-500/10",failed:"text-red-400 border-red-500/30 bg-red-500/10"};function aU(e){return e==="completed"?"completed":e==="running"?"running":e==="failed"||e==="crashed"?"failed":e}function sU(e,t){var d;const r=new Map;for(const h of e)if(h.parent_id){const f=r.get(h.parent_id)??[];f.push(h.id),r.set(h.parent_id,f)}const a=new Map,s=new Map,o=new Map;for(const h of t)if(h.type==="tool"){if(a.set(h.agent_id,(a.get(h.agent_id)??0)+1),((d=h.data)==null?void 0:d.tool_name)==="create_agent"){const f=aS(h.data.args),m=f.name??f.agent_name??"",p=f.task??"";m&&p&&o.set(m,p)}}else hg(h)||s.set(h.agent_id,(s.get(h.agent_id)??0)+1);const c=new Map;for(const h of e)c.set(h.id,{id:h.id,name:h.name,task:o.get(h.name)??"",status:aU(h.status),parentId:h.parent_id,children:r.get(h.id)??[],createdAt:h.created_at,toolCount:a.get(h.id)??0,messageCount:s.get(h.id)??0});return c}function lU({agent:e,events:t,showHeader:r=!0}){const a=ee.useMemo(()=>{const c=t.filter(h=>h.agent_id===e.id).sort((h,f)=>f_(h.id)-f_(f.id)),d=rU(c);return c.filter(h=>!d.has(h.id))},[t,e.id]),s=a.filter(c=>c.type==="tool").length,o=a.length-s;return g.jsxs("div",{children:[r&&g.jsxs(g.Fragment,{children:[g.jsxs("div",{className:"flex items-center gap-2 flex-wrap mb-1",children:[g.jsx("span",{className:"text-base font-semibold text-white truncate",children:e.name}),g.jsx("span",{className:`flex-shrink-0 text-xs font-medium capitalize px-2 py-0.5 rounded-full border ${iU[e.status]??"text-[#aaa] border-[#333] bg-[#1a1a1a]"}`,children:e.status}),g.jsx("span",{className:"font-mono text-xs text-[#555]",children:e.id})]}),g.jsxs("p",{className:"text-xs text-[#666] mb-4",children:[o," message",o===1?"":"s"," · ",s," tool call",s===1?"":"s"]})]}),a.length===0?g.jsx("p",{className:"text-sm text-[#666]",children:"No recorded activity for this agent."}):g.jsx("div",{className:"py-1",children:a.map((c,d)=>{var N,S,w,k,E,M;const h=d===a.length-1,f=c.type==="tool",m=f?String(((N=c.data)==null?void 0:N.tool_name)??"tool"):"",p=f?"":String(((S=c.data)==null?void 0:S.role)??"assistant");let y,x;if(f){const I=Q7(m);y=I.icon,x=I.color}else{const I=p==="user"||p==="human";y=I?Ao:M_,x=I?"text-blue-400":"text-purple-400"}const _=f?String(((w=c.data)==null?void 0:w.status)??"completed"):"completed";return g.jsxs("div",{className:"flex gap-3",children:[g.jsxs("div",{className:"flex flex-col items-center shrink-0",children:[g.jsx("div",{className:`w-[30px] h-[30px] rounded-full bg-black border flex items-center justify-center shrink-0 ${f&&_==="running"?"border-blue-500/40 animate-pulse":f&&_==="failed"?"border-red-500/30":"border-[#222]"}`,children:g.jsx(y,{className:`w-3.5 h-3.5 ${x}`})}),!h&&g.jsx("div",{className:"w-px flex-1 bg-[#1a1a1a] mt-1"})]}),g.jsx("div",{className:"flex-1 min-w-0 pt-[5px] pb-6",children:f?g.jsx(tU,{toolName:m,args:aS((k=c.data)==null?void 0:k.args),result:iS((E=c.data)==null?void 0:E.result)??null,status:_}):g.jsx(J7,{role:p,content:String(((M=c.data)==null?void 0:M.content)??"")})})]},c.id)})})]})}class Iu extends Error{constructor(t){super(t),this.name="RunParseError"}}const oU=["critical","high","medium","low"];function cU(e){const t=String(e??"").toLowerCase().trim();return oU.includes(t)?t:"low"}function uU(e){if(typeof e=="string"&&e.trim()){const t=e.trim().replace(" UTC","Z").replace(" ","T"),r=new Date(t);if(!Number.isNaN(r.getTime()))return r.toISOString();const a=new Date(e);if(!Number.isNaN(a.getTime()))return a.toISOString()}return new Date().toISOString()}function Ot(e){return typeof e=="string"&&e.length>0?e:null}function dU(e){return typeof e=="number"&&Number.isFinite(e)?e:null}function sS(e,t){try{return JSON.parse(e)}catch{throw new Iu(`${t} isn't valid JSON. Make sure you selected a Strix run directory.`)}}function fU(e){const t=sS(e,"run.json");if(!t||typeof t!="object"||Array.isArray(t))throw new Iu("run.json is not an object.");const r=t,a=[],s=r.targets_info;if(Array.isArray(s)){for(const x of s)if(x&&typeof x=="object"){const _=x.original;typeof _=="string"&&_&&a.push(_)}}const o=Ot(r.start_time),c=Ot(r.end_time);let d=null;if(o&&c){const x=new Date(o).getTime(),_=new Date(c).getTime();!Number.isNaN(x)&&!Number.isNaN(_)&&_>=x&&(d=Math.round((_-x)/1e3))}let h=null,f=null,m=null,p=null;const y=r.scan_results;if(y&&typeof y=="object"){const x=y;h=Ot(x.executive_summary),f=Ot(x.technical_analysis),m=Ot(x.methodology),p=Ot(x.recommendations)}return{runId:Ot(r.run_id),runName:Ot(r.run_name),targets:a,scanMode:Ot(r.scan_mode),status:Ot(r.status),startTime:o,endTime:c,durationSeconds:d,executiveSummary:h,technicalAnalysis:f,methodology:m,recommendations:p}}function hU(){return{pr_review_id:null,cve:null,cvss:null,potential_risk_saving:null,risk_saving_description:null,impact:null,endpoint:null,method:null,target:null,technical_analysis:null,poc_description:null,poc_script_code:null,code_diff:null,code_file:null,code_before:null,code_after:null,cwe:null,code_locations:null,remediation_steps:null,fix_pr_body:null,evidence:null,assumptions:null,fix_effort:null,cvss_breakdown:null,status_changed_at:null,status_changed_by:null,status_note:null,snoozed_until:null,reopened_at:null,reopened_by:null,original_severity:null,severity_changed_at:null,severity_changed_by:null,severity_override_reason:null,retest_of_vulnerability_id:null}}function mU(e,t,r){const a=e.cwe,s=typeof a=="string"&&a.trim()?[a.trim()]:Array.isArray(a)?a.filter(c=>typeof c=="string"&&c):null;return{...hU(),id:Ot(e.id)??`vuln-${t+1}`,scan_id:r,title:Ot(e.title)??"Untitled finding",description:Ot(e.description)??"",severity:cU(e.severity),status:"open",created_at:uU(e.timestamp),cve:Ot(e.cve),cvss:dU(e.cvss),impact:Ot(e.impact),endpoint:Ot(e.endpoint),method:Ot(e.method),target:Ot(e.target),technical_analysis:Ot(e.technical_analysis),poc_description:Ot(e.poc_description),poc_script_code:Ot(e.poc_script_code),cwe:s,code_locations:Array.isArray(e.code_locations)?e.code_locations:null,remediation_steps:Ot(e.remediation_steps),fix_pr_body:Ot(e.fix_pr_body),evidence:Ot(e.evidence),assumptions:Ot(e.assumptions),fix_effort:Ot(e.fix_effort)??null,cvss_breakdown:e.cvss_breakdown??null}}function pU(e,t=null){const r=sS(e,"vulnerabilities.json");if(!Array.isArray(r))throw new Iu("vulnerabilities.json is not a JSON array.");return r.map((a,s)=>{if(!a||typeof a!="object")throw new Iu(`vulnerabilities.json entry #${s+1} is not an object.`);return mU(a,s,t)})}function gU(e){const t={critical:0,high:0,medium:0,low:0};for(const r of e)t[r.severity]+=1;return t}async function Ja(e){const t=await fetch(e,{cache:"no-store"});if(!t.ok)throw new Error(`${e} responded ${t.status}`);return t.json()}function sd(e){return e?`?run=${encodeURIComponent(e)}`:""}async function lS(e){const t=await Ja("/api/run"+sd(e)),r=fU(JSON.stringify(t)),a=t.finished===!0;return{summary:r,raw:t,finished:a}}async function oS(e,t){const r=await Ja("/api/vulnerabilities"+sd(t));return pU(JSON.stringify(r),e)}async function bU(e){const t=await Ja("/api/report"+sd(e));return(t==null?void 0:t.markdown)??null}async function cS(e){const t=await Ja("/api/transcript"+sd(e));return{agents:Array.isArray(t==null?void 0:t.agents)?t.agents:[],events:Array.isArray(t==null?void 0:t.events)?t.events:[]}}async function h_(e){const{summary:t,raw:r,finished:a}=await lS(e),[s,o,c]=await Promise.all([oS(t.runId,e).catch(()=>[]),bU(e).catch(()=>null),cS(e).catch(()=>({agents:[],events:[]}))]);return{summary:t,raw:r,finished:a,vulnerabilities:s,reportMarkdown:o,transcript:c}}async function rl(e,t){const r=await fetch(e,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t),cache:"no-store"});let a={};try{const s=await r.json();s&&typeof s=="object"&&(a=s)}catch{}return{ok:r.ok,status:r.status,data:a}}async function xU(){const e=await Ja("/api/runs");return{locked:(e==null?void 0:e.locked)??!0,count:typeof(e==null?void 0:e.count)=="number"?e.count:0,runs:Array.isArray(e==null?void 0:e.runs)?e.runs:[]}}async function yU(){const e=await Ja("/api/capabilities");return{can_steer:(e==null?void 0:e.can_steer)===!0}}async function vU(e,t){const{ok:r,data:a}=await rl("/api/agents/steer",{agent_id:e,message:t});return r&&a.ok===!0?{ok:!0}:{ok:!1,error:String(a.error??"unavailable")}}async function _U(e,t){const{ok:r,data:a}=await rl("/api/feedback",{message:e,email:t});return r&&a.ok===!0?{ok:!0}:{ok:!1,error:String(a.error??"unavailable")}}async function wU(){const e=await Ja("/api/auth/status");return{verified:(e==null?void 0:e.verified)===!0,email:(e==null?void 0:e.email)??null}}async function uS(e){const{ok:t,data:r}=await rl("/api/auth/otp/start",{email:e});return t&&r.ok===!0?{ok:!0}:{ok:!1,error:String(r.error??"unavailable")}}async function dS(e,t){const{ok:r,data:a}=await rl("/api/auth/otp/verify",{email:e,code:t});return r&&a.verified===!0?{verified:!0,email:String(a.email??e)}:{verified:!1,error:String(a.error??"invalid_code")}}async function EU(){await rl("/api/auth/forget",{})}async function NU(e){const{ok:t,data:r}=await rl("/api/report/send",e?{run:e}:{});return t&&r.ok===!0?{ok:!0,password:String(r.password??""),filename:String(r.filename??"strix-report.pdf")}:{ok:!1,error:String(r.error??"unavailable")}}const Bs="__root__";function fS({agents:e,fixedAgentId:t,className:r}){const a=ee.useRef(null),[s,o]=ee.useState(!1),[c,d]=ee.useState(!1),[h,f]=ee.useState(""),[m,p]=ee.useState(!1),[y,x]=ee.useState(null),_=t!=null,N=ee.useMemo(()=>e.find(z=>!z.parent_id)??e[0]??null,[e]),S=ee.useMemo(()=>e.filter(z=>z.parent_id&&z.status==="running"),[e]),[w,k]=ee.useState(Bs),[E,M]=ee.useState(!1);ee.useEffect(()=>{w!==Bs&&!S.some(z=>z.id===w)&&k(Bs)},[w,S]);const{targetId:I,targetName:R}=ee.useMemo(()=>{if(_){const G=e.find(V=>V.id===t)??null;return{targetId:t??null,targetName:(G==null?void 0:G.name)??"this agent"}}if(w===Bs)return{targetId:(N==null?void 0:N.id)??null,targetName:"Root agent"};const z=e.find(G=>G.id===w)??null;return{targetId:(z==null?void 0:z.id)??(N==null?void 0:N.id)??null,targetName:(z==null?void 0:z.name)??"Root agent"}},[e,t,_,N,w]),$=h.trim().length===0;ee.useLayoutEffect(()=>{const z=a.current;z&&(z.style.height="auto",z.style.height=`${z.scrollHeight}px`)},[h]);const B=ee.useCallback(()=>{o(!0),requestAnimationFrame(()=>{var z;return(z=a.current)==null?void 0:z.focus()})},[]),Z=ee.useCallback(()=>{o(!1),d(!1),M(!1)},[]),j=ee.useCallback(async()=>{if(m)return;const z=h.trim();if(!z||!I)return;p(!0),x(null);const G=R,V=await vU(I,z);p(!1),V.ok?(f(""),x(`Sent to ${G}`),Tr("agent_steered")):V.error==="not_delivered"?x("Could not reach that agent (it may have finished)."):x("Could not send that message. Try again.")},[m,h,I,R]);return s?g.jsxs("div",{className:Mr("mt-4 rounded-2xl border border-white/[0.08] bg-[#050505] overflow-hidden transition-colors duration-300",c?"border-white/[0.18]":"hover:border-white/[0.12]",r),children:[g.jsxs("div",{className:"flex items-center justify-between gap-3 border-b border-white/[0.06] px-5 py-3",children:[g.jsxs("div",{className:"min-w-0",children:[g.jsxs("div",{className:"flex items-center gap-2",children:[g.jsx(Bm,{className:"h-4 w-4 text-[#666]"}),g.jsx("p",{className:"text-sm font-medium text-white",children:"Live prompt"})]}),g.jsx("p",{className:"mt-0.5 text-xs text-[#777]",children:"Connected"})]}),g.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[_?g.jsxs("div",{className:"rounded-full border border-white/[0.08] bg-white/[0.03] px-3 py-1 text-xs text-[#aaa]",children:["Target: ",g.jsx("span",{className:"text-white",children:R})]}):g.jsxs("div",{className:"flex items-center gap-1.5",children:[g.jsx("span",{className:"text-xs text-[#aaa]",children:"Target:"}),g.jsxs("div",{className:"relative",children:[g.jsxs("button",{type:"button",onClick:()=>M(z=>!z),onBlur:()=>requestAnimationFrame(()=>M(!1)),className:"inline-flex h-7 items-center gap-1 rounded-full border border-white/[0.08] bg-white/[0.03] px-3 text-xs text-white transition-colors hover:border-white/[0.16] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-white/20","aria-haspopup":"listbox","aria-expanded":E,children:[g.jsx("span",{className:"max-w-[140px] truncate",children:R}),g.jsx(ho,{className:"h-3.5 w-3.5 text-[#999]"})]}),E&&g.jsxs("div",{className:"absolute right-0 z-10 mt-1 min-w-[160px] overflow-hidden rounded-lg border border-[#333] bg-[#0a0a0a] py-1 shadow-xl",role:"listbox",children:[g.jsx(m_,{label:"Root agent",active:w===Bs,onSelect:()=>{k(Bs),M(!1)}}),S.map(z=>g.jsx(m_,{label:z.name,active:w===z.id,onSelect:()=>{k(z.id),M(!1)}},z.id))]})]})]}),g.jsx("button",{type:"button",onClick:Z,className:"inline-flex h-7 w-7 items-center justify-center rounded-full text-[#777] transition-colors hover:bg-white/[0.06] hover:text-white focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-white/20","aria-label":"Collapse live prompt composer",children:g.jsx(ho,{className:"h-4 w-4"})})]})]}),g.jsx("div",{className:"px-5 pt-4 pb-3",children:g.jsx("textarea",{ref:a,rows:1,value:h,onChange:z=>f(z.target.value),onFocus:()=>d(!0),onBlur:()=>d(!1),onKeyDown:z=>{z.key==="Enter"&&!z.shiftKey&&(z.preventDefault(),j())},placeholder:"Send a live prompt to the running pentest…",maxLength:4e3,disabled:m,className:"block w-full resize-none border-0 bg-transparent p-0 text-[15px] leading-6 text-white placeholder:text-[#444] focus:outline-none disabled:opacity-60 max-h-[160px] overflow-y-auto"})}),g.jsxs("div",{className:"flex items-center justify-between gap-3 px-4 pb-4",children:[g.jsx("div",{className:"text-xs text-[#666]",children:y??"Press Enter to send."}),g.jsxs("button",{type:"button",onClick:z=>{z.stopPropagation(),j()},disabled:m||$,className:Mr("inline-flex h-10 min-w-[112px] items-center justify-center gap-2 rounded-full px-4 text-sm font-medium transition-colors",m||$?"bg-white/[0.08] text-[#666]":"bg-white text-black hover:bg-neutral-200"),children:[m?g.jsx(qs,{className:"h-4 w-4 animate-spin"}):g.jsx(zk,{className:"h-4 w-4",strokeWidth:2.5}),g.jsx("span",{children:"Send prompt"})]})]})]}):g.jsxs("button",{type:"button",onClick:B,className:Mr("mt-4 flex w-full items-center justify-between gap-3 rounded-2xl border border-white/[0.08] bg-[#050505] px-5 py-3 text-left transition-colors duration-300 hover:border-white/[0.12] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-white/20",r),"aria-expanded":!1,"aria-label":"Expand live prompt composer",children:[g.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[g.jsx(Bm,{className:"h-4 w-4 shrink-0 text-[#666]"}),g.jsx("span",{className:"truncate text-sm font-medium text-white",children:"Guide the agent"})]}),g.jsx(O_,{className:"h-4 w-4 shrink-0 text-[#777]"})]})}function m_({label:e,active:t,onSelect:r}){return g.jsx("button",{type:"button",role:"option","aria-selected":t,onMouseDown:a=>{a.preventDefault(),r()},className:Mr("block w-full truncate px-3 py-1.5 text-left text-xs transition-colors hover:bg-white/[0.06]",t?"text-white":"text-[#aaa]"),children:e})}const SU={completed:"bg-emerald-400",running:"bg-blue-400",waiting:"bg-yellow-400",stopped:"bg-[#888]",crashed:"bg-red-400",failed:"bg-red-400"},kU=80;function CU({open:e,agent:t,events:r,steerable:a,onClose:s}){const o=ee.useRef(null),c=ee.useRef(!1),[d,h]=ee.useState(e),[f,m]=ee.useState(e?"open":"closed"),[p,y]=ee.useState(!1),x=ee.useRef(t);ee.useEffect(()=>{t&&(x.current=t)},[t]);const _=t??x.current;ee.useEffect(()=>{if(e){h(!0),m("open");return}m("closed");const S=setTimeout(()=>h(!1),140);return()=>clearTimeout(S)},[e]),ee.useEffect(()=>{if(!d){y(!1);return}const S=requestAnimationFrame(()=>y(!0));return()=>cancelAnimationFrame(S)},[d]);const N=ee.useCallback(()=>{const S=o.current;S&&(c.current=S.scrollHeight-S.scrollTop-S.clientHeight{const S=o.current;!S||!c.current||requestAnimationFrame(()=>{S.scrollTo({top:S.scrollHeight,behavior:"smooth"})})},[r]),ee.useEffect(()=>{if(!d)return;const S=k=>{k.key==="Escape"&&s()};document.addEventListener("keydown",S);const w=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.removeEventListener("keydown",S),document.body.style.overflow=w}},[d,s]),!d||!_?null:g.jsx("div",{"data-state":f,className:"agent-modal fixed inset-0 z-50 flex items-center justify-center bg-black/80 p-4 sm:p-8",onClick:s,role:"dialog","aria-modal":"true","aria-label":`Agent ${_.name}`,children:g.jsxs("div",{className:"relative flex h-[60vh] w-[calc(100vw-4rem)] max-w-6xl flex-col overflow-hidden rounded-xl border border-[#222] bg-[#0a0a0a] shadow-2xl",onClick:S=>S.stopPropagation(),children:[g.jsxs("div",{className:"flex items-center justify-between gap-3 border-b border-[#222] px-5 py-3.5",children:[g.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[g.jsx("span",{className:`h-2 w-2 flex-shrink-0 rounded-full ${SU[_.status]??"bg-[#888]"}`}),g.jsx("span",{className:"truncate text-sm font-semibold text-white",children:_.name}),g.jsx("span",{className:"flex-shrink-0 font-mono text-xs text-[#555]",children:_.id})]}),g.jsx("button",{type:"button",onClick:s,"aria-label":"Close",className:"flex-shrink-0 rounded-md p-1 text-[#888] transition-colors hover:bg-[#1a1a1a] hover:text-white",children:g.jsx(yp,{className:"h-4 w-4"})})]}),g.jsx("div",{ref:o,onScroll:N,className:"flex-1 overflow-y-auto p-5",children:p&&g.jsx(lU,{agent:_,events:r,showHeader:!1})}),a&&g.jsx("div",{className:"border-t border-[#222] px-5 py-3",children:g.jsx(fS,{agents:[_],fixedAgentId:_.id,className:"mt-0"})})]})})}var hS={color:void 0,size:void 0,className:void 0,style:void 0,attr:void 0},p_=ua.createContext&&ua.createContext(hS),TU=["attr","size","title"];function AU(e,t){if(e==null)return{};var r,a,s=MU(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(a=0;aua.createElement(t.tag,Uu({key:r},t.attr),mS(t.child)))}function mg(e){return t=>ua.createElement(DU,Bu({attr:Uu({},e.attr)},t),mS(e.child))}function DU(e){var t=r=>{var a=e.attr,s=e.size,o=e.title,c=AU(e,TU),d=s||r.size||"1em",h;return r.className&&(h=r.className),e.className&&(h=(h?h+" ":"")+e.className),ua.createElement("svg",Bu({stroke:"currentColor",fill:"currentColor",strokeWidth:"0"},r.attr,a,c,{className:h,style:Uu(Uu({color:e.color||r.color},r.style),e.style),height:d,width:d,xmlns:"http://www.w3.org/2000/svg"}),o&&ua.createElement("title",null,o),e.children)};return p_!==void 0?ua.createElement(p_.Consumer,null,r=>t(r)):t(hS)}function LU(e){return mg({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"circle",attr:{cx:"5",cy:"6",r:"3"},child:[]},{tag:"path",attr:{d:"M5 9v12"},child:[]},{tag:"circle",attr:{cx:"19",cy:"18",r:"3"},child:[]},{tag:"path",attr:{d:"m15 9-3-3 3-3"},child:[]},{tag:"path",attr:{d:"M12 6h5a2 2 0 0 1 2 2v7"},child:[]}]})(e)}function zU(e){return mg({attr:{viewBox:"0 0 16 16",fill:"currentColor"},child:[{tag:"path",attr:{d:"M15 4.95703C15 4.58711 14.8563 4.24054 14.5949 3.97992L12.0096 1.39234C11.4879 0.86922 10.5788 0.86922 10.0571 1.39234L8 3.45119V3.32321C8 2.55068 7.37187 1.922 6.6 1.922H2.4C1.62813 1.922 1 2.55068 1 3.32321V13.5988C1 14.3713 1.62813 15 2.4 15H12.6667C13.4385 15 14.0667 14.3713 14.0667 13.5988V9.39514C14.0667 8.62261 13.4385 7.99393 12.6667 7.99393H12.5379L14.5949 5.93508C14.8553 5.67445 15 5.32602 15 4.95703ZM2.4 2.85521H6.6C6.85667 2.85521 7.06667 3.06446 7.06667 3.32228V7.99299H1.93333V3.32228C1.93333 3.06446 2.14333 2.85521 2.4 2.85521ZM1.93333 13.5979V8.92714H7.06667V14.0649H2.4C2.14333 14.0649 1.93333 13.8547 1.93333 13.5979ZM13.1333 9.39421V13.5979C13.1333 13.8547 12.9233 14.0649 12.6667 14.0649H8V8.92714H12.6667C12.9233 8.92714 13.1333 9.13638 13.1333 9.39421ZM8 7.99299V6.46287L9.5288 7.99299H8ZM13.9351 5.2737L11.3488 7.86221C11.1789 8.03223 10.8859 8.03223 10.716 7.86221L8.12973 5.2737C8.0448 5.18963 7.99813 5.07753 7.99813 4.95796C7.99813 4.83839 8.0448 4.7263 8.12973 4.64129L10.716 2.05278C10.8009 1.96777 10.9129 1.92106 11.0324 1.92106C11.1519 1.92106 11.2639 1.96777 11.3488 2.05278L13.9351 4.64129C14.02 4.72536 14.0667 4.83746 14.0667 4.95703C14.0667 5.0766 14.02 5.1887 13.9351 5.2737Z"},child:[]}]})(e)}function pS(e){return mg({attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{fill:"none",strokeLinecap:"round",strokeMiterlimit:"10",strokeWidth:"32",d:"M431 320.6c-1-3.6 1.2-8.6 3.3-12.2a34 34 0 0 1 2.1-3.1A162 162 0 0 0 464 215c.3-92.2-77.5-167-173.7-167-83.9 0-153.9 57.1-170.3 132.9a160.7 160.7 0 0 0-3.7 34.2c0 92.3 74.8 169.1 171 169.1 15.3 0 35.9-4.6 47.2-7.7s22.5-7.2 25.4-8.3a26.4 26.4 0 0 1 9.3-1.7 26 26 0 0 1 10.1 2l56.7 20.1a13.5 13.5 0 0 0 3.9 1 8 8 0 0 0 8-8 13 13 0 0 0-.5-2.7z"},child:[]},{tag:"path",attr:{fill:"none",strokeLinecap:"round",strokeMiterlimit:"10",strokeWidth:"32",d:"M66.46 232a146.23 146.23 0 0 0 6.39 152.67c2.31 3.49 3.61 6.19 3.21 8s-11.93 61.87-11.93 61.87a8 8 0 0 0 2.71 7.68A8.17 8.17 0 0 0 72 464a7.3 7.3 0 0 0 2.91-.6l56.21-22a15.7 15.7 0 0 1 12 .2c18.94 7.38 39.88 12 60.83 12A159.2 159.2 0 0 0 284 432.11"},child:[]}]})(e)}const IU=[{icon:_C,label:"PR security reviews"},{icon:lT,label:"Attack surface monitoring"},{icon:ET,label:"Real-time threat intelligence"},{icon:Pk,label:"Scheduled pentesting"},{icon:yT,label:"One-click autofix"},{icon:FC,label:"Jira, Linear & Slack integrations"}];function BU({open:e,onClose:t,description:r,source:a="sidebar"}){const[s,o]=ee.useState(e),[c,d]=ee.useState(e?"open":"closed");return ee.useEffect(()=>{if(e){o(!0),d("open");return}d("closed");const h=setTimeout(()=>o(!1),200);return()=>clearTimeout(h)},[e]),ee.useEffect(()=>{if(!s)return;const h=m=>{m.key==="Escape"&&t()};document.addEventListener("keydown",h);const f=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.removeEventListener("keydown",h),document.body.style.overflow=f}},[s,t]),s?g.jsx("div",{"data-state":c,className:"dialog-overlay fixed inset-0 z-50 flex items-center justify-center bg-black/80 p-4",onClick:t,role:"dialog","aria-modal":"true","aria-label":"Upgrade your plan",children:g.jsxs("div",{"data-state":c,className:"dialog-panel relative w-full max-w-md rounded-2xl border border-[#222] bg-black p-6 shadow-lg sm:rounded-lg",onClick:h=>h.stopPropagation(),children:[g.jsx("button",{type:"button",onClick:t,"aria-label":"Close",className:"absolute right-4 top-4 rounded-md p-1 text-[#888] transition-colors hover:bg-[#1a1a1a] hover:text-white",children:g.jsx(yp,{className:"h-4 w-4"})}),g.jsxs("div",{children:[g.jsx("h2",{className:"text-lg text-white",children:"Available in Strix Cloud"}),r&&g.jsx("p",{className:"mt-2 text-base leading-relaxed text-[#e5e5e5]",children:r})]}),g.jsxs("div",{className:"space-y-4 pt-4",children:[g.jsxs("div",{className:"rounded-xl border border-[#333] bg-[#0a0a0a] p-4 sm:rounded-lg",children:[g.jsxs("div",{className:"mb-3 flex items-center gap-2",children:[g.jsx(Bm,{className:"h-4 w-4 text-blue-400"}),g.jsx("span",{className:"text-sm font-medium text-white",children:"Strix Cloud also includes"})]}),g.jsx("ul",{className:"space-y-2 text-sm text-[#888]",children:IU.map(h=>g.jsxs("li",{className:"flex items-center gap-2",children:[g.jsx(h.icon,{className:"h-3.5 w-3.5 text-[#555]"}),h.label]},h.label))})]}),g.jsxs("div",{className:"flex flex-col gap-2",children:[g.jsxs("a",{href:fa($u,"upgrade_try_free"),target:"_blank",rel:"noopener noreferrer",onClick:()=>jr("upgrade_try_free",a),className:"flex h-10 w-full items-center justify-center gap-2 rounded-lg bg-white px-4 text-sm font-semibold text-black transition-colors hover:bg-neutral-200",children:["Open Strix Cloud",g.jsx(ny,{className:"h-3.5 w-3.5"})]}),g.jsxs("a",{href:fa(TT,"upgrade_view_plans"),target:"_blank",rel:"noopener noreferrer",onClick:()=>jr("upgrade_view_plans",a),className:"flex h-9 w-full items-center justify-center gap-1.5 rounded-lg border border-[#333] px-4 text-sm font-medium text-[#888] transition-colors hover:border-[#555] hover:text-white",children:["Learn more",g.jsx(ny,{className:"h-3 w-3"})]})]})]})]})}):null}const Dm=160,Lm=260,ro=400,UU=140,b_="strix_viewer_sidebar_width",x_="strix_viewer_sidebar_collapsed";function HU(e,t){try{const r=localStorage.getItem(e),a=r?parseInt(r,10):NaN;return Number.isFinite(a)?a:t}catch{return t}}function $U({view:e,onSelectView:t,issuesCount:r,agentCount:a,runCount:s,finished:o,verified:c,email:d,onOpenEmail:h,onOpenHistory:f,onForget:m}){var z;const[p,y]=ee.useState(()=>{const G=HU(b_,Lm);return Math.min(ro,Math.max(Dm,G))}),[x,_]=ee.useState(()=>{try{return localStorage.getItem(x_)==="1"}catch{return!1}}),[N,S]=ee.useState(!1),[w,k]=ee.useState(!1),[E,M]=ee.useState(null),I=ee.useRef(null),R=(G,V)=>{jr(G,"sidebar"),M(V)},$=ee.useCallback(G=>{y(G);try{localStorage.setItem(b_,String(G))}catch{}},[]),B=ee.useCallback(G=>{_(G);try{localStorage.setItem(x_,G?"1":"0")}catch{}},[]),Z=ee.useCallback(()=>{B(!1),$(Lm)},[B,$]),j=ee.useCallback(G=>{G.preventDefault(),S(!0)},[]);return ee.useEffect(()=>{if(!N||x)return;const G=T=>{const U=T.clientX;U>=Dm&&U<=ro?y(U):U>ro&&y(ro)},V=T=>{const U=T.clientX;U{window.removeEventListener("mousemove",G),window.removeEventListener("mouseup",V)}},[N,x,B,$]),ee.useEffect(()=>{if(!w)return;const G=V=>{I.current&&!I.current.contains(V.target)&&k(!1)};return document.addEventListener("mousedown",G),()=>document.removeEventListener("mousedown",G)},[w]),g.jsxs(g.Fragment,{children:[x&&g.jsx("div",{className:"fixed left-0 top-0 z-40 hidden h-full w-4 cursor-pointer transition-colors hover:bg-[rgba(255,255,255,0.08)] lg:block",onClick:Z,title:"Expand sidebar"}),g.jsxs("aside",{className:Mr("sticky top-0 z-20 hidden h-screen flex-shrink-0 flex-col overflow-hidden border-r border-[rgba(255,255,255,0.08)] bg-black lg:flex",!N&&"transition-[width] duration-200 ease-out"),style:{width:x?0:p},children:[g.jsx("header",{className:"relative flex flex-col gap-1 pt-1 min-w-[160px]",children:g.jsx("div",{className:"flex flex-row py-1 px-2",children:g.jsxs("div",{className:"flex h-10 w-full flex-row items-center",children:[g.jsxs("a",{href:fa("https://app.strix.ai","logo"),target:"_blank",rel:"noopener noreferrer",onClick:()=>jr("logo","sidebar"),className:"flex flex-1 flex-row items-center gap-2 rounded-md py-2 pl-2.5 pr-1 min-w-0 transition-colors hover:bg-[rgba(255,255,255,0.06)]",title:"Open Strix Cloud",children:[g.jsx("span",{className:"flex flex-shrink-0 items-center justify-center rounded-full bg-gradient-to-br from-emerald-400 to-cyan-500",style:{width:20,height:20},children:g.jsx("span",{className:"text-[10px] font-semibold text-white",children:"S"})}),g.jsxs("span",{className:"flex flex-1 flex-row items-center gap-2 min-w-0",children:[g.jsx("span",{className:"truncate min-w-0 text-[14px] font-medium text-[#ededed]",children:"Strix"}),g.jsx("span",{className:"flex h-5 flex-shrink-0 items-center rounded px-2 text-[11px] font-medium text-[#888] bg-[rgba(255,255,255,0.08)]",children:"Local"})]})]}),g.jsx("a",{href:fa("https://app.strix.ai","logo"),target:"_blank",rel:"noopener noreferrer",onClick:()=>jr("logo","sidebar"),className:"flex flex-none items-center rounded-md px-1.5 py-2 transition-colors hover:bg-[rgba(255,255,255,0.06)]","aria-label":"Open Strix Cloud",children:g.jsx(Wk,{className:"h-4 w-4 text-[#666]"})})]})})}),g.jsx("nav",{className:"relative min-w-[160px] flex-1 overflow-y-auto overflow-x-clip scrollbar-thin pb-10 pt-2",children:g.jsxs("div",{className:"relative flex flex-col gap-px px-2",children:[g.jsx(yi,{icon:g.jsx(qU,{}),label:"Pentest Overview",active:e==="overview",onClick:()=>t("overview")}),g.jsx(yi,{icon:g.jsx(pT,{className:"h-4 w-4"}),label:"Issues",count:r>0?r:void 0,active:e==="issues",onClick:()=>t("issues")}),a>0&&g.jsx(yi,{icon:g.jsx(Ao,{className:"h-4 w-4"}),label:"Agents",count:a,active:e==="agents",onClick:()=>t("agents")}),g.jsx(yi,{icon:g.jsx(Vs,{className:"h-4 w-4"}),label:"Past runs",count:s>0?s:void 0,active:e==="history",onClick:f}),o&&g.jsx(yi,{icon:g.jsx(xp,{className:"h-4 w-4"}),label:"Export report",active:e==="email",onClick:h}),g.jsx(yi,{icon:g.jsx(pS,{className:"h-4 w-4"}),label:"Feedback & support",active:e==="feedback",onClick:()=>t("feedback")}),g.jsx("hr",{className:"mx-0 my-1 h-px w-full border-0 bg-[rgba(255,255,255,0.08)]"}),g.jsx(yi,{icon:g.jsx(LU,{className:"h-4 w-4"}),label:"PR Security Reviews",active:!1,onClick:()=>R("pr_reviews","Strix reviews every pull request and flags exploitable changes before they merge.")}),g.jsx(yi,{icon:g.jsx(zU,{className:"h-4 w-4"}),label:"Integrations",active:!1,onClick:()=>R("integrations","Sync findings to Jira, Linear, and Slack so fixes happen where your team already works.")}),g.jsx(yi,{icon:g.jsx(bT,{className:"h-4 w-4"}),label:"Members",active:!1,onClick:()=>R("members","Invite your team, set roles, and share findings and run history across your org.")})]})}),g.jsx("section",{className:"flex min-w-[160px] flex-col gap-0.5",ref:I,children:g.jsxs("div",{className:"relative p-2",children:[c&&d?g.jsxs("button",{onClick:()=>k(G=>!G),className:"relative flex w-full cursor-pointer items-center gap-2 rounded-md bg-transparent px-2.5 py-2 transition-colors hover:bg-[rgba(255,255,255,0.06)]",children:[g.jsx("span",{className:"flex flex-shrink-0 items-center justify-center rounded-full bg-gradient-to-br from-emerald-400 to-cyan-500",style:{width:20,height:20},children:g.jsx("span",{className:"text-[9px] font-semibold text-white",children:((z=d[0])==null?void 0:z.toUpperCase())||"U"})}),g.jsxs("span",{className:"flex min-w-0 flex-1 flex-col text-left",children:[g.jsx("span",{className:"truncate text-[13px] font-medium text-[#ededed]",children:d}),g.jsx("span",{className:"truncate text-[11px] text-[#555]",children:"Linked to this machine"})]})]}):g.jsxs("div",{className:"flex items-center gap-2 rounded-md px-2.5 py-2",children:[g.jsx("span",{className:"flex flex-shrink-0 items-center justify-center rounded-full bg-gradient-to-br from-emerald-400 to-cyan-500",style:{width:20,height:20},children:g.jsx("span",{className:"text-[9px] font-semibold text-white",children:"S"})}),g.jsx("span",{className:"flex min-w-0 flex-1 flex-col text-left",children:g.jsx("span",{className:"truncate text-[13px] font-medium text-[#ededed]",children:"Local viewer"})})]}),w&&c&&d&&g.jsxs("div",{className:"absolute bottom-full left-2 right-2 z-50 mb-1 overflow-hidden rounded-lg border border-[#333] bg-black shadow-xl",children:[g.jsxs("div",{className:"border-b border-[#333] px-3 py-2",children:[g.jsx("p",{className:"truncate text-[13px] font-medium text-white",children:"Linked email"}),g.jsx("p",{className:"truncate text-[11px] text-[#666]",children:d})]}),g.jsxs("button",{onClick:()=>{k(!1),m()},className:"flex w-full items-center gap-2 px-3 py-2 text-[13px] text-[#888] transition-colors hover:bg-[rgba(255,255,255,0.06)] hover:text-red-400",children:[g.jsx(BC,{className:"h-4 w-4"}),"Forget this email"]})]})]})}),g.jsx("div",{className:"group absolute right-0 top-0 z-30 h-full w-1 cursor-col-resize",onMouseDown:j,children:g.jsx("div",{className:Mr("absolute right-0 top-0 h-full w-px bg-[rgba(255,255,255,0.08)] transition-all duration-100",N?"w-0.5 bg-[rgba(255,255,255,0.3)]":"group-hover:bg-[rgba(255,255,255,0.2)]")})})]}),N&&g.jsx("div",{className:"fixed inset-0 z-10 cursor-col-resize"}),g.jsx(BU,{open:E!==null,description:E??"",source:"sidebar",onClose:()=>M(null)})]})}function yi({icon:e,label:t,active:r,onClick:a,count:s}){return g.jsxs("button",{onClick:a,className:Mr("group flex h-9 w-full origin-left flex-row items-center rounded-md transition-colors",r?"bg-[rgba(255,255,255,0.12)] text-white":"text-[#888] hover:bg-[rgba(255,255,255,0.06)] hover:text-[#ededed]"),children:[g.jsx("div",{className:"grid flex-none place-content-center",style:{width:36,height:36},children:e}),g.jsx("span",{className:"min-w-0 flex-1 truncate text-left text-[14px] font-medium",children:t}),s!=null&&g.jsx("span",{className:"mr-2 flex-none rounded-full border border-white/10 px-2 py-0.5 text-[10px] tabular-nums leading-none text-[#777]",children:s})]})}function qU(){return g.jsx("svg",{style:{width:16,height:16,color:"currentcolor"},viewBox:"0 0 16 16",fill:"currentColor",children:g.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M2.5 5.5V2.5H5.5V5.5H2.5ZM1 2C1 1.44772 1.44772 1 2 1H6C6.55228 1 7 1.44772 7 2V6C7 6.55228 6.55228 7 6 7H2C1.44772 7 1 6.55228 1 6V2ZM2.5 13.5V10.5H5.5V13.5H2.5ZM1 10C1 9.44772 1.44772 9 2 9H6C6.55228 9 7 9.44772 7 10V14C7 14.5523 6.55228 15 6 15H2C1.44772 15 1 14.5523 1 14V10ZM10.5 2.5V5.5H13.5V2.5H10.5ZM10 1C9.44772 1 9 1.44772 9 2V6C9 6.55228 9.44772 7 10 7H14C14.5523 7 15 6.55228 15 6V2C15 1.44772 14.5523 1 14 1H10ZM10.5 13.5V10.5H13.5V13.5H10.5ZM9 10C9 9.44772 9.44772 9 10 9H14C14.5523 9 15 9.44772 15 10V14C15 14.5523 14.5523 15 14 15H10C9.44772 15 9 14.5523 9 14V10Z"})})}const y_={work_email_required:"Please use your work email, not a personal one.",rate_limited:"Too many requests. Wait a minute and try again.",invalid_email:"That email does not look right. Check it and try again.",unavailable:"The email service is unavailable right now. Try again shortly."},PU=new Set(["gmail.com","googlemail.com","yahoo.com","ymail.com","outlook.com","hotmail.com","live.com","icloud.com","me.com","aol.com","proton.me","protonmail.com","gmx.com","mail.com"]);function FU({onVerified:e}){const[t,r]=ee.useState("email"),[a,s]=ee.useState(""),[o,c]=ee.useState(""),[d,h]=ee.useState(!1),[f,m]=ee.useState(null),[p,y]=ee.useState(null),x=async()=>{const N=a.trim();if(!N){m("Enter your email to continue.");return}const S=N.slice(N.lastIndexOf("@")+1).toLowerCase();if(PU.has(S)){Tr("work_email_required"),m(y_.work_email_required);return}h(!0),m(null);const w=await uS(N);h(!1),w.ok?(Tr("email_submitted",{purpose:"verify"}),y(`We sent a 6-digit code to ${N}.`),r("code")):(w.error==="work_email_required"&&Tr("work_email_required"),m(y_[w.error]??"Could not send a code. Try again."))},_=async()=>{const N=o.trim();if(N.length<4){m("Enter the 6-digit code from your email.");return}h(!0),m(null);const S=await dS(a.trim(),N);if(h(!1),!S.verified){m("That code did not match. Check it and try again.");return}Tr("email_verified",{purpose:"verify"}),e()};return g.jsxs("div",{className:"mx-auto mt-5 max-w-sm text-left",children:[f&&g.jsxs("div",{className:"mb-3 flex items-start gap-2 rounded-lg border border-red-500/30 bg-red-500/5 px-3 py-2",children:[g.jsx(Hu,{className:"mt-0.5 h-4 w-4 flex-shrink-0 text-red-400","aria-hidden":"true"}),g.jsx("p",{className:"text-xs text-red-300",children:f})]}),p&&!f&&g.jsx("p",{className:"mb-3 text-xs text-[#888]",children:p}),t==="email"?g.jsxs("form",{className:"space-y-3",onSubmit:N=>{N.preventDefault(),x()},children:[g.jsxs("label",{className:"block",children:[g.jsx("span",{className:"mb-1.5 block text-xs text-[#888]",children:"Your work email"}),g.jsx("input",{type:"email",autoFocus:!0,value:a,onChange:N=>s(N.target.value),placeholder:"you@company.com",className:"w-full rounded-lg bg-black px-3 py-2.5 text-sm text-white outline-none transition-colors focus:border-[#444]",style:{border:"1px solid #2a2a2a"}}),g.jsx("span",{className:"mt-1.5 block text-[11px] text-[#666]",children:"Use your work email."})]}),g.jsxs("button",{type:"submit",disabled:d,className:"flex w-full cursor-pointer items-center justify-center gap-2 rounded-lg bg-white px-4 py-2.5 text-sm font-semibold text-black transition-opacity hover:opacity-90 disabled:opacity-60",children:[d&&g.jsx(qs,{className:"h-4 w-4 animate-spin","aria-hidden":"true"}),"Send me a code"]})]}):g.jsxs("form",{className:"space-y-3",onSubmit:N=>{N.preventDefault(),_()},children:[g.jsxs("label",{className:"block",children:[g.jsx("span",{className:"mb-1.5 block text-xs text-[#888]",children:"6-digit code"}),g.jsx("input",{inputMode:"numeric",autoFocus:!0,value:o,onChange:N=>c(N.target.value.replace(/\D/g,"").slice(0,6)),placeholder:"123456",className:"w-full rounded-lg bg-black px-3 py-2.5 text-center text-lg font-mono tracking-[0.4em] text-white outline-none transition-colors focus:border-[#444]",style:{border:"1px solid #2a2a2a"}})]}),g.jsxs("button",{type:"submit",disabled:d,className:"flex w-full cursor-pointer items-center justify-center gap-2 rounded-lg bg-white px-4 py-2.5 text-sm font-semibold text-black transition-opacity hover:opacity-90 disabled:opacity-60",children:[d&&g.jsx(qs,{className:"h-4 w-4 animate-spin","aria-hidden":"true"}),"Verify"]}),g.jsx("button",{type:"button",onClick:()=>{r("email"),m(null),y(null)},className:"w-full cursor-pointer text-center text-xs text-[#666] transition-colors hover:text-[#aaa]",children:"Use a different email"})]})]})}const GU=[{key:"critical",dot:"bg-red-500",text:"text-red-500"},{key:"high",dot:"bg-orange-500",text:"text-orange-500"},{key:"medium",dot:"bg-yellow-500",text:"text-yellow-500"},{key:"low",dot:"bg-blue-500",text:"text-blue-500"}];function VU({counts:e}){const t=GU.filter(r=>e[r.key]>0);return t.length===0?g.jsx("span",{className:"text-xs text-[#555]",children:"No findings"}):g.jsx("div",{className:"flex items-center gap-3",children:t.map(r=>g.jsxs("div",{className:"flex items-center gap-1.5",children:[g.jsx("span",{className:`h-2 w-2 rounded-full ${r.dot}`,"aria-hidden":"true"}),g.jsx("span",{className:`text-xs tabular-nums ${r.text}`,children:e[r.key]})]},r.key))})}function YU(e){if(!e)return null;const t=e.trim().replace(" UTC","Z").replace(" ","T"),r=new Date(t);return Number.isNaN(r.getTime())?null:r.toLocaleString(void 0,{month:"short",day:"numeric",hour:"numeric",minute:"2-digit"})}function v_(e){if(!e)return null;const t=e.trim().replace(" UTC","Z").replace(" ","T"),r=new Date(t);if(Number.isNaN(r.getTime()))return null;const a=Date.now()-r.getTime(),s=Math.floor(a/6e4);if(s<1)return"just now";if(s<60)return`${s}m ago`;const o=Math.floor(s/60);if(o<24)return`${o}h ago`;const c=Math.floor(o/24);return c<7?`${c}d ago`:YU(e)}function XU({runs:e,activeRun:t,onSelectRun:r,onVerified:a}){const s=(e==null?void 0:e.count)??0,[o,c]=ee.useState(!1);return!e||e.locked?g.jsxs("div",{className:"rounded-xl border border-[#222] bg-[rgba(255,255,255,0.02)] p-8 text-center",children:[g.jsx("div",{className:"mx-auto mb-4 flex h-11 w-11 items-center justify-center rounded-xl",style:{border:"1px solid #2a2a2a",background:"rgba(255,255,255,0.04)"},children:g.jsx(Vs,{className:"h-5 w-5 text-[#888]","aria-hidden":"true"})}),g.jsx("h2",{className:"text-base font-semibold text-white",children:"Browse every run on this machine"}),g.jsxs("p",{className:"mx-auto mt-1.5 max-w-md text-sm text-[#888]",children:["You have ",s," past ",s===1?"run":"runs"," on this machine."]}),o?g.jsxs(g.Fragment,{children:[g.jsx("p",{className:"mx-auto mt-3 max-w-sm text-xs text-[#666]",children:"Verify your email with a one-time code to unlock the full history."}),g.jsx(FU,{onVerified:a})]}):g.jsx("button",{onClick:()=>{jr("history_unlock","past_runs"),c(!0)},className:"mt-4 cursor-pointer rounded-lg bg-white px-4 py-2 text-sm font-semibold text-black transition-opacity hover:opacity-90",children:"View runs"}),g.jsxs("p",{className:"mt-4 flex items-center justify-center gap-1.5 text-xs text-[#555]",children:[g.jsx(B_,{className:"h-3.5 w-3.5","aria-hidden":"true"}),"Or open one from the CLI with"," ",g.jsx("code",{className:"font-mono text-[#888]",children:"strix view "})]})]}):e.runs.length===0?g.jsx("div",{className:"rounded-xl border border-[#222] bg-[rgba(255,255,255,0.02)] p-8 text-center text-sm text-[#888]",children:"No past runs found on this machine yet."}):g.jsx("div",{className:"space-y-2",children:e.runs.map(d=>{const h=d.name===t,f=v_(d.start_time)??v_(d.end_time),m=bo(d.target,d.name);return g.jsxs("button",{onClick:()=>r(d.name),className:`animate-card-in group flex w-full cursor-pointer items-center gap-4 rounded-lg border px-4 py-3 text-left transition-colors ${h?"border-[#444] bg-[rgba(255,255,255,0.04)]":"border-[#222] bg-[rgba(255,255,255,0.02)] hover:border-[#444]"}`,children:[g.jsxs("div",{className:"min-w-0 flex-1",children:[g.jsxs("div",{className:"flex items-center gap-2",children:[g.jsx("span",{className:"truncate text-sm font-medium text-white",children:m}),h&&g.jsx("span",{className:"rounded-full px-1.5 py-0.5 text-[10px] font-semibold uppercase tracking-wide text-emerald-400",style:{border:"1px solid rgba(16,185,129,0.3)"},children:"Active"})]}),g.jsxs("div",{className:"mt-0.5 flex flex-wrap items-center gap-x-2 gap-y-0.5 text-xs text-[#666]",children:[d.scan_mode&&g.jsx("span",{className:"capitalize",children:d.scan_mode}),d.scan_mode&&(f||d.status)&&g.jsx("span",{className:"text-[#333]",children:"·"}),f&&g.jsx("span",{children:f}),f&&d.status&&g.jsx("span",{className:"text-[#333]",children:"·"}),d.status&&g.jsx("span",{className:"capitalize",children:d.status})]})]}),g.jsx(VU,{counts:d.severity_counts}),g.jsx(Kk,{className:"h-4 w-4 flex-shrink-0 text-[#555] transition-colors group-hover:text-[#aaa]","aria-hidden":"true"})]},d.name)})})}const __={work_email_required:"Please use your work email, not a personal one.",rate_limited:"Too many requests. Wait a minute and try again.",invalid_email:"That email does not look right. Check it and try again.",unavailable:"The email service is unavailable right now. Try again shortly."},KU={forbidden:"This email was unsubscribed from Strix, so we cannot send to it.",too_large:"This report is too large to email. Try a smaller run.",unavailable:"The email service is unavailable right now. Try again shortly."},ZU=new Set(["gmail.com","googlemail.com","yahoo.com","ymail.com","outlook.com","hotmail.com","live.com","icloud.com","me.com","aol.com","proton.me","protonmail.com","gmx.com","mail.com"]);function QU({activeRun:e,auth:t,purpose:r,skipDisclosure:a=!1,onAuthChanged:s,onExit:o}){const c=(t==null?void 0:t.verified)===!0,d=r==="verify",[h,f]=ee.useState(()=>d?"email":a?c?"sending":"email":"disclosure"),[m,p]=ee.useState((t==null?void 0:t.email)??""),[y,x]=ee.useState(""),[_,N]=ee.useState(!1),[S,w]=ee.useState(null),[k,E]=ee.useState(null),[M,I]=ee.useState(""),[R,$]=ee.useState(""),[B,Z]=ee.useState(!1),[j,z]=ee.useState(""),G=ee.useRef(!1),V=async()=>{f("sending"),w(null);const K=await NU(e);if(K.ok){Tr("report_sent"),I(K.password),$(K.filename),f("password");return}if(K.error==="reverify"||K.error==="unverified"){E("Your verification expired. Enter your email to verify again."),f("email");return}w(KU[K.error]??"Could not send the report. Try again."),f("disclosure")},T=()=>{w(null),E(null),c?V():f("email")};ee.useEffect(()=>{!d&&a&&c&&!G.current&&(G.current=!0,V())},[]);const U=async()=>{const K=m.trim();if(!K){w("Enter your email to continue.");return}const C=K.slice(K.lastIndexOf("@")+1).toLowerCase();if(ZU.has(C)){Tr("work_email_required"),w(__.work_email_required);return}N(!0),w(null);const D=await uS(K);N(!1),D.ok?(Tr("email_submitted",{purpose:r}),E(`We sent a 6-digit code to ${K}.`),f("code")):(D.error==="work_email_required"&&Tr("work_email_required"),w(__[D.error]??"Could not send a code. Try again."))},O=async()=>{const K=y.trim();if(K.length<4){w("Enter the 6-digit code from your email.");return}N(!0),w(null);const C=await dS(m.trim(),K);if(N(!1),!C.verified){w("That code did not match. Check it and try again.");return}Tr("email_verified",{purpose:r}),z(C.email),s(),d?o("history"):V()},H=async()=>{try{await navigator.clipboard.writeText(M),Z(!0),setTimeout(()=>Z(!1),1500)}catch{}},X=j||(t==null?void 0:t.email)||m.trim();return g.jsxs("div",{className:"mx-auto max-w-xl space-y-4",children:[g.jsxs("button",{onClick:()=>o(d?"history":"overview"),className:"cursor-pointer inline-flex items-center gap-1.5 text-sm text-[#888] transition-colors hover:text-white",children:[g.jsx(bp,{className:"h-4 w-4"}),d?"Back to past runs":"Back to results"]}),g.jsxs("div",{className:"flex items-center gap-2",children:[g.jsx(xp,{className:"h-5 w-5 text-[#888]","aria-hidden":"true"}),g.jsx("h1",{className:"text-2xl font-semibold text-white",children:d?"Verify your email":"Export report to PDF"})]}),g.jsxs("div",{className:"w-full rounded-2xl bg-[rgba(255,255,255,0.02)] p-6",style:{border:"1px solid #2a2a2a"},children:[g.jsx("p",{className:"mb-4 text-xs text-[#666]",children:d?"We send a one-time code to confirm it is you.":"Verified by a one-time code sent to your email"}),S&&g.jsxs("div",{className:"mb-4 flex items-start gap-2 rounded-lg border border-red-500/30 bg-red-500/5 px-3 py-2",children:[g.jsx(Hu,{className:"mt-0.5 h-4 w-4 flex-shrink-0 text-red-400","aria-hidden":"true"}),g.jsx("p",{className:"text-xs text-red-300",children:S})]}),k&&!S&&h!=="password"&&g.jsx("p",{className:"mb-4 text-xs text-[#888]",children:k}),h==="disclosure"&&g.jsxs("div",{className:"space-y-4",children:[g.jsxs("div",{className:"space-y-2.5 rounded-lg p-3.5",style:{border:"1px solid #222",background:"rgba(255,255,255,0.02)"},children:[g.jsxs("div",{className:"flex items-start gap-2.5",children:[g.jsx(I_,{className:"mt-0.5 h-4 w-4 flex-shrink-0 text-emerald-400","aria-hidden":"true"}),g.jsxs("p",{className:"text-xs leading-relaxed text-[#aaa]",children:["We email an ",g.jsx("span",{className:"text-white",children:"encrypted PDF"}),". Nothing else leaves your machine."]})]}),g.jsxs("div",{className:"flex items-start gap-2.5",children:[g.jsx(zC,{className:"mt-0.5 h-4 w-4 flex-shrink-0 text-[#888]","aria-hidden":"true"}),g.jsx("p",{className:"text-xs leading-relaxed text-[#aaa]",children:"Only you hold the password; Strix can't read it."})]})]}),g.jsx("button",{onClick:T,className:"w-full cursor-pointer rounded-lg bg-white px-4 py-2.5 text-sm font-semibold text-black transition-opacity hover:opacity-90",children:"Export report"}),c&&(t==null?void 0:t.email)&&g.jsxs("p",{className:"text-center text-xs text-[#666]",children:["Sending to ",t.email]})]}),h==="email"&&g.jsxs("form",{className:"space-y-4",onSubmit:K=>{K.preventDefault(),U()},children:[g.jsxs("label",{className:"block",children:[g.jsx("span",{className:"mb-1.5 block text-xs text-[#888]",children:"Your work email"}),g.jsx("input",{type:"email",autoFocus:!0,value:m,onChange:K=>p(K.target.value),placeholder:"you@company.com",className:"w-full rounded-lg bg-black px-3 py-2.5 text-sm text-white outline-none transition-colors focus:border-[#444]",style:{border:"1px solid #2a2a2a"}})]}),g.jsxs("button",{type:"submit",disabled:_,className:"flex w-full cursor-pointer items-center justify-center gap-2 rounded-lg bg-white px-4 py-2.5 text-sm font-semibold text-black transition-opacity hover:opacity-90 disabled:opacity-60",children:[_&&g.jsx(qs,{className:"h-4 w-4 animate-spin","aria-hidden":"true"}),"Send me a code"]})]}),h==="code"&&g.jsxs("form",{className:"space-y-4",onSubmit:K=>{K.preventDefault(),O()},children:[g.jsxs("label",{className:"block",children:[g.jsx("span",{className:"mb-1.5 block text-xs text-[#888]",children:"6-digit code"}),g.jsx("input",{inputMode:"numeric",autoFocus:!0,value:y,onChange:K=>x(K.target.value.replace(/\D/g,"").slice(0,6)),placeholder:"123456",className:"w-full rounded-lg bg-black px-3 py-2.5 text-center text-lg font-mono tracking-[0.4em] text-white outline-none transition-colors focus:border-[#444]",style:{border:"1px solid #2a2a2a"}})]}),g.jsxs("button",{type:"submit",disabled:_,className:"flex w-full cursor-pointer items-center justify-center gap-2 rounded-lg bg-white px-4 py-2.5 text-sm font-semibold text-black transition-opacity hover:opacity-90 disabled:opacity-60",children:[_&&g.jsx(qs,{className:"h-4 w-4 animate-spin","aria-hidden":"true"}),d?"Verify":"Verify and send"]}),g.jsx("button",{type:"button",onClick:()=>{f("email"),w(null),E(null)},className:"w-full cursor-pointer text-center text-xs text-[#666] transition-colors hover:text-[#aaa]",children:"Use a different email"})]}),h==="sending"&&g.jsxs("div",{className:"flex flex-col items-center gap-3 py-8",children:[g.jsx(qs,{className:"h-6 w-6 animate-spin text-white","aria-hidden":"true"}),g.jsx("p",{className:"text-sm text-[#aaa]",children:"Generating and encrypting locally..."})]}),h==="password"&&g.jsxs("div",{className:"space-y-4",children:[g.jsxs("div",{className:"flex items-start gap-2.5 rounded-lg border border-emerald-500/30 bg-emerald-500/5 px-3 py-2.5",children:[g.jsx(Gs,{className:"mt-0.5 h-4 w-4 flex-shrink-0 text-emerald-400","aria-hidden":"true"}),g.jsxs("p",{className:"text-xs text-emerald-200",children:["Sent to ",X,". Open the attached PDF with this password."]})]}),g.jsxs("div",{children:[g.jsx("span",{className:"mb-1.5 block text-xs text-[#888]",children:"Your one-time password"}),g.jsxs("div",{className:"flex items-center gap-2 rounded-lg bg-black p-3",style:{border:"1px solid #2a2a2a"},children:[g.jsx("code",{className:"flex-1 break-all font-mono text-base text-white",children:M}),g.jsxs("button",{onClick:H,className:"flex cursor-pointer items-center gap-1 rounded-md px-2 py-1 text-xs text-[#aaa] transition-colors hover:bg-[rgba(255,255,255,0.06)] hover:text-white",style:{border:"1px solid #2a2a2a"},children:[B?g.jsx(Gs,{className:"h-3.5 w-3.5"}):g.jsx(mo,{className:"h-3.5 w-3.5"}),B?"Copied":"Copy"]})]}),g.jsxs("p",{className:"mt-2 text-xs text-[#666]",children:["Save this now. Strix never stores it, so we cannot show it again. File:"," ",g.jsx("span",{className:"font-mono text-[#888]",children:R})]})]}),g.jsx("button",{onClick:()=>o("overview"),className:"w-full cursor-pointer rounded-lg px-4 py-2.5 text-sm font-semibold text-white transition-colors hover:bg-[rgba(255,255,255,0.06)]",style:{border:"1px solid #2a2a2a"},children:"Done"})]})]})]})}function la(e){return e&&typeof e=="object"&&!Array.isArray(e)?e:{}}function io(e){return Array.isArray(e)?e:[]}function Fn(e){return typeof e=="string"&&e.trim()?e:null}function Ia(e){return typeof e=="number"&&Number.isFinite(e)?e:null}function WU(e){return e.replace(/_/g," ")}function w_(e){return e&&e.charAt(0).toUpperCase()+e.slice(1)}function JU(e){if(e==null||e<0)return"n/a";const t=Math.floor(e/3600),r=Math.floor(e%3600/60),a=e%60;return t?`${t}h ${r}m ${a}s`:r?`${r}m ${a}s`:`${a}s`}function wn({label:e,children:t}){return g.jsxs("div",{className:"grid grid-cols-[7rem_1fr] gap-3 items-baseline",children:[g.jsx("dt",{className:"text-[11px] uppercase tracking-wide text-[#666]",children:e}),g.jsx("dd",{className:"min-w-0 break-words text-sm text-[#ddd]",children:t})]})}function eH({raw:e,durationSeconds:t}){const[r,a]=ee.useState(!0),s=io(e.targets_info).map(T=>{const U=la(T),O=Fn(U.original)??Fn(la(U.details).target_url)??"unknown target",H=Fn(U.type);return{display:O,type:H?WU(H):null}}),o=Fn(e.instruction),c=w_(Fn(e.scan_mode)),d=Fn(e.scope_mode),h=la(e.diff_scope),f=h.active===!0,m=Fn(h.mode),p=Fn(e.diff_base),y=e.non_interactive===!0,x=io(e.local_sources).map(T=>{if(typeof T=="string")return T;const U=la(T);return Fn(U.source_path)??Fn(U.target_path)??""}).filter(Boolean),_=w_(Fn(e.status));let N=d??"auto";f&&(N+=` (diff${m?`: ${m}`:""}${p?` vs ${p}`:""})`);const S=la(e.llm_usage),w=Object.keys(S).length>0,k=io(S.agents).map(la),E=Array.from(new Set(k.map(T=>Fn(T.model)).filter(T=>!!T))),M=Ia(S.requests),I=Ia(S.input_tokens),R=Ia(la(io(S.input_tokens_details)[0]).cached_tokens),$=Ia(S.output_tokens),B=Ia(la(io(S.output_tokens_details)[0]).reasoning_tokens),Z=Ia(S.total_tokens),j=Ia(S.cost),z=Fn(e.auth_mode)==="subscription",G=Fn(e.subscription_provider),V=(T,U)=>g.jsxs("span",{className:"text-[#666]",children:[" (",Ds(T)," ",U,")"]});return g.jsxs("div",{className:"rounded-xl border border-[#222] bg-[rgba(255,255,255,0.02)] p-5",children:[g.jsxs("button",{type:"button",onClick:()=>a(T=>!T),"aria-expanded":r,className:"flex w-full cursor-pointer items-center gap-2 text-left",children:[g.jsx(OC,{className:"h-4 w-4 text-[#888]","aria-hidden":"true"}),g.jsx("h2",{className:"text-sm font-semibold text-white",children:"Run details"}),r?g.jsx(O_,{className:"ml-auto h-4 w-4 text-[#666]","aria-hidden":"true"}):g.jsx(ho,{className:"ml-auto h-4 w-4 text-[#666]","aria-hidden":"true"})]}),r&&g.jsxs("div",{className:"mt-4 grid grid-cols-1 gap-x-8 gap-y-6 md:grid-cols-2",children:[g.jsxs("section",{children:[g.jsx("h3",{className:"mb-3 text-[11px] font-semibold uppercase tracking-wide text-[#555]",children:"Configuration"}),g.jsxs("dl",{className:"space-y-2.5",children:[s.length>0&&g.jsx(wn,{label:"Targets",children:g.jsx("div",{className:"space-y-1",children:s.map((T,U)=>g.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[g.jsx("span",{className:"font-mono text-[#ddd]",children:T.display}),T.type&&g.jsx("span",{className:"rounded-full border border-[#2a2a2a] px-1.5 py-0.5 text-[10px] text-[#888]",children:T.type})]},U))})}),g.jsx(wn,{label:"Instruction",children:o?g.jsx("span",{className:"whitespace-pre-wrap",children:o}):g.jsx("span",{className:"text-[#666]",children:"None"})}),c&&g.jsx(wn,{label:"Pentest mode",children:c}),g.jsx(wn,{label:"Scope",children:N}),g.jsx(wn,{label:"Mode",children:y?"Non-interactive":"Interactive"}),x.length>0&&g.jsx(wn,{label:"Local sources",children:g.jsx("div",{className:"space-y-0.5 font-mono text-[#ddd]",children:x.map((T,U)=>g.jsx("div",{children:T},U))})}),_&&g.jsx(wn,{label:"Status",children:_})]})]}),g.jsxs("section",{children:[g.jsx("h3",{className:"mb-3 text-[11px] font-semibold uppercase tracking-wide text-[#555]",children:"Usage & cost"}),w?g.jsxs("dl",{className:"space-y-2.5 tabular-nums",children:[g.jsx(wn,{label:"Model",children:E.length?E.join(", "):"n/a"}),z&&g.jsx(wn,{label:"Provider",children:g.jsx("span",{className:"inline-flex items-center gap-1.5",children:g.jsx("span",{className:"rounded-full border border-[#22c55e]/40 bg-[#22c55e]/10 px-2 py-0.5 text-[11px] text-[#22c55e]",children:G?`${G} subscription`:"Subscription"})})}),g.jsx(wn,{label:"Run time",children:JU(t)}),M!=null&&g.jsx(wn,{label:"Requests",children:Ds(M)}),I!=null&&g.jsxs(wn,{label:"Input tokens",children:[Ds(I),R!=null&&V(R,"cached")]}),$!=null&&g.jsxs(wn,{label:"Output tokens",children:[Ds($),B!=null&&V(B,"reasoning")]}),Z!=null&&g.jsx(wn,{label:"Total tokens",children:Ds(Z)}),z?g.jsxs(wn,{label:"Cost",children:[g.jsx("span",{className:"text-[#22c55e]",children:"$0.00"}),g.jsx("span",{className:"text-[#666]",children:" (subscription)"})]}):j!=null&&g.jsxs(wn,{label:"Cost",children:["$",j.toFixed(2)]}),k.length>0&&g.jsx(wn,{label:"Agents",children:Ds(k.length)})]}):g.jsx("p",{className:"text-sm text-[#666]",children:"Not available yet."})]})]})]})}const E_="strix_viewer_trust_dismissed";function tH({message:e}){const[t,r]=ee.useState(()=>{try{return localStorage.getItem(E_)==="1"}catch{return!1}});if(t)return null;const a=()=>{try{localStorage.setItem(E_,"1")}catch{}r(!0)};return g.jsx("div",{className:"fixed bottom-3 left-3 z-[60] max-w-xs rounded-lg bg-[#0a0a0a] p-3 shadow-2xl",style:{border:"1px solid #2a2a2a"},role:"status",children:g.jsxs("div",{className:"flex gap-2.5",children:[g.jsx(I_,{className:"mt-0.5 h-4 w-4 flex-shrink-0 text-emerald-400","aria-hidden":"true"}),g.jsx("p",{className:"text-xs leading-relaxed text-[#aaa]",children:e}),g.jsx("button",{onClick:a,"aria-label":"Dismiss",className:"-mr-0.5 -mt-0.5 flex-shrink-0 cursor-pointer rounded p-0.5 text-[#666] transition-colors hover:text-white",children:g.jsx(yp,{className:"h-3.5 w-3.5"})})]})})}const nH=5e3,N_={invalid_email:"That email doesn't look right.",invalid_message:"Please write a little more.",unavailable:"Couldn't send that just now. Try again."};function rH({defaultEmail:e,onExit:t}){const[r,a]=ee.useState(""),[s,o]=ee.useState(e??""),[c,d]=ee.useState("form"),[h,f]=ee.useState(null),m=r.trim().length>0&&s.trim().length>0&&c!=="sending",p=async()=>{if(!m)return;d("sending"),f(null);const y=await _U(r.trim(),s.trim());if(y.ok){d("sent");return}d("form"),f(N_[y.error]??N_.unavailable)};return g.jsxs("div",{className:"mx-auto max-w-xl space-y-4",children:[g.jsxs("button",{onClick:()=>t("overview"),className:"cursor-pointer inline-flex items-center gap-1.5 text-sm text-[#888] transition-colors hover:text-white",children:[g.jsx(bp,{className:"h-4 w-4"}),"Back to results"]}),g.jsxs("div",{className:"flex items-center gap-2",children:[g.jsx(pS,{className:"h-5 w-5 text-[#888]","aria-hidden":"true"}),g.jsx("h1",{className:"text-2xl font-semibold text-white",children:"Feedback & support"})]}),g.jsx("div",{className:"w-full rounded-2xl bg-[rgba(255,255,255,0.02)] p-6",style:{border:"1px solid #2a2a2a"},children:c==="sent"?g.jsxs("div",{className:"flex items-start gap-3",children:[g.jsx(j_,{className:"mt-0.5 h-5 w-5 flex-shrink-0 text-emerald-400","aria-hidden":"true"}),g.jsxs("div",{className:"min-w-0",children:[g.jsx("p",{className:"text-sm font-semibold text-white",children:"Thanks, we got it."}),g.jsx("p",{className:"mt-1 text-xs text-[#888]",children:"We read every message. If it needs a reply, we'll reach out to the email you gave."}),g.jsx("button",{onClick:()=>{a(""),d("form")},className:"mt-4 cursor-pointer text-xs text-[#888] transition-colors hover:text-white",children:"Send more feedback"})]})]}):g.jsxs(g.Fragment,{children:[g.jsx("p",{className:"mb-4 text-xs text-[#666]",children:"Bugs, feature requests, or anything else. Tell us what's on your mind."}),h&&g.jsxs("div",{className:"mb-4 flex items-start gap-2 rounded-lg border border-red-500/30 bg-red-500/5 px-3 py-2",children:[g.jsx(Hu,{className:"mt-0.5 h-4 w-4 flex-shrink-0 text-red-400","aria-hidden":"true"}),g.jsx("p",{className:"text-xs text-red-300",children:h})]}),g.jsxs("label",{className:"block",children:[g.jsx("span",{className:"mb-1.5 block text-xs text-[#888]",children:"Your feedback"}),g.jsx("textarea",{autoFocus:!0,value:r,maxLength:nH,onChange:y=>a(y.target.value),rows:5,placeholder:"What's working, what's not, what you'd love to see…",className:"w-full resize-y rounded-lg border border-[#2a2a2a] bg-black px-3 py-2.5 text-sm text-white outline-none transition-colors focus:border-white/50 focus:ring-2 focus:ring-white/10"})]}),g.jsxs("label",{className:"mt-4 block",children:[g.jsx("span",{className:"mb-1.5 block text-xs text-[#888]",children:"Your work email"}),g.jsx("input",{type:"email",value:s,onChange:y=>o(y.target.value),placeholder:"you@company.com",className:"w-full rounded-lg border border-[#2a2a2a] bg-black px-3 py-2.5 text-sm text-white outline-none transition-colors focus:border-white/50 focus:ring-2 focus:ring-white/10"})]}),g.jsx("button",{onClick:()=>void p(),disabled:!m,className:"mt-4 flex w-full cursor-pointer items-center justify-center gap-2 rounded-lg bg-white px-4 py-2.5 text-sm font-semibold text-black transition-opacity hover:opacity-90 disabled:opacity-60",children:c==="sending"?"Sending…":"Send feedback"})]})})]})}function iH({text:e,children:t,className:r=""}){const[a,s]=ee.useState(!1);return g.jsxs("span",{className:`relative inline-flex ${r}`,onMouseEnter:()=>s(!0),onMouseLeave:()=>s(!1),onFocus:()=>s(!0),onBlur:()=>s(!1),children:[t,a&&g.jsx("span",{role:"tooltip",className:"pointer-events-none absolute bottom-full left-1/2 z-50 mb-2 w-max max-w-[240px] -translate-x-1/2 rounded-md px-2.5 py-1.5 text-xs text-[#ddd] shadow-lg",style:{border:"1px solid #2a2a2a",background:"#0a0a0a"},children:e})]})}function gS({label:e,desc:t,slug:r,icon:a,surface:s}){return g.jsx(iH,{text:t,children:g.jsxs("a",{href:fa($u,r),target:"_blank",rel:"noopener noreferrer",onClick:()=>jr(r,s),className:"group inline-flex items-center gap-2 rounded-lg border border-[#222] bg-[rgba(255,255,255,0.02)] px-3 py-2 text-sm text-[#aaa] transition-colors hover:border-[#444] hover:text-white",children:[g.jsx(a,{className:"h-4 w-4 text-[#888] transition-colors group-hover:text-white","aria-hidden":"true"}),g.jsx("span",{children:e})]})})}const aH="Your findings stay on your machine. They're rendered here locally in your browser and never uploaded or stored by Strix.",S_=["critical","high","medium","low"],sH=500;function lH(){const[e,t]=ee.useState(null),[r,a]=ee.useState(null),[s,o]=ee.useState(null),[c,d]=ee.useState(null),[h,f]=ee.useState("overview"),[m,p]=ee.useState(null),[y,x]=ee.useState(null),[_,N]=ee.useState("report"),[S,w]=ee.useState(!1),[k,E]=ee.useState(!1),M=ee.useCallback(async()=>{try{p(await wU())}catch{}},[]),I=ee.useCallback(async()=>{try{x(await xU())}catch{}},[]);ee.useEffect(()=>{M(),I(),yU().then(C=>E(C.can_steer)).catch(()=>{})},[M,I]);const R=ee.useRef(!1);ee.useEffect(()=>{let C=!1,D;R.current=!1;const Y=()=>{D=setTimeout(L,sH)},L=async()=>{if(!C)try{const{summary:F,raw:q,finished:Q}=await lS(e);if(C)return;if(Q&&!R.current){R.current=!0;const te=await h_(e);C||a(te);return}const[J,W]=await Promise.all([cS(e).catch(()=>({agents:[],events:[]})),oS(F.runId,e).catch(()=>[])]);if(C)return;a(te=>({summary:F,raw:q,finished:Q,transcript:J,vulnerabilities:W,reportMarkdown:(te==null?void 0:te.reportMarkdown)??null})),Y()}catch(F){if(C)return;o(F instanceof Error?F.message:"Could not load run data."),Y()}};return(async()=>{try{const F=await h_(e);if(C)return;a(F),F.finished?R.current=!0:Y()}catch(F){if(C)return;o(F instanceof Error?F.message:"Could not load run data."),Y()}})(),()=>{C=!0,D&&clearTimeout(D)}},[e]);const $=ee.useMemo(()=>r?gU(r.vulnerabilities):null,[r]),B=(r==null?void 0:r.vulnerabilities.find(C=>C.id===c))??null,Z=(r==null?void 0:r.transcript.agents.length)??0,j=(m==null?void 0:m.verified)===!0,z=ee.useRef(!1);ee.useEffect(()=>{z.current=!1},[e]),ee.useEffect(()=>{z.current||!r||(r.finished?(z.current=!0,f("overview")):Z>0&&(z.current=!0,f("agents")))},[r,Z]);const G=ee.useCallback(C=>{z.current=!0,f(C)},[]),V=ee.useCallback(C=>{t(C),d(null),a(null),o(null),z.current=!1},[]),T=ee.useCallback((C,D)=>{jr("email_report",D),N("report"),w(C),G("email")},[G]),U=ee.useCallback(()=>T(!1,"sidebar"),[T]),O=ee.useCallback(()=>T(!0,"overview"),[T]),H=ee.useCallback(()=>{I(),G("history")},[I,G]),X=ee.useCallback(async()=>{await M(),await I()},[M,I]),K=ee.useCallback(async()=>{await EU(),await M(),await I()},[M,I]);return g.jsxs("div",{className:"min-h-screen bg-black text-white flex",children:[g.jsx($U,{view:h,onSelectView:C=>{d(null),C==="history"?H():G(C)},issuesCount:(r==null?void 0:r.vulnerabilities.length)??0,agentCount:Z,runCount:(y==null?void 0:y.count)??0,finished:(r==null?void 0:r.finished)??!1,verified:j,email:(m==null?void 0:m.email)??null,onOpenEmail:U,onOpenHistory:H,onForget:()=>void K()}),g.jsxs("div",{className:"flex-1 min-w-0",children:[g.jsx("div",{className:"border-b border-[#222]",children:g.jsxs("div",{className:"max-w-[88rem] mx-auto px-3 sm:px-6 py-4 flex items-center gap-1.5",children:[g.jsxs("a",{href:fa("https://app.strix.ai","logo"),target:"_blank",rel:"noopener noreferrer",onClick:()=>jr("logo","topbar"),className:"flex items-center gap-1.5 opacity-90 transition-opacity hover:opacity-100 lg:hidden",title:"Open Strix Cloud",children:[g.jsx("img",{src:"./logo.png",alt:"Strix",className:"w-10 h-8 object-cover"}),g.jsx("div",{className:"text-base text-white font-medium tracking-tight",children:"Strix"})]}),r&&g.jsx(cH,{finished:r.finished}),g.jsxs("div",{className:"ml-auto flex items-center gap-3",children:[j&&y&&!y.locked&&y.runs.length>0&&g.jsx(oH,{runs:y,activeRun:e,launchedName:bo((r==null?void 0:r.summary.targets[0])??null,(r==null?void 0:r.summary.runName)??(r==null?void 0:r.summary.runId)??"Current run"),onSelect:V}),g.jsxs("a",{href:fa($u,"run_in_cloud"),target:"_blank",rel:"noopener noreferrer",onClick:()=>jr("run_in_cloud","topbar"),className:"inline-flex items-center gap-1 rounded-lg bg-white px-3 py-1.5 text-xs font-semibold text-black transition-opacity hover:opacity-90",children:["Run in the cloud",g.jsx(T_,{className:"w-3 h-3","aria-hidden":"true"})]})]})]})}),g.jsxs("div",{className:"max-w-[88rem] mx-auto px-3 sm:px-6 py-8 sm:py-12 space-y-6",children:[s&&!r&&h!=="history"&&h!=="email"&&g.jsxs("div",{className:"rounded-lg px-4 py-3 flex gap-3 items-start border border-red-500/30 bg-red-500/5",children:[g.jsx(Hu,{className:"w-5 h-5 flex-shrink-0 mt-0.5 text-red-400","aria-hidden":"true"}),g.jsx("p",{className:"text-sm text-red-300",children:s})]}),g.jsx("div",{className:"animate-page-in space-y-6",children:h==="email"?g.jsx(QU,{activeRun:e,auth:m,purpose:_,skipDisclosure:S,onAuthChanged:()=>{M(),I()},onExit:C=>f(C==="history"?"history":"overview")}):h==="feedback"?g.jsx(rH,{defaultEmail:(m==null?void 0:m.email)??null,onExit:C=>f(C)}):h==="history"?g.jsxs("div",{className:"space-y-4",children:[g.jsxs("div",{className:"flex items-center gap-2",children:[g.jsx(Vs,{className:"w-5 h-5 text-[#888]","aria-hidden":"true"}),g.jsx("h1",{className:"text-2xl font-semibold text-white",children:"Past runs"})]}),g.jsx(XU,{runs:y,activeRun:e,onSelectRun:V,onVerified:()=>void X()})]}):!r&&!s?g.jsxs("div",{className:"rounded-xl border border-[#222] bg-[rgba(255,255,255,0.02)] p-10 text-center",children:[g.jsx("div",{className:"w-6 h-6 mx-auto mb-3 rounded-full border-2 border-[#333] border-t-white animate-spin"}),g.jsx("p",{className:"text-sm text-[#888]",children:"Loading run data…"})]}):r&&$?g.jsxs(g.Fragment,{children:[g.jsx(dH,{summary:r.summary}),g.jsxs("div",{className:"flex gap-5 border-b border-[#2a2a2a] lg:hidden",children:[g.jsx(Im,{active:h==="overview",onClick:()=>G("overview"),children:"Pentest Overview"}),g.jsxs(Im,{active:h==="issues",onClick:()=>G("issues"),children:["Issues",r.vulnerabilities.length>0?` (${r.vulnerabilities.length})`:""]}),Z>0&&g.jsxs(Im,{active:h==="agents",onClick:()=>G("agents"),children:["Agents (",Z,")"]})]}),h==="overview"?g.jsx(gH,{summary:r.summary,counts:$,total:r.vulnerabilities.length,reportMarkdown:r.reportMarkdown,raw:r.raw,finished:r.finished,onOpenEmail:O}):h==="agents"&&Z>0?g.jsx(bH,{run:r,canSteer:k}):B?g.jsxs("div",{className:"space-y-4",children:[g.jsxs("button",{onClick:()=>d(null),className:"cursor-pointer inline-flex items-center gap-1.5 text-sm text-[#888] hover:text-white transition-colors",children:[g.jsx(bp,{className:"w-4 h-4"})," Back to all findings"]}),g.jsx(tD,{vulnerability:B})]}):g.jsx(fH,{vulnerabilities:r.vulnerabilities,finished:r.finished,onSelect:C=>d(C)})]}):null},`${e??"launched"}:${h}:${c??""}`)]})]}),g.jsx(tH,{message:aH})]})}function oH({runs:e,activeRun:t,launchedName:r,onSelect:a}){const[s,o]=ee.useState(!1),c=e.runs.find(h=>h.name===t),d=c?bo(c.target,c.name):r;return g.jsxs("div",{className:"relative",children:[g.jsxs("button",{onClick:()=>o(h=>!h),onBlur:()=>setTimeout(()=>o(!1),150),"aria-label":"Switch pentest",className:"flex items-center gap-2 rounded-lg border border-[#3a3a3a] bg-[rgba(255,255,255,0.05)] px-3 py-2 text-sm text-white transition-colors hover:border-[#555] hover:bg-[rgba(255,255,255,0.09)]",children:[g.jsx(Vs,{className:"h-4 w-4 flex-shrink-0 text-[#888]","aria-hidden":"true"}),g.jsx("span",{className:"flex-shrink-0 text-[#888]",children:"Pentest"}),g.jsx("span",{className:"max-w-[260px] truncate font-medium",children:d}),g.jsx(ho,{className:"h-4 w-4 flex-shrink-0 text-[#aaa]","aria-hidden":"true"})]}),s&&g.jsxs("div",{className:"absolute right-0 z-50 mt-2 max-h-96 w-96 overflow-y-auto rounded-xl py-1.5 shadow-2xl",style:{border:"1px solid #3a3a3a",background:"#0a0a0a"},children:[g.jsx("div",{className:"border-b border-[#222] px-3 py-2 text-[11px] font-semibold uppercase tracking-wide text-[#666]",children:"Switch pentest"}),e.runs.map(h=>{const f=h.name===t;return g.jsxs("button",{onMouseDown:()=>a(h.name),className:`flex w-full items-center gap-2 px-3 py-2.5 text-left text-sm transition-colors hover:bg-[rgba(255,255,255,0.06)] ${f?"bg-[rgba(255,255,255,0.04)] text-white":"text-[#aaa]"}`,children:[g.jsxs("span",{className:"min-w-0 flex-1",children:[g.jsx("span",{className:"block truncate font-medium",children:bo(h.target,h.name)}),h.target&&g.jsx("span",{className:"block truncate font-mono text-xs text-[#666]",children:h.target})]}),f&&g.jsx("span",{className:"h-2 w-2 flex-shrink-0 rounded-full bg-emerald-400"})]},h.name)})]})]})}function cH({finished:e}){return e?g.jsxs("span",{className:"ml-3 inline-flex items-center gap-1.5 text-xs text-[#888]",children:[g.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-[#555]"}),"Complete"]}):g.jsxs("span",{className:"ml-3 inline-flex items-center gap-1.5 text-xs text-emerald-400",children:[g.jsxs("span",{className:"relative flex h-1.5 w-1.5",children:[g.jsx("span",{className:"absolute inline-flex h-full w-full rounded-full bg-emerald-400 opacity-75 animate-ping"}),g.jsx("span",{className:"relative inline-flex h-1.5 w-1.5 rounded-full bg-emerald-400"})]}),"Live"]})}function uH(e){if(e==null)return null;if(e<60)return`${e}s`;const t=Math.floor(e/60);return t<60?`${t}m`:`${Math.floor(t/60)}h ${t%60}m`}function dH({summary:e}){const t=uH(e.durationSeconds);return g.jsxs("div",{children:[g.jsx("h1",{className:"text-2xl font-semibold text-white",children:bo(e.targets[0]??null,e.runName??e.runId??"Pentest results")}),g.jsxs("div",{className:"mt-1 flex flex-wrap items-center gap-x-3 gap-y-1 text-sm text-[#888]",children:[e.targets.length>0&&g.jsx("span",{className:"font-mono text-[#aaa]",children:e.targets.join(", ")}),e.scanMode&&g.jsx(zm,{label:e.scanMode}),t&&g.jsx(zm,{label:t}),e.status&&g.jsx(zm,{label:e.status})]})]})}function zm({label:e}){return g.jsxs(g.Fragment,{children:[g.jsx("span",{className:"text-[#333]",children:"·"}),g.jsx("span",{className:"capitalize",children:e})]})}function fH({vulnerabilities:e,finished:t,onSelect:r}){const a=[...e].sort((s,o)=>S_.indexOf(s.severity)-S_.indexOf(o.severity));return a.length===0?g.jsxs("div",{className:"space-y-4",children:[g.jsx("div",{className:"rounded-xl border border-[#222] bg-[rgba(255,255,255,0.02)] p-8 text-center text-sm text-[#888]",children:t?"No findings in this run.":"No findings yet. The pentest is still running…"}),t&&g.jsxs("div",{className:"rounded-xl border border-[#222] bg-[rgba(255,255,255,0.02)] p-5",children:[g.jsx("p",{className:"text-sm font-medium text-white",children:"Stay ahead of new exposures"}),g.jsx("p",{className:"mt-0.5 mb-3 text-xs text-[#666]",children:"Attack surface monitoring catches new exposures for your org over time."}),g.jsx(gS,{label:"Attack surface monitoring",desc:"Continuous coverage for your whole org.",slug:"asm",surface:"empty_state",icon:XC})]})]}):g.jsx("div",{className:"space-y-2",children:a.map(s=>g.jsxs("button",{onClick:()=>r(s.id),className:"animate-card-in cursor-pointer w-full text-left rounded-lg border border-[#222] hover:border-[#444] bg-[rgba(255,255,255,0.02)] px-4 py-3 transition-colors flex items-center gap-3",children:[g.jsx("span",{className:`w-2.5 h-2.5 rounded-full flex-shrink-0 ${vp(s.severity)}`,"aria-hidden":"true"}),g.jsxs("span",{className:"flex-1 min-w-0",children:[g.jsx("span",{className:"block text-sm font-medium text-white truncate",children:s.title}),s.target&&g.jsx("span",{className:"block text-xs text-[#666] font-mono truncate",children:s.target})]}),g.jsx("span",{className:`text-xs font-semibold px-2 py-0.5 rounded-full border capitalize ${U_[s.severity]}`,children:s.severity})]},s.id))})}function hH(e){return e.replace(/^\s*#{1,6}[ \t]+.*(?:\r?\n)+/,"").trimStart()}function mH(e){const t=[];let r=null;for(const a of e.split(`
`)){const s=a.match(/^#{1,6}\s+(.*)$/);if(s){const o=s[1].trim().toLowerCase();if(o===r)continue;r=o}else a.trim()!==""&&(r=null);t.push(a)}return t.join(`
`)}function pH({onOpenEmail:e}){return g.jsx("button",{onClick:e,className:"group w-full cursor-pointer rounded-xl border border-emerald-500/25 bg-emerald-500/[0.06] p-4 text-left transition-colors hover:border-emerald-500/40",children:g.jsxs("div",{className:"flex items-center gap-3",children:[g.jsx("div",{className:"flex h-9 w-9 flex-shrink-0 items-center justify-center rounded-lg",style:{border:"1px solid rgba(16,185,129,0.3)",background:"rgba(16,185,129,0.08)"},children:g.jsx(xp,{className:"h-4 w-4 text-emerald-400","aria-hidden":"true"})}),g.jsxs("div",{className:"min-w-0 flex-1",children:[g.jsx("p",{className:"text-sm font-semibold text-white",children:"Email an encrypted PDF report of this run"}),g.jsx("p",{className:"mt-0.5 text-xs text-[#888]",children:"Encrypted with a key only you can see, email verified with a one-time code before sending."})]}),g.jsx("span",{className:"flex-shrink-0 rounded-lg bg-white px-3 py-1.5 text-xs font-semibold text-black transition-opacity group-hover:opacity-90",children:"Export report to PDF"})]})})}function gH({summary:e,counts:t,total:r,reportMarkdown:a,raw:s,finished:o,onOpenEmail:c}){const d=[["Executive Summary",e.executiveSummary],["Technical Analysis",e.technicalAnalysis],["Methodology",e.methodology],["Recommendations",e.recommendations]].filter(([,h])=>!!h).map(([h,f])=>({title:h,content:hH(f)}));return g.jsxs("div",{className:"space-y-6",children:[g.jsx("div",{className:"animate-card-in",children:g.jsx(eH,{raw:s,durationSeconds:e.durationSeconds})}),r>0&&g.jsx("div",{className:"animate-card-in rounded-xl border border-[#222] bg-[rgba(255,255,255,0.02)] p-5",children:g.jsx(nD,{findings:{total:r,...t}})}),o&&g.jsx("div",{className:"animate-card-in",children:g.jsx(pH,{onOpenEmail:c})}),d.length>0?g.jsx("div",{className:"animate-card-in rounded-xl border border-[#222] bg-[rgba(255,255,255,0.02)] p-5 space-y-8",children:d.map(h=>g.jsx(oa,{title:h.title,content:h.content},h.title))}):a?g.jsx("div",{className:"animate-card-in rounded-xl border border-[#222] bg-[rgba(255,255,255,0.02)] p-5",children:g.jsx(oa,{content:mH(a)})}):r===0&&g.jsx("p",{className:"text-sm text-[#888]",children:"No summary available for this run yet."})]})}function Im({active:e,onClick:t,children:r}){return g.jsxs("button",{onClick:t,className:`cursor-pointer relative pb-2.5 text-sm font-semibold transition-colors ${e?"text-white":"text-[#666] hover:text-white"}`,children:[r,e&&g.jsx("span",{className:"absolute bottom-0 inset-x-0 h-0.5 bg-white rounded-full"})]})}function bH({run:e,canSteer:t}){const{agents:r,events:a}=e.transcript,s=ee.useMemo(()=>sU(r,a),[r,a]),[o,c]=ee.useState(null),d=o?r.find(f=>f.id===o)??null:null,h=t&&!e.finished;return g.jsxs("div",{className:"space-y-5",children:[g.jsxs("div",{className:"rounded-xl border border-[#222] bg-[rgba(255,255,255,0.02)] p-5",children:[g.jsxs("div",{className:"flex items-center gap-2",children:[g.jsx(Ao,{className:"w-4 h-4 text-[#888]","aria-hidden":"true"}),g.jsx("h2",{className:"text-sm font-semibold text-white",children:"Agent graph"}),g.jsxs("span",{className:"text-xs text-[#666]",children:[r.length," agent",r.length===1?"":"s"]})]}),g.jsx("p",{className:"mt-1 mb-4 text-xs text-[#666]",children:"Click an agent to open its full transcript."}),g.jsx("div",{className:"h-[480px] rounded-lg border border-[#1a1a1a] overflow-hidden",children:g.jsx(GB,{agents:s,selectedAgentId:o,onSelectAgent:f=>c(f),eventsLoaded:!0,eventsEmpty:s.size===0,scanCompleted:e.finished})})]}),h&&g.jsx(fS,{agents:r}),g.jsxs("div",{className:"rounded-xl border border-[#222] bg-[rgba(255,255,255,0.02)] p-5",children:[g.jsx("p",{className:"text-sm font-semibold text-white",children:"Run this pentest with more depth"}),g.jsx("p",{className:"mt-0.5 text-xs text-[#666]",children:"Re-run this pentest on managed infra in the cloud."}),g.jsx("div",{className:"mt-3 flex flex-wrap gap-2.5",children:g.jsx(gS,{label:"Re-run in Strix Pro with more depth",desc:"Run this pentest on managed infra with more depth.",slug:"live_scan",surface:"agents",icon:WC})})]}),g.jsx(CU,{open:d!==null,agent:d,events:a,steerable:h,onClose:()=>c(null)})]})}Ck.createRoot(document.getElementById("root")).render(g.jsx(ee.StrictMode,{children:g.jsx(lH,{})}));
diff --git a/strix/interface/viewer/static/index.html b/strix/interface/viewer/static/index.html
index 18631e0b..5d42b7a6 100644
--- a/strix/interface/viewer/static/index.html
+++ b/strix/interface/viewer/static/index.html
@@ -6,7 +6,7 @@
Strix Results
-
+
diff --git a/strix/interface/viewer/transcript.py b/strix/interface/viewer/transcript.py
index 0011315c..3c11bbc1 100644
--- a/strix/interface/viewer/transcript.py
+++ b/strix/interface/viewer/transcript.py
@@ -6,6 +6,7 @@ import json
import logging
from typing import TYPE_CHECKING, Any
+from strix.config import subscription
from strix.core.paths import run_record_path
@@ -59,7 +60,39 @@ def read_run_summary(run_dir: Path) -> dict[str, Any]:
record = {}
status = record.get("status")
finished = status in _TERMINAL_STATUSES and bool(record.get("end_time"))
- return {**record, "finished": finished}
+ summary = {**record, "finished": finished}
+ _backfill_subscription_provider(summary)
+ return summary
+
+
+def _first_recorded_model(record: dict[str, Any]) -> str | None:
+ """The first non-empty per-agent model slug in a run record, or None."""
+ usage = record.get("llm_usage")
+ if not isinstance(usage, dict):
+ return None
+ agents = usage.get("agents")
+ if not isinstance(agents, list):
+ return None
+ for agent in agents:
+ if isinstance(agent, dict):
+ model = agent.get("model")
+ if isinstance(model, str) and model:
+ return model
+ return None
+
+
+def _backfill_subscription_provider(record: dict[str, Any]) -> None:
+ """Name the subscription provider for runs recorded before that field
+ existed, deriving it from the recorded ``provider/model`` slug so the viewer
+ labels them correctly without a rescan. Newer runs already carry the field.
+ """
+ if record.get("subscription_provider"):
+ return
+ if record.get("auth_mode") != "subscription":
+ return
+ label = subscription.provider_label(_first_recorded_model(record))
+ if label:
+ record["subscription_provider"] = label
def primary_target(record: dict[str, Any]) -> str | None:
diff --git a/tests/test_viewer.py b/tests/test_viewer.py
index eb13cc1f..7b4d64fa 100644
--- a/tests/test_viewer.py
+++ b/tests/test_viewer.py
@@ -70,6 +70,53 @@ def test_read_run_summary_finished_flag(tmp_path: Path) -> None:
assert read_run_summary(partial)["finished"] is False
+def _write_record(base: Path, name: str, record: dict[str, object]) -> Path:
+ run_dir = base / "strix_runs" / name
+ run_dir.mkdir(parents=True)
+ (run_dir / "run.json").write_text(json.dumps(record), encoding="utf-8")
+ return run_dir
+
+
+def test_read_run_summary_backfills_subscription_provider(tmp_path: Path) -> None:
+ # An older subscription run recorded no provider name; it is derived from
+ # the recorded provider/model slug so the viewer can label it.
+ run_dir = _write_record(
+ tmp_path,
+ "grok-run",
+ {
+ "auth_mode": "subscription",
+ "llm_usage": {"agents": [{"agent_id": "root", "model": "grok/grok-4"}]},
+ },
+ )
+ assert read_run_summary(run_dir)["subscription_provider"] == "Grok"
+
+
+def test_read_run_summary_keeps_explicit_provider(tmp_path: Path) -> None:
+ run_dir = _write_record(
+ tmp_path,
+ "chatgpt-run",
+ {
+ "auth_mode": "subscription",
+ "subscription_provider": "ChatGPT",
+ "llm_usage": {"agents": [{"agent_id": "root", "model": "grok/grok-4"}]},
+ },
+ )
+ # An explicit field is authoritative and never overwritten by the slug.
+ assert read_run_summary(run_dir)["subscription_provider"] == "ChatGPT"
+
+
+def test_read_run_summary_ignores_api_key_runs(tmp_path: Path) -> None:
+ run_dir = _write_record(
+ tmp_path,
+ "api-key-run",
+ {
+ "auth_mode": "api_key",
+ "llm_usage": {"agents": [{"agent_id": "root", "model": "openai/gpt-5.4"}]},
+ },
+ )
+ assert "subscription_provider" not in read_run_summary(run_dir)
+
+
def test_read_missing_artifacts_return_defaults(tmp_path: Path) -> None:
run_dir = _make_run(tmp_path, "empty", status="running", end_time=None)
assert read_vulnerabilities(run_dir) == []