@wrongstack/webui-hq 0.297.0 → 0.298.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (31) hide show
  1. package/dist/assets/{alerts-Bkl4wBJE.js → alerts-CngcvEJh.js} +1 -1
  2. package/dist/assets/brain-BG13bveN.js +1 -0
  3. package/dist/assets/cockpit-DXJxjPnB.js +1 -0
  4. package/dist/assets/control-CMd6VthY.js +1 -0
  5. package/dist/assets/{cost-DdiRINxE.js → cost-CJITkXsR.js} +1 -1
  6. package/dist/assets/{fleet-map-B2eU2NoT.js → fleet-map-CZOgE5Nw.js} +2 -2
  7. package/dist/assets/{fleet-topology-CTK7p_tj.js → fleet-topology-oso81R_h.js} +8 -8
  8. package/dist/assets/icons-CnibBrEa.js +1 -0
  9. package/dist/assets/index-CCbnoNGX.js +2 -0
  10. package/dist/assets/{index-B10rm8pW.css → index-CO3O3sis.css} +1 -1
  11. package/dist/assets/kanban-Dv_JO9FX.js +1 -0
  12. package/dist/assets/live-console-i2bRKrD4.js +1 -0
  13. package/dist/assets/{mailbox-CtUPdH7g.js → mailbox-Ci-OhMVd.js} +1 -1
  14. package/dist/assets/{markdown-HUVrfVaI.js → markdown-B4iP4HAO.js} +1 -1
  15. package/dist/assets/settings--viYyUXx.js +8 -0
  16. package/dist/assets/{trends-Bl-Wyntb.js → trends-CUxeiswr.js} +1 -1
  17. package/dist/assets/use-backfilled-events-aHtiydc8.js +1 -0
  18. package/dist/assets/{vendor-DT5_U5Rx.js → vendor-oWlwbM7J.js} +1 -1
  19. package/dist/assets/worktree-Be5RGvFw.js +1 -0
  20. package/dist/index.html +5 -5
  21. package/package.json +8 -4
  22. package/dist/assets/brain-aSSiXPI_.js +0 -1
  23. package/dist/assets/cockpit-Dj4gx69d.js +0 -1
  24. package/dist/assets/control-BcPCPylB.js +0 -1
  25. package/dist/assets/icons-BV2PcvP1.js +0 -1
  26. package/dist/assets/index-DwX1O_JZ.js +0 -2
  27. package/dist/assets/kanban-6xxUvXep.js +0 -1
  28. package/dist/assets/live-console-BRrd34p2.js +0 -1
  29. package/dist/assets/settings-M1WNoX6Y.js +0 -1
  30. package/dist/assets/use-backfilled-events-ceR5R8_K.js +0 -1
  31. package/dist/assets/worktree-DrEOGtox.js +0 -1
package/dist/index.html CHANGED
@@ -5,12 +5,12 @@
5
5
  <link rel="icon" type="image/svg+xml" href="/wrongstack.svg" />
6
6
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
7
7
  <title>WrongStack HQ</title>
8
- <script type="module" crossorigin src="/assets/index-DwX1O_JZ.js"></script>
8
+ <script type="module" crossorigin src="/assets/index-CCbnoNGX.js"></script>
9
9
  <link rel="modulepreload" crossorigin href="/assets/rolldown-runtime-QTnfLwEv.js">
10
- <link rel="modulepreload" crossorigin href="/assets/icons-BV2PcvP1.js">
11
- <link rel="modulepreload" crossorigin href="/assets/vendor-DT5_U5Rx.js">
12
- <link rel="modulepreload" crossorigin href="/assets/markdown-HUVrfVaI.js">
13
- <link rel="stylesheet" crossorigin href="/assets/index-B10rm8pW.css">
10
+ <link rel="modulepreload" crossorigin href="/assets/icons-CnibBrEa.js">
11
+ <link rel="modulepreload" crossorigin href="/assets/vendor-oWlwbM7J.js">
12
+ <link rel="modulepreload" crossorigin href="/assets/markdown-B4iP4HAO.js">
13
+ <link rel="stylesheet" crossorigin href="/assets/index-CO3O3sis.css">
14
14
  </head>
15
15
  <body>
16
16
  <div id="root"></div>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wrongstack/webui-hq",
3
- "version": "0.297.0",
3
+ "version": "0.298.1",
4
4
  "license": "MIT",
5
5
  "description": "HQ Command Center dashboard — offline React app for the cross-machine coordination surface (port 3499).",
6
6
  "type": "module",
@@ -12,8 +12,10 @@
12
12
  "@fontsource-variable/manrope": "^5.3.0",
13
13
  "@fontsource-variable/space-grotesk": "^5.3.0",
14
14
  "@fontsource/ibm-plex-mono": "^5.3.0",
15
+ "@types/qrcode": "^1.5.6",
15
16
  "@xyflow/react": "^12.11.2",
16
17
  "lucide-react": "^1.26.0",
18
+ "qrcode": "^1.5.4",
17
19
  "react": "^19.2.8",
18
20
  "react-dom": "^19.2.8",
19
21
  "react-markdown": "^10.1.0",
@@ -21,11 +23,12 @@
21
23
  "remark-gfm": "^4.0.1",
22
24
  "virtua": "^0.49.3",
23
25
  "zustand": "5.0.14",
24
- "@wrongstack/core": "0.297.0",
25
- "@wrongstack/tools": "0.297.0",
26
- "@wrongstack/webui-server": "0.297.0"
26
+ "@wrongstack/core": "0.298.1",
27
+ "@wrongstack/tools": "0.298.1",
28
+ "@wrongstack/webui-server": "0.298.1"
27
29
  },
28
30
  "devDependencies": {
31
+ "@types/node": "^26.1.2",
29
32
  "@types/react": "^19.2.17",
30
33
  "@types/react-dom": "^19.2.3",
31
34
  "@vitejs/plugin-react": "^6.0.4",
@@ -35,6 +38,7 @@
35
38
  },
36
39
  "files": [
37
40
  "dist",
41
+ "!dist/**/*.map",
38
42
  "README.md"
39
43
  ],
