loki-mode 6.45.0 → 6.45.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.
- package/SKILL.md +2 -2
- package/VERSION +1 -1
- package/dashboard/__init__.py +1 -1
- package/docs/INSTALLATION.md +1 -1
- package/mcp/__init__.py +1 -1
- package/package.json +1 -1
- package/web-app/dist/assets/{Badge-D1-tb3Ci.js → Badge-ClncXa1x.js} +1 -1
- package/web-app/dist/assets/{Button-DUExR4iB.js → Button-CUOgrX10.js} +1 -1
- package/web-app/dist/assets/{Card-LXXTWpme.js → Card-2UWDXe0P.js} +1 -1
- package/web-app/dist/assets/{HomePage-C3QLIWSC.js → HomePage-C4WxoEKI.js} +1 -1
- package/web-app/dist/assets/{ProjectPage-CkFeNhXf.js → ProjectPage-Dy7ONtf_.js} +13 -13
- package/web-app/dist/assets/ProjectsPage-CIDkRHyZ.js +6 -0
- package/web-app/dist/assets/{SettingsPage-BwpQIkqM.js → SettingsPage-5AxjoTTg.js} +1 -1
- package/web-app/dist/assets/{TemplatesPage-D5h6cG1N.js → TemplatesPage-DPlaAtAk.js} +1 -1
- package/web-app/dist/assets/{TerminalOutput-CnXPLmFM.js → TerminalOutput-Do2PhilR.js} +1 -1
- package/web-app/dist/assets/{clock-DRfchEI9.js → clock-DpWpY1Zx.js} +1 -1
- package/web-app/dist/assets/{external-link-CS_9f84I.js → external-link-KmF9dPsz.js} +1 -1
- package/web-app/dist/assets/{index-HocOQZ9L.js → index-ACgjqVp2.js} +2 -2
- package/web-app/dist/index.html +1 -1
- package/web-app/server.py +26 -2
- package/web-app/dist/assets/ProjectsPage-CzyuQptX.js +0 -6
package/SKILL.md
CHANGED
|
@@ -3,7 +3,7 @@ name: loki-mode
|
|
|
3
3
|
description: Multi-agent autonomous startup system. Triggers on "Loki Mode". Takes PRD to deployed product with minimal human intervention. Requires --dangerously-skip-permissions flag.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
|
-
# Loki Mode v6.45.
|
|
6
|
+
# Loki Mode v6.45.1
|
|
7
7
|
|
|
8
8
|
**You are an autonomous agent. You make decisions. You do not ask questions. You do not stop.**
|
|
9
9
|
|
|
@@ -267,4 +267,4 @@ The following features are documented in skill modules but not yet fully automat
|
|
|
267
267
|
| Quality gates 3-reviewer system | Implemented (v5.35.0) | 5 specialist reviewers in `skills/quality-gates.md`; execution in run.sh |
|
|
268
268
|
| Benchmarks (HumanEval, SWE-bench) | Infrastructure only | Runner scripts and datasets exist in `benchmarks/`; no published results |
|
|
269
269
|
|
|
270
|
-
**v6.45.
|
|
270
|
+
**v6.45.1 | [Autonomi](https://www.autonomi.dev/) flagship product | ~260 lines core**
|
package/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
6.45.
|
|
1
|
+
6.45.1
|
package/dashboard/__init__.py
CHANGED
package/docs/INSTALLATION.md
CHANGED
package/mcp/__init__.py
CHANGED
package/package.json
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{c as m,r,j as e}from"./index-
|
|
1
|
+
import{c as m,r,j as e}from"./index-ACgjqVp2.js";import{C as g,a as p}from"./clock-DpWpY1Zx.js";/**
|
|
2
2
|
* @license lucide-react v0.577.0 - ISC
|
|
3
3
|
*
|
|
4
4
|
* This source code is licensed under the ISC license.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as s}from"./index-
|
|
1
|
+
import{j as s}from"./index-ACgjqVp2.js";const n={none:"p-0",sm:"p-3",md:"p-4",lg:"p-6"};function p({hover:e=!1,padding:d="md",className:t="",children:a,onClick:r}){return s.jsx("div",{role:r?"button":void 0,tabIndex:r?0:void 0,onClick:r,onKeyDown:r?o=>{(o.key==="Enter"||o.key===" ")&&(o.preventDefault(),r())}:void 0,className:["bg-white border border-[#ECEAE3] rounded-[5px] shadow-card",e&&"hover:shadow-card-hover transition-shadow duration-200",r&&"cursor-pointer",n[d],t].filter(Boolean).join(" "),children:a})}export{p as C};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{j as e,r as n,a as h,u as be,b as ge}from"./index-
|
|
1
|
+
import{j as e,r as n,a as h,u as be,b as ge}from"./index-ACgjqVp2.js";import{u as I,B as je}from"./Badge-ClncXa1x.js";import{P as ve,a as Ne,S as ye,E,T as we}from"./TerminalOutput-Do2PhilR.js";import"./clock-DpWpY1Zx.js";function ke(t){if(t<60)return`${Math.round(t)}s`;if(t<3600)return`${Math.floor(t/60)}m ${Math.round(t%60)}s`;const s=Math.floor(t/3600),l=Math.floor(t%3600/60);return`${s}h ${l}m`}function Se(t,s){if(!t||t<=0)return"--";const l={simple:{opus:1,haiku:1,total:3},standard:{opus:2,haiku:2,total:5},complex:{opus:3,haiku:3,total:8}},r=l[s]||l.standard;return t<=r.opus?"Opus":t>r.total-r.haiku?"Haiku":"Sonnet"}function Ce({status:t,prdSummary:s,onStop:l,onPause:r,onResume:a,isPaused:c}){const i=t?Se(t.iteration??0,t.complexity||"standard"):"--",o=c??(t==null?void 0:t.paused)??!1;return e.jsxs("div",{className:"card px-5 py-3 flex items-center gap-6 text-sm",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-xs text-muted uppercase tracking-wider font-medium",children:"Phase"}),e.jsx("span",{className:"font-mono font-semibold text-ink",children:(t==null?void 0:t.phase)||"idle"})]}),e.jsx("div",{className:"w-px h-5 bg-border"}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-xs text-muted uppercase tracking-wider font-medium",children:"Complexity"}),e.jsx("span",{className:`font-mono font-semibold ${(t==null?void 0:t.complexity)==="complex"?"text-warning":(t==null?void 0:t.complexity)==="simple"?"text-success":"text-ink"}`,children:(t==null?void 0:t.complexity)||"standard"})]}),e.jsx("div",{className:"w-px h-5 bg-border"}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-xs text-muted uppercase tracking-wider font-medium",children:"Model"}),e.jsx("span",{className:`font-mono font-semibold px-2 py-0.5 rounded-md text-xs ${i==="Opus"?"bg-primary/10 text-primary":i==="Haiku"?"bg-success/10 text-success":"bg-primary/10 text-primary"}`,children:i})]}),e.jsx("div",{className:"w-px h-5 bg-border"}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-xs text-muted uppercase tracking-wider font-medium",children:"Tasks"}),e.jsx("span",{className:"font-mono text-ink",children:t!=null&&t.current_task?e.jsx("span",{className:"text-xs",children:t.current_task}):e.jsx("span",{className:"text-muted",children:"--"})}),((t==null?void 0:t.pending_tasks)??0)>0&&e.jsxs("span",{className:"text-xs text-primary font-mono",children:["+",t==null?void 0:t.pending_tasks," pending"]})]}),s&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"w-px h-5 bg-border"}),e.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[e.jsx("span",{className:"text-xs text-muted uppercase tracking-wider font-medium flex-shrink-0",children:"Building"}),e.jsx("span",{className:"text-xs font-mono text-ink truncate max-w-[220px]",title:s,children:s.length>60?s.slice(0,60)+"...":s})]})]}),e.jsx("div",{className:"flex-1"}),((t==null?void 0:t.uptime)??0)>0&&e.jsx("span",{className:"font-mono text-xs text-muted",children:ke((t==null?void 0:t.uptime)??0)}),(r||a)&&e.jsxs("button",{onClick:o?a:r,className:"flex items-center gap-1.5 px-4 py-1.5 rounded-btn text-xs font-semibold border border-warning/30 text-warning hover:bg-warning/10 transition-colors",children:[o?e.jsx(ve,{size:14}):e.jsx(Ne,{size:14}),o?"Resume":"Pause"]}),l&&e.jsxs("button",{onClick:l,className:"flex items-center gap-1.5 px-4 py-1.5 rounded-btn text-xs font-semibold bg-danger/10 text-danger border border-danger/20 hover:bg-danger/20 transition-colors",children:[e.jsx(ye,{size:14}),"Stop"]})]})}function Ee({status:t}){const s=[{label:"Iteration",value:t?t.iteration.toString():"--",color:"text-primary"},{label:"Agents",value:t?t.running_agents.toString():"--",color:t&&t.running_agents>0?"text-success":"text-muted"},{label:"Pending",value:t?t.pending_tasks.toString():"--",color:t&&t.pending_tasks>0?"text-warning":"text-muted"},{label:"Provider",value:(t==null?void 0:t.provider)||"--",color:"text-primary"}];return e.jsx("div",{className:"grid grid-cols-4 gap-3",children:s.map(l=>e.jsxs("div",{className:"card p-4 text-center",children:[e.jsx("div",{className:`text-2xl font-bold font-mono ${l.color}`,children:l.value}),e.jsx("div",{className:"text-xs text-muted font-medium mt-1 uppercase tracking-wider",children:l.label})]},l.label))})}function Pe({plan:t,loading:s,onConfirm:l,onCancel:r}){return e.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/30 backdrop-blur-sm",children:e.jsxs("div",{className:"card w-full max-w-lg mx-4 p-6 rounded-card shadow-card-hover",children:[e.jsx("h2",{className:"text-lg font-bold text-ink mb-4",children:"Build Estimate"}),s?e.jsxs("div",{className:"flex flex-col items-center py-8 gap-3",children:[e.jsx("div",{className:"w-8 h-8 border-2 border-primary border-t-transparent rounded-full animate-spin"}),e.jsx("p",{className:"text-sm text-muted",children:"Analyzing PRD..."}),e.jsxs("div",{className:"flex gap-3 mt-4",children:[e.jsx("button",{onClick:r,className:"px-4 py-2 text-sm font-medium text-muted hover:text-ink transition-colors",children:"Cancel"}),e.jsx("button",{onClick:l,className:"px-4 py-2 text-sm font-medium text-primary hover:text-primary/80 transition-colors underline",children:"Skip analysis, build now"})]})]}):t?e.jsxs(e.Fragment,{children:[t.returncode!==0&&e.jsxs("div",{className:"mb-4 px-3 py-2 rounded-btn bg-warning/10 border border-warning/20 text-warning text-xs",children:["loki plan exited with code ",t.returncode," - showing partial results"]}),e.jsxs("div",{className:"grid grid-cols-2 gap-3 mb-4",children:[e.jsxs("div",{className:"card rounded-card p-3",children:[e.jsx("div",{className:"text-xs font-semibold text-muted-accessible uppercase tracking-wider mb-1",children:"Complexity"}),e.jsx("div",{className:"text-base font-bold text-ink capitalize",children:t.complexity})]}),e.jsxs("div",{className:"card rounded-card p-3",children:[e.jsx("div",{className:"text-xs font-semibold text-muted-accessible uppercase tracking-wider mb-1",children:"Est. Cost"}),e.jsx("div",{className:"text-base font-bold text-ink",children:t.cost_estimate})]}),e.jsxs("div",{className:"card rounded-card p-3",children:[e.jsx("div",{className:"text-xs font-semibold text-muted-accessible uppercase tracking-wider mb-1",children:"Iterations"}),e.jsx("div",{className:"text-base font-bold text-ink",children:t.iterations})]}),e.jsxs("div",{className:"card rounded-card p-3",children:[e.jsx("div",{className:"text-xs font-semibold text-muted-accessible uppercase tracking-wider mb-1",children:"Phases"}),e.jsx("div",{className:"text-xs text-ink capitalize",children:t.phases.join(", ")})]})]}),t.output_text&&e.jsxs("details",{className:"mb-4",children:[e.jsx("summary",{className:"text-xs text-muted cursor-pointer hover:text-ink transition-colors",children:"Raw output"}),e.jsx("pre",{className:"mt-2 text-xs font-mono text-muted-accessible bg-black/5 rounded-card p-3 overflow-auto max-h-40 whitespace-pre-wrap",children:t.output_text})]}),e.jsxs("div",{className:"flex gap-3 justify-end",children:[e.jsx("button",{onClick:r,className:"px-4 py-2 text-sm font-medium text-muted hover:text-ink transition-colors",children:"Cancel"}),e.jsx("button",{onClick:l,className:"px-5 py-2 rounded-card text-sm font-semibold bg-primary text-white hover:bg-primary/90 transition-all shadow-button",children:"Start Build"})]})]}):e.jsx("div",{className:"text-sm text-muted py-4",children:"No plan data available."})]})})}function _e({onSubmit:t,running:s,error:l,provider:r,onProviderChange:a,initialPrd:c}){const[i,o]=n.useState(""),[m,b]=n.useState(""),[f,y]=n.useState("claude"),[d,g]=n.useState(""),j=r??f,[v,w]=n.useState(!1),[k,T]=n.useState([]),[x,P]=n.useState(!1),[N,M]=n.useState(!1),[_,A]=n.useState(!1),[z,F]=n.useState(null),[L,$]=n.useState(!1),[O,D]=n.useState(!1);n.useEffect(()=>{h.getTemplates().then(u=>{T(u),P(!1)}).catch(()=>{T([]),P(!0)})},[]),n.useEffect(()=>{c&&o(c)},[c]),n.useEffect(()=>{if(c)return;const u=localStorage.getItem("loki-prd-draft");u&&o(u),h.getPrdPrefill().then(({content:S})=>{S&&o(S)}).catch(()=>{})},[c]),n.useEffect(()=>{i.trim()?localStorage.setItem("loki-prd-draft",i):localStorage.removeItem("loki-prd-draft")},[i]),n.useEffect(()=>{const u=S=>{i.trim()&&S.preventDefault()};return window.addEventListener("beforeunload",u),()=>window.removeEventListener("beforeunload",u)},[i]);const R=n.useCallback(async(u,S)=>{b(S),w(!1);try{const G=await h.getTemplateContent(u);o(G.content)}catch{o(`# ${S}
|
|
2
2
|
|
|
3
3
|
## Overview
|
|
4
4
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var Mt=e=>{throw TypeError(e)};var Et=(e,t,n)=>t.has(e)||Mt("Cannot "+n);var Re=(e,t,n)=>(Et(e,t,"read from private field"),n?n.call(e):t.get(e)),Rt=(e,t,n)=>t.has(e)?Mt("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),Lt=(e,t,n,r)=>(Et(e,t,"write to private field"),r?r.call(e,n):t.set(e,n),n);import{c as _,r as d,W as ke,j as a,a as
|
|
1
|
+
var Mt=e=>{throw TypeError(e)};var Et=(e,t,n)=>t.has(e)||Mt("Cannot "+n);var Re=(e,t,n)=>(Et(e,t,"read from private field"),n?n.call(e):t.get(e)),Rt=(e,t,n)=>t.has(e)?Mt("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),Lt=(e,t,n,r)=>(Et(e,t,"write to private field"),r?r.call(e,n):t.set(e,n),n);import{c as _,r as d,W as ke,j as a,a as U,B as Ot,S as Xn,d as Yn,u as Qn}from"./index-ACgjqVp2.js";import{T as Zn,P as Dt,a as Jn,S as er,E as tr}from"./TerminalOutput-Do2PhilR.js";import{B as Le,P as nr}from"./Button-CUOgrX10.js";import{C as rr,a as ar}from"./clock-DpWpY1Zx.js";import{E as sr}from"./external-link-KmF9dPsz.js";/**
|
|
2
2
|
* @license lucide-react v0.577.0 - ISC
|
|
3
3
|
*
|
|
4
4
|
* This source code is licensed under the ISC license.
|
|
@@ -38,7 +38,7 @@ var Mt=e=>{throw TypeError(e)};var Et=(e,t,n)=>t.has(e)||Mt("Cannot "+n);var Re=
|
|
|
38
38
|
*
|
|
39
39
|
* This source code is licensed under the ISC license.
|
|
40
40
|
* See the LICENSE file in the root directory of this source tree.
|
|
41
|
-
*/const yr=[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],
|
|
41
|
+
*/const yr=[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],Oe=_("eye",yr);/**
|
|
42
42
|
* @license lucide-react v0.577.0 - ISC
|
|
43
43
|
*
|
|
44
44
|
* This source code is licensed under the ISC license.
|
|
@@ -63,7 +63,7 @@ var Mt=e=>{throw TypeError(e)};var Et=(e,t,n)=>t.has(e)||Mt("Cannot "+n);var Re=
|
|
|
63
63
|
*
|
|
64
64
|
* This source code is licensed under the ISC license.
|
|
65
65
|
* See the LICENSE file in the root directory of this source tree.
|
|
66
|
-
*/const Pr=[["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"}]],
|
|
66
|
+
*/const Pr=[["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"}]],an=_("file-text",Pr);/**
|
|
67
67
|
* @license lucide-react v0.577.0 - ISC
|
|
68
68
|
*
|
|
69
69
|
* This source code is licensed under the ISC license.
|
|
@@ -78,7 +78,7 @@ var Mt=e=>{throw TypeError(e)};var Et=(e,t,n)=>t.has(e)||Mt("Cannot "+n);var Re=
|
|
|
78
78
|
*
|
|
79
79
|
* This source code is licensed under the ISC license.
|
|
80
80
|
* See the LICENSE file in the root directory of this source tree.
|
|
81
|
-
*/const Or=[["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"}]],
|
|
81
|
+
*/const Or=[["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"}]],sn=_("folder-open",Or);/**
|
|
82
82
|
* @license lucide-react v0.577.0 - ISC
|
|
83
83
|
*
|
|
84
84
|
* This source code is licensed under the ISC license.
|
|
@@ -93,7 +93,7 @@ var Mt=e=>{throw TypeError(e)};var Et=(e,t,n)=>t.has(e)||Mt("Cannot "+n);var Re=
|
|
|
93
93
|
*
|
|
94
94
|
* This source code is licensed under the ISC license.
|
|
95
95
|
* See the LICENSE file in the root directory of this source tree.
|
|
96
|
-
*/const
|
|
96
|
+
*/const Fr=[["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"}]],Ar=_("key-round",Fr);/**
|
|
97
97
|
* @license lucide-react v0.577.0 - ISC
|
|
98
98
|
*
|
|
99
99
|
* This source code is licensed under the ISC license.
|
|
@@ -108,12 +108,12 @@ var Mt=e=>{throw TypeError(e)};var Et=(e,t,n)=>t.has(e)||Mt("Cannot "+n);var Re=
|
|
|
108
108
|
*
|
|
109
109
|
* This source code is licensed under the ISC license.
|
|
110
110
|
* See the LICENSE file in the root directory of this source tree.
|
|
111
|
-
*/const qr=[["path",{d:"M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8",key:"1p45f6"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}]],
|
|
111
|
+
*/const qr=[["path",{d:"M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8",key:"1p45f6"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}]],Ur=_("rotate-cw",qr);/**
|
|
112
112
|
* @license lucide-react v0.577.0 - ISC
|
|
113
113
|
*
|
|
114
114
|
* This source code is licensed under the ISC license.
|
|
115
115
|
* See the LICENSE file in the root directory of this source tree.
|
|
116
|
-
*/const
|
|
116
|
+
*/const Wr=[["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"}]],Gr=_("send",Wr);/**
|
|
117
117
|
* @license lucide-react v0.577.0 - ISC
|
|
118
118
|
*
|
|
119
119
|
* This source code is licensed under the ISC license.
|
|
@@ -128,7 +128,7 @@ var Mt=e=>{throw TypeError(e)};var Et=(e,t,n)=>t.has(e)||Mt("Cannot "+n);var Re=
|
|
|
128
128
|
*
|
|
129
129
|
* This source code is licensed under the ISC license.
|
|
130
130
|
* See the LICENSE file in the root directory of this source tree.
|
|
131
|
-
*/const Zr=[["path",{d:"M12 19h8",key:"baeox8"}],["path",{d:"m4 17 6-6-6-6",key:"1yngyt"}]],
|
|
131
|
+
*/const Zr=[["path",{d:"M12 19h8",key:"baeox8"}],["path",{d:"m4 17 6-6-6-6",key:"1yngyt"}]],on=_("terminal",Zr);/**
|
|
132
132
|
* @license lucide-react v0.577.0 - ISC
|
|
133
133
|
*
|
|
134
134
|
* This source code is licensed under the ISC license.
|
|
@@ -138,7 +138,7 @@ var Mt=e=>{throw TypeError(e)};var Et=(e,t,n)=>t.has(e)||Mt("Cannot "+n);var Re=
|
|
|
138
138
|
*
|
|
139
139
|
* This source code is licensed under the ISC license.
|
|
140
140
|
* See the LICENSE file in the root directory of this source tree.
|
|
141
|
-
*/const ea=[["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"}]],
|
|
141
|
+
*/const ea=[["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"}]],ln=_("trash-2",ea);/**
|
|
142
142
|
* @license lucide-react v0.577.0 - ISC
|
|
143
143
|
*
|
|
144
144
|
* This source code is licensed under the ISC license.
|
|
@@ -148,8 +148,8 @@ var Mt=e=>{throw TypeError(e)};var Et=(e,t,n)=>t.has(e)||Mt("Cannot "+n);var Re=
|
|
|
148
148
|
*
|
|
149
149
|
* This source code is licensed under the ISC license.
|
|
150
150
|
* See the LICENSE file in the root directory of this source tree.
|
|
151
|
-
*/const ra=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],Qe=_("x",ra);function
|
|
152
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function
|
|
151
|
+
*/const ra=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],Qe=_("x",ra);function $t(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function aa(e){if(Array.isArray(e))return e}function sa(e,t,n){return(t=fa(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function oa(e,t){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var r,s,o,f,i=[],l=!0,c=!1;try{if(o=(n=n.call(e)).next,t!==0)for(;!(l=(r=o.call(n)).done)&&(i.push(r.value),i.length!==t);l=!0);}catch(p){c=!0,s=p}finally{try{if(!l&&n.return!=null&&(f=n.return(),Object(f)!==f))return}finally{if(c)throw s}}return i}}function ia(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
152
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function It(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),n.push.apply(n,r)}return n}function Tt(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?It(Object(n),!0).forEach(function(r){sa(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):It(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function la(e,t){if(e==null)return{};var n,r,s=ca(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(s[n]=e[n])}return s}function ca(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}function da(e,t){return aa(e)||oa(e,t)||pa(e,t)||ia()}function ua(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function fa(e){var t=ua(e,"string");return typeof t=="symbol"?t:t+""}function pa(e,t){if(e){if(typeof e=="string")return $t(e,t);var n={}.toString.call(e).slice(8,-1);return n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set"?Array.from(e):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?$t(e,t):void 0}}function ma(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Ft(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),n.push.apply(n,r)}return n}function At(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Ft(Object(n),!0).forEach(function(r){ma(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Ft(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function ha(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return function(r){return t.reduceRight(function(s,o){return o(s)},r)}}function De(e){return function t(){for(var n=this,r=arguments.length,s=new Array(r),o=0;o<r;o++)s[o]=arguments[o];return s.length>=e.length?e.apply(this,s):function(){for(var f=arguments.length,i=new Array(f),l=0;l<f;l++)i[l]=arguments[l];return t.apply(n,[].concat(s,i))}}}function Ze(e){return{}.toString.call(e).includes("Object")}function xa(e){return!Object.keys(e).length}function Ae(e){return typeof e=="function"}function ga(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function ba(e,t){return Ze(t)||ce("changeType"),Object.keys(t).some(function(n){return!ga(e,n)})&&ce("changeField"),t}function va(e){Ae(e)||ce("selectorType")}function ya(e){Ae(e)||Ze(e)||ce("handlerType"),Ze(e)&&Object.values(e).some(function(t){return!Ae(t)})&&ce("handlersType")}function wa(e){e||ce("initialIsRequired"),Ze(e)||ce("initialType"),xa(e)&&ce("initialContent")}function ja(e,t){throw new Error(e[t]||e.default)}var ka={initialIsRequired:"initial state is required",initialType:"initial state should be an object",initialContent:"initial state shouldn't be an empty object",handlerType:"handler should be an object or a function",handlersType:"all handlers should be a functions",selectorType:"selector should be a function",changeType:"provided value of changes should be an object",changeField:'it seams you want to change a field in the state which is not specified in the "initial" state',default:"an unknown error accured in `state-local` package"},ce=De(ja)(ka),We={changes:ba,selector:va,handler:ya,initial:wa};function Sa(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};We.initial(e),We.handler(t);var n={current:e},r=De(Ca)(n,t),s=De(Na)(n),o=De(We.changes)(e),f=De(za)(n);function i(){var c=arguments.length>0&&arguments[0]!==void 0?arguments[0]:function(p){return p};return We.selector(c),c(n.current)}function l(c){ha(r,s,o,f)(c)}return[i,l]}function za(e,t){return Ae(t)?t(e.current):t}function Na(e,t){return e.current=At(At({},e.current),t),t}function Ca(e,t,n){return Ae(t)?t(e.current):Object.keys(n).forEach(function(r){var s;return(s=t[r])===null||s===void 0?void 0:s.call(t,e.current[r])}),n}var Pa={create:Sa},Ma={paths:{vs:"https://cdn.jsdelivr.net/npm/monaco-editor@0.55.1/min/vs"}};function Ea(e){return function t(){for(var n=this,r=arguments.length,s=new Array(r),o=0;o<r;o++)s[o]=arguments[o];return s.length>=e.length?e.apply(this,s):function(){for(var f=arguments.length,i=new Array(f),l=0;l<f;l++)i[l]=arguments[l];return t.apply(n,[].concat(s,i))}}}function Ra(e){return{}.toString.call(e).includes("Object")}function La(e){return e||_t("configIsRequired"),Ra(e)||_t("configType"),e.urls?(Oa(),{paths:{vs:e.urls.monacoBase}}):e}function Oa(){console.warn(cn.deprecation)}function Da(e,t){throw new Error(e[t]||e.default)}var cn={configIsRequired:"the configuration object is required",configType:"the configuration object should be an object",default:"an unknown error accured in `@monaco-editor/loader` package",deprecation:`Deprecation warning!
|
|
153
153
|
You are using deprecated way of configuration.
|
|
154
154
|
|
|
155
155
|
Instead of using
|
|
@@ -158,5 +158,5 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
158
158
|
monaco.config({ paths: { vs: '...' } })
|
|
159
159
|
|
|
160
160
|
For more please check the link https://github.com/suren-atoyan/monaco-loader#config
|
|
161
|
-
`},Ft=Ea(Da)(ln),$a={config:La},Ia=function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return function(s){return n.reduceRight(function(o,f){return f(o)},s)}};function cn(e,t){return Object.keys(t).forEach(function(n){t[n]instanceof Object&&e[n]&&Object.assign(t[n],cn(e[n],t[n]))}),It(It({},e),t)}var Ta={type:"cancelation",msg:"operation is manually canceled"};function st(e){var t=!1,n=new Promise(function(r,s){e.then(function(o){return t?s(Ta):r(o)}),e.catch(s)});return n.cancel=function(){return t=!0},n}var Aa=["monaco"],Fa=Pa.create({config:Ma,isInitialized:!1,resolve:null,reject:null,monaco:null}),dn=da(Fa,2),_e=dn[0],Je=dn[1];function _a(e){var t=$a.config(e),n=t.monaco,r=la(t,Aa);Je(function(s){return{config:cn(s.config,r),monaco:n}})}function Va(){var e=_e(function(t){var n=t.monaco,r=t.isInitialized,s=t.resolve;return{monaco:n,isInitialized:r,resolve:s}});if(!e.isInitialized){if(Je({isInitialized:!0}),e.monaco)return e.resolve(e.monaco),st(ot);if(window.monaco&&window.monaco.editor)return un(window.monaco),e.resolve(window.monaco),st(ot);Ia(Ba,qa)(Wa)}return st(ot)}function Ba(e){return document.body.appendChild(e)}function Ha(e){var t=document.createElement("script");return e&&(t.src=e),t}function qa(e){var t=_e(function(r){var s=r.config,o=r.reject;return{config:s,reject:o}}),n=Ha("".concat(t.config.paths.vs,"/loader.js"));return n.onload=function(){return e()},n.onerror=t.reject,n}function Wa(){var e=_e(function(n){var r=n.config,s=n.resolve,o=n.reject;return{config:r,resolve:s,reject:o}}),t=window.require;t.config(e.config),t(["vs/editor/editor.main"],function(n){var r=n.m||n;un(r),e.resolve(r)},function(n){e.reject(n)})}function un(e){_e().monaco||Je({monaco:e})}function Ua(){return _e(function(e){var t=e.monaco;return t})}var ot=new Promise(function(e,t){return Je({resolve:e,reject:t})}),fn={config:_a,init:Va,__getMonacoInstance:Ua},Ga={wrapper:{display:"flex",position:"relative",textAlign:"initial"},fullWidth:{width:"100%"},hide:{display:"none"}},it=Ga,Ka={container:{display:"flex",height:"100%",width:"100%",justifyContent:"center",alignItems:"center"}},Xa=Ka;function Ya({children:e}){return ke.createElement("div",{style:Xa.container},e)}var Qa=Ya,Za=Qa;function Ja({width:e,height:t,isEditorReady:n,loading:r,_ref:s,className:o,wrapperProps:f}){return ke.createElement("section",{style:{...it.wrapper,width:e,height:t},...f},!n&&ke.createElement(Za,null,r),ke.createElement("div",{ref:s,style:{...it.fullWidth,...!n&&it.hide},className:o}))}var es=Ja,pn=d.memo(es);function ts(e){d.useEffect(e,[])}var mn=ts;function ns(e,t,n=!0){let r=d.useRef(!0);d.useEffect(r.current||!n?()=>{r.current=!1}:e,t)}var Y=ns;function Ie(){}function we(e,t,n,r){return rs(e,r)||as(e,t,n,r)}function rs(e,t){return e.editor.getModel(hn(e,t))}function as(e,t,n,r){return e.editor.createModel(t,n,r?hn(e,r):void 0)}function hn(e,t){return e.Uri.parse(t)}function ss({original:e,modified:t,language:n,originalLanguage:r,modifiedLanguage:s,originalModelPath:o,modifiedModelPath:f,keepCurrentOriginalModel:i=!1,keepCurrentModifiedModel:l=!1,theme:c="light",loading:p="Loading...",options:v={},height:h="100%",width:w="100%",className:j,wrapperProps:g={},beforeMount:y=Ie,onMount:x=Ie}){let[m,k]=d.useState(!1),[S,b]=d.useState(!0),P=d.useRef(null),N=d.useRef(null),I=d.useRef(null),H=d.useRef(x),L=d.useRef(y),M=d.useRef(!1);mn(()=>{let z=fn.init();return z.then(D=>(N.current=D)&&b(!1)).catch(D=>(D==null?void 0:D.type)!=="cancelation"&&console.error("Monaco initialization: error:",D)),()=>P.current?A():z.cancel()}),Y(()=>{if(P.current&&N.current){let z=P.current.getOriginalEditor(),D=we(N.current,e||"",r||n||"text",o||"");D!==z.getModel()&&z.setModel(D)}},[o],m),Y(()=>{if(P.current&&N.current){let z=P.current.getModifiedEditor(),D=we(N.current,t||"",s||n||"text",f||"");D!==z.getModel()&&z.setModel(D)}},[f],m),Y(()=>{let z=P.current.getModifiedEditor();z.getOption(N.current.editor.EditorOption.readOnly)?z.setValue(t||""):t!==z.getValue()&&(z.executeEdits("",[{range:z.getModel().getFullModelRange(),text:t||"",forceMoveMarkers:!0}]),z.pushUndoStop())},[t],m),Y(()=>{var z,D;(D=(z=P.current)==null?void 0:z.getModel())==null||D.original.setValue(e||"")},[e],m),Y(()=>{let{original:z,modified:D}=P.current.getModel();N.current.editor.setModelLanguage(z,r||n||"text"),N.current.editor.setModelLanguage(D,s||n||"text")},[n,r,s],m),Y(()=>{var z;(z=N.current)==null||z.editor.setTheme(c)},[c],m),Y(()=>{var z;(z=P.current)==null||z.updateOptions(v)},[v],m);let E=d.useCallback(()=>{var U;if(!N.current)return;L.current(N.current);let z=we(N.current,e||"",r||n||"text",o||""),D=we(N.current,t||"",s||n||"text",f||"");(U=P.current)==null||U.setModel({original:z,modified:D})},[n,t,s,e,r,o,f]),V=d.useCallback(()=>{var z;!M.current&&I.current&&(P.current=N.current.editor.createDiffEditor(I.current,{automaticLayout:!0,...v}),E(),(z=N.current)==null||z.editor.setTheme(c),k(!0),M.current=!0)},[v,c,E]);d.useEffect(()=>{m&&H.current(P.current,N.current)},[m]),d.useEffect(()=>{!S&&!m&&V()},[S,m,V]);function A(){var D,U,Z,J;let z=(D=P.current)==null?void 0:D.getModel();i||((U=z==null?void 0:z.original)==null||U.dispose()),l||((Z=z==null?void 0:z.modified)==null||Z.dispose()),(J=P.current)==null||J.dispose()}return ke.createElement(pn,{width:w,height:h,isEditorReady:m,loading:p,_ref:I,className:j,wrapperProps:g})}var os=ss;d.memo(os);function is(e){let t=d.useRef();return d.useEffect(()=>{t.current=e},[e]),t.current}var ls=is,Ue=new Map;function cs({defaultValue:e,defaultLanguage:t,defaultPath:n,value:r,language:s,path:o,theme:f="light",line:i,loading:l="Loading...",options:c={},overrideServices:p={},saveViewState:v=!0,keepCurrentModel:h=!1,width:w="100%",height:j="100%",className:g,wrapperProps:y={},beforeMount:x=Ie,onMount:m=Ie,onChange:k,onValidate:S=Ie}){let[b,P]=d.useState(!1),[N,I]=d.useState(!0),H=d.useRef(null),L=d.useRef(null),M=d.useRef(null),E=d.useRef(m),V=d.useRef(x),A=d.useRef(),z=d.useRef(r),D=ls(o),U=d.useRef(!1),Z=d.useRef(!1);mn(()=>{let O=fn.init();return O.then($=>(H.current=$)&&I(!1)).catch($=>($==null?void 0:$.type)!=="cancelation"&&console.error("Monaco initialization: error:",$)),()=>L.current?ee():O.cancel()}),Y(()=>{var $,R,G,te;let O=we(H.current,e||r||"",t||s||"",o||n||"");O!==(($=L.current)==null?void 0:$.getModel())&&(v&&Ue.set(D,(R=L.current)==null?void 0:R.saveViewState()),(G=L.current)==null||G.setModel(O),v&&((te=L.current)==null||te.restoreViewState(Ue.get(o))))},[o],b),Y(()=>{var O;(O=L.current)==null||O.updateOptions(c)},[c],b),Y(()=>{!L.current||r===void 0||(L.current.getOption(H.current.editor.EditorOption.readOnly)?L.current.setValue(r):r!==L.current.getValue()&&(Z.current=!0,L.current.executeEdits("",[{range:L.current.getModel().getFullModelRange(),text:r,forceMoveMarkers:!0}]),L.current.pushUndoStop(),Z.current=!1))},[r],b),Y(()=>{var $,R;let O=($=L.current)==null?void 0:$.getModel();O&&s&&((R=H.current)==null||R.editor.setModelLanguage(O,s))},[s],b),Y(()=>{var O;i!==void 0&&((O=L.current)==null||O.revealLine(i))},[i],b),Y(()=>{var O;(O=H.current)==null||O.editor.setTheme(f)},[f],b);let J=d.useCallback(()=>{var O;if(!(!M.current||!H.current)&&!U.current){V.current(H.current);let $=o||n,R=we(H.current,r||e||"",t||s||"",$||"");L.current=(O=H.current)==null?void 0:O.editor.create(M.current,{model:R,automaticLayout:!0,...c},p),v&&L.current.restoreViewState(Ue.get($)),H.current.editor.setTheme(f),i!==void 0&&L.current.revealLine(i),P(!0),U.current=!0}},[e,t,n,r,s,o,c,p,v,f,i]);d.useEffect(()=>{b&&E.current(L.current,H.current)},[b]),d.useEffect(()=>{!N&&!b&&J()},[N,b,J]),z.current=r,d.useEffect(()=>{var O,$;b&&k&&((O=A.current)==null||O.dispose(),A.current=($=L.current)==null?void 0:$.onDidChangeModelContent(R=>{Z.current||k(L.current.getValue(),R)}))},[b,k]),d.useEffect(()=>{if(b){let O=H.current.editor.onDidChangeMarkers($=>{var G;let R=(G=L.current.getModel())==null?void 0:G.uri;if(R&&$.find(te=>te.path===R.path)){let te=H.current.editor.getModelMarkers({resource:R});S==null||S(te)}});return()=>{O==null||O.dispose()}}return()=>{}},[b,S]);function ee(){var O,$;(O=A.current)==null||O.dispose(),h?v&&Ue.set(o,L.current.saveViewState()):($=L.current.getModel())==null||$.dispose(),L.current.dispose()}return ke.createElement(pn,{width:w,height:j,isEditorReady:b,loading:l,_ref:M,className:g,wrapperProps:y})}var ds=cs,us=d.memo(ds),fs=us;function ps(e,t){const n=getComputedStyle(e),r=parseFloat(n.fontSize);return t*r}function ms(e,t){const n=getComputedStyle(e.ownerDocument.body),r=parseFloat(n.fontSize);return t*r}function hs(e){return e/100*window.innerHeight}function xs(e){return e/100*window.innerWidth}function gs(e){switch(typeof e){case"number":return[e,"px"];case"string":{const t=parseFloat(e);return e.endsWith("%")?[t,"%"]:e.endsWith("px")?[t,"px"]:e.endsWith("rem")?[t,"rem"]:e.endsWith("em")?[t,"em"]:e.endsWith("vh")?[t,"vh"]:e.endsWith("vw")?[t,"vw"]:[t,"%"]}}}function De({groupSize:e,panelElement:t,styleProp:n}){let r;const[s,o]=gs(n);switch(o){case"%":{r=s/100*e;break}case"px":{r=s;break}case"rem":{r=ms(t,s);break}case"em":{r=ps(t,s);break}case"vh":{r=hs(s);break}case"vw":{r=xs(s);break}}return r}function X(e){return parseFloat(e.toFixed(3))}function Ne({group:e}){const{orientation:t,panels:n}=e;return n.reduce((r,s)=>(r+=t==="horizontal"?s.element.offsetWidth:s.element.offsetHeight,r),0)}function ct(e){const{panels:t}=e,n=Ne({group:e});return n===0?t.map(r=>({groupResizeBehavior:r.panelConstraints.groupResizeBehavior,collapsedSize:0,collapsible:r.panelConstraints.collapsible===!0,defaultSize:void 0,disabled:r.panelConstraints.disabled,minSize:0,maxSize:100,panelId:r.id})):t.map(r=>{const{element:s,panelConstraints:o}=r;let f=0;if(o.collapsedSize!==void 0){const p=De({groupSize:n,panelElement:s,styleProp:o.collapsedSize});f=X(p/n*100)}let i;if(o.defaultSize!==void 0){const p=De({groupSize:n,panelElement:s,styleProp:o.defaultSize});i=X(p/n*100)}let l=0;if(o.minSize!==void 0){const p=De({groupSize:n,panelElement:s,styleProp:o.minSize});l=X(p/n*100)}let c=100;if(o.maxSize!==void 0){const p=De({groupSize:n,panelElement:s,styleProp:o.maxSize});c=X(p/n*100)}return{groupResizeBehavior:o.groupResizeBehavior,collapsedSize:f,collapsible:o.collapsible===!0,defaultSize:i,disabled:o.disabled,minSize:l,maxSize:c,panelId:r.id}})}function B(e,t="Assertion error"){if(!e)throw Error(t)}function dt(e,t){return Array.from(t).sort(e==="horizontal"?bs:vs)}function bs(e,t){const n=e.element.offsetLeft-t.element.offsetLeft;return n!==0?n:e.element.offsetWidth-t.element.offsetWidth}function vs(e,t){const n=e.element.offsetTop-t.element.offsetTop;return n!==0?n:e.element.offsetHeight-t.element.offsetHeight}function xn(e){return e!==null&&typeof e=="object"&&"nodeType"in e&&e.nodeType===Node.ELEMENT_NODE}function gn(e,t){return{x:e.x>=t.left&&e.x<=t.right?0:Math.min(Math.abs(e.x-t.left),Math.abs(e.x-t.right)),y:e.y>=t.top&&e.y<=t.bottom?0:Math.min(Math.abs(e.y-t.top),Math.abs(e.y-t.bottom))}}function ys({orientation:e,rects:t,targetRect:n}){const r={x:n.x+n.width/2,y:n.y+n.height/2};let s,o=Number.MAX_VALUE;for(const f of t){const{x:i,y:l}=gn(r,f),c=e==="horizontal"?i:l;c<o&&(o=c,s=f)}return B(s,"No rect found"),s}let Ge;function ws(){return Ge===void 0&&(typeof matchMedia=="function"?Ge=!!matchMedia("(pointer:coarse)").matches:Ge=!1),Ge}function bn(e){const{element:t,orientation:n,panels:r,separators:s}=e,o=dt(n,Array.from(t.children).filter(xn).map(j=>({element:j}))).map(({element:j})=>j),f=[];let i=!1,l=!1,c=-1,p=-1,v=0,h,w=[];{let j=-1;for(const g of o)g.hasAttribute("data-panel")&&(j++,g.ariaDisabled===null&&(v++,c===-1&&(c=j),p=j))}if(v>1){let j=-1;for(const g of o)if(g.hasAttribute("data-panel")){j++;const y=r.find(x=>x.element===g);if(y){if(h){const x=h.element.getBoundingClientRect(),m=g.getBoundingClientRect();let k;if(l){const S=n==="horizontal"?new DOMRect(x.right,x.top,0,x.height):new DOMRect(x.left,x.bottom,x.width,0),b=n==="horizontal"?new DOMRect(m.left,m.top,0,m.height):new DOMRect(m.left,m.top,m.width,0);switch(w.length){case 0:{k=[S,b];break}case 1:{const P=w[0],N=ys({orientation:n,rects:[x,m],targetRect:P.element.getBoundingClientRect()});k=[P,N===x?b:S];break}default:{k=w;break}}}else w.length?k=w:k=[n==="horizontal"?new DOMRect(x.right,m.top,m.left-x.right,m.height):new DOMRect(m.left,x.bottom,m.width,m.top-x.bottom)];for(const S of k){let b="width"in S?S:S.element.getBoundingClientRect();const P=ws()?e.resizeTargetMinimumSize.coarse:e.resizeTargetMinimumSize.fine;if(b.width<P){const I=P-b.width;b=new DOMRect(b.x-I/2,b.y,b.width+I,b.height)}if(b.height<P){const I=P-b.height;b=new DOMRect(b.x,b.y-I/2,b.width,b.height+I)}const N=j<=c||j>p;!i&&!N&&f.push({group:e,groupSize:Ne({group:e}),panels:[h,y],separator:"width"in S?void 0:S,rect:b}),i=!1}}l=!1,h=y,w=[]}}else if(g.hasAttribute("data-separator")){g.ariaDisabled!==null&&(i=!0);const y=s.find(x=>x.element===g);y?w.push(y):(h=void 0,w=[])}else l=!0}return f}var le;class vn{constructor(){Rt(this,le,{})}addListener(t,n){const r=Re(this,le)[t];return r===void 0?Re(this,le)[t]=[n]:r.includes(n)||r.push(n),()=>{this.removeListener(t,n)}}emit(t,n){const r=Re(this,le)[t];if(r!==void 0)if(r.length===1)r[0].call(null,n);else{let s=!1,o=null;const f=Array.from(r);for(let i=0;i<f.length;i++){const l=f[i];try{l.call(null,n)}catch(c){o===null&&(s=!0,o=c)}}if(s)throw o}}removeAllListeners(){Lt(this,le,{})}removeListener(t,n){const r=Re(this,le)[t];if(r!==void 0){const s=r.indexOf(n);s>=0&&r.splice(s,1)}}}le=new WeakMap;let re=new Map;const yn=new vn;function js(e){re=new Map(re),re.delete(e)}function _t(e,t){for(const[n]of re)if(n.id===e)return n}function de(e,t){for(const[n,r]of re)if(n.id===e)return r;if(t)throw Error(`Could not find data for Group with id ${e}`)}function xe(){return re}function mt(e,t){return yn.addListener("groupChange",n=>{n.group.id===e&&t(n)})}function oe(e,t){const n=re.get(e);re=new Map(re),re.set(e,t),yn.emit("groupChange",{group:e,prev:n,next:t})}function ks(e,t,n){let r,s={x:1/0,y:1/0};for(const o of t){const f=gn(n,o.rect);switch(e){case"horizontal":{f.x<=s.x&&(r=o,s=f);break}case"vertical":{f.y<=s.y&&(r=o,s=f);break}}}return r?{distance:s,hitRegion:r}:void 0}function Ss(e){return e!==null&&typeof e=="object"&&"nodeType"in e&&e.nodeType===Node.DOCUMENT_FRAGMENT_NODE}function zs(e,t){if(e===t)throw new Error("Cannot compare node with itself");const n={a:Ht(e),b:Ht(t)};let r;for(;n.a.at(-1)===n.b.at(-1);)r=n.a.pop(),n.b.pop();B(r,"Stacking order can only be calculated for elements with a common ancestor");const s={a:Bt(Vt(n.a)),b:Bt(Vt(n.b))};if(s.a===s.b){const o=r.childNodes,f={a:n.a.at(-1),b:n.b.at(-1)};let i=o.length;for(;i--;){const l=o[i];if(l===f.a)return 1;if(l===f.b)return-1}}return Math.sign(s.a-s.b)}const Ns=/\b(?:position|zIndex|opacity|transform|webkitTransform|mixBlendMode|filter|webkitFilter|isolation)\b/;function Cs(e){const t=getComputedStyle(wn(e)??e).display;return t==="flex"||t==="inline-flex"}function Ps(e){const t=getComputedStyle(e);return!!(t.position==="fixed"||t.zIndex!=="auto"&&(t.position!=="static"||Cs(e))||+t.opacity<1||"transform"in t&&t.transform!=="none"||"webkitTransform"in t&&t.webkitTransform!=="none"||"mixBlendMode"in t&&t.mixBlendMode!=="normal"||"filter"in t&&t.filter!=="none"||"webkitFilter"in t&&t.webkitFilter!=="none"||"isolation"in t&&t.isolation==="isolate"||Ns.test(t.willChange)||t.webkitOverflowScrolling==="touch")}function Vt(e){let t=e.length;for(;t--;){const n=e[t];if(B(n,"Missing node"),Ps(n))return n}return null}function Bt(e){return e&&Number(getComputedStyle(e).zIndex)||0}function Ht(e){const t=[];for(;e;)t.push(e),e=wn(e);return t}function wn(e){const{parentNode:t}=e;return Ss(t)?t.host:t}function Ms(e,t){return e.x<t.x+t.width&&e.x+e.width>t.x&&e.y<t.y+t.height&&e.y+e.height>t.y}function Es({groupElement:e,hitRegion:t,pointerEventTarget:n}){if(!xn(n)||n.contains(e)||e.contains(n))return!0;if(zs(n,e)>0){let r=n;for(;r;){if(r.contains(e))return!0;if(Ms(r.getBoundingClientRect(),t))return!1;r=r.parentElement}}return!0}function ht(e,t){const n=[];return t.forEach((r,s)=>{if(s.disabled)return;const o=bn(s),f=ks(s.orientation,o,{x:e.clientX,y:e.clientY});f&&f.distance.x<=0&&f.distance.y<=0&&Es({groupElement:s.element,hitRegion:f.hitRegion.rect,pointerEventTarget:e.target})&&n.push(f.hitRegion)}),n}function Rs(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!=t[n])return!1;return!0}function K(e,t,n=0){return Math.abs(X(e)-X(t))<=n}function ne(e,t){return K(e,t)?0:e>t?1:-1}function je({overrideDisabledPanels:e,panelConstraints:t,prevSize:n,size:r}){const{collapsedSize:s=0,collapsible:o,disabled:f,maxSize:i=100,minSize:l=0}=t;if(f&&!e)return n;if(ne(r,l)<0)if(o){const c=(s+l)/2;ne(r,c)<0?r=s:r=l}else r=l;return r=Math.min(i,r),r=X(r),r}function Fe({delta:e,initialLayout:t,panelConstraints:n,pivotIndices:r,prevLayout:s,trigger:o}){if(K(e,0))return t;const f=o==="imperative-api",i=Object.values(t),l=Object.values(s),c=[...i],[p,v]=r;B(p!=null,"Invalid first pivot index"),B(v!=null,"Invalid second pivot index");let h=0;switch(o){case"keyboard":{{const g=e<0?v:p,y=n[g];B(y,`Panel constraints not found for index ${g}`);const{collapsedSize:x=0,collapsible:m,minSize:k=0}=y;if(m){const S=i[g];if(B(S!=null,`Previous layout not found for panel index ${g}`),K(S,x)){const b=k-S;ne(b,Math.abs(e))>0&&(e=e<0?0-b:b)}}}{const g=e<0?p:v,y=n[g];B(y,`No panel constraints found for index ${g}`);const{collapsedSize:x=0,collapsible:m,minSize:k=0}=y;if(m){const S=i[g];if(B(S!=null,`Previous layout not found for panel index ${g}`),K(S,k)){const b=S-x;ne(b,Math.abs(e))>0&&(e=e<0?0-b:b)}}}break}default:{const g=e<0?v:p,y=n[g];B(y,`Panel constraints not found for index ${g}`);const x=i[g],{collapsible:m,collapsedSize:k,minSize:S}=y;if(m&&ne(x,S)<0)if(e>0){const b=S-k,P=b/2,N=x+e;ne(N,S)<0&&(e=ne(e,P)<=0?0:b)}else{const b=S-k,P=100-b/2,N=x-e;ne(N,S)<0&&(e=ne(100+e,P)>0?0:-b)}break}}{const g=e<0?1:-1;let y=e<0?v:p,x=0;for(;;){const k=i[y];B(k!=null,`Previous layout not found for panel index ${y}`);const S=je({overrideDisabledPanels:f,panelConstraints:n[y],prevSize:k,size:100})-k;if(x+=S,y+=g,y<0||y>=n.length)break}const m=Math.min(Math.abs(e),Math.abs(x));e=e<0?0-m:m}{let g=e<0?p:v;for(;g>=0&&g<n.length;){const y=Math.abs(e)-Math.abs(h),x=i[g];B(x!=null,`Previous layout not found for panel index ${g}`);const m=x-y,k=je({overrideDisabledPanels:f,panelConstraints:n[g],prevSize:x,size:m});if(!K(x,k)&&(h+=x-k,c[g]=k,h.toFixed(3).localeCompare(Math.abs(e).toFixed(3),void 0,{numeric:!0})>=0))break;e<0?g--:g++}}if(Rs(l,c))return s;{const g=e<0?v:p,y=i[g];B(y!=null,`Previous layout not found for panel index ${g}`);const x=y+h,m=je({overrideDisabledPanels:f,panelConstraints:n[g],prevSize:y,size:x});if(c[g]=m,!K(m,x)){let k=x-m,S=e<0?v:p;for(;S>=0&&S<n.length;){const b=c[S];B(b!=null,`Previous layout not found for panel index ${S}`);const P=b+k,N=je({overrideDisabledPanels:f,panelConstraints:n[S],prevSize:b,size:P});if(K(b,N)||(k-=N-b,c[S]=N),K(k,0))break;e>0?S--:S++}}}const w=Object.values(c).reduce((g,y)=>y+g,0);if(!K(w,100,.1))return s;const j=Object.keys(s);return c.reduce((g,y,x)=>(g[j[x]]=y,g),{})}function pe(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(const n in e)if(t[n]===void 0||ne(e[n],t[n])!==0)return!1;return!0}function me({layout:e,panelConstraints:t}){const n=Object.values(e),r=[...n],s=r.reduce((i,l)=>i+l,0);if(r.length!==t.length)throw Error(`Invalid ${t.length} panel layout: ${r.map(i=>`${i}%`).join(", ")}`);if(!K(s,100)&&r.length>0)for(let i=0;i<t.length;i++){const l=r[i];B(l!=null,`No layout data found for index ${i}`);const c=100/s*l;r[i]=c}let o=0;for(let i=0;i<t.length;i++){const l=n[i];B(l!=null,`No layout data found for index ${i}`);const c=r[i];B(c!=null,`No layout data found for index ${i}`);const p=je({overrideDisabledPanels:!0,panelConstraints:t[i],prevSize:l,size:c});c!=p&&(o+=c-p,r[i]=p)}if(!K(o,0))for(let i=0;i<t.length;i++){const l=r[i];B(l!=null,`No layout data found for index ${i}`);const c=l+o,p=je({overrideDisabledPanels:!0,panelConstraints:t[i],prevSize:l,size:c});if(l!==p&&(o-=p-l,r[i]=p,K(o,0)))break}const f=Object.keys(e);return r.reduce((i,l,c)=>(i[f[c]]=l,i),{})}function jn({groupId:e,panelId:t}){const n=()=>{const i=xe();for(const[l,{defaultLayoutDeferred:c,derivedPanelConstraints:p,layout:v,groupSize:h,separatorToPanels:w}]of i)if(l.id===e)return{defaultLayoutDeferred:c,derivedPanelConstraints:p,group:l,groupSize:h,layout:v,separatorToPanels:w};throw Error(`Group ${e} not found`)},r=()=>{const i=n().derivedPanelConstraints.find(l=>l.panelId===t);if(i!==void 0)return i;throw Error(`Panel constraints not found for Panel ${t}`)},s=()=>{const i=n().group.panels.find(l=>l.id===t);if(i!==void 0)return i;throw Error(`Layout not found for Panel ${t}`)},o=()=>{const i=n().layout[t];if(i!==void 0)return i;throw Error(`Layout not found for Panel ${t}`)},f=i=>{const l=o();if(i===l)return;const{defaultLayoutDeferred:c,derivedPanelConstraints:p,group:v,groupSize:h,layout:w,separatorToPanels:j}=n(),g=v.panels.findIndex(k=>k.id===t),y=g===v.panels.length-1,x=Fe({delta:y?l-i:i-l,initialLayout:w,panelConstraints:p,pivotIndices:y?[g-1,g]:[g,g+1],prevLayout:w,trigger:"imperative-api"}),m=me({layout:x,panelConstraints:p});pe(w,m)||oe(v,{defaultLayoutDeferred:c,derivedPanelConstraints:p,groupSize:h,layout:m,separatorToPanels:j})};return{collapse:()=>{const{collapsible:i,collapsedSize:l}=r(),{mutableValues:c}=s(),p=o();i&&p!==l&&(c.expandToSize=p,f(l))},expand:()=>{const{collapsible:i,collapsedSize:l,minSize:c}=r(),{mutableValues:p}=s(),v=o();if(i&&v===l){let h=p.expandToSize??c;h===0&&(h=1),f(h)}},getSize:()=>{const{group:i}=n(),l=o(),{element:c}=s(),p=i.orientation==="horizontal"?c.offsetWidth:c.offsetHeight;return{asPercentage:l,inPixels:p}},isCollapsed:()=>{const{collapsible:i,collapsedSize:l}=r(),c=o();return i&&K(l,c)},resize:i=>{const{group:l}=n(),{element:c}=s(),p=Ne({group:l}),v=De({groupSize:p,panelElement:c,styleProp:i}),h=X(v/p*100);f(h)}}}function qt(e){if(e.defaultPrevented)return;const t=xe();ht(e,t).forEach(n=>{if(n.separator){const r=n.panels.find(s=>s.panelConstraints.defaultSize!==void 0);if(r){const s=r.panelConstraints.defaultSize,o=jn({groupId:n.group.id,panelId:r.id});o&&s!==void 0&&(o.resize(s),e.preventDefault())}}})}function Ye(e){const t=xe();for(const[n]of t)if(n.separators.some(r=>r.element===e))return n;throw Error("Could not find parent Group for separator element")}function kn({groupId:e}){const t=()=>{const n=xe();for(const[r,s]of n)if(r.id===e)return{group:r,...s};throw Error(`Could not find Group with id "${e}"`)};return{getLayout(){const{defaultLayoutDeferred:n,layout:r}=t();return n?{}:r},setLayout(n){const{defaultLayoutDeferred:r,derivedPanelConstraints:s,group:o,groupSize:f,layout:i,separatorToPanels:l}=t(),c=me({layout:n,panelConstraints:s});return r?i:(pe(i,c)||oe(o,{defaultLayoutDeferred:r,derivedPanelConstraints:s,groupSize:f,layout:c,separatorToPanels:l}),c)}}}function fe(e,t){const n=Ye(e),r=de(n.id,!0),s=n.separators.find(p=>p.element===e);B(s,"Matching separator not found");const o=r.separatorToPanels.get(s);B(o,"Matching panels not found");const f=o.map(p=>n.panels.indexOf(p)),i=kn({groupId:n.id}).getLayout(),l=Fe({delta:t,initialLayout:i,panelConstraints:r.derivedPanelConstraints,pivotIndices:f,prevLayout:i,trigger:"keyboard"}),c=me({layout:l,panelConstraints:r.derivedPanelConstraints});pe(i,c)||oe(n,{defaultLayoutDeferred:r.defaultLayoutDeferred,derivedPanelConstraints:r.derivedPanelConstraints,groupSize:r.groupSize,layout:c,separatorToPanels:r.separatorToPanels})}function Wt(e){if(e.defaultPrevented)return;const t=e.currentTarget,n=Ye(t);if(!n.disabled)switch(e.key){case"ArrowDown":{e.preventDefault(),n.orientation==="vertical"&&fe(t,5);break}case"ArrowLeft":{e.preventDefault(),n.orientation==="horizontal"&&fe(t,-5);break}case"ArrowRight":{e.preventDefault(),n.orientation==="horizontal"&&fe(t,5);break}case"ArrowUp":{e.preventDefault(),n.orientation==="vertical"&&fe(t,-5);break}case"End":{e.preventDefault(),fe(t,100);break}case"Enter":{e.preventDefault();const r=Ye(t),s=de(r.id,!0),{derivedPanelConstraints:o,layout:f,separatorToPanels:i}=s,l=r.separators.find(h=>h.element===t);B(l,"Matching separator not found");const c=i.get(l);B(c,"Matching panels not found");const p=c[0],v=o.find(h=>h.panelId===p.id);if(B(v,"Panel metadata not found"),v.collapsible){const h=f[p.id],w=v.collapsedSize===h?r.mutableState.expandedPanelSizes[p.id]??v.minSize:v.collapsedSize;fe(t,w-h)}break}case"F6":{e.preventDefault();const r=Ye(t).separators.map(f=>f.element),s=Array.from(r).findIndex(f=>f===e.currentTarget);B(s!==null,"Index not found");const o=e.shiftKey?s>0?s-1:r.length-1:s+1<r.length?s+1:0;r[o].focus({preventScroll:!0});break}case"Home":{e.preventDefault(),fe(t,-100);break}}}let Se={cursorFlags:0,state:"inactive"};const xt=new vn;function he(){return Se}function Ls(e){return xt.addListener("change",e)}function Os(e){const t=Se,n={...Se};n.cursorFlags=e,Se=n,xt.emit("change",{prev:t,next:n})}function ze(e){const t=Se;Se=e,xt.emit("change",{prev:t,next:e})}function Ut(e){if(e.defaultPrevented||e.pointerType==="mouse"&&e.button>0)return;const t=xe(),n=ht(e,t),r=new Map;let s=!1;n.forEach(o=>{o.separator&&(s||(s=!0,o.separator.element.focus({preventScroll:!0})));const f=t.get(o.group);f&&r.set(o.group,f.layout)}),ze({cursorFlags:0,hitRegions:n,initialLayoutMap:r,pointerDownAtPoint:{x:e.clientX,y:e.clientY},state:"active"}),n.length&&e.preventDefault()}const Ds=e=>e,lt=()=>{},Sn=1,zn=2,Nn=4,Cn=8,Gt=3,Kt=12;let Ke;function Xt(){return Ke===void 0&&(Ke=!1,typeof window<"u"&&(window.navigator.userAgent.includes("Chrome")||window.navigator.userAgent.includes("Firefox"))&&(Ke=!0)),Ke}function $s({cursorFlags:e,groups:t,state:n}){let r=0,s=0;switch(n){case"active":case"hover":t.forEach(o=>{if(!o.mutableState.disableCursor)switch(o.orientation){case"horizontal":{r++;break}case"vertical":{s++;break}}})}if(!(r===0&&s===0)){switch(n){case"active":{if(e&&Xt()){const o=(e&Sn)!==0,f=(e&zn)!==0,i=(e&Nn)!==0,l=(e&Cn)!==0;if(o)return i?"se-resize":l?"ne-resize":"e-resize";if(f)return i?"sw-resize":l?"nw-resize":"w-resize";if(i)return"s-resize";if(l)return"n-resize"}break}}return Xt()?r>0&&s>0?"move":r>0?"ew-resize":"ns-resize":r>0&&s>0?"grab":r>0?"col-resize":"row-resize"}}const Yt=new WeakMap;function gt(e){if(e.defaultView===null||e.defaultView===void 0)return;let{prevStyle:t,styleSheet:n}=Yt.get(e)??{};n===void 0&&(n=new e.defaultView.CSSStyleSheet,e.adoptedStyleSheets&&e.adoptedStyleSheets.push(n));const r=he();switch(r.state){case"active":case"hover":{const s=$s({cursorFlags:r.cursorFlags,groups:r.hitRegions.map(f=>f.group),state:r.state}),o=`*, *:hover {cursor: ${s} !important; }`;if(t===o)return;t=o,s?n.cssRules.length===0?n.insertRule(o):n.replaceSync(o):n.cssRules.length===1&&n.deleteRule(0);break}case"inactive":{t=void 0,n.cssRules.length===1&&n.deleteRule(0);break}}Yt.set(e,{prevStyle:t,styleSheet:n})}function Pn({document:e,event:t,hitRegions:n,initialLayoutMap:r,mountedGroups:s,pointerDownAtPoint:o,prevCursorFlags:f}){let i=0;n.forEach(c=>{const{group:p,groupSize:v}=c,{orientation:h,panels:w}=p,{disableCursor:j}=p.mutableState;let g=0;o?h==="horizontal"?g=(t.clientX-o.x)/v*100:g=(t.clientY-o.y)/v*100:h==="horizontal"?g=t.clientX<0?-100:100:g=t.clientY<0?-100:100;const y=r.get(p),x=s.get(p);if(!y||!x)return;const{defaultLayoutDeferred:m,derivedPanelConstraints:k,groupSize:S,layout:b,separatorToPanels:P}=x;if(k&&b&&P){const N=Fe({delta:g,initialLayout:y,panelConstraints:k,pivotIndices:c.panels.map(I=>w.indexOf(I)),prevLayout:b,trigger:"mouse-or-touch"});if(pe(N,b)){if(g!==0&&!j)switch(h){case"horizontal":{i|=g<0?Sn:zn;break}case"vertical":{i|=g<0?Nn:Cn;break}}}else oe(c.group,{defaultLayoutDeferred:m,derivedPanelConstraints:k,groupSize:S,layout:N,separatorToPanels:P})}});let l=0;t.movementX===0?l|=f&Gt:l|=i&Gt,t.movementY===0?l|=f&Kt:l|=i&Kt,Os(l),gt(e)}function Qt(e){const t=xe(),n=he();switch(n.state){case"active":Pn({document:e.currentTarget,event:e,hitRegions:n.hitRegions,initialLayoutMap:n.initialLayoutMap,mountedGroups:t,prevCursorFlags:n.cursorFlags})}}function Zt(e){if(e.defaultPrevented)return;const t=he(),n=xe();switch(t.state){case"active":{if(e.buttons===0){ze({cursorFlags:0,state:"inactive"}),t.hitRegions.forEach(r=>{const s=de(r.group.id,!0);oe(r.group,s)});return}Pn({document:e.currentTarget,event:e,hitRegions:t.hitRegions,initialLayoutMap:t.initialLayoutMap,mountedGroups:n,pointerDownAtPoint:t.pointerDownAtPoint,prevCursorFlags:t.cursorFlags});break}default:{const r=ht(e,n);r.length===0?t.state!=="inactive"&&ze({cursorFlags:0,state:"inactive"}):ze({cursorFlags:0,hitRegions:r,state:"hover"}),gt(e.currentTarget);break}}}function Jt(e){if(e.relatedTarget instanceof HTMLIFrameElement)switch(he().state){case"hover":ze({cursorFlags:0,state:"inactive"})}}function en(e){if(e.defaultPrevented||e.pointerType==="mouse"&&e.button>0)return;const t=he();switch(t.state){case"active":ze({cursorFlags:0,state:"inactive"}),t.hitRegions.length>0&&(gt(e.currentTarget),t.hitRegions.forEach(n=>{const r=de(n.group.id,!0);oe(n.group,r)}),e.preventDefault())}}function tn(e){let t=0,n=0;const r={};for(const o of e)if(o.defaultSize!==void 0){t++;const f=X(o.defaultSize);n+=f,r[o.panelId]=f}else r[o.panelId]=void 0;const s=e.length-t;if(s!==0){const o=X((100-n)/s);for(const f of e)f.defaultSize===void 0&&(r[f.panelId]=o)}return r}function Is(e,t,n){if(!n[0])return;const r=e.panels.find(l=>l.element===t);if(!r||!r.onResize)return;const s=Ne({group:e}),o=e.orientation==="horizontal"?r.element.offsetWidth:r.element.offsetHeight,f=r.mutableValues.prevSize,i={asPercentage:X(o/s*100),inPixels:o};r.mutableValues.prevSize=i,r.onResize(i,r.id,f)}function Ts(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(const n in e)if(e[n]!==t[n])return!1;return!0}function As({group:e,nextGroupSize:t,prevGroupSize:n,prevLayout:r}){if(n<=0||t<=0||n===t)return r;let s=0,o=0,f=!1;const i=new Map,l=[];for(const v of e.panels){const h=r[v.id]??0;switch(v.panelConstraints.groupResizeBehavior){case"preserve-pixel-size":{f=!0;const w=h/100*n,j=X(w/t*100);i.set(v.id,j),s+=j;break}case"preserve-relative-size":default:{l.push(v.id),o+=h;break}}}if(!f||l.length===0)return r;const c=100-s,p={...r};if(i.forEach((v,h)=>{p[h]=v}),o>0)for(const v of l){const h=r[v]??0;p[v]=X(h/o*c)}else{const v=X(c/l.length);for(const h of l)p[h]=v}return p}function Fs(e,t){const n=e.map(s=>s.id),r=Object.keys(t);if(n.length!==r.length)return!1;for(const s of n)if(!r.includes(s))return!1;return!0}const ye=new Map;function _s(e){let t=!0;B(e.element.ownerDocument.defaultView,"Cannot register an unmounted Group");const n=e.element.ownerDocument.defaultView.ResizeObserver,r=new Set,s=new Set,o=new n(j=>{for(const g of j){const{borderBoxSize:y,target:x}=g;if(x===e.element){if(t){const m=Ne({group:e});if(m===0)return;const k=de(e.id);if(!k)return;const S=ct(e),b=k.defaultLayoutDeferred?tn(S):k.layout,P=As({group:e,nextGroupSize:m,prevGroupSize:k.groupSize,prevLayout:b}),N=me({layout:P,panelConstraints:S});if(!k.defaultLayoutDeferred&&pe(k.layout,N)&&Ts(k.derivedPanelConstraints,S)&&k.groupSize===m)return;oe(e,{defaultLayoutDeferred:!1,derivedPanelConstraints:S,groupSize:m,layout:N,separatorToPanels:k.separatorToPanels})}}else Is(e,x,y)}});o.observe(e.element),e.panels.forEach(j=>{B(!r.has(j.id),`Panel ids must be unique; id "${j.id}" was used more than once`),r.add(j.id),j.onResize&&o.observe(j.element)});const f=Ne({group:e}),i=ct(e),l=e.panels.map(({id:j})=>j).join(",");let c=e.mutableState.defaultLayout;c&&(Fs(e.panels,c)||(c=void 0));const p=e.mutableState.layouts[l]??c??tn(i),v=me({layout:p,panelConstraints:i}),h=e.element.ownerDocument;ye.set(h,(ye.get(h)??0)+1);const w=new Map;return bn(e).forEach(j=>{j.separator&&w.set(j.separator,j.panels)}),oe(e,{defaultLayoutDeferred:f===0,derivedPanelConstraints:i,groupSize:f,layout:v,separatorToPanels:w}),e.separators.forEach(j=>{B(!s.has(j.id),`Separator ids must be unique; id "${j.id}" was used more than once`),s.add(j.id),j.element.addEventListener("keydown",Wt)}),ye.get(h)===1&&(h.addEventListener("dblclick",qt,!0),h.addEventListener("pointerdown",Ut,!0),h.addEventListener("pointerleave",Qt),h.addEventListener("pointermove",Zt),h.addEventListener("pointerout",Jt),h.addEventListener("pointerup",en,!0)),function(){t=!1,ye.set(h,Math.max(0,(ye.get(h)??0)-1)),js(e),e.separators.forEach(j=>{j.element.removeEventListener("keydown",Wt)}),ye.get(h)||(h.removeEventListener("dblclick",qt,!0),h.removeEventListener("pointerdown",Ut,!0),h.removeEventListener("pointerleave",Qt),h.removeEventListener("pointermove",Zt),h.removeEventListener("pointerout",Jt),h.removeEventListener("pointerup",en,!0)),o.disconnect()}}function Vs(){const[e,t]=d.useState({}),n=d.useCallback(()=>t({}),[]);return[e,n]}function bt(e){const t=d.useId();return`${e??t}`}const ge=typeof window<"u"?d.useLayoutEffect:d.useEffect;function Te(e){const t=d.useRef(e);return ge(()=>{t.current=e},[e]),d.useCallback((...n)=>{var r;return(r=t.current)==null?void 0:r.call(t,...n)},[t])}function vt(...e){return Te(t=>{e.forEach(n=>{if(n)switch(typeof n){case"function":{n(t);break}case"object":{n.current=t;break}}})})}function yt(e){const t=d.useRef({...e});return ge(()=>{for(const n in e)t.current[n]=e[n]},[e]),t.current}const Mn=d.createContext(null);function Bs(e,t){const n=d.useRef({getLayout:()=>({}),setLayout:Ds});d.useImperativeHandle(t,()=>n.current,[]),ge(()=>{Object.assign(n.current,kn({groupId:e}))})}function ut({children:e,className:t,defaultLayout:n,disableCursor:r,disabled:s,elementRef:o,groupRef:f,id:i,onLayoutChange:l,onLayoutChanged:c,orientation:p="horizontal",resizeTargetMinimumSize:v={coarse:20,fine:10},style:h,...w}){const j=d.useRef({onLayoutChange:{},onLayoutChanged:{}}),g=Te(M=>{pe(j.current.onLayoutChange,M)||(j.current.onLayoutChange=M,l==null||l(M))}),y=Te(M=>{pe(j.current.onLayoutChanged,M)||(j.current.onLayoutChanged=M,c==null||c(M))}),x=bt(i),m=d.useRef(null),[k,S]=Vs(),b=d.useRef({lastExpandedPanelSizes:{},layouts:{},panels:[],resizeTargetMinimumSize:v,separators:[]}),P=vt(m,o);Bs(x,f);const N=Te((M,E)=>{const V=he(),A=_t(M),z=de(M);if(z){let D=!1;switch(V.state){case"active":{D=V.hitRegions.some(U=>U.group===A);break}}return{flexGrow:z.layout[E]??1,pointerEvents:D?"none":void 0}}return{flexGrow:(n==null?void 0:n[E])??1}}),I=yt({defaultLayout:n,disableCursor:r}),H=d.useMemo(()=>({get disableCursor(){return!!I.disableCursor},getPanelStyles:N,id:x,orientation:p,registerPanel:M=>{const E=b.current;return E.panels=dt(p,[...E.panels,M]),S(),()=>{E.panels=E.panels.filter(V=>V!==M),S()}},registerSeparator:M=>{const E=b.current;return E.separators=dt(p,[...E.separators,M]),S(),()=>{E.separators=E.separators.filter(V=>V!==M),S()}},togglePanelDisabled:(M,E)=>{const V=b.current.panels.find(D=>D.id===M);V&&(V.panelConstraints.disabled=E);const A=_t(x),z=de(x);A&&z&&oe(A,{...z,derivedPanelConstraints:ct(A)})},toggleSeparatorDisabled:(M,E)=>{const V=b.current.separators.find(A=>A.id===M);V&&(V.disabled=E)}}),[N,x,S,p,I]),L=d.useRef(null);return ge(()=>{const M=m.current;if(M===null)return;const E=b.current;let V;if(I.defaultLayout!==void 0&&Object.keys(I.defaultLayout).length===E.panels.length){V={};for(const ee of E.panels){const O=I.defaultLayout[ee.id];O!==void 0&&(V[ee.id]=O)}}const A={disabled:!!s,element:M,id:x,mutableState:{defaultLayout:V,disableCursor:!!I.disableCursor,expandedPanelSizes:b.current.lastExpandedPanelSizes,layouts:b.current.layouts},orientation:p,panels:E.panels,resizeTargetMinimumSize:E.resizeTargetMinimumSize,separators:E.separators};L.current=A;const z=_s(A),{defaultLayoutDeferred:D,derivedPanelConstraints:U,layout:Z}=de(A.id,!0);!D&&U.length>0&&(g(Z),y(Z));const J=mt(x,ee=>{const{defaultLayoutDeferred:O,derivedPanelConstraints:$,layout:R}=ee.next;if(O||$.length===0)return;const G=A.panels.map(({id:Q})=>Q).join(",");A.mutableState.layouts[G]=R,$.forEach(Q=>{if(Q.collapsible){const{layout:Ce}=ee.prev??{};if(Ce){const be=K(Q.collapsedSize,R[Q.panelId]),et=K(Q.collapsedSize,Ce[Q.panelId]);be&&!et&&(A.mutableState.expandedPanelSizes[Q.panelId]=Ce[Q.panelId])}}});const te=he().state!=="active";g(R),te&&y(R)});return()=>{L.current=null,z(),J()}},[s,x,y,g,p,k,I]),d.useEffect(()=>{const M=L.current;M&&(M.mutableState.defaultLayout=n,M.mutableState.disableCursor=!!r)}),a.jsx(Mn.Provider,{value:H,children:a.jsx("div",{...w,className:t,"data-group":!0,"data-testid":x,id:x,ref:P,style:{height:"100%",width:"100%",overflow:"hidden",...h,display:"flex",flexDirection:p==="horizontal"?"row":"column",flexWrap:"nowrap",touchAction:p==="horizontal"?"pan-y":"pan-x"},children:e})})}ut.displayName="Group";function wt(){const e=d.useContext(Mn);return B(e,"Group Context not found; did you render a Panel or Separator outside of a Group?"),e}function Hs(e,t){const{id:n}=wt(),r=d.useRef({collapse:lt,expand:lt,getSize:()=>({asPercentage:0,inPixels:0}),isCollapsed:()=>!1,resize:lt});d.useImperativeHandle(t,()=>r.current,[]),ge(()=>{Object.assign(r.current,jn({groupId:n,panelId:e}))})}function $e({children:e,className:t,collapsedSize:n="0%",collapsible:r=!1,defaultSize:s,disabled:o,elementRef:f,groupResizeBehavior:i="preserve-relative-size",id:l,maxSize:c="100%",minSize:p="0%",onResize:v,panelRef:h,style:w,...j}){const g=!!l,y=bt(l),x=yt({disabled:o}),m=d.useRef(null),k=vt(m,f),{getPanelStyles:S,id:b,orientation:P,registerPanel:N,togglePanelDisabled:I}=wt(),H=v!==null,L=Te((E,V,A)=>{v==null||v(E,l,A)});ge(()=>{const E=m.current;if(E!==null){const V={element:E,id:y,idIsStable:g,mutableValues:{expandToSize:void 0,prevSize:void 0},onResize:H?L:void 0,panelConstraints:{groupResizeBehavior:i,collapsedSize:n,collapsible:r,defaultSize:s,disabled:x.disabled,maxSize:c,minSize:p}};return N(V)}},[i,n,r,s,H,y,g,c,p,L,N,x]),d.useEffect(()=>{I(y,!!o)},[o,y,I]),Hs(y,h);const M=d.useSyncExternalStore(E=>mt(b,E),()=>JSON.stringify(S(b,y)),()=>JSON.stringify(S(b,y)));return a.jsx("div",{...j,"aria-disabled":o||void 0,"data-panel":!0,"data-testid":y,id:y,ref:k,style:{...qs,display:"flex",flexBasis:0,flexShrink:1,overflow:"visible",...JSON.parse(M)},children:a.jsx("div",{className:t,style:{maxHeight:"100%",maxWidth:"100%",flexGrow:1,overflow:"auto",...w,touchAction:P==="horizontal"?"pan-y":"pan-x"},children:e})})}$e.displayName="Panel";const qs={minHeight:0,maxHeight:"100%",height:"auto",minWidth:0,maxWidth:"100%",width:"auto",border:"none",borderWidth:0,padding:0,margin:0};function Ws({layout:e,panelConstraints:t,panelId:n,panelIndex:r}){let s,o;const f=e[n],i=t.find(l=>l.panelId===n);if(i){const l=i.maxSize,c=i.collapsible?i.collapsedSize:i.minSize,p=[r,r+1];o=me({layout:Fe({delta:c-f,initialLayout:e,panelConstraints:t,pivotIndices:p,prevLayout:e}),panelConstraints:t})[n],s=me({layout:Fe({delta:l-f,initialLayout:e,panelConstraints:t,pivotIndices:p,prevLayout:e}),panelConstraints:t})[n]}return{valueControls:n,valueMax:s,valueMin:o,valueNow:f}}function ft({children:e,className:t,disabled:n,elementRef:r,id:s,style:o,...f}){const i=bt(s),l=yt({disabled:n}),[c,p]=d.useState({}),[v,h]=d.useState("inactive"),w=d.useRef(null),j=vt(w,r),{disableCursor:g,id:y,orientation:x,registerSeparator:m,toggleSeparatorDisabled:k}=wt(),S=x==="horizontal"?"vertical":"horizontal";ge(()=>{const P=w.current;if(P!==null){const N={disabled:l.disabled,element:P,id:i},I=m(N),H=Ls(M=>{h(M.next.state!=="inactive"&&M.next.hitRegions.some(E=>E.separator===N)?M.next.state:"inactive")}),L=mt(y,M=>{const{derivedPanelConstraints:E,layout:V,separatorToPanels:A}=M.next,z=A.get(N);if(z){const D=z[0],U=z.indexOf(D);p(Ws({layout:V,panelConstraints:E,panelId:D.id,panelIndex:U}))}});return()=>{H(),L(),I()}}},[y,i,m,l]),d.useEffect(()=>{k(i,!!n)},[n,i,k]);let b;return n&&!g&&(b="not-allowed"),a.jsx("div",{...f,"aria-controls":c.valueControls,"aria-disabled":n||void 0,"aria-orientation":S,"aria-valuemax":c.valueMax,"aria-valuemin":c.valueMin,"aria-valuenow":c.valueNow,children:e,className:t,"data-separator":n?"disabled":v,"data-testid":i,id:i,ref:j,role:"separator",style:{flexBasis:"auto",cursor:b,...o,flexGrow:0,flexShrink:0,touchAction:"none"},tabIndex:n?void 0:0})}ft.displayName="Separator";const Us={ghost:"hover:bg-[#F8F4F0] text-[#36342E]",subtle:"hover:bg-[#ECEAE3] text-[#6B6960]"},Gs={sm:"w-7 h-7",md:"w-8 h-8"},Ks={sm:14,md:16};function ie({icon:e,label:t,size:n="md",variant:r="ghost",onClick:s,className:o="",disabled:f=!1,title:i}){return a.jsx("button",{type:"button","aria-label":t,title:i??t,disabled:f,onClick:s,className:["inline-flex items-center justify-center rounded-btn transition-colors",Us[r],Gs[n],f?"opacity-40 cursor-not-allowed":"",o].filter(Boolean).join(" "),children:a.jsx(e,{size:Ks[n]})})}function Xs({x:e,y:t,items:n,onClose:r}){const[s,o]=d.useState(0),f=d.useRef(null),i=d.useRef([]);d.useEffect(()=>{var c;(c=i.current[0])==null||c.focus()},[]),d.useEffect(()=>{const c=p=>{f.current&&!f.current.contains(p.target)&&r()};return document.addEventListener("mousedown",c),()=>document.removeEventListener("mousedown",c)},[r]);const l=d.useCallback(c=>{var p,v;switch(c.key){case"Escape":c.preventDefault(),r();break;case"ArrowDown":c.preventDefault(),o(h=>{var j;const w=(h+1)%n.length;return(j=i.current[w])==null||j.focus(),w});break;case"ArrowUp":c.preventDefault(),o(h=>{var j;const w=(h-1+n.length)%n.length;return(j=i.current[w])==null||j.focus(),w});break;case"Home":c.preventDefault(),o(0),(p=i.current[0])==null||p.focus();break;case"End":c.preventDefault(),o(n.length-1),(v=i.current[n.length-1])==null||v.focus();break}},[n.length,r]);return a.jsx("div",{ref:f,role:"menu",className:"bg-card border border-border rounded-card shadow-card-hover py-1 min-w-[160px]",style:{position:"fixed",left:e,top:t,zIndex:100},onKeyDown:l,children:n.map((c,p)=>{const v=c.icon,h=c.variant==="danger";return a.jsxs("button",{ref:w=>{i.current[p]=w},role:"menuitem",tabIndex:s===p?0:-1,onClick:()=>{c.onClick(),r()},className:["flex items-center gap-2 w-full text-left px-3 py-2 text-sm transition-colors",h?"text-danger hover:bg-danger/10":"text-ink hover:bg-hover"].join(" "),children:[a.jsx(v,{size:14}),c.label]},c.label)})})}function Ys({sessionId:e,defaultMode:t}){const[n,r]=d.useState([]),[s,o]=d.useState(""),[f,i]=d.useState(t||"quick"),[l,c]=d.useState(!1),p=d.useRef(null),v=d.useRef(null);d.useEffect(()=>{p.current&&(p.current.scrollTop=p.current.scrollHeight)},[n]);const h=async()=>{var g;const w=s.trim();if(!w||l)return;const j={role:"user",content:w,timestamp:new Date().toISOString()};r(y=>[...y,j]),o(""),c(!0);try{const{task_id:y}=await W.chatStart(e,w,f);let x;const m=150;let k=0;do await new Promise(b=>setTimeout(b,2e3)),x=await W.chatPoll(e,y),k++,k>=m&&(x={complete:!0,output_lines:["Build timed out after 5 minutes."],files_changed:[],returncode:1});while(!x.complete);const S={role:"system",content:x.output_lines.join(`
|
|
162
|
-
`)||"Done.",timestamp:new Date().toISOString(),filesChanged:x.files_changed};r(b=>[...b,S])}catch(y){const x={role:"system",content:`Error: ${y instanceof Error?y.message:"Request failed"}`,timestamp:new Date().toISOString()};r(m=>[...m,x])}finally{c(!1),(g=v.current)==null||g.focus()}};return a.jsxs("div",{className:"flex flex-col h-full",children:[a.jsxs("div",{ref:p,className:"flex-1 overflow-y-auto p-3 space-y-3 terminal-scroll",children:[n.length===0&&a.jsx("div",{className:"text-xs text-muted text-center py-8",children:"Send a message to iterate on your project."}),n.map((w,j)=>a.jsx("div",{className:`flex ${w.role==="user"?"justify-end":"justify-start"}`,children:a.jsxs("div",{className:`max-w-[80%] rounded-lg px-3 py-2 text-xs ${w.role==="user"?"bg-primary/10 text-ink":"bg-hover text-ink"}`,children:[a.jsx("p",{className:"whitespace-pre-wrap",children:w.content}),w.filesChanged&&w.filesChanged.length>0&&a.jsxs("div",{className:"mt-2 pt-2 border-t border-border",children:[a.jsx("span",{className:"text-xs text-muted font-semibold uppercase",children:"Files changed:"}),a.jsx("ul",{className:"mt-1 space-y-0.5",children:w.filesChanged.map((g,y)=>a.jsx("li",{className:"text-xs font-mono text-muted",children:g},y))})]})]})},j)),l&&a.jsx("div",{className:"flex justify-start",children:a.jsxs("div",{className:"bg-hover text-ink rounded-lg px-3 py-2 text-xs",children:["Building",a.jsx("span",{className:"animate-pulse",children:"..."})]})})]}),a.jsxs("div",{className:"border-t border-border p-2 flex-shrink-0",children:[a.jsx("div",{className:"flex items-center gap-1 mb-2",children:["quick","standard","max"].map(w=>a.jsx("button",{onClick:()=>i(w),className:`text-xs font-semibold px-3 py-1.5 rounded-btn transition-colors capitalize ${f===w?"bg-primary text-white":"text-muted hover:text-ink"}`,children:w},w))}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("input",{ref:v,type:"text",value:s,onChange:w=>o(w.target.value),onKeyDown:w=>{w.key==="Enter"&&!w.shiftKey&&(w.preventDefault(),h())},placeholder:"Ask AI to modify your project...",className:"flex-1 px-3 py-1.5 text-xs bg-card border border-border rounded-btn outline-none focus:border-primary transition-colors",disabled:l}),a.jsx(Xe,{size:"sm",icon:Gr,onClick:h,disabled:l||!s.trim(),"aria-label":"Send message",children:"Send"})]})]})]})}const nn=[{id:"build",label:"Build Log",icon:sn},{id:"agents",label:"Agents",icon:ur},{id:"quality",label:"Quality",icon:Qr},{id:"chat",label:"AI Chat",icon:Vr}];function Qs({status:e}){switch(e){case"pass":return a.jsx(ar,{size:14,className:"text-success"});case"fail":return a.jsx(Qe,{size:14,className:"text-danger"});default:return a.jsx(rr,{size:14,className:"text-muted"})}}function Zs({agents:e}){return!e||e.length===0?a.jsx("div",{className:"p-4 text-xs text-muted",children:"No agents running."}):a.jsx("div",{className:"p-2 space-y-1 overflow-y-auto terminal-scroll",children:e.map(t=>a.jsxs("div",{className:"flex items-center gap-2 px-3 py-2 rounded-btn bg-hover text-xs",children:[a.jsx("span",{className:"font-semibold text-ink truncate",children:t.name}),a.jsx("span",{className:"text-xs font-mono text-muted-accessible px-1.5 py-0.5 rounded-btn bg-card",children:t.type}),a.jsx("span",{className:`text-xs font-semibold ${t.status==="running"?"text-success":"text-muted"}`,children:t.status}),a.jsx("span",{className:"ml-auto text-xs text-muted-accessible font-mono truncate max-w-[200px]",children:t.task})]},t.id))})}function Js({checklist:e}){return!e||!e.items||e.items.length===0?a.jsx("div",{className:"p-4 text-xs text-muted",children:"No quality gate data available."}):a.jsxs("div",{className:"p-2 space-y-1 overflow-y-auto terminal-scroll",children:[a.jsxs("div",{className:"flex items-center gap-3 px-3 py-2 text-xs text-muted-accessible font-semibold uppercase",children:[a.jsx("span",{children:"Gate"}),a.jsxs("span",{className:"ml-auto",children:[e.passed,"/",e.total," passed"]})]}),e.items.map(t=>a.jsxs("div",{className:"flex items-center gap-2 px-3 py-1.5 rounded-btn hover:bg-hover text-xs",children:[a.jsx(Qs,{status:t.status}),a.jsx("span",{className:"text-ink",children:t.label}),t.details&&a.jsx("span",{className:"ml-auto text-xs text-muted-accessible truncate max-w-[200px]",children:t.details})]},t.id))]})}function eo({logs:e,logsLoading:t,agents:n,checklist:r,sessionId:s,subscribe:o,buildMode:f}){var c;const[i,l]=d.useState("build");return a.jsxs("div",{className:"h-full flex flex-col bg-card",children:[a.jsx("div",{role:"tablist",className:"flex items-center border-b border-border px-2 flex-shrink-0",children:nn.map(p=>{const v=p.icon,h=i===p.id;return a.jsxs("button",{role:"tab","aria-selected":h,onClick:()=>l(p.id),className:`flex items-center gap-1.5 px-3 py-2 text-xs font-medium transition-colors border-b-2 ${h?"border-primary text-primary":"border-transparent text-muted hover:text-ink"}`,children:[a.jsx(v,{size:14}),p.label]},p.id)})}),a.jsxs("div",{role:"tabpanel","aria-label":(c=nn.find(p=>p.id===i))==null?void 0:c.label,className:"flex-1 min-h-0 overflow-hidden",children:[i==="build"&&a.jsx(Qn,{logs:e,loading:t,subscribe:o}),i==="agents"&&a.jsx(Zs,{agents:n}),i==="quality"&&a.jsx(Js,{checklist:r}),i==="chat"&&a.jsx(Ys,{sessionId:s,defaultMode:f})]})]})}function pt(e,t,n){var o;if(t==="directory")return n?a.jsx(an,{size:14}):a.jsx(Tr,{size:14});const r=((o=e.split(".").pop())==null?void 0:o.toLowerCase())||"";return{js:a.jsx(se,{size:14,className:"text-yellow-600"}),ts:a.jsx(se,{size:14,className:"text-blue-500"}),tsx:a.jsx(se,{size:14,className:"text-blue-400"}),jsx:a.jsx(se,{size:14,className:"text-yellow-500"}),py:a.jsx(se,{size:14,className:"text-green-600"}),html:a.jsx(zr,{size:14,className:"text-orange-500"}),css:a.jsx(Er,{size:14,className:"text-purple-500"}),json:a.jsx(jr,{size:14,className:"text-green-500"}),md:a.jsx(rn,{size:14,className:"text-muted"}),go:a.jsx(se,{size:14,className:"text-cyan-600"}),rs:a.jsx(se,{size:14,className:"text-orange-600"}),rb:a.jsx(se,{size:14,className:"text-red-500"}),sh:a.jsx(se,{size:14,className:"text-green-600"})}[r]||a.jsx(Lr,{size:14})}function to(e){var s;const t=((s=e.split(".").pop())==null?void 0:s.toLowerCase())||"",n={js:"javascript",jsx:"javascript",ts:"typescript",tsx:"typescript",py:"python",html:"html",htm:"html",css:"css",scss:"scss",less:"less",json:"json",md:"markdown",go:"go",rs:"rust",sh:"shell",bash:"shell",yml:"yaml",yaml:"yaml",xml:"xml",svg:"xml",sql:"sql",java:"java",kt:"kotlin",rb:"ruby",dockerfile:"dockerfile"},r=e.toLowerCase();return r==="dockerfile"?"dockerfile":r==="makefile"?"makefile":n[t]||"plaintext"}function En(e,t){for(const n of e){if(n.path===t)return n.size;if(n.children){const r=En(n.children,t);if(r!==void 0)return r}}}function Rn(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}function Ln({nodes:e,selectedPath:t,onSelect:n,onDelete:r,onContextMenu:s,depth:o=0}){const[f,i]=d.useState(()=>{const l=new Set;return o<2&&e.filter(c=>c.type==="directory").forEach(c=>l.add(c.path)),l});return a.jsx("div",{role:o===0?"tree":"group",children:e.map(l=>{const c=l.type==="directory",p=f.has(l.path),v=l.path===t;return a.jsxs("div",{className:"group/file",children:[a.jsxs("button",{role:"treeitem","aria-label":l.name,"aria-selected":v,...c?{"aria-expanded":p}:{},onContextMenu:h=>{h.preventDefault(),s==null||s(h,l.path,l.name,l.type)},onClick:()=>{c?i(h=>{const w=new Set(h);return w.has(l.path)?w.delete(l.path):w.add(l.path),w}):n(l.path,l.name)},className:`w-full text-left flex items-center gap-1.5 px-2 py-1 text-xs font-mono rounded transition-colors ${v?"bg-primary/10 text-primary":"text-ink/70 hover:bg-hover"}`,style:{paddingLeft:`${o*14+8}px`},children:[c?a.jsx("span",{className:"w-3 flex items-center justify-center flex-shrink-0 text-muted",children:p?a.jsx(pr,{size:14}):a.jsx(hr,{size:14})}):a.jsx("span",{className:"w-3 flex-shrink-0"}),a.jsx("span",{className:`w-5 flex items-center justify-center flex-shrink-0 ${c?"text-primary":""}`,children:pt(l.name,l.type,p)}),a.jsxs("span",{className:"truncate",children:[l.name,c?"/":""]}),!c&&l.size!=null&&l.size>0&&a.jsx("span",{className:"text-xs text-muted ml-auto flex-shrink-0",children:Rn(l.size)}),!c&&r&&a.jsx("span",{role:"button",tabIndex:-1,onClick:h=>{h.stopPropagation(),r(l.path,l.name)},onKeyDown:h=>{h.key==="Enter"&&(h.stopPropagation(),r(l.path,l.name))},className:"text-muted hover:text-danger ml-1 flex-shrink-0 opacity-0 group-hover/file:opacity-100 transition-opacity cursor-pointer",title:"Delete file",children:a.jsx(Qe,{size:12})})]}),c&&p&&l.children&&a.jsx(Ln,{nodes:l.children,selectedPath:t,onSelect:n,onDelete:r,onContextMenu:s,depth:o+1})]},l.path)})})}function On(e,t=""){const n=[];for(const r of e)r.type==="file"&&n.push({path:r.path,name:r.name}),r.children&&n.push(...On(r.children,r.path+"/"));return n}function no(){const[e,t]=d.useState({}),[n,r]=d.useState(""),[s,o]=d.useState(""),[f,i]=d.useState(!0),[l,c]=d.useState(null),[p,v]=d.useState(new Set),h=d.useCallback(async()=>{try{const x=await W.getSecrets();t(x)}catch{}i(!1)},[]);d.useEffect(()=>{h()},[h]);const w=async()=>{const x=n.trim();if(x){if(!/^[A-Z_][A-Z0-9_]*$/.test(x)){c("Key must be a valid ENV_VAR name (uppercase letters, digits, underscores)");return}c(null);try{await W.setSecret(x,s),r(""),o(""),await h()}catch(m){c(m instanceof Error?m.message:"Failed to set secret")}}},j=async x=>{if(window.confirm(`Delete secret "${x}"?`))try{await W.deleteSecret(x),await h()}catch(m){c(m instanceof Error?m.message:"Failed to delete secret")}},g=x=>{v(m=>{const k=new Set(m);return k.has(x)?k.delete(x):k.add(x),k})},y=Object.keys(e);return f?a.jsx("div",{className:"p-6",children:a.jsx("div",{className:"text-sm text-muted animate-pulse",children:"Loading secrets..."})}):a.jsx("div",{className:"h-full flex flex-col",children:a.jsxs("div",{className:"p-6 overflow-y-auto",children:[a.jsx("h3",{className:"text-h3 font-heading text-ink mb-2",children:"Environment Secrets"}),a.jsxs("div",{className:"flex items-start gap-2 px-4 py-3 rounded-btn border border-warning/30 bg-warning/5 mb-6",children:[a.jsx(na,{size:16,className:"text-warning flex-shrink-0 mt-0.5"}),a.jsx("p",{className:"text-xs text-warning leading-relaxed",children:"Secrets are stored locally in plaintext and injected as environment variables during builds. They are never committed to the project repository."})]}),y.length>0&&a.jsx("div",{className:"card mb-6",children:a.jsxs("table",{className:"w-full text-sm",children:[a.jsx("thead",{children:a.jsxs("tr",{className:"border-b border-border",children:[a.jsx("th",{className:"text-left px-4 py-2 text-xs font-semibold text-muted-accessible uppercase tracking-wider",children:"Key"}),a.jsx("th",{className:"text-left px-4 py-2 text-xs font-semibold text-muted-accessible uppercase tracking-wider",children:"Value"}),a.jsx("th",{className:"w-20 px-4 py-2"})]})}),a.jsx("tbody",{children:y.map(x=>a.jsxs("tr",{className:"border-b border-border last:border-b-0",children:[a.jsx("td",{className:"px-4 py-2.5 font-mono text-xs text-ink",children:x}),a.jsx("td",{className:"px-4 py-2.5 font-mono text-xs text-muted-accessible",children:a.jsxs("span",{className:"flex items-center gap-2",children:[a.jsx("span",{children:p.has(x)?e[x]:"***"}),a.jsx("button",{onClick:()=>g(x),className:"text-muted hover:text-ink transition-colors",title:p.has(x)?"Hide value":"Show value",children:p.has(x)?a.jsx(vr,{size:14}):a.jsx(Le,{size:14})})]})}),a.jsx("td",{className:"px-4 py-2.5 text-right",children:a.jsx("button",{onClick:()=>j(x),className:"text-muted hover:text-danger transition-colors",title:"Delete secret",children:a.jsx(on,{size:14})})})]},x))})]})}),y.length===0&&a.jsx("div",{className:"card p-4 mb-6",children:a.jsx("p",{className:"text-sm text-muted-accessible text-center py-4",children:"No secrets configured yet. Add your first secret below."})}),a.jsxs("div",{className:"card p-4",children:[a.jsx("label",{className:"block text-xs font-semibold text-muted-accessible uppercase tracking-wider mb-3",children:"Add Secret"}),l&&a.jsx("div",{className:"text-xs text-danger mb-3 px-1",children:l}),a.jsxs("div",{className:"flex items-end gap-3",children:[a.jsxs("div",{className:"flex-1",children:[a.jsx("label",{className:"block text-xs text-muted-accessible mb-1",children:"Key"}),a.jsx("input",{type:"text",value:n,onChange:x=>r(x.target.value.toUpperCase()),placeholder:"API_KEY",className:"w-full px-3 py-2 text-sm font-mono bg-hover border border-border rounded-btn text-ink placeholder:text-muted"})]}),a.jsxs("div",{className:"flex-1",children:[a.jsx("label",{className:"block text-xs text-muted-accessible mb-1",children:"Value"}),a.jsx("input",{type:"password",value:s,onChange:x=>o(x.target.value),placeholder:"secret value",className:"w-full px-3 py-2 text-sm font-mono bg-hover border border-border rounded-btn text-ink placeholder:text-muted"})]}),a.jsxs("button",{onClick:w,disabled:!n.trim(),className:"flex items-center gap-1.5 px-4 py-2 text-sm font-medium rounded-btn border border-primary bg-primary/10 text-primary hover:bg-primary/20 transition-colors disabled:opacity-40 disabled:cursor-not-allowed",children:[a.jsx(nr,{size:14}),"Add"]})]})]})]})})}function ro({session:e,onClose:t}){var Pt;const[n,r]=d.useState(null),[s,o]=d.useState(""),[f,i]=d.useState(null),[l,c]=d.useState(null),[p,v]=d.useState(!1),[h,w]=d.useState("code"),[j,g]=d.useState(!1),[y,x]=d.useState(!1),[m,k]=d.useState(e),S=d.useRef(null),[b,P]=d.useState([]),[N,I]=d.useState(!1),[H,L]=d.useState(""),M=d.useRef(null),E=d.useRef(null),[V,A]=d.useState(0),[z,D]=d.useState(null),[U,Z]=d.useState("standard"),[J,ee]=d.useState("claude"),[O,$]=d.useState(null),[R,G]=d.useState(null),[te,Q]=d.useState(!1),[Ce,be]=d.useState(!1),et=d.useCallback(async()=>{try{await W.stopSession(),Q(!1),be(!1)}catch{}},[]),Dn=d.useCallback(async()=>{try{await W.pauseSession(),be(!0)}catch{}},[]),$n=d.useCallback(async()=>{try{await W.resumeSession(),be(!1)}catch{}},[]);d.useEffect(()=>{const u=async()=>{try{const T=await W.getStatus();Q(T.running),be(T.paused),T.provider&&ee(T.provider)}catch{}};u();const C=setInterval(u,1e4);return()=>clearInterval(C)},[]),d.useEffect(()=>{if(!(R!=null&&R.loading))return;const u=setInterval(()=>{G(C=>C?{...C,elapsed:Math.floor((Date.now()-C.startTime)/1e3)}:null)},1e3);return()=>clearInterval(u)},[R==null?void 0:R.loading]);const[F,In]=d.useState(null);d.useEffect(()=>{W.getPreviewInfo(m.id).then(In).catch(()=>{})},[m.id]);const Tn=(F==null?void 0:F.preview_url)||`/api/sessions/${encodeURIComponent(m.id)}/preview/index.html`,[Ve,jt]=d.useState([]),[ae,Be]=d.useState(0);d.useEffect(()=>{F!=null&&F.preview_url&&(jt([F.preview_url]),Be(0))},[F==null?void 0:F.preview_url]);const Pe=Ve[ae]||Tn,[kt,St]=d.useState(Pe),ve=d.useCallback(async()=>{try{const u=await W.getSessionDetail(m.id);k(u)}catch{}},[m.id]),An=d.useCallback((u,C,T,q)=>{u.preventDefault(),D({x:u.clientX,y:u.clientY,path:C,name:T,type:q})},[]),Fn=d.useCallback(()=>{ae>0&&(Be(u=>u-1),A(u=>u+1))},[ae]),_n=d.useCallback(()=>{ae<Ve.length-1&&(Be(u=>u+1),A(u=>u+1))},[ae,Ve.length]),Vn=d.useCallback(u=>{jt(C=>[...C.slice(0,ae+1),u]),Be(C=>C+1),A(C=>C+1)},[ae]);d.useEffect(()=>{St(Pe)},[Pe]);const He=d.useCallback(async()=>{G({type:"review",loading:!0,startTime:Date.now(),elapsed:0}),$(null);try{const u=await W.reviewProject(m.id);$(u.output)}catch(u){$(`Error: ${u instanceof Error?u.message:"Unknown"}`)}finally{G(null)}},[m.id]),qe=d.useCallback(async()=>{G({type:"test",loading:!0,startTime:Date.now(),elapsed:0}),$(null);try{const u=await W.testProject(m.id);$(u.output)}catch(u){$(`Error: ${u instanceof Error?u.message:"Unknown"}`)}finally{G(null)}},[m.id]),tt=d.useCallback(async()=>{G({type:"explain",loading:!0,startTime:Date.now(),elapsed:0}),$(null);try{const u=await W.explainProject(m.id);$(u.output)}catch(u){$(`Error: ${u instanceof Error?u.message:"Unknown"}`)}finally{G(null)}},[m.id]),nt=d.useCallback(async(u,C)=>{if(window.confirm(`Delete "${C}"?`))try{await W.deleteSessionFile(m.id,u),n===u&&(r(null),o(""),i(null),c(null),g(!1)),await ve()}catch(q){const ue=q instanceof Error?q.message:"Unknown error";window.alert(`Delete failed: ${ue}`)}},[m.id,n,ve]),Bn=d.useCallback(u=>u.type==="file"?[{label:"Review",icon:Le,onClick:()=>{He()}},{label:"Generate Tests",icon:at,onClick:()=>{qe()}},{label:"Explain",icon:Ot,onClick:()=>{tt()}},{label:"Delete",icon:on,onClick:()=>{nt(u.path,u.name)},variant:"danger"}]:[{label:"Review Project",icon:Le,onClick:()=>{He()}},{label:"Run Tests",icon:at,onClick:()=>{qe()}}],[He,qe,tt,nt]),Me=d.useCallback(async(u,C)=>{j&&n&&l!==null&&P(q=>q.map(ue=>ue.path===n?{...ue,content:l,modified:!0}:ue));const T=b.find(q=>q.path===u);if(T){r(u),o(C),i(T.content),c(T.content),g(T.modified);return}r(u),o(C),v(!0),g(!1);try{const q=m.id?await W.getSessionFileContent(m.id,u):await W.getFileContent(u);i(q.content),c(q.content),P(ue=>[...ue,{path:u,name:C,content:q.content,modified:!1}])}catch{i("[Error loading file]"),c("[Error loading file]")}finally{v(!1)}},[m.id,j,n,l,b]),rt=d.useCallback(async()=>{var u;if(!(!n||l===null||!m.id)){x(!0);try{await W.saveSessionFile(m.id,n,l),i(l),g(!1),P(T=>T.map(q=>q.path===n?{...q,content:l,modified:!1}:q));const C=((u=n.split(".").pop())==null?void 0:u.toLowerCase())||"";["html","css","js","jsx","ts","tsx"].includes(C)&&A(T=>T+1)}catch(C){const T=C instanceof Error?C.message:"Unknown error";window.alert(`Save failed: ${T}`)}finally{x(!1)}}},[n,l,m.id]),zt=d.useCallback(u=>{const C=b.find(T=>T.path===u);if(!(C!=null&&C.modified&&!window.confirm("Unsaved changes. Close anyway?"))&&(P(T=>T.filter(q=>q.path!==u)),n===u)){const T=b.filter(q=>q.path!==u);if(T.length>0){const q=T[T.length-1];r(q.path),o(q.name),i(q.content),c(q.content),g(q.modified)}else r(null),o(""),i(null),c(null),g(!1)}},[b,n]);d.useEffect(()=>{const u=C=>{(C.metaKey||C.ctrlKey)&&C.key==="s"&&(C.preventDefault(),j&&n&&rt()),(C.metaKey||C.ctrlKey)&&C.key==="p"&&(C.preventDefault(),I(T=>!T),L("")),C.key==="Escape"&&N&&I(!1)};return window.addEventListener("keydown",u),()=>window.removeEventListener("keydown",u)},[j,n,rt,N]),d.useEffect(()=>{N&&M.current&&M.current.focus()},[N]);const Nt=On(m.files),Ee=H?Nt.filter(u=>u.path.toLowerCase().includes(H.toLowerCase())):Nt;d.useEffect(()=>{const u=m.files.find(C=>C.name==="index.html"&&C.type==="file");u&&Me(u.path,u.name)},[]);const Hn=d.useCallback(u=>{u!==void 0&&(c(u),g(u!==f))},[f]),qn=d.useCallback(u=>{S.current=u},[]),Wn=d.useCallback(async()=>{const u=window.prompt("New file name (e.g. src/utils.ts):");if(!(!u||!u.trim()))try{await W.createSessionFile(m.id,u.trim()),await ve()}catch(C){const T=C instanceof Error?C.message:"Unknown error";window.alert(`Create file failed: ${T}`)}},[m.id,ve]),Un=d.useCallback(async()=>{const u=window.prompt("New folder name (e.g. src/components):");if(!(!u||!u.trim()))try{await W.createSessionDirectory(m.id,u.trim()),await ve()}catch(C){const T=C instanceof Error?C.message:"Unknown error";window.alert(`Create folder failed: ${T}`)}},[m.id,ve]),Ct=n?En(m.files,n):void 0,Gn=((Pt=s.split(".").pop())==null?void 0:Pt.toUpperCase())||"";return a.jsxs("div",{className:"flex flex-col h-full relative",children:[a.jsxs("div",{className:"bg-card px-3 py-2 flex items-center gap-3 flex-shrink-0 border-b border-border",children:[a.jsx("button",{onClick:()=>{j&&!window.confirm("Unsaved changes. Discard?")||t()},className:"text-xs font-medium px-3 py-1.5 rounded-btn border border-border text-muted hover:text-ink hover:bg-hover transition-colors",children:"Back"}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsx("h2",{className:"text-sm font-bold text-ink truncate",children:m.id}),a.jsx("p",{className:"text-xs font-mono text-muted-accessible truncate",children:m.path})]}),a.jsx("span",{className:`text-xs font-semibold px-2 py-0.5 rounded-full ${m.status==="completed"||m.status==="completion_promise_fulfilled"?"bg-success/10 text-success":"bg-muted/10 text-muted"}`,children:m.status}),te&&a.jsxs("div",{className:"flex items-center gap-1 border-l border-border pl-3 ml-1",children:[Ce?a.jsx(Xe,{variant:"ghost",size:"sm",icon:Zn,onClick:$n,title:"Resume build",children:"Resume"}):a.jsx(Xe,{variant:"ghost",size:"sm",icon:Jn,onClick:Dn,title:"Pause build",children:"Pause"}),a.jsx(Xe,{variant:"danger",size:"sm",icon:er,onClick:et,title:"Stop build",children:"Stop"})]}),a.jsx(ie,{icon:Le,label:"Review project",size:"sm",onClick:He,disabled:!!(R!=null&&R.loading)}),a.jsx(ie,{icon:at,label:"Run tests",size:"sm",onClick:qe,disabled:!!(R!=null&&R.loading)}),a.jsx(ie,{icon:Ot,label:"Explain project",size:"sm",onClick:tt,disabled:!!(R!=null&&R.loading)})]}),a.jsx("div",{className:"flex-1 min-h-0",children:a.jsxs(ut,{orientation:"vertical",children:[a.jsx($e,{defaultSize:70,minSize:40,children:a.jsxs(ut,{orientation:"horizontal",className:"h-full",children:[a.jsx($e,{defaultSize:20,minSize:15,children:a.jsxs("div",{className:"h-full flex flex-col border-r border-border bg-card",children:[a.jsxs("div",{className:"px-3 py-2 border-b border-border flex items-center gap-2",children:[a.jsx("span",{className:"text-xs text-muted-accessible uppercase tracking-wider font-semibold flex-1",children:"Files"}),a.jsxs("button",{onClick:Wn,title:"New File",className:"flex items-center gap-1 text-xs text-muted-accessible hover:text-primary px-2.5 py-1 rounded border border-border hover:border-primary/30 transition-colors",children:[a.jsx(Cr,{size:12})," New"]}),a.jsxs("button",{onClick:Un,title:"New Folder",className:"flex items-center gap-1 text-xs text-muted-accessible hover:text-primary px-2.5 py-1 rounded border border-border hover:border-primary/30 transition-colors",children:[a.jsx($r,{size:12})," New"]})]}),a.jsx("div",{className:"flex-1 overflow-y-auto terminal-scroll",children:m.files.length>0?a.jsx(Ln,{nodes:m.files,selectedPath:n,onSelect:Me,onDelete:nt,onContextMenu:An}):a.jsx("div",{className:"p-4 text-xs text-muted",children:"No files"})})]})}),a.jsx(ft,{className:"w-1 bg-border hover:bg-primary/30 transition-colors cursor-col-resize"}),a.jsx($e,{defaultSize:80,minSize:40,children:a.jsxs("div",{className:"h-full flex flex-col min-w-0",children:[a.jsx("div",{className:"flex items-center border-b border-border bg-hover px-1 flex-shrink-0",role:"tablist",children:[{id:"code",label:"Code",icon:gr},{id:"preview",label:"Preview",icon:Le},{id:"config",label:"Config",icon:Kn},{id:"secrets",label:"Secrets",icon:Fr},{id:"prd",label:"PRD",icon:rn}].map(u=>a.jsxs("button",{role:"tab","aria-selected":h===u.id,onClick:()=>w(u.id),className:`flex items-center gap-1.5 px-4 py-2 text-xs font-medium border-b-2 transition-colors ${h===u.id?"border-primary text-primary":"border-transparent text-muted hover:text-ink hover:border-border"}`,children:[a.jsx(u.icon,{size:14}),u.label]},u.id))}),a.jsxs("div",{className:"flex-1 min-h-0",role:"tabpanel",children:[h==="code"&&a.jsxs("div",{className:"h-full flex flex-col min-w-0",children:[b.length>0&&a.jsx("div",{className:"flex items-center border-b border-border bg-hover overflow-x-auto flex-shrink-0",children:b.map(u=>a.jsxs("button",{onClick:()=>Me(u.path,u.name),className:`flex items-center gap-1.5 px-3 py-1.5 text-[11px] font-mono border-r border-border whitespace-nowrap transition-colors ${u.path===n?"bg-card text-ink":"text-muted hover:text-ink hover:bg-card"}`,children:[a.jsx("span",{className:"w-4 flex items-center justify-center",children:pt(u.name,"file")}),u.name,u.modified&&a.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-primary"}),a.jsx("span",{role:"button",tabIndex:-1,title:"Close tab",onClick:C=>{C.stopPropagation(),zt(u.path)},onKeyDown:C=>{C.key==="Enter"&&(C.stopPropagation(),zt(u.path))},className:"text-muted hover:text-danger ml-1 cursor-pointer",children:a.jsx(Qe,{size:12})})]},u.path))}),n?a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"px-4 py-1.5 border-b border-border flex items-center gap-2 flex-shrink-0 bg-hover",children:[a.jsx("span",{className:"text-xs font-mono text-secondary truncate",children:n}),y&&a.jsx("span",{className:"text-xs text-primary animate-pulse flex-shrink-0",children:"Saving..."}),a.jsx("span",{className:"ml-auto text-xs text-muted/50 font-mono",children:Ct!=null?Rn(Ct):""}),a.jsx("span",{className:"text-xs text-muted font-mono uppercase",children:Gn}),j&&a.jsx("button",{onClick:rt,className:"text-xs font-medium px-2 py-0.5 rounded border border-primary/40 bg-primary/10 text-primary hover:bg-primary/20 transition-colors",children:"Save"})]}),a.jsx("div",{className:"flex-1 min-h-0",children:p?a.jsx("div",{className:"text-muted text-xs animate-pulse p-4",children:"Loading..."}):a.jsx(fs,{value:l??"",language:to(s),theme:"vs",onChange:Hn,onMount:qn,options:{minimap:{enabled:!1},fontSize:13,lineNumbers:"on",wordWrap:"on",scrollBeyondLastLine:!1,automaticLayout:!0,padding:{top:8},renderLineHighlight:"line",smoothScrolling:!0,cursorBlinking:"smooth",folding:!0,bracketPairColorization:{enabled:!0}}})})]}):a.jsx("div",{className:"flex-1 flex items-center justify-center text-muted text-sm",children:"Select a file to view its contents"})]}),h==="preview"&&a.jsxs("div",{className:"h-full flex flex-col",children:[a.jsx("div",{className:"px-3 py-1.5 border-b border-border flex items-center gap-2 bg-hover",children:F!=null&&F.preview_url?a.jsxs(a.Fragment,{children:[a.jsx(ie,{icon:ir,label:"Back",size:"sm",onClick:Fn,disabled:ae<=0}),a.jsx(ie,{icon:cr,label:"Forward",size:"sm",onClick:_n,disabled:ae>=Ve.length-1}),a.jsx(ie,{icon:Wr,label:"Refresh",size:"sm",onClick:()=>A(u=>u+1)}),a.jsx("input",{value:kt,onChange:u=>St(u.target.value),onKeyDown:u=>{u.key==="Enter"&&Vn(kt)},className:"flex-1 px-3 py-1 text-xs font-mono bg-card border border-border rounded-btn"}),a.jsx(ie,{icon:sr,label:"Open in new tab",size:"sm",onClick:()=>window.open(Pe,"_blank")})]}):F?a.jsx("div",{className:"flex-1 flex items-center gap-2 text-sm text-muted",children:a.jsx("span",{className:"font-medium text-ink",children:F.description})}):a.jsx("div",{className:"flex-1 flex items-center text-sm text-muted",children:"Detecting project type..."})}),F!=null&&F.preview_url?a.jsx("div",{className:"flex-1 bg-white",children:a.jsx("iframe",{ref:E,src:Pe,title:"Project Preview",className:"w-full h-full border-0",sandbox:"allow-scripts allow-same-origin allow-forms allow-popups"},V)}):F?a.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center gap-4 p-8 text-center",children:[a.jsx("div",{className:"w-16 h-16 rounded-full bg-primary/10 flex items-center justify-center",children:F.type==="api"||F.type==="python-api"?a.jsx(Xr,{size:28,className:"text-primary"}):F.type==="library"?a.jsx(Hr,{size:28,className:"text-primary"}):F.type==="go-app"||F.type==="rust-app"?a.jsx(sn,{size:28,className:"text-primary"}):a.jsx(an,{size:28,className:"text-primary"})}),a.jsxs("div",{children:[a.jsx("h3",{className:"text-lg font-heading text-ink mb-1",children:F.type.replace(/-/g," ").replace(/\b\w/g,u=>u.toUpperCase())}),a.jsx("p",{className:"text-sm text-muted",children:F.description})]}),F.dev_command&&a.jsxs("div",{className:"card p-4 max-w-md w-full",children:[a.jsx("p",{className:"text-xs font-semibold text-muted-accessible uppercase tracking-wider mb-2",children:"Run locally"}),a.jsx("code",{className:"text-sm font-mono text-primary bg-hover px-3 py-2 rounded-btn block",children:F.dev_command})]}),F.port&&a.jsxs("p",{className:"text-xs text-muted",children:["Server runs on port ",F.port]})]}):a.jsx("div",{className:"flex-1 flex items-center justify-center text-muted text-sm",children:"Detecting project type..."})]}),h==="config"&&a.jsx("div",{className:"h-full flex flex-col",children:a.jsxs("div",{className:"p-6 overflow-y-auto",children:[a.jsx("h3",{className:"text-h3 font-heading text-ink mb-4",children:"Project Configuration"}),a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"card p-4",children:[a.jsx("label",{className:"block text-xs font-semibold text-muted-accessible uppercase tracking-wider mb-2",children:"Provider"}),a.jsxs("p",{className:"text-xs text-muted mb-2",children:["Current session: ",a.jsx("span",{className:"font-semibold text-ink capitalize",children:J})]}),a.jsx("div",{className:"flex gap-2",children:["claude","codex","gemini"].map(u=>a.jsx("button",{onClick:()=>{ee(u),W.setProvider(u).catch(()=>{})},className:`px-4 py-2 rounded-btn text-sm font-medium border transition-colors capitalize ${J===u?"border-primary bg-primary/10 text-primary":"border-border text-secondary hover:bg-hover"}`,children:u},u))})]}),a.jsxs("div",{className:"card p-4",children:[a.jsx("label",{className:"block text-xs font-semibold text-muted-accessible uppercase tracking-wider mb-2",children:"Build Mode"}),a.jsx("div",{className:"flex gap-2",children:["quick","standard","max"].map(u=>a.jsx("button",{onClick:()=>Z(u),className:`px-4 py-2 rounded-btn text-sm font-medium border transition-colors capitalize ${U===u?"border-primary bg-primary/10 text-primary":"border-border text-secondary hover:bg-hover"}`,children:u},u))})]}),a.jsxs("div",{className:"card p-4",children:[a.jsx("label",{className:"block text-xs font-semibold text-muted-accessible uppercase tracking-wider mb-2",children:"Project Path"}),a.jsx("input",{value:m.path,readOnly:!0,className:"w-full px-3 py-2 text-sm font-mono bg-hover border border-border rounded-btn text-ink"})]}),a.jsxs("div",{className:"card p-4",children:[a.jsx("label",{className:"block text-xs font-semibold text-muted-accessible uppercase tracking-wider mb-2",children:"Session ID"}),a.jsx("input",{value:m.id,readOnly:!0,className:"w-full px-3 py-2 text-sm font-mono bg-hover border border-border rounded-btn text-ink"})]})]})]})}),h==="secrets"&&a.jsx(no,{}),h==="prd"&&a.jsx("div",{className:"h-full flex flex-col",children:a.jsxs("div",{className:"p-6 overflow-y-auto",children:[a.jsx("h3",{className:"text-h3 font-heading text-ink mb-4",children:"Product Requirements"}),m.prd?a.jsx("pre",{className:"text-sm font-mono text-ink whitespace-pre-wrap bg-hover border border-border rounded-card p-4 leading-relaxed",children:m.prd}):a.jsx("div",{className:"text-sm text-muted text-center py-8",children:"No PRD found for this project."})]})})]})]})})]})}),a.jsx(ft,{className:"h-1 bg-border hover:bg-primary/30 cursor-row-resize"}),a.jsx($e,{defaultSize:30,minSize:15,collapsible:!0,children:a.jsx(eo,{logs:null,logsLoading:!1,agents:null,checklist:null,sessionId:e.id,buildMode:U})})]})}),(R==null?void 0:R.loading)&&a.jsx("div",{className:"absolute inset-x-0 bottom-0 z-20 bg-card border-t border-border p-4",children:a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("div",{className:"w-4 h-4 border-2 border-primary border-t-transparent rounded-full animate-spin"}),a.jsxs("span",{className:"text-sm font-medium text-ink",children:[R.type==="review"?"Reviewing project":R.type==="test"?"Generating tests":"Analyzing project","..."]}),a.jsxs("span",{className:"text-xs font-mono text-muted",children:[R.elapsed,"s"]})]})}),O&&a.jsxs("div",{className:"absolute inset-x-0 bottom-0 z-20 bg-card border-t border-border p-4 max-h-64 overflow-y-auto",children:[a.jsxs("div",{className:"flex items-center justify-between mb-2",children:[a.jsx("span",{className:"text-xs font-semibold text-ink",children:"Action Output"}),a.jsx(ie,{icon:Qe,label:"Close",size:"sm",onClick:()=>$(null)})]}),a.jsx("pre",{className:"text-xs font-mono text-ink whitespace-pre-wrap",children:O})]}),z&&a.jsx(Xs,{x:z.x,y:z.y,items:Bn(z),onClose:()=>D(null)}),N&&a.jsx("div",{className:"fixed inset-0 z-50 flex items-start justify-center pt-[20vh]",role:"dialog","aria-modal":"true","aria-label":"Quick open file search",onClick:()=>I(!1),children:a.jsxs("div",{className:"bg-card rounded-card shadow-2xl border border-border w-full max-w-lg",onClick:u=>u.stopPropagation(),children:[a.jsx("input",{ref:M,type:"text",value:H,onChange:u=>L(u.target.value),placeholder:"Search files by name...",className:"w-full px-4 py-3 text-sm font-mono border-b border-border outline-none rounded-t-card bg-transparent",onKeyDown:u=>{u.key==="Enter"&&Ee.length>0&&(Me(Ee[0].path,Ee[0].name),I(!1)),u.key==="Escape"&&I(!1)}}),a.jsxs("div",{className:"max-h-64 overflow-y-auto",children:[Ee.slice(0,20).map(u=>a.jsxs("button",{onClick:()=>{Me(u.path,u.name),I(!1)},className:"w-full text-left px-4 py-2 text-xs font-mono hover:bg-primary/5 flex items-center gap-2",children:[a.jsx("span",{className:"w-5 flex items-center justify-center",children:pt(u.name,"file")}),a.jsx("span",{className:"text-ink",children:u.name}),a.jsx("span",{className:"text-muted ml-auto truncate text-xs",children:u.path})]},u.path)),Ee.length===0&&a.jsx("div",{className:"px-4 py-3 text-xs text-muted",children:"No matching files"})]})]})})]})}function uo(){const{sessionId:e}=Xn(),t=Yn(),[n,r]=d.useState(null),[s,o]=d.useState(!0),[f,i]=d.useState(null);return d.useEffect(()=>{e&&(o(!0),i(null),W.getSessionDetail(e).then(l=>{r(l),o(!1)}).catch(l=>{i(l instanceof Error?l.message:"Failed to load session"),o(!1)}))},[e]),s?a.jsx("div",{className:"h-screen bg-background flex items-center justify-center",children:a.jsxs("div",{className:"text-center",children:[a.jsx("div",{className:"text-muted animate-pulse text-sm",children:"Loading project..."}),a.jsx("div",{className:"text-xs font-mono text-muted/50 mt-2",children:e})]})}):f||!n?a.jsx("div",{className:"h-screen bg-background flex items-center justify-center",children:a.jsxs("div",{className:"text-center",children:[a.jsx("p",{className:"text-danger text-sm font-medium",children:"Project not found"}),a.jsx("p",{className:"text-xs text-muted mt-1",children:f||`Session ${e} does not exist`}),a.jsx("button",{onClick:()=>t("/"),className:"mt-4 px-4 py-2 rounded-btn text-sm font-semibold border border-primary/30 text-primary hover:bg-primary/5 transition-all",children:"Back to Home"})]})}):a.jsx("div",{className:"h-screen bg-background flex flex-col",children:a.jsx("div",{className:"flex-1 min-h-0",children:a.jsx(tr,{name:"ProjectWorkspace",children:a.jsx(ro,{session:n,onClose:()=>t("/")})})})})}export{uo as default};
|
|
161
|
+
`},_t=Ea(Da)(cn),$a={config:La},Ia=function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return function(s){return n.reduceRight(function(o,f){return f(o)},s)}};function dn(e,t){return Object.keys(t).forEach(function(n){t[n]instanceof Object&&e[n]&&Object.assign(t[n],dn(e[n],t[n]))}),Tt(Tt({},e),t)}var Ta={type:"cancelation",msg:"operation is manually canceled"};function st(e){var t=!1,n=new Promise(function(r,s){e.then(function(o){return t?s(Ta):r(o)}),e.catch(s)});return n.cancel=function(){return t=!0},n}var Fa=["monaco"],Aa=Pa.create({config:Ma,isInitialized:!1,resolve:null,reject:null,monaco:null}),un=da(Aa,2),Ve=un[0],Je=un[1];function _a(e){var t=$a.config(e),n=t.monaco,r=la(t,Fa);Je(function(s){return{config:dn(s.config,r),monaco:n}})}function Va(){var e=Ve(function(t){var n=t.monaco,r=t.isInitialized,s=t.resolve;return{monaco:n,isInitialized:r,resolve:s}});if(!e.isInitialized){if(Je({isInitialized:!0}),e.monaco)return e.resolve(e.monaco),st(ot);if(window.monaco&&window.monaco.editor)return fn(window.monaco),e.resolve(window.monaco),st(ot);Ia(Ba,qa)(Ua)}return st(ot)}function Ba(e){return document.body.appendChild(e)}function Ha(e){var t=document.createElement("script");return e&&(t.src=e),t}function qa(e){var t=Ve(function(r){var s=r.config,o=r.reject;return{config:s,reject:o}}),n=Ha("".concat(t.config.paths.vs,"/loader.js"));return n.onload=function(){return e()},n.onerror=t.reject,n}function Ua(){var e=Ve(function(n){var r=n.config,s=n.resolve,o=n.reject;return{config:r,resolve:s,reject:o}}),t=window.require;t.config(e.config),t(["vs/editor/editor.main"],function(n){var r=n.m||n;fn(r),e.resolve(r)},function(n){e.reject(n)})}function fn(e){Ve().monaco||Je({monaco:e})}function Wa(){return Ve(function(e){var t=e.monaco;return t})}var ot=new Promise(function(e,t){return Je({resolve:e,reject:t})}),pn={config:_a,init:Va,__getMonacoInstance:Wa},Ga={wrapper:{display:"flex",position:"relative",textAlign:"initial"},fullWidth:{width:"100%"},hide:{display:"none"}},it=Ga,Ka={container:{display:"flex",height:"100%",width:"100%",justifyContent:"center",alignItems:"center"}},Xa=Ka;function Ya({children:e}){return ke.createElement("div",{style:Xa.container},e)}var Qa=Ya,Za=Qa;function Ja({width:e,height:t,isEditorReady:n,loading:r,_ref:s,className:o,wrapperProps:f}){return ke.createElement("section",{style:{...it.wrapper,width:e,height:t},...f},!n&&ke.createElement(Za,null,r),ke.createElement("div",{ref:s,style:{...it.fullWidth,...!n&&it.hide},className:o}))}var es=Ja,mn=d.memo(es);function ts(e){d.useEffect(e,[])}var hn=ts;function ns(e,t,n=!0){let r=d.useRef(!0);d.useEffect(r.current||!n?()=>{r.current=!1}:e,t)}var Q=ns;function Te(){}function we(e,t,n,r){return rs(e,r)||as(e,t,n,r)}function rs(e,t){return e.editor.getModel(xn(e,t))}function as(e,t,n,r){return e.editor.createModel(t,n,r?xn(e,r):void 0)}function xn(e,t){return e.Uri.parse(t)}function ss({original:e,modified:t,language:n,originalLanguage:r,modifiedLanguage:s,originalModelPath:o,modifiedModelPath:f,keepCurrentOriginalModel:i=!1,keepCurrentModifiedModel:l=!1,theme:c="light",loading:p="Loading...",options:v={},height:h="100%",width:w="100%",className:j,wrapperProps:g={},beforeMount:y=Te,onMount:x=Te}){let[m,k]=d.useState(!1),[S,b]=d.useState(!0),P=d.useRef(null),N=d.useRef(null),I=d.useRef(null),H=d.useRef(x),L=d.useRef(y),M=d.useRef(!1);hn(()=>{let z=pn.init();return z.then(D=>(N.current=D)&&b(!1)).catch(D=>(D==null?void 0:D.type)!=="cancelation"&&console.error("Monaco initialization: error:",D)),()=>P.current?F():z.cancel()}),Q(()=>{if(P.current&&N.current){let z=P.current.getOriginalEditor(),D=we(N.current,e||"",r||n||"text",o||"");D!==z.getModel()&&z.setModel(D)}},[o],m),Q(()=>{if(P.current&&N.current){let z=P.current.getModifiedEditor(),D=we(N.current,t||"",s||n||"text",f||"");D!==z.getModel()&&z.setModel(D)}},[f],m),Q(()=>{let z=P.current.getModifiedEditor();z.getOption(N.current.editor.EditorOption.readOnly)?z.setValue(t||""):t!==z.getValue()&&(z.executeEdits("",[{range:z.getModel().getFullModelRange(),text:t||"",forceMoveMarkers:!0}]),z.pushUndoStop())},[t],m),Q(()=>{var z,D;(D=(z=P.current)==null?void 0:z.getModel())==null||D.original.setValue(e||"")},[e],m),Q(()=>{let{original:z,modified:D}=P.current.getModel();N.current.editor.setModelLanguage(z,r||n||"text"),N.current.editor.setModelLanguage(D,s||n||"text")},[n,r,s],m),Q(()=>{var z;(z=N.current)==null||z.editor.setTheme(c)},[c],m),Q(()=>{var z;(z=P.current)==null||z.updateOptions(v)},[v],m);let E=d.useCallback(()=>{var W;if(!N.current)return;L.current(N.current);let z=we(N.current,e||"",r||n||"text",o||""),D=we(N.current,t||"",s||n||"text",f||"");(W=P.current)==null||W.setModel({original:z,modified:D})},[n,t,s,e,r,o,f]),V=d.useCallback(()=>{var z;!M.current&&I.current&&(P.current=N.current.editor.createDiffEditor(I.current,{automaticLayout:!0,...v}),E(),(z=N.current)==null||z.editor.setTheme(c),k(!0),M.current=!0)},[v,c,E]);d.useEffect(()=>{m&&H.current(P.current,N.current)},[m]),d.useEffect(()=>{!S&&!m&&V()},[S,m,V]);function F(){var D,W,Z,J;let z=(D=P.current)==null?void 0:D.getModel();i||((W=z==null?void 0:z.original)==null||W.dispose()),l||((Z=z==null?void 0:z.modified)==null||Z.dispose()),(J=P.current)==null||J.dispose()}return ke.createElement(mn,{width:w,height:h,isEditorReady:m,loading:p,_ref:I,className:j,wrapperProps:g})}var os=ss;d.memo(os);function is(e){let t=d.useRef();return d.useEffect(()=>{t.current=e},[e]),t.current}var ls=is,Ge=new Map;function cs({defaultValue:e,defaultLanguage:t,defaultPath:n,value:r,language:s,path:o,theme:f="light",line:i,loading:l="Loading...",options:c={},overrideServices:p={},saveViewState:v=!0,keepCurrentModel:h=!1,width:w="100%",height:j="100%",className:g,wrapperProps:y={},beforeMount:x=Te,onMount:m=Te,onChange:k,onValidate:S=Te}){let[b,P]=d.useState(!1),[N,I]=d.useState(!0),H=d.useRef(null),L=d.useRef(null),M=d.useRef(null),E=d.useRef(m),V=d.useRef(x),F=d.useRef(),z=d.useRef(r),D=ls(o),W=d.useRef(!1),Z=d.useRef(!1);hn(()=>{let O=pn.init();return O.then($=>(H.current=$)&&I(!1)).catch($=>($==null?void 0:$.type)!=="cancelation"&&console.error("Monaco initialization: error:",$)),()=>L.current?te():O.cancel()}),Q(()=>{var $,R,G,ee;let O=we(H.current,e||r||"",t||s||"",o||n||"");O!==(($=L.current)==null?void 0:$.getModel())&&(v&&Ge.set(D,(R=L.current)==null?void 0:R.saveViewState()),(G=L.current)==null||G.setModel(O),v&&((ee=L.current)==null||ee.restoreViewState(Ge.get(o))))},[o],b),Q(()=>{var O;(O=L.current)==null||O.updateOptions(c)},[c],b),Q(()=>{!L.current||r===void 0||(L.current.getOption(H.current.editor.EditorOption.readOnly)?L.current.setValue(r):r!==L.current.getValue()&&(Z.current=!0,L.current.executeEdits("",[{range:L.current.getModel().getFullModelRange(),text:r,forceMoveMarkers:!0}]),L.current.pushUndoStop(),Z.current=!1))},[r],b),Q(()=>{var $,R;let O=($=L.current)==null?void 0:$.getModel();O&&s&&((R=H.current)==null||R.editor.setModelLanguage(O,s))},[s],b),Q(()=>{var O;i!==void 0&&((O=L.current)==null||O.revealLine(i))},[i],b),Q(()=>{var O;(O=H.current)==null||O.editor.setTheme(f)},[f],b);let J=d.useCallback(()=>{var O;if(!(!M.current||!H.current)&&!W.current){V.current(H.current);let $=o||n,R=we(H.current,r||e||"",t||s||"",$||"");L.current=(O=H.current)==null?void 0:O.editor.create(M.current,{model:R,automaticLayout:!0,...c},p),v&&L.current.restoreViewState(Ge.get($)),H.current.editor.setTheme(f),i!==void 0&&L.current.revealLine(i),P(!0),W.current=!0}},[e,t,n,r,s,o,c,p,v,f,i]);d.useEffect(()=>{b&&E.current(L.current,H.current)},[b]),d.useEffect(()=>{!N&&!b&&J()},[N,b,J]),z.current=r,d.useEffect(()=>{var O,$;b&&k&&((O=F.current)==null||O.dispose(),F.current=($=L.current)==null?void 0:$.onDidChangeModelContent(R=>{Z.current||k(L.current.getValue(),R)}))},[b,k]),d.useEffect(()=>{if(b){let O=H.current.editor.onDidChangeMarkers($=>{var G;let R=(G=L.current.getModel())==null?void 0:G.uri;if(R&&$.find(ee=>ee.path===R.path)){let ee=H.current.editor.getModelMarkers({resource:R});S==null||S(ee)}});return()=>{O==null||O.dispose()}}return()=>{}},[b,S]);function te(){var O,$;(O=F.current)==null||O.dispose(),h?v&&Ge.set(o,L.current.saveViewState()):($=L.current.getModel())==null||$.dispose(),L.current.dispose()}return ke.createElement(mn,{width:w,height:j,isEditorReady:b,loading:l,_ref:M,className:g,wrapperProps:y})}var ds=cs,us=d.memo(ds),fs=us;function ps(e,t){const n=getComputedStyle(e),r=parseFloat(n.fontSize);return t*r}function ms(e,t){const n=getComputedStyle(e.ownerDocument.body),r=parseFloat(n.fontSize);return t*r}function hs(e){return e/100*window.innerHeight}function xs(e){return e/100*window.innerWidth}function gs(e){switch(typeof e){case"number":return[e,"px"];case"string":{const t=parseFloat(e);return e.endsWith("%")?[t,"%"]:e.endsWith("px")?[t,"px"]:e.endsWith("rem")?[t,"rem"]:e.endsWith("em")?[t,"em"]:e.endsWith("vh")?[t,"vh"]:e.endsWith("vw")?[t,"vw"]:[t,"%"]}}}function $e({groupSize:e,panelElement:t,styleProp:n}){let r;const[s,o]=gs(n);switch(o){case"%":{r=s/100*e;break}case"px":{r=s;break}case"rem":{r=ms(t,s);break}case"em":{r=ps(t,s);break}case"vh":{r=hs(s);break}case"vw":{r=xs(s);break}}return r}function X(e){return parseFloat(e.toFixed(3))}function Ne({group:e}){const{orientation:t,panels:n}=e;return n.reduce((r,s)=>(r+=t==="horizontal"?s.element.offsetWidth:s.element.offsetHeight,r),0)}function ct(e){const{panels:t}=e,n=Ne({group:e});return n===0?t.map(r=>({groupResizeBehavior:r.panelConstraints.groupResizeBehavior,collapsedSize:0,collapsible:r.panelConstraints.collapsible===!0,defaultSize:void 0,disabled:r.panelConstraints.disabled,minSize:0,maxSize:100,panelId:r.id})):t.map(r=>{const{element:s,panelConstraints:o}=r;let f=0;if(o.collapsedSize!==void 0){const p=$e({groupSize:n,panelElement:s,styleProp:o.collapsedSize});f=X(p/n*100)}let i;if(o.defaultSize!==void 0){const p=$e({groupSize:n,panelElement:s,styleProp:o.defaultSize});i=X(p/n*100)}let l=0;if(o.minSize!==void 0){const p=$e({groupSize:n,panelElement:s,styleProp:o.minSize});l=X(p/n*100)}let c=100;if(o.maxSize!==void 0){const p=$e({groupSize:n,panelElement:s,styleProp:o.maxSize});c=X(p/n*100)}return{groupResizeBehavior:o.groupResizeBehavior,collapsedSize:f,collapsible:o.collapsible===!0,defaultSize:i,disabled:o.disabled,minSize:l,maxSize:c,panelId:r.id}})}function B(e,t="Assertion error"){if(!e)throw Error(t)}function dt(e,t){return Array.from(t).sort(e==="horizontal"?bs:vs)}function bs(e,t){const n=e.element.offsetLeft-t.element.offsetLeft;return n!==0?n:e.element.offsetWidth-t.element.offsetWidth}function vs(e,t){const n=e.element.offsetTop-t.element.offsetTop;return n!==0?n:e.element.offsetHeight-t.element.offsetHeight}function gn(e){return e!==null&&typeof e=="object"&&"nodeType"in e&&e.nodeType===Node.ELEMENT_NODE}function bn(e,t){return{x:e.x>=t.left&&e.x<=t.right?0:Math.min(Math.abs(e.x-t.left),Math.abs(e.x-t.right)),y:e.y>=t.top&&e.y<=t.bottom?0:Math.min(Math.abs(e.y-t.top),Math.abs(e.y-t.bottom))}}function ys({orientation:e,rects:t,targetRect:n}){const r={x:n.x+n.width/2,y:n.y+n.height/2};let s,o=Number.MAX_VALUE;for(const f of t){const{x:i,y:l}=bn(r,f),c=e==="horizontal"?i:l;c<o&&(o=c,s=f)}return B(s,"No rect found"),s}let Ke;function ws(){return Ke===void 0&&(typeof matchMedia=="function"?Ke=!!matchMedia("(pointer:coarse)").matches:Ke=!1),Ke}function vn(e){const{element:t,orientation:n,panels:r,separators:s}=e,o=dt(n,Array.from(t.children).filter(gn).map(j=>({element:j}))).map(({element:j})=>j),f=[];let i=!1,l=!1,c=-1,p=-1,v=0,h,w=[];{let j=-1;for(const g of o)g.hasAttribute("data-panel")&&(j++,g.ariaDisabled===null&&(v++,c===-1&&(c=j),p=j))}if(v>1){let j=-1;for(const g of o)if(g.hasAttribute("data-panel")){j++;const y=r.find(x=>x.element===g);if(y){if(h){const x=h.element.getBoundingClientRect(),m=g.getBoundingClientRect();let k;if(l){const S=n==="horizontal"?new DOMRect(x.right,x.top,0,x.height):new DOMRect(x.left,x.bottom,x.width,0),b=n==="horizontal"?new DOMRect(m.left,m.top,0,m.height):new DOMRect(m.left,m.top,m.width,0);switch(w.length){case 0:{k=[S,b];break}case 1:{const P=w[0],N=ys({orientation:n,rects:[x,m],targetRect:P.element.getBoundingClientRect()});k=[P,N===x?b:S];break}default:{k=w;break}}}else w.length?k=w:k=[n==="horizontal"?new DOMRect(x.right,m.top,m.left-x.right,m.height):new DOMRect(m.left,x.bottom,m.width,m.top-x.bottom)];for(const S of k){let b="width"in S?S:S.element.getBoundingClientRect();const P=ws()?e.resizeTargetMinimumSize.coarse:e.resizeTargetMinimumSize.fine;if(b.width<P){const I=P-b.width;b=new DOMRect(b.x-I/2,b.y,b.width+I,b.height)}if(b.height<P){const I=P-b.height;b=new DOMRect(b.x,b.y-I/2,b.width,b.height+I)}const N=j<=c||j>p;!i&&!N&&f.push({group:e,groupSize:Ne({group:e}),panels:[h,y],separator:"width"in S?void 0:S,rect:b}),i=!1}}l=!1,h=y,w=[]}}else if(g.hasAttribute("data-separator")){g.ariaDisabled!==null&&(i=!0);const y=s.find(x=>x.element===g);y?w.push(y):(h=void 0,w=[])}else l=!0}return f}var le;class yn{constructor(){Rt(this,le,{})}addListener(t,n){const r=Re(this,le)[t];return r===void 0?Re(this,le)[t]=[n]:r.includes(n)||r.push(n),()=>{this.removeListener(t,n)}}emit(t,n){const r=Re(this,le)[t];if(r!==void 0)if(r.length===1)r[0].call(null,n);else{let s=!1,o=null;const f=Array.from(r);for(let i=0;i<f.length;i++){const l=f[i];try{l.call(null,n)}catch(c){o===null&&(s=!0,o=c)}}if(s)throw o}}removeAllListeners(){Lt(this,le,{})}removeListener(t,n){const r=Re(this,le)[t];if(r!==void 0){const s=r.indexOf(n);s>=0&&r.splice(s,1)}}}le=new WeakMap;let re=new Map;const wn=new yn;function js(e){re=new Map(re),re.delete(e)}function Vt(e,t){for(const[n]of re)if(n.id===e)return n}function de(e,t){for(const[n,r]of re)if(n.id===e)return r;if(t)throw Error(`Could not find data for Group with id ${e}`)}function xe(){return re}function mt(e,t){return wn.addListener("groupChange",n=>{n.group.id===e&&t(n)})}function oe(e,t){const n=re.get(e);re=new Map(re),re.set(e,t),wn.emit("groupChange",{group:e,prev:n,next:t})}function ks(e,t,n){let r,s={x:1/0,y:1/0};for(const o of t){const f=bn(n,o.rect);switch(e){case"horizontal":{f.x<=s.x&&(r=o,s=f);break}case"vertical":{f.y<=s.y&&(r=o,s=f);break}}}return r?{distance:s,hitRegion:r}:void 0}function Ss(e){return e!==null&&typeof e=="object"&&"nodeType"in e&&e.nodeType===Node.DOCUMENT_FRAGMENT_NODE}function zs(e,t){if(e===t)throw new Error("Cannot compare node with itself");const n={a:qt(e),b:qt(t)};let r;for(;n.a.at(-1)===n.b.at(-1);)r=n.a.pop(),n.b.pop();B(r,"Stacking order can only be calculated for elements with a common ancestor");const s={a:Ht(Bt(n.a)),b:Ht(Bt(n.b))};if(s.a===s.b){const o=r.childNodes,f={a:n.a.at(-1),b:n.b.at(-1)};let i=o.length;for(;i--;){const l=o[i];if(l===f.a)return 1;if(l===f.b)return-1}}return Math.sign(s.a-s.b)}const Ns=/\b(?:position|zIndex|opacity|transform|webkitTransform|mixBlendMode|filter|webkitFilter|isolation)\b/;function Cs(e){const t=getComputedStyle(jn(e)??e).display;return t==="flex"||t==="inline-flex"}function Ps(e){const t=getComputedStyle(e);return!!(t.position==="fixed"||t.zIndex!=="auto"&&(t.position!=="static"||Cs(e))||+t.opacity<1||"transform"in t&&t.transform!=="none"||"webkitTransform"in t&&t.webkitTransform!=="none"||"mixBlendMode"in t&&t.mixBlendMode!=="normal"||"filter"in t&&t.filter!=="none"||"webkitFilter"in t&&t.webkitFilter!=="none"||"isolation"in t&&t.isolation==="isolate"||Ns.test(t.willChange)||t.webkitOverflowScrolling==="touch")}function Bt(e){let t=e.length;for(;t--;){const n=e[t];if(B(n,"Missing node"),Ps(n))return n}return null}function Ht(e){return e&&Number(getComputedStyle(e).zIndex)||0}function qt(e){const t=[];for(;e;)t.push(e),e=jn(e);return t}function jn(e){const{parentNode:t}=e;return Ss(t)?t.host:t}function Ms(e,t){return e.x<t.x+t.width&&e.x+e.width>t.x&&e.y<t.y+t.height&&e.y+e.height>t.y}function Es({groupElement:e,hitRegion:t,pointerEventTarget:n}){if(!gn(n)||n.contains(e)||e.contains(n))return!0;if(zs(n,e)>0){let r=n;for(;r;){if(r.contains(e))return!0;if(Ms(r.getBoundingClientRect(),t))return!1;r=r.parentElement}}return!0}function ht(e,t){const n=[];return t.forEach((r,s)=>{if(s.disabled)return;const o=vn(s),f=ks(s.orientation,o,{x:e.clientX,y:e.clientY});f&&f.distance.x<=0&&f.distance.y<=0&&Es({groupElement:s.element,hitRegion:f.hitRegion.rect,pointerEventTarget:e.target})&&n.push(f.hitRegion)}),n}function Rs(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!=t[n])return!1;return!0}function K(e,t,n=0){return Math.abs(X(e)-X(t))<=n}function ne(e,t){return K(e,t)?0:e>t?1:-1}function je({overrideDisabledPanels:e,panelConstraints:t,prevSize:n,size:r}){const{collapsedSize:s=0,collapsible:o,disabled:f,maxSize:i=100,minSize:l=0}=t;if(f&&!e)return n;if(ne(r,l)<0)if(o){const c=(s+l)/2;ne(r,c)<0?r=s:r=l}else r=l;return r=Math.min(i,r),r=X(r),r}function _e({delta:e,initialLayout:t,panelConstraints:n,pivotIndices:r,prevLayout:s,trigger:o}){if(K(e,0))return t;const f=o==="imperative-api",i=Object.values(t),l=Object.values(s),c=[...i],[p,v]=r;B(p!=null,"Invalid first pivot index"),B(v!=null,"Invalid second pivot index");let h=0;switch(o){case"keyboard":{{const g=e<0?v:p,y=n[g];B(y,`Panel constraints not found for index ${g}`);const{collapsedSize:x=0,collapsible:m,minSize:k=0}=y;if(m){const S=i[g];if(B(S!=null,`Previous layout not found for panel index ${g}`),K(S,x)){const b=k-S;ne(b,Math.abs(e))>0&&(e=e<0?0-b:b)}}}{const g=e<0?p:v,y=n[g];B(y,`No panel constraints found for index ${g}`);const{collapsedSize:x=0,collapsible:m,minSize:k=0}=y;if(m){const S=i[g];if(B(S!=null,`Previous layout not found for panel index ${g}`),K(S,k)){const b=S-x;ne(b,Math.abs(e))>0&&(e=e<0?0-b:b)}}}break}default:{const g=e<0?v:p,y=n[g];B(y,`Panel constraints not found for index ${g}`);const x=i[g],{collapsible:m,collapsedSize:k,minSize:S}=y;if(m&&ne(x,S)<0)if(e>0){const b=S-k,P=b/2,N=x+e;ne(N,S)<0&&(e=ne(e,P)<=0?0:b)}else{const b=S-k,P=100-b/2,N=x-e;ne(N,S)<0&&(e=ne(100+e,P)>0?0:-b)}break}}{const g=e<0?1:-1;let y=e<0?v:p,x=0;for(;;){const k=i[y];B(k!=null,`Previous layout not found for panel index ${y}`);const S=je({overrideDisabledPanels:f,panelConstraints:n[y],prevSize:k,size:100})-k;if(x+=S,y+=g,y<0||y>=n.length)break}const m=Math.min(Math.abs(e),Math.abs(x));e=e<0?0-m:m}{let g=e<0?p:v;for(;g>=0&&g<n.length;){const y=Math.abs(e)-Math.abs(h),x=i[g];B(x!=null,`Previous layout not found for panel index ${g}`);const m=x-y,k=je({overrideDisabledPanels:f,panelConstraints:n[g],prevSize:x,size:m});if(!K(x,k)&&(h+=x-k,c[g]=k,h.toFixed(3).localeCompare(Math.abs(e).toFixed(3),void 0,{numeric:!0})>=0))break;e<0?g--:g++}}if(Rs(l,c))return s;{const g=e<0?v:p,y=i[g];B(y!=null,`Previous layout not found for panel index ${g}`);const x=y+h,m=je({overrideDisabledPanels:f,panelConstraints:n[g],prevSize:y,size:x});if(c[g]=m,!K(m,x)){let k=x-m,S=e<0?v:p;for(;S>=0&&S<n.length;){const b=c[S];B(b!=null,`Previous layout not found for panel index ${S}`);const P=b+k,N=je({overrideDisabledPanels:f,panelConstraints:n[S],prevSize:b,size:P});if(K(b,N)||(k-=N-b,c[S]=N),K(k,0))break;e>0?S--:S++}}}const w=Object.values(c).reduce((g,y)=>y+g,0);if(!K(w,100,.1))return s;const j=Object.keys(s);return c.reduce((g,y,x)=>(g[j[x]]=y,g),{})}function pe(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(const n in e)if(t[n]===void 0||ne(e[n],t[n])!==0)return!1;return!0}function me({layout:e,panelConstraints:t}){const n=Object.values(e),r=[...n],s=r.reduce((i,l)=>i+l,0);if(r.length!==t.length)throw Error(`Invalid ${t.length} panel layout: ${r.map(i=>`${i}%`).join(", ")}`);if(!K(s,100)&&r.length>0)for(let i=0;i<t.length;i++){const l=r[i];B(l!=null,`No layout data found for index ${i}`);const c=100/s*l;r[i]=c}let o=0;for(let i=0;i<t.length;i++){const l=n[i];B(l!=null,`No layout data found for index ${i}`);const c=r[i];B(c!=null,`No layout data found for index ${i}`);const p=je({overrideDisabledPanels:!0,panelConstraints:t[i],prevSize:l,size:c});c!=p&&(o+=c-p,r[i]=p)}if(!K(o,0))for(let i=0;i<t.length;i++){const l=r[i];B(l!=null,`No layout data found for index ${i}`);const c=l+o,p=je({overrideDisabledPanels:!0,panelConstraints:t[i],prevSize:l,size:c});if(l!==p&&(o-=p-l,r[i]=p,K(o,0)))break}const f=Object.keys(e);return r.reduce((i,l,c)=>(i[f[c]]=l,i),{})}function kn({groupId:e,panelId:t}){const n=()=>{const i=xe();for(const[l,{defaultLayoutDeferred:c,derivedPanelConstraints:p,layout:v,groupSize:h,separatorToPanels:w}]of i)if(l.id===e)return{defaultLayoutDeferred:c,derivedPanelConstraints:p,group:l,groupSize:h,layout:v,separatorToPanels:w};throw Error(`Group ${e} not found`)},r=()=>{const i=n().derivedPanelConstraints.find(l=>l.panelId===t);if(i!==void 0)return i;throw Error(`Panel constraints not found for Panel ${t}`)},s=()=>{const i=n().group.panels.find(l=>l.id===t);if(i!==void 0)return i;throw Error(`Layout not found for Panel ${t}`)},o=()=>{const i=n().layout[t];if(i!==void 0)return i;throw Error(`Layout not found for Panel ${t}`)},f=i=>{const l=o();if(i===l)return;const{defaultLayoutDeferred:c,derivedPanelConstraints:p,group:v,groupSize:h,layout:w,separatorToPanels:j}=n(),g=v.panels.findIndex(k=>k.id===t),y=g===v.panels.length-1,x=_e({delta:y?l-i:i-l,initialLayout:w,panelConstraints:p,pivotIndices:y?[g-1,g]:[g,g+1],prevLayout:w,trigger:"imperative-api"}),m=me({layout:x,panelConstraints:p});pe(w,m)||oe(v,{defaultLayoutDeferred:c,derivedPanelConstraints:p,groupSize:h,layout:m,separatorToPanels:j})};return{collapse:()=>{const{collapsible:i,collapsedSize:l}=r(),{mutableValues:c}=s(),p=o();i&&p!==l&&(c.expandToSize=p,f(l))},expand:()=>{const{collapsible:i,collapsedSize:l,minSize:c}=r(),{mutableValues:p}=s(),v=o();if(i&&v===l){let h=p.expandToSize??c;h===0&&(h=1),f(h)}},getSize:()=>{const{group:i}=n(),l=o(),{element:c}=s(),p=i.orientation==="horizontal"?c.offsetWidth:c.offsetHeight;return{asPercentage:l,inPixels:p}},isCollapsed:()=>{const{collapsible:i,collapsedSize:l}=r(),c=o();return i&&K(l,c)},resize:i=>{const{group:l}=n(),{element:c}=s(),p=Ne({group:l}),v=$e({groupSize:p,panelElement:c,styleProp:i}),h=X(v/p*100);f(h)}}}function Ut(e){if(e.defaultPrevented)return;const t=xe();ht(e,t).forEach(n=>{if(n.separator){const r=n.panels.find(s=>s.panelConstraints.defaultSize!==void 0);if(r){const s=r.panelConstraints.defaultSize,o=kn({groupId:n.group.id,panelId:r.id});o&&s!==void 0&&(o.resize(s),e.preventDefault())}}})}function Ye(e){const t=xe();for(const[n]of t)if(n.separators.some(r=>r.element===e))return n;throw Error("Could not find parent Group for separator element")}function Sn({groupId:e}){const t=()=>{const n=xe();for(const[r,s]of n)if(r.id===e)return{group:r,...s};throw Error(`Could not find Group with id "${e}"`)};return{getLayout(){const{defaultLayoutDeferred:n,layout:r}=t();return n?{}:r},setLayout(n){const{defaultLayoutDeferred:r,derivedPanelConstraints:s,group:o,groupSize:f,layout:i,separatorToPanels:l}=t(),c=me({layout:n,panelConstraints:s});return r?i:(pe(i,c)||oe(o,{defaultLayoutDeferred:r,derivedPanelConstraints:s,groupSize:f,layout:c,separatorToPanels:l}),c)}}}function fe(e,t){const n=Ye(e),r=de(n.id,!0),s=n.separators.find(p=>p.element===e);B(s,"Matching separator not found");const o=r.separatorToPanels.get(s);B(o,"Matching panels not found");const f=o.map(p=>n.panels.indexOf(p)),i=Sn({groupId:n.id}).getLayout(),l=_e({delta:t,initialLayout:i,panelConstraints:r.derivedPanelConstraints,pivotIndices:f,prevLayout:i,trigger:"keyboard"}),c=me({layout:l,panelConstraints:r.derivedPanelConstraints});pe(i,c)||oe(n,{defaultLayoutDeferred:r.defaultLayoutDeferred,derivedPanelConstraints:r.derivedPanelConstraints,groupSize:r.groupSize,layout:c,separatorToPanels:r.separatorToPanels})}function Wt(e){if(e.defaultPrevented)return;const t=e.currentTarget,n=Ye(t);if(!n.disabled)switch(e.key){case"ArrowDown":{e.preventDefault(),n.orientation==="vertical"&&fe(t,5);break}case"ArrowLeft":{e.preventDefault(),n.orientation==="horizontal"&&fe(t,-5);break}case"ArrowRight":{e.preventDefault(),n.orientation==="horizontal"&&fe(t,5);break}case"ArrowUp":{e.preventDefault(),n.orientation==="vertical"&&fe(t,-5);break}case"End":{e.preventDefault(),fe(t,100);break}case"Enter":{e.preventDefault();const r=Ye(t),s=de(r.id,!0),{derivedPanelConstraints:o,layout:f,separatorToPanels:i}=s,l=r.separators.find(h=>h.element===t);B(l,"Matching separator not found");const c=i.get(l);B(c,"Matching panels not found");const p=c[0],v=o.find(h=>h.panelId===p.id);if(B(v,"Panel metadata not found"),v.collapsible){const h=f[p.id],w=v.collapsedSize===h?r.mutableState.expandedPanelSizes[p.id]??v.minSize:v.collapsedSize;fe(t,w-h)}break}case"F6":{e.preventDefault();const r=Ye(t).separators.map(f=>f.element),s=Array.from(r).findIndex(f=>f===e.currentTarget);B(s!==null,"Index not found");const o=e.shiftKey?s>0?s-1:r.length-1:s+1<r.length?s+1:0;r[o].focus({preventScroll:!0});break}case"Home":{e.preventDefault(),fe(t,-100);break}}}let Se={cursorFlags:0,state:"inactive"};const xt=new yn;function he(){return Se}function Ls(e){return xt.addListener("change",e)}function Os(e){const t=Se,n={...Se};n.cursorFlags=e,Se=n,xt.emit("change",{prev:t,next:n})}function ze(e){const t=Se;Se=e,xt.emit("change",{prev:t,next:e})}function Gt(e){if(e.defaultPrevented||e.pointerType==="mouse"&&e.button>0)return;const t=xe(),n=ht(e,t),r=new Map;let s=!1;n.forEach(o=>{o.separator&&(s||(s=!0,o.separator.element.focus({preventScroll:!0})));const f=t.get(o.group);f&&r.set(o.group,f.layout)}),ze({cursorFlags:0,hitRegions:n,initialLayoutMap:r,pointerDownAtPoint:{x:e.clientX,y:e.clientY},state:"active"}),n.length&&e.preventDefault()}const Ds=e=>e,lt=()=>{},zn=1,Nn=2,Cn=4,Pn=8,Kt=3,Xt=12;let Xe;function Yt(){return Xe===void 0&&(Xe=!1,typeof window<"u"&&(window.navigator.userAgent.includes("Chrome")||window.navigator.userAgent.includes("Firefox"))&&(Xe=!0)),Xe}function $s({cursorFlags:e,groups:t,state:n}){let r=0,s=0;switch(n){case"active":case"hover":t.forEach(o=>{if(!o.mutableState.disableCursor)switch(o.orientation){case"horizontal":{r++;break}case"vertical":{s++;break}}})}if(!(r===0&&s===0)){switch(n){case"active":{if(e&&Yt()){const o=(e&zn)!==0,f=(e&Nn)!==0,i=(e&Cn)!==0,l=(e&Pn)!==0;if(o)return i?"se-resize":l?"ne-resize":"e-resize";if(f)return i?"sw-resize":l?"nw-resize":"w-resize";if(i)return"s-resize";if(l)return"n-resize"}break}}return Yt()?r>0&&s>0?"move":r>0?"ew-resize":"ns-resize":r>0&&s>0?"grab":r>0?"col-resize":"row-resize"}}const Qt=new WeakMap;function gt(e){if(e.defaultView===null||e.defaultView===void 0)return;let{prevStyle:t,styleSheet:n}=Qt.get(e)??{};n===void 0&&(n=new e.defaultView.CSSStyleSheet,e.adoptedStyleSheets&&e.adoptedStyleSheets.push(n));const r=he();switch(r.state){case"active":case"hover":{const s=$s({cursorFlags:r.cursorFlags,groups:r.hitRegions.map(f=>f.group),state:r.state}),o=`*, *:hover {cursor: ${s} !important; }`;if(t===o)return;t=o,s?n.cssRules.length===0?n.insertRule(o):n.replaceSync(o):n.cssRules.length===1&&n.deleteRule(0);break}case"inactive":{t=void 0,n.cssRules.length===1&&n.deleteRule(0);break}}Qt.set(e,{prevStyle:t,styleSheet:n})}function Mn({document:e,event:t,hitRegions:n,initialLayoutMap:r,mountedGroups:s,pointerDownAtPoint:o,prevCursorFlags:f}){let i=0;n.forEach(c=>{const{group:p,groupSize:v}=c,{orientation:h,panels:w}=p,{disableCursor:j}=p.mutableState;let g=0;o?h==="horizontal"?g=(t.clientX-o.x)/v*100:g=(t.clientY-o.y)/v*100:h==="horizontal"?g=t.clientX<0?-100:100:g=t.clientY<0?-100:100;const y=r.get(p),x=s.get(p);if(!y||!x)return;const{defaultLayoutDeferred:m,derivedPanelConstraints:k,groupSize:S,layout:b,separatorToPanels:P}=x;if(k&&b&&P){const N=_e({delta:g,initialLayout:y,panelConstraints:k,pivotIndices:c.panels.map(I=>w.indexOf(I)),prevLayout:b,trigger:"mouse-or-touch"});if(pe(N,b)){if(g!==0&&!j)switch(h){case"horizontal":{i|=g<0?zn:Nn;break}case"vertical":{i|=g<0?Cn:Pn;break}}}else oe(c.group,{defaultLayoutDeferred:m,derivedPanelConstraints:k,groupSize:S,layout:N,separatorToPanels:P})}});let l=0;t.movementX===0?l|=f&Kt:l|=i&Kt,t.movementY===0?l|=f&Xt:l|=i&Xt,Os(l),gt(e)}function Zt(e){const t=xe(),n=he();switch(n.state){case"active":Mn({document:e.currentTarget,event:e,hitRegions:n.hitRegions,initialLayoutMap:n.initialLayoutMap,mountedGroups:t,prevCursorFlags:n.cursorFlags})}}function Jt(e){if(e.defaultPrevented)return;const t=he(),n=xe();switch(t.state){case"active":{if(e.buttons===0){ze({cursorFlags:0,state:"inactive"}),t.hitRegions.forEach(r=>{const s=de(r.group.id,!0);oe(r.group,s)});return}Mn({document:e.currentTarget,event:e,hitRegions:t.hitRegions,initialLayoutMap:t.initialLayoutMap,mountedGroups:n,pointerDownAtPoint:t.pointerDownAtPoint,prevCursorFlags:t.cursorFlags});break}default:{const r=ht(e,n);r.length===0?t.state!=="inactive"&&ze({cursorFlags:0,state:"inactive"}):ze({cursorFlags:0,hitRegions:r,state:"hover"}),gt(e.currentTarget);break}}}function en(e){if(e.relatedTarget instanceof HTMLIFrameElement)switch(he().state){case"hover":ze({cursorFlags:0,state:"inactive"})}}function tn(e){if(e.defaultPrevented||e.pointerType==="mouse"&&e.button>0)return;const t=he();switch(t.state){case"active":ze({cursorFlags:0,state:"inactive"}),t.hitRegions.length>0&&(gt(e.currentTarget),t.hitRegions.forEach(n=>{const r=de(n.group.id,!0);oe(n.group,r)}),e.preventDefault())}}function nn(e){let t=0,n=0;const r={};for(const o of e)if(o.defaultSize!==void 0){t++;const f=X(o.defaultSize);n+=f,r[o.panelId]=f}else r[o.panelId]=void 0;const s=e.length-t;if(s!==0){const o=X((100-n)/s);for(const f of e)f.defaultSize===void 0&&(r[f.panelId]=o)}return r}function Is(e,t,n){if(!n[0])return;const r=e.panels.find(l=>l.element===t);if(!r||!r.onResize)return;const s=Ne({group:e}),o=e.orientation==="horizontal"?r.element.offsetWidth:r.element.offsetHeight,f=r.mutableValues.prevSize,i={asPercentage:X(o/s*100),inPixels:o};r.mutableValues.prevSize=i,r.onResize(i,r.id,f)}function Ts(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(const n in e)if(e[n]!==t[n])return!1;return!0}function Fs({group:e,nextGroupSize:t,prevGroupSize:n,prevLayout:r}){if(n<=0||t<=0||n===t)return r;let s=0,o=0,f=!1;const i=new Map,l=[];for(const v of e.panels){const h=r[v.id]??0;switch(v.panelConstraints.groupResizeBehavior){case"preserve-pixel-size":{f=!0;const w=h/100*n,j=X(w/t*100);i.set(v.id,j),s+=j;break}case"preserve-relative-size":default:{l.push(v.id),o+=h;break}}}if(!f||l.length===0)return r;const c=100-s,p={...r};if(i.forEach((v,h)=>{p[h]=v}),o>0)for(const v of l){const h=r[v]??0;p[v]=X(h/o*c)}else{const v=X(c/l.length);for(const h of l)p[h]=v}return p}function As(e,t){const n=e.map(s=>s.id),r=Object.keys(t);if(n.length!==r.length)return!1;for(const s of n)if(!r.includes(s))return!1;return!0}const ye=new Map;function _s(e){let t=!0;B(e.element.ownerDocument.defaultView,"Cannot register an unmounted Group");const n=e.element.ownerDocument.defaultView.ResizeObserver,r=new Set,s=new Set,o=new n(j=>{for(const g of j){const{borderBoxSize:y,target:x}=g;if(x===e.element){if(t){const m=Ne({group:e});if(m===0)return;const k=de(e.id);if(!k)return;const S=ct(e),b=k.defaultLayoutDeferred?nn(S):k.layout,P=Fs({group:e,nextGroupSize:m,prevGroupSize:k.groupSize,prevLayout:b}),N=me({layout:P,panelConstraints:S});if(!k.defaultLayoutDeferred&&pe(k.layout,N)&&Ts(k.derivedPanelConstraints,S)&&k.groupSize===m)return;oe(e,{defaultLayoutDeferred:!1,derivedPanelConstraints:S,groupSize:m,layout:N,separatorToPanels:k.separatorToPanels})}}else Is(e,x,y)}});o.observe(e.element),e.panels.forEach(j=>{B(!r.has(j.id),`Panel ids must be unique; id "${j.id}" was used more than once`),r.add(j.id),j.onResize&&o.observe(j.element)});const f=Ne({group:e}),i=ct(e),l=e.panels.map(({id:j})=>j).join(",");let c=e.mutableState.defaultLayout;c&&(As(e.panels,c)||(c=void 0));const p=e.mutableState.layouts[l]??c??nn(i),v=me({layout:p,panelConstraints:i}),h=e.element.ownerDocument;ye.set(h,(ye.get(h)??0)+1);const w=new Map;return vn(e).forEach(j=>{j.separator&&w.set(j.separator,j.panels)}),oe(e,{defaultLayoutDeferred:f===0,derivedPanelConstraints:i,groupSize:f,layout:v,separatorToPanels:w}),e.separators.forEach(j=>{B(!s.has(j.id),`Separator ids must be unique; id "${j.id}" was used more than once`),s.add(j.id),j.element.addEventListener("keydown",Wt)}),ye.get(h)===1&&(h.addEventListener("dblclick",Ut,!0),h.addEventListener("pointerdown",Gt,!0),h.addEventListener("pointerleave",Zt),h.addEventListener("pointermove",Jt),h.addEventListener("pointerout",en),h.addEventListener("pointerup",tn,!0)),function(){t=!1,ye.set(h,Math.max(0,(ye.get(h)??0)-1)),js(e),e.separators.forEach(j=>{j.element.removeEventListener("keydown",Wt)}),ye.get(h)||(h.removeEventListener("dblclick",Ut,!0),h.removeEventListener("pointerdown",Gt,!0),h.removeEventListener("pointerleave",Zt),h.removeEventListener("pointermove",Jt),h.removeEventListener("pointerout",en),h.removeEventListener("pointerup",tn,!0)),o.disconnect()}}function Vs(){const[e,t]=d.useState({}),n=d.useCallback(()=>t({}),[]);return[e,n]}function bt(e){const t=d.useId();return`${e??t}`}const ge=typeof window<"u"?d.useLayoutEffect:d.useEffect;function Fe(e){const t=d.useRef(e);return ge(()=>{t.current=e},[e]),d.useCallback((...n)=>{var r;return(r=t.current)==null?void 0:r.call(t,...n)},[t])}function vt(...e){return Fe(t=>{e.forEach(n=>{if(n)switch(typeof n){case"function":{n(t);break}case"object":{n.current=t;break}}})})}function yt(e){const t=d.useRef({...e});return ge(()=>{for(const n in e)t.current[n]=e[n]},[e]),t.current}const En=d.createContext(null);function Bs(e,t){const n=d.useRef({getLayout:()=>({}),setLayout:Ds});d.useImperativeHandle(t,()=>n.current,[]),ge(()=>{Object.assign(n.current,Sn({groupId:e}))})}function ut({children:e,className:t,defaultLayout:n,disableCursor:r,disabled:s,elementRef:o,groupRef:f,id:i,onLayoutChange:l,onLayoutChanged:c,orientation:p="horizontal",resizeTargetMinimumSize:v={coarse:20,fine:10},style:h,...w}){const j=d.useRef({onLayoutChange:{},onLayoutChanged:{}}),g=Fe(M=>{pe(j.current.onLayoutChange,M)||(j.current.onLayoutChange=M,l==null||l(M))}),y=Fe(M=>{pe(j.current.onLayoutChanged,M)||(j.current.onLayoutChanged=M,c==null||c(M))}),x=bt(i),m=d.useRef(null),[k,S]=Vs(),b=d.useRef({lastExpandedPanelSizes:{},layouts:{},panels:[],resizeTargetMinimumSize:v,separators:[]}),P=vt(m,o);Bs(x,f);const N=Fe((M,E)=>{const V=he(),F=Vt(M),z=de(M);if(z){let D=!1;switch(V.state){case"active":{D=V.hitRegions.some(W=>W.group===F);break}}return{flexGrow:z.layout[E]??1,pointerEvents:D?"none":void 0}}return{flexGrow:(n==null?void 0:n[E])??1}}),I=yt({defaultLayout:n,disableCursor:r}),H=d.useMemo(()=>({get disableCursor(){return!!I.disableCursor},getPanelStyles:N,id:x,orientation:p,registerPanel:M=>{const E=b.current;return E.panels=dt(p,[...E.panels,M]),S(),()=>{E.panels=E.panels.filter(V=>V!==M),S()}},registerSeparator:M=>{const E=b.current;return E.separators=dt(p,[...E.separators,M]),S(),()=>{E.separators=E.separators.filter(V=>V!==M),S()}},togglePanelDisabled:(M,E)=>{const V=b.current.panels.find(D=>D.id===M);V&&(V.panelConstraints.disabled=E);const F=Vt(x),z=de(x);F&&z&&oe(F,{...z,derivedPanelConstraints:ct(F)})},toggleSeparatorDisabled:(M,E)=>{const V=b.current.separators.find(F=>F.id===M);V&&(V.disabled=E)}}),[N,x,S,p,I]),L=d.useRef(null);return ge(()=>{const M=m.current;if(M===null)return;const E=b.current;let V;if(I.defaultLayout!==void 0&&Object.keys(I.defaultLayout).length===E.panels.length){V={};for(const te of E.panels){const O=I.defaultLayout[te.id];O!==void 0&&(V[te.id]=O)}}const F={disabled:!!s,element:M,id:x,mutableState:{defaultLayout:V,disableCursor:!!I.disableCursor,expandedPanelSizes:b.current.lastExpandedPanelSizes,layouts:b.current.layouts},orientation:p,panels:E.panels,resizeTargetMinimumSize:E.resizeTargetMinimumSize,separators:E.separators};L.current=F;const z=_s(F),{defaultLayoutDeferred:D,derivedPanelConstraints:W,layout:Z}=de(F.id,!0);!D&&W.length>0&&(g(Z),y(Z));const J=mt(x,te=>{const{defaultLayoutDeferred:O,derivedPanelConstraints:$,layout:R}=te.next;if(O||$.length===0)return;const G=F.panels.map(({id:Y})=>Y).join(",");F.mutableState.layouts[G]=R,$.forEach(Y=>{if(Y.collapsible){const{layout:Ce}=te.prev??{};if(Ce){const be=K(Y.collapsedSize,R[Y.panelId]),et=K(Y.collapsedSize,Ce[Y.panelId]);be&&!et&&(F.mutableState.expandedPanelSizes[Y.panelId]=Ce[Y.panelId])}}});const ee=he().state!=="active";g(R),ee&&y(R)});return()=>{L.current=null,z(),J()}},[s,x,y,g,p,k,I]),d.useEffect(()=>{const M=L.current;M&&(M.mutableState.defaultLayout=n,M.mutableState.disableCursor=!!r)}),a.jsx(En.Provider,{value:H,children:a.jsx("div",{...w,className:t,"data-group":!0,"data-testid":x,id:x,ref:P,style:{height:"100%",width:"100%",overflow:"hidden",...h,display:"flex",flexDirection:p==="horizontal"?"row":"column",flexWrap:"nowrap",touchAction:p==="horizontal"?"pan-y":"pan-x"},children:e})})}ut.displayName="Group";function wt(){const e=d.useContext(En);return B(e,"Group Context not found; did you render a Panel or Separator outside of a Group?"),e}function Hs(e,t){const{id:n}=wt(),r=d.useRef({collapse:lt,expand:lt,getSize:()=>({asPercentage:0,inPixels:0}),isCollapsed:()=>!1,resize:lt});d.useImperativeHandle(t,()=>r.current,[]),ge(()=>{Object.assign(r.current,kn({groupId:n,panelId:e}))})}function Ie({children:e,className:t,collapsedSize:n="0%",collapsible:r=!1,defaultSize:s,disabled:o,elementRef:f,groupResizeBehavior:i="preserve-relative-size",id:l,maxSize:c="100%",minSize:p="0%",onResize:v,panelRef:h,style:w,...j}){const g=!!l,y=bt(l),x=yt({disabled:o}),m=d.useRef(null),k=vt(m,f),{getPanelStyles:S,id:b,orientation:P,registerPanel:N,togglePanelDisabled:I}=wt(),H=v!==null,L=Fe((E,V,F)=>{v==null||v(E,l,F)});ge(()=>{const E=m.current;if(E!==null){const V={element:E,id:y,idIsStable:g,mutableValues:{expandToSize:void 0,prevSize:void 0},onResize:H?L:void 0,panelConstraints:{groupResizeBehavior:i,collapsedSize:n,collapsible:r,defaultSize:s,disabled:x.disabled,maxSize:c,minSize:p}};return N(V)}},[i,n,r,s,H,y,g,c,p,L,N,x]),d.useEffect(()=>{I(y,!!o)},[o,y,I]),Hs(y,h);const M=d.useSyncExternalStore(E=>mt(b,E),()=>JSON.stringify(S(b,y)),()=>JSON.stringify(S(b,y)));return a.jsx("div",{...j,"aria-disabled":o||void 0,"data-panel":!0,"data-testid":y,id:y,ref:k,style:{...qs,display:"flex",flexBasis:0,flexShrink:1,overflow:"visible",...JSON.parse(M)},children:a.jsx("div",{className:t,style:{maxHeight:"100%",maxWidth:"100%",flexGrow:1,overflow:"auto",...w,touchAction:P==="horizontal"?"pan-y":"pan-x"},children:e})})}Ie.displayName="Panel";const qs={minHeight:0,maxHeight:"100%",height:"auto",minWidth:0,maxWidth:"100%",width:"auto",border:"none",borderWidth:0,padding:0,margin:0};function Us({layout:e,panelConstraints:t,panelId:n,panelIndex:r}){let s,o;const f=e[n],i=t.find(l=>l.panelId===n);if(i){const l=i.maxSize,c=i.collapsible?i.collapsedSize:i.minSize,p=[r,r+1];o=me({layout:_e({delta:c-f,initialLayout:e,panelConstraints:t,pivotIndices:p,prevLayout:e}),panelConstraints:t})[n],s=me({layout:_e({delta:l-f,initialLayout:e,panelConstraints:t,pivotIndices:p,prevLayout:e}),panelConstraints:t})[n]}return{valueControls:n,valueMax:s,valueMin:o,valueNow:f}}function ft({children:e,className:t,disabled:n,elementRef:r,id:s,style:o,...f}){const i=bt(s),l=yt({disabled:n}),[c,p]=d.useState({}),[v,h]=d.useState("inactive"),w=d.useRef(null),j=vt(w,r),{disableCursor:g,id:y,orientation:x,registerSeparator:m,toggleSeparatorDisabled:k}=wt(),S=x==="horizontal"?"vertical":"horizontal";ge(()=>{const P=w.current;if(P!==null){const N={disabled:l.disabled,element:P,id:i},I=m(N),H=Ls(M=>{h(M.next.state!=="inactive"&&M.next.hitRegions.some(E=>E.separator===N)?M.next.state:"inactive")}),L=mt(y,M=>{const{derivedPanelConstraints:E,layout:V,separatorToPanels:F}=M.next,z=F.get(N);if(z){const D=z[0],W=z.indexOf(D);p(Us({layout:V,panelConstraints:E,panelId:D.id,panelIndex:W}))}});return()=>{H(),L(),I()}}},[y,i,m,l]),d.useEffect(()=>{k(i,!!n)},[n,i,k]);let b;return n&&!g&&(b="not-allowed"),a.jsx("div",{...f,"aria-controls":c.valueControls,"aria-disabled":n||void 0,"aria-orientation":S,"aria-valuemax":c.valueMax,"aria-valuemin":c.valueMin,"aria-valuenow":c.valueNow,children:e,className:t,"data-separator":n?"disabled":v,"data-testid":i,id:i,ref:j,role:"separator",style:{flexBasis:"auto",cursor:b,...o,flexGrow:0,flexShrink:0,touchAction:"none"},tabIndex:n?void 0:0})}ft.displayName="Separator";const Ws={ghost:"hover:bg-[#F8F4F0] text-[#36342E]",subtle:"hover:bg-[#ECEAE3] text-[#6B6960]"},Gs={sm:"w-7 h-7",md:"w-8 h-8"},Ks={sm:14,md:16};function ie({icon:e,label:t,size:n="md",variant:r="ghost",onClick:s,className:o="",disabled:f=!1,title:i}){return a.jsx("button",{type:"button","aria-label":t,title:i??t,disabled:f,onClick:s,className:["inline-flex items-center justify-center rounded-btn transition-colors",Ws[r],Gs[n],f?"opacity-40 cursor-not-allowed":"",o].filter(Boolean).join(" "),children:a.jsx(e,{size:Ks[n]})})}function Xs({x:e,y:t,items:n,onClose:r}){const[s,o]=d.useState(0),f=d.useRef(null),i=d.useRef([]);d.useEffect(()=>{var c;(c=i.current[0])==null||c.focus()},[]),d.useEffect(()=>{const c=p=>{f.current&&!f.current.contains(p.target)&&r()};return document.addEventListener("mousedown",c),()=>document.removeEventListener("mousedown",c)},[r]);const l=d.useCallback(c=>{var p,v;switch(c.key){case"Escape":c.preventDefault(),r();break;case"ArrowDown":c.preventDefault(),o(h=>{var j;const w=(h+1)%n.length;return(j=i.current[w])==null||j.focus(),w});break;case"ArrowUp":c.preventDefault(),o(h=>{var j;const w=(h-1+n.length)%n.length;return(j=i.current[w])==null||j.focus(),w});break;case"Home":c.preventDefault(),o(0),(p=i.current[0])==null||p.focus();break;case"End":c.preventDefault(),o(n.length-1),(v=i.current[n.length-1])==null||v.focus();break}},[n.length,r]);return a.jsx("div",{ref:f,role:"menu",className:"bg-card border border-border rounded-card shadow-card-hover py-1 min-w-[160px]",style:{position:"fixed",left:e,top:t,zIndex:100},onKeyDown:l,children:n.map((c,p)=>{const v=c.icon,h=c.variant==="danger";return a.jsxs("button",{ref:w=>{i.current[p]=w},role:"menuitem",tabIndex:s===p?0:-1,onClick:()=>{c.onClick(),r()},className:["flex items-center gap-2 w-full text-left px-3 py-2 text-sm transition-colors",h?"text-danger hover:bg-danger/10":"text-ink hover:bg-hover"].join(" "),children:[a.jsx(v,{size:14}),c.label]},c.label)})})}function Ys({sessionId:e,defaultMode:t}){const[n,r]=d.useState([]),[s,o]=d.useState(""),[f,i]=d.useState(t||"quick"),[l,c]=d.useState(!1),p=d.useRef(null),v=d.useRef(null);d.useEffect(()=>{p.current&&(p.current.scrollTop=p.current.scrollHeight)},[n]);const h=async()=>{var g;const w=s.trim();if(!w||l)return;const j={role:"user",content:w,timestamp:new Date().toISOString()};r(y=>[...y,j]),o(""),c(!0);try{const{task_id:y}=await U.chatStart(e,w,f);let x;const m=150;let k=0;do await new Promise(b=>setTimeout(b,2e3)),x=await U.chatPoll(e,y),k++,k>=m&&(x={complete:!0,output_lines:["Build timed out after 5 minutes."],files_changed:[],returncode:1});while(!x.complete);const S={role:"system",content:x.output_lines.join(`
|
|
162
|
+
`)||"Done.",timestamp:new Date().toISOString(),filesChanged:x.files_changed};r(b=>[...b,S])}catch(y){const x={role:"system",content:`Error: ${y instanceof Error?y.message:"Request failed"}`,timestamp:new Date().toISOString()};r(m=>[...m,x])}finally{c(!1),(g=v.current)==null||g.focus()}};return a.jsxs("div",{className:"flex flex-col h-full",children:[a.jsxs("div",{ref:p,className:"flex-1 overflow-y-auto p-3 space-y-3 terminal-scroll",children:[n.length===0&&a.jsx("div",{className:"text-xs text-muted text-center py-8",children:"Send a message to iterate on your project."}),n.map((w,j)=>a.jsx("div",{className:`flex ${w.role==="user"?"justify-end":"justify-start"}`,children:a.jsxs("div",{className:`max-w-[80%] rounded-lg px-3 py-2 text-xs ${w.role==="user"?"bg-primary/10 text-ink":"bg-hover text-ink"}`,children:[a.jsx("p",{className:"whitespace-pre-wrap",children:w.content}),w.filesChanged&&w.filesChanged.length>0&&a.jsxs("div",{className:"mt-2 pt-2 border-t border-border",children:[a.jsx("span",{className:"text-xs text-muted font-semibold uppercase",children:"Files changed:"}),a.jsx("ul",{className:"mt-1 space-y-0.5",children:w.filesChanged.map((g,y)=>a.jsx("li",{className:"text-xs font-mono text-muted",children:g},y))})]})]})},j)),l&&a.jsx("div",{className:"flex justify-start",children:a.jsxs("div",{className:"bg-hover text-ink rounded-lg px-3 py-2 text-xs",children:["Building",a.jsx("span",{className:"animate-pulse",children:"..."})]})})]}),a.jsxs("div",{className:"border-t border-border p-2 flex-shrink-0",children:[a.jsx("div",{className:"flex items-center gap-1 mb-2",children:["quick","standard","max"].map(w=>a.jsx("button",{onClick:()=>i(w),className:`text-xs font-semibold px-3 py-1.5 rounded-btn transition-colors capitalize ${f===w?"bg-primary text-white":"text-muted hover:text-ink"}`,children:w},w))}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("input",{ref:v,type:"text",value:s,onChange:w=>o(w.target.value),onKeyDown:w=>{w.key==="Enter"&&!w.shiftKey&&(w.preventDefault(),h())},placeholder:"Ask AI to modify your project...",className:"flex-1 px-3 py-1.5 text-xs bg-card border border-border rounded-btn outline-none focus:border-primary transition-colors",disabled:l}),a.jsx(Le,{size:"sm",icon:Gr,onClick:h,disabled:l||!s.trim(),"aria-label":"Send message",children:"Send"})]})]})]})}const rn=[{id:"build",label:"Build Log",icon:on},{id:"agents",label:"Agents",icon:ur},{id:"quality",label:"Quality",icon:Qr},{id:"chat",label:"AI Chat",icon:Vr}];function Qs({status:e}){switch(e){case"pass":return a.jsx(ar,{size:14,className:"text-success"});case"fail":return a.jsx(Qe,{size:14,className:"text-danger"});default:return a.jsx(rr,{size:14,className:"text-muted"})}}function Zs({agents:e}){return!e||e.length===0?a.jsx("div",{className:"p-4 text-xs text-muted",children:"No agents running."}):a.jsx("div",{className:"p-2 space-y-1 overflow-y-auto terminal-scroll",children:e.map(t=>a.jsxs("div",{className:"flex items-center gap-2 px-3 py-2 rounded-btn bg-hover text-xs",children:[a.jsx("span",{className:"font-semibold text-ink truncate",children:t.name}),a.jsx("span",{className:"text-xs font-mono text-muted-accessible px-1.5 py-0.5 rounded-btn bg-card",children:t.type}),a.jsx("span",{className:`text-xs font-semibold ${t.status==="running"?"text-success":"text-muted"}`,children:t.status}),a.jsx("span",{className:"ml-auto text-xs text-muted-accessible font-mono truncate max-w-[200px]",children:t.task})]},t.id))})}function Js({checklist:e}){return!e||!e.items||e.items.length===0?a.jsx("div",{className:"p-4 text-xs text-muted",children:"No quality gate data available."}):a.jsxs("div",{className:"p-2 space-y-1 overflow-y-auto terminal-scroll",children:[a.jsxs("div",{className:"flex items-center gap-3 px-3 py-2 text-xs text-muted-accessible font-semibold uppercase",children:[a.jsx("span",{children:"Gate"}),a.jsxs("span",{className:"ml-auto",children:[e.passed,"/",e.total," passed"]})]}),e.items.map(t=>a.jsxs("div",{className:"flex items-center gap-2 px-3 py-1.5 rounded-btn hover:bg-hover text-xs",children:[a.jsx(Qs,{status:t.status}),a.jsx("span",{className:"text-ink",children:t.label}),t.details&&a.jsx("span",{className:"ml-auto text-xs text-muted-accessible truncate max-w-[200px]",children:t.details})]},t.id))]})}function eo({logs:e,logsLoading:t,agents:n,checklist:r,sessionId:s,subscribe:o,buildMode:f}){var c;const[i,l]=d.useState("build");return a.jsxs("div",{className:"h-full flex flex-col bg-card",children:[a.jsx("div",{role:"tablist",className:"flex items-center border-b border-border px-2 flex-shrink-0",children:rn.map(p=>{const v=p.icon,h=i===p.id;return a.jsxs("button",{role:"tab","aria-selected":h,onClick:()=>l(p.id),className:`flex items-center gap-1.5 px-3 py-2 text-xs font-medium transition-colors border-b-2 ${h?"border-primary text-primary":"border-transparent text-muted hover:text-ink"}`,children:[a.jsx(v,{size:14}),p.label]},p.id)})}),a.jsxs("div",{role:"tabpanel","aria-label":(c=rn.find(p=>p.id===i))==null?void 0:c.label,className:"flex-1 min-h-0 overflow-hidden",children:[i==="build"&&a.jsx(Zn,{logs:e,loading:t,subscribe:o}),i==="agents"&&a.jsx(Zs,{agents:n}),i==="quality"&&a.jsx(Js,{checklist:r}),i==="chat"&&a.jsx(Ys,{sessionId:s,defaultMode:f})]})]})}function pt(e,t,n){var o;if(t==="directory")return n?a.jsx(sn,{size:14}):a.jsx(Tr,{size:14});const r=((o=e.split(".").pop())==null?void 0:o.toLowerCase())||"";return{js:a.jsx(se,{size:14,className:"text-yellow-600"}),ts:a.jsx(se,{size:14,className:"text-blue-500"}),tsx:a.jsx(se,{size:14,className:"text-blue-400"}),jsx:a.jsx(se,{size:14,className:"text-yellow-500"}),py:a.jsx(se,{size:14,className:"text-green-600"}),html:a.jsx(zr,{size:14,className:"text-orange-500"}),css:a.jsx(Er,{size:14,className:"text-purple-500"}),json:a.jsx(jr,{size:14,className:"text-green-500"}),md:a.jsx(an,{size:14,className:"text-muted"}),go:a.jsx(se,{size:14,className:"text-cyan-600"}),rs:a.jsx(se,{size:14,className:"text-orange-600"}),rb:a.jsx(se,{size:14,className:"text-red-500"}),sh:a.jsx(se,{size:14,className:"text-green-600"})}[r]||a.jsx(Lr,{size:14})}function to(e){var s;const t=((s=e.split(".").pop())==null?void 0:s.toLowerCase())||"",n={js:"javascript",jsx:"javascript",ts:"typescript",tsx:"typescript",py:"python",html:"html",htm:"html",css:"css",scss:"scss",less:"less",json:"json",md:"markdown",go:"go",rs:"rust",sh:"shell",bash:"shell",yml:"yaml",yaml:"yaml",xml:"xml",svg:"xml",sql:"sql",java:"java",kt:"kotlin",rb:"ruby",dockerfile:"dockerfile"},r=e.toLowerCase();return r==="dockerfile"?"dockerfile":r==="makefile"?"makefile":n[t]||"plaintext"}function Rn(e,t){for(const n of e){if(n.path===t)return n.size;if(n.children){const r=Rn(n.children,t);if(r!==void 0)return r}}}function Ln(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}function On({nodes:e,selectedPath:t,onSelect:n,onDelete:r,onContextMenu:s,depth:o=0}){const[f,i]=d.useState(()=>{const l=new Set;return o<2&&e.filter(c=>c.type==="directory").forEach(c=>l.add(c.path)),l});return a.jsx("div",{role:o===0?"tree":"group",children:e.map(l=>{const c=l.type==="directory",p=f.has(l.path),v=l.path===t;return a.jsxs("div",{className:"group/file",children:[a.jsxs("button",{role:"treeitem","aria-label":l.name,"aria-selected":v,...c?{"aria-expanded":p}:{},onContextMenu:h=>{h.preventDefault(),s==null||s(h,l.path,l.name,l.type)},onClick:()=>{c?i(h=>{const w=new Set(h);return w.has(l.path)?w.delete(l.path):w.add(l.path),w}):n(l.path,l.name)},className:`w-full text-left flex items-center gap-1.5 px-2 py-1 text-xs font-mono rounded transition-colors ${v?"bg-primary/10 text-primary":"text-ink/70 hover:bg-hover"}`,style:{paddingLeft:`${o*14+8}px`},children:[c?a.jsx("span",{className:"w-3 flex items-center justify-center flex-shrink-0 text-muted",children:p?a.jsx(pr,{size:14}):a.jsx(hr,{size:14})}):a.jsx("span",{className:"w-3 flex-shrink-0"}),a.jsx("span",{className:`w-5 flex items-center justify-center flex-shrink-0 ${c?"text-primary":""}`,children:pt(l.name,l.type,p)}),a.jsxs("span",{className:"truncate",children:[l.name,c?"/":""]}),!c&&l.size!=null&&l.size>0&&a.jsx("span",{className:"text-xs text-muted ml-auto flex-shrink-0",children:Ln(l.size)}),!c&&r&&a.jsx("span",{role:"button",tabIndex:-1,onClick:h=>{h.stopPropagation(),r(l.path,l.name)},onKeyDown:h=>{h.key==="Enter"&&(h.stopPropagation(),r(l.path,l.name))},className:"text-muted hover:text-danger ml-1 flex-shrink-0 opacity-0 group-hover/file:opacity-100 transition-opacity cursor-pointer",title:"Delete file",children:a.jsx(Qe,{size:12})})]}),c&&p&&l.children&&a.jsx(On,{nodes:l.children,selectedPath:t,onSelect:n,onDelete:r,onContextMenu:s,depth:o+1})]},l.path)})})}function Dn(e,t=""){const n=[];for(const r of e)r.type==="file"&&n.push({path:r.path,name:r.name}),r.children&&n.push(...Dn(r.children,r.path+"/"));return n}function no(){const[e,t]=d.useState({}),[n,r]=d.useState(""),[s,o]=d.useState(""),[f,i]=d.useState(!0),[l,c]=d.useState(null),[p,v]=d.useState(new Set),h=d.useCallback(async()=>{try{const x=await U.getSecrets();t(x)}catch{}i(!1)},[]);d.useEffect(()=>{h()},[h]);const w=async()=>{const x=n.trim();if(x){if(!/^[A-Z_][A-Z0-9_]*$/.test(x)){c("Key must be a valid ENV_VAR name (uppercase letters, digits, underscores)");return}c(null);try{await U.setSecret(x,s),r(""),o(""),await h()}catch(m){c(m instanceof Error?m.message:"Failed to set secret")}}},j=async x=>{if(window.confirm(`Delete secret "${x}"?`))try{await U.deleteSecret(x),await h()}catch(m){c(m instanceof Error?m.message:"Failed to delete secret")}},g=x=>{v(m=>{const k=new Set(m);return k.has(x)?k.delete(x):k.add(x),k})},y=Object.keys(e);return f?a.jsx("div",{className:"p-6",children:a.jsx("div",{className:"text-sm text-muted animate-pulse",children:"Loading secrets..."})}):a.jsx("div",{className:"h-full flex flex-col",children:a.jsxs("div",{className:"p-6 overflow-y-auto",children:[a.jsx("h3",{className:"text-h3 font-heading text-ink mb-2",children:"Environment Secrets"}),a.jsxs("div",{className:"flex items-start gap-2 px-4 py-3 rounded-btn border border-warning/30 bg-warning/5 mb-6",children:[a.jsx(na,{size:16,className:"text-warning flex-shrink-0 mt-0.5"}),a.jsx("p",{className:"text-xs text-warning leading-relaxed",children:"Secrets are stored locally in plaintext and injected as environment variables during builds. They are never committed to the project repository."})]}),y.length>0&&a.jsx("div",{className:"card mb-6",children:a.jsxs("table",{className:"w-full text-sm",children:[a.jsx("thead",{children:a.jsxs("tr",{className:"border-b border-border",children:[a.jsx("th",{className:"text-left px-4 py-2 text-xs font-semibold text-muted-accessible uppercase tracking-wider",children:"Key"}),a.jsx("th",{className:"text-left px-4 py-2 text-xs font-semibold text-muted-accessible uppercase tracking-wider",children:"Value"}),a.jsx("th",{className:"w-20 px-4 py-2"})]})}),a.jsx("tbody",{children:y.map(x=>a.jsxs("tr",{className:"border-b border-border last:border-b-0",children:[a.jsx("td",{className:"px-4 py-2.5 font-mono text-xs text-ink",children:x}),a.jsx("td",{className:"px-4 py-2.5 font-mono text-xs text-muted-accessible",children:a.jsxs("span",{className:"flex items-center gap-2",children:[a.jsx("span",{children:p.has(x)?e[x]:"***"}),a.jsx("button",{onClick:()=>g(x),className:"text-muted hover:text-ink transition-colors",title:p.has(x)?"Hide value":"Show value",children:p.has(x)?a.jsx(vr,{size:14}):a.jsx(Oe,{size:14})})]})}),a.jsx("td",{className:"px-4 py-2.5 text-right",children:a.jsx("button",{onClick:()=>j(x),className:"text-muted hover:text-danger transition-colors",title:"Delete secret",children:a.jsx(ln,{size:14})})})]},x))})]})}),y.length===0&&a.jsx("div",{className:"card p-4 mb-6",children:a.jsx("p",{className:"text-sm text-muted-accessible text-center py-4",children:"No secrets configured yet. Add your first secret below."})}),a.jsxs("div",{className:"card p-4",children:[a.jsx("label",{className:"block text-xs font-semibold text-muted-accessible uppercase tracking-wider mb-3",children:"Add Secret"}),l&&a.jsx("div",{className:"text-xs text-danger mb-3 px-1",children:l}),a.jsxs("div",{className:"flex items-end gap-3",children:[a.jsxs("div",{className:"flex-1",children:[a.jsx("label",{className:"block text-xs text-muted-accessible mb-1",children:"Key"}),a.jsx("input",{type:"text",value:n,onChange:x=>r(x.target.value.toUpperCase()),placeholder:"API_KEY",className:"w-full px-3 py-2 text-sm font-mono bg-hover border border-border rounded-btn text-ink placeholder:text-muted"})]}),a.jsxs("div",{className:"flex-1",children:[a.jsx("label",{className:"block text-xs text-muted-accessible mb-1",children:"Value"}),a.jsx("input",{type:"password",value:s,onChange:x=>o(x.target.value),placeholder:"secret value",className:"w-full px-3 py-2 text-sm font-mono bg-hover border border-border rounded-btn text-ink placeholder:text-muted"})]}),a.jsxs("button",{onClick:w,disabled:!n.trim(),className:"flex items-center gap-1.5 px-4 py-2 text-sm font-medium rounded-btn border border-primary bg-primary/10 text-primary hover:bg-primary/20 transition-colors disabled:opacity-40 disabled:cursor-not-allowed",children:[a.jsx(nr,{size:14}),"Add"]})]})]})]})})}function ro({session:e,onClose:t}){var Pt;const[n,r]=d.useState(null),[s,o]=d.useState(""),[f,i]=d.useState(null),[l,c]=d.useState(null),[p,v]=d.useState(!1),[h,w]=d.useState("code"),[j,g]=d.useState(!1),[y,x]=d.useState(!1),[m,k]=d.useState(e),S=d.useRef(null),[b,P]=d.useState([]),[N,I]=d.useState(!1),[H,L]=d.useState(""),M=d.useRef(null),E=d.useRef(null),[V,F]=d.useState(0),[z,D]=d.useState(null),[W,Z]=d.useState("standard"),[J,te]=d.useState("claude"),[O,$]=d.useState(null),[R,G]=d.useState(null),[ee,Y]=d.useState(!1),[Ce,be]=d.useState(!1),et=d.useCallback(async()=>{try{await U.stopSession(),Y(!1),be(!1)}catch{}},[]),$n=d.useCallback(async()=>{try{await U.pauseSession(),be(!0)}catch{}},[]),In=d.useCallback(async()=>{try{await U.resumeSession(),be(!1)}catch{}},[]);d.useEffect(()=>{const u=async()=>{try{const T=await U.getStatus();Y(T.running),be(T.paused),T.provider&&te(T.provider)}catch{}};u();const C=setInterval(u,1e4);return()=>clearInterval(C)},[]),d.useEffect(()=>{if(!(R!=null&&R.loading))return;const u=setInterval(()=>{G(C=>C?{...C,elapsed:Math.floor((Date.now()-C.startTime)/1e3)}:null)},1e3);return()=>clearInterval(u)},[R==null?void 0:R.loading]);const[A,Tn]=d.useState(null);d.useEffect(()=>{U.getPreviewInfo(m.id).then(Tn).catch(()=>{})},[m.id]);const Fn=(A==null?void 0:A.preview_url)||`/api/sessions/${encodeURIComponent(m.id)}/preview/index.html`,[Be,jt]=d.useState([]),[ae,He]=d.useState(0);d.useEffect(()=>{A!=null&&A.preview_url&&(jt([A.preview_url]),He(0))},[A==null?void 0:A.preview_url]);const Pe=Be[ae]||Fn,[kt,St]=d.useState(Pe),ve=d.useCallback(async()=>{try{const u=await U.getSessionDetail(m.id);k(u)}catch{}},[m.id]),An=d.useCallback((u,C,T,q)=>{u.preventDefault(),D({x:u.clientX,y:u.clientY,path:C,name:T,type:q})},[]),_n=d.useCallback(()=>{ae>0&&(He(u=>u-1),F(u=>u+1))},[ae]),Vn=d.useCallback(()=>{ae<Be.length-1&&(He(u=>u+1),F(u=>u+1))},[ae,Be.length]),Bn=d.useCallback(u=>{jt(C=>[...C.slice(0,ae+1),u]),He(C=>C+1),F(C=>C+1)},[ae]);d.useEffect(()=>{St(Pe)},[Pe]);const qe=d.useCallback(async()=>{G({type:"review",loading:!0,startTime:Date.now(),elapsed:0}),$(null);try{const u=await U.reviewProject(m.id);$(u.output)}catch(u){$(`Error: ${u instanceof Error?u.message:"Unknown"}`)}finally{G(null)}},[m.id]),Ue=d.useCallback(async()=>{G({type:"test",loading:!0,startTime:Date.now(),elapsed:0}),$(null);try{const u=await U.testProject(m.id);$(u.output)}catch(u){$(`Error: ${u instanceof Error?u.message:"Unknown"}`)}finally{G(null)}},[m.id]),tt=d.useCallback(async()=>{G({type:"explain",loading:!0,startTime:Date.now(),elapsed:0}),$(null);try{const u=await U.explainProject(m.id);$(u.output)}catch(u){$(`Error: ${u instanceof Error?u.message:"Unknown"}`)}finally{G(null)}},[m.id]),nt=d.useCallback(async(u,C)=>{if(window.confirm(`Delete "${C}"?`))try{await U.deleteSessionFile(m.id,u),n===u&&(r(null),o(""),i(null),c(null),g(!1)),await ve()}catch(q){const ue=q instanceof Error?q.message:"Unknown error";window.alert(`Delete failed: ${ue}`)}},[m.id,n,ve]),Hn=d.useCallback(u=>u.type==="file"?[{label:"Review",icon:Oe,onClick:()=>{qe()}},{label:"Generate Tests",icon:at,onClick:()=>{Ue()}},{label:"Explain",icon:Ot,onClick:()=>{tt()}},{label:"Delete",icon:ln,onClick:()=>{nt(u.path,u.name)},variant:"danger"}]:[{label:"Review Project",icon:Oe,onClick:()=>{qe()}},{label:"Run Tests",icon:at,onClick:()=>{Ue()}}],[qe,Ue,tt,nt]),Me=d.useCallback(async(u,C)=>{j&&n&&l!==null&&P(q=>q.map(ue=>ue.path===n?{...ue,content:l,modified:!0}:ue));const T=b.find(q=>q.path===u);if(T){r(u),o(C),i(T.content),c(T.content),g(T.modified);return}r(u),o(C),v(!0),g(!1);try{const q=m.id?await U.getSessionFileContent(m.id,u):await U.getFileContent(u);i(q.content),c(q.content),P(ue=>[...ue,{path:u,name:C,content:q.content,modified:!1}])}catch{i("[Error loading file]"),c("[Error loading file]")}finally{v(!1)}},[m.id,j,n,l,b]),rt=d.useCallback(async()=>{var u;if(!(!n||l===null||!m.id)){x(!0);try{await U.saveSessionFile(m.id,n,l),i(l),g(!1),P(T=>T.map(q=>q.path===n?{...q,content:l,modified:!1}:q));const C=((u=n.split(".").pop())==null?void 0:u.toLowerCase())||"";["html","css","js","jsx","ts","tsx"].includes(C)&&F(T=>T+1)}catch(C){const T=C instanceof Error?C.message:"Unknown error";window.alert(`Save failed: ${T}`)}finally{x(!1)}}},[n,l,m.id]),zt=d.useCallback(u=>{const C=b.find(T=>T.path===u);if(!(C!=null&&C.modified&&!window.confirm("Unsaved changes. Close anyway?"))&&(P(T=>T.filter(q=>q.path!==u)),n===u)){const T=b.filter(q=>q.path!==u);if(T.length>0){const q=T[T.length-1];r(q.path),o(q.name),i(q.content),c(q.content),g(q.modified)}else r(null),o(""),i(null),c(null),g(!1)}},[b,n]);d.useEffect(()=>{const u=C=>{(C.metaKey||C.ctrlKey)&&C.key==="s"&&(C.preventDefault(),j&&n&&rt()),(C.metaKey||C.ctrlKey)&&C.key==="p"&&(C.preventDefault(),I(T=>!T),L("")),C.key==="Escape"&&N&&I(!1)};return window.addEventListener("keydown",u),()=>window.removeEventListener("keydown",u)},[j,n,rt,N]),d.useEffect(()=>{N&&M.current&&M.current.focus()},[N]);const Nt=Dn(m.files),Ee=H?Nt.filter(u=>u.path.toLowerCase().includes(H.toLowerCase())):Nt;d.useEffect(()=>{const u=m.files.find(C=>C.name==="index.html"&&C.type==="file");u&&Me(u.path,u.name)},[]);const qn=d.useCallback(u=>{u!==void 0&&(c(u),g(u!==f))},[f]),Un=d.useCallback(u=>{S.current=u},[]),Wn=d.useCallback(async()=>{const u=window.prompt("New file name (e.g. src/utils.ts):");if(!(!u||!u.trim()))try{await U.createSessionFile(m.id,u.trim()),await ve()}catch(C){const T=C instanceof Error?C.message:"Unknown error";window.alert(`Create file failed: ${T}`)}},[m.id,ve]),Gn=d.useCallback(async()=>{const u=window.prompt("New folder name (e.g. src/components):");if(!(!u||!u.trim()))try{await U.createSessionDirectory(m.id,u.trim()),await ve()}catch(C){const T=C instanceof Error?C.message:"Unknown error";window.alert(`Create folder failed: ${T}`)}},[m.id,ve]),Ct=n?Rn(m.files,n):void 0,Kn=((Pt=s.split(".").pop())==null?void 0:Pt.toUpperCase())||"";return a.jsxs("div",{className:"flex flex-col h-full relative",children:[a.jsxs("div",{className:"bg-card px-3 py-2 flex items-center gap-3 flex-shrink-0 border-b border-border",children:[a.jsx("button",{onClick:()=>{j&&!window.confirm("Unsaved changes. Discard?")||t()},className:"text-xs font-medium px-3 py-1.5 rounded-btn border border-border text-muted hover:text-ink hover:bg-hover transition-colors",children:"Back"}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsx("h2",{className:"text-sm font-bold text-ink truncate",children:m.id}),a.jsx("p",{className:"text-xs font-mono text-muted-accessible truncate",children:m.path})]}),a.jsx("span",{className:`text-xs font-semibold px-2 py-0.5 rounded-full ${m.status==="completed"||m.status==="completion_promise_fulfilled"?"bg-success/10 text-success":"bg-muted/10 text-muted"}`,children:m.status}),!ee&&a.jsx(Le,{variant:"primary",size:"sm",icon:Dt,onClick:async()=>{try{const u=m.prd||"";if(!u.trim()){window.alert("No PRD found for this project. Go to Home to start a new build.");return}await U.startSession({prd:u,provider:J,projectDir:m.path}),Y(!0)}catch(u){window.alert(`Failed to start: ${u instanceof Error?u.message:"Unknown error"}`)}},title:"Start build for this project",children:"Build"}),ee&&a.jsxs("div",{className:"flex items-center gap-1 border-l border-border pl-3 ml-1",children:[Ce?a.jsx(Le,{variant:"ghost",size:"sm",icon:Dt,onClick:In,title:"Resume build",children:"Resume"}):a.jsx(Le,{variant:"ghost",size:"sm",icon:Jn,onClick:$n,title:"Pause build",children:"Pause"}),a.jsx(Le,{variant:"danger",size:"sm",icon:er,onClick:et,title:"Stop build",children:"Stop"})]}),a.jsx(ie,{icon:Oe,label:"Review project",size:"sm",onClick:qe,disabled:!!(R!=null&&R.loading)}),a.jsx(ie,{icon:at,label:"Run tests",size:"sm",onClick:Ue,disabled:!!(R!=null&&R.loading)}),a.jsx(ie,{icon:Ot,label:"Explain project",size:"sm",onClick:tt,disabled:!!(R!=null&&R.loading)})]}),a.jsx("div",{className:"flex-1 min-h-0",children:a.jsxs(ut,{orientation:"vertical",children:[a.jsx(Ie,{defaultSize:70,minSize:40,children:a.jsxs(ut,{orientation:"horizontal",className:"h-full",children:[a.jsx(Ie,{defaultSize:20,minSize:15,children:a.jsxs("div",{className:"h-full flex flex-col border-r border-border bg-card",children:[a.jsxs("div",{className:"px-3 py-2 border-b border-border flex items-center gap-2",children:[a.jsx("span",{className:"text-xs text-muted-accessible uppercase tracking-wider font-semibold flex-1",children:"Files"}),a.jsxs("button",{onClick:Wn,title:"New File",className:"flex items-center gap-1 text-xs text-muted-accessible hover:text-primary px-2.5 py-1 rounded border border-border hover:border-primary/30 transition-colors",children:[a.jsx(Cr,{size:12})," New"]}),a.jsxs("button",{onClick:Gn,title:"New Folder",className:"flex items-center gap-1 text-xs text-muted-accessible hover:text-primary px-2.5 py-1 rounded border border-border hover:border-primary/30 transition-colors",children:[a.jsx($r,{size:12})," New"]})]}),a.jsx("div",{className:"flex-1 overflow-y-auto terminal-scroll",children:m.files.length>0?a.jsx(On,{nodes:m.files,selectedPath:n,onSelect:Me,onDelete:nt,onContextMenu:An}):a.jsx("div",{className:"p-4 text-xs text-muted",children:"No files"})})]})}),a.jsx(ft,{className:"w-1 bg-border hover:bg-primary/30 transition-colors cursor-col-resize"}),a.jsx(Ie,{defaultSize:80,minSize:40,children:a.jsxs("div",{className:"h-full flex flex-col min-w-0",children:[a.jsx("div",{className:"flex items-center border-b border-border bg-hover px-1 flex-shrink-0",role:"tablist",children:[{id:"code",label:"Code",icon:gr},{id:"preview",label:"Preview",icon:Oe},{id:"config",label:"Config",icon:Xn},{id:"secrets",label:"Secrets",icon:Ar},{id:"prd",label:"PRD",icon:an}].map(u=>a.jsxs("button",{role:"tab","aria-selected":h===u.id,onClick:()=>w(u.id),className:`flex items-center gap-1.5 px-4 py-2 text-xs font-medium border-b-2 transition-colors ${h===u.id?"border-primary text-primary":"border-transparent text-muted hover:text-ink hover:border-border"}`,children:[a.jsx(u.icon,{size:14}),u.label]},u.id))}),a.jsxs("div",{className:"flex-1 min-h-0",role:"tabpanel",children:[h==="code"&&a.jsxs("div",{className:"h-full flex flex-col min-w-0",children:[b.length>0&&a.jsx("div",{className:"flex items-center border-b border-border bg-hover overflow-x-auto flex-shrink-0",children:b.map(u=>a.jsxs("button",{onClick:()=>Me(u.path,u.name),className:`flex items-center gap-1.5 px-3 py-1.5 text-[11px] font-mono border-r border-border whitespace-nowrap transition-colors ${u.path===n?"bg-card text-ink":"text-muted hover:text-ink hover:bg-card"}`,children:[a.jsx("span",{className:"w-4 flex items-center justify-center",children:pt(u.name,"file")}),u.name,u.modified&&a.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-primary"}),a.jsx("span",{role:"button",tabIndex:-1,title:"Close tab",onClick:C=>{C.stopPropagation(),zt(u.path)},onKeyDown:C=>{C.key==="Enter"&&(C.stopPropagation(),zt(u.path))},className:"text-muted hover:text-danger ml-1 cursor-pointer",children:a.jsx(Qe,{size:12})})]},u.path))}),n?a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"px-4 py-1.5 border-b border-border flex items-center gap-2 flex-shrink-0 bg-hover",children:[a.jsx("span",{className:"text-xs font-mono text-secondary truncate",children:n}),y&&a.jsx("span",{className:"text-xs text-primary animate-pulse flex-shrink-0",children:"Saving..."}),a.jsx("span",{className:"ml-auto text-xs text-muted/50 font-mono",children:Ct!=null?Ln(Ct):""}),a.jsx("span",{className:"text-xs text-muted font-mono uppercase",children:Kn}),j&&a.jsx("button",{onClick:rt,className:"text-xs font-medium px-2 py-0.5 rounded border border-primary/40 bg-primary/10 text-primary hover:bg-primary/20 transition-colors",children:"Save"})]}),a.jsx("div",{className:"flex-1 min-h-0",children:p?a.jsx("div",{className:"text-muted text-xs animate-pulse p-4",children:"Loading..."}):a.jsx(fs,{value:l??"",language:to(s),theme:"vs",onChange:qn,onMount:Un,options:{minimap:{enabled:!1},fontSize:13,lineNumbers:"on",wordWrap:"on",scrollBeyondLastLine:!1,automaticLayout:!0,padding:{top:8},renderLineHighlight:"line",smoothScrolling:!0,cursorBlinking:"smooth",folding:!0,bracketPairColorization:{enabled:!0}}})})]}):a.jsx("div",{className:"flex-1 flex items-center justify-center text-muted text-sm",children:"Select a file to view its contents"})]}),h==="preview"&&a.jsxs("div",{className:"h-full flex flex-col",children:[a.jsx("div",{className:"px-3 py-1.5 border-b border-border flex items-center gap-2 bg-hover",children:A!=null&&A.preview_url?a.jsxs(a.Fragment,{children:[a.jsx(ie,{icon:ir,label:"Back",size:"sm",onClick:_n,disabled:ae<=0}),a.jsx(ie,{icon:cr,label:"Forward",size:"sm",onClick:Vn,disabled:ae>=Be.length-1}),a.jsx(ie,{icon:Ur,label:"Refresh",size:"sm",onClick:()=>F(u=>u+1)}),a.jsx("input",{value:kt,onChange:u=>St(u.target.value),onKeyDown:u=>{u.key==="Enter"&&Bn(kt)},className:"flex-1 px-3 py-1 text-xs font-mono bg-card border border-border rounded-btn"}),a.jsx(ie,{icon:sr,label:"Open in new tab",size:"sm",onClick:()=>window.open(Pe,"_blank")})]}):A?a.jsx("div",{className:"flex-1 flex items-center gap-2 text-sm text-muted",children:a.jsx("span",{className:"font-medium text-ink",children:A.description})}):a.jsx("div",{className:"flex-1 flex items-center text-sm text-muted",children:"Detecting project type..."})}),A!=null&&A.preview_url?a.jsx("div",{className:"flex-1 bg-white",children:a.jsx("iframe",{ref:E,src:Pe,title:"Project Preview",className:"w-full h-full border-0",sandbox:"allow-scripts allow-same-origin allow-forms allow-popups"},V)}):A?a.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center gap-4 p-8 text-center",children:[a.jsx("div",{className:"w-16 h-16 rounded-full bg-primary/10 flex items-center justify-center",children:A.type==="api"||A.type==="python-api"?a.jsx(Xr,{size:28,className:"text-primary"}):A.type==="library"?a.jsx(Hr,{size:28,className:"text-primary"}):A.type==="go-app"||A.type==="rust-app"?a.jsx(on,{size:28,className:"text-primary"}):a.jsx(sn,{size:28,className:"text-primary"})}),a.jsxs("div",{children:[a.jsx("h3",{className:"text-lg font-heading text-ink mb-1",children:A.type.replace(/-/g," ").replace(/\b\w/g,u=>u.toUpperCase())}),a.jsx("p",{className:"text-sm text-muted",children:A.description})]}),A.dev_command&&a.jsxs("div",{className:"card p-4 max-w-md w-full",children:[a.jsx("p",{className:"text-xs font-semibold text-muted-accessible uppercase tracking-wider mb-2",children:"Run locally"}),a.jsx("code",{className:"text-sm font-mono text-primary bg-hover px-3 py-2 rounded-btn block",children:A.dev_command})]}),A.port&&a.jsxs("p",{className:"text-xs text-muted",children:["Server runs on port ",A.port]})]}):a.jsx("div",{className:"flex-1 flex items-center justify-center text-muted text-sm",children:"Detecting project type..."})]}),h==="config"&&a.jsx("div",{className:"h-full flex flex-col",children:a.jsxs("div",{className:"p-6 overflow-y-auto",children:[a.jsx("h3",{className:"text-h3 font-heading text-ink mb-4",children:"Project Configuration"}),a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"card p-4",children:[a.jsx("label",{className:"block text-xs font-semibold text-muted-accessible uppercase tracking-wider mb-2",children:"Provider"}),a.jsxs("p",{className:"text-xs text-muted mb-2",children:["Current session: ",a.jsx("span",{className:"font-semibold text-ink capitalize",children:J})]}),a.jsx("div",{className:"flex gap-2",children:["claude","codex","gemini"].map(u=>a.jsx("button",{onClick:()=>{te(u),U.setProvider(u).catch(()=>{})},className:`px-4 py-2 rounded-btn text-sm font-medium border transition-colors capitalize ${J===u?"border-primary bg-primary/10 text-primary":"border-border text-secondary hover:bg-hover"}`,children:u},u))})]}),a.jsxs("div",{className:"card p-4",children:[a.jsx("label",{className:"block text-xs font-semibold text-muted-accessible uppercase tracking-wider mb-2",children:"Build Mode"}),a.jsx("div",{className:"flex gap-2",children:["quick","standard","max"].map(u=>a.jsx("button",{onClick:()=>Z(u),className:`px-4 py-2 rounded-btn text-sm font-medium border transition-colors capitalize ${W===u?"border-primary bg-primary/10 text-primary":"border-border text-secondary hover:bg-hover"}`,children:u},u))})]}),a.jsxs("div",{className:"card p-4",children:[a.jsx("label",{className:"block text-xs font-semibold text-muted-accessible uppercase tracking-wider mb-2",children:"Project Path"}),a.jsx("input",{value:m.path,readOnly:!0,className:"w-full px-3 py-2 text-sm font-mono bg-hover border border-border rounded-btn text-ink"})]}),a.jsxs("div",{className:"card p-4",children:[a.jsx("label",{className:"block text-xs font-semibold text-muted-accessible uppercase tracking-wider mb-2",children:"Session ID"}),a.jsx("input",{value:m.id,readOnly:!0,className:"w-full px-3 py-2 text-sm font-mono bg-hover border border-border rounded-btn text-ink"})]})]})]})}),h==="secrets"&&a.jsx(no,{}),h==="prd"&&a.jsx("div",{className:"h-full flex flex-col",children:a.jsxs("div",{className:"p-6 overflow-y-auto",children:[a.jsx("h3",{className:"text-h3 font-heading text-ink mb-4",children:"Product Requirements"}),m.prd?a.jsx("pre",{className:"text-sm font-mono text-ink whitespace-pre-wrap bg-hover border border-border rounded-card p-4 leading-relaxed",children:m.prd}):a.jsx("div",{className:"text-sm text-muted text-center py-8",children:"No PRD found for this project."})]})})]})]})})]})}),a.jsx(ft,{className:"h-1 bg-border hover:bg-primary/30 cursor-row-resize"}),a.jsx(Ie,{defaultSize:30,minSize:15,collapsible:!0,children:a.jsx(eo,{logs:null,logsLoading:!1,agents:null,checklist:null,sessionId:e.id,buildMode:W})})]})}),(R==null?void 0:R.loading)&&a.jsx("div",{className:"absolute inset-x-0 bottom-0 z-20 bg-card border-t border-border p-4",children:a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("div",{className:"w-4 h-4 border-2 border-primary border-t-transparent rounded-full animate-spin"}),a.jsxs("span",{className:"text-sm font-medium text-ink",children:[R.type==="review"?"Reviewing project":R.type==="test"?"Generating tests":"Analyzing project","..."]}),a.jsxs("span",{className:"text-xs font-mono text-muted",children:[R.elapsed,"s"]})]})}),O&&a.jsxs("div",{className:"absolute inset-x-0 bottom-0 z-20 bg-card border-t border-border p-4 max-h-64 overflow-y-auto",children:[a.jsxs("div",{className:"flex items-center justify-between mb-2",children:[a.jsx("span",{className:"text-xs font-semibold text-ink",children:"Action Output"}),a.jsx(ie,{icon:Qe,label:"Close",size:"sm",onClick:()=>$(null)})]}),a.jsx("pre",{className:"text-xs font-mono text-ink whitespace-pre-wrap",children:O})]}),z&&a.jsx(Xs,{x:z.x,y:z.y,items:Hn(z),onClose:()=>D(null)}),N&&a.jsx("div",{className:"fixed inset-0 z-50 flex items-start justify-center pt-[20vh]",role:"dialog","aria-modal":"true","aria-label":"Quick open file search",onClick:()=>I(!1),children:a.jsxs("div",{className:"bg-card rounded-card shadow-2xl border border-border w-full max-w-lg",onClick:u=>u.stopPropagation(),children:[a.jsx("input",{ref:M,type:"text",value:H,onChange:u=>L(u.target.value),placeholder:"Search files by name...",className:"w-full px-4 py-3 text-sm font-mono border-b border-border outline-none rounded-t-card bg-transparent",onKeyDown:u=>{u.key==="Enter"&&Ee.length>0&&(Me(Ee[0].path,Ee[0].name),I(!1)),u.key==="Escape"&&I(!1)}}),a.jsxs("div",{className:"max-h-64 overflow-y-auto",children:[Ee.slice(0,20).map(u=>a.jsxs("button",{onClick:()=>{Me(u.path,u.name),I(!1)},className:"w-full text-left px-4 py-2 text-xs font-mono hover:bg-primary/5 flex items-center gap-2",children:[a.jsx("span",{className:"w-5 flex items-center justify-center",children:pt(u.name,"file")}),a.jsx("span",{className:"text-ink",children:u.name}),a.jsx("span",{className:"text-muted ml-auto truncate text-xs",children:u.path})]},u.path)),Ee.length===0&&a.jsx("div",{className:"px-4 py-3 text-xs text-muted",children:"No matching files"})]})]})})]})}function uo(){const{sessionId:e}=Yn(),t=Qn(),[n,r]=d.useState(null),[s,o]=d.useState(!0),[f,i]=d.useState(null);return d.useEffect(()=>{e&&(o(!0),i(null),U.getSessionDetail(e).then(l=>{r(l),o(!1)}).catch(l=>{i(l instanceof Error?l.message:"Failed to load session"),o(!1)}))},[e]),s?a.jsx("div",{className:"h-screen bg-background flex items-center justify-center",children:a.jsxs("div",{className:"text-center",children:[a.jsx("div",{className:"text-muted animate-pulse text-sm",children:"Loading project..."}),a.jsx("div",{className:"text-xs font-mono text-muted/50 mt-2",children:e})]})}):f||!n?a.jsx("div",{className:"h-screen bg-background flex items-center justify-center",children:a.jsxs("div",{className:"text-center",children:[a.jsx("p",{className:"text-danger text-sm font-medium",children:"Project not found"}),a.jsx("p",{className:"text-xs text-muted mt-1",children:f||`Session ${e} does not exist`}),a.jsx("button",{onClick:()=>t("/"),className:"mt-4 px-4 py-2 rounded-btn text-sm font-semibold border border-primary/30 text-primary hover:bg-primary/5 transition-all",children:"Back to Home"})]})}):a.jsx("div",{className:"h-screen bg-background flex flex-col",children:a.jsx("div",{className:"flex-1 min-h-0",children:a.jsx(tr,{name:"ProjectWorkspace",children:a.jsx(ro,{session:n,onClose:()=>t("/")})})})})}export{uo as default};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import{c as f,u as h,r as n,a as g,j as e}from"./index-ACgjqVp2.js";import{B as d,P as m}from"./Button-CUOgrX10.js";import{C as j}from"./Card-2UWDXe0P.js";import{u as y,B as b}from"./Badge-ClncXa1x.js";import"./clock-DpWpY1Zx.js";/**
|
|
2
|
+
* @license lucide-react v0.577.0 - ISC
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the ISC license.
|
|
5
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/const N=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],v=f("search",N);function C(r){const s=k(r);return s==="completed"?"completed":s==="running"?"running":s==="failed"?"failed":s==="started"?"started":"empty"}const S={completed:"Completed",complete:"Completed",done:"Completed",completion_promise_fulfilled:"Completed",running:"Running",in_progress:"Running",planning:"Planning",started:"Started",error:"Failed",failed:"Failed",empty:"Empty"};function k(r){return{completion_promise_fulfilled:"completed",complete:"completed",done:"completed",in_progress:"running",planning:"running",error:"failed"}[r]||r}const E=[{key:"all",label:"All"},{key:"running",label:"Running"},{key:"completed",label:"Completed"},{key:"failed",label:"Failed"}];function A(){const r=h(),[s,a]=n.useState(""),[l,p]=n.useState("all"),u=n.useCallback(()=>g.getSessionsHistory(),[]),{data:i}=y(u,15e3,!0),o=n.useMemo(()=>{if(!i)return[];let t=i;if(l!=="all"&&(t=t.filter(c=>c.status===l)),s.trim()){const c=s.trim().toLowerCase();t=t.filter(x=>x.prd_snippet.toLowerCase().includes(c))}return t},[i,l,s]);return e.jsxs("div",{className:"max-w-[1400px] mx-auto px-6 py-8",children:[e.jsxs("div",{className:"flex items-center justify-between mb-6",children:[e.jsx("h1",{className:"font-heading text-h1 text-[#36342E]",children:"Projects"}),e.jsx(d,{icon:m,onClick:()=>r("/"),children:"New Project"})]}),e.jsxs("div",{className:"flex items-center gap-4 mb-6",children:[e.jsxs("div",{className:"relative flex-1 max-w-sm",children:[e.jsx(v,{size:16,className:"absolute left-3 top-1/2 -translate-y-1/2 text-[#6B6960]"}),e.jsx("input",{type:"text",placeholder:"Search projects...","aria-label":"Search projects",value:s,onChange:t=>a(t.target.value),className:"w-full pl-9 pr-3 py-2 text-sm border border-[#ECEAE3] rounded-[5px] bg-white text-[#36342E] placeholder:text-[#939084] focus:outline-none focus:ring-2 focus:ring-[#553DE9]/20 focus:border-[#553DE9]"})]}),e.jsx("div",{className:"flex items-center gap-1",role:"tablist",children:E.map(t=>e.jsx("button",{role:"tab","aria-selected":l===t.key,onClick:()=>p(t.key),className:`px-3 py-1.5 text-xs font-semibold rounded-[3px] transition-colors ${l===t.key?"bg-[#553DE9] text-white":"text-[#6B6960] hover:text-[#36342E] hover:bg-[#F8F4F0]"}`,children:t.label},t.key))})]}),o.length===0?e.jsxs("div",{className:"flex flex-col items-center justify-center py-20 text-center",children:[e.jsx("p",{className:"text-[#6B6960] text-sm mb-4",children:"No projects yet. Start building."}),e.jsx(d,{icon:m,onClick:()=>r("/"),children:"New Project"})]}):e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:o.map(t=>e.jsx(w,{session:t,onClick:()=>r(`/project/${t.id}`)},t.id))})]})}function w({session:r,onClick:s}){const a=new Date(r.date).toLocaleDateString(void 0,{month:"short",day:"numeric",year:"numeric"});return e.jsxs(j,{hover:!0,onClick:s,children:[e.jsxs("div",{className:"flex items-center justify-between mb-2",children:[e.jsx("span",{className:"text-xs text-[#6B6960]",children:a}),e.jsx(b,{status:C(r.status),children:S[r.status]||r.status})]}),e.jsx("h3",{className:"text-sm font-medium text-[#36342E] line-clamp-2 mb-2",children:r.prd_snippet||"Untitled project"}),e.jsx("p",{className:"text-xs text-[#6B6960] truncate",children:r.path})]})}export{A as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as t,a,j as e}from"./index-
|
|
1
|
+
import{r as t,a,j as e}from"./index-ACgjqVp2.js";import{C as l}from"./Card-2UWDXe0P.js";import{E as c}from"./external-link-KmF9dPsz.js";const h=[{id:"claude",name:"Claude",description:"Anthropic Claude Code -- full features"},{id:"codex",name:"Codex",description:"OpenAI Codex CLI -- degraded mode"},{id:"gemini",name:"Gemini",description:"Google Gemini CLI -- degraded mode"}];function p(){const[i,n]=t.useState("claude"),[o,r]=t.useState(!1),[d,x]=t.useState("");t.useEffect(()=>{a.getCurrentProvider().then(s=>n(s.provider)).catch(()=>{}),a.getStatus().then(s=>x(s.version||"")).catch(()=>{})},[]);const m=async s=>{n(s),r(!0);try{await a.setProvider(s)}catch{}finally{r(!1)}};return e.jsxs("div",{className:"max-w-[800px] mx-auto px-6 py-8",children:[e.jsx("h1",{className:"font-heading text-h1 text-[#36342E] mb-8",children:"Settings"}),e.jsxs("section",{className:"mb-10",children:[e.jsx("h2",{className:"text-sm font-semibold text-[#36342E] uppercase tracking-wide mb-4",children:"Provider"}),e.jsx("div",{className:"flex flex-col gap-3",children:h.map(s=>e.jsx(l,{hover:!0,onClick:()=>m(s.id),className:i===s.id?"ring-2 ring-[#553DE9] border-[#553DE9]":"",children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:`w-4 h-4 rounded-full border-2 flex items-center justify-center flex-shrink-0 ${i===s.id?"border-[#553DE9]":"border-[#ECEAE3]"}`,children:i===s.id&&e.jsx("div",{className:"w-2 h-2 rounded-full bg-[#553DE9]"})}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium text-[#36342E]",children:s.name}),e.jsx("p",{className:"text-xs text-[#6B6960]",children:s.description})]})]})},s.id))}),o&&e.jsx("p",{className:"text-xs text-[#6B6960] mt-2",children:"Saving..."})]}),e.jsxs("section",{children:[e.jsx("h2",{className:"text-sm font-semibold text-[#36342E] uppercase tracking-wide mb-4",children:"About"}),e.jsx(l,{children:e.jsxs("div",{className:"flex flex-col gap-3",children:[d&&e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"text-sm text-[#6B6960]",children:"Version"}),e.jsxs("span",{className:"text-sm font-medium text-[#36342E]",children:["v",d]})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"text-sm text-[#6B6960]",children:"Documentation"}),e.jsxs("a",{href:"https://www.autonomi.dev/docs",target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-1 text-sm text-[#553DE9] hover:underline",children:["autonomi.dev/docs ",e.jsx(c,{size:12})]})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"text-sm text-[#6B6960]",children:"GitHub"}),e.jsxs("a",{href:"https://github.com/asklokesh/loki-mode",target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-1 text-sm text-[#553DE9] hover:underline",children:["asklokesh/loki-mode ",e.jsx(c,{size:12})]})]})]})})]})]})}export{p as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{u as c,r,a as x,j as t}from"./index-
|
|
1
|
+
import{u as c,r,a as x,j as t}from"./index-ACgjqVp2.js";import{C as p}from"./Card-2UWDXe0P.js";import{u as d,B as h}from"./Badge-ClncXa1x.js";import"./clock-DpWpY1Zx.js";const g=[{key:"all",label:"All"},{key:"website",label:"Website"},{key:"api",label:"API"},{key:"cli",label:"CLI"},{key:"bot",label:"Bot"},{key:"data",label:"Data"},{key:"other",label:"Other"}];function u(l){return l.replace(/\.md$/i,"").replace(/[-_]/g," ").replace(/\b\w/g,a=>a.toUpperCase())}function k(){const l=c(),[a,o]=r.useState("all"),n=r.useCallback(()=>x.getTemplates(),[]),{data:s}=d(n,6e4,!0),i=r.useMemo(()=>s?a==="all"?s:s.filter(e=>(e.category||"other")===a):[],[s,a]),m=e=>{sessionStorage.setItem("pl_template",e),l("/")};return t.jsxs("div",{className:"max-w-[1400px] mx-auto px-6 py-8",children:[t.jsx("h1",{className:"font-heading text-h1 text-[#36342E] mb-6",children:"Templates"}),t.jsx("div",{className:"flex items-center gap-1 mb-6",role:"tablist",children:g.map(e=>t.jsx("button",{role:"tab","aria-selected":a===e.key,onClick:()=>o(e.key),className:`px-3 py-1.5 text-xs font-semibold rounded-[3px] transition-colors ${a===e.key?"bg-[#553DE9] text-white":"text-[#6B6960] hover:text-[#36342E] hover:bg-[#F8F4F0]"}`,children:e.label},e.key))}),s?i.length===0?t.jsx("p",{className:"text-sm text-[#6B6960] py-12 text-center",children:"No templates in this category."}):t.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:i.map(e=>t.jsxs(p,{hover:!0,onClick:()=>m(e.filename),children:[t.jsx("div",{className:"mb-2",children:t.jsx(h,{status:"version",children:e.category||"other"})}),t.jsx("h3",{className:"text-sm font-medium text-[#36342E] mb-1",children:u(e.name)}),t.jsx("p",{className:"text-xs text-[#6B6960]",children:e.filename})]},e.filename))}):t.jsx("p",{className:"text-sm text-[#6B6960]",children:"Loading templates..."})]})}export{k as default};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/HomePage-
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/HomePage-C4WxoEKI.js","assets/Badge-ClncXa1x.js","assets/clock-DpWpY1Zx.js","assets/TerminalOutput-Do2PhilR.js","assets/ProjectPage-Dy7ONtf_.js","assets/Button-CUOgrX10.js","assets/external-link-KmF9dPsz.js","assets/ProjectsPage-CIDkRHyZ.js","assets/Card-2UWDXe0P.js","assets/TemplatesPage-DPlaAtAk.js","assets/SettingsPage-5AxjoTTg.js"])))=>i.map(i=>d[i]);
|
|
2
2
|
var cv=Object.defineProperty;var fv=(i,o,r)=>o in i?cv(i,o,{enumerable:!0,configurable:!0,writable:!0,value:r}):i[o]=r;var Un=(i,o,r)=>fv(i,typeof o!="symbol"?o+"":o,r);(function(){const o=document.createElement("link").relList;if(o&&o.supports&&o.supports("modulepreload"))return;for(const d of document.querySelectorAll('link[rel="modulepreload"]'))f(d);new MutationObserver(d=>{for(const h of d)if(h.type==="childList")for(const p of h.addedNodes)p.tagName==="LINK"&&p.rel==="modulepreload"&&f(p)}).observe(document,{childList:!0,subtree:!0});function r(d){const h={};return d.integrity&&(h.integrity=d.integrity),d.referrerPolicy&&(h.referrerPolicy=d.referrerPolicy),d.crossOrigin==="use-credentials"?h.credentials="include":d.crossOrigin==="anonymous"?h.credentials="omit":h.credentials="same-origin",h}function f(d){if(d.ep)return;d.ep=!0;const h=r(d);fetch(d.href,h)}})();function ov(i){return i&&i.__esModule&&Object.prototype.hasOwnProperty.call(i,"default")?i.default:i}var xf={exports:{}},Nn={};/**
|
|
3
3
|
* @license React
|
|
4
4
|
* react-jsx-runtime.production.js
|
|
@@ -133,4 +133,4 @@ Please change the parent <Route path="${q}"> to <Route path="${q==="/"?"*":`${q}
|
|
|
133
133
|
*
|
|
134
134
|
* This source code is licensed under the ISC license.
|
|
135
135
|
* See the LICENSE file in the root directory of this source tree.
|
|
136
|
-
*/const p1=[["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"}]],S1=Fl("settings-2",p1),gh="pl_sidebar_collapsed",b1=[{to:"/",label:"Home",icon:r1},{to:"/projects",label:"Projects",icon:o1},{to:"/templates",label:"Templates",icon:h1}],E1=[{to:"/settings",label:"Settings",icon:S1}];function T1({wsConnected:i,version:o}){const[r,f]=_.useState(()=>{try{return localStorage.getItem(gh)==="1"}catch{return!1}});_.useEffect(()=>{try{localStorage.setItem(gh,r?"1":"0")}catch{}},[r]);const d=h=>["flex items-center gap-3 px-3 py-2 text-sm transition-colors rounded-[5px]",r&&"justify-center",h?"bg-[#553DE9]/8 text-[#553DE9] font-medium border-l-2 border-[#553DE9]":"text-[#36342E] hover:bg-[#F8F4F0]"].filter(Boolean).join(" ");return V.jsxs("aside",{className:"flex flex-col h-full border-r border-[#ECEAE3] bg-white transition-[width] duration-200",style:{width:r?64:240,minWidth:r?64:240},children:[V.jsxs("div",{className:"flex items-center justify-between px-4 h-14 border-b border-[#ECEAE3]",children:[!r&&V.jsxs("div",{className:"flex flex-col",children:[V.jsx("span",{className:"font-heading text-lg font-bold leading-tight text-[#36342E]",children:"Purple Lab"}),V.jsx("span",{className:"text-xs text-[#6B6960]",children:"Powered by Loki"})]}),V.jsx("button",{type:"button","aria-label":r?"Expand sidebar":"Collapse sidebar",title:r?"Expand sidebar":"Collapse sidebar",onClick:()=>f(!r),className:"inline-flex items-center justify-center w-7 h-7 rounded-[3px] text-[#939084] hover:bg-[#F8F4F0] transition-colors",children:r?V.jsx(g1,{size:16}):V.jsx(y1,{size:16})})]}),V.jsxs("nav",{className:"flex-1 px-2 py-3 flex flex-col gap-1","aria-label":"Main navigation",children:[b1.map(h=>V.jsxs(Qf,{to:h.to,end:h.to==="/",className:({isActive:p})=>d(p),title:r?h.label:void 0,children:[V.jsx(h.icon,{size:18}),!r&&V.jsx("span",{children:h.label})]},h.to)),V.jsx("div",{className:"my-2 border-t border-[#ECEAE3]"}),E1.map(h=>V.jsxs(Qf,{to:h.to,className:({isActive:p})=>d(p),title:r?h.label:void 0,children:[V.jsx(h.icon,{size:18}),!r&&V.jsx("span",{children:h.label})]},h.to))]}),V.jsxs("div",{className:"px-3 py-3 border-t border-[#ECEAE3] flex flex-col gap-2",children:[V.jsxs("div",{className:["flex items-center gap-2 text-xs",r&&"justify-center"].filter(Boolean).join(" "),children:[V.jsx("span",{className:`w-2 h-2 rounded-full flex-shrink-0 ${i?"bg-[#1FC5A8]":"bg-[#C45B5B]"}`}),!r&&V.jsx("span",{className:"text-[#6B6960]",children:i?"Connected":"Disconnected"})]}),!r&&o&&V.jsxs("span",{className:"text-xs text-[#6B6960]",children:["v",o]}),V.jsxs("a",{href:"https://www.autonomi.dev/docs",target:"_blank",rel:"noopener noreferrer",className:["flex items-center gap-2 text-xs text-[#6B6960] hover:text-[#36342E] transition-colors",r&&"justify-center"].filter(Boolean).join(" "),title:r?"Documentation":void 0,children:[V.jsx(c1,{size:14}),!r&&V.jsx("span",{children:"Docs"})]})]})]})}const z1=`${window.location.origin}/api`,A1=`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}/ws`;async function lt(i,o){const r=await fetch(`${z1}${i}`,{...o,headers:{"Content-Type":"application/json",...o==null?void 0:o.headers}});if(!r.ok){const f=await r.text().catch(()=>"");throw new Error(`API error ${r.status}: ${r.statusText}${f?` - ${f}`:""}`)}return r.json()}const _1={startSession:i=>lt("/session/start",{method:"POST",body:JSON.stringify(i)}),stopSession:()=>lt("/session/stop",{method:"POST"}),pauseSession:()=>lt("/session/pause",{method:"POST"}),resumeSession:()=>lt("/session/resume",{method:"POST"}),getPrdPrefill:()=>lt("/session/prd-prefill"),getStatus:()=>lt("/session/status"),getAgents:()=>lt("/session/agents"),getLogs:(i=200)=>lt(`/session/logs?lines=${i}`),getMemorySummary:()=>lt("/session/memory"),getChecklist:()=>lt("/session/checklist"),getFiles:()=>lt("/session/files"),getFileContent:i=>lt(`/session/files/content?path=${encodeURIComponent(i)}`),getSessionFileContent:(i,o)=>lt(`/sessions/${encodeURIComponent(i)}/file?path=${encodeURIComponent(o)}`),getTemplates:()=>lt("/templates"),getTemplateContent:i=>lt(`/templates/${encodeURIComponent(i)}`),planSession:(i,o)=>lt("/session/plan",{method:"POST",body:JSON.stringify({prd:i,provider:o})}),generateReport:(i="markdown")=>lt("/session/report",{method:"POST",body:JSON.stringify({format:i})}),shareSession:()=>lt("/session/share",{method:"POST"}),getCurrentProvider:()=>lt("/provider/current"),setProvider:i=>lt("/provider/set",{method:"POST",body:JSON.stringify({provider:i})}),getMetrics:()=>lt("/session/metrics"),getSessionsHistory:()=>lt("/sessions/history"),getSessionDetail:i=>lt(`/sessions/${encodeURIComponent(i)}`),onboardRepo:i=>lt("/session/onboard",{method:"POST",body:JSON.stringify({path:i})}),saveSessionFile:(i,o,r)=>lt(`/sessions/${encodeURIComponent(i)}/file`,{method:"PUT",body:JSON.stringify({path:o,content:r})}),createSessionFile:(i,o,r="")=>lt(`/sessions/${encodeURIComponent(i)}/file`,{method:"POST",body:JSON.stringify({path:o,content:r})}),deleteSessionFile:(i,o)=>lt(`/sessions/${encodeURIComponent(i)}/file`,{method:"DELETE",body:JSON.stringify({path:o})}),createSessionDirectory:(i,o)=>lt(`/sessions/${encodeURIComponent(i)}/directory`,{method:"POST",body:JSON.stringify({path:o})}),reviewProject:i=>lt(`/sessions/${encodeURIComponent(i)}/review`,{method:"POST"}),testProject:i=>lt(`/sessions/${encodeURIComponent(i)}/test`,{method:"POST"}),explainProject:i=>lt(`/sessions/${encodeURIComponent(i)}/explain`,{method:"POST"}),exportProject:i=>lt(`/sessions/${encodeURIComponent(i)}/export`,{method:"POST"}),chatMessage:(i,o,r="quick")=>lt(`/sessions/${encodeURIComponent(i)}/chat`,{method:"POST",body:JSON.stringify({message:o,mode:r})}),chatStart:(i,o,r="quick")=>lt(`/sessions/${encodeURIComponent(i)}/chat`,{method:"POST",body:JSON.stringify({message:o,mode:r})}),chatPoll:(i,o)=>lt(`/sessions/${encodeURIComponent(i)}/chat/${encodeURIComponent(o)}`),getPreviewInfo:i=>lt(`/sessions/${encodeURIComponent(i)}/preview-info`),getSecrets:()=>lt("/secrets"),setSecret:(i,o)=>lt("/secrets",{method:"POST",body:JSON.stringify({key:i,value:o})}),deleteSecret:i=>lt(`/secrets/${encodeURIComponent(i)}`,{method:"DELETE"})};class R1{constructor(o){Un(this,"ws",null);Un(this,"listeners",new Map);Un(this,"reconnectTimer",null);Un(this,"url");this.url=o||A1}connect(){var o;((o=this.ws)==null?void 0:o.readyState)!==WebSocket.OPEN&&(this.ws=new WebSocket(this.url),this.ws.onopen=()=>{this.emit("connected",{message:"WebSocket connected"})},this.ws.onmessage=r=>{try{const f=JSON.parse(r.data);this.emit(f.type,f.data||f)}catch{}},this.ws.onclose=()=>{this.emit("disconnected",{}),this.scheduleReconnect()},this.ws.onerror=()=>{var r;(r=this.ws)==null||r.close()})}scheduleReconnect(){this.reconnectTimer||(this.reconnectTimer=setTimeout(()=>{this.reconnectTimer=null,this.connect()},3e3))}on(o,r){return this.listeners.has(o)||this.listeners.set(o,new Set),this.listeners.get(o).add(r),()=>{var f;return(f=this.listeners.get(o))==null?void 0:f.delete(r)}}emit(o,r){var f,d;(f=this.listeners.get(o))==null||f.forEach(h=>h(r)),(d=this.listeners.get("*"))==null||d.forEach(h=>h({type:o,data:r}))}send(o){var r;((r=this.ws)==null?void 0:r.readyState)===WebSocket.OPEN&&this.ws.send(JSON.stringify(o))}disconnect(){var o;this.reconnectTimer&&(clearTimeout(this.reconnectTimer),this.reconnectTimer=null),(o=this.ws)==null||o.close(),this.ws=null}}function O1(i){const[o,r]=_.useState(!1),f=_.useRef(null),d=_.useRef(i);_.useEffect(()=>{d.current=i},[i]),_.useEffect(()=>{const p=new R1;return f.current=p,p.on("connected",()=>r(!0)),p.on("disconnected",()=>{r(!1),d.current&&d.current(null)}),p.on("state_update",O=>{d.current&&O&&typeof O=="object"&&d.current(O)}),p.connect(),()=>{p.disconnect(),f.current=null}},[]);const h=_.useCallback((p,O)=>{var b;return((b=f.current)==null?void 0:b.on(p,O))||(()=>{})},[]);return{connected:o,subscribe:h}}function M1(){const[i,o]=_.useState(""),{connected:r}=O1(()=>{});return _.useEffect(()=>{_1.getStatus().then(f=>{o(f.version||"")}).catch(()=>{})},[]),V.jsxs("div",{className:"flex h-screen bg-[#FAF9F6]",children:[V.jsx("a",{href:"#main-content",className:"sr-only focus:not-sr-only focus:absolute focus:z-50 focus:top-2 focus:left-2 focus:px-4 focus:py-2 focus:bg-white focus:text-[#553DE9] focus:rounded-[3px] focus:shadow-card",children:"Skip to main content"}),V.jsx(T1,{wsConnected:r,version:i}),V.jsx("main",{id:"main-content",className:"flex-1 overflow-auto",children:V.jsx(p0,{})})]})}const C1=_.lazy(()=>Xn(()=>import("./HomePage-
|
|
136
|
+
*/const p1=[["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"}]],S1=Fl("settings-2",p1),gh="pl_sidebar_collapsed",b1=[{to:"/",label:"Home",icon:r1},{to:"/projects",label:"Projects",icon:o1},{to:"/templates",label:"Templates",icon:h1}],E1=[{to:"/settings",label:"Settings",icon:S1}];function T1({wsConnected:i,version:o}){const[r,f]=_.useState(()=>{try{return localStorage.getItem(gh)==="1"}catch{return!1}});_.useEffect(()=>{try{localStorage.setItem(gh,r?"1":"0")}catch{}},[r]);const d=h=>["flex items-center gap-3 px-3 py-2 text-sm transition-colors rounded-[5px]",r&&"justify-center",h?"bg-[#553DE9]/8 text-[#553DE9] font-medium border-l-2 border-[#553DE9]":"text-[#36342E] hover:bg-[#F8F4F0]"].filter(Boolean).join(" ");return V.jsxs("aside",{className:"flex flex-col h-full border-r border-[#ECEAE3] bg-white transition-[width] duration-200",style:{width:r?64:240,minWidth:r?64:240},children:[V.jsxs("div",{className:"flex items-center justify-between px-4 h-14 border-b border-[#ECEAE3]",children:[!r&&V.jsxs("div",{className:"flex flex-col",children:[V.jsx("span",{className:"font-heading text-lg font-bold leading-tight text-[#36342E]",children:"Purple Lab"}),V.jsx("span",{className:"text-xs text-[#6B6960]",children:"Powered by Loki"})]}),V.jsx("button",{type:"button","aria-label":r?"Expand sidebar":"Collapse sidebar",title:r?"Expand sidebar":"Collapse sidebar",onClick:()=>f(!r),className:"inline-flex items-center justify-center w-7 h-7 rounded-[3px] text-[#939084] hover:bg-[#F8F4F0] transition-colors",children:r?V.jsx(g1,{size:16}):V.jsx(y1,{size:16})})]}),V.jsxs("nav",{className:"flex-1 px-2 py-3 flex flex-col gap-1","aria-label":"Main navigation",children:[b1.map(h=>V.jsxs(Qf,{to:h.to,end:h.to==="/",className:({isActive:p})=>d(p),title:r?h.label:void 0,children:[V.jsx(h.icon,{size:18}),!r&&V.jsx("span",{children:h.label})]},h.to)),V.jsx("div",{className:"my-2 border-t border-[#ECEAE3]"}),E1.map(h=>V.jsxs(Qf,{to:h.to,className:({isActive:p})=>d(p),title:r?h.label:void 0,children:[V.jsx(h.icon,{size:18}),!r&&V.jsx("span",{children:h.label})]},h.to))]}),V.jsxs("div",{className:"px-3 py-3 border-t border-[#ECEAE3] flex flex-col gap-2",children:[V.jsxs("div",{className:["flex items-center gap-2 text-xs",r&&"justify-center"].filter(Boolean).join(" "),children:[V.jsx("span",{className:`w-2 h-2 rounded-full flex-shrink-0 ${i?"bg-[#1FC5A8]":"bg-[#C45B5B]"}`}),!r&&V.jsx("span",{className:"text-[#6B6960]",children:i?"Connected":"Disconnected"})]}),!r&&o&&V.jsxs("span",{className:"text-xs text-[#6B6960]",children:["v",o]}),V.jsxs("a",{href:"https://www.autonomi.dev/docs",target:"_blank",rel:"noopener noreferrer",className:["flex items-center gap-2 text-xs text-[#6B6960] hover:text-[#36342E] transition-colors",r&&"justify-center"].filter(Boolean).join(" "),title:r?"Documentation":void 0,children:[V.jsx(c1,{size:14}),!r&&V.jsx("span",{children:"Docs"})]})]})]})}const z1=`${window.location.origin}/api`,A1=`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}/ws`;async function lt(i,o){const r=await fetch(`${z1}${i}`,{...o,headers:{"Content-Type":"application/json",...o==null?void 0:o.headers}});if(!r.ok){const f=await r.text().catch(()=>"");throw new Error(`API error ${r.status}: ${r.statusText}${f?` - ${f}`:""}`)}return r.json()}const _1={startSession:i=>lt("/session/start",{method:"POST",body:JSON.stringify(i)}),stopSession:()=>lt("/session/stop",{method:"POST"}),pauseSession:()=>lt("/session/pause",{method:"POST"}),resumeSession:()=>lt("/session/resume",{method:"POST"}),getPrdPrefill:()=>lt("/session/prd-prefill"),getStatus:()=>lt("/session/status"),getAgents:()=>lt("/session/agents"),getLogs:(i=200)=>lt(`/session/logs?lines=${i}`),getMemorySummary:()=>lt("/session/memory"),getChecklist:()=>lt("/session/checklist"),getFiles:()=>lt("/session/files"),getFileContent:i=>lt(`/session/files/content?path=${encodeURIComponent(i)}`),getSessionFileContent:(i,o)=>lt(`/sessions/${encodeURIComponent(i)}/file?path=${encodeURIComponent(o)}`),getTemplates:()=>lt("/templates"),getTemplateContent:i=>lt(`/templates/${encodeURIComponent(i)}`),planSession:(i,o)=>lt("/session/plan",{method:"POST",body:JSON.stringify({prd:i,provider:o})}),generateReport:(i="markdown")=>lt("/session/report",{method:"POST",body:JSON.stringify({format:i})}),shareSession:()=>lt("/session/share",{method:"POST"}),getCurrentProvider:()=>lt("/provider/current"),setProvider:i=>lt("/provider/set",{method:"POST",body:JSON.stringify({provider:i})}),getMetrics:()=>lt("/session/metrics"),getSessionsHistory:()=>lt("/sessions/history"),getSessionDetail:i=>lt(`/sessions/${encodeURIComponent(i)}`),onboardRepo:i=>lt("/session/onboard",{method:"POST",body:JSON.stringify({path:i})}),saveSessionFile:(i,o,r)=>lt(`/sessions/${encodeURIComponent(i)}/file`,{method:"PUT",body:JSON.stringify({path:o,content:r})}),createSessionFile:(i,o,r="")=>lt(`/sessions/${encodeURIComponent(i)}/file`,{method:"POST",body:JSON.stringify({path:o,content:r})}),deleteSessionFile:(i,o)=>lt(`/sessions/${encodeURIComponent(i)}/file`,{method:"DELETE",body:JSON.stringify({path:o})}),createSessionDirectory:(i,o)=>lt(`/sessions/${encodeURIComponent(i)}/directory`,{method:"POST",body:JSON.stringify({path:o})}),reviewProject:i=>lt(`/sessions/${encodeURIComponent(i)}/review`,{method:"POST"}),testProject:i=>lt(`/sessions/${encodeURIComponent(i)}/test`,{method:"POST"}),explainProject:i=>lt(`/sessions/${encodeURIComponent(i)}/explain`,{method:"POST"}),exportProject:i=>lt(`/sessions/${encodeURIComponent(i)}/export`,{method:"POST"}),chatMessage:(i,o,r="quick")=>lt(`/sessions/${encodeURIComponent(i)}/chat`,{method:"POST",body:JSON.stringify({message:o,mode:r})}),chatStart:(i,o,r="quick")=>lt(`/sessions/${encodeURIComponent(i)}/chat`,{method:"POST",body:JSON.stringify({message:o,mode:r})}),chatPoll:(i,o)=>lt(`/sessions/${encodeURIComponent(i)}/chat/${encodeURIComponent(o)}`),getPreviewInfo:i=>lt(`/sessions/${encodeURIComponent(i)}/preview-info`),getSecrets:()=>lt("/secrets"),setSecret:(i,o)=>lt("/secrets",{method:"POST",body:JSON.stringify({key:i,value:o})}),deleteSecret:i=>lt(`/secrets/${encodeURIComponent(i)}`,{method:"DELETE"})};class R1{constructor(o){Un(this,"ws",null);Un(this,"listeners",new Map);Un(this,"reconnectTimer",null);Un(this,"url");this.url=o||A1}connect(){var o;((o=this.ws)==null?void 0:o.readyState)!==WebSocket.OPEN&&(this.ws=new WebSocket(this.url),this.ws.onopen=()=>{this.emit("connected",{message:"WebSocket connected"})},this.ws.onmessage=r=>{try{const f=JSON.parse(r.data);this.emit(f.type,f.data||f)}catch{}},this.ws.onclose=()=>{this.emit("disconnected",{}),this.scheduleReconnect()},this.ws.onerror=()=>{var r;(r=this.ws)==null||r.close()})}scheduleReconnect(){this.reconnectTimer||(this.reconnectTimer=setTimeout(()=>{this.reconnectTimer=null,this.connect()},3e3))}on(o,r){return this.listeners.has(o)||this.listeners.set(o,new Set),this.listeners.get(o).add(r),()=>{var f;return(f=this.listeners.get(o))==null?void 0:f.delete(r)}}emit(o,r){var f,d;(f=this.listeners.get(o))==null||f.forEach(h=>h(r)),(d=this.listeners.get("*"))==null||d.forEach(h=>h({type:o,data:r}))}send(o){var r;((r=this.ws)==null?void 0:r.readyState)===WebSocket.OPEN&&this.ws.send(JSON.stringify(o))}disconnect(){var o;this.reconnectTimer&&(clearTimeout(this.reconnectTimer),this.reconnectTimer=null),(o=this.ws)==null||o.close(),this.ws=null}}function O1(i){const[o,r]=_.useState(!1),f=_.useRef(null),d=_.useRef(i);_.useEffect(()=>{d.current=i},[i]),_.useEffect(()=>{const p=new R1;return f.current=p,p.on("connected",()=>r(!0)),p.on("disconnected",()=>{r(!1),d.current&&d.current(null)}),p.on("state_update",O=>{d.current&&O&&typeof O=="object"&&d.current(O)}),p.connect(),()=>{p.disconnect(),f.current=null}},[]);const h=_.useCallback((p,O)=>{var b;return((b=f.current)==null?void 0:b.on(p,O))||(()=>{})},[]);return{connected:o,subscribe:h}}function M1(){const[i,o]=_.useState(""),{connected:r}=O1(()=>{});return _.useEffect(()=>{_1.getStatus().then(f=>{o(f.version||"")}).catch(()=>{})},[]),V.jsxs("div",{className:"flex h-screen bg-[#FAF9F6]",children:[V.jsx("a",{href:"#main-content",className:"sr-only focus:not-sr-only focus:absolute focus:z-50 focus:top-2 focus:left-2 focus:px-4 focus:py-2 focus:bg-white focus:text-[#553DE9] focus:rounded-[3px] focus:shadow-card",children:"Skip to main content"}),V.jsx(T1,{wsConnected:r,version:i}),V.jsx("main",{id:"main-content",className:"flex-1 overflow-auto",children:V.jsx(p0,{})})]})}const C1=_.lazy(()=>Xn(()=>import("./HomePage-C4WxoEKI.js"),__vite__mapDeps([0,1,2,3]))),D1=_.lazy(()=>Xn(()=>import("./ProjectPage-Dy7ONtf_.js"),__vite__mapDeps([4,3,5,2,6]))),x1=_.lazy(()=>Xn(()=>import("./ProjectsPage-CIDkRHyZ.js"),__vite__mapDeps([7,5,8,1,2]))),U1=_.lazy(()=>Xn(()=>import("./TemplatesPage-DPlaAtAk.js"),__vite__mapDeps([9,8,1,2]))),N1=_.lazy(()=>Xn(()=>import("./SettingsPage-5AxjoTTg.js"),__vite__mapDeps([10,8,6])));function jn(){return V.jsx("div",{className:"h-screen bg-[#FAF9F6] flex items-center justify-center text-[#6B6960] text-sm",children:"Loading..."})}function H1(){return V.jsxs(b0,{children:[V.jsx(Wl,{path:"/project/:sessionId",element:V.jsx(_.Suspense,{fallback:V.jsx(jn,{}),children:V.jsx(D1,{})})}),V.jsxs(Wl,{element:V.jsx(M1,{}),children:[V.jsx(Wl,{path:"/",element:V.jsx(_.Suspense,{fallback:V.jsx(jn,{}),children:V.jsx(C1,{})})}),V.jsx(Wl,{path:"/projects",element:V.jsx(_.Suspense,{fallback:V.jsx(jn,{}),children:V.jsx(x1,{})})}),V.jsx(Wl,{path:"/templates",element:V.jsx(_.Suspense,{fallback:V.jsx(jn,{}),children:V.jsx(U1,{})})}),V.jsx(Wl,{path:"/settings",element:V.jsx(_.Suspense,{fallback:V.jsx(jn,{}),children:V.jsx(N1,{})})})]})]})}Sv.createRoot(document.getElementById("root")).render(V.jsx(_.StrictMode,{children:V.jsx(V0,{children:V.jsx(H1,{})})}));export{c1 as B,S1 as S,j1 as W,_1 as a,O1 as b,Fl as c,q1 as d,V as j,_ as r,e0 as u};
|
package/web-app/dist/index.html
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
<link rel="preconnect" href="https://fonts.googleapis.com">
|
|
9
9
|
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
|
10
10
|
<link href="https://fonts.googleapis.com/css2?family=DM+Serif+Display&family=Inter:wght@400;500;600;700;800&family=JetBrains+Mono:wght@400;500;600&display=swap" rel="stylesheet">
|
|
11
|
-
<script type="module" crossorigin src="/assets/index-
|
|
11
|
+
<script type="module" crossorigin src="/assets/index-ACgjqVp2.js"></script>
|
|
12
12
|
<link rel="stylesheet" crossorigin href="/assets/index-BZpAV5M8.css">
|
|
13
13
|
</head>
|
|
14
14
|
<body class="bg-background text-ink font-sans antialiased">
|
package/web-app/server.py
CHANGED
|
@@ -356,7 +356,7 @@ def _build_file_tree(root: Path, max_depth: int = 4, _depth: int = 0) -> list[di
|
|
|
356
356
|
|
|
357
357
|
for item in items:
|
|
358
358
|
# Skip hidden dirs and common noise
|
|
359
|
-
if item.name.startswith(".")
|
|
359
|
+
if item.name.startswith("."):
|
|
360
360
|
continue
|
|
361
361
|
if item.name in ("node_modules", "__pycache__", ".git", "venv", ".venv"):
|
|
362
362
|
continue
|
|
@@ -1197,6 +1197,14 @@ def _infer_session_status(entry: Path) -> str:
|
|
|
1197
1197
|
st = json.load(f)
|
|
1198
1198
|
phase = st.get("phase", "")
|
|
1199
1199
|
if phase and phase != "idle":
|
|
1200
|
+
# Verify the session is actually still running by checking
|
|
1201
|
+
# if session.json was modified recently (within last 5 min)
|
|
1202
|
+
try:
|
|
1203
|
+
mtime = state_file.stat().st_mtime
|
|
1204
|
+
if time.time() - mtime > 300: # 5 minutes stale
|
|
1205
|
+
return "completed" # Process died, mark as completed
|
|
1206
|
+
except OSError:
|
|
1207
|
+
pass
|
|
1200
1208
|
return phase
|
|
1201
1209
|
except (json.JSONDecodeError, OSError):
|
|
1202
1210
|
pass
|
|
@@ -1211,7 +1219,16 @@ def _infer_session_status(entry: Path) -> str:
|
|
|
1211
1219
|
if st.get("completed") or st.get("status") == "completed":
|
|
1212
1220
|
return "completed"
|
|
1213
1221
|
if st.get("status"):
|
|
1214
|
-
|
|
1222
|
+
status_val = st["status"]
|
|
1223
|
+
# If status indicates active work, verify freshness
|
|
1224
|
+
if status_val in ("running", "in_progress", "planning"):
|
|
1225
|
+
try:
|
|
1226
|
+
mtime = sf.stat().st_mtime
|
|
1227
|
+
if time.time() - mtime > 300: # 5 minutes stale
|
|
1228
|
+
return "completed"
|
|
1229
|
+
except OSError:
|
|
1230
|
+
pass
|
|
1231
|
+
return status_val
|
|
1215
1232
|
except (json.JSONDecodeError, OSError):
|
|
1216
1233
|
pass
|
|
1217
1234
|
|
|
@@ -1922,6 +1939,13 @@ async def get_preview_info(session_id: str) -> JSONResponse:
|
|
|
1922
1939
|
info["description"] = "Project -- showing README"
|
|
1923
1940
|
break
|
|
1924
1941
|
|
|
1942
|
+
# Verify the entry file actually exists on disk before returning a preview URL
|
|
1943
|
+
if info["entry_file"]:
|
|
1944
|
+
entry_path = target / info["entry_file"]
|
|
1945
|
+
if not entry_path.exists():
|
|
1946
|
+
info["preview_url"] = None
|
|
1947
|
+
info["entry_file"] = None
|
|
1948
|
+
|
|
1925
1949
|
return JSONResponse(content=info)
|
|
1926
1950
|
|
|
1927
1951
|
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import{c as f,u as h,r as l,a as j,j as e}from"./index-HocOQZ9L.js";import{B as d,P as x}from"./Button-DUExR4iB.js";import{C as g}from"./Card-LXXTWpme.js";import{u as y,B as b}from"./Badge-D1-tb3Ci.js";import"./clock-DRfchEI9.js";/**
|
|
2
|
-
* @license lucide-react v0.577.0 - ISC
|
|
3
|
-
*
|
|
4
|
-
* This source code is licensed under the ISC license.
|
|
5
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
6
|
-
*/const N=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],v=f("search",N);function k(s){return s==="completed"?"completed":s==="running"?"running":s==="failed"?"failed":s==="started"?"started":"empty"}const C=[{key:"all",label:"All"},{key:"running",label:"Running"},{key:"completed",label:"Completed"},{key:"failed",label:"Failed"}];function D(){const s=h(),[r,c]=l.useState(""),[a,m]=l.useState("all"),u=l.useCallback(()=>j.getSessionsHistory(),[]),{data:i}=y(u,15e3,!0),o=l.useMemo(()=>{if(!i)return[];let t=i;if(a!=="all"&&(t=t.filter(n=>n.status===a)),r.trim()){const n=r.trim().toLowerCase();t=t.filter(p=>p.prd_snippet.toLowerCase().includes(n))}return t},[i,a,r]);return e.jsxs("div",{className:"max-w-[1400px] mx-auto px-6 py-8",children:[e.jsxs("div",{className:"flex items-center justify-between mb-6",children:[e.jsx("h1",{className:"font-heading text-h1 text-[#36342E]",children:"Projects"}),e.jsx(d,{icon:x,onClick:()=>s("/"),children:"New Project"})]}),e.jsxs("div",{className:"flex items-center gap-4 mb-6",children:[e.jsxs("div",{className:"relative flex-1 max-w-sm",children:[e.jsx(v,{size:16,className:"absolute left-3 top-1/2 -translate-y-1/2 text-[#6B6960]"}),e.jsx("input",{type:"text",placeholder:"Search projects...","aria-label":"Search projects",value:r,onChange:t=>c(t.target.value),className:"w-full pl-9 pr-3 py-2 text-sm border border-[#ECEAE3] rounded-[5px] bg-white text-[#36342E] placeholder:text-[#939084] focus:outline-none focus:ring-2 focus:ring-[#553DE9]/20 focus:border-[#553DE9]"})]}),e.jsx("div",{className:"flex items-center gap-1",role:"tablist",children:C.map(t=>e.jsx("button",{role:"tab","aria-selected":a===t.key,onClick:()=>m(t.key),className:`px-3 py-1.5 text-xs font-semibold rounded-[3px] transition-colors ${a===t.key?"bg-[#553DE9] text-white":"text-[#6B6960] hover:text-[#36342E] hover:bg-[#F8F4F0]"}`,children:t.label},t.key))})]}),o.length===0?e.jsxs("div",{className:"flex flex-col items-center justify-center py-20 text-center",children:[e.jsx("p",{className:"text-[#6B6960] text-sm mb-4",children:"No projects yet. Start building."}),e.jsx(d,{icon:x,onClick:()=>s("/"),children:"New Project"})]}):e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:o.map(t=>e.jsx(E,{session:t,onClick:()=>s(`/project/${t.id}`)},t.id))})]})}function E({session:s,onClick:r}){const c=new Date(s.date).toLocaleDateString(void 0,{month:"short",day:"numeric",year:"numeric"});return e.jsxs(g,{hover:!0,onClick:r,children:[e.jsxs("div",{className:"flex items-center justify-between mb-2",children:[e.jsx("span",{className:"text-xs text-[#6B6960]",children:c}),e.jsx(b,{status:k(s.status),children:s.status})]}),e.jsx("h3",{className:"text-sm font-medium text-[#36342E] line-clamp-2 mb-2",children:s.prd_snippet||"Untitled project"}),e.jsx("p",{className:"text-xs text-[#6B6960] truncate",children:s.path})]})}export{D as default};
|