40
44
  "scripts": {
@@ -1 +0,0 @@
1
- import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{Ct as t,Lt as n,Q as r,bt as i,jt as a,s as o,t as s,xt as c}from"./icons-BV2PcvP1.js";import{i as l}from"./markdown-HUVrfVaI.js";import{t as u}from"./use-backfilled-events-ceR5R8_K.js";var d=e(n(),1),f=l(),p={decision_requested:{label:`Requested`,Icon:c,cls:`info`},decision_answered:{label:`Answered`,Icon:t,cls:`active`},decision_ask_human:{label:`Ask Human`,Icon:r,cls:`warn`},decision_denied:{label:`Denied`,Icon:i,cls:`error`},human_answered:{label:`Human`,Icon:o,cls:`info`},intervention:{label:`Intervention`,Icon:s,cls:`warn`}};function m(){let{events:e,loading:t}=u(`brain.event`,200),n=e.slice(-200).reverse(),r=(0,d.useMemo)(()=>{let e=0,t=0,r=0,i=0,a=0;for(let o of n){let n=o.payload;n.kind===`decision_requested`&&(e+=1),n.kind===`decision_answered`&&(t+=1),(n.kind===`decision_ask_human`||n.kind===`human_answered`)&&(r+=1),n.kind===`intervention`&&(i+=1),(n.risk===`high`||n.risk===`critical`)&&(a+=1)}return{requested:e,answered:t,human:r,interventions:i,highRisk:a}},[n]);return n.length===0?(0,f.jsx)(`div`,{className:`hq-empty hq-empty-ornate`,children:t?`Loading brain history…`:`No brain decisions yet. Brain events appear when autonomous consumers route decisions through the Brain.`}):(0,f.jsxs)(`div`,{className:`hq-screen hq-brain-screen`,children:[(0,f.jsxs)(`section`,{className:`hq-screen-hero hq-brain-hero`,"aria-label":`Brain decision summary`,children:[(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`span`,{className:`hq-section-kicker`,children:`Decision ledger`}),(0,f.jsx)(`h2`,{children:`Brain arbitration timeline`}),(0,f.jsx)(`p`,{children:`Requests, answers, human escalations and interventions are shown as a governed decision trail instead of a flat event stream.`})]}),(0,f.jsxs)(`div`,{className:`hq-hero-metrics`,children:[(0,f.jsx)(h,{label:`requested`,value:r.requested}),(0,f.jsx)(h,{label:`answered`,value:r.answered,tone:`ok`}),(0,f.jsx)(h,{label:`human`,value:r.human,tone:r.human>0?`warn`:void 0}),(0,f.jsx)(h,{label:`high risk`,value:r.highRisk,tone:r.highRisk>0?`error`:`ok`})]})]}),(0,f.jsxs)(`div`,{className:`hq-section-head`,children:[(0,f.jsxs)(`div`,{children:[(0,f.jsxs)(`span`,{className:`hq-section-kicker`,children:[`Latest `,n.length]}),(0,f.jsx)(`h3`,{children:`Decision trail`})]}),r.interventions>0?(0,f.jsxs)(`span`,{className:`hq-pill warn`,children:[r.interventions,` interventions`]}):null]}),(0,f.jsx)(`div`,{className:`hq-decision-timeline`,children:n.map(e=>{let t=e.payload,n=p[t.kind]??{label:t.kind,Icon:a,cls:`info`};return(0,f.jsxs)(`article`,{className:`hq-card hq-decision-card ${n.cls}`,children:[(0,f.jsx)(`div`,{className:`hq-decision-marker`,"aria-hidden":`true`,children:(0,f.jsx)(n.Icon,{size:15,className:`hq-kind-icon ${n.cls}`})}),(0,f.jsxs)(`div`,{className:`hq-decision-body`,children:[(0,f.jsxs)(`div`,{className:`hq-row`,children:[(0,f.jsx)(`span`,{className:`hq-text-bright`,children:n.label}),t.source!==void 0&&(0,f.jsx)(`span`,{className:`hq-pill info`,children:t.source}),t.risk!==void 0&&(0,f.jsxs)(`span`,{className:`hq-pill ${t.risk===`high`||t.risk===`critical`?`error`:`warn`}`,children:[t.risk,` risk`]}),(0,f.jsx)(`span`,{className:`hq-mono hq-row-time`,children:new Date(t.at).toLocaleTimeString()})]}),t.question!==void 0&&(0,f.jsx)(`div`,{className:`hq-mono hq-row-detail`,children:t.question}),t.decision!==void 0&&(0,f.jsx)(`div`,{className:`hq-row hq-row-detail`,children:(0,f.jsxs)(`span`,{className:`hq-pill active`,children:[`→ `,t.decision]})}),t.detail!==void 0&&(0,f.jsx)(`div`,{className:`hq-mono hq-row-subtle`,children:t.detail}),t.kind===`intervention`&&(0,f.jsxs)(`div`,{className:`hq-row hq-row-detail`,children:[(0,f.jsx)(`span`,{className:`hq-pill warn`,children:t.interventionKind}),(0,f.jsx)(`span`,{className:`hq-pill`,children:t.intervened?`steered`:`observed`})]})]})]},e.id)})})]})}function h({label:e,value:t,tone:n}){return(0,f.jsxs)(`div`,{className:`hq-hero-metric`,"data-tone":n,children:[(0,f.jsx)(`strong`,{children:t}),(0,f.jsx)(`span`,{children:e})]})}export{m as BrainView};
@@ -1 +0,0 @@
1
- import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{Lt as t,_ as n}from"./icons-BV2PcvP1.js";import{i as r}from"./markdown-HUVrfVaI.js";import{f as i,l as a,o,s}from"./index-DwX1O_JZ.js";var c=e(t(),1),l=r();function u(){let{snapshot:e,alerts:t,selectedClientId:r,connected:u}=a(i(e=>({snapshot:e.snapshot,alerts:e.alerts,selectedClientId:e.selectedClientId,connected:e.connected}))),g=e,_=g?.totals,v=g?.machines??[],y=g?.projects??[],b=g?.clients??[],x=g?.liveSessions??[],S=b.filter(e=>e.capabilities.includes(`control.receive`)),C=r??S[0]?.clientId??null,w=S.find(e=>e.clientId===C)??S[0]??null,[T,E]=(0,c.useState)([]),[D,O]=(0,c.useState)([]),[k,A]=(0,c.useState)(null),[j,M]=(0,c.useState)(null),[N,P]=(0,c.useState)(null),[F,I]=(0,c.useState)(null),[L,R]=(0,c.useState)(null),[z,B]=(0,c.useState)(null);(0,c.useEffect)(()=>{let e=!1,t=()=>{o(`/api/system/health`).then(t=>{e||(R(t),B(null))}).catch(t=>{e||B(t instanceof Error?t.message:String(t))})};t();let n=setInterval(t,3e4);return()=>{e=!0,clearInterval(n)}},[]),(0,c.useEffect)(()=>{let e=!1,t=()=>{o(`/api/alerts`).then(t=>{e||(E(t.active),O(t.history),A(null))}).catch(t=>{e||A(t instanceof Error?t.message:String(t))})};t();let n=setInterval(t,15e3);return()=>{e=!0,clearInterval(n)}},[]);let V=(0,c.useMemo)(()=>{let e=t.slice(-30).reverse().map(e=>({severity:typeof e.severity==`string`?e.severity:`info`,ruleId:e.type??`hq.alert`,message:typeof e.message==`string`?e.message:`Alert envelope received`,timestamp:typeof e.timestamp==`string`?e.timestamp:new Date().toISOString()})),n=[...T??[],...D??[]].slice(-30).reverse().map(e=>({severity:typeof e.severity==`string`?e.severity:`info`,ruleId:typeof e.ruleId==`string`?e.ruleId:`alert`,message:typeof e.message==`string`?e.message:``,timestamp:typeof e.lastFiredAt==`string`?e.lastFiredAt:typeof e.firstFiredAt==`string`?e.firstFiredAt:new Date().toISOString()})),r=[...e,...n],i=new Set,a=[];for(let e of r){let t=`${e.ruleId}|${e.message}|${e.timestamp}`;if(!i.has(t)&&(i.add(t),a.push(e),a.length>=12))break}return a},[t,T,D]),H=(0,c.useMemo)(()=>{let e=0,t=0,n=0,r=0,i=0;for(let a of x){a.status===`active`&&(i+=1);for(let i of a.agents??[])e+=1,i.status===`running`||i.status===`streaming`?t+=1:i.status===`waiting_user`?n+=1:i.status===`error`&&(r+=1)}return{total:e,busy:t,waiting:n,errored:r,activeSessions:i}},[x]),U=(0,c.useMemo)(()=>[...y].sort((e,t)=>t.totalCostUsd-e.totalCostUsd).slice(0,4),[y]);async function W(e){if(w!==null){M(e),P(null),I(null);try{let t=e===`pause-noisy`?{subject:`HQ quick action: pause noisy agents`,body:`HQ operator requests: pause non-critical/noisy agent work, reduce chatter, and keep only essential status updates until resumed.`,priority:`high`}:{subject:`HQ quick action: status request`,body:`HQ operator requests a concise status broadcast from active agents: current task, blocker if any, and next expected action.`,priority:`normal`},n=await s(w.clientId,`broadcast`,t);P(`queued ${n.commandId}`)}catch(e){I(e instanceof Error?e.message:String(e))}finally{M(null)}}}let G=[{title:`Fleet`,view:`fleet`,cta:`open fleet`,body:(0,l.jsxs)(`div`,{className:`hq-cockpit-grid`,children:[(0,l.jsx)(d,{label:`machines`,value:v.length}),(0,l.jsx)(d,{label:`clients`,value:b.length}),(0,l.jsx)(d,{label:`sessions`,value:H.activeSessions,accent:H.activeSessions>0?`green`:void 0}),(0,l.jsx)(d,{label:`agents`,value:H.total}),(0,l.jsx)(d,{label:`busy`,value:H.busy,accent:H.busy>0?`green`:void 0}),(0,l.jsx)(d,{label:`waiting`,value:H.waiting,accent:H.waiting>0?`warn`:void 0}),(0,l.jsx)(d,{label:`errored`,value:H.errored,accent:H.errored>0?`error`:void 0}),(0,l.jsx)(d,{label:`cost $`,value:(_?.totalCostUsd??0).toFixed(2),accent:`green`})]})}],K={title:`Auth Tokens`,view:`settings`,cta:`open settings`,body:(0,l.jsx)(f,{tokenStats:_?.tokenStats})},q={title:`Alerts`,view:`alerts`,cta:`open alerts`,body:V.length===0?(0,l.jsx)(`div`,{className:`hq-empty hq-cockpit-empty`,children:`No alerts in the last few minutes.`}):(0,l.jsx)(`div`,{className:`hq-cockpit-alert-list`,children:V.map((e,t)=>(0,l.jsxs)(`div`,{className:`hq-cockpit-alert-row`,children:[(0,l.jsx)(`span`,{className:`hq-pill `+h(e.severity),children:e.severity}),(0,l.jsx)(`span`,{className:`hq-mono`,children:e.ruleId}),(0,l.jsx)(`span`,{className:`hq-cockpit-alert-msg`,children:e.message}),(0,l.jsx)(`span`,{className:`hq-mono hq-text-dim hq-ml-auto`,children:m(e.timestamp)})]},`${e.ruleId}-${e.timestamp}-${t}`))})},J={title:`Cost`,view:`cost`,cta:`open cost`,body:U.length===0?(0,l.jsx)(`div`,{className:`hq-empty hq-cockpit-empty`,children:`No cost data yet — connect some clients.`}):(0,l.jsx)(`div`,{className:`hq-cockpit-cost-list`,children:U.map(e=>{let t=(_?.totalCostUsd??0)>0?e.totalCostUsd/_.totalCostUsd*100:0;return(0,l.jsxs)(`div`,{className:`hq-cockpit-cost-row`,children:[(0,l.jsxs)(`div`,{className:`hq-cockpit-cost-line`,children:[(0,l.jsx)(`span`,{className:`hq-cockpit-cost-name`,children:e.projectName}),(0,l.jsx)(`span`,{className:`hq-mono hq-text-dim`,children:e.projectId}),(0,l.jsxs)(`span`,{className:`hq-mono hq-cockpit-cost-amount hq-ml-auto`,children:[`$`,e.totalCostUsd.toFixed(4)]}),(0,l.jsxs)(`span`,{className:`hq-mono hq-text-dim`,children:[t.toFixed(1),`%`]})]}),(0,l.jsx)(`div`,{className:`hq-cockpit-cost-bar`,role:`progressbar`,"aria-label":`${e.projectName} share of fleet cost`,"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":Number(t.toFixed(1)),children:(0,l.jsx)(`span`,{style:{width:`${Math.max(2,t)}%`}})}),(0,l.jsxs)(`div`,{className:`hq-cockpit-cost-meta`,children:[(0,l.jsxs)(`span`,{children:[e.activeSessions,` sessions`]}),(0,l.jsxs)(`span`,{children:[e.activeSubagents,` subagents`]}),(0,l.jsxs)(`span`,{children:[e.activeClients,` clients`]})]})]},e.projectId)})})};return(0,l.jsxs)(`div`,{children:[(0,l.jsx)(`div`,{className:`hq-card-title`,children:`Cockpit`}),(0,l.jsxs)(`div`,{className:`hq-card hq-cockpit-summary`,children:[(0,l.jsxs)(`div`,{className:`hq-row`,children:[(0,l.jsx)(`span`,{className:`hq-pill info`,children:u?`connected`:`reconnecting`}),(0,l.jsxs)(`span`,{className:`hq-pill`,children:[_?.activeMachines??0,` machines`]}),(0,l.jsxs)(`span`,{className:`hq-pill`,children:[_?.activeSessions??0,` sessions`]}),(0,l.jsxs)(`span`,{className:`hq-pill`,children:[_?.activeAgents??0,` agents`]}),(0,l.jsxs)(`span`,{className:`hq-pill green`,children:[`$`,(_?.totalCostUsd??0).toFixed(2)]}),(T?.length??0)>0&&(0,l.jsxs)(`span`,{className:`hq-pill error`,children:[T?.length??0,` active alerts`]}),k!==null&&(0,l.jsx)(`span`,{className:`hq-pill error`,children:k}),(0,l.jsx)(`button`,{type:`button`,className:`hq-btn secondary hq-ml-auto`,onClick:()=>a.getState().setActiveView(`fleet`),children:`Open Fleet`})]}),(0,l.jsxs)(`section`,{className:`hq-cockpit-actions`,"aria-label":`Cockpit quick actions`,children:[(0,l.jsxs)(`div`,{className:`hq-cockpit-actions-copy`,children:[(0,l.jsx)(`span`,{className:`hq-cockpit-section-title`,children:`Quick Actions`}),(0,l.jsx)(`span`,{className:`hq-mono`,children:w===null?`no controllable client connected`:`target ${p(w.clientId)}`})]}),(0,l.jsxs)(`div`,{className:`hq-cockpit-actions-buttons`,children:[(0,l.jsx)(`button`,{type:`button`,className:`hq-btn secondary`,disabled:w===null||j!==null,onClick:()=>void W(`pause-noisy`),children:j===`pause-noisy`?`Queuing…`:`Pause noisy agents`}),(0,l.jsx)(`button`,{type:`button`,className:`hq-btn secondary`,disabled:w===null||j!==null,onClick:()=>void W(`status-request`),children:j===`status-request`?`Queuing…`:`Broadcast status request`}),(0,l.jsx)(`button`,{type:`button`,className:`hq-btn secondary`,onClick:()=>a.getState().setActiveView(`control`),children:`Open Control`})]}),N!==null&&(0,l.jsx)(`span`,{className:`hq-pill info`,children:N}),F!==null&&(0,l.jsx)(`span`,{className:`hq-pill error`,children:F})]})]}),L!==null||z!==null?(0,l.jsxs)(`div`,{className:`hq-card hq-cockpit-section`,children:[(0,l.jsxs)(`div`,{className:`hq-row`,children:[(0,l.jsxs)(`span`,{className:`hq-cockpit-section-title`,children:[(0,l.jsx)(n,{size:14,style:{marginRight:`0.375rem`}}),`System Health`]}),(0,l.jsx)(`button`,{type:`button`,className:`hq-btn secondary hq-ml-auto`,onClick:()=>a.getState().setActiveView(`settings`),children:`open settings`})]}),z===null?L===null?null:(0,l.jsxs)(`div`,{className:`hq-cockpit-grid`,children:[(0,l.jsx)(d,{label:`status`,value:L.status,accent:L.status===`healthy`?`green`:`error`}),(0,l.jsx)(d,{label:`event log`,value:L.uptime.eventLogSize}),(0,l.jsx)(d,{label:`connections`,value:L.connections.total}),(0,l.jsx)(d,{label:`active`,value:L.connections.active,accent:L.connections.active>0?`green`:void 0}),(0,l.jsx)(d,{label:`stale`,value:L.connections.stale,accent:L.connections.stale>3?`warn`:void 0})]}):(0,l.jsx)(`div`,{className:`hq-empty hq-cockpit-empty`,children:z})]}):null,[...G,K,q,J].map(e=>(0,l.jsxs)(`div`,{className:`hq-card hq-cockpit-section`,children:[(0,l.jsxs)(`div`,{className:`hq-row`,children:[(0,l.jsx)(`span`,{className:`hq-cockpit-section-title`,children:e.title}),(0,l.jsx)(`button`,{type:`button`,className:`hq-btn secondary hq-ml-auto`,onClick:()=>a.getState().setActiveView(e.view),children:e.cta})]}),e.body]},e.title))]})}function d({label:e,value:t,accent:n}){return(0,l.jsxs)(`div`,{className:`hq-stat`+(n?` ${n}`:``),children:[(0,l.jsx)(`span`,{className:`hq-stat-num`,children:t}),(0,l.jsx)(`span`,{className:`hq-stat-label`,children:e})]})}function f({tokenStats:e}){if(e===void 0)return(0,l.jsx)(`div`,{className:`hq-empty hq-cockpit-empty`,children:`Token expiry stats unavailable on this HQ version.`});let{browserTotal:t,clientTotal:n,expired:r,expiringSoon:i}=e,a=t+n;return(0,l.jsxs)(`fieldset`,{className:`hq-cockpit-grid`,"aria-label":`Auth token stats`,style:{border:0,margin:0,padding:0},children:[(0,l.jsx)(d,{label:`browser`,value:t}),(0,l.jsx)(d,{label:`client`,value:n}),(0,l.jsx)(d,{label:`total`,value:a}),(0,l.jsx)(d,{label:`expired`,value:r,accent:r>0?`error`:void 0}),(0,l.jsx)(d,{label:`expiring soon`,value:i,accent:i>0?`warn`:void 0})]})}function p(e){return e.length<=18?e:`${e.slice(0,9)}…${e.slice(-6)}`}function m(e){let t=new Date(e);return Number.isNaN(t.getTime())?e:t.toLocaleTimeString()}function h(e){return e===`critical`||e===`error`||e===`high`?`error`:e===`warn`||e===`warning`||e===`medium`?`warn`:e===`info`||e===`low`?`info`:`idle`}export{u as CockpitView};
@@ -1 +0,0 @@
1
- import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{F as t,H as n,Lt as r,N as i,Nt as a,O as o,c as ee,d as s,t as c}from"./icons-BV2PcvP1.js";import{i as l}from"./markdown-HUVrfVaI.js";import{a as te,f as u,l as d,n as f,o as p,s as ne}from"./index-DwX1O_JZ.js";var m=e(r(),1),h=l(),g={steer:{label:`steer`,icon:(0,h.jsx)(c,{size:13}),desc:`High-priority course correction — interrupts the agent at the next turn.`},btw:{label:`btw`,icon:(0,h.jsx)(i,{size:13}),desc:`Non-urgent FYI — rides alongside the run without interrupting it.`},queue:{label:`queue`,icon:(0,h.jsx)(n,{size:13}),desc:`Queue a prompt — picked up after the current run finishes.`},abort:{label:`abort`,icon:(0,h.jsx)(o,{size:13}),desc:`Stop the leader run or every subagent on the client. Destructive.`,danger:!0},spawn:{label:`spawn`,icon:(0,h.jsx)(a,{size:13}),desc:`Launch a role subagent (bug-hunter, critic, …) with an optional task.`},broadcast:{label:`broadcast`,icon:(0,h.jsx)(t,{size:13}),desc:`Mailbox message to every agent in the client’s project.`},"run-command":{label:`run-command`,icon:(0,h.jsx)(s,{size:13}),desc:`Route a shell command to the client. RCE-gated (--hq-allow-exec + control.execute).`,danger:!0}};function _(){let{snapshot:e,selectedClientId:t,commandStatuses:n}=d(u(e=>({snapshot:e.snapshot,selectedClientId:e.selectedClientId,commandStatuses:e.commandStatuses}))),r=(e?.clients??[]).filter(e=>e.capabilities.includes(`control.receive`)),i=r.some(e=>e.clientId===t)?t:r[0]?.clientId??null,a=r.find(e=>e.clientId===i)??null,o=a===null?void 0:(e?.liveSessions??[]).find(e=>e.clientId===a.clientId||e.machineId===a.machineId&&e.projectId===a.projectId&&e.pid!==void 0&&e.pid===a.pid),s=te().control,[c,l]=(0,m.useState)(s.cmdType),[_,x]=(0,m.useState)(`compose`),[S,ae]=(0,m.useState)(s.steerTo),[C,oe]=(0,m.useState)(s.steerSubject),[w,se]=(0,m.useState)(s.steerBody),[T,ce]=(0,m.useState)(s.spawnRole),[E,le]=(0,m.useState)(s.spawnTask),[D,O]=(0,m.useState)(s.abortTarget),[k,ue]=(0,m.useState)(s.broadcastSubject),[A,de]=(0,m.useState)(s.broadcastBody),[j,fe]=(0,m.useState)(``),[M,pe]=(0,m.useState)(``),[N,P]=(0,m.useState)(``),[F,I]=(0,m.useState)(null),[L,R]=(0,m.useState)(null),[z,B]=(0,m.useState)(!1),[V,H]=(0,m.useState)([]),[me,U]=(0,m.useState)(!1),[W,G]=(0,m.useState)(null),[he,ge]=(0,m.useState)(null),K=(0,m.useMemo)(()=>ve(),[c,S,C,w,T,E,D,k,A,j,M]),q=K.risk===`danger`,J=c===`run-command`?`RUN`:`ABORT`,Y=i!==null&&K.disabledReason===null&&(!q||N===J),X=K.disabledReason===null&&i!==null;function Z(){x(`compose`),P(``),R(null),I(null)}function _e(e){l(e),f({cmdType:e}),Z()}async function Q(){U(!0),G(null);try{let e=await p(`/api/commands?limit=25`);H(e.commands.slice().reverse())}catch(e){G(e instanceof Error?e.message:String(e))}finally{U(!1)}}(0,m.useEffect)(()=>{Q();let e=setInterval(()=>{document.hidden||Q()},15e3);return()=>clearInterval(e)},[]),(0,m.useEffect)(()=>{n.length!==0&&H(e=>{let t=new Map(e.map(e=>[e.commandId,e]));for(let e of n)t.set(e.commandId,e);return[...t.values()].sort((e,t)=>t.enqueuedAt.localeCompare(e.enqueuedAt)).slice(0,25)})},[n]);async function $(){if(!(i===null||!Y)){B(!0),R(null),I(null);try{let e=await ne(i,K.type,K.payload);I(`queued ${K.type} command ${e.commandId}`),ge(e.commandId),x(`compose`),P(``),Q()}catch(e){R(e instanceof Error?e.message:String(e))}finally{B(!1)}}}(0,m.useEffect)(()=>{let e=e=>{e.key!==`Enter`||!(e.ctrlKey||e.metaKey)||(e.preventDefault(),_===`compose`&&X?(x(`preview`),I(null),R(null)):_===`preview`&&Y&&!z&&$())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)});function ve(){if(c===`steer`||c===`btw`||c===`queue`){let e=w.trim(),t=c===`steer`?`Send high-priority steer to`:c===`btw`?`Post a non-urgent FYI (btw) to`:`Queue a prompt for`;return{type:c,payload:{to:S||`leader`,subject:C||`HQ ${c}`,body:w,priority:c===`steer`?`high`:`normal`},disabledReason:e.length===0?`Message body is required.`:null,risk:`normal`,summary:`${t} ${S||`leader`}.`}}if(c===`run-command`){let e=j.trim();return{type:`run-command`,payload:{command:j,...M.trim()?{cwd:M.trim()}:{}},disabledReason:e.length===0?`Command is required.`:null,risk:`danger`,summary:`Route a shell command to the client (requires --hq-allow-exec + control.execute; delivered as a steer, the agent’s permission policy still applies).`}}if(c===`abort`)return{type:`abort`,payload:{target:D},disabledReason:null,risk:`danger`,summary:D===`fleet`?`Abort all subagents on the selected client.`:`Abort the selected target on the selected client.`};if(c===`spawn`){let e=E.trim();return{type:`spawn`,payload:{role:T,...e?{task:e}:{}},disabledReason:T.trim().length===0?`Role is required.`:null,risk:`normal`,summary:`Spawn a ${T} subagent${e?` with an initial task`:``}.`}}let e=A.trim();return{type:`broadcast`,payload:{subject:k||`HQ broadcast`,body:A,priority:`normal`},disabledReason:e.length===0?`Broadcast body is required.`:null,risk:`normal`,summary:`Broadcast a normal-priority mailbox message to the selected client project.`}}return r.length===0?(0,h.jsxs)(`div`,{className:`hq-empty`,children:[`No controllable clients connected. Clients must advertise the `,(0,h.jsx)(`code`,{children:`control.receive`}),` `,`capability (CLI/TUI/WebUI surfaces do this automatically when connected to HQ).`]}):(0,h.jsxs)(`div`,{className:`hq-control-grid`,children:[(0,h.jsxs)(`div`,{className:`hq-control-composer`,children:[(0,h.jsx)(`div`,{className:`hq-card-title`,children:`Command Target`}),(0,h.jsxs)(`div`,{className:`hq-card hq-control-target`,children:[(0,h.jsx)(`label`,{className:`hq-label`,htmlFor:`hq-control-client`,children:`Client`}),(0,h.jsx)(`select`,{id:`hq-control-client`,className:`hq-select`,value:i??``,onChange:e=>{d.getState().selectClient(e.target.value),Z()},children:r.map(t=>(0,h.jsx)(`option`,{value:t.clientId,children:re(t,e)},t.clientId))}),a!==null&&(0,h.jsxs)(`div`,{className:`hq-control-meta`,children:[(0,h.jsxs)(`span`,{children:[(0,h.jsx)(`strong`,{children:`kind`}),` `,a.kind]}),(0,h.jsxs)(`span`,{children:[(0,h.jsx)(`strong`,{children:`host`}),` `,a.hostname??`unknown`]}),(0,h.jsxs)(`span`,{children:[(0,h.jsx)(`strong`,{children:`project`}),` `,a.projectId]}),(0,h.jsxs)(`span`,{children:[(0,h.jsx)(`strong`,{children:`client`}),` `,v(a.clientId)]}),o!==void 0&&(0,h.jsxs)(`span`,{children:[(0,h.jsx)(`strong`,{children:`session`}),` `,v(o.sessionId),` ·`,` `,o.agentCount,` agents`]})]})]}),(0,h.jsx)(`div`,{className:`hq-card-title`,children:`Command Type`}),(0,h.jsxs)(`fieldset`,{className:`hq-control-steps`,"aria-label":`Control command stages`,children:[(0,h.jsx)(`span`,{className:`hq-step active`,children:`1 compose`}),(0,h.jsx)(`span`,{className:`hq-step`+(_===`preview`?` active`:``),children:`2 preview`}),(0,h.jsx)(`span`,{className:`hq-step`+(F===null?``:` active`),children:`3 queued`})]}),(0,h.jsx)(`div`,{className:`hq-control-types`,children:Object.keys(g).map(e=>{let t=g[e];return(0,h.jsxs)(`button`,{type:`button`,title:t.desc,className:`hq-control-type`+(c===e?` selected`:``)+(t.danger===!0?` danger`:``),onClick:()=>_e(e),children:[t.icon,t.label]},e)})}),(0,h.jsxs)(`div`,{className:`hq-control-typedesc`,children:[g[c].danger===!0&&(0,h.jsx)(ee,{size:12}),g[c].desc]}),(0,h.jsxs)(`div`,{className:`hq-mt-12`,children:[(c===`steer`||c===`btw`||c===`queue`)&&(0,h.jsxs)(`div`,{className:`hq-card`,children:[(0,h.jsxs)(`label`,{className:`hq-label`,htmlFor:`hq-control-recipient`,children:[`To (agent address — e.g. `,(0,h.jsx)(`code`,{children:`leader`}),`, `,(0,h.jsx)(`code`,{children:`leader@sessionTag`}),`, or a subagent id)`]}),(0,h.jsx)(`input`,{id:`hq-control-recipient`,className:`hq-input`,value:S,onChange:e=>{ae(e.target.value),f({steerTo:e.target.value})},placeholder:`leader`}),(0,h.jsx)(`label`,{className:`hq-label hq-mt-8`,htmlFor:`hq-control-subject`,children:`Subject`}),(0,h.jsx)(`input`,{id:`hq-control-subject`,className:`hq-input`,value:C,onChange:e=>{oe(e.target.value),f({steerSubject:e.target.value})}}),(0,h.jsx)(`label`,{className:`hq-label hq-mt-8`,htmlFor:`hq-control-body`,children:`Body`}),(0,h.jsx)(`textarea`,{id:`hq-control-body`,className:`hq-textarea`,value:w,onChange:e=>{se(e.target.value),f({steerBody:e.target.value})}})]}),c===`abort`&&(0,h.jsxs)(`div`,{className:`hq-card hq-card-danger`,children:[(0,h.jsx)(`label`,{className:`hq-label`,htmlFor:`hq-control-abort-target`,children:`Target`}),(0,h.jsxs)(`select`,{id:`hq-control-abort-target`,className:`hq-select`,value:D,onChange:e=>{O(e.target.value),f({abortTarget:e.target.value})},children:[(0,h.jsx)(`option`,{value:`leader`,children:`leader (session leader)`}),(0,h.jsx)(`option`,{value:`fleet`,children:`fleet (all subagents)`})]}),(0,h.jsxs)(`div`,{className:`hq-control-warning`,children:[`Abort is destructive. Preview requires typing `,(0,h.jsx)(`strong`,{children:`ABORT`}),` before dispatch.`]})]}),c===`spawn`&&(0,h.jsxs)(`div`,{className:`hq-card`,children:[(0,h.jsx)(`label`,{className:`hq-label`,htmlFor:`hq-control-spawn-role`,children:`Role`}),(0,h.jsxs)(`select`,{id:`hq-control-spawn-role`,className:`hq-select`,value:T,onChange:e=>{ce(e.target.value),f({spawnRole:e.target.value})},children:[(0,h.jsx)(`option`,{value:`bug-hunter`,children:`bug-hunter`}),(0,h.jsx)(`option`,{value:`refactor-planner`,children:`refactor-planner`}),(0,h.jsx)(`option`,{value:`critic`,children:`critic`}),(0,h.jsx)(`option`,{value:`security-scanner`,children:`security-scanner`}),(0,h.jsx)(`option`,{value:`code-reviewer`,children:`code-reviewer`})]}),(0,h.jsx)(`label`,{className:`hq-label hq-mt-8`,htmlFor:`hq-control-spawn-task`,children:`Task (optional)`}),(0,h.jsx)(`textarea`,{id:`hq-control-spawn-task`,className:`hq-textarea`,value:E,onChange:e=>{le(e.target.value),f({spawnTask:e.target.value})},placeholder:`Describe the task…`})]}),c===`run-command`&&(0,h.jsxs)(`div`,{className:`hq-card hq-card-danger`,children:[(0,h.jsx)(`label`,{className:`hq-label`,htmlFor:`hq-control-run-command`,children:`Shell command`}),(0,h.jsx)(`textarea`,{id:`hq-control-run-command`,className:`hq-textarea`,value:j,onChange:e=>fe(e.target.value),placeholder:`pnpm test`}),(0,h.jsx)(`label`,{className:`hq-label hq-mt-8`,htmlFor:`hq-control-run-cwd`,children:`Working directory (optional — defaults to the agent's project root)`}),(0,h.jsx)(`input`,{id:`hq-control-run-cwd`,className:`hq-input`,value:M,onChange:e=>pe(e.target.value),placeholder:``}),(0,h.jsxs)(`div`,{className:`hq-control-warning`,children:[`RCE-gated: the client must run with `,(0,h.jsx)(`code`,{children:`--hq-allow-exec`}),` and your token needs the `,(0,h.jsx)(`code`,{children:`control.execute`}),` capability — otherwise the server rejects this. Preview requires typing `,(0,h.jsx)(`strong`,{children:`RUN`}),` before dispatch.`]})]}),c===`broadcast`&&(0,h.jsxs)(`div`,{className:`hq-card`,children:[(0,h.jsx)(`label`,{className:`hq-label`,htmlFor:`hq-control-broadcast-subject`,children:`Subject`}),(0,h.jsx)(`input`,{id:`hq-control-broadcast-subject`,className:`hq-input`,value:k,onChange:e=>{ue(e.target.value),f({broadcastSubject:e.target.value})}}),(0,h.jsx)(`label`,{className:`hq-label hq-mt-8`,htmlFor:`hq-control-broadcast-body`,children:`Body`}),(0,h.jsx)(`textarea`,{id:`hq-control-broadcast-body`,className:`hq-textarea`,value:A,onChange:e=>{de(e.target.value),f({broadcastBody:e.target.value})}})]})]}),(0,h.jsx)(`div`,{className:`hq-card-title`,children:`Dispatch Gate`}),(0,h.jsxs)(`div`,{className:`hq-card hq-command-preview`+(K.risk===`danger`?` hq-card-danger`:``),children:[(0,h.jsxs)(`div`,{className:`hq-row`,children:[(0,h.jsx)(`span`,{className:`hq-pill `+(K.risk===`danger`?`error`:`info`),children:K.risk}),(0,h.jsx)(`span`,{children:K.summary}),K.disabledReason!==null&&(0,h.jsx)(`span`,{className:`hq-pill warn`,children:K.disabledReason})]}),_===`preview`?(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(`div`,{className:`hq-msg-sublabel`,children:`payload preview`}),(0,h.jsx)(`pre`,{className:`hq-msg-pre`,children:JSON.stringify({clientId:i,type:K.type,payload:K.payload},null,2)}),q&&(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(`label`,{className:`hq-label hq-mt-12`,htmlFor:`hq-control-confirm`,children:`Confirm destructive dispatch`}),(0,h.jsx)(`input`,{id:`hq-control-confirm`,className:`hq-input`,value:N,onChange:e=>P(e.target.value),placeholder:`Type ${J}`})]}),(0,h.jsxs)(`div`,{className:`hq-row hq-mt-12`,children:[(0,h.jsx)(`button`,{type:`button`,className:`hq-btn`,disabled:z||!Y,onClick:()=>void $(),title:`Ctrl+Enter`,children:z?`Dispatching…`:`Dispatch Command`}),(0,h.jsx)(`button`,{type:`button`,className:`hq-btn secondary`,disabled:z,onClick:Z,children:`Back to Compose`})]})]}):(0,h.jsx)(`button`,{type:`button`,className:`hq-btn`,disabled:!X,onClick:()=>{x(`preview`),I(null),R(null)},title:`Ctrl+Enter`,children:`Preview Command`})]}),F&&(0,h.jsx)(`div`,{className:`hq-pill active hq-mt-12`,children:F}),L&&(0,h.jsx)(`div`,{className:`hq-pill error hq-mt-12`,children:L})]}),(0,h.jsxs)(`div`,{className:`hq-control-audit`,children:[(0,h.jsx)(`div`,{className:`hq-card-title`,children:`Command Audit`}),(0,h.jsxs)(`div`,{className:`hq-card hq-command-audit`,children:[(0,h.jsxs)(`div`,{className:`hq-row`,children:[(0,h.jsxs)(`span`,{className:`hq-pill info`,children:[`recent `,V.length]}),me&&(0,h.jsx)(`span`,{className:`hq-pill idle`,children:`refreshing`}),W!==null&&(0,h.jsx)(`span`,{className:`hq-pill error`,children:W}),(0,h.jsx)(`button`,{type:`button`,className:`hq-btn secondary hq-ml-auto`,onClick:()=>void Q(),children:`Refresh`})]}),V.length===0?(0,h.jsx)(`div`,{className:`hq-empty hq-cockpit-empty`,children:`No command audit entries yet.`}):(0,h.jsx)(`div`,{className:`hq-audit-list`,children:V.map(e=>(0,h.jsxs)(`div`,{className:`hq-audit-row`+(e.commandId===he?` just-dispatched`:``)+(i!==null&&e.clientId===i?``:` other-client`),children:[(0,h.jsxs)(`div`,{className:`hq-audit-main`,children:[(0,h.jsx)(`span`,{className:`hq-pill `+ie(e),children:e.status}),(0,h.jsx)(`span`,{className:`hq-pill info`,children:e.type}),(0,h.jsx)(`span`,{className:`hq-mono`,children:v(e.commandId)}),e.ackStatus!==void 0&&(0,h.jsxs)(`span`,{className:`hq-pill `+b(e.ackStatus),children:[`ack `,e.ackStatus]})]}),(0,h.jsxs)(`div`,{className:`hq-audit-meta`,children:[(0,h.jsxs)(`span`,{children:[(0,h.jsx)(`strong`,{children:`client`}),` `,v(e.clientId)]}),(0,h.jsxs)(`span`,{children:[(0,h.jsx)(`strong`,{children:`by`}),` `,e.enqueuedBy]}),(0,h.jsxs)(`span`,{children:[(0,h.jsx)(`strong`,{children:`queued`}),` `,y(e.enqueuedAt)]}),e.ackedAt!==void 0&&(0,h.jsxs)(`span`,{children:[(0,h.jsx)(`strong`,{children:`acked`}),` `,y(e.ackedAt)]})]}),e.ackMessage!==void 0&&e.ackMessage.length>0&&(0,h.jsx)(`div`,{className:`hq-audit-message`,children:e.ackMessage})]},e.commandId))})]})]})]})}function v(e){return e.length>18?`${e.slice(0,10)}…${e.slice(-6)}`:e}function re(e,t){let n=t?.projects.find(t=>t.projectId===e.projectId),r=(t?.liveSessions??[]).find(t=>t.clientId===e.clientId||t.machineId===e.machineId&&t.projectId===e.projectId&&t.pid!==void 0&&t.pid===e.pid);return`${e.hostname??e.machineId} › ${n?.projectName??e.projectId} › ${`${e.kind.toUpperCase()}${e.pid===void 0?``:` · pid ${e.pid}`}`} › ${v(r?.sessionId??e.clientId)}`}function y(e,t=Date.now()){let n=new Date(e);if(Number.isNaN(n.getTime()))return e;let r=Math.max(0,t-n.getTime());return r<6e4?`${Math.floor(r/1e3)}s ago`:r<36e5?`${Math.floor(r/6e4)}m ago`:n.toLocaleTimeString()}function ie(e){return e.ackStatus===`failed`||e.ackStatus===`rejected`?`error`:e.status===`acked`?`active`:e.status===`delivered`?`info`:e.status===`queued`?`warn`:`idle`}function b(e){return e===`failed`||e===`rejected`?`error`:e===`completed`?`active`:`info`}export{_ as ControlView};
@@ -1 +0,0 @@
1
- import{r as e,t}from"./rolldown-runtime-QTnfLwEv.js";var n=t((e=>{var t=Symbol.for(`react.transitional.element`),n=Symbol.for(`react.portal`),r=Symbol.for(`react.fragment`),i=Symbol.for(`react.strict_mode`),a=Symbol.for(`react.profiler`),o=Symbol.for(`react.consumer`),s=Symbol.for(`react.context`),c=Symbol.for(`react.forward_ref`),l=Symbol.for(`react.suspense`),u=Symbol.for(`react.memo`),d=Symbol.for(`react.lazy`),f=Symbol.for(`react.activity`),p=Symbol.iterator;function m(e){return typeof e!=`object`||!e?null:(e=p&&e[p]||e[`@@iterator`],typeof e==`function`?e:null)}var h={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},g=Object.assign,_={};function v(e,t,n){this.props=e,this.context=t,this.refs=_,this.updater=n||h}v.prototype.isReactComponent={},v.prototype.setState=function(e,t){if(typeof e!=`object`&&typeof e!=`function`&&e!=null)throw Error(`takes an object of state variables to update or a function which returns an object of state variables.`);this.updater.enqueueSetState(this,e,t,`setState`)},v.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,`forceUpdate`)};function y(){}y.prototype=v.prototype;function b(e,t,n){this.props=e,this.context=t,this.refs=_,this.updater=n||h}var x=b.prototype=new y;x.constructor=b,g(x,v.prototype),x.isPureReactComponent=!0;var S=Array.isArray;function C(){}var w={H:null,A:null,T:null,S:null},T=Object.prototype.hasOwnProperty;function E(e,n,r){var i=r.ref;return{$$typeof:t,type:e,key:n,ref:i===void 0?null:i,props:r}}function D(e,t){return E(e.type,t,e.props)}function O(e){return typeof e==`object`&&!!e&&e.$$typeof===t}function k(e){var t={"=":`=0`,":":`=2`};return`$`+e.replace(/[=:]/g,function(e){return t[e]})}var A=/\/+/g;function j(e,t){return typeof e==`object`&&e&&e.key!=null?k(``+e.key):t.toString(36)}function M(e){switch(e.status){case`fulfilled`:return e.value;case`rejected`:throw e.reason;default:switch(typeof e.status==`string`?e.then(C,C):(e.status=`pending`,e.then(function(t){e.status===`pending`&&(e.status=`fulfilled`,e.value=t)},function(t){e.status===`pending`&&(e.status=`rejected`,e.reason=t)})),e.status){case`fulfilled`:return e.value;case`rejected`:throw e.reason}}throw e}function N(e,r,i,a,o){var s=typeof e;(s===`undefined`||s===`boolean`)&&(e=null);var c=!1;if(e===null)c=!0;else switch(s){case`bigint`:case`string`:case`number`:c=!0;break;case`object`:switch(e.$$typeof){case t:case n:c=!0;break;case d:return c=e._init,N(c(e._payload),r,i,a,o)}}if(c)return o=o(e),c=a===``?`.`+j(e,0):a,S(o)?(i=``,c!=null&&(i=c.replace(A,`$&/`)+`/`),N(o,r,i,``,function(e){return e})):o!=null&&(O(o)&&(o=D(o,i+(o.key==null||e&&e.key===o.key?``:(``+o.key).replace(A,`$&/`)+`/`)+c)),r.push(o)),1;c=0;var l=a===``?`.`:a+`:`;if(S(e))for(var u=0;u<e.length;u++)a=e[u],s=l+j(a,u),c+=N(a,r,i,s,o);else if(u=m(e),typeof u==`function`)for(e=u.call(e),u=0;!(a=e.next()).done;)a=a.value,s=l+j(a,u++),c+=N(a,r,i,s,o);else if(s===`object`){if(typeof e.then==`function`)return N(M(e),r,i,a,o);throw r=String(e),Error(`Objects are not valid as a React child (found: `+(r===`[object Object]`?`object with keys {`+Object.keys(e).join(`, `)+`}`:r)+`). If you meant to render a collection of children, use an array instead.`)}return c}function P(e,t,n){if(e==null)return e;var r=[],i=0;return N(e,r,``,``,function(e){return t.call(n,e,i++)}),r}function F(e){if(e._status===-1){var t=e._result;t=t(),t.then(function(t){(e._status===0||e._status===-1)&&(e._status=1,e._result=t)},function(t){(e._status===0||e._status===-1)&&(e._status=2,e._result=t)}),e._status===-1&&(e._status=0,e._result=t)}if(e._status===1)return e._result.default;throw e._result}var I=typeof reportError==`function`?reportError:function(e){if(typeof window==`object`&&typeof window.ErrorEvent==`function`){var t=new window.ErrorEvent(`error`,{bubbles:!0,cancelable:!0,message:typeof e==`object`&&e&&typeof e.message==`string`?String(e.message):String(e),error:e});if(!window.dispatchEvent(t))return}else if(typeof process==`object`&&typeof process.emit==`function`){process.emit(`uncaughtException`,e);return}console.error(e)},L={map:P,forEach:function(e,t,n){P(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return P(e,function(){t++}),t},toArray:function(e){return P(e,function(e){return e})||[]},only:function(e){if(!O(e))throw Error(`React.Children.only expected to receive a single React element child.`);return e}};e.Activity=f,e.Children=L,e.Component=v,e.Fragment=r,e.Profiler=a,e.PureComponent=b,e.StrictMode=i,e.Suspense=l,e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=w,e.__COMPILER_RUNTIME={__proto__:null,c:function(e){return w.H.useMemoCache(e)}},e.cache=function(e){return function(){return e.apply(null,arguments)}},e.cacheSignal=function(){return null},e.cloneElement=function(e,t,n){if(e==null)throw Error(`The argument must be a React element, but you passed `+e+`.`);var r=g({},e.props),i=e.key;if(t!=null)for(a in t.key!==void 0&&(i=``+t.key),t)!T.call(t,a)||a===`key`||a===`__self`||a===`__source`||a===`ref`&&t.ref===void 0||(r[a]=t[a]);var a=arguments.length-2;if(a===1)r.children=n;else if(1<a){for(var o=Array(a),s=0;s<a;s++)o[s]=arguments[s+2];r.children=o}return E(e.type,i,r)},e.createContext=function(e){return e={$$typeof:s,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null},e.Provider=e,e.Consumer={$$typeof:o,_context:e},e},e.createElement=function(e,t,n){var r,i={},a=null;if(t!=null)for(r in t.key!==void 0&&(a=``+t.key),t)T.call(t,r)&&r!==`key`&&r!==`__self`&&r!==`__source`&&(i[r]=t[r]);var o=arguments.length-2;if(o===1)i.children=n;else if(1<o){for(var s=Array(o),c=0;c<o;c++)s[c]=arguments[c+2];i.children=s}if(e&&e.defaultProps)for(r in o=e.defaultProps,o)i[r]===void 0&&(i[r]=o[r]);return E(e,a,i)},e.createRef=function(){return{current:null}},e.forwardRef=function(e){return{$$typeof:c,render:e}},e.isValidElement=O,e.lazy=function(e){return{$$typeof:d,_payload:{_status:-1,_result:e},_init:F}},e.memo=function(e,t){return{$$typeof:u,type:e,compare:t===void 0?null:t}},e.startTransition=function(e){var t=w.T,n={};w.T=n;try{var r=e(),i=w.S;i!==null&&i(n,r),typeof r==`object`&&r&&typeof r.then==`function`&&r.then(C,I)}catch(e){I(e)}finally{t!==null&&n.types!==null&&(t.types=n.types),w.T=t}},e.unstable_useCacheRefresh=function(){return w.H.useCacheRefresh()},e.use=function(e){return w.H.use(e)},e.useActionState=function(e,t,n){return w.H.useActionState(e,t,n)},e.useCallback=function(e,t){return w.H.useCallback(e,t)},e.useContext=function(e){return w.H.useContext(e)},e.useDebugValue=function(){},e.useDeferredValue=function(e,t){return w.H.useDeferredValue(e,t)},e.useEffect=function(e,t){return w.H.useEffect(e,t)},e.useEffectEvent=function(e){return w.H.useEffectEvent(e)},e.useId=function(){return w.H.useId()},e.useImperativeHandle=function(e,t,n){return w.H.useImperativeHandle(e,t,n)},e.useInsertionEffect=function(e,t){return w.H.useInsertionEffect(e,t)},e.useLayoutEffect=function(e,t){return w.H.useLayoutEffect(e,t)},e.useMemo=function(e,t){return w.H.useMemo(e,t)},e.useOptimistic=function(e,t){return w.H.useOptimistic(e,t)},e.useReducer=function(e,t,n){return w.H.useReducer(e,t,n)},e.useRef=function(e){return w.H.useRef(e)},e.useState=function(e){return w.H.useState(e)},e.useSyncExternalStore=function(e,t,n){return w.H.useSyncExternalStore(e,t,n)},e.useTransition=function(){return w.H.useTransition()},e.version=`19.2.8`})),r=t(((e,t)=>{t.exports=n()})),i=e(r(),1),a=(...e)=>e.filter((e,t,n)=>!!e&&e.trim()!==``&&n.indexOf(e)===t).join(` `).trim(),o=e=>e.replace(/([a-z0-9])([A-Z])/g,`$1-$2`).toLowerCase(),s=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,t,n)=>n?n.toUpperCase():t.toLowerCase()),c=e=>{let t=s(e);return t.charAt(0).toUpperCase()+t.slice(1)},l={xmlns:`http://www.w3.org/2000/svg`,width:24,height:24,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:2,strokeLinecap:`round`,strokeLinejoin:`round`},u=e=>{for(let t in e)if(t.startsWith(`aria-`)||t===`role`||t===`title`)return!0;return!1},d=(0,i.createContext)({}),f=()=>(0,i.useContext)(d),p=(0,i.forwardRef)(({color:e,size:t,strokeWidth:n,absoluteStrokeWidth:r,className:o=``,children:s,iconNode:c,...d},p)=>{let{size:m=24,strokeWidth:h=2,absoluteStrokeWidth:g=!1,color:_=`currentColor`,className:v=``}=f()??{},y=r??g?Number(n??h)*24/Number(t??m):n??h;return(0,i.createElement)(`svg`,{ref:p,...l,width:t??m??l.width,height:t??m??l.height,stroke:e??_,strokeWidth:y,className:a(`lucide`,v,o),...!s&&!u(d)&&{"aria-hidden":`true`},...d},[...c.map(([e,t])=>(0,i.createElement)(e,t)),...Array.isArray(s)?s:[s]])}),m=(e,t)=>{let n=(0,i.forwardRef)(({className:n,...r},s)=>(0,i.createElement)(p,{ref:s,iconNode:t,className:a(`lucide-${o(c(e))}`,`lucide-${e}`,n),...r}));return n.displayName=c(e),n},h=m(`activity`,[[`path`,{d:`M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2`,key:`169zse`}]]),g=m(`arrow-down-to-line`,[[`path`,{d:`M12 17V3`,key:`1cwfxf`}],[`path`,{d:`m6 11 6 6 6-6`,key:`12ii2o`}],[`path`,{d:`M19 21H5`,key:`150jfl`}]]),_=m(`bell-ring`,[[`path`,{d:`M10.268 21a2 2 0 0 0 3.464 0`,key:`vwvbt9`}],[`path`,{d:`M22 8c0-2.3-.8-4.3-2-6`,key:`5bb3ad`}],[`path`,{d:`M3.262 15.326A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673C19.41 13.956 18 12.499 18 8A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326`,key:`11g9vi`}],[`path`,{d:`M4 2C2.8 3.7 2 5.7 2 8`,key:`tap9e0`}]]),v=m(`bot`,[[`path`,{d:`M12 8V4H8`,key:`hb8ula`}],[`rect`,{width:`16`,height:`12`,x:`4`,y:`8`,rx:`2`,key:`enze0r`}],[`path`,{d:`M2 14h2`,key:`vft8re`}],[`path`,{d:`M20 14h2`,key:`4cs60a`}],[`path`,{d:`M15 13v2`,key:`1xurst`}],[`path`,{d:`M9 13v2`,key:`rq6x2g`}]]),y=m(`brain-circuit`,[[`path`,{d:`M12 5a3 3 0 1 0-5.997.125 4 4 0 0 0-2.526 5.77 4 4 0 0 0 .556 6.588A4 4 0 1 0 12 18Z`,key:`l5xja`}],[`path`,{d:`M9 13a4.5 4.5 0 0 0 3-4`,key:`10igwf`}],[`path`,{d:`M6.003 5.125A3 3 0 0 0 6.401 6.5`,key:`105sqy`}],[`path`,{d:`M3.477 10.896a4 4 0 0 1 .585-.396`,key:`ql3yin`}],[`path`,{d:`M6 18a4 4 0 0 1-1.967-.516`,key:`2e4loj`}],[`path`,{d:`M12 13h4`,key:`1ku699`}],[`path`,{d:`M12 18h6a2 2 0 0 1 2 2v1`,key:`105ag5`}],[`path`,{d:`M12 8h8`,key:`1lhi5i`}],[`path`,{d:`M16 8V5a2 2 0 0 1 2-2`,key:`u6izg6`}],[`circle`,{cx:`16`,cy:`13`,r:`.5`,key:`ry7gng`}],[`circle`,{cx:`18`,cy:`3`,r:`.5`,key:`1aiba7`}],[`circle`,{cx:`20`,cy:`21`,r:`.5`,key:`yhc1fs`}],[`circle`,{cx:`20`,cy:`8`,r:`.5`,key:`1e43v0`}]]),b=m(`brain`,[[`path`,{d:`M12 18V5`,key:`adv99a`}],[`path`,{d:`M15 13a4.17 4.17 0 0 1-3-4 4.17 4.17 0 0 1-3 4`,key:`1e3is1`}],[`path`,{d:`M17.598 6.5A3 3 0 1 0 12 5a3 3 0 1 0-5.598 1.5`,key:`1gqd8o`}],[`path`,{d:`M17.997 5.125a4 4 0 0 1 2.526 5.77`,key:`iwvgf7`}],[`path`,{d:`M18 18a4 4 0 0 0 2-7.464`,key:`efp6ie`}],[`path`,{d:`M19.967 17.483A4 4 0 1 1 12 18a4 4 0 1 1-7.967-.517`,key:`1gq6am`}],[`path`,{d:`M6 18a4 4 0 0 1-2-7.464`,key:`k1g0md`}],[`path`,{d:`M6.003 5.125a4 4 0 0 0-2.526 5.77`,key:`q97ue3`}]]),x=m(`chart-no-axes-combined`,[[`path`,{d:`M12 16v5`,key:`zza2cw`}],[`path`,{d:`M16 14.639V21`,key:`1s85h0`}],[`path`,{d:`M20 10.656V21`,key:`q45596`}],[`path`,{d:`m22 3-8.646 8.646a.5.5 0 0 1-.708 0L9.354 8.354a.5.5 0 0 0-.707 0L2 15`,key:`1fw8x9`}],[`path`,{d:`M4 18.463V21`,key:`1otddq`}],[`path`,{d:`M8 14.656V21`,key:`1t2idw`}]]),S=m(`check`,[[`path`,{d:`M20 6 9 17l-5-5`,key:`1gmf2c`}]]),C=m(`chevron-down`,[[`path`,{d:`m6 9 6 6 6-6`,key:`qrunsl`}]]),w=m(`chevron-right`,[[`path`,{d:`m9 18 6-6-6-6`,key:`mthhwq`}]]),T=m(`chevrons-down`,[[`path`,{d:`m7 6 5 5 5-5`,key:`1lc07p`}],[`path`,{d:`m7 13 5 5 5-5`,key:`1d48rs`}]]),E=m(`chevrons-up`,[[`path`,{d:`m17 11-5-5-5 5`,key:`e8nh98`}],[`path`,{d:`m17 18-5-5-5 5`,key:`2avn1x`}]]),D=m(`circle-check-big`,[[`path`,{d:`M21.801 10A10 10 0 1 1 17 3.335`,key:`yps3ct`}],[`path`,{d:`m9 11 3 3L22 4`,key:`1pflzl`}]]),O=m(`circle-check`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m9 12 2 2 4-4`,key:`dzmm74`}]]),k=m(`circle-dollar-sign`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M16 8h-6a2 2 0 1 0 0 4h4a2 2 0 1 1 0 4H8`,key:`1h4pet`}],[`path`,{d:`M12 18V6`,key:`zqpxq5`}]]),A=m(`circle-question-mark`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3`,key:`1u773s`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]]),j=m(`circle-slash`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`line`,{x1:`9`,x2:`15`,y1:`15`,y2:`9`,key:`1dfufj`}]]),M=m(`circle-x`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m15 9-6 6`,key:`1uzhvr`}],[`path`,{d:`m9 9 6 6`,key:`z0biqf`}]]),N=m(`clipboard-list`,[[`rect`,{width:`8`,height:`4`,x:`8`,y:`2`,rx:`1`,ry:`1`,key:`tgr4d6`}],[`path`,{d:`M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2`,key:`116196`}],[`path`,{d:`M12 11h4`,key:`1jrz19`}],[`path`,{d:`M12 16h4`,key:`n85exb`}],[`path`,{d:`M8 11h.01`,key:`1dfujw`}],[`path`,{d:`M8 16h.01`,key:`18s6g9`}]]),P=m(`clock-3`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 6v6h4`,key:`135r8i`}]]),F=m(`code-xml`,[[`path`,{d:`m18 16 4-4-4-4`,key:`1inbqp`}],[`path`,{d:`m6 8-4 4 4 4`,key:`15zrgr`}],[`path`,{d:`m14.5 4-5 16`,key:`e7oirm`}]]),I=m(`columns-3`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M9 3v18`,key:`fh3hqa`}],[`path`,{d:`M15 3v18`,key:`14nvp0`}]]),L=m(`copy`,[[`rect`,{width:`14`,height:`14`,x:`8`,y:`8`,rx:`2`,ry:`2`,key:`17jyea`}],[`path`,{d:`M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2`,key:`zix9uf`}]]),ee=m(`database`,[[`ellipse`,{cx:`12`,cy:`5`,rx:`9`,ry:`3`,key:`msslwz`}],[`path`,{d:`M3 5V19A9 3 0 0 0 21 19V5`,key:`1wlel7`}],[`path`,{d:`M3 12A9 3 0 0 0 21 12`,key:`mv7ke4`}]]),te=m(`external-link`,[[`path`,{d:`M15 3h6v6`,key:`1q9fwt`}],[`path`,{d:`M10 14 21 3`,key:`gplh6r`}],[`path`,{d:`M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6`,key:`a6xqqp`}]]),R=m(`file-braces`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1`,key:`1oajmo`}],[`path`,{d:`M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1`,key:`mpwhp6`}]]),z=m(`file-pen`,[[`path`,{d:`M12.659 22H18a2 2 0 0 0 2-2V8a2.4 2.4 0 0 0-.706-1.706l-3.588-3.588A2.4 2.4 0 0 0 14 2H6a2 2 0 0 0-2 2v9.34`,key:`o6klzx`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M10.378 12.622a1 1 0 0 1 3 3.003L8.36 20.637a2 2 0 0 1-.854.506l-2.867.837a.5.5 0 0 1-.62-.62l.836-2.869a2 2 0 0 1 .506-.853z`,key:`zhnas1`}]]),B=m(`file-text`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M10 9H8`,key:`b1mrlr`}],[`path`,{d:`M16 13H8`,key:`t4e002`}],[`path`,{d:`M16 17H8`,key:`z1uh3a`}]]),V=m(`flask-conical`,[[`path`,{d:`M14 2v6a2 2 0 0 0 .245.96l5.51 10.08A2 2 0 0 1 18 22H6a2 2 0 0 1-1.755-2.96l5.51-10.08A2 2 0 0 0 10 8V2`,key:`18mbvz`}],[`path`,{d:`M6.453 15h11.094`,key:`3shlmq`}],[`path`,{d:`M8.5 2h7`,key:`csnxdl`}]]),H=m(`folder-git-2`,[[`path`,{d:`M18 19a5 5 0 0 1-5-5v8`,key:`sz5oeg`}],[`path`,{d:`M9 20H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v5`,key:`1w6njk`}],[`circle`,{cx:`13`,cy:`12`,r:`2`,key:`1j92g6`}],[`circle`,{cx:`20`,cy:`19`,r:`2`,key:`1obnsp`}]]),U=m(`folder-open`,[[`path`,{d:`m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2`,key:`usdka0`}]]),W=m(`folder-tree`,[[`path`,{d:`M20 10a1 1 0 0 0 1-1V6a1 1 0 0 0-1-1h-2.5a1 1 0 0 1-.8-.4l-.9-1.2A1 1 0 0 0 15 3h-2a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z`,key:`hod4my`}],[`path`,{d:`M20 21a1 1 0 0 0 1-1v-3a1 1 0 0 0-1-1h-2.9a1 1 0 0 1-.88-.55l-.42-.85a1 1 0 0 0-.92-.6H13a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z`,key:`w4yl2u`}],[`path`,{d:`M3 5a2 2 0 0 0 2 2h3`,key:`f2jnh7`}],[`path`,{d:`M3 3v13a2 2 0 0 0 2 2h3`,key:`k8epm1`}]]),G=m(`gauge`,[[`path`,{d:`m12 14 4-4`,key:`9kzdfg`}],[`path`,{d:`M3.34 19a10 10 0 1 1 17.32 0`,key:`19p75a`}]]),K=m(`git-branch`,[[`path`,{d:`M15 6a9 9 0 0 0-9 9V3`,key:`1cii5b`}],[`circle`,{cx:`18`,cy:`6`,r:`3`,key:`1h7g24`}],[`circle`,{cx:`6`,cy:`18`,r:`3`,key:`fqmcym`}]]),q=m(`git-compare`,[[`circle`,{cx:`18`,cy:`18`,r:`3`,key:`1xkwt0`}],[`circle`,{cx:`6`,cy:`6`,r:`3`,key:`1lh9wr`}],[`path`,{d:`M13 6h3a2 2 0 0 1 2 2v7`,key:`1yeb86`}],[`path`,{d:`M11 18H8a2 2 0 0 1-2-2V9`,key:`19pyzm`}]]),J=m(`git-merge`,[[`circle`,{cx:`18`,cy:`18`,r:`3`,key:`1xkwt0`}],[`circle`,{cx:`6`,cy:`6`,r:`3`,key:`1lh9wr`}],[`path`,{d:`M6 21V9a9 9 0 0 0 9 9`,key:`7kw0sc`}]]),Y=m(`globe`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20`,key:`13o1zl`}],[`path`,{d:`M2 12h20`,key:`9i4pu4`}]]),X=m(`hammer`,[[`path`,{d:`m15 12-9.373 9.373a1 1 0 0 1-3.001-3L12 9`,key:`1hayfq`}],[`path`,{d:`m18 15 4-4`,key:`16gjal`}],[`path`,{d:`m21.5 11.5-1.914-1.914A2 2 0 0 1 19 8.172v-.344a2 2 0 0 0-.586-1.414l-1.657-1.657A6 6 0 0 0 12.516 3H9l1.243 1.243A6 6 0 0 1 12 8.485V10l2 2h1.172a2 2 0 0 1 1.414.586L18.5 14.5`,key:`15ts47`}]]),Z=m(`hand`,[[`path`,{d:`M18 11V6a2 2 0 0 0-2-2a2 2 0 0 0-2 2`,key:`1fvzgz`}],[`path`,{d:`M14 10V4a2 2 0 0 0-2-2a2 2 0 0 0-2 2v2`,key:`1kc0my`}],[`path`,{d:`M10 10.5V6a2 2 0 0 0-2-2a2 2 0 0 0-2 2v8`,key:`10h0bg`}],[`path`,{d:`M18 8a2 2 0 1 1 4 0v6a8 8 0 0 1-8 8h-2c-2.8 0-4.5-.86-5.99-2.34l-3.6-3.6a2 2 0 0 1 2.83-2.82L7 15`,key:`1s1gnw`}]]),Q=m(`hash`,[[`line`,{x1:`4`,x2:`20`,y1:`9`,y2:`9`,key:`4lhtct`}],[`line`,{x1:`4`,x2:`20`,y1:`15`,y2:`15`,key:`vyu0kd`}],[`line`,{x1:`10`,x2:`8`,y1:`3`,y2:`21`,key:`1ggp8o`}],[`line`,{x1:`16`,x2:`14`,y1:`3`,y2:`21`,key:`weycgp`}]]),ne=m(`history`,[[`path`,{d:`M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`,key:`1357e3`}],[`path`,{d:`M3 3v5h5`,key:`1xhq8a`}],[`path`,{d:`M12 7v5l4 2`,key:`1fdv2h`}]]),re=m(`inbox`,[[`polyline`,{points:`22 12 16 12 14 15 10 15 8 12 2 12`,key:`o97t9d`}],[`path`,{d:`M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z`,key:`oot6mr`}]]),ie=m(`info`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 16v-4`,key:`1dtifu`}],[`path`,{d:`M12 8h.01`,key:`e9boi3`}]]),ae=m(`key-round`,[[`path`,{d:`M2.586 17.414A2 2 0 0 0 2 18.828V21a1 1 0 0 0 1 1h3a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h1a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h.172a2 2 0 0 0 1.414-.586l.814-.814a6.5 6.5 0 1 0-4-4z`,key:`1s6t7t`}],[`circle`,{cx:`16.5`,cy:`7.5`,r:`.5`,fill:`currentColor`,key:`w0ekpg`}]]),oe=m(`layout-dashboard`,[[`rect`,{width:`7`,height:`9`,x:`3`,y:`3`,rx:`1`,key:`10lvy0`}],[`rect`,{width:`7`,height:`5`,x:`14`,y:`3`,rx:`1`,key:`16une8`}],[`rect`,{width:`7`,height:`9`,x:`14`,y:`12`,rx:`1`,key:`1hutg5`}],[`rect`,{width:`7`,height:`5`,x:`3`,y:`16`,rx:`1`,key:`ldoo1y`}]]),se=m(`layout-grid`,[[`rect`,{width:`7`,height:`7`,x:`3`,y:`3`,rx:`1`,key:`1g98yp`}],[`rect`,{width:`7`,height:`7`,x:`14`,y:`3`,rx:`1`,key:`6d4xhi`}],[`rect`,{width:`7`,height:`7`,x:`14`,y:`14`,rx:`1`,key:`nxv5o0`}],[`rect`,{width:`7`,height:`7`,x:`3`,y:`14`,rx:`1`,key:`1bb6yr`}]]),ce=m(`life-buoy`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m4.93 4.93 4.24 4.24`,key:`1ymg45`}],[`path`,{d:`m14.83 9.17 4.24-4.24`,key:`1cb5xl`}],[`path`,{d:`m14.83 14.83 4.24 4.24`,key:`q42g0n`}],[`path`,{d:`m9.17 14.83-4.24 4.24`,key:`bqpfvv`}],[`circle`,{cx:`12`,cy:`12`,r:`4`,key:`4exip2`}]]),le=m(`list-checks`,[[`path`,{d:`M13 5h8`,key:`a7qcls`}],[`path`,{d:`M13 12h8`,key:`h98zly`}],[`path`,{d:`M13 19h8`,key:`c3s6r1`}],[`path`,{d:`m3 17 2 2 4-4`,key:`1jhpwq`}],[`path`,{d:`m3 7 2 2 4-4`,key:`1obspn`}]]),ue=m(`list-plus`,[[`path`,{d:`M16 5H3`,key:`m91uny`}],[`path`,{d:`M11 12H3`,key:`51ecnj`}],[`path`,{d:`M16 19H3`,key:`zzsher`}],[`path`,{d:`M18 9v6`,key:`1twb98`}],[`path`,{d:`M21 12h-6`,key:`bt1uis`}]]),de=m(`list-todo`,[[`path`,{d:`M13 5h8`,key:`a7qcls`}],[`path`,{d:`M13 12h8`,key:`h98zly`}],[`path`,{d:`M13 19h8`,key:`c3s6r1`}],[`path`,{d:`m3 17 2 2 4-4`,key:`1jhpwq`}],[`rect`,{x:`3`,y:`4`,width:`6`,height:`6`,rx:`1`,key:`cif1o7`}]]),fe=m(`list-tree`,[[`path`,{d:`M8 5h13`,key:`1pao27`}],[`path`,{d:`M13 12h8`,key:`h98zly`}],[`path`,{d:`M13 19h8`,key:`c3s6r1`}],[`path`,{d:`M3 10a2 2 0 0 0 2 2h3`,key:`1npucw`}],[`path`,{d:`M3 5v12a2 2 0 0 0 2 2h3`,key:`x1gjn2`}]]),pe=m(`lock-keyhole`,[[`circle`,{cx:`12`,cy:`16`,r:`1`,key:`1au0dj`}],[`rect`,{x:`3`,y:`10`,width:`18`,height:`12`,rx:`2`,key:`6s8ecr`}],[`path`,{d:`M7 10V7a5 5 0 0 1 10 0v3`,key:`1pqi11`}]]),me=m(`log-out`,[[`path`,{d:`m16 17 5-5-5-5`,key:`1bji2h`}],[`path`,{d:`M21 12H9`,key:`dn1m92`}],[`path`,{d:`M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4`,key:`1uf3rs`}]]),he=m(`mail-plus`,[[`path`,{d:`M22 13V6a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2v12c0 1.1.9 2 2 2h8`,key:`12jkf8`}],[`path`,{d:`m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7`,key:`1ocrg3`}],[`path`,{d:`M19 16v6`,key:`tddt3s`}],[`path`,{d:`M16 19h6`,key:`xwg31i`}]]),ge=m(`mail`,[[`path`,{d:`m22 7-8.991 5.727a2 2 0 0 1-2.009 0L2 7`,key:`132q7q`}],[`rect`,{x:`2`,y:`4`,width:`20`,height:`16`,rx:`2`,key:`izxlao`}]]),_e=m(`megaphone`,[[`path`,{d:`M11 6a13 13 0 0 0 8.4-2.8A1 1 0 0 1 21 4v12a1 1 0 0 1-1.6.8A13 13 0 0 0 11 14H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2z`,key:`q8bfy3`}],[`path`,{d:`M6 14a12 12 0 0 0 2.4 7.2 2 2 0 0 0 3.2-2.4A8 8 0 0 1 10 14`,key:`1853fq`}],[`path`,{d:`M8 6v8`,key:`15ugcq`}]]),ve=m(`message-circle`,[[`path`,{d:`M2.992 16.342a2 2 0 0 1 .094 1.167l-1.065 3.29a1 1 0 0 0 1.236 1.168l3.413-.998a2 2 0 0 1 1.099.092 10 10 0 1 0-4.777-4.719`,key:`1sd12s`}]]),ye=m(`message-square-text`,[[`path`,{d:`M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z`,key:`18887p`}],[`path`,{d:`M7 11h10`,key:`1twpyw`}],[`path`,{d:`M7 15h6`,key:`d9of3u`}],[`path`,{d:`M7 7h8`,key:`af5zfr`}]]),be=m(`monitor-smartphone`,[[`path`,{d:`M18 8V6a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2v7a2 2 0 0 0 2 2h8`,key:`10dyio`}],[`path`,{d:`M10 19v-3.96 3.15`,key:`1irgej`}],[`path`,{d:`M7 19h5`,key:`qswx4l`}],[`rect`,{width:`6`,height:`10`,x:`16`,y:`12`,rx:`2`,key:`1egngj`}]]),xe=m(`moon`,[[`path`,{d:`M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401`,key:`kfwtm`}]]),Se=m(`network`,[[`rect`,{x:`16`,y:`16`,width:`6`,height:`6`,rx:`1`,key:`4q2zg0`}],[`rect`,{x:`2`,y:`16`,width:`6`,height:`6`,rx:`1`,key:`8cvhb9`}],[`rect`,{x:`9`,y:`2`,width:`6`,height:`6`,rx:`1`,key:`1egb70`}],[`path`,{d:`M5 16v-3a1 1 0 0 1 1-1h12a1 1 0 0 1 1 1v3`,key:`1jsf9p`}],[`path`,{d:`M12 12V8`,key:`2874zd`}]]),Ce=m(`notebook-pen`,[[`path`,{d:`M13.4 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-7.4`,key:`re6nr2`}],[`path`,{d:`M2 6h4`,key:`aawbzj`}],[`path`,{d:`M2 10h4`,key:`l0bgd4`}],[`path`,{d:`M2 14h4`,key:`1gsvsf`}],[`path`,{d:`M2 18h4`,key:`1bu2t1`}],[`path`,{d:`M21.378 5.626a1 1 0 1 0-3.004-3.004l-5.01 5.012a2 2 0 0 0-.506.854l-.837 2.87a.5.5 0 0 0 .62.62l2.87-.837a2 2 0 0 0 .854-.506z`,key:`pqwjuv`}]]),we=m(`octagon-x`,[[`path`,{d:`m15 9-6 6`,key:`1uzhvr`}],[`path`,{d:`M2.586 16.726A2 2 0 0 1 2 15.312V8.688a2 2 0 0 1 .586-1.414l4.688-4.688A2 2 0 0 1 8.688 2h6.624a2 2 0 0 1 1.414.586l4.688 4.688A2 2 0 0 1 22 8.688v6.624a2 2 0 0 1-.586 1.414l-4.688 4.688a2 2 0 0 1-1.414.586H8.688a2 2 0 0 1-1.414-.586z`,key:`2d38gg`}],[`path`,{d:`m9 9 6 6`,key:`z0biqf`}]]),Te=m(`package`,[[`path`,{d:`M11 21.73a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73z`,key:`1a0edw`}],[`path`,{d:`M12 22V12`,key:`d0xqtd`}],[`polyline`,{points:`3.29 7 12 12 20.71 7`,key:`ousv84`}],[`path`,{d:`m7.5 4.27 9 5.15`,key:`1c824w`}]]),Ee=m(`panel-left-close`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M9 3v18`,key:`fh3hqa`}],[`path`,{d:`m16 15-3-3 3-3`,key:`14y99z`}]]),De=m(`panel-left-open`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M9 3v18`,key:`fh3hqa`}],[`path`,{d:`m14 9 3 3-3 3`,key:`8010ee`}]]),Oe=m(`pin`,[[`path`,{d:`M12 17v5`,key:`bb1du9`}],[`path`,{d:`M9 10.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-.76a2 2 0 0 0-1.11-1.79l-1.78-.9A2 2 0 0 1 15 10.76V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H8a2 2 0 0 0 0 4 1 1 0 0 1 1 1z`,key:`1nkz8b`}]]),ke=m(`radio-tower`,[[`path`,{d:`M4.9 16.1C1 12.2 1 5.8 4.9 1.9`,key:`s0qx1y`}],[`path`,{d:`M7.8 4.7a6.14 6.14 0 0 0-.8 7.5`,key:`1idnkw`}],[`circle`,{cx:`12`,cy:`9`,r:`2`,key:`1092wv`}],[`path`,{d:`M16.2 4.8c2 2 2.26 5.11.8 7.47`,key:`ojru2q`}],[`path`,{d:`M19.1 1.9a9.96 9.96 0 0 1 0 14.1`,key:`rhi7fg`}],[`path`,{d:`M9.5 18h5`,key:`mfy3pd`}],[`path`,{d:`m8 22 4-11 4 11`,key:`25yftu`}]]),Ae=m(`refresh-cw`,[[`path`,{d:`M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8`,key:`v9h5vc`}],[`path`,{d:`M21 3v5h-5`,key:`1q7to0`}],[`path`,{d:`M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16`,key:`3uifl3`}],[`path`,{d:`M8 16H3v5`,key:`1cv678`}]]),je=m(`rotate-ccw`,[[`path`,{d:`M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`,key:`1357e3`}],[`path`,{d:`M3 3v5h5`,key:`1xhq8a`}]]),Me=m(`scroll-text`,[[`path`,{d:`M15 12h-5`,key:`r7krc0`}],[`path`,{d:`M15 8h-5`,key:`1khuty`}],[`path`,{d:`M19 17V5a2 2 0 0 0-2-2H4`,key:`zz82l3`}],[`path`,{d:`M8 21h12a2 2 0 0 0 2-2v-1a1 1 0 0 0-1-1H11a1 1 0 0 0-1 1v1a2 2 0 1 1-4 0V5a2 2 0 1 0-4 0v2a1 1 0 0 0 1 1h3`,key:`1ph1d7`}]]),Ne=m(`search`,[[`path`,{d:`m21 21-4.34-4.34`,key:`14j7rj`}],[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`4ej97u`}]]),Pe=m(`send`,[[`path`,{d:`M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z`,key:`1ffxy3`}],[`path`,{d:`m21.854 2.147-10.94 10.939`,key:`12cjpa`}]]),Fe=m(`server`,[[`rect`,{width:`20`,height:`8`,x:`2`,y:`2`,rx:`2`,ry:`2`,key:`ngkwjq`}],[`rect`,{width:`20`,height:`8`,x:`2`,y:`14`,rx:`2`,ry:`2`,key:`iecqi9`}],[`line`,{x1:`6`,x2:`6.01`,y1:`6`,y2:`6`,key:`16zg32`}],[`line`,{x1:`6`,x2:`6.01`,y1:`18`,y2:`18`,key:`nzw8ys`}]]),Ie=m(`settings-2`,[[`path`,{d:`M14 17H5`,key:`gfn3mx`}],[`path`,{d:`M19 7h-9`,key:`6i9tg`}],[`circle`,{cx:`17`,cy:`17`,r:`3`,key:`18b49y`}],[`circle`,{cx:`7`,cy:`7`,r:`3`,key:`dfmy0x`}]]),Le=m(`settings`,[[`path`,{d:`M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915`,key:`1i5ecw`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]),Re=m(`shell`,[[`path`,{d:`M14 11a2 2 0 1 1-4 0 4 4 0 0 1 8 0 6 6 0 0 1-12 0 8 8 0 0 1 16 0 10 10 0 1 1-20 0 11.93 11.93 0 0 1 2.42-7.22 2 2 0 1 1 3.16 2.44`,key:`1cn552`}]]),ze=m(`shield-check`,[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}],[`path`,{d:`m9 12 2 2 4-4`,key:`dzmm74`}]]),Be=m(`shield-off`,[[`path`,{d:`m2 2 20 20`,key:`1ooewy`}],[`path`,{d:`M5 5a1 1 0 0 0-1 1v7c0 5 3.5 7.5 7.67 8.94a1 1 0 0 0 .67.01c2.35-.82 4.48-1.97 5.9-3.71`,key:`1jlk70`}],[`path`,{d:`M9.309 3.652A12.252 12.252 0 0 0 11.24 2.28a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1v7a9.784 9.784 0 0 1-.08 1.264`,key:`18rp1v`}]]),Ve=m(`square-terminal`,[[`path`,{d:`m7 11 2-2-2-2`,key:`1lz0vl`}],[`path`,{d:`M11 13h4`,key:`1p7l4v`}],[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,ry:`2`,key:`1m3agn`}]]),$=m(`sun`,[[`circle`,{cx:`12`,cy:`12`,r:`4`,key:`4exip2`}],[`path`,{d:`M12 2v2`,key:`tus03m`}],[`path`,{d:`M12 20v2`,key:`1lh1kg`}],[`path`,{d:`m4.93 4.93 1.41 1.41`,key:`149t6j`}],[`path`,{d:`m17.66 17.66 1.41 1.41`,key:`ptbguv`}],[`path`,{d:`M2 12h2`,key:`1t8f8n`}],[`path`,{d:`M20 12h2`,key:`1q8mjw`}],[`path`,{d:`m6.34 17.66-1.41 1.41`,key:`1m8zz5`}],[`path`,{d:`m19.07 4.93-1.41 1.41`,key:`1shlcs`}]]),He=m(`trash-2`,[[`path`,{d:`M10 11v6`,key:`nco0om`}],[`path`,{d:`M14 11v6`,key:`outv1u`}],[`path`,{d:`M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6`,key:`miytrc`}],[`path`,{d:`M3 6h18`,key:`d0wm0j`}],[`path`,{d:`M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2`,key:`e791ji`}]]),Ue=m(`triangle-alert`,[[`path`,{d:`m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3`,key:`wmoenq`}],[`path`,{d:`M12 9v4`,key:`juzpu7`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]]),We=m(`user-round`,[[`circle`,{cx:`12`,cy:`8`,r:`5`,key:`1hypcn`}],[`path`,{d:`M20 21a8 8 0 0 0-16 0`,key:`rfgkzh`}]]),Ge=m(`users`,[[`path`,{d:`M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2`,key:`1yyitq`}],[`path`,{d:`M16 3.128a4 4 0 0 1 0 7.744`,key:`16gr8j`}],[`path`,{d:`M22 21v-2a4 4 0 0 0-3-3.87`,key:`kshegd`}],[`circle`,{cx:`9`,cy:`7`,r:`4`,key:`nufk8`}]]),Ke=m(`wifi-off`,[[`path`,{d:`M12 20h.01`,key:`zekei9`}],[`path`,{d:`M8.5 16.429a5 5 0 0 1 7 0`,key:`1bycff`}],[`path`,{d:`M5 12.859a10 10 0 0 1 5.17-2.69`,key:`1dl1wf`}],[`path`,{d:`M19 12.859a10 10 0 0 0-2.007-1.523`,key:`4k23kn`}],[`path`,{d:`M2 8.82a15 15 0 0 1 4.177-2.643`,key:`1grhjp`}],[`path`,{d:`M22 8.82a15 15 0 0 0-11.288-3.764`,key:`z3jwby`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}]]),qe=m(`wifi`,[[`path`,{d:`M12 20h.01`,key:`zekei9`}],[`path`,{d:`M2 8.82a15 15 0 0 1 20 0`,key:`dnpr2z`}],[`path`,{d:`M5 12.859a10 10 0 0 1 14 0`,key:`1x1e6c`}],[`path`,{d:`M8.5 16.429a5 5 0 0 1 7 0`,key:`1bycff`}]]),Je=m(`wrench`,[[`path`,{d:`M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.106-3.105c.32-.322.863-.22.983.218a6 6 0 0 1-8.259 7.057l-7.91 7.91a1 1 0 0 1-2.999-3l7.91-7.91a6 6 0 0 1 7.057-8.259c.438.12.54.662.219.984z`,key:`1ngwbx`}]]),Ye=m(`x`,[[`path`,{d:`M18 6 6 18`,key:`1bl5f8`}],[`path`,{d:`m6 6 12 12`,key:`d8bk6v`}]]),Xe=m(`zap`,[[`path`,{d:`M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z`,key:`1xq2db`}]]);export{X as $,Se as A,x as At,fe as B,ke as C,O as Ct,Te as D,w as Dt,Ee as E,T as Et,_e as F,g as Ft,se as G,ue as H,ge as I,h as It,ie as J,oe as K,he as L,r as Lt,be as M,y as Mt,ye as N,v as Nt,we as O,C as Ot,ve as P,_ as Pt,Z as Q,me as R,Ae as S,k as St,De as T,E as Tt,le as U,de as V,ce as W,ne as X,re as Y,Q as Z,Fe as _,P as _t,Ke as a,W as at,Me as b,j as bt,Ue as c,V as ct,Ve as d,R as dt,Y as et,Be as f,te as ft,Ie as g,F as gt,Le as h,I as ht,qe as i,G as it,xe as j,b as jt,Ce as k,S as kt,He as l,B as lt,Re as m,L as mt,Ye as n,q as nt,Ge as o,U as ot,ze as p,ee as pt,ae as q,Je as r,K as rt,We as s,H as st,Xe as t,J as tt,$ as u,z as ut,Pe as v,N as vt,Oe as w,D as wt,je as x,A as xt,Ne as y,M as yt,pe as z};
@@ -1,2 +0,0 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/cockpit-Dj4gx69d.js","assets/rolldown-runtime-QTnfLwEv.js","assets/icons-BV2PcvP1.js","assets/markdown-HUVrfVaI.js","assets/fleet-map-B2eU2NoT.js","assets/vendor-DT5_U5Rx.js","assets/fleet-topology-CTK7p_tj.js","assets/live-console-BRrd34p2.js","assets/mailbox-CtUPdH7g.js","assets/use-backfilled-events-ceR5R8_K.js","assets/kanban-6xxUvXep.js","assets/cost-DdiRINxE.js","assets/brain-aSSiXPI_.js","assets/worktree-DrEOGtox.js","assets/trends-Bl-Wyntb.js","assets/alerts-Bkl4wBJE.js","assets/control-BcPCPylB.js","assets/settings-M1WNoX6Y.js"])))=>i.map(i=>d[i]);
2
- import{r as e,t}from"./rolldown-runtime-QTnfLwEv.js";import{A as n,At as r,C as i,Ct as a,E as o,It as s,J as c,K as l,Lt as u,Mt as d,N as f,Pt as ee,R as te,St as ne,T as re,Y as ie,_ as ae,a as oe,c as p,g as m,ht as h,i as se,j as ce,mt as g,n as _,o as le,p as ue,rt as de,u as fe,x as v,yt as pe}from"./icons-BV2PcvP1.js";import{t as y}from"./vendor-DT5_U5Rx.js";import{i as me}from"./markdown-HUVrfVaI.js";(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),e.crossOrigin===`use-credentials`?t.credentials=`include`:e.crossOrigin===`anonymous`?t.credentials=`omit`:t.credentials=`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var b={maxReconnectAttempts:10,initialBackoffMs:1e3,maxBackoffMs:3e4,backoffMultiplier:2,jitterRatio:0,queueLimit:1e3,heartbeatIntervalMs:0,heartbeatTimeoutMs:0};function he(){return{phase:`idle`,reconnectAttempt:0,lastActivityAt:null,stopped:!1}}function ge(e){return e.stopped?e:{...e,phase:`connecting`}}function _e(e,t=Date.now()){return{...e,phase:`open`,reconnectAttempt:0,lastActivityAt:t,stopped:!1}}function ve(e,t=Date.now()){return{...e,lastActivityAt:t}}function ye(e){return{...e,phase:`closed`,stopped:!0}}function be(e,t,n=Date.now(),r=Math.random){if(e.stopped||e.reconnectAttempt>=t.maxReconnectAttempts)return{state:{...e,phase:`closed`},plan:null};let i=e.reconnectAttempt+1,a=Math.min(t.initialBackoffMs*t.backoffMultiplier**(i-1),t.maxBackoffMs),o=(r()*2-1)*t.jitterRatio,s=Math.max(0,Math.round(a*(1+o)));return{state:{...e,phase:`reconnecting`,reconnectAttempt:i},plan:{attempt:i,delayMs:s,retryAt:n+s}}}function xe(e,t,n=Date.now()){return e.phase!==`open`||e.lastActivityAt===null||t.heartbeatIntervalMs<=0?!1:n-e.lastActivityAt>t.heartbeatIntervalMs+t.heartbeatTimeoutMs}var Se=`abort,ping,user_message,tool.confirm_result,completion.request,model.switch,model.refine,autonomy.switch,context.clear,context.compact,context.debug,context.editor.open,context.editor.validate,context.editor.apply,context.mode.create,context.mode.delete,context.mode.switch,context.mode.update,context.modes.list,context.repair,mode.switch,modes.list,session.checkpoints,session.delete,session.new,session.rename,session.resume,session.rewind,session.save,sessions.list,side_effects.list,stats.get,todo.update,todos.clear,todos.get,todos.remove`.split(`,`),Ce=[`collab.join`,`collab.leave`,`collab.annotate`,`collab.resolve`,`collab.request_pause`,`collab.resume`,`collab.grant_control`,`collab.inject_tool`,`mailbox.action`,`mailbox.agents`,`mailbox.clear`,`mailbox.compact`,`mailbox.messages`,`mailbox.purge`,`mailbox.send`],we=`brain.ask,brain.config.get,brain.config.set,brain.risk,brain.status,chronicle.facet,chronicle.facets,chronicle.graph,chronicle.metrics,chronicle.query,chronicle.status,config.doctor,design.list,design.materialize,design.set,design.state,design.swap,design.tune,design.use,design.verify,memory.list,memory.sage.backfillRecoverable,memory.sage.candidateResolve,memory.sage.delete,memory.sage.forFile,memory.sage.get,memory.sage.graph,memory.sage.list,memory.sage.listPage,memory.sage.recover,memory.sage.remember,memory.sage.update`.split(`,`),Te=`auth.oauth.cancel,auth.oauth.code,auth.oauth.start,mcp.add,mcp.disable,mcp.discover,mcp.enable,mcp.list,mcp.prompt.get,mcp.prompts,mcp.remove,mcp.resource.read,mcp.resources,mcp.restart,mcp.sleep,mcp.update,mcp.wake,prompts.content,prompts.create,prompts.favorite,prompts.list,prompts.recent,prompts.search,prompts.used,skills.content,skills.create,skills.edit,skills.export,skills.install,skills.list,skills.uninstall,skills.update`.split(`,`),Ee=`goal-state.get,goal.addTask,goal.assess,goal.assignTask,goal.clear,goal.get,goal.list,goal.load,goal.moveTask,goal.pause,goal.resume,goal.retryTask,goal.revert,goal.runTask,goal.save,goal.selectPhase,goal.start,goal.state,goal.status,goal.stop,goal.taskStatus,goal.toggleAutonomous,plan.get,plan.item.update,plan.template_use,task.update,tasks.get`.split(`,`),De=`sdd.board.cancel_task,sdd.board.cleanup_worktrees,sdd.board.delete_task,sdd.board.destroy,sdd.board.get,sdd.board.list,sdd.board.pause,sdd.board.reassign,sdd.board.resume,sdd.board.retry,sdd.board.retry_all_failed,sdd.board.rollback,sdd.board.set_task_fallbacks,sdd.board.set_task_model,sdd.board.set_task_verification,sdd.board.split_task,sdd.board.stop,sdd.run.from_graph,sdd.run.from_spec,sdd.run.start,sdd.spec.approve,sdd.spec.discard,sdd.spec.get,sdd.spec.message,sdd.spec.start,specs.get,specs.list,specs.taskStatus`.split(`,`),Oe=[`files.list`,`files.read`,`files.tree`,`files.write`,`git.changes`,`git.diff`,`git.info`,`projects.add`,`projects.list`,`projects.select`,`working_dir.set`,`worktree.cleanup`,`worktree.diff`,`worktree.merge`,`worktree.remove`,`worktree.scan`,`shell.open`,`process.kill`,`process.killAll`,`process.list`,`terminal.close`,`terminal.create`,`terminal.input`,`terminal.resize`],ke=`codebase.index.server.shutdown,connections.health,connections.service_action,diag.get,key.add,key.delete,key.set_active,key.update,prefs.get,prefs.update,provider.add,provider.clear_models,provider.models,provider.models.search,provider.probe,provider.remove,provider.status.clear,provider.status.get,provider.status.retry,provider.undo_clear,provider.update,providers.list,providers.saved,tool.disable,tool.enable,tools.list,webui.shutdown`.split(`,`),Ae=`error,log,pong,side_effects,agent.status_changed,agent.timeline.message,client.status_update,compaction.failed,completion.result,context.compacted,context.debug,context.editor.snapshot,context.editor.validation,context.editor.applied,context.mode.changed,context.modes.list,context.repaired,ctx.max_context,ctx.pct,delegate.completed,delegate.started,iteration.completed,iteration.limit_reached,iteration.started,model.refine_result,modes.list,provider.active_blocked,provider.error,provider.fallback,provider.response,provider.retry,provider.status_changed,provider.stream_error,provider.text_delta,provider.thinking_delta,run.result,session.checkpoints,session.damaged,session.end,session.rewound,session.start,session.stats,sessions.list,sessions.status_update,stats.get,token.cost_estimate_unavailable,token.threshold,tool.confirm_needed,tool.disabled,tool.enabled,tool.executed,tool.loop_detected,tool.progress,tool.started,tools.list,trust.persisted`.split(`,`),je=[`collab.annotation.added`,`collab.annotation.resolved`,`collab.event`,`collab.injection.granted`,`collab.participant.joined`,`collab.participant.left`,`collab.pause.granted`,`collab.pause.released`,`collab.state`,`mailbox.action_result`,`mailbox.agent_registered`,`mailbox.agents`,`mailbox.cleared`,`mailbox.compacted`,`mailbox.event`,`mailbox.messages`,`mailbox.sent`,`mailbox.purged`,`mailbox.received`,`subagent.budget_extended`,`subagent.event`],Me=`brain.answer,brain.config,brain.event,brain.status,chronicle.error,chronicle.facet_result,chronicle.facets_result,chronicle.graph_result,chronicle.metrics_result,chronicle.query_result,chronicle.status_result,config.doctor.result,design.list,design.materialize,design.set,design.state,design.swap,design.tune,design.use,design.verify,memory.event,memory.list,memory.sage.backfillRecoverable,memory.sage.candidateResolve,memory.sage.delete,memory.sage.forFile,memory.sage.get,memory.sage.graph,memory.sage.list,memory.sage.listPage,memory.sage.recover,memory.sage.remember,memory.sage.update`.split(`,`),Ne=`mcp.content.error,mcp.content.selected,mcp.list,mcp.operation_result,mcp.prompts,mcp.resources,mcp.server.added,mcp.server.connected,mcp.server.disconnected,mcp.server.discovered,mcp.server.error,mcp.server.reconnected,mcp.server.removed,mcp.server.sleeping,mcp.server.updated,mcp.server.waking,prompts.content,prompts.created,prompts.favorite,prompts.list,prompts.recent,prompts.search,prompts.used,skills.content,skills.created,skills.edited,skills.exported,skills.installed,skills.list,skills.uninstalled,skills.updated`.split(`,`),Pe=`budget.decision,budget.threshold_reached,coordinator.stats,coordinator.status,eternal.iteration,fleet.concurrency_update,goal-state.updated,goal.assess.result,goal.list,goal.paused,goal.resumed,goal.saved,goal.error,goal.stopped,goal.failed,goal.completed,goal.cleared,goal.reverted,goal.progress,goal.state,in_flight.ended,in_flight.started,plan.updated,task.completed,task.failed,task.pending,task.started,tasks.updated,todos.cleared,todos.updated`.split(`,`),Fe=[`kanban.task.activity`,`sdd.board.lifecycle_result`,`sdd.board.list`,`sdd.board.snapshot`,`sdd.run.started`,`sdd.spec.agent_text`,`sdd.spec.error`,`sdd.spec.snapshot`,`specs.detail`,`specs.list`],Ie=[`consensus.vote_cast`,`consensus.vote_initiated`,`consensus.vote_resolved`,`cron.job_fired`,`cron.snapshot`,`techstack.job.cancelled`,`techstack.job.failed`,`techstack.job.progress`,`techstack.job.started`,`techstack.report.delivered`,`techstack.report.ready`,`techstack.snapshot.updated`,`techstack.workspace.completed`],Le=`checkpoint.written,codemap.file_event,codemap.index_updated,codemap.tool_executed,codemap.tool_started,file.saved,files.list,files.read,files.tree,files.written,git.changes,git.diff,git.info,process.list,projects.added,projects.list,projects.selected,terminal.exit,terminal.output,working_dir.changed,worktree.cleanup_result,worktree.diff_result,worktree.event,worktree.merge_result,worktree.orphans,worktree.state`.split(`,`),Re=[`auth.oauth.status`,`codebase.index.server.shutdown_result`,`connections.health_error`,`connections.health_result`,`connections.service_action_result`,`diag.get`,`key.operation_result`,`model.switch_result`,`prefs.updated`,`provider.catalog`,`provider.models`,`provider.models.search_result`,`provider.probe`,`provider.status.snapshot`,`providers.saved`],ze=[...Se,...Ce,...Oe,...ke,...Ee,...De,...we,...Te],Be=[...Ae,...je,...Le,...Re,...Pe,...Fe,...Ie,...Me,...Ne];new Set(ze),new Set(Be);function x(e){return typeof e==`object`&&e&&!Array.isArray(e)?e:null}function S(e,t=0){return typeof e==`number`&&Number.isFinite(e)?e:t}function C(e){return e===void 0||Array.isArray(e)}function Ve(e){return S(e.activeProjects)===e.activeProjects&&S(e.activeClients)===e.activeClients&&S(e.activeSessions)===e.activeSessions&&S(e.activeSubagents)===e.activeSubagents&&S(e.unreadMailboxMessages)===e.unreadMailboxMessages&&S(e.incompleteMailboxMessages)===e.incompleteMailboxMessages&&S(e.totalCostUsd)===e.totalCostUsd}function He(e){if(e.type!==`hq.snapshot`)return null;let t=x(e.snapshot),n=t?x(t.totals):null;return!t||typeof t.generatedAt!=`string`||!Array.isArray(t.clients)||!Array.isArray(t.projects)||!Array.isArray(t.sessions)||!Array.isArray(t.fleets)||!Array.isArray(t.mailboxes)||!n||!Ve(n)||!C(t.machines)||!C(t.liveSessions)||!C(t.mcpServers)?null:{kind:`hq-snapshot`,snapshot:t}}function Ue(e){if(e.type!==`hq.event`)return null;let t=x(e.event);return!t||typeof t.id!=`string`||typeof t.type!=`string`||typeof t.timestamp!=`string`||typeof t.clientId!=`string`||typeof t.projectId!=`string`||typeof t.seq!=`number`?null:{kind:`hq-event`,event:t}}function We(e){return e.type!==`hq.alert`||typeof e.severity!=`string`||![`info`,`warn`,`error`].includes(e.severity)||typeof e.message!=`string`||typeof e.timestamp!=`string`?null:{kind:`hq-alert`,alert:e}}function Ge(e){if(e.type!==`hq.command_status`)return null;let t=x(e.command);return!t||typeof t.commandId!=`string`||typeof t.type!=`string`||typeof t.clientId!=`string`||typeof t.enqueuedBy!=`string`||typeof t.enqueuedAt!=`string`||typeof t.status!=`string`||![`queued`,`delivered`,`acked`].includes(t.status)?null:{kind:`hq-command-status`,command:t}}var w=e(u(),1),Ke=y(),qe=e=>Symbol.iterator in e,Je=e=>`entries`in e,Ye=(e,t)=>{let n=e instanceof Map?e:new Map(e.entries()),r=t instanceof Map?t:new Map(t.entries());if(n.size!==r.size)return!1;for(let[e,t]of n)if(!r.has(e)||!Object.is(t,r.get(e)))return!1;return!0},Xe=(e,t)=>{let n=e[Symbol.iterator](),r=t[Symbol.iterator](),i=n.next(),a=r.next();for(;!i.done&&!a.done;){if(!Object.is(i.value,a.value))return!1;i=n.next(),a=r.next()}return!!i.done&&!!a.done};function Ze(e,t){return Object.is(e,t)?!0:typeof e!=`object`||!e||typeof t!=`object`||!t||Object.getPrototypeOf(e)!==Object.getPrototypeOf(t)?!1:qe(e)&&qe(t)?Je(e)&&Je(t)?Ye(e,t):Xe(e,t):Ye({entries:()=>Object.entries(e)},{entries:()=>Object.entries(t)})}function T(e){let t=w.useRef(void 0);return n=>{let r=e(n);return Ze(t.current,r)?t.current:t.current=r}}var E=`wrongstack.hq.token.v1`;function Qe(){if(typeof window>`u`)return null;try{let e=new URLSearchParams(window.location.search).get(`token`);return e!==null&&e.length>0?e:null}catch{return null}}function D(){if(typeof window>`u`)return null;try{return window.sessionStorage??null}catch{return null}}function $e(){try{let e=D()?.getItem(E)??null;return e!==null&&e.length>0?e:null}catch{return null}}function O(e){try{D()?.setItem(E,e)}catch{}}function k(){try{D()?.removeItem(E)}catch{}}function A(){let e=Qe();return e===null?$e():(O(e),e)}function et(){if(typeof window>`u`)return;let e=Qe();if(e!==null&&(O(e),$e()===e))try{let e=new URL(window.location.href);e.searchParams.delete(`token`),window.history.replaceState(null,``,`${e.pathname}${e.search}${e.hash}`)}catch{}}function tt(){let e=A();return e===null?{}:{Authorization:`Bearer ${e}`}}function j(e,t){let n={...t?.headers??{},...tt()};return fetch(e,{...t,headers:n})}function nt(){if(typeof window>`u`)return null;try{let e=window.location.hash;if(!e.startsWith(`#bootstrap=`))return null;let t=e.slice(11);return t.length>0?t:null}catch{return null}}function rt(){if(!(typeof window>`u`))try{let e=new URL(window.location.href);e.hash.startsWith(`#bootstrap=`)&&(e.hash=``,window.history.replaceState(null,``,`${e.pathname}${e.search}`))}catch{}}async function it(){let e=nt();if(e===null)return!1;try{return(await fetch(`/api/auth/bootstrap`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({code:e}),credentials:`same-origin`,signal:AbortSignal.timeout(1e4)})).ok?(rt(),k(),!0):!1}catch{return!1}}var at=e=>{let t,n=new Set,r=(e,r)=>{let i=typeof e==`function`?e(t):e;if(!Object.is(i,t)){let e=t;t=r??(typeof i!=`object`||!i)?i:Object.assign({},t,i),n.forEach(n=>n(t,e))}},i=()=>t,a={setState:r,getState:i,getInitialState:()=>o,subscribe:e=>(n.add(e),()=>n.delete(e))},o=t=e(r,i,a);return a},ot=(e=>e?at(e):at),st=e=>e;function ct(e,t=st){let n=w.useSyncExternalStore(e.subscribe,w.useCallback(()=>t(e.getState()),[e,t]),w.useCallback(()=>t(e.getInitialState()),[e,t]));return w.useDebugValue(n),n}var lt=e=>{let t=ot(e),n=e=>ct(t,e);return Object.assign(n,t),n},ut=(e=>e?lt(e):lt),dt=6e3,ft=0,M=ut()(e=>({toasts:[],addToast:(t,n=`info`,r=dt,i)=>{let a=`toast-${++ft}-${Date.now()}`,o={id:a,message:t,severity:n,createdAt:Date.now(),ttlMs:r,action:i};e(e=>({toasts:[...e.toasts.slice(-4),o]})),r>0&&setTimeout(()=>{e(e=>({toasts:e.toasts.filter(e=>e.id!==a)}))},r)},removeToast:t=>e(e=>({toasts:e.toasts.filter(e=>e.id!==t)})),clearToasts:()=>e({toasts:[]})})),N=me(),pt={error:(0,N.jsx)(pe,{size:16,"aria-hidden":`true`}),warning:(0,N.jsx)(p,{size:16,"aria-hidden":`true`}),info:(0,N.jsx)(c,{size:16,"aria-hidden":`true`}),success:(0,N.jsx)(a,{size:16,"aria-hidden":`true`})};function mt(){let{toasts:e,removeToast:t}=M(T(e=>({toasts:e.toasts,removeToast:e.removeToast})));return e.length===0?null:(0,N.jsx)(`div`,{className:`hq-toast-container`,role:`status`,"aria-live":`polite`,"aria-label":`Notifications`,children:e.map(e=>(0,N.jsxs)(`div`,{className:`hq-toast hq-toast--${e.severity}`,"data-severity":e.severity,children:[(0,N.jsx)(`span`,{className:`hq-toast-icon`,children:pt[e.severity]}),(0,N.jsx)(`span`,{className:`hq-toast-message`,children:e.message}),e.action?(0,N.jsx)(`span`,{className:`hq-toast-action`,children:e.action}):null,(0,N.jsx)(`button`,{type:`button`,className:`hq-toast-close`,"aria-label":`Dismiss notification`,onClick:()=>t(e.id),children:(0,N.jsx)(_,{size:12})})]},e.id))})}var P=e(t(((e,t)=>{t.exports={}}))(),1),ht=class extends Error{name=`FsError`;code;path;context;constructor(e){super(e.message,{cause:e.cause}),this.code=e.code,this.path=e.path,this.context=e.context}};function F(e={}){let t=e.createLockTimeoutError??(({targetPath:e,timeoutMs:t})=>new ht({message:`Timed out waiting for file lock: ${e}`,code:`FS_ATOMIC_WRITE_FAILED`,path:e,context:{timeoutMs:t}}));async function n(e,t,n){try{let t=await P.open(e,`r+`);try{await t.sync()}finally{await t.close()}}catch{}let r;try{r=(await P.stat(t)).mode&511}catch{r=n.mode}r!==void 0&&await P.chmod(e,r),await vt(e,t),r!==void 0&&process.platform===`win32`&&await P.chmod(t,r).catch(()=>void 0)}function r(e){return P.join(P.dirname(e),`.${P.basename(e)}.${(0,P.randomBytes)(6).toString(`hex`)}.tmp`)}async function i(e,t,i={}){await P.mkdir(P.dirname(e),{recursive:!0});let a=r(e);try{typeof t==`string`?await P.writeFile(a,t,{flag:`wx`,encoding:i.encoding??`utf8`}):await P.writeFile(a,t,{flag:`wx`}),await n(a,e,i)}catch(e){throw await P.unlink(a).catch(()=>void 0),e}}async function a(e,t,i={}){await P.mkdir(P.dirname(e),{recursive:!0});let a=r(e);try{let r=await P.open(a,`wx`),o;try{o=await t(r)}finally{await r.close().catch(()=>void 0)}return await n(a,e,i),o}catch(e){throw await P.unlink(a).catch(()=>void 0),e}}async function o(e){await P.mkdir(e,{recursive:!0})}async function s(e,n,r={}){let i=P.dirname(e),a=P.join(i,`.${P.basename(e)}.lock`),o=r.timeoutMs??15e3,s=r.staleMs??3e4,c=Date.now(),l;for(;;)try{l=await P.open(a,`wx`),await l.writeFile(`${process.pid}:${Date.now()}`);break}catch(n){l&&=(await l.close().catch(()=>void 0),await P.unlink(a).catch(()=>void 0),void 0);let r=n.code;if(r===`ENOENT`){await P.mkdir(i,{recursive:!0});continue}if(r!==`EEXIST`&&r!==`EPERM`)throw n;try{let e=await P.stat(a);if(Date.now()-e.mtimeMs>s){let t=await P.stat(a).catch(()=>void 0);t&&t.mtimeMs===e.mtimeMs&&Date.now()-t.mtimeMs>s&&await P.unlink(a).catch(()=>void 0);continue}}catch{continue}let u=Date.now()-c;if(u>=o)throw t({targetPath:e,timeoutMs:o});await gt(a,o-u)}let u=Math.max(50,Math.floor(s/2)),d=setInterval(()=>{let e=new Date;P.utimes(a,e,e).catch(()=>void 0)},u);d.unref?.();try{return await n()}finally{clearInterval(d),await l?.close().catch(()=>void 0),await P.unlink(a).catch(()=>void 0)}}return{atomicWrite:i,atomicReplaceWithWriter:a,ensureDir:o,withFileLock:s}}async function gt(e,t){let n=P.dirname(e),r=P.basename(e),i=Math.min(t,100);return new Promise(a=>{let o=!1,s=null,c=()=>{o||(o=!0,s?.close(),a())},l=setTimeout(c,i);try{s=(0,P.watch)(n,(e,t)=>{t===r&&(e===`rename`||e===`change`)&&(clearTimeout(l),c())})}catch{clearTimeout(l),setTimeout(c,Math.min(t,25));return}P.access(e).catch(()=>{clearTimeout(l),c()})})}var _t=new Set([`EPERM`,`EBUSY`,`EACCES`,`ENOTEMPTY`]);async function vt(e,t){if(process.platform!==`win32`){await P.rename(e,t);return}let n=[10,25,60,120,250,500,1e3,2e3],r=0;for(;;)try{await P.rename(e,t);return}catch(i){let a=i.code;if(!a||!_t.has(a)||r===n.length)throw r===n.length&&process.emitWarning(`Windows rename retries exhausted for '${e}' \u2192 '${t}' (code=${a}). Write skipped \u2014 the caller will retry on the next cycle.`,{code:`WRONGSTACK_WIN32_RENAME_EXHAUSTED`}),i;await new Promise(e=>setTimeout(e,n[r])),r++}}var I=F();I.atomicWrite,I.ensureDir,I.withFileLock;var L=new Set([`graceful`,`crash`,`heartbeat-timeout`,`auth-revoked`]),R=`__hq_peer__`;function yt(e){return e===void 0||typeof e==`string`}function bt(e){if(typeof e!=`object`||!e||Array.isArray(e))return!1;let t=e;return!(typeof t.projectId!=`string`||t.projectId.length===0||typeof t.machineId!=`string`||t.machineId.length===0||typeof t.leaderClientId!=`string`||t.leaderClientId.length===0||typeof t.previousLeaderHandle!=`string`||t.previousLeaderHandle.length===0||typeof t.reason!=`string`||!L.has(t.reason)||typeof t.detectedAt!=`string`||!Number.isFinite(Date.parse(t.detectedAt))||!yt(t.rehydrateHint)||t.rehydrateHint!==void 0&&t.rehydrateHint.length>280||!yt(t.rehydrateCommandId))}function xt(e){if(typeof e!=`object`||!e||Array.isArray(e))return!1;let t=e;return!(typeof t.projectId!=`string`||t.projectId.length===0||typeof t.machineId!=`string`||t.machineId.length===0||typeof t.leaderClientId!=`string`||t.leaderClientId.length===0||typeof t.previousLeaderHandle!=`string`||t.previousLeaderHandle.length===0||typeof t.reason!=`string`||!L.has(t.reason)||typeof t.detectedAt!=`string`||!Number.isFinite(Date.parse(t.detectedAt)))}var St=[{type:`anthropic_key`,regex:/(?<![A-Za-z0-9])sk-ant-api\d+-[A-Za-z0-9_-]{20,}(?![A-Za-z0-9])/g},{type:`openai_key`,regex:/(?<![A-Za-z0-9])sk-(?:proj-)?[A-Za-z0-9_-]{20,}(?![A-Za-z0-9])/g},{type:`github_pat`,regex:/(?<![A-Za-z0-9])ghp_[A-Za-z0-9]{36,}(?![A-Za-z0-9])/g},{type:`github_pat_v2`,regex:/(?<![A-Za-z0-9])github_pat_[A-Za-z0-9_]{50,}(?![A-Za-z0-9])/g},{type:`aws_access_key`,regex:/(?<![A-Za-z0-9])AKIA[0-9A-Z]{16}(?![A-Za-z0-9])/g},{type:`gcp_key`,regex:/(?<![A-Za-z0-9])AIza[0-9A-Za-z_-]{35}(?![A-Za-z0-9])/g},{type:`slack_token`,regex:/(?<![A-Za-z0-9-])xox[abpos]-[A-Za-z0-9-]{10,}(?![A-Za-z0-9-])/g},{type:`stripe_key`,regex:/(?<![A-Za-z0-9])sk_(?:live|test)_[A-Za-z0-9]{24,}(?![A-Za-z0-9])/g},{type:`twilio_sid`,regex:/(?<![A-Za-z0-9])AC[a-f0-9]{32}(?![A-Za-z0-9])/g},{type:`telegram_bot_token`,regex:/\/bot\d+:[A-Za-z0-9_-]{20,}(?![A-Za-z0-9_-])/g},{type:`jwt`,regex:/(?<![A-Za-z0-9/+=])eyJ[A-Za-z0-9_-]{10,}\.[A-Za-z0-9_-]{10,}\.[A-Za-z0-9_-]{10,}(?![A-Za-z0-9/+=])/g},{type:`private_key`,regex:/(?:^|\n)-----BEGIN (?:RSA|EC|OPENSSH|DSA|PGP)? ?PRIVATE KEY-----[\s\S]*?-----END[^-]*-----(?:\n|$)/g},{type:`mongodb_uri`,regex:/mongodb(?:\+srv)?:\/\/[^\s"'`]+/g},{type:`postgres_uri`,regex:/postgres(?:ql)?:\/\/[^\s"'`]+/g},{type:`mysql_uri`,regex:/mysql:\/\/[^\s"'`]+/g},{type:`redis_uri`,regex:/redis:\/\/[^\s"'`]+/g},{type:`huggingface_token`,regex:/(?<![A-Za-z0-9])hf_[A-Za-z0-9]{34}(?![A-Za-z0-9])/g},{type:`replicate_token`,regex:/(?<![A-Za-z0-9])r8_[A-Za-z0-9]{40,}(?![A-Za-z0-9])/g},{type:`perplexity_key`,regex:/(?<![A-Za-z0-9])pplx-[A-Za-z0-9]{40,}(?![A-Za-z0-9])/g},{type:`groq_key`,regex:/(?<![A-Za-z0-9])gsk_[A-Za-z0-9]{40,}(?![A-Za-z0-9])/g},{type:`bearer_token`,regex:/(?:^|[^A-Za-z0-9_.~+/-])Bearer\s+[A-Za-z0-9._~+/-]{12,512}=*(?=$|[^A-Za-z0-9_.~+/-])/g},{type:`high_entropy_env`,regex:/(^|\s)([A-Z_]{4,}(?:KEY|TOKEN|SECRET|PASSWORD|PWD))\s*[:=]\s*['"]?([A-Za-z0-9_/+=-]{20,512})['"]?(?=\s|$)/g}],Ct=St.filter(e=>e.type!==`high_entropy_env`),wt=new RegExp(Ct.map(e=>`(${e.regex.source})`).join(`|`),`g`),Tt=St.find(e=>e.type===`high_entropy_env`).regex,Et=Ct.map(e=>`[REDACTED:${e.type}]`),Dt=64*1024,Ot=1024;function kt(e){return e.includes(`-----BEGIN`)||e.includes(`sk-`)||e.includes(`sk_`)||e.includes(`ghp_`)||e.includes(`github_pat_`)||e.includes(`eyJ`)||e.includes(`AKIA`)||e.includes(`AIza`)||e.includes(`xox`)||e.includes(`Bearer `)||e.includes(`/bot`)||e.includes(`hf_`)||e.includes(`r8_`)||e.includes(`pplx-`)||e.includes(`gsk_`)||e.includes(`_KEY=`)||e.includes(`_TOKEN=`)||e.includes(`_SECRET=`)||e.includes(`_PASSWORD=`)||e.includes(`mongodb://`)||e.includes(`mongodb+srv://`)||e.includes(`postgres://`)||e.includes(`postgresql://`)||e.includes(`mysql://`)||e.includes(`redis://`)||e.includes(`"apiKey"`)||e.includes(`"api_key"`)||e.includes(`"token"`)||e.includes(`"secret"`)||e.includes(`"password"`)||e.includes(`"authorization"`)||e.includes(`"bearer"`)||e.includes(`"private_key"`)||e.includes(`"access_token"`)||e.includes(`"refresh_token"`)||e.includes(`"client_secret"`)}new class{scrub(e){if(!e||!kt(e))return e;if(e.length<=Dt)return this.scrubOne(e);let t=[],n=0;for(;n<e.length;){let r=Math.min(n+Dt,e.length);if(r<e.length){let t=Math.min(r+Ot,e.length),n=-1;for(let i=r;i<t;i++){let t=e.charCodeAt(i);if(t===32||t===9||t===10||t===13){n=i;break}}r=n===-1?r:n+1}t.push(this.scrubOne(e.slice(n,r))),n=r}return t.join(``)}scrubOne(e){if(!kt(e))return e;let t=e.replace(wt,(e,...t)=>{let n=t.findIndex(e=>e!==void 0);if(n<0)return e;let r=Et[n];return r===void 0?e:r});return t=t.replace(Tt,(e,t,n,r)=>`${t}${n}=[REDACTED:high_entropy_env]`),t}scrubObject(e){let t=new WeakSet,n=e=>{if(typeof e==`string`)return this.scrub(e);if(typeof e!=`object`||!e||t.has(e))return e;if(t.add(e),Array.isArray(e))return e.map(n);let r={};for(let[t,i]of Object.entries(e))r[t]=n(i);return r};return n(e)}},Math.min(16*1024*1024,Math.floor(P.getHeapStatistics().heap_size_limit*.1));var At={PROVIDER_RATE_LIMITED:`PROVIDER_RATE_LIMITED`,PROVIDER_AUTH_FAILED:`PROVIDER_AUTH_FAILED`,PROVIDER_OVERLOADED:`PROVIDER_OVERLOADED`,PROVIDER_INVALID_REQUEST:`PROVIDER_INVALID_REQUEST`,PROVIDER_SERVER_ERROR:`PROVIDER_SERVER_ERROR`,PROVIDER_NETWORK_ERROR:`PROVIDER_NETWORK_ERROR`,PROVIDER_CONTEXT_OVERFLOW:`PROVIDER_CONTEXT_OVERFLOW`,TOOL_NOT_FOUND:`TOOL_NOT_FOUND`,TOOL_PERMISSION_DENIED:`TOOL_PERMISSION_DENIED`,TOOL_EXECUTION_FAILED:`TOOL_EXECUTION_FAILED`,TOOL_TIMEOUT:`TOOL_TIMEOUT`,TOOL_INPUT_INVALID:`TOOL_INPUT_INVALID`,CONFIG_INVALID:`CONFIG_INVALID`,CONFIG_NOT_FOUND:`CONFIG_NOT_FOUND`,CONFIG_PARSE_FAILED:`CONFIG_PARSE_FAILED`,CONFIG_MIGRATION_NEEDED:`CONFIG_MIGRATION_NEEDED`,PLUGIN_LOAD_FAILED:`PLUGIN_LOAD_FAILED`,PLUGIN_API_MISMATCH:`PLUGIN_API_MISMATCH`,PLUGIN_MISSING_DEPENDENCY:`PLUGIN_MISSING_DEPENDENCY`,AGENT_ITERATION_LIMIT:`AGENT_ITERATION_LIMIT`,AGENT_CONTEXT_OVERFLOW:`AGENT_CONTEXT_OVERFLOW`,AGENT_ABORTED:`AGENT_ABORTED`,AGENT_RUN_FAILED:`AGENT_RUN_FAILED`,SESSION_NOT_FOUND:`SESSION_NOT_FOUND`,SESSION_CORRUPTED:`SESSION_CORRUPTED`,SESSION_WRITE_FAILED:`SESSION_WRITE_FAILED`,CONTAINER_TOKEN_ALREADY_BOUND:`CONTAINER_TOKEN_ALREADY_BOUND`,CONTAINER_TOKEN_NOT_BOUND:`CONTAINER_TOKEN_NOT_BOUND`,CONTAINER_CIRCULAR_DEPENDENCY:`CONTAINER_CIRCULAR_DEPENDENCY`,REGISTRY_DUPLICATE:`REGISTRY_DUPLICATE`,REGISTRY_NOT_FOUND:`REGISTRY_NOT_FOUND`,REGISTRY_INVALID:`REGISTRY_INVALID`,FS_READ_FAILED:`FS_READ_FAILED`,FS_WRITE_FAILED:`FS_WRITE_FAILED`,FS_MKDIR_FAILED:`FS_MKDIR_FAILED`,FS_DELETE_FAILED:`FS_DELETE_FAILED`,FS_ATOMIC_WRITE_FAILED:`FS_ATOMIC_WRITE_FAILED`,SDD_VALIDATION_FAILED:`SDD_VALIDATION_FAILED`,SDD_PARSE_FAILED:`SDD_PARSE_FAILED`,SDD_INVALID_STATE:`SDD_INVALID_STATE`,SDD_NOT_READY:`SDD_NOT_READY`,VALIDATION_ERROR:`VALIDATION_ERROR`,PARSE_FAILED:`PARSE_FAILED`,UNKNOWN:`UNKNOWN`},jt=class extends Error{code;subsystem;severity;recoverable;context;constructor(e){super(e.message,{cause:e.cause}),this.name=`WrongStackError`,this.code=e.code,this.subsystem=e.subsystem,this.severity=e.severity??`error`,this.recoverable=e.recoverable??!1,this.context=e.context}describe(){let e=this.context?` ${Mt(this.context)}`:``;return`${this.code}: ${this.message}${e}`}};function Mt(e){let t=Object.entries(e).filter(([,e])=>e!==void 0).slice(0,3).map(([e,t])=>`${e}=${String(t)}`);return t.length>0?`[${t.join(` `)}]`:``}var Nt=class extends jt{path;constructor(e){super({message:e.message,code:e.code,subsystem:`fs`,severity:`error`,recoverable:e.code!==At.FS_READ_FAILED,context:{path:e.path,...e.context},cause:e.cause}),this.name=`FsError`,this.path=e.path}},z=F({createLockTimeoutError:({targetPath:e,timeoutMs:t})=>new Nt({message:`Timed out waiting for file lock: ${e}`,code:`FS_ATOMIC_WRITE_FAILED`,path:e,context:{timeoutMs:t}})});z.atomicWrite,z.atomicReplaceWithWriter,z.ensureDir,z.withFileLock,P.join(`.wrongstack`,`project.json`),new Set([...new Set([`mode_changed`,`compaction`,`checkpoint`,`skill_activated`,`skill_deactivated`,`agent_spawned`,`agent_stopped`,`agent_error`,`error`,`provider_retry`,`provider_error`,`message_truncated`])].filter(e=>e!==`checkpoint`)),Object.freeze({vps8:{maxBytes:8*1024*1024,rotateKeepBytes:2*1024*1024},vps32:{maxBytes:32*1024*1024,rotateKeepBytes:16*1024*1024},desktop:{maxBytes:64*1024*1024,rotateKeepBytes:24*1024*1024}});function Pt(e,t){let n=t.liveSessions??[],r=e.selectedSessionId===null?void 0:n.find(t=>t.sessionId===e.selectedSessionId),i=e.selectedAgentId===null||r?.agents.some(t=>t.id===e.selectedAgentId)===!0,a=e.selectedClientId===null||t.clients.some(t=>t.clientId===e.selectedClientId);return{snapshot:t,...e.selectedSessionId!==null&&r===void 0?{selectedSessionId:null,selectedAgentId:null}:i?{}:{selectedAgentId:null},...a?{}:{selectedClientId:null}}}function Ft(e,t){return e.timestamp===t.timestamp&&e.severity===t.severity&&e.message===t.message}var B=ut()(e=>({snapshot:null,events:[],alerts:[],commandStatuses:[],activeView:`cockpit`,selectedSessionId:null,selectedAgentId:null,selectedClientId:null,connected:!1,authRequired:!1,resumeCursors:{},needsSnapshotRefresh:!1,peerRehydrate:null,setActiveView:t=>e({activeView:t}),selectSession:(t,n=null)=>e({selectedSessionId:t,selectedAgentId:n}),selectAgent:(t,n)=>e({selectedSessionId:t,selectedAgentId:n}),selectClient:t=>e({selectedClientId:t}),markAuthRequired:()=>e(e=>e.authRequired?{}:{authRequired:!0}),_hydrateSnapshot:t=>e(e=>e.snapshot===null?Pt(e,t):{}),_onSnapshot:t=>e(e=>{let n=e.snapshot;return n!==null&&typeof n.generatedAt==`string`&&typeof t.generatedAt==`string`&&Date.parse(t.generatedAt)<Date.parse(n.generatedAt)?{}:{...Pt(e,t),connected:!0}}),_resetResumeCursors:()=>e({resumeCursors:{}}),_onEvent:t=>e(e=>{let n=e.events.some(e=>e.id===t.id),r=n?{}:{events:[...e.events,t].slice(-500)},i=t.type===`peer.rehydrate`||t.type===`peer.lost`?e=>({}):n=>{let r=e.resumeCursors[n]??0,i=t.seq,a=r>0&&i>0&&i<=r/2&&t.type!==`client.hello`;return i>r||a?{resumeCursors:{...e.resumeCursors,[n]:i}}:{}};if(t.type===`peer.rehydrate`){if(!bt(t.payload))return r;let e={kind:`peer.rehydrate`,payload:t.payload,receivedAt:new Date().toISOString()};return{...r,...i(R),...n?{}:{peerRehydrate:e}}}if(t.type===`peer.lost`){if(!xt(t.payload))return r;let e={kind:`peer.lost`,payload:t.payload,receivedAt:new Date().toISOString()};return{...r,...i(R),...n?{}:{peerRehydrate:e}}}return{...r,...i(t.clientId)}}),_onAlert:t=>e(e=>e.alerts.some(e=>Ft(e,t))?{}:{alerts:[...e.alerts,t].slice(-100)}),_onCommandStatus:t=>e(e=>{let n=e.commandStatuses.findIndex(e=>e.commandId===t.commandId);if(n<0)return{commandStatuses:[...e.commandStatuses,t].slice(-200)};let r=[...e.commandStatuses];return r[n]=t,{commandStatuses:r}}),_setConnected:t=>e({connected:t}),_setNeedsSnapshotRefresh:t=>e(e=>e.needsSnapshotRefresh===t?{}:{needsSnapshotRefresh:t}),_dismissPeerRehydrate:()=>e({peerRehydrate:null})}));async function V(e){let t;try{t=await j(e)}catch{throw Error(`Network error fetching ${e}`)}if(t.status===401)throw B.getState().markAuthRequired(),Error(`401 Unauthorized fetching ${e} — browser token required`);if(!t.ok)throw Error(`${t.status} ${t.statusText}`);try{return await t.json()}catch{throw Error(`Invalid JSON response from ${e}: ${t.status}`)}}async function It(e){let t;try{t=await j(`/api/mailbox-send`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)})}catch{throw Error(`Network error sending mailbox message`)}if(t.status===401)throw B.getState().markAuthRequired(),Error(`401 Unauthorized — browser token required`);if(!t.ok){let e=await t.json().catch(()=>null),n=typeof e?.error==`string`?e.error:t.statusText||`HTTP ${t.status}`;throw Error(n)}try{return await t.json()}catch{throw Error(`Invalid JSON response from mailbox-send API`)}}async function Lt(e,t,n){let r;try{r=await j(`/api/command`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({clientId:e,type:t,payload:n})})}catch{throw Error(`Network error sending command`)}if(r.status===401)throw B.getState().markAuthRequired(),Error(`401 Unauthorized — browser token required`);if(!r.ok){let e=(await r.json().catch(()=>null))?.error??(r.statusText||`HTTP ${r.status}`);throw Error(e)}try{return await r.json()}catch{throw Error(`Invalid JSON response from command API`)}}var Rt=`wrongstack.hq.local-prefs.v1`,H={appearance:{theme:`dark`},fleet:{scope:`all`,layout:`map`,machineId:``,projectId:``},console:{delivery:`steer`,subject:``,body:``},control:{cmdType:`steer`,abortTarget:`leader`,spawnRole:`bug-hunter`,spawnTask:``,steerTo:`leader`,steerSubject:``,steerBody:``,broadcastSubject:``,broadcastBody:``},mailbox:{query:``,types:[],priorities:[],includeCompleted:!0}},U=null,W=new Set;function G(){for(let e of W)e()}function K(e){return typeof structuredClone==`function`?structuredClone(e):JSON.parse(JSON.stringify(e))}function q(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function zt(){if(typeof window>`u`||window.localStorage===void 0)return K(H);try{let e=window.localStorage.getItem(Rt);return e===null?K(H):Bt(JSON.parse(e))}catch{return K(H)}}function Bt(e){if(!q(e))return K(H);let t=q(e.appearance)?e.appearance:{},n=q(e.fleet)?e.fleet:{},r=q(e.console)?e.console:{},i=q(e.control)?e.control:{},a=q(e.mailbox)?e.mailbox:{};return{appearance:{theme:t.theme===`light`?`light`:`dark`},fleet:{scope:n.scope===`machine`||n.scope===`project`?n.scope:`all`,layout:n.layout===`compact`?`compact`:`map`,machineId:typeof n.machineId==`string`?n.machineId:``,projectId:typeof n.projectId==`string`?n.projectId:``},console:{delivery:r.delivery===`btw`||r.delivery===`queue`?r.delivery:`steer`,subject:typeof r.subject==`string`?r.subject:``,body:typeof r.body==`string`?r.body:``},control:{cmdType:i.cmdType===`btw`||i.cmdType===`queue`||i.cmdType===`abort`||i.cmdType===`spawn`||i.cmdType===`broadcast`||i.cmdType===`run-command`?i.cmdType:H.control.cmdType,abortTarget:i.abortTarget===`fleet`?`fleet`:`leader`,spawnRole:typeof i.spawnRole==`string`&&i.spawnRole.length>0?i.spawnRole:H.control.spawnRole,spawnTask:typeof i.spawnTask==`string`?i.spawnTask:H.control.spawnTask,steerTo:typeof i.steerTo==`string`?i.steerTo:H.control.steerTo,steerSubject:typeof i.steerSubject==`string`?i.steerSubject:H.control.steerSubject,steerBody:typeof i.steerBody==`string`?i.steerBody:H.control.steerBody,broadcastSubject:typeof i.broadcastSubject==`string`?i.broadcastSubject:H.control.broadcastSubject,broadcastBody:typeof i.broadcastBody==`string`?i.broadcastBody:H.control.broadcastBody},mailbox:{query:typeof a.query==`string`?a.query:H.mailbox.query,types:Array.isArray(a.types)?a.types.filter(e=>typeof e==`string`):[],priorities:Array.isArray(a.priorities)?a.priorities.filter(e=>typeof e==`string`):[],includeCompleted:typeof a.includeCompleted!=`boolean`||a.includeCompleted}}}function J(){return U===null&&(U=zt()),U}function Y(e){if(!(typeof window>`u`||window.localStorage===void 0))try{window.localStorage.setItem(Rt,JSON.stringify(e))}catch{}}function Vt(e){return W.add(e),()=>W.delete(e)}function Ht(){return J()}function Ut(){return H}function Wt(){return(0,w.useSyncExternalStore)(Vt,Ht,Ut)}function Gt(e){let t=J();U={...t,control:{...t.control,...e}},Y(U),G()}function Kt(e){let t=J();U={...t,appearance:{...t.appearance,...e}},Y(U),G()}function qt(e){let t=J();U={...t,fleet:{...t.fleet,...e}},Y(U),G()}function Jt(e){let t=J();U={...t,console:{...t.console,...e}},Y(U),G()}function Yt(e){let t=J();U={...t,mailbox:{...t.mailbox,...e}},Y(U),G()}function Xt({hadToken:e}){let[t,n]=(0,w.useState)(null),[r,i]=(0,w.useState)(null);(0,w.useEffect)(()=>{fetch(`/api/auth/status`).then(async e=>{if(!e.ok)throw Error(`HTTP ${e.status}`);return await e.json()}).then(n).catch(()=>i(`Could not load HQ auth status.`))},[]);let a=t?.tokenMode??!0,o=t?.passwordMode??!1,[s,c]=(0,w.useState)(`token`);return(0,w.useEffect)(()=>{t&&c(t.passwordMode?`password`:`token`)},[t]),r?(0,N.jsx)(`div`,{className:`hq-token-gate`,children:(0,N.jsxs)(`div`,{className:`hq-token-card`,children:[(0,N.jsx)(`div`,{className:`hq-brand`,children:`WrongStack HQ`}),(0,N.jsx)(`div`,{className:`hq-token-title`,children:`Auth status unavailable`}),(0,N.jsx)(`p`,{className:`hq-token-text`,children:r})]})}):t?(0,N.jsx)(`div`,{className:`hq-token-gate`,children:(0,N.jsxs)(`div`,{className:`hq-token-card`,children:[(0,N.jsx)(`div`,{className:`hq-brand`,children:`WrongStack HQ`}),a&&o?(0,N.jsxs)(`div`,{className:`hq-token-tabs`,children:[(0,N.jsx)(`button`,{type:`button`,className:`hq-token-tab`+(s===`token`?` active`:``),onClick:()=>c(`token`),children:`Browser token`}),(0,N.jsx)(`button`,{type:`button`,className:`hq-token-tab`+(s===`password`?` active`:``),onClick:()=>c(`password`),children:`Password`})]}):null,s===`token`||!o?(0,N.jsx)(Zt,{hadToken:e}):(0,N.jsx)(Qt,{})]})}):(0,N.jsx)(`div`,{className:`hq-token-gate`,children:(0,N.jsxs)(`div`,{className:`hq-token-card`,children:[(0,N.jsx)(`div`,{className:`hq-brand`,children:`WrongStack HQ`}),(0,N.jsx)(`div`,{className:`hq-token-title`,children:`Checking auth mode…`})]})})}function Zt({hadToken:e}){let[t,n]=(0,w.useState)(``),r=()=>{let e=t.trim();e.length!==0&&(O(e),window.location.reload())};return(0,N.jsxs)(N.Fragment,{children:[(0,N.jsx)(`div`,{className:`hq-token-title`,children:`Browser token required`}),(0,N.jsx)(`p`,{className:`hq-token-text`,children:e?`The saved token was rejected — it may have been revoked or the server was reset. Paste a current browser token.`:`This HQ server runs in token mode. Paste the browser token printed at startup (the ?token= value in the URL wstack --hq shows).`}),(0,N.jsx)(`input`,{className:`hq-token-input`,type:`password`,placeholder:`browser token`,autoComplete:`off`,value:t,onChange:e=>n(e.target.value),onKeyDown:e=>{e.key===`Enter`&&r()}}),(0,N.jsx)(`button`,{type:`button`,className:`hq-token-submit`,onClick:r,disabled:t.trim().length===0,children:`Connect`}),(0,N.jsxs)(`p`,{className:`hq-token-hint`,children:[`Manage tokens with `,(0,N.jsx)(`code`,{children:`wstack hq token list`}),` / `,(0,N.jsx)(`code`,{children:`wstack hq token create`}),` — they live in `,(0,N.jsx)(`code`,{children:`~/.wrongstack/hq/auth.json`}),`.`]})]})}function Qt(){let[e,t]=(0,w.useState)(``),[n,r]=(0,w.useState)(null),[i,a]=(0,w.useState)(!1),o=async()=>{let t=e;if(t.length!==0){a(!0),r(null);try{let e=await fetch(`/api/login`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({password:t})});if(!e.ok){let t=`Login failed.`;try{let n=(await e.json()).error;typeof n==`string`?t=n:typeof n?.message==`string`&&(t=n.message)}catch{}r(t),a(!1);return}k(),window.location.reload()}catch{r(`Network error. Is the HQ server running?`),a(!1)}}};return(0,N.jsxs)(N.Fragment,{children:[(0,N.jsx)(`div`,{className:`hq-token-title`,children:`Password required`}),(0,N.jsx)(`p`,{className:`hq-token-text`,children:`This HQ server is protected by a password. Enter it to open the dashboard.`}),n?(0,N.jsx)(`p`,{className:`hq-token-error`,children:n}):null,(0,N.jsx)(`input`,{className:`hq-token-input`,type:`password`,placeholder:`password`,autoComplete:`current-password`,value:e,onChange:e=>t(e.target.value),onKeyDown:e=>{e.key===`Enter`&&o()}}),(0,N.jsx)(`button`,{type:`button`,className:`hq-token-submit`,onClick:()=>void o(),disabled:e.length===0||i,children:i?`Logging in…`:`Log in`}),(0,N.jsxs)(`p`,{className:`hq-token-hint`,children:[`Set or change the password with `,(0,N.jsx)(`code`,{children:`wstack --hq --password <secret>`}),`.`]})]})}var $t=`modulepreload`,en=function(e){return`/`+e},tn={},X=function(e,t,n){let r=Promise.resolve();if(t&&t.length>0){let e=document.getElementsByTagName(`link`),i=document.querySelector(`meta[property=csp-nonce]`),a=i?.nonce||i?.getAttribute(`nonce`);function o(e){return Promise.all(e.map(e=>Promise.resolve(e).then(e=>({status:`fulfilled`,value:e}),e=>({status:`rejected`,reason:e}))))}function s(e){return import.meta.resolve?import.meta.resolve(e):new URL(e,import.meta.url).href}r=o(t.map(t=>{if(t=en(t,n),t=s(t),t in tn)return;tn[t]=!0;let r=t.endsWith(`.css`);for(let n=e.length-1;n>=0;n--){let i=e[n];if(i.href===t&&(!r||i.rel===`stylesheet`))return}let i=document.createElement(`link`);if(i.rel=r?`stylesheet`:$t,r||(i.as=`script`),i.crossOrigin=``,i.href=t,a&&i.setAttribute(`nonce`,a),document.head.appendChild(i),r)return new Promise((e,n)=>{i.addEventListener(`load`,e),i.addEventListener(`error`,()=>n(Error(`Unable to preload CSS for ${t}`)))})}))}function i(e){let t=new Event(`vite:preloadError`,{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return r.then(t=>{for(let e of t||[])e.status===`rejected`&&i(e.reason);return e().catch(i)})},nn=360*60*1e3,Z=[{id:`cockpit`,label:`Cockpit`,eyebrow:`Fleet overview`,description:`Health, active work, alerts, cost and command shortcuts.`,group:`Operations`,icon:l,shortcut:1},{id:`fleet`,label:`Fleet Map`,eyebrow:`Topology`,description:`Machines, projects, terminals and agents in one live graph.`,group:`Operations`,icon:n,shortcut:2},{id:`console`,label:`Live Console`,eyebrow:`Transcripts`,description:`Stream and inspect session or agent conversations.`,group:`Operations`,icon:f,shortcut:3},{id:`mailbox`,label:`Mailbox`,eyebrow:`Coordination`,description:`Cross-project messages, unread work and direct delivery.`,group:`Operations`,icon:ie,shortcut:4},{id:`kanban`,label:`Kanban`,eyebrow:`Project work`,description:`Read-only project boards synchronized across clones and machines.`,group:`Operations`,icon:h},{id:`alerts`,label:`Alerts`,eyebrow:`Attention`,description:`Active fleet warnings and alert transition history.`,group:`Intelligence`,icon:ee,shortcut:5},{id:`cost`,label:`Cost`,eyebrow:`Economics`,description:`Project, provider and model spending distribution.`,group:`Intelligence`,icon:ne,shortcut:6},{id:`trends`,label:`Trends`,eyebrow:`Telemetry`,description:`Cost, token and tool activity over time.`,group:`Intelligence`,icon:r,shortcut:7},{id:`brain`,label:`Brain`,eyebrow:`Decisions`,description:`Autonomous decisions, escalations and interventions.`,group:`Intelligence`,icon:d,shortcut:8},{id:`worktree`,label:`Worktrees`,eyebrow:`Workspace`,description:`Distributed branches, worktrees and ownership state.`,group:`System`,icon:de,shortcut:9},{id:`control`,label:`Control`,eyebrow:`Command plane`,description:`Steer, queue, broadcast and audit remote commands.`,group:`System`,icon:i,shortcut:0},{id:`settings`,label:`Security`,eyebrow:`Access control`,description:`Manage the HQ browser password, authentication and active credentials.`,group:`System`,icon:m}],rn=[`Operations`,`Intelligence`,`System`],an={cockpit:(0,w.lazy)(()=>X(()=>import(`./cockpit-Dj4gx69d.js`).then(e=>({default:e.CockpitView})),__vite__mapDeps([0,1,2,3]))),fleet:(0,w.lazy)(()=>X(()=>import(`./fleet-map-B2eU2NoT.js`).then(e=>({default:e.FleetMapView})),__vite__mapDeps([4,1,2,5,3,6]))),console:(0,w.lazy)(()=>X(()=>import(`./live-console-BRrd34p2.js`).then(e=>({default:e.LiveConsoleView})),__vite__mapDeps([7,1,2,3,6,5]))),mailbox:(0,w.lazy)(()=>X(()=>import(`./mailbox-CtUPdH7g.js`).then(e=>({default:e.MailboxView})),__vite__mapDeps([8,1,2,3,9]))),kanban:(0,w.lazy)(()=>X(()=>import(`./kanban-6xxUvXep.js`).then(e=>({default:e.KanbanView})),__vite__mapDeps([10,1,2,3]))),cost:(0,w.lazy)(()=>X(()=>import(`./cost-DdiRINxE.js`).then(e=>({default:e.CostView})),__vite__mapDeps([11,1,2,3]))),brain:(0,w.lazy)(()=>X(()=>import(`./brain-aSSiXPI_.js`).then(e=>({default:e.BrainView})),__vite__mapDeps([12,1,2,3,9]))),worktree:(0,w.lazy)(()=>X(()=>import(`./worktree-DrEOGtox.js`).then(e=>({default:e.WorktreeView})),__vite__mapDeps([13,1,2,3,9]))),trends:(0,w.lazy)(()=>X(()=>import(`./trends-Bl-Wyntb.js`).then(e=>({default:e.TrendsView})),__vite__mapDeps([14,1,2,3]))),alerts:(0,w.lazy)(()=>X(()=>import(`./alerts-Bkl4wBJE.js`).then(e=>({default:e.AlertsView})),__vite__mapDeps([15,1,2,3]))),control:(0,w.lazy)(()=>X(()=>import(`./control-BcPCPylB.js`).then(e=>({default:e.ControlView})),__vite__mapDeps([16,1,2,3]))),settings:(0,w.lazy)(()=>X(()=>import(`./settings-M1WNoX6Y.js`).then(e=>({default:e.SettingsView})),__vite__mapDeps([17,1,2,3])))};function on(e){return Z.find(t=>t.id===e)??Z[0]}var sn=class extends w.Component{state={error:null};static getDerivedStateFromError(e){return{error:e instanceof Error?e.message:String(e)}}componentDidUpdate(e){e.view!==this.props.view&&this.state.error!==null&&this.setState({error:null})}render(){return this.state.error===null?this.props.children:(0,N.jsxs)(`div`,{className:`hq-view-error`,role:`alert`,children:[(0,N.jsx)(ue,{size:22}),(0,N.jsxs)(`div`,{children:[(0,N.jsx)(`strong`,{children:`This HQ surface stopped safely.`}),(0,N.jsx)(`p`,{children:this.state.error})]}),(0,N.jsxs)(`button`,{type:`button`,className:`hq-btn secondary`,onClick:()=>this.setState({error:null}),children:[(0,N.jsx)(v,{size:13}),`Retry view`]})]})}};function cn(){let{snapshot:e,alerts:t,activeView:n,authRequired:r,connected:i,peerRehydrate:a}=B(T(e=>({snapshot:e.snapshot,alerts:e.alerts,activeView:e.activeView,authRequired:e.authRequired,connected:e.connected,peerRehydrate:e.peerRehydrate}))),[c,l]=(0,w.useState)(()=>typeof window>`u`||window.innerWidth>=1180),[u,d]=(0,w.useState)(null),[f,ee]=(0,w.useState)(null),[ie,p]=(0,w.useState)(!1),{theme:m}=Wt().appearance,h=(0,w.useRef)(!1),g=(0,w.useRef)(!1);if((0,w.useEffect)(()=>{g.current&&i===!1?M.getState().addToast(`Connection lost — reconnecting with backoff…`,`warning`,4e3):g.current&&h.current===!1&&i===!0&&M.getState().addToast(`Reconnected to HQ server`,`success`,3e3),i&&(g.current=!0),h.current=i},[i]),(0,w.useEffect)(()=>(document.documentElement.dataset.hqTheme=m,()=>{delete document.documentElement.dataset.hqTheme}),[m]),(0,w.useEffect)(()=>{let e=!1;return V(`/api/snapshot`).then(t=>{e||B.getState()._hydrateSnapshot(t)}).catch(()=>{}),()=>{e=!0}},[]),(0,w.useEffect)(()=>{let e=!1;return V(`/api/auth/status`).then(t=>{e||ee(t)}).catch(()=>{}),()=>{e=!0}},[]),(0,w.useEffect)(()=>{let e=!1,t=()=>{V(`/api/system/update`).then(t=>{e||d(t)}).catch(()=>{})};t();let n=window.setInterval(t,nn);return()=>{e=!0,window.clearInterval(n)}},[]),(0,w.useEffect)(()=>{let e=e=>{if((e.ctrlKey||e.metaKey)&&e.key.toLowerCase()===`b`){e.preventDefault(),l(e=>!e);return}if(e.altKey&&/^\d$/.test(e.key)){let t=Number(e.key),n=Z.find(e=>e.shortcut===t);n&&(e.preventDefault(),B.getState().setActiveView(n.id));return}e.key===`Escape`&&c&&window.innerWidth<900&&l(!1)};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[c]),r)return(0,N.jsx)(Xt,{hadToken:A()!==null});let _=e?.totals,ue=_?.unreadMailboxMessages??0,de=t.filter(e=>e.severity!==`info`).length,v=on(n),pe=v.icon,y=an[n],me=e=>{B.getState().setActiveView(e),window.innerWidth<900&&l(!1)},b=async()=>{p(!0);try{await j(`/api/logout`,{method:`POST`})}finally{k(),window.location.reload()}};return(0,N.jsxs)(`div`,{className:`hq-app`,"data-theme":m,"data-testid":`hq-workbench`,children:[(0,N.jsx)(`button`,{type:`button`,className:`hq-sidebar-scrim`,"data-open":c,"aria-label":`Close HQ navigation`,onClick:()=>l(!1)}),(0,N.jsxs)(`aside`,{className:`hq-secondary-nav`,"data-open":c,"aria-label":`HQ navigation`,children:[(0,N.jsxs)(`div`,{className:`hq-secondary-header`,children:[(0,N.jsxs)(`div`,{className:`hq-secondary-brand`,children:[(0,N.jsx)(`img`,{src:`/wrongstack.svg`,alt:``,"aria-hidden":`true`,draggable:!1}),(0,N.jsxs)(`div`,{className:`hq-secondary-copy`,children:[(0,N.jsx)(`span`,{className:`hq-secondary-eyebrow`,children:`Command center`}),(0,N.jsx)(`strong`,{children:`WrongStack HQ`})]})]}),(0,N.jsx)(`button`,{type:`button`,className:`hq-icon-button hq-secondary-close`,"aria-label":`Collapse HQ navigation`,title:`Collapse navigation (Ctrl+B)`,onClick:()=>l(!1),children:(0,N.jsx)(o,{size:16})})]}),(0,N.jsx)(`div`,{className:`hq-secondary-scroll`,children:rn.map(e=>(0,N.jsxs)(`section`,{className:`hq-nav-group`,children:[(0,N.jsx)(`div`,{className:`hq-nav-group-label`,children:e}),Z.filter(t=>t.group===e).map(e=>{let t=e.icon,r=e.id===`mailbox`?ue:e.id===`alerts`?de:0;return(0,N.jsxs)(`button`,{type:`button`,className:`hq-nav-item`,"data-active":n===e.id,"aria-current":n===e.id?`page`:void 0,onClick:()=>me(e.id),children:[(0,N.jsx)(t,{size:15}),(0,N.jsx)(`span`,{children:e.label}),e.shortcut===void 0?null:(0,N.jsxs)(`kbd`,{children:[`Alt+`,e.shortcut]}),r>0?(0,N.jsx)(`span`,{className:`hq-nav-badge`,children:r}):null]},e.id)})]},e))}),(0,N.jsxs)(`div`,{className:`hq-secondary-footer`,children:[(0,N.jsxs)(`div`,{className:`hq-link-state`,"data-live":i,children:[(0,N.jsx)(`span`,{className:`hq-link-dot`}),(0,N.jsxs)(`div`,{children:[(0,N.jsx)(`strong`,{children:i?`Connected`:`Reconnecting`}),(0,N.jsxs)(`span`,{children:[_?.activeMachines??0,` machines · `,_?.activeClients??0,` clients`]})]})]}),(0,N.jsx)(`span`,{className:`hq-build-label`,children:`@wrongstack/webui-hq`})]})]}),(0,N.jsxs)(`section`,{className:`hq-workbench`,"data-update-available":u?.outdated===!0,children:[(0,N.jsxs)(`header`,{className:`hq-header`,children:[(0,N.jsx)(`button`,{type:`button`,className:`hq-icon-button hq-sidebar-toggle`,"aria-label":c?`Collapse HQ navigation`:`Expand HQ navigation`,"aria-expanded":c,title:`Toggle navigation (Ctrl+B)`,onClick:()=>l(e=>!e),children:c?(0,N.jsx)(o,{size:17}):(0,N.jsx)(re,{size:17})}),(0,N.jsx)(`div`,{className:`hq-view-icon`,"aria-hidden":`true`,children:(0,N.jsx)(pe,{size:18})}),(0,N.jsxs)(`div`,{className:`hq-view-identity`,children:[(0,N.jsx)(`span`,{children:v.eyebrow}),(0,N.jsx)(`h1`,{children:v.label}),(0,N.jsx)(`p`,{children:v.description})]}),(0,N.jsxs)(`div`,{className:`hq-top-metrics`,children:[(0,N.jsx)(Q,{icon:ae,label:`Machines`,value:_?.activeMachines??0}),(0,N.jsx)(Q,{icon:le,label:`Agents`,value:_?.activeAgents??0}),(0,N.jsx)(Q,{icon:s,label:`Sessions`,value:_?.activeSessions??0}),(0,N.jsx)(Q,{icon:ne,label:`Cost`,value:`$${(_?.totalCostUsd??0).toFixed(2)}`,accent:!0})]}),(0,N.jsxs)(`div`,{className:`hq-connection-pill`,"data-live":i,children:[i?(0,N.jsx)(se,{size:13}):(0,N.jsx)(oe,{size:13}),i?`Live`:`Reconnecting`]}),(0,N.jsx)(`button`,{type:`button`,className:`hq-icon-button hq-theme-toggle`,"aria-label":`Switch to ${m===`dark`?`light`:`dark`} mode`,title:`Switch to ${m===`dark`?`light`:`dark`} mode`,onClick:()=>Kt({theme:m===`dark`?`light`:`dark`}),children:m===`dark`?(0,N.jsx)(fe,{size:16}):(0,N.jsx)(ce,{size:16})}),f?.tokenMode||f?.passwordMode?(0,N.jsx)(`button`,{type:`button`,className:`hq-icon-button`,"aria-label":`Log out of HQ`,title:`Log out and clear this tab's HQ credentials`,disabled:ie,onClick:()=>void b(),children:(0,N.jsx)(te,{size:16})}):null]}),u?.outdated?(0,N.jsx)(un,{status:u}):null,a?(0,N.jsx)(ln,{envelope:a}):null,(0,N.jsx)(`main`,{className:`hq-main`,id:`hq-main`,tabIndex:-1,children:(0,N.jsx)(sn,{view:n,children:(0,N.jsx)(w.Suspense,{fallback:(0,N.jsx)(dn,{label:v.label}),children:(0,N.jsx)(y,{})})})})]}),(0,N.jsx)(mt,{})]})}function ln({envelope:e}){let t=e.kind===`peer.rehydrate`?`Leader session lost — survivor clients can rehydrate`:`Leader session lost — no survivor clients reported`,n=e.kind===`peer.rehydrate`&&e.payload.rehydrateHint?e.payload.rehydrateHint:`${e.payload.previousLeaderHandle} on ${e.payload.machineId} ended (${e.payload.reason}).`;return(0,N.jsxs)(`aside`,{className:`hq-peer-rehydrate-notice`,role:`status`,"aria-live":`polite`,children:[(0,N.jsx)(p,{size:16,"aria-hidden":`true`}),(0,N.jsxs)(`div`,{children:[(0,N.jsx)(`strong`,{children:t}),(0,N.jsx)(`span`,{children:n})]}),(0,N.jsx)(`button`,{type:`button`,onClick:()=>B.getState()._dismissPeerRehydrate(),title:`Dismiss peer lifecycle notice`,children:`Dismiss`})]})}function un({status:e}){let[t,n]=(0,w.useState)(!1),r=async()=>{try{await navigator.clipboard.writeText(e.command),n(!0),window.setTimeout(()=>n(!1),1500)}catch{n(!1)}};return(0,N.jsxs)(`aside`,{className:`hq-update-notice`,role:`status`,"aria-live":`polite`,children:[(0,N.jsx)(p,{size:16,"aria-hidden":`true`}),(0,N.jsxs)(`div`,{children:[(0,N.jsx)(`strong`,{children:`WrongStack update available`}),(0,N.jsxs)(`span`,{children:[`v`,e.current,` → v`,e.latest,`. Run `,(0,N.jsx)(`code`,{children:e.command}),` in your terminal, then restart HQ.`]})]}),(0,N.jsxs)(`button`,{type:`button`,onClick:()=>void r(),title:`Copy update command`,children:[(0,N.jsx)(g,{size:13,"aria-hidden":`true`}),t?`Copied`:`Copy command`]})]})}function Q({icon:e,label:t,value:n,accent:r=!1}){return(0,N.jsxs)(`div`,{className:`hq-top-metric`,"data-accent":r,children:[(0,N.jsx)(e,{size:12}),(0,N.jsx)(`span`,{children:t}),(0,N.jsx)(`strong`,{children:n})]})}function dn({label:e}){return(0,N.jsxs)(`div`,{className:`hq-view-loading`,role:`status`,children:[(0,N.jsx)(i,{size:18}),(0,N.jsxs)(`span`,{children:[`Loading `,e,`…`]})]})}var fn=25e3,pn=1e4,mn=3e4,hn=32;function gn(e){if(!Number.isFinite(e))return 0;let t=Math.max(0,Math.trunc(e));return Number.isSafeInteger(t)?t:0}var _n=class{ws=null;handlers=new Set;stateHandlers=new Set;reconnectAttempt=0;connectionState=he();reconnectTimer=null;heartbeatTimer=null;lastMessageAt=0;stopped=!1;_state=`disconnected`;_url;resumeCursor;maxRetries;heartbeatIntervalMs;heartbeatTimeoutMs;maxBackoffMs;constructor(e){if(this.maxRetries=e?.maxRetries??1/0,this.heartbeatIntervalMs=e?.heartbeatIntervalMs??fn,this.heartbeatTimeoutMs=e?.heartbeatTimeoutMs??pn,this.maxBackoffMs=e?.maxBackoffMs??mn,this.resumeCursor=e?.resumeCursor??(()=>({})),e?.url)this._url=e.url;else{let e=typeof window<`u`?window.location:{host:`127.0.0.1:3499`,protocol:`http:`},t=e.protocol===`https:`?`wss:`:`ws:`,n=A(),r=`${t}//${e.host}/ws/browser`;this._url=n===null?r:`${r}?token=${encodeURIComponent(n)}`}}get url(){return this._url}get state(){return this._state}get isConnected(){return this.ws?.readyState===WebSocket.OPEN}connect(){if(this.stopped||this.ws!==null)return;this.connectionState=ge(this.connectionState),this.emitState(`connecting`);let e;try{e=new WebSocket(this._url)}catch{this.scheduleReconnect();return}this.ws=e,e.onopen=()=>{this.ws===e&&(this.reconnectAttempt=0,this.connectionState=_e(this.connectionState),this.lastMessageAt=Date.now(),this.connectionState=ve(this.connectionState,this.lastMessageAt),this.emitState(`connected`),this.sendResume(),this.startHeartbeat())},e.onmessage=t=>{if(this.ws===e){this.lastMessageAt=Date.now(),this.connectionState=ve(this.connectionState,this.lastMessageAt);try{let e=JSON.parse(typeof t.data==`string`?t.data:``);for(let t of this.handlers)try{t(e)}catch{}}catch{}}},e.onclose=()=>this.handleClose(e,`close`),e.onerror=()=>this.handleClose(e,`error`)}close(){this.stopped=!0,this.connectionState=ye(this.connectionState),this.stopHeartbeat(),this.reconnectTimer!==null&&(clearTimeout(this.reconnectTimer),this.reconnectTimer=null),this.ws?.close(1e3,`client closed`),this.ws=null,this.emitState(`disconnected`)}setResumeCursorProvider(e){this.resumeCursor=e}on(e){return this.handlers.add(e),()=>this.handlers.delete(e)}onStateChange(e){return this.stateHandlers.add(e),e(this._state),()=>this.stateHandlers.delete(e)}handleClose(e,t){this.ws===e&&(this.ws=null,this.stopHeartbeat(),this.scheduleReconnect())}scheduleReconnect(){if(this.stopped||this.reconnectTimer!==null)return;let e=be(this.connectionState,{...b,maxReconnectAttempts:this.maxRetries,maxBackoffMs:this.maxBackoffMs,heartbeatIntervalMs:this.heartbeatIntervalMs,heartbeatTimeoutMs:this.heartbeatTimeoutMs,jitterRatio:.5});if(this.connectionState=e.state,this.reconnectAttempt=e.state.reconnectAttempt,!e.plan){this.emitState(`disconnected`);return}this.emitState(`reconnecting`),this.reconnectTimer=setTimeout(()=>{this.reconnectTimer=null,this.connect()},e.plan.delayMs)}sendResume(){if(this.ws?.readyState===WebSocket.OPEN)try{for(let e of this.resumeFrames())this.ws.send(JSON.stringify(e))}catch{}}resumeFrames(){try{let e=this.resumeCursor(),t=typeof e.entries==`function`?e.entries():Object.entries(e),n=[];for(let[e,r]of t){if(typeof e!=`string`||e.length===0)continue;let t=gn(r);n.push({clientId:e,lastSeqSeen:t})}n.sort((e,t)=>t.lastSeqSeen===e.lastSeqSeen?e.clientId.localeCompare(t.clientId):t.lastSeqSeen-e.lastSeqSeen);let r=n.find(({clientId:e})=>e===R),i=r===void 0?hn:hn-1,a=n.filter(({clientId:e})=>e!==R).slice(0,i);return r!==void 0&&a.unshift(r),a.map(({clientId:e,lastSeqSeen:t})=>({type:`client.resume`,clientId:e,lastSeqSeen:t}))}catch{return[]}}get isHeartbeatTimedOut(){return this.ws===null||xe(this.connectionState,{...b,heartbeatIntervalMs:this.heartbeatIntervalMs,heartbeatTimeoutMs:this.heartbeatTimeoutMs})}startHeartbeat(){this.stopHeartbeat(),this.lastMessageAt=Date.now(),this.heartbeatTimer=setInterval(()=>{this.isHeartbeatTimedOut&&this.ws!==null&&(this.ws.close(4e3,`heartbeat timeout`),this.ws=null,this.scheduleReconnect())},this.heartbeatIntervalMs)}stopHeartbeat(){this.heartbeatTimer!==null&&(clearInterval(this.heartbeatTimer),this.heartbeatTimer=null)}emitState(e){this._state=e;for(let t of this.stateHandlers)try{t(e)}catch{}}},$=null;function vn(e){if($===null)return $=new _n(e),$.connect(),$;if(e?.resumeCursor!==void 0&&$.setResumeCursorProvider(e.resumeCursor),e===void 0)return $;let t=[];return e.url!==void 0&&e.url!==$.url&&t.push(`url: ${e.url} vs ${$.url}`),e.heartbeatIntervalMs!==void 0&&e.heartbeatIntervalMs!==$.heartbeatIntervalMs&&t.push(`heartbeatIntervalMs: ${e.heartbeatIntervalMs} vs ${$.heartbeatIntervalMs}`),e.heartbeatTimeoutMs!==void 0&&e.heartbeatTimeoutMs!==$.heartbeatTimeoutMs&&t.push(`heartbeatTimeoutMs: ${e.heartbeatTimeoutMs} vs ${$.heartbeatTimeoutMs}`),e.maxBackoffMs!==void 0&&e.maxBackoffMs!==$.maxBackoffMs&&t.push(`maxBackoffMs: ${e.maxBackoffMs} vs ${$.maxBackoffMs}`),e.maxRetries!==void 0&&e.maxRetries!==$.maxRetries&&t.push(`maxRetries: ${e.maxRetries} vs ${$.maxRetries}`),t.length>0&&typeof console<`u`&&console.warn(`[hq-ws-client] getHqClient() called with options that conflict with the live singleton; ignoring: ${t.join(`, `)}. Call closeHqClient() first if you need to reconfigure.`),$}var yn=document.getElementById(`root`);yn!==null&&it().finally(()=>{et();let e=vn({resumeCursor:()=>B.getState().resumeCursors});e.onStateChange(e=>{B.getState()._setConnected(e===`connected`)});let t=null,n=()=>{t===null&&(B.getState()._setNeedsSnapshotRefresh(!1),t=V(`/api/snapshot`).then(e=>{B.getState()._onSnapshot(e)}).catch(()=>void 0).finally(()=>{t=null}))};B.subscribe((e,t)=>{e.needsSnapshotRefresh&&!t.needsSnapshotRefresh&&n()}),e.on(e=>{if(e.type===`hq.snapshot`){let t=He(e);t&&B.getState()._onSnapshot(t.snapshot)}else if(e.type===`hq.event`){let t=Ue(e);t&&B.getState()._onEvent(t.event)}else if(e.type===`hq.alert`){let t=We(e);t&&B.getState()._onAlert(t.alert)}else if(e.type===`hq.command_status`){let t=Ge(e);t&&B.getState()._onCommandStatus(t.command)}else if(e.type===`hq.resume_gap`)for(let t of e.envelopes){let e=Ue({type:`hq.event`,event:t});e&&B.getState()._onEvent(e.event)}else e.type===`hq.resume_reject`&&(B.getState()._resetResumeCursors(),B.getState()._setNeedsSnapshotRefresh(!0))}),(0,Ke.createRoot)(yn).render((0,N.jsx)(w.StrictMode,{children:(0,N.jsx)(cn,{})}))});export{Wt as a,It as c,k as d,T as f,Yt as i,B as l,Gt as n,V as o,qt as r,Lt as s,Jt as t,j as u};
@@ -1 +0,0 @@
1
- import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{Ct as t,Lt as n,S as r,_t as i,c as a,rt as o,s}from"./icons-BV2PcvP1.js";import{i as c}from"./markdown-HUVrfVaI.js";import{l,o as u}from"./index-DwX1O_JZ.js";var d=e(n(),1),f=new Set([`low`,`medium`,`high`,`critical`]),p=new Set([`pending`,`ready`,`in_progress`,`review`,`completed`,`blocked`,`failed`,`archived`]);function m(e){return`/api/projects/${encodeURIComponent(e)}/kanban`}function h(e){return e.boards.map(e=>g(e)).filter(e=>e!==null).sort((e,t)=>t.updatedAt.localeCompare(e.updatedAt))}function g(e){let t=e.board;if(t.id!==e.boardId)return null;let n=y(t.columns).map(_).filter(e=>e!==null),r=y(t.tasks).map(v).filter(e=>e!==null),i=new Set(n.map(e=>e.id)),a=new Set(r.map(e=>e.columnId).filter(e=>!i.has(e)));for(let e of a)n.push({id:e,title:e.length>0?e:`Unmapped`,order:2**53-1});let o=n.sort((e,t)=>e.order-t.order||e.title.localeCompare(t.title)).map(e=>({...e,tasks:r.filter(t=>t.columnId===e.id).sort((e,t)=>e.order-t.order||e.title.localeCompare(t.title))}));return{id:e.boardId,title:S(t.title)??e.boardId,description:S(t.description),tags:x(t.tags),revision:e.revision,updatedAt:e.updatedAt,activePresence:y(t.presence).filter(e=>e.active===!0).length,taskCount:r.length,completedTaskCount:r.filter(e=>e.status===`completed`).length,activeTaskCount:r.filter(e=>e.status===`in_progress`||e.status===`review`).length,blockedTaskCount:r.filter(e=>e.status===`blocked`||e.status===`failed`).length,columns:o}}function _(e){let t=S(e.id),n=S(e.title);return!t||!n?null:{id:t,title:n,color:S(e.color),order:C(e.order)??0,wipLimit:C(e.wipLimit)}}function v(e){let t=S(e.id),n=S(e.title),r=S(e.columnId);if(!t||!n||r===void 0)return null;let i=b(e.assignment);return{id:t,title:n,description:S(e.description),columnId:r,order:C(e.order)??0,priority:w(e.priority,f)??`medium`,status:w(e.status,p)??`pending`,assignee:S(e.assignee)??S(e.assignedAgent)??S(i?.name)??S(i?.agentId),assignmentStatus:S(i?.status),labels:x(e.labels),dependsOn:x(e.dependsOn),dueDate:S(e.dueDate)}}function y(e){return Array.isArray(e)?e.filter(e=>typeof e==`object`&&!!e&&!Array.isArray(e)):[]}function b(e){return typeof e==`object`&&e&&!Array.isArray(e)?e:void 0}function x(e){return Array.isArray(e)?e.filter(e=>typeof e==`string`):[]}function S(e){return typeof e==`string`?e:void 0}function C(e){return typeof e==`number`&&Number.isFinite(e)?e:void 0}function w(e,t){return typeof e==`string`&&t.has(e)?e:void 0}var T=c(),E=1e4,D=[];function O(){let e=l(e=>e.snapshot?.projects??D),t=l(e=>{for(let t=e.events.length-1;t>=0;t--){let n=e.events[t];if(n?.type===`kanban.snapshot`)return n.id}return null}),[n,i]=(0,d.useState)(``),[o,s]=(0,d.useState)(``),[c,f]=(0,d.useState)(null),[p,g]=(0,d.useState)(!1),[_,v]=(0,d.useState)(!1),[y,b]=(0,d.useState)(null),x=(0,d.useRef)(0),S=(0,d.useRef)(t);(0,d.useEffect)(()=>{if(e.length===0){i(``),f(null);return}e.some(e=>e.projectId===n)||i(e[0].projectId)},[n,e]);let C=(0,d.useCallback)(async(e=!1)=>{if(!n)return;let t=++x.current;e?g(!0):v(!0);try{let e=await u(m(n));if(t!==x.current)return;f(e),b(null)}catch(e){if(t!==x.current)return;b(e instanceof Error?e.message:String(e))}finally{t===x.current&&(g(!1),v(!1))}},[n]);(0,d.useEffect)(()=>{x.current++,f(null),s(``),b(null)},[n]),(0,d.useEffect)(()=>{if(!n)return;C(!0);let e=window.setInterval(()=>void C(!1),E);return()=>{x.current++,window.clearInterval(e)}},[C,n]),(0,d.useEffect)(()=>{t===null||t===S.current||(S.current=t,n&&C(!1))},[t,C,n]);let w=(0,d.useMemo)(()=>c?h(c):[],[c]);(0,d.useEffect)(()=>{w.length===0?s(``):w.some(e=>e.id===o)||s(w[0].id)},[o,w]);let O=w.find(e=>e.id===o)??null,j=e.find(e=>e.projectId===n)??null;return e.length===0?(0,T.jsx)(`div`,{className:`hq-empty`,children:`No HQ projects are available. Connect a WrongStack client to publish its project identity and Kanban snapshot.`}):(0,T.jsxs)(`div`,{className:`hq-kanban-view`,children:[(0,T.jsx)(k,{projects:e,projectId:n,onProjectChange:e=>i(e),boards:w,boardId:o,onBoardChange:s,generatedAt:c?.generatedAt,refreshing:_,onRefresh:()=>void C(!1)}),y?(0,T.jsxs)(`div`,{className:`hq-kanban-error`,role:`alert`,children:[(0,T.jsx)(a,{size:15}),(0,T.jsx)(`span`,{children:y}),(0,T.jsx)(`button`,{type:`button`,onClick:()=>void C(!0),children:`Retry`})]}):null,p&&c===null?(0,T.jsxs)(`div`,{className:`hq-view-loading`,role:`status`,children:[(0,T.jsx)(r,{size:18}),(0,T.jsx)(`span`,{children:`Loading project boards…`})]}):O?(0,T.jsxs)(T.Fragment,{children:[(0,T.jsx)(A,{project:j,board:O,boardCount:w.length}),(0,T.jsx)(M,{board:O})]}):(0,T.jsxs)(`div`,{className:`hq-empty`,children:[`This project has not published a Kanban board yet. Create one with `,(0,T.jsx)(`code`,{children:`/kanban`}),` `,`from any connected clone.`]})]})}function k({projects:e,projectId:t,onProjectChange:n,boards:i,boardId:a,onBoardChange:o,generatedAt:s,refreshing:c,onRefresh:l}){return(0,T.jsxs)(`div`,{className:`hq-kanban-toolbar`,children:[(0,T.jsxs)(`label`,{children:[(0,T.jsx)(`span`,{children:`Project`}),(0,T.jsx)(`select`,{className:`hq-select`,"aria-label":`Kanban project`,value:t,onChange:e=>n(e.target.value),children:e.map(e=>(0,T.jsx)(`option`,{value:e.projectId,children:e.projectName},e.projectId))})]}),(0,T.jsxs)(`label`,{children:[(0,T.jsx)(`span`,{children:`Board`}),(0,T.jsxs)(`select`,{className:`hq-select`,"aria-label":`Kanban board`,value:a,disabled:i.length===0,onChange:e=>o(e.target.value),children:[i.length===0?(0,T.jsx)(`option`,{value:``,children:`No boards`}):null,i.map(e=>(0,T.jsx)(`option`,{value:e.id,children:e.title},e.id))]})]}),(0,T.jsxs)(`div`,{className:`hq-kanban-sync`,children:[(0,T.jsx)(`span`,{children:s?`Synced ${F(s)}`:`Waiting for snapshot`}),(0,T.jsxs)(`button`,{type:`button`,onClick:l,disabled:c,"aria-label":`Refresh Kanban`,children:[(0,T.jsx)(r,{size:14,className:c?`is-spinning`:void 0}),`Refresh`]})]})]})}function A({project:e,board:t,boardCount:n}){return(0,T.jsxs)(`section`,{className:`hq-kanban-summary`,children:[(0,T.jsxs)(`div`,{className:`hq-kanban-heading`,children:[(0,T.jsxs)(`div`,{children:[(0,T.jsxs)(`span`,{children:[e?.projectName??`Project`,` · Kanban`]}),(0,T.jsx)(`h2`,{children:t.title}),t.description?(0,T.jsx)(`p`,{children:t.description}):null]}),(0,T.jsxs)(`div`,{className:`hq-kanban-board-meta`,children:[(0,T.jsxs)(`span`,{className:`hq-mono`,children:[`rev `,t.revision]}),(0,T.jsx)(`span`,{children:F(t.updatedAt)}),t.activePresence>0?(0,T.jsxs)(`span`,{className:`hq-pill active`,children:[t.activePresence,` active`]}):null]})]}),t.tags.length>0?(0,T.jsx)(`div`,{className:`hq-kanban-tags`,children:t.tags.map(e=>(0,T.jsx)(`span`,{className:`hq-pill info`,children:e},e))}):null,(0,T.jsxs)(`div`,{className:`hq-kanban-stats`,children:[(0,T.jsx)(j,{label:`Boards`,value:n}),(0,T.jsx)(j,{label:`Tasks`,value:t.taskCount}),(0,T.jsx)(j,{label:`Active`,value:t.activeTaskCount,tone:`active`}),(0,T.jsx)(j,{label:`Blocked`,value:t.blockedTaskCount,tone:`blocked`}),(0,T.jsx)(j,{label:`Done`,value:t.completedTaskCount,tone:`done`})]})]})}function j({label:e,value:t,tone:n}){return(0,T.jsxs)(`div`,{className:`hq-kanban-stat`,"data-tone":n,children:[(0,T.jsx)(`strong`,{children:t}),(0,T.jsx)(`span`,{children:e})]})}function M({board:e}){return e.columns.length===0?(0,T.jsx)(`div`,{className:`hq-empty`,children:`This board does not have any columns yet.`}):(0,T.jsx)(`section`,{className:`hq-kanban-board`,"aria-label":`${e.title} Kanban board`,style:{"--hq-kanban-columns":Math.max(1,e.columns.length)},children:e.columns.map(e=>(0,T.jsxs)(`div`,{className:`hq-kanban-column`,"data-over-limit":e.wipLimit!==void 0&&e.tasks.filter(e=>e.status!==`completed`).length>e.wipLimit,children:[(0,T.jsxs)(`header`,{style:e.color?{borderTopColor:e.color}:void 0,children:[(0,T.jsxs)(`div`,{children:[(0,T.jsx)(`strong`,{children:e.title}),e.wipLimit===void 0?null:(0,T.jsxs)(`span`,{children:[`WIP `,e.tasks.length,`/`,e.wipLimit]})]}),(0,T.jsx)(`span`,{className:`hq-kanban-column-count`,children:e.tasks.length})]}),(0,T.jsx)(`div`,{className:`hq-kanban-column-body`,children:e.tasks.length===0?(0,T.jsx)(`div`,{className:`hq-kanban-column-empty`,children:`No cards`}):e.tasks.map(e=>(0,T.jsx)(N,{task:e},e.id))})]},e.id))})}function N({task:e}){return(0,T.jsxs)(`article`,{className:`hq-kanban-task`,"data-priority":e.priority,children:[(0,T.jsxs)(`div`,{className:`hq-kanban-task-topline`,children:[(0,T.jsx)(`span`,{className:`hq-pill ${e.status}`,children:e.status.replaceAll(`_`,` `)}),(0,T.jsx)(`span`,{className:`hq-kanban-priority ${e.priority}`,children:e.priority})]}),(0,T.jsx)(`h3`,{children:e.title}),e.description?(0,T.jsx)(`p`,{children:e.description}):null,e.labels.length>0?(0,T.jsx)(`div`,{className:`hq-kanban-task-labels`,children:e.labels.slice(0,4).map(e=>(0,T.jsx)(`span`,{children:e},e))}):null,(0,T.jsxs)(`footer`,{children:[e.assignee?(0,T.jsxs)(`span`,{title:e.assignmentStatus??`assigned`,children:[(0,T.jsx)(s,{size:12}),e.assignee]}):null,e.dependsOn.length>0?(0,T.jsxs)(`span`,{title:`${e.dependsOn.length} dependencies`,children:[(0,T.jsx)(o,{size:12}),e.dependsOn.length]}):null,e.dueDate?(0,T.jsxs)(`span`,{title:`Due ${new Date(e.dueDate).toLocaleString()}`,children:[(0,T.jsx)(i,{size:12}),P(e.dueDate)]}):null,e.status===`completed`?(0,T.jsx)(t,{size:13,className:`is-done`}):null]})]})}function P(e){let t=new Date(e);return Number.isFinite(t.getTime())?t.toLocaleDateString(void 0,{month:`short`,day:`numeric`}):e}function F(e){let t=Date.parse(e);if(!Number.isFinite(t))return e;let n=Math.max(0,Math.floor((Date.now()-t)/1e3));if(n<10)return`just now`;if(n<60)return`${n}s ago`;let r=Math.floor(n/60);if(r<60)return`${r}m ago`;let i=Math.floor(r/60);return i<24?`${i}h ago`:`${Math.floor(i/24)}d ago`}export{O as KanbanView};
@@ -1 +0,0 @@
1
- import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{C as t,Dt as n,Ft as r,Lt as i,M as a,N as o,Nt as s,O as c,X as l,d as u,st as d,v as f}from"./icons-BV2PcvP1.js";import{i as p}from"./markdown-HUVrfVaI.js";import{a as m,f as h,l as g,s as _,t as v}from"./index-DwX1O_JZ.js";import{c as y,l as b,s as ee,t as x,u as S}from"./fleet-topology-CTK7p_tj.js";var C=e(i(),1);function w(e,t,n){if(e===null||t===null)return null;let r=(e.liveSessions??[]).find(e=>e.sessionId===t);if(r===void 0)return null;let i=e.sessions.find(e=>e.sessionId===t)?.clientId,a=r.clientId??i,o=e.clients.find(e=>e.connected&&e.clientId===a),s=e.clients.filter(e=>e.connected&&e.machineId===r.machineId&&e.projectId===r.projectId&&(r.pid===void 0||e.pid===r.pid)),c=(o?.capabilities.includes(`control.receive`)===!0?o:void 0)??s.find(e=>e.kind===r.clientKind&&e.capabilities.includes(`control.receive`))??s.find(e=>e.capabilities.includes(`control.receive`))??o??s[0],l=n===null?null:r.agents.find(e=>e.id===n)??null,u=n===null||n===`leader`?`leader`:n,d=e.clients.some(e=>e.connected&&e.projectId===r.projectId&&e.capabilities.includes(`mailbox.serve`));return{session:r,client:c??null,agent:l,recipient:u,controllable:c?.capabilities.includes(`control.receive`)===!0,mailboxServeActive:d}}var T=p();function E(e){let t=x(e),n=[],r=new Map,i=new Map,a=new Map,o=e=>`machine:${e.machineId}`,s=e=>`project:${e.machineId}:${e.projectId}`;for(let e of t.nodes){if(e.kind!==`machine`)continue;let t={id:e.id,label:e.label,sub:e.sub,projects:[]};r.set(e.id,t),n.push(t)}for(let e of t.nodes){if(e.kind!==`project`)continue;let t=r.get(o(e));if(t===void 0)continue;let n={id:e.id,label:e.label,clients:[]};i.set(e.id,n),t.projects.push(n)}for(let e of t.nodes){if(e.kind!==`terminal`||e.sessionId===void 0||e.serviceMode!==void 0)continue;let t=i.get(s(e));if(t===void 0)continue;let n={clientId:e.clientId,sessionId:e.sessionId,label:e.label,clientKind:e.clientKind,status:e.status,synthetic:e.isSyntheticSession===!0,agents:[]};a.set(e.sessionId,n),t.clients.push(n)}for(let e of t.nodes){if(e.kind!==`agent`||e.sessionId===void 0||e.agentId===void 0)continue;let t=a.get(e.sessionId);t!==void 0&&t.agents.push({id:e.agentId,label:e.label,status:e.status})}return n.map(e=>({...e,projects:e.projects.filter(e=>e.clients.length>0)})).filter(e=>e.projects.length>0)}function D(e){return e===`active`||e===`running`||e===`streaming`?`active`:e===`waiting_user`?`warn`:e===`error`||e===`stale`||e===`closing`?`error`:`idle`}function O({snapshot:e,selectedSessionId:t,selectedAgentId:r}){let i=(0,C.useMemo)(()=>E(e),[e]),[o,c]=(0,C.useState)(new Set),l=e=>c(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n});return i.length===0?(0,T.jsx)(`div`,{className:`hq-fleetnav`,children:(0,T.jsx)(`div`,{className:`hq-empty hq-pad-md`,children:`No live sessions. Open a WrongStack CLI/TUI/WebUI connected to HQ.`})}):(0,T.jsx)(`div`,{className:`hq-fleetnav`,role:`tree`,"aria-label":`Fleet navigator`,children:i.map(e=>{let i=!o.has(e.id);return(0,T.jsxs)(`div`,{className:`hq-nav-machine`,children:[(0,T.jsxs)(`button`,{type:`button`,className:`hq-nav-row machine`,onClick:()=>l(e.id),"aria-expanded":i,children:[(0,T.jsx)(n,{size:12,className:`hq-nav-caret`+(i?` open`:``)}),(0,T.jsx)(a,{size:13}),(0,T.jsx)(`span`,{className:`hq-nav-label`,title:e.sub??e.label,children:e.label})]}),i&&e.projects.map(e=>{let i=!o.has(e.id);return(0,T.jsxs)(`div`,{className:`hq-nav-project`,children:[(0,T.jsxs)(`button`,{type:`button`,className:`hq-nav-row project`,onClick:()=>l(e.id),"aria-expanded":i,children:[(0,T.jsx)(n,{size:12,className:`hq-nav-caret`+(i?` open`:``)}),(0,T.jsx)(d,{size:13}),(0,T.jsx)(`span`,{className:`hq-nav-label`,title:e.label,children:e.label})]}),i&&e.clients.map(e=>{let i=!o.has(e.sessionId),a=t===e.sessionId&&r===null;return(0,T.jsxs)(`div`,{className:`hq-nav-client`,children:[(0,T.jsxs)(`div`,{className:`hq-nav-clientrow`,children:[e.agents.length>0?(0,T.jsx)(`button`,{type:`button`,className:`hq-nav-caretbtn`,onClick:()=>l(e.sessionId),"aria-label":i?`Collapse`:`Expand`,children:(0,T.jsx)(n,{size:12,className:`hq-nav-caret`+(i?` open`:``)})}):(0,T.jsx)(`span`,{className:`hq-nav-caretbtn`}),(0,T.jsxs)(`button`,{type:`button`,className:`hq-nav-row client`+(a?` selected`:``),disabled:e.synthetic,onClick:()=>{e.synthetic||(g.getState().selectSession(e.sessionId),e.clientId!==void 0&&g.getState().selectClient(e.clientId))},title:e.synthetic?`waiting for session telemetry`:e.label,children:[(0,T.jsx)(`span`,{className:`hq-nav-dot `+D(e.status)}),(0,T.jsx)(u,{size:12}),(0,T.jsx)(`span`,{className:`hq-nav-label`,children:e.label}),e.agents.length>0&&(0,T.jsx)(`span`,{className:`hq-nav-count`,children:e.agents.length})]})]}),i&&e.agents.map(n=>(0,T.jsxs)(`button`,{type:`button`,className:`hq-nav-row agent`+(t===e.sessionId&&r===n.id?` selected`:``),onClick:()=>{g.getState().selectAgent(e.sessionId,n.id),e.clientId!==void 0&&g.getState().selectClient(e.clientId)},title:n.label,children:[(0,T.jsx)(`span`,{className:`hq-nav-dot `+D(n.status)}),(0,T.jsx)(s,{size:12}),(0,T.jsx)(`span`,{className:`hq-nav-label`,children:n.label})]},n.id))]},e.sessionId)})]},e.id)})]},e.id)})})}function k(e){return e===`completed`?`active`:e===`failed`||e===`rejected`?`error`:e===`delivered`||e===`accepted`?`info`:`warn`}function A({receipt:e,lifecycle:t}){let n=new Date(e.createdAt).toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`,second:`2-digit`}),r=(0,T.jsx)(`span`,{className:`hq-pill ${k(t)}`,children:t});return e.type===`abort`?(0,T.jsx)(`div`,{className:`hq-chat-turn system hq-command-turn`,"data-command-id":e.commandId,children:(0,T.jsxs)(`span`,{className:`hq-chat-system-line`,children:[(0,T.jsx)(c,{size:12}),` `,e.preview,` `,r,(0,T.jsx)(`span`,{className:`hq-chat-clock`,children:n})]})}):(0,T.jsx)(`div`,{className:`hq-chat-turn user hq-command-turn`,"data-command-id":e.commandId,children:(0,T.jsxs)(`div`,{className:`hq-chat-bubble user`,children:[(0,T.jsxs)(`div`,{className:`hq-chat-role`,children:[`you → `,e.target,` · `,e.type,` `,r,(0,T.jsx)(`span`,{className:`hq-chat-clock`,children:n})]}),(0,T.jsx)(`div`,{className:`hq-chat-prose`,children:e.preview})]})})}function j(){let{selectedSessionId:e,selectedAgentId:n,snapshot:i,commandStatuses:a}=g(h(e=>({selectedSessionId:e.selectedSessionId,selectedAgentId:e.selectedAgentId,snapshot:e.snapshot,commandStatuses:e.commandStatuses}))),u=e,d=n,p=d!==null,x=m().console,[E,D]=(0,C.useState)(x.delivery),[k,j]=(0,C.useState)(x.subject),[M,N]=(0,C.useState)(x.body),[P,F]=(0,C.useState)(!1),[I,L]=(0,C.useState)(null),[te,R]=(0,C.useState)(!1),[z,B]=(0,C.useState)(!1),[V,H]=(0,C.useState)([]),U=b(u,d),{entries:W,meta:G,stats:K}=U,q=(0,C.useMemo)(()=>V.filter(e=>{if(e.type===`abort`)return!0;let t=Date.parse(e.createdAt);return!W.some(n=>n.role===`user`&&n.text.trim()===e.preview&&Math.abs(Date.parse(n.ts)-t)<12e4)}),[W,V]);(0,C.useEffect)(()=>{if(!U.pinned||q.length===0)return;let e=window.requestAnimationFrame(()=>{U.listRef.current?.scrollToIndex(W.length+q.length-1,{align:`end`})});return()=>window.cancelAnimationFrame(e)},[U.listRef,U.pinned,W.length,q.length]);let J=()=>{U.jumpToLatest(),window.requestAnimationFrame(()=>{U.listRef.current?.scrollToIndex(W.length+q.length-1,{align:`end`})})},Y=(0,C.useMemo)(()=>w(i,u,d),[d,u,i]),X=Y?.agent??null,Z=Y?.recipient===`leader`,Q=X?.name??(Z?`Leader agent`:Y?.recipient??`agent`);(0,C.useEffect)(()=>{let e=Y?.client?.clientId;e!==void 0&&g.getState().selectClient(e),L(null),R(!1),B(!1),H([])},[Y?.client?.clientId,u,d]);let $=async()=>{if(Y?.client===null||Y?.client===void 0||!Y.controllable||M.trim().length===0)return;F(!0),L(null);let e=M.trim();try{let t=await _(Y.client.clientId,E,{to:Y.recipient,subject:k.trim()||`HQ ${E}`,body:e,priority:E===`steer`?`high`:`normal`});N(``),v({body:``}),H(n=>[...n,{commandId:t.commandId,type:E,target:Q,preview:e,createdAt:new Date().toISOString()}].slice(-8)),L({tone:`ok`,text:`${E} queued for ${Q} · ${t.commandId}`})}catch(e){L({tone:`error`,text:e instanceof Error?e.message:String(e)})}finally{F(!1)}},ne=async()=>{if(!(Y?.client===null||Y?.client===void 0)){F(!0),L(null);try{let e=await _(Y.client.clientId,`abort`,{target:Y.recipient});if(H(t=>[...t,{commandId:e.commandId,type:`abort`,target:Q,preview:`Interrupt ${Q}`,createdAt:new Date().toISOString()}].slice(-8)),Z&&z){let e=await _(Y.client.clientId,`abort`,{target:`fleet`});H(t=>[...t,{commandId:e.commandId,type:`abort`,target:`all subagents`,preview:`Interrupt every subagent on this client`,createdAt:new Date().toISOString()}].slice(-8))}L({tone:`ok`,text:Z&&z?`Leader interrupt queued; all subagents will be interrupted too.`:`${Q} interrupt queued.`}),R(!1)}catch(e){L({tone:`error`,text:e instanceof Error?e.message:String(e)})}finally{F(!1)}}};return(0,T.jsxs)(`div`,{className:`hq-console-shell`,children:[(0,T.jsx)(O,{snapshot:i??null,selectedSessionId:u,selectedAgentId:d}),(0,T.jsxs)(`div`,{className:`hq-console`,children:[(0,T.jsxs)(`div`,{className:`hq-chat-header`,children:[(0,T.jsx)(o,{size:15,className:`hq-chat-header-icon`}),(0,T.jsx)(`span`,{className:`hq-card-title hq-title-inline`,children:`Console`}),p&&(0,T.jsxs)(`span`,{className:`hq-pill active`,children:[(0,T.jsx)(s,{size:12}),` `,X?.name??d]}),G.projectName!==void 0&&!p&&(0,T.jsx)(`span`,{className:`hq-pill`,children:G.projectName}),Y!==null&&(0,T.jsxs)(`span`,{className:`hq-pill info`,title:Y.client?.clientId,children:[Y.session.hostname??Y.session.machineId,` ·`,` `,Y.session.clientKind.toUpperCase()]}),Y?.mailboxServeActive===!0&&(0,T.jsx)(`span`,{className:`hq-pill active`,children:`mailbox serve`}),G.source!==void 0&&(0,T.jsx)(`span`,{className:`hq-pill`,title:G.source===`disk`?`disk = full history replayed from this machine`:`stream = live ring only (remote or not yet persisted)`,children:G.source===`disk`?`full history`:`live ring`}),(0,T.jsxs)(`span`,{className:`hq-chat-counts`,children:[(0,T.jsxs)(`span`,{className:`hq-pill`,children:[K.turns+q.length,` turns`]}),(0,T.jsxs)(`span`,{className:`hq-pill`,children:[K.tools,` tools`]}),K.running>0&&(0,T.jsxs)(`span`,{className:`hq-pill running`,children:[K.running,` running`]}),K.errors>0&&(0,T.jsxs)(`span`,{className:`hq-pill error`,children:[K.errors,` err`]}),!p&&!U.full&&G.total>W.length&&(0,T.jsxs)(`button`,{type:`button`,className:`hq-btn secondary hq-chat-fullbtn`,onClick:()=>U.setFull(!0),title:`History is truncated — load all ${G.total} turns`,children:[(0,T.jsx)(l,{size:12}),` load all `,G.total]})]})]}),u===null?(0,T.jsx)(`div`,{className:`hq-empty`,children:`Pick a client or agent from the tree on the left.`}):U.loading&&W.length===0&&q.length===0?(0,T.jsx)(`div`,{className:`hq-empty`,children:p?`Loading agent history…`:`Loading transcript…`}):U.error===null?(0,T.jsxs)(`div`,{className:`hq-chat-scroll`,children:[W.length===0&&q.length===0?(0,T.jsx)(`div`,{className:`hq-empty`,children:p?`No messages from ${X?.name??d??`this agent`} yet.`:`No transcript entries yet.`}):(0,T.jsxs)(S,{ref:U.listRef,onScroll:U.onScroll,className:`hq-chat-vlist`,children:[W.map((e,t)=>(0,T.jsx)(`div`,{className:`hq-chat-rowpad`,children:(0,T.jsx)(ee,{entry:e,running:U.isRunningAt(e,t)})},y(e,t))),q.map(e=>{let t=a.find(t=>t.commandId===e.commandId);return(0,T.jsx)(`div`,{className:`hq-chat-rowpad`,"aria-live":`polite`,children:(0,T.jsx)(A,{receipt:e,lifecycle:t?.ackStatus??t?.status??`queued`})},`receipt:${e.commandId}`)})]}),!U.pinned&&(W.length>0||q.length>0)&&(0,T.jsx)(`button`,{type:`button`,className:`hq-chat-jump`,onClick:J,title:`Jump to latest`,children:(0,T.jsx)(r,{size:14})})]}):(0,T.jsxs)(`div`,{className:`hq-empty`,children:[`Error: `,U.error]}),u!==null&&(0,T.jsxs)(`div`,{className:`hq-console-composer`,children:[(0,T.jsxs)(`div`,{className:`hq-console-composer-head`,children:[(0,T.jsxs)(`span`,{children:[(0,T.jsx)(t,{size:13}),` Send to `,(0,T.jsx)(`strong`,{children:Q})]}),(0,T.jsx)(`span`,{className:`hq-pill ${Y?.controllable===!0?`active`:`error`}`,children:Y?.controllable===!0?`control live`:`read-only client`})]}),(0,T.jsxs)(`div`,{className:`hq-console-compose-row`,children:[(0,T.jsxs)(`select`,{className:`hq-select hq-console-delivery`,"aria-label":`Message delivery mode`,value:E,onChange:e=>{let t=e.target.value;D(t),v({delivery:t})},children:[(0,T.jsx)(`option`,{value:`steer`,children:`Steer now`}),(0,T.jsx)(`option`,{value:`btw`,children:`BTW / FYI`}),(0,T.jsx)(`option`,{value:`queue`,children:`Queue next`})]}),(0,T.jsx)(`input`,{className:`hq-input hq-console-subject`,"aria-label":`Message subject`,placeholder:`HQ ${E} (optional subject)`,value:k,onChange:e=>{j(e.target.value),v({subject:e.target.value})}}),(0,T.jsxs)(`button`,{type:`button`,className:`hq-btn danger hq-console-interrupt`,disabled:P||Y?.controllable!==!0,onClick:()=>{B(!1),R(!0)},children:[(0,T.jsx)(c,{size:13}),` Interrupt`]})]}),(0,T.jsxs)(`div`,{className:`hq-console-compose-row hq-console-message-row`,children:[(0,T.jsx)(`textarea`,{className:`hq-textarea hq-console-message`,"aria-label":`Message ${Q}`,placeholder:`Message ${Q}…`,rows:2,value:M,onChange:e=>{N(e.target.value),v({body:e.target.value})},onKeyDown:e=>{e.key===`Enter`&&(e.ctrlKey||e.metaKey)&&(e.preventDefault(),$())}}),(0,T.jsxs)(`button`,{type:`button`,className:`hq-btn primary hq-console-send`,disabled:P||M.trim().length===0||Y?.controllable!==!0,onClick:()=>void $(),children:[(0,T.jsx)(f,{size:13}),` `,P?`Queueing…`:`Send`]})]}),(0,T.jsxs)(`div`,{className:`hq-console-compose-foot`,children:[(0,T.jsx)(`span`,{children:`Ctrl+Enter sends · steer interrupts at the next safe turn`}),I!==null&&(0,T.jsx)(`span`,{className:`hq-console-status ${I.tone}`,children:I.text})]})]})]}),te&&Y!==null&&(0,T.jsxs)(`div`,{className:`hq-confirm-layer`,role:`presentation`,children:[(0,T.jsx)(`button`,{type:`button`,className:`hq-confirm-scrim`,"aria-label":`Cancel interrupt`,onClick:()=>R(!1)}),(0,T.jsxs)(`section`,{className:`hq-confirm-dialog`,role:`dialog`,"aria-modal":`true`,"aria-labelledby":`hq-interrupt-title`,children:[(0,T.jsx)(c,{size:22,className:`hq-confirm-danger`}),(0,T.jsxs)(`div`,{children:[(0,T.jsxs)(`h2`,{id:`hq-interrupt-title`,children:[`Interrupt `,Q,`?`]}),(0,T.jsx)(`p`,{children:`The current run will stop at its cancellation boundary.`})]}),Z&&(0,T.jsxs)(`label`,{className:`hq-confirm-check`,children:[(0,T.jsx)(`input`,{type:`checkbox`,checked:z,onChange:e=>B(e.target.checked)}),`Also interrupt every subagent on this client`]}),(0,T.jsxs)(`div`,{className:`hq-confirm-actions`,children:[(0,T.jsx)(`button`,{type:`button`,className:`hq-btn secondary`,onClick:()=>R(!1),children:`Cancel`}),(0,T.jsxs)(`button`,{type:`button`,className:`hq-btn danger`,disabled:P,onClick:()=>void ne(),children:[(0,T.jsx)(c,{size:13}),` Confirm interrupt`]})]})]})]})]})}export{j as LiveConsoleView};
@@ -1 +0,0 @@
1
- import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{C as t,Lt as n,R as r,f as i,mt as a,p as o,q as s,z as c}from"./icons-BV2PcvP1.js";import{i as l}from"./markdown-HUVrfVaI.js";import{d as u,u as d}from"./index-DwX1O_JZ.js";var f=e(n(),1),p=l();async function m(e){let t=e.statusText||`HTTP ${e.status}`;try{let n=await e.json();return typeof n.error==`string`?n.error:n.error?.message??t}catch{return t}}function h(){let[e,n]=(0,f.useState)(null),[l,h]=(0,f.useState)(``),[g,_]=(0,f.useState)(``),[v,y]=(0,f.useState)(``),[b,x]=(0,f.useState)(!1),[S,C]=(0,f.useState)(null),[w,T]=(0,f.useState)(!1),E=async()=>{let e=await d(`/api/auth/status`);if(!e.ok)throw Error(await m(e));n(await e.json())};(0,f.useEffect)(()=>{E().catch(e=>{C({tone:`error`,text:e instanceof Error?e.message:String(e)})})},[]);let D=e?.passwordMode===!0&&e.authKind===`password`,O=g.length>=8&&g.length<=1024,k=g===v,A=O&&k&&(!D||l.length>0)&&!b,j=async()=>{if(A){x(!0),C(null);try{let t=await d(`/api/auth/password`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({...D?{currentPassword:l}:{},newPassword:g})});if(!t.ok)throw Error(await m(t));n(await t.json()),h(``),_(``),y(``),C({tone:`ok`,text:e?.passwordMode?`Password changed.`:`Password enabled.`})}catch(e){C({tone:`error`,text:e instanceof Error?e.message:String(e)})}finally{x(!1)}}},M=async()=>{x(!0),C(null);try{let e=await d(`/api/auth/password`,{method:`DELETE`,headers:{"Content-Type":`application/json`},body:JSON.stringify({...D?{currentPassword:l}:{}})});if(!e.ok)throw Error(await m(e));n(await e.json()),h(``),T(!1),C({tone:`ok`,text:`Password protection removed.`})}catch(e){C({tone:`error`,text:e instanceof Error?e.message:String(e)})}finally{x(!1)}},N=async()=>{x(!0);try{await d(`/api/logout`,{method:`POST`})}finally{u(),window.location.reload()}},P=async()=>{if(!(!e?.publicOrigin||!e.passwordMode))try{await navigator.clipboard.writeText(e.publicOrigin),C({tone:`ok`,text:`Public tunnel URL copied.`})}catch{C({tone:`error`,text:`Could not copy the public tunnel URL.`})}};return(0,p.jsxs)(`div`,{className:`hq-security-page`,children:[(0,p.jsxs)(`section`,{className:`hq-security-summary`,"aria-label":`Authentication status`,children:[(0,p.jsxs)(`div`,{className:`hq-security-card`,children:[(0,p.jsx)(o,{size:18}),(0,p.jsx)(`span`,{children:`Browser access`}),(0,p.jsx)(`strong`,{children:e?.loggedIn?`Authenticated`:`Checking…`})]}),(0,p.jsxs)(`div`,{className:`hq-security-card`,children:[(0,p.jsx)(s,{size:18}),(0,p.jsx)(`span`,{children:`Browser tokens`}),(0,p.jsx)(`strong`,{children:e?.tokenMode?`Enabled`:`Disabled`})]}),(0,p.jsxs)(`div`,{className:`hq-security-card`,children:[(0,p.jsx)(c,{size:18}),(0,p.jsx)(`span`,{children:`Password login`}),(0,p.jsx)(`strong`,{children:e?.passwordMode?`Enabled`:`Disabled`})]}),(0,p.jsxs)(`div`,{className:`hq-security-card`,children:[(0,p.jsx)(t,{size:18}),(0,p.jsx)(`span`,{children:`Public tunnel`}),(0,p.jsx)(`strong`,{children:e?.publicRelay?`Active`:`Disabled`}),e?.publicOrigin&&e.passwordMode?(0,p.jsxs)(`button`,{type:`button`,className:`hq-security-copy`,"aria-label":`Copy public tunnel URL`,title:e.publicOrigin,onClick:()=>void P(),children:[(0,p.jsx)(a,{size:12}),`Copy URL`]}):null]})]}),(0,p.jsxs)(`section`,{className:`hq-security-panel`,children:[(0,p.jsxs)(`div`,{className:`hq-security-panel-head`,children:[(0,p.jsxs)(`div`,{children:[(0,p.jsx)(`span`,{children:`Browser credential`}),(0,p.jsx)(`h2`,{children:e?.passwordMode?`Change HQ password`:`Enable HQ password`}),(0,p.jsx)(`p`,{children:`Passwords are stored as salted scrypt hashes. Changing the password invalidates older password sessions.`})]}),(0,p.jsx)(c,{size:22})]}),S?(0,p.jsx)(`div`,{className:`hq-security-message`,"data-tone":S.tone,role:`status`,children:S.text}):null,(0,p.jsxs)(`div`,{className:`hq-security-form`,children:[D?(0,p.jsxs)(`label`,{children:[(0,p.jsx)(`span`,{children:`Current password`}),(0,p.jsx)(`input`,{type:`password`,autoComplete:`current-password`,value:l,onChange:e=>h(e.target.value)})]}):null,(0,p.jsxs)(`label`,{children:[(0,p.jsx)(`span`,{children:`New password`}),(0,p.jsx)(`input`,{type:`password`,autoComplete:`new-password`,minLength:8,maxLength:1024,value:g,onChange:e=>_(e.target.value)}),(0,p.jsx)(`small`,{children:`Minimum 8 characters.`})]}),(0,p.jsxs)(`label`,{children:[(0,p.jsx)(`span`,{children:`Confirm new password`}),(0,p.jsx)(`input`,{type:`password`,autoComplete:`new-password`,minLength:8,maxLength:1024,value:v,onChange:e=>y(e.target.value),onKeyDown:e=>{e.key===`Enter`&&j()}}),v&&!k?(0,p.jsx)(`small`,{"data-error":!0,children:`Passwords do not match.`}):null]}),(0,p.jsx)(`div`,{className:`hq-security-actions`,children:(0,p.jsxs)(`button`,{type:`button`,className:`hq-btn`,disabled:!A,onClick:()=>void j(),children:[(0,p.jsx)(o,{size:14}),b?`Saving…`:e?.passwordMode?`Change password`:`Enable password`]})})]})]}),(0,p.jsxs)(`section`,{className:`hq-security-panel danger-zone`,children:[(0,p.jsxs)(`div`,{className:`hq-security-panel-head`,children:[(0,p.jsxs)(`div`,{children:[(0,p.jsx)(`span`,{children:`Session and recovery`}),(0,p.jsx)(`h2`,{children:`Access controls`}),(0,p.jsx)(`p`,{children:`Browser tokens remain available as a recovery path. Public tunnel mode will refuse to remove the last browser authentication method.`})]}),(0,p.jsx)(i,{size:22})]}),(0,p.jsxs)(`div`,{className:`hq-security-actions split`,children:[(0,p.jsxs)(`button`,{type:`button`,className:`hq-btn secondary`,disabled:b,onClick:()=>void N(),children:[(0,p.jsx)(r,{size:14}),`Log out this browser`]}),e?.passwordMode?w?(0,p.jsxs)(`div`,{className:`hq-security-confirm-remove`,children:[(0,p.jsx)(`span`,{children:`Remove password protection?`}),(0,p.jsx)(`button`,{type:`button`,className:`hq-btn secondary`,disabled:b,onClick:()=>T(!1),children:`Cancel`}),(0,p.jsx)(`button`,{type:`button`,className:`hq-btn danger`,disabled:b||D&&!l,onClick:()=>void M(),children:`Remove password`})]}):(0,p.jsxs)(`button`,{type:`button`,className:`hq-btn danger`,disabled:b,onClick:()=>T(!0),children:[(0,p.jsx)(i,{size:14}),`Remove password`]}):null]})]})]})}export{h as SettingsView};
@@ -1 +0,0 @@
1
- import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{Lt as t}from"./icons-BV2PcvP1.js";import{l as n,o as r}from"./index-DwX1O_JZ.js";var i=e(t(),1);function a(e,t=200){let a=n(e=>e.events),[o,s]=(0,i.useState)([]),[c,l]=(0,i.useState)(!0);return(0,i.useEffect)(()=>{let n=!1;return r(`/api/events?type=${encodeURIComponent(e)}&limit=${t}`).then(e=>{n||(s([...e.events??[]].reverse()),l(!1))}).catch(()=>{n||l(!1)}),()=>{n=!0}},[e,t]),{events:(0,i.useMemo)(()=>{let t=new Set,n=[];for(let r of o)r.type!==e||t.has(r.id)||(t.add(r.id),n.push(r));for(let r of a)r.type!==e||t.has(r.id)||(t.add(r.id),n.push(r));return n},[o,a,e]),loading:c}}export{a as t};
@@ -1 +0,0 @@
1
- import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{D as t,Lt as n,c as r,kt as i,l as a,tt as o,yt as s}from"./icons-BV2PcvP1.js";import{i as c}from"./markdown-HUVrfVaI.js";import{t as l}from"./use-backfilled-events-ceR5R8_K.js";var u=e(n(),1),d=c(),f={allocated:{Icon:t,cls:`info`},committed:{Icon:i,cls:`active`},merged:{Icon:o,cls:`active`},conflict:{Icon:r,cls:`warn`},released:{Icon:a,cls:`idle`},failed:{Icon:s,cls:`error`}};function p({e}){let n=e.payload,r=f[n.kind]??{Icon:t,cls:`info`};return(0,d.jsxs)(`div`,{className:`hq-row hq-worktree-event-line`,children:[(0,d.jsx)(r.Icon,{size:14,className:`hq-kind-icon ${r.cls}`}),(0,d.jsx)(`span`,{className:`hq-text-bright`,children:n.kind}),n.branch!==void 0&&(0,d.jsx)(`span`,{className:`hq-pill info`,children:n.branch}),n.kind===`committed`&&(0,d.jsxs)(`span`,{className:`hq-mono hq-diffstat`,children:[(0,d.jsxs)(`span`,{className:`hq-diff-add-count`,children:[`+`,n.insertions??0]}),` `,(0,d.jsxs)(`span`,{className:`hq-diff-del-count`,children:[`−`,n.deletions??0]}),` in `,n.files??0,` file(s)`,` `,n.sha===void 0?``:`(${n.sha.slice(0,7)})`]}),n.kind===`conflict`&&n.conflictFiles!==void 0&&(0,d.jsxs)(`span`,{className:`hq-mono hq-row-error`,children:[`conflicts: `,n.conflictFiles.join(`, `)]}),n.kind===`failed`&&(0,d.jsx)(`span`,{className:`hq-mono hq-row-error`,children:n.error}),(0,d.jsx)(`span`,{className:`hq-mono hq-row-time`,children:new Date(e.timestamp).toLocaleTimeString()})]})}function m(){let{events:e,loading:n}=l(`worktree.event`,300),r=(0,u.useMemo)(()=>{let t=new Map;for(let n of e){let e=n.payload.ownerId??`(unknown)`,r=t.get(e)??[];r.push(n),t.set(e,r)}return Array.from(t.entries()).reverse()},[e]),i=(0,u.useMemo)(()=>{let e=0,t=0,n=0,i=0;for(let[,a]of r){let r=a.at(-1)?.payload;r?.kind===`merged`||r?.kind===`released`?t+=1:e+=1,a.some(e=>e.payload.kind===`conflict`)&&(n+=1),a.some(e=>e.payload.kind===`failed`)&&(i+=1)}return{open:e,merged:t,conflicts:n,failed:i}},[r]);return r.length===0?(0,d.jsx)(`div`,{className:`hq-empty hq-empty-ornate`,children:n?`Loading worktree history…`:`No worktree events yet. These appear when Goal allocates or merges git worktrees for parallel phases.`}):(0,d.jsxs)(`div`,{className:`hq-screen hq-worktree-screen`,children:[(0,d.jsxs)(`section`,{className:`hq-screen-hero hq-worktree-hero`,"aria-label":`Worktree lifecycle summary`,children:[(0,d.jsxs)(`div`,{children:[(0,d.jsx)(`span`,{className:`hq-section-kicker`,children:`Workspace lanes`}),(0,d.jsx)(`h2`,{children:`Parallel branch lifecycle`}),(0,d.jsx)(`p`,{children:`Each owner gets a lane so allocation, commits, conflicts, merges and release events read as an ordered build path.`})]}),(0,d.jsxs)(`div`,{className:`hq-hero-metrics`,children:[(0,d.jsx)(h,{label:`lanes`,value:r.length}),(0,d.jsx)(h,{label:`open`,value:i.open,tone:i.open>0?`warn`:`ok`}),(0,d.jsx)(h,{label:`merged/released`,value:i.merged,tone:`ok`}),(0,d.jsx)(h,{label:`conflicts`,value:i.conflicts+i.failed,tone:i.conflicts+i.failed>0?`error`:`ok`})]})]}),(0,d.jsx)(`div`,{className:`hq-worktree-lanes`,children:r.map(([e,n])=>{let r=n[n.length-1].payload,i=f[r.kind]??{Icon:t,cls:`info`};return(0,d.jsxs)(`article`,{className:`hq-card hq-worktree-lane`,children:[(0,d.jsxs)(`div`,{className:`hq-row hq-lane-head`,children:[(0,d.jsx)(`span`,{className:`hq-mono hq-text-bright`,children:e}),(0,d.jsx)(`span`,{className:`hq-pill ${i.cls}`,children:r.kind}),(0,d.jsxs)(`span`,{className:`hq-mono hq-row-time`,children:[n.length,` events`]})]}),(0,d.jsx)(`div`,{className:`hq-worktree-event-list`,children:n.map(e=>(0,d.jsx)(p,{e},e.id))})]},e)})})]})}function h({label:e,value:t,tone:n}){return(0,d.jsxs)(`div`,{className:`hq-hero-metric`,"data-tone":n,children:[(0,d.jsx)(`strong`,{children:t}),(0,d.jsx)(`span`,{children:e})]})}export{m as WorktreeView};