@oscharko-dev/keiko 0.1.5 → 0.1.6
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/dist/gateway/http.d.ts +2 -0
- package/dist/gateway/http.js +38 -5
- package/dist/harness/session.d.ts +1 -1
- package/dist/harness/session.js +1 -1
- package/dist/sdk/index.d.ts +1 -1
- package/dist/sdk/index.js +1 -1
- package/dist/ui/csp-hashes.json +6 -6
- package/dist/ui/static/404.html +1 -1
- package/dist/ui/static/_next/static/chunks/44-ee3006ace87402b4.js +1 -0
- package/dist/ui/static/index.html +1 -1
- package/dist/ui/static/index.txt +2 -2
- package/dist/ui/static/launch.html +1 -1
- package/dist/ui/static/launch.txt +2 -2
- package/package.json +1 -1
- package/dist/ui/static/_next/static/chunks/44-5a78c4df1a436207.js +0 -1
- /package/dist/ui/static/_next/static/{iY8U2g5uZ5O_y0YMPoJO5 → vHP365Z8U38dG6vdAzGnl}/_buildManifest.js +0 -0
- /package/dist/ui/static/_next/static/{iY8U2g5uZ5O_y0YMPoJO5 → vHP365Z8U38dG6vdAzGnl}/_ssgManifest.js +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[44],{4044:(e,t,n)=>{Promise.resolve().then(n.bind(n,8534))},8534:(e,t,n)=>{"use strict";let l,s;n.d(t,{KeikoDesktop:()=>nI});var a=n(5155),i=n(2115);let r=(0,i.createContext)(null);function o(e){let{value:t,children:n}=e;return(0,a.jsx)(r.Provider,{value:t,children:n})}let c=[{id:"read",action:"Read files",scope:"workspace",decision:"allow"},{id:"write",action:"Write files",scope:"src/** \xb7 docs/**",decision:"allow"},{id:"write-prod",action:"Write files",scope:"prod/** \xb7 infra/**",decision:"deny"},{id:"command",action:"Run commands",scope:"test \xb7 build \xb7 lint",decision:"allow"},{id:"command-danger",action:"Run commands",scope:"deploy \xb7 rm \xb7 db",decision:"ask"},{id:"network",action:"Network / fetch",scope:"allowlist",decision:"ask"},{id:"pr",action:"Open pull request",scope:"feature branches",decision:"allow"},{id:"mail",action:"Mail / calendar",scope:"any",decision:"ask"}],d=["Prefers TypeScript + functional React","Writes Conventional Commits","Always reviews diffs before merge","Never touches infra without explicit ok","Deep-work mornings (CET), async afternoons"],u={calendar:!0,mail:!1,jira:!0,docs:!0},m="keiko.twin.mode",p="keiko.twin.persona",h="keiko.twin.policy",x="keiko.twin.memory",f="keiko.twin.bridges",g=(0,i.createContext)(null);function v(e,t){try{let n=window.localStorage.getItem(e);if(null===n)return t;let l=JSON.parse(n);return null==l?t:l}catch(e){return t}}function j(e,t){try{window.localStorage.setItem(e,t)}catch(e){}}function y(e,t){try{window.localStorage.setItem(e,JSON.stringify(t))}catch(e){}}function w(e){let{children:t}=e,[n,l]=(0,i.useState)("manual"),[s,r]=(0,i.useState)("Developer"),[o,w]=(0,i.useState)(c),[b,N]=(0,i.useState)(d),[k,S]=(0,i.useState)(u),[C,M]=(0,i.useState)(!1);(0,i.useEffect)(()=>{l(function(){try{let e=window.localStorage.getItem(m);return"manual"===e||"autonomous"===e?e:"manual"}catch(e){return"manual"}}()),r(function(){try{let e=window.localStorage.getItem(p);if("Developer"===e||"Product Owner"===e||"Designer"===e)return e;return"Developer"}catch(e){return"Developer"}}()),w(v(h,c)),N(v(x,d)),S(v(f,u)),M(!0)},[]),(0,i.useEffect)(()=>{C&&j(m,n)},[n,C]),(0,i.useEffect)(()=>{C&&j(p,s)},[s,C]),(0,i.useEffect)(()=>{C&&y(h,o)},[o,C]),(0,i.useEffect)(()=>{C&&y(x,b)},[b,C]),(0,i.useEffect)(()=>{C&&y(f,k)},[k,C]);let z=(0,i.useCallback)((e,t)=>(function(e,t,n){var l,s,a,i,r,o,c;let d=t=>{var n,l;return null!=(l=null==(n=e.find(e=>e.id===t))?void 0:n.decision)?l:null};return"write"===t?"high"===n?null!=(l=d("write-prod"))?l:"deny":null!=(s=d("write"))?s:"allow":"command"===t?"high"===n?null!=(a=d("command-danger"))?a:"ask":null!=(i=d("command"))?i:"allow":"git"===t?null!=(r=d("pr"))?r:"allow":"mail"===t?null!=(o=d("mail"))?o:"ask":"network"===t&&null!=(c=d("network"))?c:"ask"})(o,e,t),[o]),E=(0,i.useMemo)(()=>({mode:n,setMode:l,persona:s,setPersona:r,policy:o,setPolicy:w,memory:b,setMemory:N,bridges:k,setBridges:S,decide:z}),[n,s,o,b,k,z]);return(0,a.jsx)(g.Provider,{value:E,children:t})}function b(){let e=(0,i.useContext)(g);if(null===e)throw Error("useTwin must be used inside <TwinProvider>");return e}let N=(0,i.createContext)({wins:[],active:null,winCount:0});function k(e){let{size:t=18,sw:n=1.6,vb:l=24,fill:s,style:i,children:r,d:o}=e,c=void 0!==s;return(0,a.jsx)("svg",{width:t,height:t,viewBox:"0 0 ".concat(String(l)," ").concat(String(l)),fill:c?s:"none",stroke:c?"none":"currentColor",strokeWidth:n,strokeLinecap:"round",strokeLinejoin:"round",style:i,"aria-hidden":"true",children:void 0!==o?(0,a.jsx)("path",{d:o}):r})}let S={newChat:e=>(0,a.jsxs)(k,{...e,children:[(0,a.jsx)("path",{d:"M4 5h10M4 9h7"}),(0,a.jsx)("path",{d:"M14.5 13.5l4-4a1.6 1.6 0 0 1 2.3 2.3l-6.2 6.2-3 .7.7-3 6.2-6.2"})]}),search:e=>(0,a.jsxs)(k,{...e,children:[(0,a.jsx)("circle",{cx:"11",cy:"11",r:"6.5"}),(0,a.jsx)("path",{d:"M20 20l-4.3-4.3"})]}),plugins:e=>(0,a.jsxs)(k,{...e,children:[(0,a.jsx)("rect",{x:"4",y:"4",width:"6.5",height:"6.5",rx:"1.5"}),(0,a.jsx)("rect",{x:"13.5",y:"4",width:"6.5",height:"6.5",rx:"1.5"}),(0,a.jsx)("rect",{x:"4",y:"13.5",width:"6.5",height:"6.5",rx:"1.5"}),(0,a.jsx)("rect",{x:"13.5",y:"13.5",width:"6.5",height:"6.5",rx:"1.5"})]}),automations:e=>(0,a.jsxs)(k,{...e,children:[(0,a.jsx)("circle",{cx:"12",cy:"12",r:"8"}),(0,a.jsx)("path",{d:"M12 7.5V12l3 2"})]}),mobile:e=>(0,a.jsxs)(k,{...e,children:[(0,a.jsx)("rect",{x:"7",y:"3",width:"10",height:"18",rx:"2.5"}),(0,a.jsx)("path",{d:"M11 18h2"})]}),folder:e=>(0,a.jsx)(k,{...e,d:"M3.5 7a2 2 0 0 1 2-2h3.2a2 2 0 0 1 1.4.6l1 1a2 2 0 0 0 1.4.6H18.5a2 2 0 0 1 2 2v6.2a2 2 0 0 1-2 2h-13a2 2 0 0 1-2-2V7Z"}),settings:e=>(0,a.jsxs)(k,{...e,children:[(0,a.jsx)("path",{d:"M10.325 4.317c.426 -1.756 2.924 -1.756 3.35 0a1.724 1.724 0 0 0 2.573 1.066c1.543 -.94 3.31 .826 2.37 2.37a1.724 1.724 0 0 0 1.065 2.572c1.756 .426 1.756 2.924 0 3.35a1.724 1.724 0 0 0 -1.066 2.573c.94 1.543 -.826 3.31 -2.37 2.37a1.724 1.724 0 0 0 -2.572 1.065c-.426 1.756 -2.924 1.756 -3.35 0a1.724 1.724 0 0 0 -2.573 -1.066c-1.543 .94 -3.31 -.826 -2.37 -2.37a1.724 1.724 0 0 0 -1.065 -2.572c-1.756 -.426 -1.756 -2.924 0 -3.35a1.724 1.724 0 0 0 1.066 -2.573c-.94 -1.543 .826 -3.31 2.37 -2.37c1 .608 2.296 .07 2.572 -1.065z"}),(0,a.jsx)("circle",{cx:"12",cy:"12",r:"3"})]}),files:e=>(0,a.jsxs)(k,{...e,children:[(0,a.jsx)("path",{d:"M13 3H7a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V9z"}),(0,a.jsx)("path",{d:"M13 3v6h6"})]}),browser:e=>(0,a.jsxs)(k,{...e,children:[(0,a.jsx)("circle",{cx:"12",cy:"12",r:"8.5"}),(0,a.jsx)("path",{d:"M3.5 12h17M12 3.5c2.3 2.3 2.3 14.7 0 17M12 3.5c-2.3 2.3-2.3 14.7 0 17"})]}),review:e=>(0,a.jsxs)(k,{...e,children:[(0,a.jsx)("path",{d:"M9 12l2 2 4-4"}),(0,a.jsx)("rect",{x:"3.5",y:"4.5",width:"17",height:"15",rx:"2.5"})]}),terminal:e=>(0,a.jsxs)(k,{...e,children:[(0,a.jsx)("rect",{x:"3.5",y:"4.5",width:"17",height:"15",rx:"2.5"}),(0,a.jsx)("path",{d:"M7.5 9l3 3-3 3M13 15h4"})]}),agents:e=>(0,a.jsxs)(k,{...e,children:[(0,a.jsx)("rect",{x:"5",y:"7",width:"14",height:"11",rx:"3"}),(0,a.jsx)("path",{d:"M12 7V4M9 12h.01M15 12h.01M2.5 12.5v2M21.5 12.5v2"})]}),git:e=>(0,a.jsxs)(k,{...e,children:[(0,a.jsx)("circle",{cx:"6",cy:"6",r:"2.5"}),(0,a.jsx)("circle",{cx:"6",cy:"18",r:"2.5"}),(0,a.jsx)("circle",{cx:"17",cy:"9",r:"2.5"}),(0,a.jsx)("path",{d:"M6 8.5v7M17 11.5c0 3-3 3.5-6 4"})]}),plus:e=>(0,a.jsx)(k,{...e,d:"M12 5v14M5 12h14"}),chevron:e=>(0,a.jsx)(k,{...e,d:"M6 9l6 6 6-6"}),chevronR:e=>(0,a.jsx)(k,{...e,d:"M9 6l6 6-6 6"}),mic:e=>(0,a.jsxs)(k,{...e,children:[(0,a.jsx)("rect",{x:"9",y:"3",width:"6",height:"11",rx:"3"}),(0,a.jsx)("path",{d:"M5.5 11.5a6.5 6.5 0 0 0 13 0M12 18v3"})]}),arrowUp:e=>(0,a.jsx)(k,{...e,d:"M12 19V5M6 11l6-6 6 6"}),spark:e=>(0,a.jsx)(k,{...e,d:"M12 3l1.8 5.6L19 10l-5.2 1.4L12 17l-1.8-5.6L5 10l5.2-1.4z"}),pin:e=>(0,a.jsx)(k,{...e,d:"M9 3h6l-1 5 3 3-5 1-1 8-1-8-5-1 3-3z"}),archive:e=>(0,a.jsxs)(k,{...e,children:[(0,a.jsx)("rect",{x:"3.5",y:"5",width:"17",height:"4",rx:"1"}),(0,a.jsx)("path",{d:"M5 9v8a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V9M10 13h4"})]}),sidebar:e=>(0,a.jsxs)(k,{...e,children:[(0,a.jsx)("rect",{x:"3.5",y:"4.5",width:"17",height:"15",rx:"2.5"}),(0,a.jsx)("path",{d:"M9.5 4.5v15"})]}),minimize:e=>(0,a.jsx)(k,{...e,d:"M5 12h14"}),expand:e=>(0,a.jsx)(k,{...e,d:"M4 9V4h5M20 15v5h-5M20 9V4h-5M4 15v5h5"}),back:e=>(0,a.jsx)(k,{...e,d:"M15 6l-6 6 6 6"}),fwd:e=>(0,a.jsx)(k,{...e,d:"M9 6l6 6-6 6"}),drag:e=>(0,a.jsxs)(k,{...e,children:[(0,a.jsx)("circle",{cx:"9",cy:"6",r:"1.1",fill:"currentColor",stroke:"none"}),(0,a.jsx)("circle",{cx:"15",cy:"6",r:"1.1",fill:"currentColor",stroke:"none"}),(0,a.jsx)("circle",{cx:"9",cy:"12",r:"1.1",fill:"currentColor",stroke:"none"}),(0,a.jsx)("circle",{cx:"15",cy:"12",r:"1.1",fill:"currentColor",stroke:"none"}),(0,a.jsx)("circle",{cx:"9",cy:"18",r:"1.1",fill:"currentColor",stroke:"none"}),(0,a.jsx)("circle",{cx:"15",cy:"18",r:"1.1",fill:"currentColor",stroke:"none"})]}),close:e=>(0,a.jsx)(k,{...e,d:"M6 6l12 12M18 6L6 18"}),dots:e=>(0,a.jsxs)(k,{...e,children:[(0,a.jsx)("circle",{cx:"6",cy:"12",r:"1.3",fill:"currentColor",stroke:"none"}),(0,a.jsx)("circle",{cx:"12",cy:"12",r:"1.3",fill:"currentColor",stroke:"none"}),(0,a.jsx)("circle",{cx:"18",cy:"12",r:"1.3",fill:"currentColor",stroke:"none"})]}),check:e=>(0,a.jsx)(k,{...e,d:"M5 12.5l4.5 4.5L19 6.5"}),reset:e=>(0,a.jsxs)(k,{...e,children:[(0,a.jsx)("path",{d:"M4 12a8 8 0 1 1 2.3 5.6"}),(0,a.jsx)("path",{d:"M4 20v-4h4"})]}),file:e=>(0,a.jsxs)(k,{...e,children:[(0,a.jsx)("path",{d:"M13 3H7a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V9z"}),(0,a.jsx)("path",{d:"M13 3v6h6"})]}),diff:e=>(0,a.jsx)(k,{...e,d:"M12 4v6M9 7h6M5 17h14"}),branch:e=>(0,a.jsxs)(k,{...e,children:[(0,a.jsx)("circle",{cx:"6",cy:"6",r:"2.3"}),(0,a.jsx)("circle",{cx:"6",cy:"18",r:"2.3"}),(0,a.jsx)("circle",{cx:"18",cy:"8",r:"2.3"}),(0,a.jsx)("path",{d:"M6 8.3v7.4M18 10.3c0 4-4 3.7-7 4.7"})]}),cube:e=>(0,a.jsxs)(k,{...e,children:[(0,a.jsx)("path",{d:"M12 3l8 4.5v9L12 21l-8-4.5v-9z"}),(0,a.jsx)("path",{d:"M12 12l8-4.5M12 12v9M12 12L4 7.5"})]}),maximize:e=>(0,a.jsx)(k,{...e,children:(0,a.jsx)("rect",{x:"5",y:"5",width:"14",height:"14",rx:"2.5"})}),restore:e=>(0,a.jsxs)(k,{...e,children:[(0,a.jsx)("rect",{x:"8",y:"8",width:"11",height:"11",rx:"2"}),(0,a.jsx)("path",{d:"M5 15V7a2 2 0 0 1 2-2h8"})]}),split:e=>(0,a.jsxs)(k,{...e,children:[(0,a.jsx)("rect",{x:"3.5",y:"4.5",width:"17",height:"15",rx:"2.5"}),(0,a.jsx)("path",{d:"M12 4.5v15"})]}),tile:e=>(0,a.jsxs)(k,{...e,children:[(0,a.jsx)("rect",{x:"3.5",y:"4.5",width:"7",height:"7",rx:"1.5"}),(0,a.jsx)("rect",{x:"13.5",y:"4.5",width:"7",height:"7",rx:"1.5"}),(0,a.jsx)("rect",{x:"3.5",y:"13.5",width:"7",height:"7",rx:"1.5"}),(0,a.jsx)("rect",{x:"13.5",y:"13.5",width:"7",height:"7",rx:"1.5"})]}),cascade:e=>(0,a.jsxs)(k,{...e,children:[(0,a.jsx)("rect",{x:"4",y:"4",width:"12",height:"12",rx:"2"}),(0,a.jsx)("path",{d:"M20 8v10a2 2 0 0 1-2 2H8"})]}),editor:e=>(0,a.jsx)(k,{...e,children:(0,a.jsx)("path",{d:"M8 9l-3 3 3 3M16 9l3 3-3 3M13.5 6l-3 12"})}),gear:e=>(0,a.jsxs)(k,{...e,children:[(0,a.jsx)("circle",{cx:"12",cy:"12",r:"2.6"}),(0,a.jsx)("path",{d:"M12 3.5v2M12 18.5v2M20.5 12h-2M5.5 12h-2M18 6l-1.4 1.4M7.4 16.6 6 18M18 18l-1.4-1.4M7.4 7.4 6 6"})]}),panelRight:e=>(0,a.jsxs)(k,{...e,children:[(0,a.jsx)("rect",{x:"3.5",y:"4.5",width:"17",height:"15",rx:"2.5"}),(0,a.jsx)("path",{d:"M14.5 4.5v15"})]}),layers:e=>(0,a.jsx)(k,{...e,d:"M12 3l8 4.5-8 4.5-8-4.5z M4 12l8 4.5 8-4.5 M4 16.5 12 21l8-4.5"}),tokens:e=>(0,a.jsxs)(k,{...e,children:[(0,a.jsx)("circle",{cx:"9",cy:"9",r:"4.5"}),(0,a.jsx)("path",{d:"M14 9.5a4.5 4.5 0 1 1-4 6.9"})]}),bolt:e=>(0,a.jsx)(k,{...e,d:"M13 3 5 13h5l-1 8 8-10h-5z"}),add:e=>(0,a.jsxs)(k,{...e,children:[(0,a.jsx)("rect",{x:"3.5",y:"3.5",width:"17",height:"17",rx:"3.5"}),(0,a.jsx)("path",{d:"M12 8.5v7M8.5 12h7"})]}),bell:e=>(0,a.jsxs)(k,{...e,children:[(0,a.jsx)("path",{d:"M6.5 9a5.5 5.5 0 0 1 11 0c0 4.5 2 5.5 2 5.5H4.5s2-1 2-5.5"}),(0,a.jsx)("path",{d:"M10 19a2 2 0 0 0 4 0"})]}),sun:e=>(0,a.jsxs)(k,{...e,children:[(0,a.jsx)("circle",{cx:"12",cy:"12",r:"4"}),(0,a.jsx)("path",{d:"M12 2.5v2.5M12 19v2.5M2.5 12H5M19 12h2.5M5.1 5.1 6.9 6.9M17.1 17.1l1.8 1.8M18.9 5.1 17.1 6.9M6.9 17.1 5.1 18.9"})]}),moon:e=>(0,a.jsx)(k,{...e,d:"M20 13.5A8 8 0 1 1 10.5 4a6.5 6.5 0 0 0 9.5 9.5z"}),zoomOut:e=>(0,a.jsxs)(k,{...e,children:[(0,a.jsx)("circle",{cx:"11",cy:"11",r:"6.5"}),(0,a.jsx)("path",{d:"M20 20l-4.2-4.2M8.3 11h5.4"})]}),zoomIn:e=>(0,a.jsxs)(k,{...e,children:[(0,a.jsx)("circle",{cx:"11",cy:"11",r:"6.5"}),(0,a.jsx)("path",{d:"M20 20l-4.2-4.2M11 8.3v5.4M8.3 11h5.4"})]}),activity:e=>(0,a.jsx)(k,{...e,d:"M3 12h3l2.5-7 5 14 2.5-7H21"})};function C(e){let{winCount:t,mode:n}=e;return(0,a.jsxs)("footer",{className:"footer mono",children:[(0,a.jsxs)("span",{className:"ft-seg ft-gov","data-mode":n,children:["autonomous"===n?(0,a.jsx)("img",{className:"ft-orca",src:"/assets/keiko-logo.svg",alt:""}):(0,a.jsx)("span",{className:"ft-you",children:"M"}),"autonomous"===n?"Keiko governing":"You \xb7 manual"]}),(0,a.jsxs)("span",{className:"ft-seg ft-opt2",children:[(0,a.jsx)(S.folder,{size:13})," example-workspace"]}),(0,a.jsxs)("span",{className:"ft-seg",children:[(0,a.jsx)(S.branch,{size:13})," keiko/issue-51"]}),(0,a.jsxs)("span",{className:"ft-seg ft-opt2",children:[(0,a.jsx)(S.cube,{size:13})," Work locally"]}),(0,a.jsx)("span",{className:"spacer"}),(0,a.jsxs)("span",{className:"ft-seg ft-accent",children:[(0,a.jsx)(S.tile,{size:13})," ",t," ",1===t?"window":"windows"]}),(0,a.jsxs)("span",{className:"ft-seg ft-opt2",children:[(0,a.jsx)(S.bolt,{size:13,style:{color:"var(--accent)"}})," example-chat-model \xb7 Medium"]}),(0,a.jsxs)("span",{className:"ft-seg ft-opt1",children:[(0,a.jsx)(S.tokens,{size:13})," 12.4k tokens"]}),(0,a.jsx)("span",{className:"ft-seg ft-dim ft-opt1",children:"241 ms"}),(0,a.jsxs)("span",{className:"ft-seg ft-accent",children:[(0,a.jsx)("span",{className:"dot",style:{background:"var(--accent)"}})," autosaved"]})]})}let M=[{id:"finder",name:"Finder",tile:"finder"},{id:"terminal",name:"Terminal",tile:"terminal"},{id:"vscode",name:"VS Code",img:"/assets/editors/vscode.svg"},{id:"intellij",name:"IntelliJ IDEA",img:"/assets/editors/intellij.svg"},{id:"goland",name:"GoLand",img:"/assets/editors/goland.svg"},{id:"rustrover",name:"RustRover",img:"/assets/editors/rustrover.svg"},{id:"pycharm",name:"PyCharm",img:"/assets/editors/pycharm.svg"},{id:"webstorm",name:"WebStorm",img:"/assets/editors/webstorm.svg"}],z="keiko.editor",E="intellij";function P(){try{var e;return null!=(e=window.localStorage.getItem(z))?e:E}catch(e){return E}}function R(e){let{ed:t,size:n=20}=e;if(void 0!==t.img)return(0,a.jsx)("img",{className:"ed-img",src:t.img,width:n,height:n,alt:""});let l=Math.round(.27*n);return"terminal"===t.tile?(0,a.jsx)("span",{className:"ed-tile",style:{width:n,height:n,borderRadius:l,background:"#2a2c33"},children:(0,a.jsx)("span",{className:"ed-mark mono",style:{color:"#4ee08d",fontSize:.42*n},children:">_"})}):(0,a.jsx)("span",{className:"ed-tile",style:{width:n,height:n,borderRadius:l,background:"linear-gradient(180deg,#36c4ff,#1e7cf0)"},children:(0,a.jsx)(S.folder,{size:.56*n,style:{color:"#fff"}})})}function T(e){var t;let{project:n}=e,[l,s]=(0,i.useState)(!1),[r,o]=(0,i.useState)(P),c=null!=(t=M.find(e=>e.id===r))?t:M[3];return(0,i.useEffect)(()=>{try{window.localStorage.setItem(z,r)}catch(e){}},[r]),(0,a.jsxs)("div",{className:"edm",children:[(0,a.jsxs)("button",{type:"button",className:"edm-trigger",onClick:()=>s(e=>!e),title:"Open ".concat(n," in ").concat(c.name),"aria-haspopup":"menu","aria-expanded":l,children:[(0,a.jsx)(R,{ed:c,size:20}),(0,a.jsx)(S.chevron,{size:13,style:{color:"var(--fg-faint)"}})]}),l?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("div",{className:"edm-backdrop",onClick:()=>s(!1),"aria-hidden":"true",role:"presentation"}),(0,a.jsxs)("div",{className:"edm-menu",role:"menu",children:[(0,a.jsxs)("div",{className:"edm-head mono",children:["Open “",n,"” in…"]}),M.map(e=>(0,a.jsxs)("button",{type:"button",className:"edm-item","data-sel":e.id===r,onClick:()=>{o(e.id),s(!1)},role:"menuitemradio","aria-checked":e.id===r,children:[(0,a.jsx)(R,{ed:e,size:24}),(0,a.jsx)("span",{className:"edm-name",children:e.name}),e.id===r?(0,a.jsx)(S.check,{size:14,style:{color:"var(--accent)"}}):null]},e.id))]})]}):null]})}function A(e){let{mode:t,onChange:n}=e;return(0,a.jsxs)("div",{className:"modesw","data-mode":t,children:[(0,a.jsxs)("button",{type:"button",className:"modesw-opt","data-on":"manual"===t,onClick:()=>n("manual"),title:"You approve every privileged action",children:[(0,a.jsx)("span",{className:"modesw-av",children:"M"})," You"]}),(0,a.jsxs)("button",{type:"button",className:"modesw-opt","data-on":"autonomous"===t,onClick:()=>n("autonomous"),title:"Keiko governs agents per your policy",children:[(0,a.jsx)("img",{className:"modesw-orca",src:"/assets/keiko-logo.svg",alt:""})," Keiko"]})]})}function L(e){let{mode:t,onModeChange:n,openPalette:l,onTileAll:s,onSplitFront:i,onCascade:r}=e;return(0,a.jsxs)("header",{className:"header",children:[(0,a.jsxs)("div",{className:"hd-brand",children:[(0,a.jsx)("img",{className:"hd-logo",src:"/assets/keiko-logo.svg",alt:"Keiko"}),(0,a.jsx)("span",{className:"hd-wordmark",children:"Keiko"})]}),(0,a.jsxs)("div",{className:"tb-tabs",children:[(0,a.jsxs)("div",{className:"tb-tab","data-active":"true",children:[(0,a.jsx)("span",{children:"example-workspace"}),(0,a.jsx)(S.chevron,{size:13,style:{color:"var(--fg-faint)"}})]}),(0,a.jsx)("button",{type:"button",className:"tb-newtab","aria-label":"New tab",children:(0,a.jsx)(S.plus,{size:15})})]}),(0,a.jsx)("span",{className:"spacer"}),(0,a.jsxs)("div",{className:"hd-tools",children:[(0,a.jsxs)("button",{type:"button",className:"hd-tool hd-tool-cta",onClick:l,title:"New window",children:[(0,a.jsx)(S.add,{size:16}),(0,a.jsx)("span",{children:"New"})]}),(0,a.jsx)("span",{className:"hd-div"}),(0,a.jsx)(T,{project:"example-workspace"}),(0,a.jsx)("span",{className:"hd-div"}),(0,a.jsx)("button",{type:"button",className:"hd-tool",onClick:s,title:"Tile all windows",children:(0,a.jsx)(S.tile,{size:16})}),(0,a.jsx)("button",{type:"button",className:"hd-tool",onClick:i,title:"Split the two front windows",children:(0,a.jsx)(S.split,{size:16})}),(0,a.jsx)("button",{type:"button",className:"hd-tool",onClick:r,title:"Cascade windows",children:(0,a.jsx)(S.cascade,{size:16})})]}),(0,a.jsx)("span",{className:"hd-div"}),(0,a.jsx)(A,{mode:t,onChange:n}),(0,a.jsxs)("div",{className:"tb-status mono",children:[(0,a.jsx)("span",{className:"dot",style:{background:"var(--ok)"}})," connected"]}),(0,a.jsx)("button",{type:"button",className:"tb-btn","aria-label":"Expand window",children:(0,a.jsx)(S.expand,{size:15})}),(0,a.jsx)("button",{type:"button",className:"tb-btn","aria-label":"Minimize window",children:(0,a.jsx)(S.minimize,{size:16})})]})}let D=[{id:"keiko",icon:"spark",label:"Keiko",img:"/assets/keiko-logo.svg"},{id:"project",icon:"folder",label:"Project"},{id:"search",icon:"search",label:"Search"},{id:"plugins",icon:"plugins",label:"Plugins"}],F=[{id:"automations",icon:"automations",label:"Automations"},{id:"mobile",icon:"mobile",label:"Keiko mobile"}];function I(e){let{tool:t,active:n,onClick:l}=e,s=S[t.icon];return(0,a.jsx)("button",{type:"button",className:"rail-btn","data-active":n?"true":"false","data-side":"left","aria-label":t.label,title:t.label,onClick:l,children:void 0!==t.img?(0,a.jsx)("img",{className:"rail-img",src:t.img,alt:""}):(0,a.jsx)(s,{size:19})})}function O(e){let{openTools:t,onTool:n,onNewChat:l,theme:s,onToggleTheme:i}=e;return(0,a.jsxs)("div",{className:"rail rail-left",children:[(0,a.jsx)("button",{type:"button",className:"rail-new",onClick:l,"data-side":"left","aria-label":"New chat",title:"New chat",children:(0,a.jsx)(S.newChat,{size:18})}),(0,a.jsx)("div",{className:"rail-div"}),(0,a.jsx)("div",{className:"rail-group",children:D.map(e=>(0,a.jsx)(I,{tool:e,active:t.has(e.id),onClick:()=>n(e.id)},e.id))}),(0,a.jsx)("span",{className:"spacer"}),(0,a.jsx)("div",{className:"rail-group",children:F.map(e=>(0,a.jsx)(I,{tool:e,active:t.has(e.id),onClick:()=>n(e.id)},e.id))}),(0,a.jsx)("div",{className:"rail-div"}),(0,a.jsx)("button",{type:"button",className:"rail-btn","data-side":"left","aria-label":"light"===s?"Dark mode":"Light mode",title:"light"===s?"Dark mode":"Light mode",onClick:i,children:"light"===s?(0,a.jsx)(S.moon,{size:19}):(0,a.jsx)(S.sun,{size:19})}),(0,a.jsx)("button",{type:"button",className:"rail-btn","data-side":"left","data-active":t.has("settings")?"true":"false","aria-label":"Settings",title:"Settings",onClick:()=>n("settings"),children:(0,a.jsx)(S.settings,{size:19})}),(0,a.jsx)("button",{type:"button",className:"rail-avatar","data-side":"left","aria-label":"Account",title:"Account",children:"M"})]})}let W=[{id:"inspector",label:"Inspector",icon:"layers"},{id:"activity",label:"Activity",icon:"activity"},{id:"notifications",label:"Notifications",icon:"bell"},{id:"resources",label:"Resources",icon:"cube"}];function K(e){let{openTools:t,onTool:n}=e;return(0,a.jsx)("div",{className:"rail rail-right",children:(0,a.jsx)("div",{className:"rail-group",children:W.map(e=>{let l=S[e.icon];return(0,a.jsx)("button",{type:"button",className:"rail-btn","data-active":t.has(e.id),"data-side":"right","data-tip":e.label,"aria-label":e.label,onClick:()=>n(e.id),children:(0,a.jsx)(l,{size:19})},e.id)})})})}function U(e,t,n){let l=e.createShader(t);return null===l?null:(e.shaderSource(l,n),e.compileShader(l),e.getShaderParameter(l,e.COMPILE_STATUS))?l:(console.warn("[keiko-shader]",e.getShaderInfoLog(l)),e.deleteShader(l),null)}function B(){let e=window.localStorage.getItem("keiko.wallpaper.opacity");if(null===e)return 1;let t=Number.parseInt(e,10);return Number.isFinite(t)?Math.max(0,Math.min(100,t))/100:1}function q(){let e=(0,i.useRef)(null);return(0,i.useEffect)(()=>{let t=e.current;if(null===t)return;let n=t.parentElement;if(null!==n)return function(e,t){var n;t.style.opacity=String(B());let l=e=>{let n=e.detail,l="number"==typeof n?n:100*B();t.style.opacity=String(Math.max(0,Math.min(100,l))/100)};window.addEventListener("keiko:wallpaper-opacity",l);let s=null;try{s=t.getContext("webgl",{antialias:!1,alpha:!1,premultipliedAlpha:!1,depth:!1})}catch(e){s=null}if(null===s)return()=>{window.removeEventListener("keiko:wallpaper-opacity",l)};let a=U(s,s.VERTEX_SHADER,"\nattribute vec2 aPos;\nvoid main(){ gl_Position = vec4(aPos, 0.0, 1.0); }\n"),i=U(s,s.FRAGMENT_SHADER,"\nprecision highp float;\nuniform vec2 uRes;\nuniform float uTime;\nuniform vec2 uMouse; // 0..1, y up\nuniform float uDark; // 1 = dark theme, 0 = light\nuniform vec2 uRip[4]; // ripple origins (0..1, y up)\nuniform float uRipT[4]; // seconds since each ripple fired (large = inactive)\n\nfloat hash(vec2 p){\n p = fract(p * vec2(123.34, 456.21));\n p += dot(p, p + 45.32);\n return fract(p.x * p.y);\n}\nfloat vnoise(vec2 p){\n vec2 i = floor(p), f = fract(p);\n vec2 u = f * f * (3.0 - 2.0 * f);\n float a = hash(i), b = hash(i + vec2(1.,0.));\n float c = hash(i + vec2(0.,1.)), d = hash(i + vec2(1.,1.));\n return mix(mix(a,b,u.x), mix(c,d,u.x), u.y);\n}\nfloat fbm(vec2 p){\n float v = 0.0, a = 0.5;\n mat2 m = mat2(1.6, 1.2, -1.2, 1.6);\n for(int i = 0; i < 5; i++){ v += a * vnoise(p); p = m * p; a *= 0.5; }\n return v;\n}\n\nvoid main(){\n vec2 uv = gl_FragCoord.xy / uRes.xy;\n float aspect = uRes.x / uRes.y;\n vec2 p = vec2(uv.x * aspect, uv.y);\n vec2 m = vec2(uMouse.x * aspect, uMouse.y);\n\n float t = uTime * 0.06;\n\n // --- click ripples ---------------------------------------------------\n float rip = 0.0;\n for(int i = 0; i < 4; i++){\n float age = uRipT[i];\n if(age < 2.4){\n vec2 rc = vec2(uRip[i].x * aspect, uRip[i].y);\n float d = distance(p, rc);\n float ring = sin(d * 15.0 - age * 9.0);\n float env = exp(-d * 3.6) * exp(-age * 2.1);\n rip += ring * env;\n }\n }\n\n // --- liquid domain warp ---------------------------------------------\n vec2 warp = vec2(\n fbm(p * 2.1 + vec2(0.0, t)),\n fbm(p * 2.1 + vec2(t, 4.7))\n );\n // mouse bends the flow toward the cursor\n vec2 toM = m - p;\n float md = exp(-length(toM) * 2.2);\n warp += toM * md * 0.28;\n warp += rip * 0.07;\n\n float f = fbm(p * 2.4 + warp * 1.7 + vec2(t * 0.6, 0.0));\n\n // --- chrome banding (sharp metallic streaks) ------------------------\n float bands = abs(sin((f * 4.0 + warp.x * 2.0) * 3.14159 + t * 1.4));\n float chrome = pow(bands, 2.6);\n\n // --- palette (brand) -------------------------------------------------\n vec3 baseD = vec3(0.072, 0.085, 0.079); // warm near-black ~ --bg\n vec3 metalD = vec3(0.205, 0.230, 0.216); // chrome mid grey\n vec3 baseL = vec3(0.930, 0.942, 0.935); // near-white\n vec3 metalL = vec3(0.795, 0.835, 0.812); // soft grey\n vec3 green = vec3(0.306, 0.729, 0.529); // #4EBA87\n\n vec3 base = mix(baseL, baseD, uDark);\n vec3 metal = mix(metalL, metalD, uDark);\n\n vec3 col = mix(base, metal, chrome * 0.85);\n\n // orca-green sheen on the brightest specular ridges\n float spec = smoothstep(0.80, 1.0, bands);\n col += green * spec * mix(0.085, 0.16, uDark);\n\n // soft green glow trailing the cursor — fun to fidget with\n col += green * md * 0.085;\n\n // ripple highlight\n vec3 ripCol = mix(green, vec3(1.0), uDark);\n col += ripCol * max(rip, 0.0) * 0.032;\n\n // keep it dezent — pull back toward base\n col = mix(base, col, 0.84);\n\n gl_FragColor = vec4(col, 1.0);\n}\n");if(null===a||null===i)return()=>{window.removeEventListener("keiko:wallpaper-opacity",l)};let r=s.createProgram();if(null===r)return()=>{window.removeEventListener("keiko:wallpaper-opacity",l)};if(s.attachShader(r,a),s.attachShader(r,i),s.linkProgram(r),!s.getProgramParameter(r,s.LINK_STATUS))return console.warn("[keiko-shader]",s.getProgramInfoLog(r)),()=>{window.removeEventListener("keiko:wallpaper-opacity",l)};s.useProgram(r);let o=s.createBuffer();s.bindBuffer(s.ARRAY_BUFFER,o),s.bufferData(s.ARRAY_BUFFER,new Float32Array([-1,-1,3,-1,-1,3]),s.STATIC_DRAW);let c=s.getAttribLocation(r,"aPos");s.enableVertexAttribArray(c),s.vertexAttribPointer(c,2,s.FLOAT,!1,0,0);let d=s.getUniformLocation(r,"uRes"),u=s.getUniformLocation(r,"uTime"),m=s.getUniformLocation(r,"uMouse"),p=s.getUniformLocation(r,"uDark"),h=s.getUniformLocation(r,"uRip"),x=s.getUniformLocation(r,"uRipT"),f=1,g=1,v=Math.min(null!=(n=window.devicePixelRatio)?n:1,1.5),j={tx:.5,ty:.5,x:.5,y:.5},y=new Float32Array(8),w=[,,,,].fill(-1/0),b=0;function N(){let n=e.getBoundingClientRect();f=Math.max(1,Math.round(n.width)),g=Math.max(1,Math.round(n.height)),t.width=Math.round(f*v),t.height=Math.round(g*v),t.style.width="".concat(String(f),"px"),t.style.height="".concat(String(g),"px"),null!==s&&s.viewport(0,0,t.width,t.height)}N();let k="undefined"!=typeof ResizeObserver?new ResizeObserver(N):null;null!==k?k.observe(e):window.addEventListener("resize",N);let S=t=>{let n=e.getBoundingClientRect();j.tx=(t.clientX-n.left)/Math.max(1,n.width),j.ty=1-(t.clientY-n.top)/Math.max(1,n.height)},C=t=>{let n=e.getBoundingClientRect(),l=(t.clientX-n.left)/Math.max(1,n.width),s=1-(t.clientY-n.top)/Math.max(1,n.height);l<0||l>1||s<0||s>1||(y[2*b]=l,y[2*b+1]=s,w[b]=performance.now(),b=(b+1)%4)};e.addEventListener("pointermove",S),e.addEventListener("pointerdown",C);let M=performance.now(),z=0,E=!0,P=new Float32Array(4);function R(){if(!E)return;let e=performance.now();j.x+=(j.tx-j.x)*.06,j.y+=(j.ty-j.y)*.06;for(let t=0;t<4;t++){var n;P[t]=(e-(null!=(n=w[t])?n:-1/0))/1e3}let l=+("light"!==document.documentElement.dataset.theme);null!==s&&(s.uniform2f(d,t.width,t.height),s.uniform1f(u,(e-M)/1e3),s.uniform2f(m,j.x,j.y),s.uniform1f(p,l),s.uniform2fv(h,y),s.uniform1fv(x,P),s.drawArrays(s.TRIANGLES,0,3)),z=requestAnimationFrame(R)}z=requestAnimationFrame(R);let T=()=>{document.hidden?(E=!1,cancelAnimationFrame(z)):E||(E=!0,z=requestAnimationFrame(R))};return document.addEventListener("visibilitychange",T),()=>{if(E=!1,cancelAnimationFrame(z),document.removeEventListener("visibilitychange",T),window.removeEventListener("keiko:wallpaper-opacity",l),e.removeEventListener("pointermove",S),e.removeEventListener("pointerdown",C),null!==k?k.disconnect():window.removeEventListener("resize",N),null!==s){let e=s.getExtension("WEBGL_lose_context");null!==e&&e.loseContext()}}}(n,t)},[]),(0,a.jsx)("canvas",{ref:e,className:"ws-shader","aria-hidden":"true"})}let J={agents:["files","terminal","plugins","review","browser","agents","keiko"],chat:["files","browser","plugins","keiko"],files:["agents","chat"],terminal:["agents"],plugins:["agents","chat"],review:["agents"],browser:["agents","chat"],keiko:["agents","chat"]};function _(e,t){var n,l;return void 0!==e&&void 0!==t&&e!==t&&((null!=(n=J[e])?n:[]).includes(t)||(null!=(l=J[t])?l:[]).includes(e))}function V(e){return{left:{x:e.x,y:e.y,w:e.w/2,h:e.h},right:{x:e.x+e.w/2,y:e.y,w:e.w/2,h:e.h},maxi:{x:e.x,y:e.y,w:e.w,h:e.h},tl:{x:e.x,y:e.y,w:e.w/2,h:e.h/2},tr:{x:e.x+e.w/2,y:e.y,w:e.w/2,h:e.h/2},bl:{x:e.x,y:e.y+e.h/2,w:e.w/2,h:e.h/2},br:{x:e.x+e.w/2,y:e.y+e.h/2,w:e.w/2,h:e.h/2}}}function Y(e){let{wins:t,conns:n,connecting:l,api:s}=e,i=function(e,t){let n=new Map(e.map(e=>[e.id,e])),l=[];for(let e of t){let t=n.get(e.a),s=n.get(e.b);if(void 0===t||void 0===s)continue;let a=function(e,t){let n,l,s,a,i={x:e.x+e.w/2,y:e.y+e.h/2},r={x:t.x+t.w/2,y:t.y+t.h/2},o=r.x-i.x,c=r.y-i.y;if(Math.abs(o)>=Math.abs(c)){n=o>=0?{x:e.x+e.w,y:i.y}:{x:e.x,y:i.y};let c=Math.max(40,Math.abs((l=o>=0?{x:t.x,y:r.y}:{x:t.x+t.w,y:r.y}).x-n.x)/2),d=o>=0?1:-1;s={x:n.x+d*c,y:n.y},a={x:l.x-d*c,y:l.y}}else{n=c>=0?{x:i.x,y:e.y+e.h}:{x:i.x,y:e.y};let o=Math.max(40,Math.abs((l=c>=0?{x:r.x,y:t.y}:{x:r.x,y:t.y+t.h}).y-n.y)/2),d=c>=0?1:-1;s={x:n.x,y:n.y+d*o},a={x:l.x,y:l.y-d*o}}let d={x:(n.x+3*s.x+3*a.x+l.x)/8,y:(n.y+3*s.y+3*a.y+l.y)/8};return{d:"M".concat(String(n.x),",").concat(String(n.y)," C").concat(String(s.x),",").concat(String(s.y)," ").concat(String(a.x),",").concat(String(a.y)," ").concat(String(l.x),",").concat(String(l.y)),mid:d}}(t,s);l.push({c:e,d:a.d,mid:a.mid,label:function(e,t){let n="files"===e.type?e:"files"===t.type?t:null,l=null===n?null:n===e?t:e;if(null!==n&&null!==l&&("chat"===l.type||"agents"===l.type))return"uses ".concat(function(e){if(void 0===e)return"src";let t=e.root;return"string"==typeof t&&t.length>0?t:"src"}(n.cfg),"/");let s=[e.type,t.type];return s.includes("keiko")?"governed by":"agents"===s[0]&&"agents"===s[1]?"delegates":s.includes("terminal")?"runs in":s.includes("plugins")?"tools":s.includes("review")?"reviews":s.includes("browser")?"browses":"linked"}(t,s)})}return l}(t,n),r=null!==l?function(e,t){let n=t.find(t=>t.id===e.from);if(void 0===n)return null;let l={x:n.x+n.w/2,y:n.y+n.h/2},s=e.x-l.x,a=e.y-l.y,i=Math.abs(s)>=Math.abs(a),r=i?{x:s>=0?n.x+n.w:n.x,y:l.y}:{x:l.x,y:a>=0?n.y+n.h:n.y},o=Math.max(40,Math.abs(i?s:a)/2),c=i?{x:r.x+(s>=0?o:-o),y:r.y}:{x:r.x,y:r.y+(a>=0?o:-o)},d=e.x,u=e.y;return{d:"M".concat(String(r.x),",").concat(String(r.y)," C").concat(String(c.x),",").concat(String(c.y)," ").concat(String(d),",").concat(String(u)," ").concat(String(d),",").concat(String(u)),ex:d,ey:u}}(l,t):null;return(0,a.jsxs)("div",{className:"conn-layer",children:[(0,a.jsxs)("svg",{className:"conn-svg",viewBox:"-10000 -10000 20000 20000",preserveAspectRatio:"xMidYMid meet",children:[i.map(e=>(0,a.jsx)("path",{className:"conn-path",d:e.d},e.c.id)),null!==r?(0,a.jsx)("path",{className:"conn-path conn-temp",d:r.d}):null,null!==r?(0,a.jsx)("circle",{className:"conn-dot",cx:r.ex,cy:r.ey,r:"5"}):null]}),i.map(e=>(0,a.jsxs)("button",{type:"button",className:"conn-badge",style:{left:e.mid.x,top:e.mid.y},onClick:()=>s.removeConn(e.c.id),title:"Remove connection","aria-label":"Remove connection: ".concat(e.label),children:[(0,a.jsx)(S.git,{size:11})," ",(0,a.jsx)("span",{children:e.label})]},e.c.id))]})}class H extends Error{constructor(e,t,n){super(t),this.code=e,this.status=n,this.name="ApiError"}}async function X(e,t){var n,l;let s=(null!=(n=null==t?void 0:t.method)?n:"GET").toUpperCase(),a=await fetch(e,{...t,headers:{Accept:"application/json",...(null==t?void 0:t.body)!==void 0?{"Content-Type":"application/json"}:{},..."GET"===s||"HEAD"===s?{}:{"X-Keiko-CSRF":"1"},...null!=(l=null==t?void 0:t.headers)?l:{}}});if(!a.ok){let e="INTERNAL",t="HTTP ".concat(a.status.toString());try{let n=await a.json();e=n.error.code,t=n.error.message}catch(e){}throw new H(e,t,a.status)}if(204!==a.status)return a.json()}async function G(){return X("/api/config")}async function Z(){return null!=l||(l=X("/api/models").catch(e=>{throw l=void 0,e})),l}async function Q(e){let t=await X("/api/gateway/setup",{method:"POST",body:JSON.stringify(e)});return l=void 0,t}async function $(e){return X("/api/runs",{method:"POST",body:JSON.stringify(e)})}async function ee(e){return X("/api/runs/".concat(encodeURIComponent(e),"/cancel"),{method:"POST",body:JSON.stringify({confirm:!0})})}async function et(e){return X("/api/runs/".concat(encodeURIComponent(e)))}async function en(e){return X("/api/runs/".concat(encodeURIComponent(e),"/apply"),{method:"POST",body:JSON.stringify({confirm:!0})})}async function el(e){return X("/api/evidence/".concat(encodeURIComponent(e)))}async function es(){return null!=s||(s=X("/api/projects").finally(()=>{s=void 0})),s}async function ea(e){return X("/api/projects",{method:"POST",body:JSON.stringify(e)})}async function ei(e){return X("/api/chats?projectPath=".concat(encodeURIComponent(e)))}async function er(e,t){let n=new URLSearchParams;return n.set("chatId",e),n.set("projectPath",t),X("/api/chats/messages?".concat(n.toString()))}async function eo(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return X("/api/desktop/chats",{method:"POST",body:JSON.stringify(e)})}async function ec(e){return X("/api/desktop/chat",{method:"POST",body:JSON.stringify(e)})}async function ed(e,t){let n=new URLSearchParams;return n.set("root",e),void 0!==t&&t.length>0&&n.set("path",t),X("/api/files/directories?".concat(n.toString()))}async function eu(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",n=new URLSearchParams;return n.set("root",e),t.length>0&&n.set("path",t),X("/api/files/tree?".concat(n.toString()))}async function em(e,t){let n=new URLSearchParams;return n.set("root",e),n.set("path",t),X("/api/files/preview?".concat(n.toString()))}let ep="example-chat-model",eh="New chat";function ex(e){return e instanceof H?"".concat(e.code,": ").concat(e.message):e instanceof Error?e.message:"Unknown error"}function ef(e){return[...e].sort((e,t)=>t.updatedAt-e.updatedAt)}let eg={projects:[],chats:[],messages:[],models:[],activeProject:void 0,activeChat:void 0,selectedModel:ep};async function ev(){var e,t,n;let l=(await Z().catch(()=>({models:[]}))).models.filter(e=>"chat"===e.kind),s=l.some(e=>e.id===ep)?ep:null!=(n=null==(t=l[0])?void 0:t.id)?n:ep,a=await es().catch(()=>({projects:[]})),i=null!=(e=a.projects.find(e=>e.available))?e:a.projects[0];if(void 0!==i){let e=ef((await ei(i.path).catch(()=>({chats:[]}))).chats),t=e[0];if(void 0!==t){let n=await er(t.id,i.path);return{models:l,selectedModel:t.selectedModel,projects:Array.from(a.projects),activeProject:i,chats:e,activeChat:t,messages:Array.from(n.messages)}}}let r={modelId:s,title:eh};(null==i?void 0:i.available)===!0&&(r.projectPath=i.path);let o=await eo(r);return{models:l,selectedModel:o.chat.selectedModel,projects:Array.from(o.projects),activeProject:o.project,chats:ef(o.chats),activeChat:o.chat,messages:Array.from(o.messages)}}let ej=["Explain the architecture of this codebase","Find and fix a bug in the workspace store","Write tests for the window manager"];function ey(e){return t=>{"Enter"!==t.key||t.shiftKey||(t.preventDefault(),e())}}function ew(e){let{message:t}=e,n="user"===t.role;return(0,a.jsx)("article",{className:"chat-msg","data-role":t.role,children:(0,a.jsxs)("div",{className:"chat-msg-bubble",children:[(0,a.jsx)("div",{className:"chat-msg-role",children:n?"You":"Keiko"}),t.content,(0,a.jsx)("div",{className:"chat-msg-time",children:new Date(t.timestamp).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})})]})})}function eb(){return(0,a.jsx)("article",{className:"chat-msg","data-role":"assistant",children:(0,a.jsxs)("div",{className:"chat-msg-bubble",children:[(0,a.jsx)("div",{className:"chat-msg-role",children:"Keiko"}),(0,a.jsxs)("span",{className:"chat-typing","aria-label":"Keiko is responding",children:[(0,a.jsx)("i",{}),(0,a.jsx)("i",{}),(0,a.jsx)("i",{})]})]})})}function eN(e){let{session:t,ready:n}=e,{models:l,selectedModel:s,setSelectedModel:i}=t;return(0,a.jsxs)("div",{className:"cmp-bar",children:[(0,a.jsx)("button",{type:"button",className:"cmp-add","aria-label":"Attach (coming soon)",title:"Attach",children:(0,a.jsx)(S.plus,{size:16})}),(0,a.jsxs)("button",{type:"button",className:"cmp-mode",title:"Mode",children:[(0,a.jsx)(S.spark,{size:14,style:{color:"var(--accent)"}})," Build",(0,a.jsx)(S.chevron,{size:12})]}),(0,a.jsx)("span",{className:"spacer"}),(0,a.jsxs)("label",{className:"cmp-model mono",title:"Model",children:[(0,a.jsx)(S.cube,{size:13,style:{color:"var(--accent)"}}),(0,a.jsx)("select",{className:"cmp-model-select",value:s,"aria-label":"Model",onChange:e=>i(e.target.value),children:(l.length>0?l:[{id:ep}]).map(e=>(0,a.jsx)("option",{value:e.id,children:e.id},e.id))}),(0,a.jsx)(S.chevron,{size:12})]}),(0,a.jsx)("button",{type:"button",className:"cmp-icon","aria-label":"Voice (coming soon)",title:"Voice",children:(0,a.jsx)(S.mic,{size:16})}),(0,a.jsx)("button",{type:"submit",className:"cmp-send","data-on":n,disabled:!n,"aria-label":"Send message",children:(0,a.jsx)(S.arrowUp,{size:16})})]})}function ek(e){let{session:t,ready:n,placeholder:l}=e,{draft:s,loading:i,sending:r,setDraft:o,sendMessage:c}=t;return(0,a.jsxs)("div",{className:"cmp-box",children:[(0,a.jsx)("textarea",{className:"cmp-input",rows:2,value:s,"aria-label":"Chat message",placeholder:l,onChange:e=>o(e.target.value),onKeyDown:ey(c),disabled:i||r}),(0,a.jsx)(eN,{session:t,ready:n})]})}function eS(e){var t;let{session:n,ready:l}=e,{loading:s,activeProject:i,setDraft:r,sendMessage:o}=n,c=null!=(t=null==i?void 0:i.name)?t:"example-workspace";return(0,a.jsxs)("form",{className:"composer composer-compact",onSubmit:e=>{e.preventDefault(),o()},children:[(0,a.jsx)("h1",{className:"composer-title",children:"What should we build?"}),(0,a.jsx)(ek,{session:n,ready:l,placeholder:s?"Loading local workspace...":"Describe a task, paste a link, or ask anything..."}),(0,a.jsxs)("div",{className:"cmp-context",children:[(0,a.jsxs)("button",{type:"button",className:"chip",children:[(0,a.jsx)(S.folder,{size:14,style:{color:"var(--accent)"}}),(0,a.jsx)("span",{className:"chip-label",children:c}),(0,a.jsx)(S.chevron,{size:12,style:{color:"var(--fg-faint)"}})]}),(0,a.jsxs)("button",{type:"button",className:"chip",children:[(0,a.jsx)(S.cube,{size:14,style:{color:"var(--fg-dim)"}}),(0,a.jsx)("span",{className:"chip-label",children:"Work locally"}),(0,a.jsx)(S.chevron,{size:12,style:{color:"var(--fg-faint)"}})]})]}),(0,a.jsx)("div",{className:"cmp-suggest",children:ej.map(e=>(0,a.jsxs)("button",{type:"button",className:"suggest",onClick:()=>r(e),children:[(0,a.jsx)(S.spark,{size:12,style:{color:"var(--accent)"}})," ",e]},e))})]})}function eC(e){let{session:t,ready:n}=e,{draft:l,loading:s,sending:i,setDraft:r,sendMessage:o}=t;return(0,a.jsx)("form",{className:"composer composer-fill",onSubmit:e=>{e.preventDefault(),o()},children:(0,a.jsxs)("div",{className:"cmp-box cmp-box-fill",children:[(0,a.jsx)("textarea",{className:"cmp-input cmp-input-mini",value:l,"aria-label":"Chat message",placeholder:s?"Loading...":"Ask Keiko...",onChange:e=>r(e.target.value),onKeyDown:ey(o),disabled:s||i}),(0,a.jsx)("button",{type:"submit",className:"cmp-send cmp-send-float","data-on":n,disabled:!n,"aria-label":"Send message",title:"Send",children:(0,a.jsx)(S.arrowUp,{size:16})})]})})}function eM(e){let{root:t}=e;return(0,a.jsxs)("div",{className:"chat-ctx",children:[(0,a.jsx)(S.files,{size:12})," Context ",(0,a.jsxs)("span",{className:"mono",children:[t,"/"]})]})}function ez(e){let{mini:t=!1,linkedRoot:n=null}=e,l=function(){let e=(0,i.useContext)(r);if(null===e)throw Error("useChatSessionContext must be used inside ChatSessionProvider");return e}(),{messages:s,draft:o,loading:c,sending:d,error:u,sendMessage:m}=l,p=o.trim().length>0&&!d&&!c,h=s.filter(e=>"user"===e.role||"assistant"===e.role),x=(0,i.useRef)(null);return((0,i.useEffect)(()=>{let e=x.current;null!==e&&(e.scrollTop=e.scrollHeight)},[h.length,d]),t)?(0,a.jsxs)("div",{className:"chatw chatw-mini",children:[null!==n?(0,a.jsx)(eM,{root:n}):null,(0,a.jsx)(eC,{session:l,ready:p})]}):(0,a.jsxs)("div",{className:"chatw",children:[null!==n?(0,a.jsx)(eM,{root:n}):null,(0,a.jsx)("div",{className:"chatw-scroll",ref:x,"aria-live":"polite",children:0===h.length?(0,a.jsx)(eS,{session:l,ready:p}):(0,a.jsxs)("div",{className:"chatw-log",children:[h.map(e=>(0,a.jsx)(ew,{message:e},e.id)),d?(0,a.jsx)(eb,{}):null]})}),h.length>0?(0,a.jsx)("div",{className:"chatw-foot",children:(0,a.jsxs)("form",{className:"composer",onSubmit:e=>{e.preventDefault(),m()},children:[(0,a.jsx)(ek,{session:l,ready:p,placeholder:"Ask Keiko about your code..."}),void 0!==u?(0,a.jsx)("div",{role:"alert",className:"cmp-err",children:u}):null]})}):null,0===h.length&&void 0!==u?(0,a.jsx)("div",{className:"chatw-foot",children:(0,a.jsx)("div",{role:"alert",className:"cmp-err",children:u})}):null]})}let eE={w:150,h:110},eP={w:290,h:190},eR={chat:{title:"Chat",icon:"newChat",accent:!0,desc:"Talk to Keiko",w:480,h:480,min:{w:300,h:260},config:[{key:"title",label:"Title",type:"text",def:"New chat",optional:!0,placeholder:"Name this conversation"},{key:"model",label:"Model",type:"select",options:["example-chat-model","example-fast-model"],def:"example-chat-model"}]},files:{title:"Files",icon:"files",accent:!0,desc:"Browse a folder",w:290,h:340,tiny:{w:200,h:150},config:[{key:"root",label:"Folder",type:"directory",def:""}]},editor:{title:"Editor",icon:"editor",desc:"Edit a file",w:480,h:360,config:[{key:"file",label:"File path",type:"text",def:"windows.jsx",placeholder:"path/to/file.jsx"}]},browser:{title:"Browser",icon:"browser",desc:"Open a URL",w:460,h:340,config:[{key:"url",label:"URL",type:"text",def:"localhost:5173",placeholder:"https://…"}]},terminal:{title:"Terminal",icon:"terminal",accent:!0,desc:"Run commands",w:460,h:250,tiny:{w:250,h:140},config:[{key:"projectPath",label:"Project path",type:"text",def:""},{key:"cwd",label:"Working directory",type:"directory",def:""}]},review:{title:"Review",icon:"review",desc:"Review a proposed diff",w:520,h:420,config:[{key:"runId",label:"Run ID",type:"text",def:"",optional:!0,placeholder:"e.g. r-2026-06-01-…"}]},agents:{title:"Agents",icon:"agents",desc:"Run a BFF workflow",w:520,h:560,tiny:{w:250,h:140},cta:"Start agent",config:[]},integ:{title:"Integrations",icon:"plugins",desc:"Connect apps",w:320,h:300,config:[{key:"provider",label:"Provider",type:"select",options:["GitHub","Linear","Slack","Sentry"],def:"GitHub"}]},keiko:{title:"Keiko",icon:"spark",desc:"Keiko twin",w:344,h:520,tool:!0,singleton:!0},settings:{title:"Settings",icon:"settings",desc:"Preferences",w:470,h:560,tool:!0,singleton:!0},project:{title:"Project",icon:"folder",desc:"Project tree",w:304,h:440,tool:!0,singleton:!0},search:{title:"Search",icon:"search",desc:"Search the workspace",w:320,h:500,tool:!0,singleton:!0},plugins:{title:"Plugins",icon:"plugins",desc:"Plugins & tools",w:320,h:470,tool:!0,singleton:!0},automations:{title:"Automations",icon:"automations",desc:"Workflow automations",w:320,h:300,tool:!0,singleton:!0},mobile:{title:"Keiko mobile",icon:"mobile",desc:"Mobile companion",w:300,h:380,tool:!0,singleton:!0},inspector:{title:"Inspector",icon:"layers",desc:"Inspect the workspace",w:290,h:440,tool:!0,singleton:!0},activity:{title:"Activity",icon:"activity",desc:"Activity timeline",w:322,h:460,tool:!0,singleton:!0},notifications:{title:"Notifications",icon:"bell",desc:"Notifications",w:300,h:360,tool:!0,singleton:!0},resources:{title:"Resources",icon:"cube",desc:"System resources",w:300,h:320,tool:!0,singleton:!0}},eT=new Map;function eA(e,t){eT.set(e,t)}let eL=function(){let e={};return Object.keys(eR).forEach(t=>{e[t]=function(e,t){var n,l;let s={title:t.title,icon:t.icon,desc:t.desc,w:t.w,h:t.h,min:null!=(n=t.min)?n:eE,tiny:null!=(l=t.tiny)?l:eP,render:(t,n)=>{let l=eT.get(e);return void 0!==l?l(t,n):null}},a={};return!0===t.accent&&(a.accent=!0),!0===t.tool&&(a.tool=!0),!0===t.singleton&&(a.singleton=!0),void 0!==t.config&&(a.config=t.config),void 0!==t.cta&&(a.cta=t.cta),{...s,...a}}(t,eR[t])}),e}(),eD=["n","s","e","w","ne","nw","se","sw"],eF=["t","r","b","l"];function eI(e){let{icon:t,label:n}=e,l=S[t];return(0,a.jsxs)("div",{className:"too-small",children:[(0,a.jsx)("div",{className:"ts-ico",children:(0,a.jsx)(l,{size:28})}),(0,a.jsxs)("div",{className:"ts-title",children:["Too small to show ",n]}),(0,a.jsx)("div",{className:"ts-sub",children:"Enlarge the window or zoom out"}),(0,a.jsx)("div",{className:"ts-arrow","aria-hidden":"true",children:(0,a.jsx)("svg",{width:"22",height:"22",viewBox:"0 0 22 22",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round",children:(0,a.jsx)("path",{d:"M8 8l8 8M16 11v5h-5"})})})]})}function eO(e){var t,n;let{win:l,top:s,connState:r,view:o,api:c,wsRef:d}=e,u=eL[l.type],m=S[u.icon],p=null!=(n=l.zoom)?n:1,h="chat"===l.type||"agents"===l.type?c.linkedFilesRoot(l.id):null,x="agents"===l.type?null==(t=c.linkedFilesContext(l.id))?void 0:t.activeFilePath:void 0,f=l.w/p,g=l.h/p,v=(0,i.useCallback)(e=>{c.update(l.id,{cfg:{...l.cfg,...e}})},[c,l.cfg,l.id]),{mode:j,node:y}=function(e,t,n,l,s,i,r){if("chat"===e){let e=t<430||n<430;return{mode:e?"mini":"full",node:(0,a.jsx)(ez,{mini:e,linkedRoot:s})}}let o=eL[e];return t<o.tiny.w||n<o.tiny.h?{mode:"tiny",node:(0,a.jsx)(eI,{icon:o.icon,label:o.title})}:{mode:"full",node:o.render(l,{linkedRoot:s,linkedFilePath:i,updateCfg:r})}}(l.type,f,g,l.cfg,h,x,v),w=(0,i.useCallback)(e=>c.update(l.id,{zoom:Math.max(.5,Math.min(2,Math.round(10*e)/10))}),[c,l.id]),b=(0,i.useCallback)(e=>{var t,n,s,a;if(0!==e.button||"valid"===r)return;e.preventDefault(),c.focus(l.id);let i=d.current;if(null===i)return;let u=function(e,t){let n=t.zoom;return{z:n,vpx0:-t.x/n,vpy0:-t.y/n,vpw:e.width/n,vph:e.height/n,toWX:l=>(l-e.left-t.x)/n,toWY:l=>(l-e.top-t.y)/n}}(i.getBoundingClientRect(),o),m=l.max,p=m?null!=(s=null==(t=l.prev)?void 0:t.w)?s:480:l.w,h=m?null!=(a=null==(n=l.prev)?void 0:n.h)?a:360:l.h,x=m?p/2:u.toWX(e.clientX)-l.x,f=m?18:u.toWY(e.clientY)-l.y;m&&c.update(l.id,{max:!1,w:p,h:h}),function(e,t,n){let l=30/t.z,s=s=>{let a=t.toWX(s.clientX),i=t.toWY(s.clientY),r=a-n.offX,o=i-n.offY;r=Math.max(t.vpx0-(n.W-120),Math.min(t.vpx0+t.vpw-120,r)),o=Math.max(t.vpy0,Math.min(t.vpy0+t.vph-38,o)),e.setSnap(function(e,t,n,l){let s=e-n.vpx0<l,a=n.vpx0+n.vpw-e<l,i=t-n.vpy0<l,r=n.vpy0+n.vph-t<l;return i&&s?"tl":i&&a?"tr":r&&s?"bl":r&&a?"br":s?"left":a?"right":i?"maxi":null}(a,i,t,l)),e.update(n.winId,{x:r,y:o})},a=()=>{window.removeEventListener("pointermove",s),window.removeEventListener("pointerup",a),e.commitSnap(n.winId),document.body.style.cursor=""};window.addEventListener("pointermove",s),window.addEventListener("pointerup",a)}(c,u,{winId:l.id,offX:x,offY:f,W:p})},[c,l.id,l.x,l.y,l.w,l.h,l.max,l.prev,o,d,r]),N=(0,i.useCallback)(e=>t=>{t.preventDefault(),t.stopPropagation(),c.focus(l.id);let n={x:l.x,y:l.y,w:l.w,h:l.h},s=t.clientX,a=t.clientY,i=o.zoom,r=t=>{let r=function(e,t,n,l,s){let{x:a,y:i,w:r,h:o}=e;t.includes("e")&&(r=e.w+n),t.includes("s")&&(o=e.h+l),t.includes("w")&&(r=e.w-n,a=e.x+n),t.includes("n")&&(o=e.h-l,i=e.y+l);let c=eL[s].min,d=c.w>0?c.w:240,u=c.h>0?c.h:150;return r<d&&(t.includes("w")&&(a-=d-r),r=d),o<u&&(t.includes("n")&&(i-=u-o),o=u),{x:a,y:i,w:r,h:o}}(n,e,(t.clientX-s)/i,(t.clientY-a)/i,l.type);c.update(l.id,{...r,max:!1})},d=()=>{window.removeEventListener("pointermove",r),window.removeEventListener("pointerup",d),document.body.style.cursor=""};document.body.style.cursor="n"===e||"s"===e?"ns-resize":"e"===e||"w"===e?"ew-resize":"ne"===e||"sw"===e?"nesw-resize":"nwse-resize",window.addEventListener("pointermove",r),window.addEventListener("pointerup",d)},[c,l.id,l.x,l.y,l.w,l.h,l.type,o.zoom]),k=(0,i.useCallback)(e=>{e.preventDefault(),e.stopPropagation(),c.startConnect(l.id,e)},[c,l.id]),C="full"===j?function(e,t){if(void 0===t)return null;let n=e=>{let n=t[e];return"string"==typeof n&&n.length>0?n:null};switch(e){case"files":return n("root");case"browser":return n("url");case"editor":return n("file");case"terminal":return n("cwd");case"review":{let e=n("base"),t=n("head");return null!==e&&null!==t?"".concat(e," → ").concat(t):null}case"agents":return n("role");case"chat":{let e=n("title");return null!==e&&"New chat"!==e?e:null}default:return null}}(l.type,l.cfg):null,M={left:l.x,top:l.y,width:l.w,height:l.h,zIndex:l.z};return(0,a.jsxs)("section",{className:"window","data-top":s?"true":"false","data-max":l.max?"true":"false","data-conn":null!=r?r:void 0,"data-window-id":l.id,style:M,onPointerDown:e=>{"valid"===r&&c.confirmConnect(l.id,e),c.focus(l.id)},children:[(0,a.jsxs)("header",{className:"win-head",onPointerDown:b,onDoubleClick:()=>c.maximize(l.id),children:[(0,a.jsx)("span",{className:"win-ico",style:{color:!0===u.accent?"var(--accent)":"var(--fg-muted)"},children:(0,a.jsx)(m,{size:14})}),(0,a.jsx)("span",{className:"win-title",children:u.title}),null!==C?(0,a.jsx)("span",{className:"win-sub mono",children:C}):null,(0,a.jsx)("span",{className:"spacer"}),(0,a.jsxs)("div",{className:"win-zoom",children:[(0,a.jsx)("button",{type:"button",className:"win-zbtn",title:"Zoom content out","aria-label":"Zoom content out",onPointerDown:e=>e.stopPropagation(),onClick:()=>w(p-.1),children:(0,a.jsx)(S.zoomOut,{size:13})}),(0,a.jsxs)("button",{type:"button",className:"win-zpct",title:"Reset zoom","aria-label":"Reset content zoom",onPointerDown:e=>e.stopPropagation(),onClick:()=>c.update(l.id,{zoom:1}),children:[Math.round(100*p),"%"]}),(0,a.jsx)("button",{type:"button",className:"win-zbtn",title:"Zoom content in","aria-label":"Zoom content in",onPointerDown:e=>e.stopPropagation(),onClick:()=>w(p+.1),children:(0,a.jsx)(S.zoomIn,{size:13})})]}),(0,a.jsx)("button",{type:"button",className:"win-btn",title:l.max?"Restore":"Maximize","aria-label":l.max?"Restore window":"Maximize window",onPointerDown:e=>e.stopPropagation(),onClick:()=>c.maximize(l.id),children:l.max?(0,a.jsx)(S.restore,{size:13}):(0,a.jsx)(S.maximize,{size:13})}),(0,a.jsx)("button",{type:"button",className:"win-btn win-close",title:"Close","aria-label":"Close window",onPointerDown:e=>e.stopPropagation(),onClick:()=>c.close(l.id),children:(0,a.jsx)(S.close,{size:14})})]}),(0,a.jsx)("div",{className:"win-body","data-mode":j,style:"tiny"===j?{}:{zoom:p},children:y}),l.max?null:eD.map(e=>(0,a.jsx)("div",{className:"wz wz-".concat(e),onPointerDown:N(e)},e)),l.max?null:eF.map(e=>(0,a.jsx)("div",{className:"win-port wp-".concat(e),title:"Click to connect to another card","aria-label":"Connect from ".concat("t"===e?"top":"r"===e?"right":"b"===e?"bottom":"left"," edge"),role:"button",tabIndex:0,onPointerDown:k},"p".concat(e)))]})}function eW(e){var t;let{ws:n,wsRef:l,openPalette:s,palette:r}=e,{wins:o,view:c,snapPrev:d,conns:u,connecting:m,api:p}=n,h=function(e){if(null===e||0===e.length)return null;let t=e[0];for(let n=1;n<e.length;n++){let l=e[n];l.z>t.z&&(t=l)}return t}(o),x=null!==m&&null!==o&&null!=(t=o.find(e=>e.id===m.from))?t:null,f=(0,i.useMemo)(()=>({backgroundSize:"".concat(String(22*c.zoom),"px ").concat(String(22*c.zoom),"px"),backgroundPosition:"".concat(String(c.x),"px ").concat(String(c.y),"px")}),[c]),g=(0,i.useMemo)(()=>({transform:"translate(".concat(String(c.x),"px, ").concat(String(c.y),"px) scale(").concat(String(c.zoom),")"),transformOrigin:"0 0"}),[c]),v=null!==o&&0===o.length;return(0,a.jsxs)("div",{className:"workspace",ref:l,"data-connecting":null!==m?"true":void 0,onPointerDownCapture:e=>{if(0!==e.button||null===m||null===x||null===o)return;let t=function(e){if(!(e instanceof Element))return;let t=e.closest(".window[data-window-id]");return null==t?void 0:t.dataset.windowId}(e.target);if(void 0===t||t===x.id)return;let n=o.find(e=>e.id===t);void 0!==n&&_(x.type,n.type)&&p.confirmConnect(n.id,e)},onPointerDown:e=>{var t;if(0===e.button&&!((t=e.target)instanceof Element&&(null!==t.closest(".window")||null!==t.closest(".ws-zoom")||null!==t.closest(".ws-fab")||null!==t.closest(".conn-badge")))){if(null!==m)return void p.cancelConnect();!function(e,t){let n=t.clientX,l=t.clientY;document.body.style.cursor="grabbing";let s=t=>{e(t.clientX-n,t.clientY-l),n=t.clientX,l=t.clientY},a=()=>{window.removeEventListener("pointermove",s),window.removeEventListener("pointerup",a),document.body.style.cursor=""};window.addEventListener("pointermove",s),window.addEventListener("pointerup",a)}(p.panBy,e)}},children:[(0,a.jsx)(q,{}),(0,a.jsx)("div",{className:"ws-grid",style:f,"aria-hidden":"true"}),v?(0,a.jsxs)("div",{className:"ws-empty",children:[(0,a.jsx)("img",{className:"ws-empty-logo",src:"/assets/keiko-logo.svg",alt:""}),(0,a.jsx)("div",{className:"ws-empty-title",children:"Empty workspace"}),(0,a.jsx)("div",{className:"ws-empty-sub",children:"Open a window to start working"}),(0,a.jsxs)("button",{type:"button",className:"ws-empty-btn",onClick:s,children:[(0,a.jsx)(S.add,{size:15})," New window"]})]}):null,(0,a.jsxs)("div",{className:"ws-scene",style:g,children:[null!==d?(0,a.jsx)("div",{className:"snap-ghost",style:{left:d.x,top:d.y,width:d.w,height:d.h}}):null,null!==o?(0,a.jsx)(Y,{wins:o,conns:u,connecting:m,api:p}):null,null!==o?o.map(e=>(0,a.jsx)(eO,{win:e,top:null!==h&&e.id===h.id,connState:null===x?null:e.id===x.id?"source":_(x.type,e.type)?"valid":"invalid",view:c,api:p,wsRef:l},e.id)):null]}),(0,a.jsxs)("div",{className:"ws-zoom",children:[(0,a.jsx)("button",{type:"button",className:"ws-zoom-btn",onClick:()=>p.zoomTo(c.zoom-.2),"aria-label":"Zoom out",title:"Zoom out",children:(0,a.jsx)(S.zoomOut,{size:15})}),(0,a.jsxs)("button",{type:"button",className:"ws-zoom-pct mono",onClick:p.resetView,"aria-label":"Reset view",title:"Reset view",children:[Math.round(100*c.zoom),"%"]}),(0,a.jsx)("button",{type:"button",className:"ws-zoom-btn",onClick:()=>p.zoomTo(c.zoom+.2),"aria-label":"Zoom in",title:"Zoom in",children:(0,a.jsx)(S.zoomIn,{size:15})})]}),(0,a.jsx)("button",{type:"button",className:"ws-fab",onPointerDown:e=>e.stopPropagation(),onClick:s,"aria-label":"New window",title:"New window",children:(0,a.jsx)(S.add,{size:20})}),null!=r?r:null]})}function eK(e){let{commands:t,onClose:n}=e,[l,s]=(0,i.useState)(""),[r,o]=(0,i.useState)(0),c=(0,i.useRef)(null),d=(0,i.useRef)(null);(0,i.useEffect)(()=>(d.current=document.activeElement,()=>{var e,t;null==(t=d.current)||null==(e=t.focus)||e.call(t)}),[]),(0,i.useEffect)(()=>{var e;null==(e=c.current)||e.focus()},[]);let u=(0,i.useMemo)(()=>{let e=l.toLowerCase();return t.filter(t=>{var n;return"".concat(t.label," ").concat(null!=(n=t.group)?n:"").toLowerCase().includes(e)})},[t,l]);(0,i.useEffect)(()=>{o(0)},[l]);let m=e=>{void 0!==e&&(e.run(),n())};return(0,a.jsx)("div",{className:"cmdk-overlay",onPointerDown:n,children:(0,a.jsxs)("div",{className:"cmdk",role:"dialog","aria-modal":"true","aria-label":"Command palette",onPointerDown:e=>e.stopPropagation(),onKeyDown:e=>{if("ArrowDown"===e.key){e.preventDefault(),o(e=>Math.min(u.length-1,e+1));return}if("ArrowUp"===e.key){e.preventDefault(),o(e=>Math.max(0,e-1));return}if("Enter"===e.key){e.preventDefault(),m(u[r]);return}"Escape"===e.key&&n()},children:[(0,a.jsxs)("div",{className:"cmdk-input",children:[(0,a.jsx)(S.search,{size:16}),(0,a.jsx)("input",{ref:c,role:"combobox","aria-expanded":"true","aria-controls":"cmdk-list","aria-activedescendant":u.length>0?"cmdk-row-".concat(String(r)):void 0,"aria-label":"Command query",placeholder:"Type a command…",value:l,onChange:e=>s(e.target.value)}),(0,a.jsx)("span",{className:"kbd",children:"esc"})]}),(0,a.jsxs)("div",{id:"cmdk-list",role:"listbox",className:"cmdk-list",children:[0===u.length&&(0,a.jsx)("div",{className:"cmdk-empty",children:"No matching commands"}),u.map((e,t)=>(0,a.jsxs)("div",{role:"option",id:"cmdk-row-".concat(String(t)),"aria-selected":t===r,className:"cmdk-row","data-sel":t===r,tabIndex:-1,onMouseEnter:()=>o(t),onClick:()=>m(e),children:[(0,a.jsx)("span",{className:"cmdk-ico",children:function(e){var t;let n=null!=(t=S[e])?t:S.spark;return(0,a.jsx)(n,{size:16})}(e.icon)}),(0,a.jsx)("span",{className:"cmdk-label",children:e.label}),(0,a.jsx)("span",{className:"spacer"}),void 0!==e.group&&(0,a.jsx)("span",{className:"cmdk-group mono",children:e.group})]},e.id))]})]})})}function eU(e){let{onCancel:t}=e,[n,l]=(0,i.useState)(""),[s,r]=(0,i.useState)(""),[o,c]=(0,i.useState)(""),[d,u]=(0,i.useState)(""),[m,p]=(0,i.useState)(!1),[h,x]=(0,i.useState)(),[f,g]=(0,i.useState)();async function v(e){if(e.preventDefault(),!m){p(!0),x(void 0),g(void 0);try{let e=Array.from(new Set(d.split(/[\n,]/u).map(e=>e.trim()).filter(e=>e.length>0)));if(function(e){try{return new URL(e.trim()).hostname.endsWith(".services.ai.azure.com")}catch(e){return!1}}(n)&&0===e.length){x("Azure AI Foundry requires deployment names. Paste the names from the Deployments tab."),p(!1);return}let t=(await Q({baseUrl:n,apiKey:s,apiKeyHeaderName:""===o.trim()?void 0:o.trim(),deploymentNames:e})).testedModelIds.length;g("Verified ".concat(String(t)," workflow chat model").concat(1===t?"":"s",". Reloading Keiko...")),window.setTimeout(()=>window.location.reload(),800)}catch(e){x(e instanceof H?"".concat(e.code,": ").concat(e.message):e instanceof Error?e.message:"The gateway could not be configured."),p(!1)}}}return(0,a.jsx)("div",{className:"gw-setup-backdrop",role:"presentation",children:(0,a.jsxs)("form",{className:"gw-setup",onSubmit:e=>void v(e),children:[(0,a.jsxs)("div",{className:"gw-setup-badge",children:[(0,a.jsx)(S.cube,{size:18}),"Model gateway setup"]}),(0,a.jsx)("h1",{children:"Connect Keiko to your internal LLMs"}),(0,a.jsx)("p",{children:"Keiko needs the internal gateway URL and API token before chat and agent workflows can run. The token is tested once and stored only on this machine."}),(0,a.jsxs)("label",{className:"gw-field",children:[(0,a.jsx)("span",{children:"Base URL"}),(0,a.jsx)("input",{className:"gw-input mono",value:n,placeholder:"https://llm-gateway.example.com/v1",autoComplete:"off",disabled:m||void 0!==f,onChange:e=>l(e.target.value)})]}),(0,a.jsxs)("label",{className:"gw-field",children:[(0,a.jsx)("span",{children:"API token"}),(0,a.jsx)("input",{className:"gw-input mono",type:"password",value:s,placeholder:"Paste your API token",autoComplete:"off",disabled:m||void 0!==f,onChange:e=>r(e.target.value)})]}),(0,a.jsxs)("label",{className:"gw-field",children:[(0,a.jsx)("span",{children:"API key header optional"}),(0,a.jsx)("input",{className:"gw-input mono",value:o,placeholder:"Authorization",autoComplete:"off",disabled:m||void 0!==f,onChange:e=>c(e.target.value)})]}),(0,a.jsxs)("label",{className:"gw-field",children:[(0,a.jsx)("span",{children:"Deployment names for Azure"}),(0,a.jsx)("textarea",{className:"gw-input gw-textarea mono",value:d,placeholder:"Paste deployment names, one per line",autoComplete:"off",disabled:m||void 0!==f,onChange:e=>u(e.target.value)})]}),(0,a.jsx)("div",{className:"gw-note",children:"Leave the header field empty unless your gateway admin gave you a custom API-key header, for example X-Litellm-Key. Supported headers are Authorization, X-Litellm-Key, X-Api-Key, and api-key. Leave deployment names empty only for OpenAI-compatible gateways with model discovery. For Azure AI Foundry, paste deployment names exactly as shown in the Deployments tab. Testing several deployments can take up to 30 seconds."}),void 0!==h?(0,a.jsx)("div",{className:"gw-error",children:h}):null,void 0!==f?(0,a.jsx)("div",{className:"gw-success",children:f}):null,(0,a.jsxs)("div",{className:"gw-actions",children:[void 0!==t?(0,a.jsx)("button",{className:"gw-cancel",type:"button",disabled:m||void 0!==f,onClick:t,children:"Cancel"}):null,(0,a.jsx)("button",{className:"gw-submit",type:"submit",disabled:m||void 0!==f||""===n.trim()||""===s.trim(),children:m?"Testing connection...":"Test & save"})]})]})})}let eB=[["ask","Ask every action"],["full","Full access"]];function eq(e){let{cfg:t,set:n}=e,l=!1!==t.keikoMode,s="full"===t.access?"full":"ask",i=l?"No rights by default. You approve while manual; Keiko governs per policy when autonomous.":"full"===s?"Legacy: agent acts without prompts.":"Legacy: you approve each privileged action.";return(0,a.jsxs)("div",{className:"permctl",children:[(0,a.jsxs)("button",{type:"button",className:"perm-toggle","data-on":l,"aria-pressed":l,onClick:()=>n("keikoMode",!l),children:[(0,a.jsx)("img",{className:"perm-orca",src:"/assets/keiko-logo.svg",alt:""}),(0,a.jsxs)("span",{className:"perm-tt",children:[(0,a.jsx)("span",{className:"perm-name",children:"Keiko-Mode"}),(0,a.jsx)("span",{className:"perm-desc",children:"Zero standing rights \xb7 Keiko governs"})]}),(0,a.jsx)("span",{className:"perm-sw"+(l?" on":""),children:(0,a.jsx)("span",{})})]}),!l&&(0,a.jsx)("div",{className:"perm-legacy",children:eB.map(e=>{let[t,l]=e;return(0,a.jsx)("button",{type:"button",className:"perm-opt","data-on":s===t,"aria-pressed":s===t,onClick:()=>n("access",t),children:l},t)})}),(0,a.jsx)("div",{className:"perm-note",children:i})]})}function eJ(e){return e instanceof Error?e.message:"Unable to read directories."}function e_(e){let{value:t,projectId:n,selectProjectRoot:l=!1,onSelect:s,onClose:r}=e,[o,c]=(0,i.useState)(null),[d,u]=(0,i.useState)(t),[m,p]=(0,i.useState)(!1),[h,x]=(0,i.useState)(null),f=null!=n?n:t.trim(),g=(0,i.useCallback)(async e=>{if(0===f.length){c(null),u(""),x("Select a registered project first.");return}p(!0),x(null);try{let t=await ed(f,e);c(t),u(t.path)}catch(e){x(eJ(e))}finally{p(!1)}},[f]);return(0,i.useEffect)(()=>{g(t.length>0?t:void 0)},[g,t]),(0,a.jsxs)("div",{className:"dir-picker",role:"group","aria-label":"Directory picker",children:[(0,a.jsxs)("div",{className:"dir-top",children:[(0,a.jsx)("input",{className:"dlg-input mono dir-path",value:d,onChange:e=>u(e.target.value),onKeyDown:e=>{"Enter"===e.key&&(e.preventDefault(),g(d))}}),(0,a.jsx)("button",{type:"button",className:"dlg-btn dir-go",onClick:()=>void g(d),children:"Go"})]}),null!==o?(0,a.jsx)("div",{className:"dir-roots",children:o.roots.map(e=>(0,a.jsx)("button",{type:"button",className:"dir-chip",onClick:()=>void g(e.path),children:e.label},"".concat(e.label,":").concat(e.path)))}):null,(0,a.jsxs)("div",{className:"dir-list",children:[(null==o?void 0:o.parent)!==null&&(null==o?void 0:o.parent)!==void 0?(0,a.jsxs)("button",{type:"button",className:"dir-row",onClick:()=>{var e;g(null!=(e=o.parent)?e:void 0)},children:[(0,a.jsx)(S.back,{size:14}),(0,a.jsx)("span",{children:"Parent directory"})]}):null,null==o?void 0:o.entries.map(e=>(0,a.jsxs)("button",{type:"button",className:"dir-row",onClick:()=>void g(e.path),children:[(0,a.jsx)(S.folder,{size:14}),(0,a.jsx)("span",{children:e.name})]},e.path)),m?(0,a.jsx)("div",{className:"dir-note",children:"Loading directories..."}):null,m||null===o||0!==o.entries.length?null:(0,a.jsx)("div",{className:"dir-note",children:"No child directories."}),null!==h?(0,a.jsx)("div",{className:"dir-error",children:h}):null]}),(0,a.jsxs)("div",{className:"dir-actions",children:[(0,a.jsx)("button",{type:"button",className:"dlg-btn",onClick:r,children:"Close"}),(0,a.jsx)("button",{type:"button",className:"dlg-btn dlg-primary",onClick:()=>{if(null!==o){var e,t;s(l&&null!=(t=null==(e=o.roots[0])?void 0:e.path)?t:o.path),r()}},disabled:null===o,children:"Use directory"})]})]})}let eV=[{id:"verify",label:"Verify"},{id:"explain-plan",label:"Explain plan"},{id:"unit-test-generation",label:"Generate unit tests"},{id:"bug-investigation",label:"Investigate bug"}];function eY(e){return e.filter(e=>e.available).map(e=>e.path)}function eH(e){return e.split(/[\n,]/u).map(e=>e.trim()).filter(e=>e.length>0)}function eX(e){return"chat"===e.kind&&e.toolCalling&&e.structuredOutput}function eG(e){return e.replaceAll("\\","/")}function eZ(e,t){let n=eG(t.trim());if(0===n.length)return"";let l=eG(e.trim()).replace(/\/+$/u,"");if(0===l.length)return n;if(n===l)return".";let s="".concat(l,"/");return n.startsWith(s)?n.slice(s.length):n}function eQ(e,t){return eH(t).map(t=>eZ(e,t)).join(", ")}function e$(e){var t;let{filesContext:n,firstRef:l,directoryField:s,setDirectoryField:r,setDialogError:o,onConfirm:c}=e,[d,u]=(0,i.useState)("verify"),[m,p]=(0,i.useState)(null!=(t=null==n?void 0:n.root)?t:""),[h,x]=(0,i.useState)(""),[f,g]=(0,i.useState)([]),[v,j]=(0,i.useState)([]),[y,w]=(0,i.useState)(()=>{var e,t;return function(e,t){let n=null===t?"":eZ(e,t);return{verifyTargetFiles:n,explainFilePath:n,explainQuestion:"",unitTargetKind:"file",unitFilePath:n,unitModuleDir:"",unitFilePaths:n,bugDescription:"",bugFailingOutput:"",bugStackTrace:"",bugTargetFiles:n}}(null!=(e=null==n?void 0:n.root)?e:"",null!=(t=null==n?void 0:n.activeFilePath)?t:null)}),[b,N]=(0,i.useState)(!0),[k,C]=(0,i.useState)(!1),[M,z]=(0,i.useState)(!1),E=m.trim(),P=null!==n&&n.root===E&&void 0!==n.activeFilePath?n.activeFilePath:null,R=E.length>0&&v.includes(E),T=function(e,t,n,l){if(0===t.length)return"Workspace is required.";if(0===n.length)return"No model is available.";if("explain-plan"===e&&0===l.explainFilePath.trim().length)return"Explain plan requires a filePath.";if("unit-test-generation"===e){if("file"===l.unitTargetKind&&0===l.unitFilePath.trim().length)return"Unit test generation requires a filePath.";if("module"===l.unitTargetKind&&0===l.unitModuleDir.trim().length)return"Unit test generation requires a moduleDir.";if("changedFiles"===l.unitTargetKind&&0===eH(l.unitFilePaths).length)return"Unit test generation requires at least one filePath."}return"bug-investigation"!==e||l.bugDescription.trim().length>0||l.bugFailingOutput.trim().length>0||l.bugStackTrace.trim().length>0||eH(l.bugTargetFiles).length>0?null:"Bug investigation requires description, output, stack trace, or target files."}(d,E,h,y),A=null===T&&R&&!M&&!b;(0,i.useEffect)(()=>{let e=!1;return N(!0),o(null),Promise.all([Z(),es()]).then(t=>{let[n,l]=t;if(e)return;let s=n.models.filter(eX);g(s),x(e=>{var t,n,l;return e||(null!=(l=null==(t=null!=(n=s.find(e=>"example-chat-model"===e.id))?n:s[0])?void 0:t.id)?l:"")}),j(eY(l.projects))}).catch(t=>{e||o(eJ(t))}).finally(()=>{e||N(!1)}),()=>{e=!0}},[o]);let L=e=>{w(t=>({...t,...e}))};(0,i.useEffect)(()=>{if(null===P)return;let e=eZ(E,P);w(t=>{let n={};return 0===t.verifyTargetFiles.trim().length&&(n.verifyTargetFiles=e),0===t.explainFilePath.trim().length&&(n.explainFilePath=e),0===t.unitFilePath.trim().length&&(n.unitFilePath=e),0===t.unitFilePaths.trim().length&&(n.unitFilePaths=e),0===t.bugTargetFiles.trim().length&&(n.bugTargetFiles=e),0===Object.keys(n).length?t:{...t,...n}})},[P,E]);let D=async()=>{j(eY((await es()).projects))},F=async()=>{if(0!==E.length){C(!0),o(null);try{await ea({path:E}),await D()}catch(e){o(eJ(e))}finally{C(!1)}}},I=async()=>{if(!A)return void o(null!=T?T:"Workspace is not registered.");z(!0),o(null);let e=function(e,t,n,l){if("verify"===e){let e=eH(l.verifyTargetFiles).map(e=>eZ(t,e));return{taskType:"verify",modelId:n,input:{workspaceRoot:t,...e.length>0?{targetFiles:e}:{}}}}if("explain-plan"===e)return{taskType:"explain-plan",modelId:n,input:{workspaceRoot:t,filePath:eZ(t,l.explainFilePath),...l.explainQuestion.trim().length>0?{question:l.explainQuestion.trim()}:{}}};if("unit-test-generation"===e){let e=eH(l.unitFilePaths).map(e=>eZ(t,e)),s="module"===l.unitTargetKind?{kind:"module",moduleDir:eZ(t,l.unitModuleDir)}:"changedFiles"===l.unitTargetKind?{kind:"changedFiles",filePaths:e}:{kind:"file",filePath:eZ(t,l.unitFilePath)};return{workflowId:"unit-test-generation",modelId:n,input:{workspaceRoot:t,target:s}}}return{workflowId:"bug-investigation",modelId:n,input:{workspaceRoot:t,report:{...l.bugDescription.trim().length>0?{description:l.bugDescription.trim()}:{},...l.bugFailingOutput.trim().length>0?{failingOutput:l.bugFailingOutput.trim()}:{},...l.bugStackTrace.trim().length>0?{stackTrace:l.bugStackTrace.trim()}:{},...eH(l.bugTargetFiles).length>0?{targetFiles:eH(l.bugTargetFiles).map(e=>eZ(t,e))}:{}}}}}(d,E,h,y);try{let t=await $(e);c({workflow:d,model:h,runId:t.runId,fingerprint:t.fingerprint,workspaceRoot:E,inputJson:JSON.stringify(e.input),...null!==n&&n.root===E?{__connectFilesId:n.id}:{}})}catch(e){e instanceof H&&"WORKSPACE_NOT_REGISTERED"===e.code?(await D().catch(()=>void 0),o("Workspace is not registered.")):o(eJ(e))}finally{z(!1)}};return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)("label",{className:"dlg-field",children:[(0,a.jsx)("span",{className:"dlg-label",children:"Workflow"}),(0,a.jsxs)("span",{className:"dlg-selwrap",children:[(0,a.jsx)("select",{ref:l,className:"dlg-input mono",value:d,onChange:e=>u(e.target.value),children:eV.map(e=>(0,a.jsx)("option",{value:e.id,children:e.label},e.id))}),(0,a.jsx)("span",{className:"dlg-selchev",children:(0,a.jsx)(S.chevron,{size:15})})]})]}),(0,a.jsxs)("label",{className:"dlg-field",children:[(0,a.jsx)("span",{className:"dlg-label",children:"Workspace"}),(0,a.jsxs)("span",{className:"dlg-dirwrap",children:[(0,a.jsx)("input",{className:"dlg-input mono",value:m,placeholder:"/absolute/project/path",onClick:()=>r("agentWorkspace"),onChange:e=>p(e.target.value)}),(0,a.jsx)("button",{type:"button",className:"dlg-dirbtn",onClick:()=>r("agentWorkspace"),children:"Browse"})]}),"agentWorkspace"===s?(0,a.jsx)(e_,{value:m,projectId:R?E:void 0,onSelect:p,onClose:()=>r(null)}):null]}),E.length>0&&!R?(0,a.jsxs)("div",{className:"dlg-agent-warning",children:[(0,a.jsx)("span",{children:"Workspace is not registered."}),(0,a.jsx)("button",{type:"button",className:"dlg-btn",disabled:k,onClick:()=>void F(),children:k?"Registering...":"Register workspace"})]}):null,(0,a.jsxs)("label",{className:"dlg-field",children:[(0,a.jsx)("span",{className:"dlg-label",children:"Model"}),(0,a.jsxs)("span",{className:"dlg-selwrap",children:[(0,a.jsx)("select",{className:"dlg-input mono",value:h,onChange:e=>x(e.target.value),disabled:0===f.length,children:f.map(e=>(0,a.jsx)("option",{value:e.id,children:e.id},e.id))}),(0,a.jsx)("span",{className:"dlg-selchev",children:(0,a.jsx)(S.chevron,{size:15})})]})]}),null!==P?(0,a.jsxs)("button",{type:"button",className:"dlg-current-file",onClick:()=>{if(null===P)return;let e=eZ(E,P);"verify"===d?L({verifyTargetFiles:e}):"explain-plan"===d?L({explainFilePath:e}):"unit-test-generation"===d?"changedFiles"===y.unitTargetKind?L({unitFilePaths:e}):L({unitTargetKind:"file",unitFilePath:e}):L({bugTargetFiles:e})},children:[(0,a.jsx)(S.files,{size:13})," Use current file ",(0,a.jsx)("span",{className:"mono",children:P})]}):null,"verify"===d?(0,a.jsxs)("label",{className:"dlg-field",children:[(0,a.jsxs)("span",{className:"dlg-label",children:["Target files ",(0,a.jsx)("span",{className:"dlg-opt",children:"optional"})]}),(0,a.jsx)("textarea",{className:"dlg-input dlg-textarea mono",rows:2,placeholder:"src/file.ts, src/other.ts",value:y.verifyTargetFiles,onChange:e=>L({verifyTargetFiles:e.target.value}),onBlur:e=>L({verifyTargetFiles:eQ(E,e.target.value)})})]}):"explain-plan"===d?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)("label",{className:"dlg-field",children:[(0,a.jsx)("span",{className:"dlg-label",children:"filePath"}),(0,a.jsx)("input",{className:"dlg-input mono",placeholder:"src/file.ts",value:y.explainFilePath,onChange:e=>L({explainFilePath:e.target.value}),onBlur:e=>L({explainFilePath:eZ(E,e.target.value)})})]}),(0,a.jsxs)("label",{className:"dlg-field",children:[(0,a.jsxs)("span",{className:"dlg-label",children:["Question ",(0,a.jsx)("span",{className:"dlg-opt",children:"optional"})]}),(0,a.jsx)("textarea",{className:"dlg-input dlg-textarea",rows:2,placeholder:"What should the plan focus on?",value:y.explainQuestion,onChange:e=>L({explainQuestion:e.target.value})})]})]}):"unit-test-generation"===d?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)("label",{className:"dlg-field",children:[(0,a.jsx)("span",{className:"dlg-label",children:"targetKind"}),(0,a.jsxs)("span",{className:"dlg-selwrap",children:[(0,a.jsxs)("select",{className:"dlg-input mono",value:y.unitTargetKind,onChange:e=>L({unitTargetKind:e.target.value}),children:[(0,a.jsx)("option",{value:"file",children:"file"}),(0,a.jsx)("option",{value:"module",children:"module"}),(0,a.jsx)("option",{value:"changedFiles",children:"changedFiles"})]}),(0,a.jsx)("span",{className:"dlg-selchev",children:(0,a.jsx)(S.chevron,{size:15})})]})]}),"module"===y.unitTargetKind?(0,a.jsxs)("label",{className:"dlg-field",children:[(0,a.jsx)("span",{className:"dlg-label",children:"moduleDir"}),(0,a.jsx)("input",{className:"dlg-input mono",placeholder:"src/module",value:y.unitModuleDir,onChange:e=>L({unitModuleDir:e.target.value}),onBlur:e=>L({unitModuleDir:eZ(E,e.target.value)})})]}):"changedFiles"===y.unitTargetKind?(0,a.jsxs)("label",{className:"dlg-field",children:[(0,a.jsx)("span",{className:"dlg-label",children:"filePaths"}),(0,a.jsx)("textarea",{className:"dlg-input dlg-textarea mono",rows:2,placeholder:"src/file.ts, src/other.ts",value:y.unitFilePaths,onChange:e=>L({unitFilePaths:e.target.value}),onBlur:e=>L({unitFilePaths:eQ(E,e.target.value)})})]}):(0,a.jsxs)("label",{className:"dlg-field",children:[(0,a.jsx)("span",{className:"dlg-label",children:"filePath"}),(0,a.jsx)("input",{className:"dlg-input mono",placeholder:"src/file.ts",value:y.unitFilePath,onChange:e=>L({unitFilePath:e.target.value}),onBlur:e=>L({unitFilePath:eZ(E,e.target.value)})})]})]}):(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)("label",{className:"dlg-field",children:[(0,a.jsxs)("span",{className:"dlg-label",children:["Description ",(0,a.jsx)("span",{className:"dlg-opt",children:"optional"})]}),(0,a.jsx)("textarea",{className:"dlg-input dlg-textarea",rows:2,placeholder:"Describe the observed bug.",value:y.bugDescription,onChange:e=>L({bugDescription:e.target.value})})]}),(0,a.jsxs)("label",{className:"dlg-field",children:[(0,a.jsxs)("span",{className:"dlg-label",children:["Failing output ",(0,a.jsx)("span",{className:"dlg-opt",children:"optional"})]}),(0,a.jsx)("textarea",{className:"dlg-input dlg-textarea mono",rows:2,value:y.bugFailingOutput,onChange:e=>L({bugFailingOutput:e.target.value})})]}),(0,a.jsxs)("label",{className:"dlg-field",children:[(0,a.jsxs)("span",{className:"dlg-label",children:["Stack trace ",(0,a.jsx)("span",{className:"dlg-opt",children:"optional"})]}),(0,a.jsx)("textarea",{className:"dlg-input dlg-textarea mono",rows:2,value:y.bugStackTrace,onChange:e=>L({bugStackTrace:e.target.value})})]}),(0,a.jsxs)("label",{className:"dlg-field",children:[(0,a.jsxs)("span",{className:"dlg-label",children:["Target files ",(0,a.jsx)("span",{className:"dlg-opt",children:"optional"})]}),(0,a.jsx)("textarea",{className:"dlg-input dlg-textarea mono",rows:2,placeholder:"src/file.ts, src/other.ts",value:y.bugTargetFiles,onChange:e=>L({bugTargetFiles:e.target.value}),onBlur:e=>L({bugTargetFiles:eQ(E,e.target.value)})})]})]}),(0,a.jsxs)("div",{className:"permctl agent-disabled-perm","aria-disabled":"true",children:[(0,a.jsxs)("div",{className:"perm-toggle","data-on":!0,children:[(0,a.jsx)("img",{className:"perm-orca",src:"/assets/keiko-logo.svg",alt:""}),(0,a.jsxs)("span",{className:"perm-tt",children:[(0,a.jsx)("span",{className:"perm-name",children:"Keiko-Mode"}),(0,a.jsx)("span",{className:"perm-desc",children:"coming soon"})]}),(0,a.jsx)("span",{className:"perm-sw on",children:(0,a.jsx)("span",{})})]}),(0,a.jsx)("div",{className:"perm-note",children:"Runs are dry-run only. Apply requires explicit review and Apply."})]}),(0,a.jsxs)("div",{className:"dlg-agent-actions",children:[(0,a.jsx)("button",{type:"button",className:"dlg-btn dlg-primary",disabled:!A,onClick:()=>void I(),children:M?"Starting...":"Start agent"}),b?(0,a.jsx)("span",{className:"dlg-note",children:"Loading models and projects..."}):null]})]})}function e0(e){var t,n;let{type:l,types:s,filesContext:r=null,onConfirm:o,onClose:c}=e,d=s[l],u=null!=(t=d.config)?t:[],[m,p]=(0,i.useState)(()=>(function(e){let t={};for(let l of e){var n;t[l.key]=null!=(n=l.def)?n:""}return t})(u)),[h,x]=(0,i.useState)(!1),[f,g]=(0,i.useState)(null),[v,j]=(0,i.useState)(null),y=(0,i.useRef)(null),w=(0,i.useRef)(null);(0,i.useEffect)(()=>(w.current=document.activeElement,()=>{var e,t;null==(t=w.current)||null==(e=t.focus)||e.call(t)}),[]),(0,i.useEffect)(()=>{let e=requestAnimationFrame(()=>{var e;x(!0),null==(e=y.current)||e.focus()});return()=>cancelAnimationFrame(e)},[]),(0,i.useEffect)(()=>{if("files"!==l)return;let e=!1,t=m.root;if("string"!=typeof t||!(t.length>0))return g(null),es().then(t=>{let n=eY(t.projects)[0];e||void 0===n||p(e=>({...e,root:n}))}).catch(t=>{e||g(eJ(t))}),()=>{e=!0}},[m.root,l]);let b=(e,t)=>p(n=>({...n,[e]:t})),N=()=>{"agents"!==l&&o(m)},k=S[d.icon],C=null!=(n=d.cta)?n:"Open ".concat(d.title);return(0,a.jsx)("div",{className:"dlg-overlay"+(h?" in":""),onPointerDown:c,children:(0,a.jsxs)("div",{className:"dlg",role:"dialog","aria-modal":"true","aria-label":"New ".concat(d.title," window"),onPointerDown:e=>e.stopPropagation(),onKeyDown:e=>{if("Escape"===e.key)return void c();if("Enter"===e.key&&(e.metaKey||e.ctrlKey))return void N();if("Tab"!==e.key)return;let t=function(e){let t=e.querySelectorAll("button,input,select,textarea"),n=[];return t.forEach(e=>{e.hasAttribute("disabled")||(null!==e.offsetParent||"BUTTON"===e.tagName)&&n.push(e)}),n}(e.currentTarget);if(0===t.length)return;let n=t[0],l=t[t.length-1];e.shiftKey&&document.activeElement===n?(e.preventDefault(),l.focus()):e.shiftKey||document.activeElement!==l||(e.preventDefault(),n.focus())},children:[(0,a.jsxs)("div",{className:"dlg-head",children:[(0,a.jsx)("span",{className:"dlg-ico",children:(0,a.jsx)(k,{size:20})}),(0,a.jsxs)("div",{className:"dlg-htext",children:[(0,a.jsxs)("span",{className:"dlg-title",children:["New ",d.title," window"]}),(0,a.jsx)("span",{className:"dlg-sub",children:d.desc})]}),(0,a.jsx)("span",{className:"spacer"}),(0,a.jsx)("button",{type:"button",className:"palette-x",onClick:c,"aria-label":"Cancel",title:"Cancel",children:(0,a.jsx)(S.close,{size:16})})]}),(0,a.jsxs)("div",{className:"dlg-body",children:["agents"===l?(0,a.jsx)(e$,{filesContext:r,firstRef:e=>{y.current=e},directoryField:v,setDirectoryField:j,setDialogError:g,onConfirm:o}):0===u.length&&(0,a.jsxs)("div",{className:"dlg-empty",children:["Add a new ",d.title," window to your workspace."]}),"agents"!==l&&u.map((e,t)=>(0,a.jsxs)("label",{className:"dlg-field",children:[(0,a.jsxs)("span",{className:"dlg-label",children:[e.label,!0===e.optional&&(0,a.jsx)("span",{className:"dlg-opt",children:"optional"})]}),function(e,t,n,l,s){var i,r,o,c;if("perm"===e.type)return(0,a.jsx)(eq,{cfg:t,set:n});let d=t[e.key],u="string"==typeof d?d:void 0===d?"":String(d);if("select"===e.type){let t=null!=(i=e.options)?i:[];return(0,a.jsxs)("span",{className:"dlg-selwrap",children:[(0,a.jsx)("select",{ref:null!=l?l:void 0,className:"dlg-input mono",value:u,onChange:t=>n(e.key,t.target.value),disabled:0===t.length,children:t.map(t=>{var n;return(0,a.jsx)("option",{value:t,children:(null!=(n=e.prefix)?n:"")+t},t)})}),(0,a.jsx)("span",{className:"dlg-selchev",children:(0,a.jsx)(S.chevron,{size:15})})]})}return"textarea"===e.type?(0,a.jsx)("textarea",{ref:null!=l?l:void 0,className:"dlg-input dlg-textarea",rows:3,placeholder:null!=(r=e.placeholder)?r:"",value:u,onChange:t=>n(e.key,t.target.value)}):"directory"===e.type?(0,a.jsxs)("span",{className:"dlg-dirwrap",children:[(0,a.jsx)("input",{ref:null!=l?l:void 0,className:"dlg-input mono",placeholder:null!=(o=e.placeholder)?o:e.label,value:u,onClick:()=>s(e.key),onChange:t=>n(e.key,t.target.value)}),(0,a.jsx)("button",{type:"button",className:"dlg-dirbtn",onClick:()=>s(e.key),children:"Browse"})]}):(0,a.jsx)("input",{ref:null!=l?l:void 0,className:"dlg-input mono",placeholder:null!=(c=e.placeholder)?c:e.label,value:u,onChange:t=>n(e.key,t.target.value)})}(e,m,b,0===t?e=>{y.current=e}:null,j),"directory"===e.type&&v===e.key?(0,a.jsx)(e_,{value:"string"==typeof m[e.key]?m[e.key]:"",selectProjectRoot:"root"===e.key,onSelect:t=>b(e.key,t),onClose:()=>j(null)}):null]},e.key)),null!==f?(0,a.jsx)("div",{className:"dlg-error",children:f}):null]}),(0,a.jsxs)("div",{className:"dlg-foot",children:[(0,a.jsx)("button",{type:"button",className:"dlg-btn",onClick:c,children:"Cancel"}),"agents"!==l?(0,a.jsx)("button",{type:"button",className:"dlg-btn dlg-primary",onClick:N,children:C}):null]})]})})}function e1(e){let{types:t,order:n,onAdd:l,onClose:s}=e,r=(0,i.useRef)(null);return(0,i.useEffect)(()=>{var e;let t=null==(e=r.current)?void 0:e.querySelector(".pal-card");null==t||t.focus()},[]),(0,a.jsxs)("div",{ref:r,className:"palette",role:"dialog","aria-modal":"true","aria-label":"New window picker",onPointerDown:e=>e.stopPropagation(),onKeyDown:e=>{"Escape"===e.key&&(e.preventDefault(),s())},children:[(0,a.jsxs)("div",{className:"palette-head",children:[(0,a.jsx)("span",{className:"palette-badge",children:(0,a.jsx)(S.add,{size:17})}),(0,a.jsxs)("div",{className:"palette-htext",children:[(0,a.jsx)("span",{className:"palette-title",children:"New Window"}),(0,a.jsx)("span",{className:"palette-sub",children:"Pick a card to add to your workspace"})]}),(0,a.jsx)("span",{className:"spacer"}),(0,a.jsx)("button",{type:"button",className:"palette-x",onClick:s,"aria-label":"Close window picker",title:"Close",children:(0,a.jsx)(S.close,{size:16})})]}),(0,a.jsx)("div",{className:"palette-grid",children:n.map(e=>{let n=t[e],s=S[n.icon];return(0,a.jsxs)("button",{type:"button",className:"pal-card pal-main",onClick:()=>l(e),children:[(0,a.jsx)("span",{className:"pal-ico",children:(0,a.jsx)(s,{size:18})}),(0,a.jsx)("span",{className:"pal-name",children:n.title}),(0,a.jsx)("span",{className:"pal-desc",children:n.desc}),(0,a.jsx)("span",{className:"pal-add",children:(0,a.jsx)(S.plus,{size:15})})]},e)})})]})}let e2="keiko.theme",e5="dark";function e3(e,t,n,l,s){return{x:e.x+Math.max(16,Math.min(s+26*l,e.w-t-16)),y:e.y+Math.max(16,Math.min(s+26*l,e.h-n-16))}}function e4(e){let{prev:t,...n}=e;return n}function e6(e,t,n){return e.some(e=>e.a===t&&e.b===n||e.a===n&&e.b===t)}let e8="keiko.workspace.v4",e7="keiko.conns.v1",e9="keiko.view";function te(){try{let e=window.localStorage.getItem(e9);if(null===e)return{zoom:1,x:0,y:0};let t=JSON.parse(e);if("object"==typeof t&&null!==t&&"zoom"in t&&"number"==typeof t.zoom)return{zoom:t.zoom,x:"number"==typeof t.x?t.x:0,y:"number"==typeof t.y?t.y:0}}catch(e){}return{zoom:1,x:0,y:0}}function tt(e){return Math.max(.3,Math.min(2.5,e))}function tn(e){return Math.max(.5,Math.min(2,Math.round(10*e)/10))}function tl(e){let t=e[0];for(let n=1;n<e.length;n++){let l=e[n];l.z>t.z&&(t=l)}return t}function ts(e,t){try{window.localStorage.setItem(e,JSON.stringify(t))}catch(e){}}let ta=[{name:"Keiko",open:!0,chats:[{id:"c1",title:"Workspace bootstrap",time:"2h"},{id:"c2",title:"Resizable card system",time:"5h"}]},{name:"c2c-PreBeta",open:!1,chats:[]},{name:"example-workspace",open:!0,chats:[{id:"c3",title:"Start work mode",running:!0},{id:"c4",title:"Create agent team for #29",time:"8h"},{id:"c5",title:"Begin work",pinned:!0}]}];function ti(e){let{project:t,activeChat:n,onChat:l}=e,[s,r]=(0,i.useState)(t.open);return(0,a.jsxs)("div",{className:"proj",children:[(0,a.jsxs)("button",{className:"proj-head",onClick:()=>{r(e=>!e)},children:[(0,a.jsx)("span",{className:"proj-caret","data-open":s,children:(0,a.jsx)(S.chevronR,{size:13})}),(0,a.jsx)(S.folder,{size:15}),(0,a.jsx)("span",{className:"proj-name",children:t.name})]}),s&&(0,a.jsx)("div",{className:"proj-chats",children:0===t.chats.length?(0,a.jsx)("div",{className:"proj-empty",children:"No chats"}):t.chats.map(e=>(0,a.jsxs)("button",{className:"chat-row","data-active":n===e.id,onClick:()=>{l(e.id)},children:[!0===e.running&&(0,a.jsx)("span",{className:"chat-spin",children:(0,a.jsx)(S.reset,{size:12})}),(0,a.jsx)("span",{className:"chat-title",children:e.title}),!0===e.pinned&&(0,a.jsx)("span",{className:"chat-meta",children:(0,a.jsx)(S.pin,{size:12})}),void 0!==e.time&&(0,a.jsx)("span",{className:"chat-time",children:e.time})]},e.id))})]})}function tr(){var e;let t=null!=(e=localStorage.getItem("keiko.project.activeChat"))?e:"c3",[n,l]=(0,i.useState)(t),s=e=>{l(e),localStorage.setItem("keiko.project.activeChat",e)};return(0,a.jsxs)("div",{className:"tw-scroll",children:[(0,a.jsxs)("div",{className:"sb-section",children:[(0,a.jsx)("span",{className:"sb-section-label",children:"Projects"}),(0,a.jsx)("button",{className:"sb-section-add","aria-label":"Add project",children:(0,a.jsx)(S.plus,{size:14})})]}),ta.map(e=>(0,a.jsx)(ti,{project:e,activeChat:n,onChat:s},e.name)),(0,a.jsx)("div",{className:"sb-section",style:{marginTop:14},children:(0,a.jsx)("span",{className:"sb-section-label",children:"Chats"})}),(0,a.jsx)("div",{className:"proj-empty",style:{paddingLeft:12},children:"No chats"})]})}function to(e){let{name:t,icon:n}=e,l=null!=n?n:function(e){let t=e.toLowerCase();return"dockerfile"===t||t.includes("docker-compose")||t.endsWith(".dockerignore")?"docker":t.endsWith(".json")?"json":t.endsWith(".yml")||t.endsWith(".yaml")?"yaml":t.endsWith(".md")?"markdown":t.endsWith(".properties")||t.endsWith(".env")||t.startsWith(".env.")?"properties":t.endsWith(".java")?"java":t.endsWith(".tsx")?"react":t.endsWith(".ts")?"typescript":t.endsWith(".jsx")||t.endsWith(".js")||t.endsWith(".mjs")||t.endsWith(".cjs")?"javascript":t.endsWith(".py")?"python":t.endsWith(".go")?"go":t.endsWith(".rs")?"rust":t.endsWith(".gradle")?"gradle":t.endsWith(".sql")?"postgresql":t.endsWith(".html")?"html5":t.endsWith(".css")?"css3":t.endsWith(".graphql")||t.endsWith(".gql")?"graphql":t.endsWith(".png")||t.endsWith(".jpg")||t.endsWith(".jpeg")||t.endsWith(".gif")||t.endsWith(".webp")||t.endsWith(".svg")?"image":null}(t);return null!==l?(0,a.jsx)("img",{className:"fi-img",src:"/assets/icons/".concat(l,".svg"),width:"15",height:"15",alt:""}):(0,a.jsx)("span",{className:"fi-fallback",children:(0,a.jsx)(S.file,{size:14})})}let tc=[{name:"backend",type:"folder",icon:"spring",children:[{name:"src/main/java/com/keiko/orca",type:"folder",children:[{name:"OrcaApplication.java",type:"file"},{name:"api",type:"folder",open:!1,children:[{name:"AgentController.java",type:"file"},{name:"WorkspaceController.java",type:"file"}]},{name:"service",type:"folder",open:!1,children:[{name:"InferenceService.java",type:"file"},{name:"AgentOrchestrator.java",type:"file"}]},{name:"config",type:"folder",open:!1,children:[{name:"SecurityConfig.java",type:"file"}]}]},{name:"src/main/resources",type:"folder",open:!1,children:[{name:"application.yml",type:"file"},{name:"schema.sql",type:"file"}]},{name:"build.gradle",type:"file"},{name:"Dockerfile",type:"file"}]},{name:"frontend",type:"folder",icon:"react",children:[{name:"src",type:"folder",children:[{name:"App.tsx",type:"file"},{name:"components",type:"folder",open:!1,children:[{name:"Workspace.tsx",type:"file"},{name:"WindowManager.tsx",type:"file"}]},{name:"api",type:"folder",open:!1,children:[{name:"client.ts",type:"file"},{name:"schema.graphql",type:"file"}]},{name:"styles",type:"folder",open:!1,children:[{name:"theme.css",type:"file"}]}]},{name:"package.json",type:"file",mut:"M"},{name:"tsconfig.json",type:"file"},{name:"Dockerfile",type:"file"}]},{name:"deploy",type:"folder",icon:"kubernetes",children:[{name:"k8s",type:"folder",children:[{name:"deployment.yaml",type:"file",icon:"kubernetes"},{name:"service.yaml",type:"file",icon:"kubernetes"},{name:"ingress.yaml",type:"file",icon:"kubernetes"}]},{name:"docker-compose.yml",type:"file"},{name:"prometheus.yml",type:"file",icon:"prometheus"}]},{name:".github/workflows",type:"folder",icon:"github",open:!1,children:[{name:"ci.yml",type:"file"},{name:"release.yml",type:"file"}]},{name:"README.md",type:"file"}];function td(e){let{node:t,depth:n,path:l,active:s,onPick:r}=e,[o,c]=(0,i.useState)(!1!==t.open),d=8+13*n,u="".concat(l,"/").concat(t.name);if("folder"===t.type){var m;return(0,a.jsxs)("div",{children:[(0,a.jsxs)("button",{className:"tr-row",style:{paddingLeft:d},onClick:()=>{c(e=>!e)},children:[(0,a.jsx)("span",{className:"tr-caret","data-open":o,children:(0,a.jsx)(S.chevronR,{size:11})}),void 0!==t.icon?(0,a.jsx)("img",{className:"fi-img",src:"/assets/icons/".concat(t.icon,".svg"),width:"15",height:"15",alt:""}):(0,a.jsx)("span",{className:"fi-fallback",style:{color:"var(--accent)"},children:(0,a.jsx)(S.folder,{size:14})}),(0,a.jsx)("span",{className:"tr-name tr-folder",children:t.name})]}),o&&(null==(m=t.children)?void 0:m.map((e,t)=>(0,a.jsx)(td,{node:e,depth:n+1,path:u,active:s,onPick:r},"".concat(u,"/").concat(e.name,"-").concat(String(t)))))]})}return(0,a.jsxs)("button",{className:"tr-row tr-file","data-active":s===u,style:{paddingLeft:d+14},onClick:()=>{r(u)},children:[(0,a.jsx)(to,{name:t.name,icon:t.icon}),(0,a.jsx)("span",{className:"tr-name",children:t.name}),void 0!==t.mut&&(0,a.jsx)("span",{className:"file-mut",children:t.mut})]})}function tu(){let[e,t]=(0,i.useState)("/frontend/src/App.tsx");return(0,a.jsxs)("div",{className:"srch",children:[(0,a.jsxs)("div",{className:"srch-box",children:[(0,a.jsx)(S.search,{size:15}),(0,a.jsx)("input",{placeholder:"Search files & symbols…"}),(0,a.jsx)("span",{className:"kbd",children:"⇧⇧"})]}),(0,a.jsxs)("div",{className:"tw-label srch-label",children:["example-workspace"," ",(0,a.jsx)("span",{className:"srch-meta mono",children:"spring-boot \xb7 typescript"})]}),(0,a.jsx)("div",{className:"tr",children:tc.map((n,l)=>(0,a.jsx)(td,{node:n,depth:0,path:"",active:e,onPick:t},"".concat(n.name,"-").concat(String(l))))})]})}let tm=[{name:"Context7",img:"upstash",desc:"Up-to-date library docs",on:!0},{name:"Sequential Thinking",icon:"layers",desc:"Step-by-step reasoning",on:!0},{name:"Filesystem",icon:"files",desc:"Local file access",on:!0},{name:"GitHub",img:"github",desc:"Repos \xb7 PRs \xb7 issues",on:!0},{name:"Playwright",img:"playwright",desc:"Browser automation",on:!1},{name:"Brave Search",img:"brave",desc:"Web search",on:!1},{name:"Memory",icon:"cube",desc:"Knowledge graph",on:!0}],tp=[{name:"GitHub",img:"github",on:!0},{name:"Linear",img:"linear",on:!0},{name:"PostgreSQL",img:"postgresql",on:!0},{name:"Sentry",img:"sentry",on:!1},{name:"Slack",img:"slack",on:!1},{name:"Notion",img:"notion",on:!1}];function th(e){let{img:t,icon:n,glyph:l}=e;if(void 0!==t)return(0,a.jsx)("img",{className:"pl-img",src:"/assets/icons/".concat(t,".svg"),width:"20",height:"20",alt:""});if(void 0!==n){let e=S[n];return(0,a.jsx)("span",{className:"pl-line",children:(0,a.jsx)(e,{size:18})})}return(0,a.jsx)("span",{className:"mono pl-glyph",children:l})}function tx(){let[e,t]=(0,i.useState)(tm.map(e=>e.on)),n=e.filter(Boolean).length;return(0,a.jsxs)("div",{className:"plg",children:[(0,a.jsxs)("div",{className:"plg-sec",children:[(0,a.jsx)("span",{className:"plg-sec-t",children:"MCP Servers"}),(0,a.jsxs)("span",{className:"plg-sec-c mono",children:[n,"/",tm.length," active"]})]}),tm.map((n,l)=>{var s;let i=null!=(s=e[l])&&s;return(0,a.jsxs)("div",{className:"plg-row",children:[(0,a.jsx)("span",{className:"plg-ico",children:(0,a.jsx)(th,{img:n.img,icon:n.icon})}),(0,a.jsxs)("span",{className:"plg-text",children:[(0,a.jsx)("span",{className:"plg-name",children:n.name}),(0,a.jsx)("span",{className:"plg-desc",children:n.desc})]}),(0,a.jsx)("button",{className:"plg-dot".concat(i?" on":""),title:i?"Running":"Stopped","aria-label":"".concat(n.name,": ").concat(i?"running":"stopped"),onClick:()=>{t(e=>{var t;let n=[...e];return n[l]=!(null!=(t=n[l])&&t),n})}})]},n.name)}),(0,a.jsx)("div",{className:"plg-sec plg-sec2",children:(0,a.jsx)("span",{className:"plg-sec-t",children:"Connectors"})}),tp.map(e=>(0,a.jsxs)("button",{className:"plg-row plg-conn","data-on":e.on,children:[(0,a.jsx)("span",{className:"plg-ico",children:(0,a.jsx)(th,{img:e.img})}),(0,a.jsxs)("span",{className:"plg-text",children:[(0,a.jsx)("span",{className:"plg-name",children:e.name}),(0,a.jsx)("span",{className:"plg-desc",children:e.on?"Connected":"Not connected"})]}),e.on?(0,a.jsx)("span",{className:"integ-on",children:(0,a.jsx)(S.check,{size:13})}):(0,a.jsx)("span",{className:"integ-add",children:(0,a.jsx)(S.plus,{size:14})})]},e.name))]})}function tf(e){let{on:t,onChange:n,label:l}=e;return(0,a.jsx)("button",{role:"switch","aria-checked":t,"aria-label":l,className:"auto-toggle".concat(t?" on":""),onClick:()=>{n(!t)},children:(0,a.jsx)("span",{})})}let tg=[{id:"nightly-review",name:"Nightly review",when:"02:00 daily",defaultOn:!0},{id:"on-push-lint",name:"On push → lint",when:"git push",defaultOn:!0},{id:"weekly-digest",name:"Weekly digest",when:"Mon 09:00",defaultOn:!1}],tv="keiko.automations.v1",tj=Object.fromEntries(tg.map(e=>[e.id,e.defaultOn]));function ty(){try{let e=localStorage.getItem(tv);if(null===e)return{...tj};let t=JSON.parse(e);if("object"!=typeof t||null===t||Array.isArray(t))return{...tj};let n={...tj};for(let[e,l]of Object.entries(t))e in tj&&"boolean"==typeof l&&(n[e]=l);return n}catch(e){return{...tj}}}function tw(){let[e,t]=(0,i.useState)(ty);return(0,a.jsx)("div",{className:"tw-list",children:tg.map(n=>{var l;let s=null!=(l=e[n.id])?l:n.defaultOn;return(0,a.jsxs)("div",{className:"auto-row",children:[(0,a.jsx)("span",{className:"dot",style:{background:s?"var(--accent)":"var(--fg-faint)"}}),(0,a.jsxs)("span",{className:"auto-text",children:[(0,a.jsx)("span",{className:"auto-name",children:n.name}),(0,a.jsx)("span",{className:"auto-when mono",children:n.when})]}),(0,a.jsx)(tf,{on:s,onChange:()=>{var e;e=n.id,t(t=>{var n;let l={...t,[e]:!(null!=(n=t[e])&&n)};return localStorage.setItem(tv,JSON.stringify(l)),l})},label:n.name})]},n.id)})})}function tb(){return(0,a.jsxs)("div",{className:"tw-pad mob",children:[(0,a.jsxs)("div",{className:"mob-qr",children:[(0,a.jsx)("div",{className:"ph-stripes"}),(0,a.jsx)(S.mobile,{size:28,style:{position:"relative",color:"var(--fg-dim)"}})]}),(0,a.jsx)("div",{className:"mob-title",children:"Keiko mobile"}),(0,a.jsx)("div",{className:"mob-sub",children:"Scan to continue this workspace on your phone."})]})}function tN(){let{wins:e,active:t,winCount:n}=(0,i.useContext)(N),l=null!==t?eL[t.type]:null,s=null!==t?Object.entries(t.cfg).filter(e=>{let[,t]=e;return""!==t&&null!=t}):[];return(0,a.jsxs)("div",{className:"tw-pad",children:[(0,a.jsx)("div",{className:"rb-section-label",style:{marginTop:0},children:"Active window"}),null!==t&&null!==l?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)("div",{className:"insp-top",children:[(0,a.jsx)("span",{className:"insp-ico",style:{color:!0===l.accent?"var(--accent)":"var(--fg-muted)"},children:function(e,t){let n=S[e];return(0,a.jsx)(n,{size:16})}(l.icon,16)}),(0,a.jsx)("span",{className:"insp-title",children:l.title})]}),(0,a.jsxs)("div",{className:"rb-rows",children:[(0,a.jsxs)("div",{className:"rb-row",children:[(0,a.jsx)("span",{className:"rb-row-k",children:"Size"}),(0,a.jsxs)("span",{className:"rb-row-v mono",children:[Math.round(t.w)," \xd7 ",Math.round(t.h)]})]}),(0,a.jsxs)("div",{className:"rb-row",children:[(0,a.jsx)("span",{className:"rb-row-k",children:"Position"}),(0,a.jsxs)("span",{className:"rb-row-v mono",children:[Math.round(t.x),", ",Math.round(t.y)]})]}),(0,a.jsxs)("div",{className:"rb-row",children:[(0,a.jsx)("span",{className:"rb-row-k",children:"State"}),(0,a.jsx)("span",{className:"rb-row-v mono",children:t.max?"maximized":"floating"})]})]}),s.length>0&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("div",{className:"rb-section-label",children:"Configuration"}),(0,a.jsx)("div",{className:"rb-rows",children:s.map(e=>{let[t,n]=e;return(0,a.jsxs)("div",{className:"rb-row",children:[(0,a.jsx)("span",{className:"rb-row-k",children:t}),(0,a.jsx)("span",{className:"rb-row-v mono",children:String(n).slice(0,20)||"—"})]},t)})})]})]}):(0,a.jsx)("div",{className:"insp-empty",children:"No window focused"}),(0,a.jsx)("div",{className:"rb-section-label",children:"Workspace"}),(0,a.jsx)("div",{className:"rb-rows",children:(0,a.jsxs)("div",{className:"rb-row",children:[(0,a.jsx)("span",{className:"rb-row-k",children:"Open windows"}),(0,a.jsx)("span",{className:"rb-row-v mono",children:n})]})})]})}let tk=[{t:"Agent finished build-board",time:"2m",c:"var(--accent)"},{t:"diff-review ready to merge",time:"9m",c:"var(--info)"},{t:"lint-pass queued",time:"14m",c:"var(--fg-faint)"}];function tS(){return(0,a.jsx)("div",{className:"tw-list",children:tk.map((e,t)=>(0,a.jsxs)("div",{className:"nt-row",children:[(0,a.jsx)("span",{className:"dot",style:{background:e.c,marginTop:6}}),(0,a.jsxs)("span",{className:"nt-text",children:[(0,a.jsx)("span",{className:"nt-title",children:e.t}),(0,a.jsxs)("span",{className:"nt-time mono",children:[e.time," ago"]})]})]},t))})}function tC(){return(0,a.jsxs)("div",{className:"tw-pad",children:[(0,a.jsxs)("div",{className:"rb-placeholder",style:{height:150},children:[(0,a.jsx)("div",{className:"ph-stripes"}),(0,a.jsx)("span",{className:"rb-ph-label mono",children:"resources"})]}),(0,a.jsx)("div",{className:"rb-foot mono",style:{marginTop:14},children:"grows with the product"})]})}let tM="keiko-activity",tz={step:"var(--fg-dim)",approval:"var(--warn)",approved:"var(--accent)",rejected:"var(--danger)",stopped:"var(--danger)",open:"var(--info)","twin-approved":"var(--accent)","twin-denied":"var(--danger)"};function tE(){let e=function(){var e;let[,t]=(0,i.useState)(0);return(0,i.useEffect)(()=>{let e=()=>{t(e=>e+1)};return window.addEventListener(tM,e),()=>{window.removeEventListener(tM,e)}},[]),null!=(e=window.__keikoActivity)?e:[]}();return(0,a.jsxs)("div",{className:"tl",children:[0===e.length&&(0,a.jsxs)("div",{className:"tl-empty",children:["No activity yet.",(0,a.jsx)("br",{}),"Start an agent to see its actions stream here."]}),e.map((e,t)=>{var n,l;return(0,a.jsxs)("div",{className:"tl-row",children:[(0,a.jsx)("span",{className:"tl-dot",style:{background:null!=(n=tz[e.type])?n:"var(--fg-faint)"}}),(0,a.jsxs)("div",{className:"tl-body",children:[(0,a.jsx)("span",{className:"tl-text",children:e.text}),(0,a.jsxs)("span",{className:"tl-meta mono",children:[null!=(l=e.agent)?l:"workspace"," \xb7 ",new Date(e.time).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",second:"2-digit"})]})]})]},t)})]})}let tP={jsx:"js",js:"js",mjs:"js",ts:"ts",tsx:"ts",java:"java",kt:"kotlin",kts:"kotlin",py:"py",rb:"py",go:"go",rs:"rust",json:"json",yml:"yaml",yaml:"yaml",md:"md",markdown:"md",html:"html",xml:"html",css:"css",sql:"sql",sh:"sh",bash:"sh",cob:"cobol",cbl:"cobol",gradle:"js",graphql:"graphql",gql:"graphql",properties:"props",toml:"props",env:"props",dockerfile:"docker"};function tR(e){var t;let n=e.toLowerCase();if(".env"===n||n.startsWith(".env."))return"props";if("dockerfile"===n||n.startsWith("dockerfile"))return"docker";if(n.includes("docker-compose"))return"yaml";let l=n.split("."),s=l.length>1?l[l.length-1]:void 0;return void 0===s?"code":null!=(t=tP[s])?t:"code"}let tT=new Set("const let var function return if else for while do switch case break continue import from export default class extends implements interface enum new async await yield of in typeof instanceof this super public private protected static final readonly void int long double float boolean char byte short val fun object data override companion package def pass lambda try catch except finally throw throws raise with as not and or is null nil None True False true false undefined struct impl trait pub use mod match where select insert update delete create table from join on group by order limit FROM RUN CMD ENV COPY WORKDIR EXPOSE ENTRYPOINT AS".split(" "));function tA(e){let t=[];return e.split(/(`[^`]+`|\*\*[^*]+\*\*)/).forEach(e=>{""!==e&&(e.startsWith("`")?t.push(["str",e]):e.startsWith("**")?t.push(["type",e]):t.push(["id",e]))}),t.length>0?t:[["id",e]]}function tL(e,t){if("md"===t)return e.split("\n").map(e=>{if(/^#{1,6}\s/.test(e))return[["head",e]];if(/^\s*```/.test(e))return[["com",e]];let t=/^(\s*)([-*+]|\d+\.)(\s)/.exec(e);if(null!==t){var n,l,s;let a=null!=(n=t[1])?n:"";return[["ws",a],["key",null!=(l=t[2])?l:""],["ws",null!=(s=t[3])?s:""],...tA(e.slice(t[0].length))]}return tA(e)});if("json"===t)return e.split("\n").map(e=>{let t=[],n=0;for(;n<e.length;){let l=e.slice(n),s=/^"(?:[^"\\]|\\.)*"/.exec(l);if(null!==s){let l=e.slice(n+s[0].length),a=/^\s*:/.test(l);t.push([a?"key2":"str",s[0]]),n+=s[0].length;continue}let a=/^-?\d[\d.eE+\-]*/.exec(l);if(null!==a){t.push(["num",a[0]]),n+=a[0].length;continue}let i=/^(true|false|null)\b/.exec(l);if(null!==i){t.push(["lit",i[0]]),n+=i[0].length;continue}let r=/^\s+/.exec(l);if(null!==r){t.push(["ws",r[0]]),n+=r[0].length;continue}t.push(["punct",l.charAt(0)]),n+=1}return t});let n="py"===t||"sh"===t||"yaml"===t||"props"===t||"docker"===t?{line:"#",block:null}:"sql"===t?{line:"--",block:["/*","*/"]}:"cobol"===t?{line:"*>",block:null}:"html"===t?{line:null,block:["\x3c!--","--\x3e"]}:{line:"//",block:["/*","*/"]},l={inBlock:!1},s=[];for(let t of e.split("\n"))s.push(function(e,t,n){let l=[],s=0;if(t.inBlock&&null!==n.block){let a=e.indexOf(n.block[1]);if(-1===a)return l.push(["com",e]),l;l.push(["com",e.slice(0,a+n.block[1].length)]),s=a+n.block[1].length,t.inBlock=!1}for(;s<e.length;){let i=e.slice(s);if(null!==n.line&&i.startsWith(n.line)){l.push(["com",i]);break}if(null!==n.block&&i.startsWith(n.block[0])){let a=e.indexOf(n.block[1],s+n.block[0].length);if(-1===a){l.push(["com",i]),t.inBlock=!0;break}l.push(["com",e.slice(s,a+n.block[1].length)]),s=a+n.block[1].length;continue}let r=/^(?:"(?:[^"\\]|\\.)*"?|'(?:[^'\\]|\\.)*'?)/.exec(i);if(null!==r&&r[0].length>1){l.push(["str",r[0]]),s+=r[0].length;continue}if(/^\d/.test(i)){var a;let e=/^\d[\w.]*/.exec(i),t=null!=(a=null==e?void 0:e[0])?a:i.charAt(0);l.push(["num",t]),s+=t.length;continue}let o=/^[@A-Za-z_$][\w$]*/.exec(i);if(null!==o){let t=o[0],n="id";tT.has(t)?n="key":t.startsWith("@")||/^[A-Z]/.test(t)?n="type":"("===e.charAt(s+t.length)&&(n="fn"),l.push([n,t]),s+=t.length;continue}let c=/^\s+/.exec(i);if(null!==c){l.push(["ws",c[0]]),s+=c[0].length;continue}let d=/^[^\w\s$@]+/.exec(i);if(null!==d){l.push(["punct",d[0]]),s+=d[0].length;continue}l.push(["id",i.charAt(0)]),s+=1}return l}(t,l,n));return s}function tD(e){if(!Number.isFinite(e)||e<=0)return"0 B";let t=["B","KB","MB","GB"],n=e,l=0;for(;n>=1024&&l<t.length-1;)n/=1024,l+=1;let s=0===l?n.toFixed(0):n.toFixed(n>=10?1:2);return"".concat(s," ").concat(t[l])}function tF(e){return new Intl.DateTimeFormat(void 0,{dateStyle:"medium",timeStyle:"short"}).format(new Date(e))}function tI(e){let{label:t,value:n}=e;return(0,a.jsxs)("div",{className:"fpv-meta-row",children:[(0,a.jsx)("span",{children:t}),(0,a.jsx)("strong",{children:n})]})}function tO(e){var t,n,l,s;let{root:r,path:o,onClose:c}=e,[d,u]=(0,i.useState)(null),[m,p]=(0,i.useState)(!0),[h,x]=(0,i.useState)(null);(0,i.useEffect)(()=>{let e=!1;return p(!0),x(null),u(null),em(r,o).then(t=>{e||u(t)}).catch(t=>{e||x(t instanceof H&&"DENIED"===t.code?{message:"This file is excluded from the read surface for safety (matches a deny pattern such as .env, *.pem, node_modules, .git, …).",denied:!0}:t instanceof Error?{message:t.message,denied:!1}:{message:"Unable to read this file.",denied:!1})}).finally(()=>{e||p(!1)}),()=>{e=!0}},[o,r]);let f=(null==h?void 0:h.denied)===!0,g=null!==d?"text"===d.kind?tR(d.name):"image"===d.kind?d.mime:null!=(s=d.extension)?s:"binary":f?"denied":null!==h?"error":"loading",v=f?"Hidden file":null!=(t=null==d?void 0:d.name)?t:null!==h?"Preview unavailable":"Loading preview",j=(null==d?void 0:d.kind)==="text"&&d.content.length<=2e5,y=(null==d?void 0:d.kind)==="text"?j?tL(d.content,tR(d.name)):d.content.split("\n").map(e=>[["id",e]]):[];return(0,a.jsxs)("div",{className:"fpv",children:[(0,a.jsxs)("div",{className:"fpv-bar",children:[(0,a.jsx)("button",{className:"fpv-back",type:"button",onClick:c,title:"Back to files","aria-label":"Back to files",children:(0,a.jsx)(S.back,{size:15})}),(0,a.jsx)(to,{name:f||null===d?"":d.name}),(0,a.jsx)("span",{className:"fpv-name",title:v,children:v}),(0,a.jsx)("span",{className:"fpv-lang mono",children:g}),(0,a.jsx)("span",{className:"spacer"}),(0,a.jsx)("button",{className:"fpv-back",type:"button",onClick:c,title:"Close preview","aria-label":"Close preview",children:(0,a.jsx)(S.close,{size:15})})]}),m?(0,a.jsx)("div",{className:"fpv-state",children:"Loading preview..."}):null,null!==h?(0,a.jsx)("div",{className:"fpv-state fpv-error",role:"alert",children:h.message}):null,(null==d?void 0:d.kind)==="text"?(0,a.jsxs)(a.Fragment,{children:[d.truncated?(0,a.jsxs)("div",{className:"fpv-banner",children:["Preview truncated at ",tD(d.maxBytes),". Open the file in the editor for full content."]}):null,j?null:(0,a.jsx)("div",{className:"fpv-banner",children:"Syntax highlighting disabled for large previews."}),(0,a.jsx)("div",{className:"fpv-code mono",children:y.map((e,t)=>(0,a.jsxs)("div",{className:"fpv-line",children:[(0,a.jsx)("span",{className:"fpv-num",children:t+1}),(0,a.jsx)("span",{className:"fpv-src",children:e.map((e,t)=>(0,a.jsx)("span",{className:"hl-".concat(e[0]),children:e[1]},t))})]},t))})]}):null,(null==d?void 0:d.kind)==="image"?(0,a.jsxs)("div",{className:"fpv-image-pane",children:[(0,a.jsx)("div",{className:"fpv-image-card",children:(0,a.jsx)("img",{className:"fpv-image",src:d.dataUrl,alt:d.name})}),(0,a.jsxs)("div",{className:"fpv-meta",children:[(0,a.jsx)(tI,{label:"Type",value:d.mime}),(0,a.jsx)(tI,{label:"Size",value:tD(d.sizeBytes)}),(0,a.jsx)(tI,{label:"Modified",value:tF(d.modifiedAt)})]})]}):null,(null==d?void 0:d.kind)==="binary"?(0,a.jsx)("div",{className:"fpv-meta-pane",children:(0,a.jsxs)("div",{className:"fpv-meta-card",children:[(0,a.jsx)(to,{name:d.name}),(0,a.jsx)("h3",{children:d.name}),(0,a.jsx)("p",{children:"too_large"===d.reason?"Preview disabled because this file exceeds ".concat(tD(null!=(n=d.maxBytes)?n:0),"."):"No safe text or image preview is available for this file type."}),(0,a.jsxs)("div",{className:"fpv-meta",children:[(0,a.jsx)(tI,{label:"Type",value:d.mime}),(0,a.jsx)(tI,{label:"Extension",value:null!=(l=d.extension)?l:"none"}),(0,a.jsx)(tI,{label:"Size",value:tD(d.sizeBytes)}),(0,a.jsx)(tI,{label:"Modified",value:tF(d.modifiedAt)})]})]})}):null]})}function tW(e){var t;let{root:n,onActiveFileChange:l}=e,s=null==n?void 0:n.trim(),r=void 0!==s&&s.length>0?s:null,[o,c]=(0,i.useState)(null),d=null!=(t=null!=r?r:o)?t:"",[u,m]=(0,i.useState)(null),[p,h]=(0,i.useState)(null),[x,f]=(0,i.useState)({}),[g,v]=(0,i.useState)(()=>new Set([""])),[j,y]=(0,i.useState)(0),w=(0,i.useRef)(l);w.current=l,(0,i.useEffect)(()=>{if(null!==r)return;let e=!1;return es().then(t=>{var n;if(e)return;let l=null==(n=t.projects.find(e=>e.available))?void 0:n.path;c(null!=l?l:null)}).catch(()=>{e||c(null)}),()=>{e=!0}},[r]);let b=(0,i.useCallback)(async e=>{if(0===d.length)return void f(t=>({...t,[e]:{entries:[],truncated:!1,loading:!1,error:"No registered project is available."}}));f(t=>{var n,l,s,a;return{...t,[e]:{entries:null!=(s=null==(n=t[e])?void 0:n.entries)?s:[],truncated:null!=(a=null==(l=t[e])?void 0:l.truncated)&&a,loading:!0,error:null}}});try{let n=await eu(d,e);if(""===e){var t;m(n.root),null==(t=w.current)||t.call(w,null,n.root)}f(t=>({...t,[e]:{entries:n.entries,truncated:n.truncated,loading:!1,error:null}}))}catch(t){f(n=>{var l,s,a,i;return{...n,[e]:{entries:null!=(a=null==(l=n[e])?void 0:l.entries)?a:[],truncated:null!=(i=null==(s=n[e])?void 0:s.truncated)&&i,loading:!1,error:t instanceof Error?t.message:"Unable to read this folder."}}})}},[d]);(0,i.useEffect)(()=>{var e;h(null),null==(e=w.current)||e.call(w,null,null),m(null),v(new Set([""])),f({}),b("")},[d,b,j]);let N=function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:x[e];return(0,a.jsxs)("div",{className:"tr-dir",children:[(null==n?void 0:n.loading)===!0?(0,a.jsx)("div",{className:"files-note",style:{paddingLeft:22+13*t},children:"Loading..."}):null,(null==n?void 0:n.error)!==null&&(null==n?void 0:n.error)!==void 0?(0,a.jsxs)("div",{className:"files-error",style:{marginLeft:8+13*t},children:[(0,a.jsx)("span",{children:n.error}),(0,a.jsx)("button",{type:"button",onClick:()=>{b(e)},children:"Retry"})]}):null,null==n?void 0:n.entries.map(e=>((e,t)=>{let n=8+13*t,l=g.has(e.path);if("directory"===e.kind){let s=x[e.path];return(0,a.jsxs)("div",{children:[(0,a.jsxs)("button",{className:"tr-row","data-readable":e.readable,style:{paddingLeft:n},type:"button",disabled:!e.readable,"aria-expanded":l,onClick:()=>(e=>{if(!e.readable)return;let t=g.has(e.path);v(t=>{let n=new Set(t);return n.has(e.path)?n.delete(e.path):n.add(e.path),n}),t||void 0!==x[e.path]||b(e.path)})(e),title:e.readable?e.path:"Symlink target is outside the selected root",children:[(0,a.jsx)("span",{className:"tr-caret","data-open":l,children:(0,a.jsx)(S.chevronR,{size:11})}),(0,a.jsx)("span",{className:"fi-fallback",style:{color:"var(--accent)"},children:(0,a.jsx)(S.folder,{size:14})}),(0,a.jsx)("span",{className:"tr-name tr-folder",children:e.name}),e.symlink?(0,a.jsx)("span",{className:"tr-badge",children:"link"}):null]}),l?N(e.path,t+1,s):null]},e.path)}return(0,a.jsxs)("button",{className:"tr-row tr-file","data-active":p===e.path,"data-readable":e.readable,style:{paddingLeft:n+14},type:"button",disabled:!e.readable,onClick:()=>{var t;h(e.path),null==(t=w.current)||t.call(w,e.path,null!=u?u:d)},title:e.readable?e.path:"Symlink target is outside the selected root",children:[(0,a.jsx)(to,{name:e.name}),(0,a.jsx)("span",{className:"tr-name",children:e.name}),e.symlink?(0,a.jsx)("span",{className:"tr-badge",children:"link"}):null,(0,a.jsx)("span",{className:"tr-meta mono",children:function(e){if(!Number.isFinite(e)||e<=0)return"0 B";let t=["B","KB","MB","GB"],n=e,l=0;for(;n>=1024&&l<t.length-1;)n/=1024,l+=1;let s=0===l?n.toFixed(0):n.toFixed(n>=10?1:2);return"".concat(s," ").concat(t[l])}(e.sizeBytes)})]},e.path)})(e,t)),void 0===n||n.loading||null!==n.error||0!==n.entries.length?null:(0,a.jsx)("div",{className:"files-note",style:{paddingLeft:22+13*t},children:"Empty folder."}),(null==n?void 0:n.truncated)===!0?(0,a.jsx)("div",{className:"files-note files-warning",style:{paddingLeft:22+13*t},children:"Showing the first 1000 entries."}):null]})};return null!==p?(0,a.jsx)(tO,{root:null!=u?u:d,path:p,onClose:()=>{var e;h(null),null==(e=w.current)||e.call(w,null,null!=u?u:d)}}):(0,a.jsxs)("div",{className:"files",children:[(0,a.jsx)("button",{className:"files-refresh",type:"button",onClick:()=>y(e=>e+1),title:"Refresh folder","aria-label":"Refresh folder",children:(0,a.jsx)(S.reset,{size:13})}),(0,a.jsx)("div",{className:"tr files-tree",children:N("",0)})]})}let tK=[{n:1,t:[["k","const"],[""," "],["v","{ useState }"],[""," = "],["v","React"]]},{n:2,t:[]},{n:3,t:[["k","function"],[""," "],["f","WindowFrame"],["p","({ win, on })"],[""," {"]]},{n:4,t:[[""," "],["k","const"],[""," [drag, setDrag] = "],["f","useState"],["p","(null)"]]},{n:5,t:[[""," "],["k","return"],[""," "],["p","<section"],["a"," className"],["","="],["s",'"window"'],["p",">"]]},{n:6,t:[[""," "],["c","// drag \xb7 resize \xb7 snap"]]},{n:7,t:[[""," "],["p","</section>"]]},{n:8,t:[["","}"]]}];function tU(e){let{file:t="windows.jsx"}=e;return(0,a.jsxs)("div",{className:"editor",children:[(0,a.jsxs)("div",{className:"ed-tabs mono",children:[(0,a.jsxs)("span",{className:"ed-tab active",children:[(0,a.jsx)(S.editor,{size:12})," ",t]}),(0,a.jsx)("span",{className:"ed-tab",children:"styles.css"})]}),(0,a.jsx)("div",{className:"ed-code mono",children:tK.map(e=>(0,a.jsxs)("div",{className:"ed-line",children:[(0,a.jsx)("span",{className:"ed-num",children:e.n}),(0,a.jsx)("span",{className:"ed-src",children:e.t.map((e,t)=>(0,a.jsx)("span",{className:""===e[0]?void 0:"tk-".concat(e[0]),children:e[1]},t))})]},e.n))})]})}async function tB(e,t){var n,l;let s=(null!=(n=null==t?void 0:t.method)?n:"GET").toUpperCase(),a="GET"!==s&&"HEAD"!==s,i=await fetch(e,{...t,headers:{Accept:"application/json",...a?{"Content-Type":"application/json"}:{},...a?{"X-Keiko-CSRF":"1"}:{},...null!=(l=null==t?void 0:t.headers)?l:{}}});if(!i.ok){let e="INTERNAL",t="HTTP ".concat(i.status.toString());try{let n=await i.json();e=n.error.code,t=n.error.message}catch(e){}throw new H(e,t,i.status)}if(204!==i.status)return i.json()}async function tq(e){return tB("/api/browser/status?port=".concat(encodeURIComponent(String(e))))}async function tJ(e){return tB("/api/browser/sessions",{method:"POST",body:JSON.stringify({port:e})})}async function t_(e){await tB("/api/browser/sessions/".concat(encodeURIComponent(e)),{method:"DELETE"})}async function tV(e,t){return tB("/api/browser/sessions/".concat(encodeURIComponent(e),"/navigate"),{method:"POST",body:JSON.stringify({url:t})})}async function tY(e){return tB("/api/browser/sessions/".concat(encodeURIComponent(e),"/screenshot"),{method:"POST",body:JSON.stringify({})})}async function tH(e,t){return tB("/api/browser/sessions/".concat(encodeURIComponent(e),"/apply"),{method:"POST",body:JSON.stringify({captureSeq:t})})}async function tX(e){return tB("/api/browser/sessions/".concat(encodeURIComponent(e),"/content"),{method:"POST",body:JSON.stringify({})})}function tG(e){return e instanceof H?{code:e.code,message:e.message}:e instanceof Error?{code:"INTERNAL",message:e.message}:{code:"INTERNAL",message:"Unexpected error."}}function tZ(e){var t,n;let l=null!=(t=e.cdpPort)?t:9222,s=null!=(n=e.url)?n:"http://localhost:5173",[r,o]=(0,i.useState)(String(l)),[c,d]=(0,i.useState)(s),[u,m]=(0,i.useState)(null),[p,h]=(0,i.useState)(null),[x,f]=(0,i.useState)(!1),[g,v]=(0,i.useState)(null),[j,y]=(0,i.useState)([]),[w,b]=(0,i.useState)(null),[N,k]=(0,i.useState)(null),[S,C]=(0,i.useState)(null),M=(0,i.useRef)(null),z=(0,i.useCallback)(()=>{v(null)},[]),E=(0,i.useCallback)(e=>{y(t=>{let n=[...t,e];return n.length>50?n.slice(n.length-50):n}),"navigated"===e.kind&&"string"==typeof e.payload.originOnly&&C(e.payload.originOnly),"error"===e.kind&&v({code:"string"==typeof e.payload.code?e.payload.code:"INTERNAL",message:"string"==typeof e.payload.message?e.payload.message:"Error."})},[]);(0,i.useEffect)(()=>{var e,t;if(null===u){null==(e=M.current)||e.close(),M.current=null;return}let n=new EventSource((t=u.sessionId,"/api/browser/sessions/".concat(encodeURIComponent(t),"/events")));for(let e of["session-opened","navigated","screenshot-captured","page-content-captured","session-closed","trust-warning","error"])n.addEventListener("browser:".concat(e),e=>{try{let t=JSON.parse(e.data);E(t)}catch(e){}});return M.current=n,()=>{n.close(),M.current=null}},[u,E]);let P=(0,i.useCallback)(async()=>{z(),f(!0);try{let e=Number.parseInt(r,10),t=await tq(e);h(t)}catch(e){v(tG(e))}finally{f(!1)}},[r,z]),R=(0,i.useCallback)(async()=>{z(),f(!0);try{let e=Number.parseInt(r,10),t=await tJ(e);m(t),y([]),k(null),C(null)}catch(e){v(tG(e))}finally{f(!1)}},[r,z]),T=(0,i.useCallback)(async()=>{if(null!==u){z(),f(!0);try{await t_(u.sessionId),m(null),b(null),k(null),C(null)}catch(e){v(tG(e))}finally{f(!1)}}},[u,z]),A=(0,i.useCallback)(async()=>{if(null!==u){z(),f(!0);try{let e=await tV(u.sessionId,c);C(e.originOnly)}catch(e){v(tG(e))}finally{f(!1)}}},[u,c,z]),L=(0,i.useCallback)(async()=>{if(null!==u){z(),f(!0);try{let e=await tY(u.sessionId);e.persisted||b({seq:e.seq,dataBase64:e.dataBase64})}catch(e){v(tG(e))}finally{f(!1)}}},[u,z]),D=(0,i.useCallback)(async()=>{if(null!==u&&null!==w){z(),f(!0);try{let e=await tH(u.sessionId,w.seq);e.persisted&&k(e.path),b(null)}catch(e){v(tG(e))}finally{f(!1)}}},[u,w,z]),F=(0,i.useCallback)(async()=>{if(null!==u){z(),f(!0);try{await tX(u.sessionId)}catch(e){v(tG(e))}finally{f(!1)}}},[u,z]),I=(0,i.useMemo)(()=>x||null!==u,[x,u]),O=(0,i.useMemo)(()=>x||null===u,[x,u]);return(0,a.jsxs)("div",{className:"browser","aria-label":"Browser tool",children:[(0,a.jsxs)("div",{className:"bw-bar",children:[(0,a.jsx)("span",{className:"bw-dot",style:{background:null===u?"var(--line-strong)":"var(--ok)"},"aria-hidden":"true"}),(0,a.jsxs)("label",{className:"bw-field",children:[(0,a.jsx)("span",{className:"bw-field-label",children:"Port"}),(0,a.jsx)("input",{type:"text",inputMode:"numeric",className:"bw-input",value:r,onChange:e=>o(e.target.value),disabled:null!==u||x})]}),(0,a.jsxs)("label",{className:"bw-field bw-field-url",children:[(0,a.jsx)("span",{className:"bw-field-label",children:"URL"}),(0,a.jsx)("input",{type:"url",className:"bw-input bw-input-url",value:c,onChange:e=>d(e.target.value),disabled:x})]})]}),(0,a.jsxs)("div",{className:"bw-actions",role:"toolbar","aria-label":"Browser actions",children:[(0,a.jsx)("button",{type:"button",className:"bw-btn",onClick:()=>{P()},disabled:x||null!==u,children:"Check"}),(0,a.jsx)("button",{type:"button",className:"bw-btn bw-btn-primary",onClick:()=>{R()},disabled:I,children:"Open session"}),(0,a.jsx)("button",{type:"button",className:"bw-btn",onClick:()=>{A()},disabled:O,children:"Navigate"}),(0,a.jsx)("button",{type:"button",className:"bw-btn",onClick:()=>{L()},disabled:O,children:"Screenshot"}),(0,a.jsx)("button",{type:"button",className:"bw-btn",onClick:()=>{D()},disabled:x||null===w,children:"Apply"}),(0,a.jsx)("button",{type:"button",className:"bw-btn",onClick:()=>{F()},disabled:O,children:"Capture HTML"}),(0,a.jsx)("button",{type:"button",className:"bw-btn bw-btn-danger",onClick:()=>{T()},disabled:O,children:"Close"})]}),null!==p&&null===u?(0,a.jsxs)("p",{className:"bw-status",role:"status",children:["Reachable: ",p.reachable?"yes":"no",null===p.browserVersion?"":" — ".concat(p.browserVersion)]}):null,null!==S?(0,a.jsxs)("p",{className:"bw-status",role:"status","aria-live":"polite",children:["Current origin: ",(0,a.jsx)("span",{className:"mono",children:S})]}):null,null!==w?(0,a.jsx)("p",{className:"bw-status",role:"status",children:"Screenshot ready (dry-run) — press Apply to persist."}):null,null!==N?(0,a.jsxs)("p",{className:"bw-status",role:"status",children:["Persisted as ",(0,a.jsx)("span",{className:"mono",children:N}),"."]}):null,null!==g?(0,a.jsxs)("div",{className:"bw-error",role:"alert",children:[(0,a.jsx)("strong",{children:g.code}),": ",g.message]}):null,(0,a.jsx)("div",{className:"bw-view",children:null!==w?(0,a.jsx)("img",{className:"bw-screenshot",src:"data:image/png;base64,".concat(w.dataBase64),alt:"Pending screenshot preview"}):(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("div",{className:"ph-stripes","aria-hidden":"true"}),(0,a.jsx)("div",{className:"bw-overlay mono",children:null===u?"no session":"live preview"})]})}),(0,a.jsx)("div",{className:"bw-log","aria-label":"Browser event log","aria-live":"polite","aria-atomic":"false",children:(0,a.jsx)("ul",{className:"bw-log-list",children:j.slice(-10).map((e,t)=>(0,a.jsxs)("li",{className:"bw-log-item",children:[(0,a.jsx)("span",{className:"bw-log-kind",children:function(e){switch(e){case"session-opened":return"session opened";case"navigated":return"navigated";case"screenshot-captured":return"screenshot captured";case"page-content-captured":return"content captured";case"session-closed":return"session closed";case"trust-warning":return"trust warning";case"error":return"error"}}(e.kind)}),(0,a.jsx)("span",{className:"bw-log-detail mono",children:function(e){let t=e.payload;if("navigated"===e.kind){let e="string"==typeof t.originOnly?t.originOnly:"",n="number"==typeof t.httpStatus?" (".concat(String(t.httpStatus),")"):"";return"".concat(e).concat(n)}return"screenshot-captured"===e.kind?!0===t.persisted?"persisted":"dry-run":"page-content-captured"===e.kind?"number"==typeof t.byteLength?"".concat(String(t.byteLength)," bytes"):"":"error"===e.kind||"trust-warning"===e.kind?"string"==typeof t.message?t.message:"string"==typeof t.warning?t.warning:"":""}(e)})]},"".concat(String(e.kind),"-").concat(String(t))))})})]})}async function tQ(e,t){var n,l;let s=(null!=(n=null==t?void 0:t.method)?n:"GET").toUpperCase(),a="GET"!==s&&"HEAD"!==s,i=await fetch(e,{...t,headers:{Accept:"application/json",...a?{"Content-Type":"application/json"}:{},...a?{"X-Keiko-CSRF":"1"}:{},...null!=(l=null==t?void 0:t.headers)?l:{}}});if(!i.ok){let e="INTERNAL",t="HTTP ".concat(i.status.toString());try{let n=await i.json();e=n.error.code,t=n.error.message}catch(e){}throw new H(e,t,i.status)}if(204!==i.status)return i.json()}async function t$(){return tQ("/api/terminal/policy")}async function t0(e,t){let n=new URLSearchParams;return n.set("projectId",e),void 0!==t&&t.length>0&&n.set("path",t),tQ("/api/terminal/directories?".concat(n.toString()))}async function t1(e){return tQ("/api/terminal/executions",{method:"POST",body:JSON.stringify(e)})}async function t2(e){await tQ("/api/terminal/executions/".concat(encodeURIComponent(e)),{method:"DELETE"})}function t5(e){return e instanceof H?{code:e.code,message:e.message}:e instanceof Error?{code:"INTERNAL",message:e.message}:{code:"INTERNAL",message:"Unexpected error."}}function t3(e){var t,n;let[l,s]=(0,i.useState)(null),[r,o]=(0,i.useState)(""),[c,d]=(0,i.useState)(""),[u,m]=(0,i.useState)(null!=(t=e.cwd)?t:""),[p,h]=(0,i.useState)(null!=(n=e.projectPath)?n:""),[x,f]=(0,i.useState)(!1),[g,v]=(0,i.useState)(null),[j,y]=(0,i.useState)(null),[w,b]=(0,i.useState)(null),[N,k]=(0,i.useState)([]),S=(0,i.useRef)(null),C=(0,i.useRef)(!1),M=(0,i.useRef)(null),[z,E]=(0,i.useState)([]);(0,i.useEffect)(()=>{let e=!1;return t$().then(t=>{e||(s(t),o(e=>{var n;return e.length>0?e:null!=(n=t.commands[0])?n:""}))}).catch(t=>{e||b(t5(t))}),()=>{e=!0}},[]),(0,i.useEffect)(()=>{if(0===p.length)return void E([]);let e=!1;return t0(p,u.length>0?u:void 0).then(t=>{e||E(t.entries)}).catch(()=>{e||E([])}),()=>{e=!0}},[p,u]),(0,i.useEffect)(()=>{let e=new EventSource("/api/terminal/events");S.current=e;let t=e=>{try{let t=JSON.parse(e.data);if("execution-started"===t.kind&&C.current){let e=t.payload;"string"==typeof e.requestId&&e.requestId===M.current&&v(e=>null!==e?e:t.executionId)}if("execution-completed"===t.kind||"execution-failed"===t.kind||"execution-cancelled"===t.kind){let e=t.payload;"string"==typeof e.requestId&&e.requestId===M.current&&v(e=>null===e||e!==t.executionId?e:null)}k(e=>{let n=[t,...e];return n.length>30?n.slice(0,30):n})}catch(e){}};for(let n of["execution-started","execution-completed","execution-failed","execution-cancelled"])e.addEventListener("terminal:".concat(n),t);return()=>{e.close(),S.current=null}},[]);let P=(0,i.useCallback)(async e=>{if(e.preventDefault(),x)return;b(null),y(null),v(null);let t="function"==typeof crypto.randomUUID?crypto.randomUUID():"terminal-".concat(Date.now().toString(36),"-").concat(Math.random().toString(36).slice(2));M.current=t;let n=function(e){let t=e.trim();return 0===t.length?[]:t.split(/\s+/)}(c);C.current=!0,f(!0);try{let e={projectId:p,command:r,args:n,...u.length>0?{cwd:u}:{},requestId:t},l=await t1(e);y(l)}catch(e){b(t5(e))}finally{C.current=!1,f(!1),M.current=null,v(null)}},[c,r,u,p,x]),R=(0,i.useCallback)(async()=>{if(null!==g)try{await t2(g)}catch(e){b(t5(e))}},[g]),T=(0,i.useMemo)(()=>{var e;return null!=(e=null==l?void 0:l.limits)?e:null},[l]);return(0,a.jsxs)("div",{className:"terminal",children:[(0,a.jsxs)("form",{className:"tm-form",onSubmit:e=>void P(e),children:[(0,a.jsxs)("label",{className:"tm-field",children:[(0,a.jsx)("span",{children:"Project path"}),(0,a.jsx)("input",{type:"text",value:p,onChange:e=>h(e.target.value),placeholder:"/absolute/path/to/project",required:!0})]}),(0,a.jsxs)("label",{className:"tm-field",children:[(0,a.jsx)("span",{children:"Command"}),(0,a.jsx)("select",{value:r,onChange:e=>o(e.target.value),disabled:null===l,required:!0,children:null==l?void 0:l.commands.map(e=>(0,a.jsx)("option",{value:e,children:e},e))})]}),(0,a.jsxs)("label",{className:"tm-field",children:[(0,a.jsx)("span",{children:"Args (space-separated)"}),(0,a.jsx)("input",{type:"text",value:c,onChange:e=>d(e.target.value),placeholder:"e.g. -la src"})]}),(0,a.jsxs)("label",{className:"tm-field",children:[(0,a.jsx)("span",{children:"Working directory (optional)"}),(0,a.jsx)("input",{type:"text",value:u,onChange:e=>m(e.target.value),placeholder:"(project root)",list:"tm-cwd-suggestions"}),(0,a.jsx)("datalist",{id:"tm-cwd-suggestions",children:z.map(e=>(0,a.jsx)("option",{value:e.path},e.path))})]}),(0,a.jsxs)("div",{className:"tm-actions",children:[(0,a.jsx)("button",{type:"submit",className:"tm-action",disabled:x||null===l,children:x?"Running…":"Run"}),x?(0,a.jsx)("button",{type:"button",className:"tm-action",disabled:null===g,onClick:()=>void R(),children:"Cancel"}):null]}),null!==T?(0,a.jsxs)("p",{className:"tm-limits",children:["Limits: ",T.maxOutputBytes," bytes output, ",T.defaultTimeoutMs," ms timeout"]}):null]}),null!==w?(0,a.jsxs)("div",{className:"tm-error",role:"alert",children:[(0,a.jsxs)("span",{className:"tm-error-text",children:[(0,a.jsx)("strong",{children:w.code}),": ",w.message]}),(0,a.jsx)("button",{type:"button",className:"tm-error-dismiss","aria-label":"Dismiss error",onClick:()=>b(null),children:"✕"})]}):null,null!==j?(0,a.jsxs)("div",{className:"tm-result",role:"status","aria-live":"polite",children:[(0,a.jsxs)("div",{className:"tm-badges",children:[(0,a.jsxs)("span",{className:0===j.exitCode?"tm-badge tm-badge-ok":"tm-badge tm-badge-fail",children:["exit ",String(j.exitCode)]}),(0,a.jsxs)("span",{className:"tm-badge",children:[j.durationMs," ms"]}),j.truncated?(0,a.jsx)("span",{className:"tm-badge tm-badge-warn",children:"truncated"}):null,j.timedOut?(0,a.jsx)("span",{className:"tm-badge tm-badge-warn",children:"timed out"}):null]}),j.stdout.length>0?(0,a.jsx)("pre",{className:"tm-stdout",children:j.stdout}):null,j.stderr.length>0?(0,a.jsx)("pre",{className:"tm-stderr",children:j.stderr}):null]}):null,(0,a.jsx)("ul",{className:"tm-events",role:"log","aria-live":"polite","aria-relevant":"additions text","aria-atomic":"false","aria-label":"Recent terminal events",children:N.map((e,t)=>(0,a.jsxs)("li",{className:"tm-event",children:[(0,a.jsx)("span",{className:"tm-event-kind",children:function(e){switch(e){case"execution-started":return"started";case"execution-completed":return"completed";case"execution-failed":return"failed";case"execution-cancelled":return"cancelled"}}(e.kind)}),(0,a.jsx)("span",{className:"tm-event-detail",children:function(e){let t=e.payload;return"execution-completed"===e.kind?["number"==typeof t.exitCode||null===t.exitCode?"exit ".concat(String(t.exitCode)):"","number"==typeof t.durationMs?"".concat(String(t.durationMs),"ms"):""].filter(Boolean).join(" \xb7 "):"execution-failed"===e.kind?"string"==typeof t.code?t.code:"":"execution-started"===e.kind&&"string"==typeof t.command?t.command:""}(e)})]},"".concat(e.executionId,"-").concat(String(t),"-").concat(e.kind)))})]})}function t4(e){return e.startsWith("a/")||e.startsWith("b/")?e.slice(2):e}function t6(e){return e instanceof H?{code:e.code,message:e.message}:e instanceof Error?{code:"INTERNAL",message:e.message}:{code:"INTERNAL",message:"Unexpected error."}}function t8(e){return("dry-run"===e.status||"fix-proposed"===e.status)&&void 0!==e.proposedDiff&&void 0===e.appliedAt}function t7(e){return void 0!==e.proposedDiff&&""!==e.proposedDiff}function t9(e){let{href:t,hasManifest:n,error:l}=e;return n?(0,a.jsx)("a",{className:"rv-evidence-link",href:t,target:"_blank",rel:"noopener noreferrer",children:"Evidence"}):null!==l?(0,a.jsx)("span",{className:"rv-evidence-link rv-evidence-error",role:"status","aria-label":"Evidence unavailable: ".concat(l.message),title:l.message,children:"Evidence error"}):(0,a.jsx)("span",{className:"rv-evidence-link rv-evidence-disabled",role:"link","aria-disabled":"true",children:"Evidence"})}function ne(e){let{tokens:t}=e;return(0,a.jsx)(a.Fragment,{children:t.map((e,t)=>(0,a.jsx)("span",{className:"hl-".concat(e[0]),children:e[1]},t))})}function nt(e){var t,n,l;let s,{line:i,lang:r}=e,o="add"===i.kind?"+":"del"===i.kind?"−":"ctx"===i.kind?"\xb7":"",c="ctx"===i.kind?"":" rv-".concat(i.kind);if("meta"!==i.kind&&"code"!==r){let e=null!=(t=tL(i.text,tR(r))[0])?t:[];s=(0,a.jsx)(ne,{tokens:e})}else s=i.text;return(0,a.jsxs)("div",{className:"rv-line".concat(c),children:[(0,a.jsx)("span",{className:"rv-sr-only",children:{add:"Added line",del:"Deleted line",ctx:"Context line",meta:"Diff metadata"}[i.kind]}),(0,a.jsx)("span",{className:"rv-num-old rv-num",children:null!=(n=i.oldLine)?n:""}),(0,a.jsx)("span",{className:"rv-num-new rv-num",children:null!=(l=i.newLine)?l:""}),(0,a.jsx)("span",{className:"rv-gutter","aria-hidden":"true",children:o}),(0,a.jsx)("code",{className:"rv-src",children:s})]})}function nn(e){let{hunk:t,lang:n}=e;return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)("div",{className:"rv-hunk mono","aria-label":"Hunk header ".concat(t.header),children:[(0,a.jsx)("span",{className:"rv-sr-only",children:"Hunk header"}),t.header]}),t.lines.map((e,t)=>(0,a.jsx)(nt,{line:e,lang:n},t))]})}function nl(e){var t;let{file:n,index:l,changedFiles:s,sectionRef:i}=e,r=s.find(e=>e.path===n.path),o=n.path.includes(".")&&null!=(t=n.path.split(".").pop())?t:"code";return(0,a.jsxs)("section",{id:"rv-file-".concat(l),"aria-labelledby":"rv-file-".concat(l,"-h"),ref:i,children:[(0,a.jsxs)("h3",{id:"rv-file-".concat(l,"-h"),className:"rv-file mono",children:[(0,a.jsx)("span",{className:"rv-path",children:n.path}),void 0!==n.oldPath&&(0,a.jsxs)("span",{className:"rv-oldpath",children:[" (was ",n.oldPath,")"]}),(0,a.jsx)("span",{className:"spacer"}),(0,a.jsxs)("span",{className:"rv-stat add",children:["+",n.addedLines]}),(0,a.jsxs)("span",{className:"rv-stat del",children:["−",n.removedLines]}),(null==r?void 0:r.elevatedReview)===!0&&(0,a.jsx)("span",{className:"rv-elevated","aria-label":"Elevated review",children:"!"})]}),(0,a.jsx)("div",{className:"rv-code mono",children:n.hunks.map((e,t)=>(0,a.jsx)(nn,{hunk:e,lang:o},t))})]})}function ns(e){var t,n,l;let{runId:s}=e,[r,o]=(0,i.useState)(null),[c,d]=(0,i.useState)(!1),[u,m]=(0,i.useState)(null),[p,h]=(0,i.useState)(!1),[x,f]=(0,i.useState)(null),[g,v]=(0,i.useState)(!1),[j,y]=(0,i.useState)(null),[w,b]=(0,i.useState)(null);(0,i.useEffect)(()=>{if(void 0===s||""===s)return;let e=!1;return h(!0),f(null),o(null),d(!1),m(null),b(null),Promise.allSettled([et(s),el(s)]).then(t=>{let[n,l]=t;if(!e){if("fulfilled"===l.status)d(!0),m(null);else{let e=t6(l.reason);d(!1),m("NOT_FOUND"===e.code?null:e)}if("fulfilled"===n.status){o(n.value.report),h(!1);return}f(t6(n.reason)),h(!1)}}),()=>{e=!0}},[s]);let N="/api/evidence/".concat(encodeURIComponent(null!=s?s:"")),k=(0,i.useMemo)(()=>(null==r?void 0:r.proposedDiff)!==void 0?function(e){let t=new TextEncoder,n=t.encode(e).byteLength;if(0===e.length)return{files:[],truncated:!1,totalBytes:0};let l=e,s=!1;if(n>524288){s=!0;let n=t.encode(e),a=new TextDecoder().decode(n.slice(0,524288)),i=a.lastIndexOf("\n");l=-1===i?a:a.slice(0,i+1)}let a=l.split("\n"),i=a.length>0&&""===a[a.length-1]?a.slice(0,-1):a,r=[],o=null,c=null,d=0,u=0,m=()=>{null!==o&&null!==c&&o.hunks.push(c),c=null},p=()=>{m(),null!==o&&r.push(o),o=null},h=0;for(;h<i.length;){var x,f,g;let e=null!=(x=i[h])?x:"";if(e.startsWith("diff --git ")){p();let t=/^diff --git a\/(.+?) b\/(.+)$/.exec(e);if(null!==t&&void 0!==t[1]&&void 0!==t[2]){let e=t[1],n=t[2],l=t4("b/".concat(n)),s=t4("a/".concat(e)),a={path:l,hunks:[],addedLines:0,removedLines:0};s!==l&&(a.oldPath=s),o=a}h++;continue}if(null!==c){if(e.startsWith("+")){let t={kind:"add",oldLine:null,newLine:u,text:e.slice(1)};c.lines.push(t),null!==o&&o.addedLines++,u++,h++;continue}if(e.startsWith("-")){let t={kind:"del",oldLine:d,newLine:null,text:e.slice(1)};c.lines.push(t),null!==o&&o.removedLines++,d++,h++;continue}if(e.startsWith("\\ ")){let t={kind:"meta",oldLine:null,newLine:null,text:e};c.lines.push(t),h++;continue}if(e.startsWith(" ")||""===e){let t={kind:"ctx",oldLine:d,newLine:u,text:e.startsWith(" ")?e.slice(1):e};c.lines.push(t),d++,u++,h++;continue}}if(e.startsWith("--- ")){let t=e.slice(4);if("/dev/null"!==t&&null===o)p(),o={path:t4(t),hunks:[],addedLines:0,removedLines:0};else if("/dev/null"!==t&&null!==o){let e=t4(t);e!==o.path&&(o.oldPath=e)}h++;continue}if(e.startsWith("+++ ")){let t=e.slice(4);"/dev/null"!==t&&null!==o?o.path=t4(t):"/dev/null"!==t&&(p(),o={path:t4(t),hunks:[],addedLines:0,removedLines:0}),h++;continue}if(e.startsWith("@@ ")){null===o&&(o={path:"(unknown)",hunks:[],addedLines:0,removedLines:0}),m();let t=function(e){let t=/^@@ -(\d+)(?:,\d+)? \+(\d+)(?:,\d+)? @@/.exec(e);return null===t||void 0===t[1]||void 0===t[2]?null:{oldStart:parseInt(t[1],10),newStart:parseInt(t[2],10)}}(e);d=null!=(f=null==t?void 0:t.oldStart)?f:1,u=null!=(g=null==t?void 0:t.newStart)?g:1,c={header:e,lines:[]},h++;continue}h++}return p(),{files:r,truncated:s,totalBytes:n}}(r.proposedDiff):null,[null==r?void 0:r.proposedDiff]),S=null!=(t=null==r?void 0:r.changedFiles)?t:[],C=(0,i.useMemo)(()=>{var e,t;return{added:null!=(e=null==k?void 0:k.files.reduce((e,t)=>e+t.addedLines,0))?e:0,removed:null!=(t=null==k?void 0:k.files.reduce((e,t)=>e+t.removedLines,0))?t:0}},[k]),M=null!==k&&k.files.length>0?Math.min(null!=w?w:0,k.files.length-1):null,z=null!==M?null==k?void 0:k.files[M]:void 0,E=(null==r?void 0:r.status)==="running";return void 0===s||""===s?(0,a.jsxs)("section",{className:"review rv-empty","aria-label":"Diff review",children:[(0,a.jsx)("h2",{className:"rv-empty-h",children:"Review"}),(0,a.jsx)("p",{className:"rv-empty-p",children:"Enter a run ID in the window configuration to load a proposed diff."})]}):(0,a.jsxs)("section",{className:"review","aria-label":"Diff review",children:[p&&(0,a.jsxs)("div",{className:"rv-loading","aria-busy":"true","aria-label":"Loading diff",children:[(0,a.jsx)("div",{className:"rv-skel"}),(0,a.jsx)("div",{className:"rv-skel rv-skel-sm"})]}),!p&&null!==x&&(0,a.jsxs)("div",{role:"alert",className:"rv-error",children:["NOT_FOUND"===x.code?"No run with that ID was found.":"".concat(x.code,": ").concat(x.message),(c||null!==u)&&(0,a.jsx)("span",{className:"rv-error-evidence",children:(0,a.jsx)(t9,{href:N,hasManifest:c,error:u})})]}),!p&&null===x&&null!==r&&E&&(0,a.jsx)("p",{role:"status","aria-live":"polite",className:"rv-no-diff",children:"Run is still running. The proposed diff will appear when the run completes."}),!p&&null===x&&null!==r&&!E&&!t7(r)&&(0,a.jsx)("p",{className:"rv-no-diff",children:"This run has no proposed diff to review."}),!p&&null===x&&null!==r&&t7(r)&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)("div",{className:"rv-header",children:[(0,a.jsx)("span",{className:"rv-status mono",children:null!=(l=({running:"Running",completed:"Completed","dry-run":"Dry run",rejected:"Rejected",cancelled:"Cancelled",failed:"Failed","fix-applied":"Fix applied","fix-proposed":"Fix proposed","investigation-only":"Investigation only"})[n=r.status])?l:n}),void 0!==r.modelId&&(0,a.jsx)("span",{className:"rv-model mono",children:r.modelId}),(0,a.jsxs)("span",{className:"rv-counts mono",children:[null!==k&&"".concat(k.files.length," file").concat(1!==k.files.length?"s":"")," ",(0,a.jsxs)("span",{className:"rv-stat add",children:["+",C.added]})," ",(0,a.jsxs)("span",{className:"rv-stat del",children:["−",C.removed]})]}),(0,a.jsx)("span",{className:"spacer"}),(0,a.jsx)(t9,{href:N,hasManifest:c,error:u})]}),null!==k&&k.files.length>0&&null!==M&&void 0!==z&&(0,a.jsxs)("div",{className:"rv-layout",children:[(0,a.jsx)("nav",{className:"rv-filelist","aria-label":"Changed files",children:(0,a.jsx)("ul",{children:k.files.map((e,t)=>{let n=S.find(t=>t.path===e.path),l=M===t;return(0,a.jsx)("li",{children:(0,a.jsxs)("button",{type:"button",className:"rv-filerow","aria-pressed":l,"aria-controls":l?"rv-file-".concat(t):void 0,onClick:()=>{b(t)},children:[(0,a.jsx)("span",{className:"rv-filerow-path mono",children:function(e){if(e.length<=40)return e;let t=e.lastIndexOf("/");return -1===t?e:"…/".concat(e.slice(t+1))}(e.path)}),(0,a.jsxs)("span",{className:"rv-stat add",children:["+",e.addedLines]}),(0,a.jsxs)("span",{className:"rv-stat del",children:["−",e.removedLines]}),(null==n?void 0:n.elevatedReview)===!0&&(0,a.jsx)("span",{className:"rv-elevated","aria-label":"Elevated review",children:"!"})]})},e.path)})})}),(0,a.jsxs)("div",{className:"rv-body",children:[(0,a.jsx)(nl,{file:z,index:M,changedFiles:S,sectionRef:()=>void 0},z.path),k.truncated&&(0,a.jsxs)("p",{role:"note",className:"rv-truncated",children:["Diff truncated at 512 KB. Open the"," ",c?(0,a.jsx)("a",{href:N,target:"_blank",rel:"noopener noreferrer",children:"evidence manifest"}):"evidence manifest"," ","for the full record."]})]})]}),(0,a.jsxs)("div",{className:"rv-controls",children:[(0,a.jsx)("span",{role:"status","aria-live":"polite",className:"rv-apply-status",children:g?"Applying…":void 0!==r.appliedAt?"Applied":""}),null!==j&&(0,a.jsx)("span",{role:"alert",className:"rv-apply-error",children:j.message}),void 0!==r.appliedAt?(0,a.jsx)("span",{className:"rv-final mono",children:"Applied"}):t8(r)?(0,a.jsx)("button",{type:"button",className:"arun-btn",disabled:g,onClick:()=>{void 0!==s&&null!==r&&t8(r)&&(v(!0),y(null),en(s).then(e=>{o(e.report),v(!1)}).catch(e=>{y(t6(e)),v(!1)}))},children:g?"Applying…":"Apply"}):null]})]})]})}function na(e){if(e<1e3)return"".concat(e.toString()," ms");if(e<6e4)return"".concat((e/1e3).toFixed(1)," s");let t=Math.floor(e/6e4),n=Math.floor(e%6e4/1e3);return"".concat(t.toString(),"m ").concat(n.toString(),"s")}function ni(e){return e<1e3?e.toString():"".concat((e/1e3).toFixed(1),"k")}let nr=["run:started","state:transition","model:call:started","model:call:completed","model:call:failed","tool:call:started","tool:call:completed","tool:call:failed","reasoning:trace","patch:proposed","verification:result","run:completed","run:cancelled","run:failed","command:executed","sandbox:configured","patch:applied","workflow:started","conventions:detected","context:selected","workflow:model:call:started","workflow:model:call:completed","patch:validated","workflow:patch:applied","workflow:verification:result","workflow:completed","workflow:failed","bug:started","bug:failure:parsed","bug:context:selected","bug:model:call:started","bug:model:call:completed","bug:rootcause:proposed","bug:patch:validated","bug:patch:applied","bug:verification:result","bug:completed","bug:failed","ready"],no=new Set(["run:completed","run:cancelled","run:failed","workflow:completed","workflow:failed","bug:completed","bug:failed"]),nc=new Set(["completed","dry-run","rejected","cancelled","failed","fix-applied","fix-proposed","investigation-only"]),nd={verify:"Verify","explain-plan":"Explain plan","unit-test-generation":"Generate unit tests","bug-investigation":"Investigate bug"};function nu(e,t){return void 0===t||0===t.length?null:(0,a.jsxs)("div",{className:"arun-result-card",children:[(0,a.jsx)("div",{className:"arun-result-title",children:e}),(0,a.jsx)("pre",{children:t})]})}function nm(e){var t,n,l,s,r,o,c,d,u;let{cfg:m={},linkedRoot:p=null,linkedFilePath:h}=e,x=null!=(n=m.runId)?n:null,f="verify"===(d=m.workflow)||"explain-plan"===d||"unit-test-generation"===d||"bug-investigation"===d?d:null,g=null!=(l=m.model)?l:"",v=function(e){if(void 0===e||0===e.length)return null;try{let t=JSON.parse(e);return"object"!=typeof t||null===t||Array.isArray(t)?null:t}catch(e){return null}}(m.inputJson),j=function(e){let[t,n]=(0,i.useState)([]),[l,s]=(0,i.useState)("connecting"),[a,r]=(0,i.useState)(null),o=(0,i.useRef)(-1);return(0,i.useEffect)(()=>{if(null===e)return;n([]),s("connecting"),r(null),o.current=-1;let t=null,l=!1,a="/api/runs/".concat(encodeURIComponent(e),"/events");(t=new EventSource(o.current>=0?"".concat(a,"?lastEventId=").concat(o.current.toString()):a)).onopen=()=>{l||s("live")},t.onerror=()=>{l||(s("error"),r("Stream disconnected. Attempting to reconnect…"))};let i=e=>{let a;if(!l){try{a=JSON.parse(e.data)}catch(e){return}o.current=a.seq,n(e=>[...e,a]),no.has(a.type)&&(s("terminal"),null==t||t.close())}};for(let e of nr)t.addEventListener(e,i);return()=>{l=!0,null==t||t.close()}},[e]),{events:t,status:l,error:a}}(x),[y,w]=(0,i.useState)(null),[b,N]=(0,i.useState)(null),[k,C]=(0,i.useState)(null),[M,z]=(0,i.useState)(!1),[E,P]=(0,i.useState)(null),[R,T]=(0,i.useState)(null),A=(0,i.useCallback)(async()=>{if(null!==x){C(null);try{let e=await et(x);w(e.report),N(null)}catch(e){if(e instanceof H&&404===e.status){try{let e=await el(x);N(e.manifest),w(null)}catch(e){C(e instanceof Error?e.message:"Unable to load evidence.")}return}C(e instanceof Error?e.message:"Unable to load run report.")}}},[x]);(0,i.useEffect)(()=>{A()},[A]),(0,i.useEffect)(()=>{"terminal"===j.status&&A()},[A,j.status]),(0,i.useEffect)(()=>{let e=!1;if(0!==g.length)return Z().then(t=>{var n,l;e||T(null!=(l=null==(n=t.models.find(e=>e.id===g))?void 0:n.costClass)?l:null)}).catch(()=>{e||T(null)}),()=>{e=!0}},[g]);let L=(0,i.useMemo)(()=>(function(e,t){var n,l,s,a,i,r;let o=null!=(a=null==t||null==(n=t.usage)?void 0:n.promptTokens)?a:0,c=null!=(i=null==t||null==(l=t.usage)?void 0:l.completionTokens)?i:0,d=null!=(r=null==t||null==(s=t.usage)?void 0:s.latencyMs)?r:0,u=+((null==t?void 0:t.usage)!==void 0);if(u>0)return{promptTokens:o,completionTokens:c,latencyMs:d,requestCount:u};for(let t of e){let e=function(e){if("model:call:completed"===e.type)return{promptTokens:e.usage.promptTokens,completionTokens:e.usage.completionTokens,latencyMs:e.usage.latencyMs,requestCount:1};let t=e.promptTokens,n=e.completionTokens,l=e.latencyMs;return"number"==typeof t&&"number"==typeof n&&"number"==typeof l?{promptTokens:t,completionTokens:n,latencyMs:l,requestCount:1}:null}(t);null!==e&&(o+=e.promptTokens,c+=e.completionTokens,d+=e.latencyMs,u+=e.requestCount)}return{promptTokens:o,completionTokens:c,latencyMs:d,requestCount:u}})(j.events,y),[j.events,y]),D=null!=(o=null!=(s=null==y?void 0:y.durationMs)?s:null==b?void 0:b.run.durationMs)?o:j.events.length>0?Math.max(0,Date.now()-Number(new Date(null!=(r=null==(t=j.events[0])?void 0:t.ts)?r:Date.now()))):0,F=null!==y?y.status:null!==b?b.run.outcome:"loading",I=null!==y&&nc.has(y.status),O=null!==y&&void 0!==y.proposedDiff&&void 0===y.appliedAt&&("unit-test-generation"===f&&"dry-run"===y.status||"bug-investigation"===f&&"fix-proposed"===y.status),W=async()=>{if(null!==x){C(null);try{await ee(x),await A()}catch(e){C(e instanceof Error?e.message:"Unable to cancel run.")}}},K=async()=>{if(null!==x&&O){z(!0),P(null);try{let e=await en(x);w(e.report)}catch(e){P(e instanceof Error?e.message:"Unable to apply run.")}finally{z(!1)}}};return null===x||null===f?(0,a.jsxs)("div",{className:"arun arun-empty",children:[(0,a.jsx)("div",{className:"arun-result-title",children:"Agent run is not configured."}),(0,a.jsx)("p",{children:"Open a new Agent window from the launcher to start a BFF workflow."})]}):(0,a.jsxs)("div",{className:"arun arun-real",children:[(0,a.jsxs)("div",{className:"arun-head",children:[(0,a.jsx)("span",{className:"arun-role",children:nd[f]}),(0,a.jsx)("span",{className:"ag-model mono",children:g}),null!==R?(0,a.jsx)("span",{className:"arun-gov",children:R}):null,(0,a.jsx)("span",{className:"spacer"}),(0,a.jsxs)("span",{className:"arun-status",children:[(0,a.jsx)("span",{className:"dot","data-live":(null==y?void 0:y.status)==="running"}),F]})]}),(0,a.jsxs)("div",{className:"arun-summary",children:[(0,a.jsx)("strong",{children:function(e,t,n){var l;if(null===t&&null===n)return"Loading run state...";let s=null===e?"Agent run":nd[e];return(null==t?void 0:t.status)==="running"?"".concat(s," is running."):(null==t?void 0:t.status)==="dry-run"?"".concat(s," produced a reviewable dry-run."):(null==t?void 0:t.status)==="fix-proposed"?"".concat(s," proposed a fix."):(null==t?void 0:t.status)==="fix-applied"?"".concat(s," applied changes."):(null==t?void 0:t.status)==="investigation-only"?"".concat(s," completed without a patch."):(null==t?void 0:t.status)==="failed"||(null==t?void 0:t.status)==="rejected"?"".concat(s," failed."):(null==t?void 0:t.status)==="cancelled"?"".concat(s," was cancelled."):null!==t?"".concat(s," completed."):"".concat(s," evidence loaded: ").concat(null!=(l=null==n?void 0:n.run.outcome)?l:"unknown",".")}(f,y,b)}),(0,a.jsxs)("span",{className:"mono",children:["run ",x.slice(0,8)]})]}),(0,a.jsxs)("div",{className:"arun-meters",children:[(0,a.jsxs)("div",{className:"arun-meter",children:[(0,a.jsx)("span",{className:"arun-mk",children:"Elapsed"}),(0,a.jsx)("span",{className:"arun-mv mono",children:na(D)})]}),(0,a.jsxs)("div",{className:"arun-meter",children:[(0,a.jsx)("span",{className:"arun-mk",children:"Usage"}),(0,a.jsx)("span",{className:"arun-mv mono",children:0===L.requestCount?"No model usage":"".concat(ni(L.promptTokens+L.completionTokens)," tok")})]}),(0,a.jsxs)("div",{className:"arun-meter",children:[(0,a.jsx)("span",{className:"arun-mk",children:"Latency"}),(0,a.jsx)("span",{className:"arun-mv mono",children:0===L.requestCount?"-":na(L.latencyMs)})]})]}),(0,a.jsxs)("div",{className:"arun-perms",children:[(0,a.jsxs)("span",{className:"arun-perm","data-on":null!==p,children:[(0,a.jsx)(S.files,{size:11}),null!==p?p:null!=(c=m.workspaceRoot)?c:"no workspace"]}),void 0!==h?(0,a.jsxs)("span",{className:"arun-perm","data-on":!0,children:[(0,a.jsx)(S.files,{size:11}),h]}):null,(0,a.jsxs)("span",{className:"arun-perm","aria-disabled":"true",children:[(0,a.jsx)(S.plugins,{size:11}),"permissions coming soon"]})]}),null!==v?(0,a.jsxs)("details",{className:"arun-input",children:[(0,a.jsx)("summary",{children:"Run input"}),(0,a.jsx)("pre",{children:JSON.stringify(v,null,2)})]}):null,(0,a.jsx)("div",{className:"arun-log",children:0===j.events.length?(0,a.jsxs)("div",{className:"arun-log-row",children:[(0,a.jsx)("span",{className:"arun-log-ico",children:(0,a.jsx)(S.reset,{size:12})}),(0,a.jsx)("span",{className:"arun-log-text",children:"Waiting for run events..."})]}):j.events.slice().reverse().slice(0,50).map(e=>(0,a.jsxs)("div",{className:"arun-log-row",children:[(0,a.jsx)("span",{className:"arun-log-ico",children:(0,a.jsx)(S.spark,{size:12})}),(0,a.jsx)("span",{className:"arun-log-text",children:function(e){switch(e.type){case"ready":return"SSE stream ready";case"run:started":return"Started ".concat(e.taskType);case"run:completed":return"Run completed";case"run:failed":return"Run failed: ".concat(e.failure.message);case"run:cancelled":return"Run cancelled";case"state:transition":return"".concat(e.from," -> ").concat(e.to).concat(void 0===e.reason?"":": ".concat(e.reason));case"model:call:started":return"Model call started (".concat(e.contextBytes.toString()," bytes)");case"model:call:completed":return"Model call completed (".concat(ni(e.usage.promptTokens+e.usage.completionTokens)," tokens)");case"model:call:failed":return"Model call failed: ".concat(e.message);case"patch:proposed":return"Patch proposed (".concat(e.patchBytes.toString()," bytes)");case"verification:result":return"Verification ".concat(e.passed?"passed":"failed",": ").concat(e.detail);case"workflow:started":return"Unit-test workflow started";case"workflow:model:call:completed":return"Unit-test model call completed (".concat(ni(e.promptTokens+e.completionTokens)," tokens)");case"workflow:verification:result":return"Unit-test verification ".concat(e.overallStatus);case"workflow:completed":return"Unit-test workflow ".concat(e.status);case"workflow:failed":return"Unit-test workflow failed: ".concat(e.message);case"bug:started":return"Bug investigation started";case"bug:model:call:completed":return"Bug model call completed (".concat(ni(e.promptTokens+e.completionTokens)," tokens)");case"bug:rootcause:proposed":return"Root cause proposed".concat(e.hasPatch?" with patch":"");case"bug:verification:result":return"Bug verification ".concat(e.overallStatus);case"bug:completed":return"Bug investigation ".concat(e.status);case"bug:failed":return"Bug investigation failed: ".concat(e.message);default:return e.type}}(e)}),(0,a.jsx)("span",{className:"arun-log-t mono",children:function(e){let t="number"==typeof e.ts?e.ts:Date.parse(e.ts);return Number.isFinite(t)?new Date(t).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",second:"2-digit"}):""}(e)})]},"".concat(e.runId,":").concat(e.seq,":").concat(e.type)))}),null!==y?(0,a.jsxs)("div",{className:"arun-results",children:[void 0===y.report?null:(0,a.jsxs)("div",{className:"arun-result-card",children:[(0,a.jsx)("div",{className:"arun-result-title",children:"Report"}),(0,a.jsx)("pre",{children:y.report})]}),void 0===y.overallStatus||void 0===y.results?null:(0,a.jsxs)("div",{className:"arun-result-card",children:[(0,a.jsx)("div",{className:"arun-result-title",children:"Verification"}),(0,a.jsxs)("div",{className:"arun-kv",children:[(0,a.jsx)("span",{children:"Status"}),(0,a.jsx)("strong",{children:y.overallStatus})]}),y.results.slice(0,8).map(e=>(0,a.jsxs)("div",{className:"arun-check-row",children:[(0,a.jsx)("span",{children:e.kind}),(0,a.jsx)("span",{className:"mono",children:e.status})]},"".concat(e.kind,":").concat(e.command)))]}),nu("Failure",y.failureReason),nu("Covered behavior",y.coveredBehavior),nu("Known gaps",y.knownGaps),nu("Verification note",y.verificationSkipReason),function(e){let t=e.hypothesis;if(void 0===t)return null;let n=[["Root cause",t.rootCause],["Regression test",t.regressionTestStrategy],["Uncertainty",t.uncertainty],["Confidence",t.confidence]].filter(e=>"string"==typeof e[1]&&e[1].length>0);return 0===n.length?null:(0,a.jsxs)("div",{className:"arun-result-card",children:[(0,a.jsx)("div",{className:"arun-result-title",children:"Hypothesis"}),n.map(e=>{let[t,n]=e;return(0,a.jsxs)("div",{className:"arun-kv",children:[(0,a.jsx)("span",{children:t}),(0,a.jsx)("strong",{children:n})]},t)})]})}(y),void 0===(u=y.nextActions)||0===u.length?null:(0,a.jsxs)("div",{className:"arun-result-card",children:[(0,a.jsx)("div",{className:"arun-result-title",children:"Next actions"}),u.map(e=>(0,a.jsx)("div",{className:"arun-check-row",children:(0,a.jsx)("span",{children:e})},e))]}),void 0!==y.dryRunPreview?(0,a.jsxs)("div",{className:"arun-result-card",children:[(0,a.jsx)("div",{className:"arun-result-title",children:"Dry-run preview"}),(0,a.jsx)("pre",{children:y.dryRunPreview})]}):null,void 0!==y.proposedDiff?(0,a.jsxs)("div",{className:"arun-result-card",children:[(0,a.jsx)("div",{className:"arun-result-title",children:"Proposed diff"}),(0,a.jsx)("pre",{children:y.proposedDiff})]}):null,function(e){let t=e.verificationSummary;return void 0===t?null:(0,a.jsxs)("div",{className:"arun-result-card",children:[(0,a.jsx)("div",{className:"arun-result-title",children:"Verification"}),(0,a.jsxs)("div",{className:"arun-kv",children:[(0,a.jsx)("span",{children:"Status"}),(0,a.jsx)("strong",{children:t.overallStatus})]}),(0,a.jsxs)("div",{className:"arun-kv",children:[(0,a.jsx)("span",{children:"Duration"}),(0,a.jsx)("strong",{children:na(t.durationMs)})]}),t.results.slice(0,5).map(e=>(0,a.jsxs)("div",{className:"arun-check-row",children:[(0,a.jsx)("span",{children:e.kind}),(0,a.jsx)("span",{className:"mono",children:e.status})]},"".concat(e.kind,":").concat(e.command)))]})}(y),void 0!==y.applyReport?(0,a.jsxs)("div",{className:"arun-result-card arun-applied",children:[(0,a.jsx)("div",{className:"arun-result-title",children:"Applied"}),(0,a.jsx)("pre",{children:JSON.stringify(y.applyReport,null,2)})]}):null]}):null!==b?(0,a.jsxs)("div",{className:"arun-result-card",children:[(0,a.jsx)("div",{className:"arun-result-title",children:"Evidence"}),(0,a.jsxs)("div",{className:"arun-kv",children:[(0,a.jsx)("span",{children:"Outcome"}),(0,a.jsx)("strong",{children:b.run.outcome})]}),(0,a.jsxs)("div",{className:"arun-kv",children:[(0,a.jsx)("span",{children:"Duration"}),(0,a.jsx)("strong",{children:na(b.run.durationMs)})]})]}):null,null!==k?(0,a.jsx)("div",{className:"arun-error",children:k}):null,null!==E?(0,a.jsx)("div",{className:"arun-error",children:E}):null,(0,a.jsxs)("div",{className:"arun-controls",children:[(0,a.jsx)("a",{className:"arun-btn ghost",href:"/api/evidence/".concat(encodeURIComponent(x)),target:"_blank",rel:"noreferrer",children:"Evidence"}),O?(0,a.jsx)("button",{type:"button",className:"arun-btn",disabled:M,onClick:()=>void K(),children:M?"Applying...":"Apply"}):(null==y?void 0:y.appliedAt)!==void 0?(0,a.jsx)("span",{className:"arun-final mono",children:"Applied"}):null,I||(null==y?void 0:y.status)!=="running"?null:(0,a.jsx)("button",{type:"button",className:"arun-btn danger",onClick:()=>void W(),children:"Cancel"})]})]})}let np=[{name:"Messaging",desc:"Catch up on threads",glyph:"#"},{name:"GitHub",desc:"PRs, code & CI",glyph:"{ }"},{name:"Linear",desc:"Track issues",glyph:"⊿"},{name:"Slack",desc:"Team channels",glyph:"≡"},{name:"Sentry",desc:"Error tracking",glyph:"◎"}];function nh(e){let{provider:t="GitHub"}=e;return(0,a.jsx)("div",{className:"integ",children:np.map(e=>{let n=e.name===t;return(0,a.jsxs)("button",{type:"button",className:"integ-row","data-on":n,"aria-pressed":n,children:[(0,a.jsx)("span",{className:"integ-glyph mono",children:e.glyph}),(0,a.jsxs)("span",{className:"integ-text",children:[(0,a.jsx)("span",{className:"integ-name",children:e.name}),(0,a.jsx)("span",{className:"integ-desc",children:e.desc})]}),n?(0,a.jsx)("span",{className:"integ-on",children:(0,a.jsx)(S.check,{size:13})}):(0,a.jsx)("span",{className:"integ-add",children:(0,a.jsx)(S.plus,{size:14})})]},e.name)})})}let nx={allow:["Allow","var(--accent)"],ask:["Ask","var(--warn)"],deny:["Deny","var(--danger)"]},nf={allow:"ask",ask:"deny",deny:"allow"},ng=[{id:1,label:"Write src/windows.jsx",kind:"write",risk:"low",expect:"allow"},{id:2,label:"Overwrite prod/secrets.env",kind:"write",risk:"high",expect:"deny"},{id:3,label:"Run `npm test`",kind:"command",risk:"low",expect:"allow"},{id:4,label:"Run `kubectl apply` → prod",kind:"command",risk:"high",expect:"ask"},{id:5,label:"Open pull request #142",kind:"git",risk:"low",expect:"allow"},{id:6,label:"Email the customer",kind:"mail",risk:"low",expect:"ask"}],nv=[["Developer","Codes, reviews diffs, runs tests, opens PRs"],["Product Owner","Searches docs, drafts Jira tickets, plans releases"],["Designer","Explores UI options, reviews flows, writes specs"]],nj=[["calendar","Calendar","automations"],["mail","Mail","bell"],["jira","Jira","review"],["docs","Docs","files"]];function ny(e){let{policy:t,setPolicy:n}=e;return(0,a.jsxs)("div",{className:"pol",children:[(0,a.jsx)("div",{className:"pol-hint",children:"Rights an agent inherits when Keiko governs. Tap a decision to cycle through Allow → Ask → Deny."}),t.map(e=>{let t=nx[e.decision];return(0,a.jsxs)("div",{className:"pol-row",children:[(0,a.jsxs)("div",{className:"pol-text",children:[(0,a.jsx)("span",{className:"pol-action",children:e.action}),(0,a.jsx)("span",{className:"pol-scope mono",children:e.scope})]}),(0,a.jsx)("button",{type:"button",className:"pol-dec",style:{color:t[1],borderColor:t[1]},onClick:()=>{let t;return t=e.id,n(e=>e.map(e=>e.id===t?{...e,decision:nf[e.decision]}:e))},children:t[0]})]},e.id)})]})}function nw(e){let{decide:t}=e,[n,l]=(0,i.useState)(!1),s=ng.map(e=>{let n=t(e.kind,e.risk);return{...e,actual:n,pass:n===e.expect}}),r=s.filter(e=>e.pass).length;return(0,a.jsxs)("div",{className:"evl",children:[(0,a.jsxs)("div",{className:"evl-head",children:[(0,a.jsxs)("button",{type:"button",className:"evl-run",onClick:()=>l(!0),children:[(0,a.jsx)(S.spark,{size:13})," Run evaluation"]}),n&&(0,a.jsxs)("span",{className:"evl-score"+(r===s.length?" ok":""),children:[r,"/",s.length," passed"]})]}),(0,a.jsx)("div",{className:"evl-hint",children:"Mock scenarios against your policy before going autonomous."}),s.map(e=>(0,a.jsxs)("div",{className:"evl-row","data-state":n?e.pass?"pass":"fail":"idle",children:[(0,a.jsx)("span",{className:"evl-ico",children:n?e.pass?(0,a.jsx)(S.check,{size:13}):(0,a.jsx)(S.close,{size:13}):(0,a.jsx)("span",{className:"evl-dot"})}),(0,a.jsx)("span",{className:"evl-label",children:e.label}),n&&(0,a.jsx)("span",{className:"evl-res mono",style:{color:nx[e.actual][1]},children:nx[e.actual][0]})]},e.id))]})}function nb(e){let{memory:t,setMemory:n}=e,[l,s]=(0,i.useState)(""),r=()=>{let e=l.trim();""!==e&&(n(t=>[e,...t]),s(""))};return(0,a.jsxs)("div",{className:"mem",children:[(0,a.jsxs)("div",{className:"mem-add",children:[(0,a.jsx)("input",{value:l,onChange:e=>s(e.target.value),placeholder:"Teach Keiko something about you…",onKeyDown:e=>{"Enter"===e.key&&r()}}),(0,a.jsx)("button",{type:"button",onClick:r,"aria-label":"Add memory",children:(0,a.jsx)(S.plus,{size:15})})]}),t.map((e,t)=>(0,a.jsxs)("div",{className:"mem-row",children:[(0,a.jsx)(S.spark,{size:12}),(0,a.jsx)("span",{className:"mem-text",children:e}),(0,a.jsx)("button",{type:"button",className:"mem-x","aria-label":"Remove memory: ".concat(e),onClick:()=>n(e=>e.filter((e,n)=>n!==t)),children:(0,a.jsx)(S.close,{size:12})})]},"".concat(String(t),"-").concat(e)))]})}function nN(e){let{bridges:t,setBridges:n}=e;return(0,a.jsxs)("div",{className:"brg",children:[(0,a.jsx)("div",{className:"evl-hint",children:"What your twin can reach on your behalf."}),nj.map(e=>{let[l,s,i]=e,r=S[i],o=t[l];return(0,a.jsxs)("button",{type:"button",className:"brg-row","data-on":o,"aria-pressed":o,onClick:()=>n(e=>({...e,[l]:!e[l]})),children:[(0,a.jsx)("span",{className:"brg-ico",children:(0,a.jsx)(r,{size:16})}),(0,a.jsx)("span",{className:"brg-name",children:s}),(0,a.jsx)("span",{className:"brg-tg"+(o?" on":""),children:(0,a.jsx)("span",{})})]},l)})]})}function nk(e){let{persona:t,setPersona:n}=e;return(0,a.jsxs)("div",{className:"prs",children:[(0,a.jsx)("div",{className:"evl-hint",children:"Keiko adapts behaviour & tools to who is at the wheel."}),nv.map(e=>{let[l,s]=e;return(0,a.jsxs)("button",{type:"button",className:"prs-row","data-on":t===l,"aria-pressed":t===l,onClick:()=>n(l),children:[(0,a.jsx)("span",{className:"prs-dot"}),(0,a.jsxs)("span",{className:"prs-text",children:[(0,a.jsx)("span",{className:"prs-name",children:l}),(0,a.jsx)("span",{className:"prs-desc",children:s})]}),t===l&&(0,a.jsx)(S.check,{size:14,style:{color:"var(--accent)"}})]},l)})]})}let nS=[["policy","Policy"],["eval","EVAL"],["memory","Memory"],["bridges","Connections"],["persona","Persona"]];function nC(){let e=b(),[t,n]=(0,i.useState)("policy");return(0,a.jsxs)("div",{className:"twin",children:[(0,a.jsxs)("div",{className:"twin-hero",children:[(0,a.jsx)("img",{className:"twin-orca",src:"/assets/keiko-logo.svg",alt:""}),(0,a.jsxs)("div",{className:"twin-id",children:[(0,a.jsx)("span",{className:"twin-name",children:"Keiko — Digital Twin"}),(0,a.jsxs)("span",{className:"twin-sub mono",children:["mirroring \xb7 ",e.persona]})]}),(0,a.jsx)("span",{className:"twin-mode "+("autonomous"===e.mode?"on":""),children:"autonomous"===e.mode?"Autonomous":"Manual"})]}),(0,a.jsx)("div",{className:"twin-tabs",children:nS.map(e=>{let[l,s]=e;return(0,a.jsx)("button",{type:"button",className:"twin-tab","data-on":t===l,onClick:()=>n(l),children:s},l)})}),(0,a.jsxs)("div",{className:"twin-body",children:["policy"===t&&(0,a.jsx)(ny,{policy:e.policy,setPolicy:e.setPolicy}),"eval"===t&&(0,a.jsx)(nw,{decide:e.decide}),"memory"===t&&(0,a.jsx)(nb,{memory:e.memory,setMemory:e.setMemory}),"bridges"===t&&(0,a.jsx)(nN,{bridges:e.bridges,setBridges:e.setBridges}),"persona"===t&&(0,a.jsx)(nk,{persona:e.persona,setPersona:e.setPersona})]})]})}function nM(e){var t;let{model:n}=e;return(0,a.jsxs)("div",{className:"ml-row",children:[(0,a.jsx)("span",{className:"ml-ico",children:(0,a.jsx)(S.cube,{size:16})}),(0,a.jsxs)("div",{className:"ml-info",children:[(0,a.jsxs)("div",{className:"ml-top",children:[(0,a.jsx)("span",{className:"ml-name",children:n.id}),(0,a.jsx)("span",{className:"ml-type mono",children:"ocr-vision"===(t=n.kind)?"OCR":t})]}),(0,a.jsxs)("div",{className:"ml-url mono",children:["tools ",n.toolCalling?"yes":"no"," \xb7 structured"," ",n.structuredOutput?"yes":"no"," \xb7 ",n.costClass,"/",n.latencyClass]})]}),(0,a.jsx)("span",{className:"ml-status "+("chat"===n.kind?"connected":"untested"),title:n.kind})]})}let nz="keiko.wallpaper.opacity";function nE(){let e=window.localStorage.getItem(nz);if(null===e)return 100;let t=Number.parseInt(e,10);return Number.isFinite(t)?Math.max(0,Math.min(100,t)):100}function nP(){let[e,t]=(0,i.useState)(nE);(0,i.useEffect)(()=>{try{window.localStorage.setItem(nz,String(e))}catch(e){}window.dispatchEvent(new CustomEvent("keiko:wallpaper-opacity",{detail:e}))},[e]);let n={"--p":"".concat(String(e),"%")};return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("div",{className:"set-sec-h",children:(0,a.jsxs)("div",{children:[(0,a.jsx)("div",{className:"set-sec-t",children:"Workspace wallpaper"}),(0,a.jsx)("div",{className:"set-sec-d",children:"Liquid Chrome — a subtle metallic flow behind the grid that reacts to your cursor and clicks. Set to 0 % for the plain workspace background."})]})}),(0,a.jsxs)("div",{className:"gpref",children:[(0,a.jsxs)("div",{className:"gpref-row",children:[(0,a.jsx)("label",{className:"gpref-label",htmlFor:"wp-op",children:"Wallpaper opacity"}),(0,a.jsxs)("span",{className:"gpref-val mono",children:[e,"%"]})]}),(0,a.jsx)("input",{id:"wp-op",className:"gpref-slider",type:"range",min:0,max:100,step:1,value:e,onChange:e=>t(Number.parseInt(e.target.value,10)),style:n,"aria-label":"Wallpaper opacity"}),(0,a.jsxs)("div",{className:"gpref-scale",children:[(0,a.jsx)("span",{children:"Off"}),(0,a.jsx)("span",{children:"Full"})]})]})]})}function nR(){let[e,t]=(0,i.useState)("models"),[n,l]=(0,i.useState)([]),[s,r]=(0,i.useState)(!1),[o,c]=(0,i.useState)(!0),[d,u]=(0,i.useState)(),[m,p]=(0,i.useState)(!1);(0,i.useEffect)(()=>{let e=!1;return async function(){c(!0),u(void 0);try{let[t,n]=await Promise.all([G(),Z()]);if(e)return;r(t.configPresent),l(n.models)}catch(t){if(e)return;u(t instanceof Error?t.message:"Could not load gateway settings.")}finally{e||c(!1)}}(),()=>{e=!0}},[]);let h=n.filter(e=>"chat"===e.kind).length,x=s&&n.length>0;return(0,a.jsxs)("div",{className:"set",children:[(0,a.jsxs)("div",{className:"set-hero",children:[(0,a.jsx)(S.settings,{size:18}),(0,a.jsx)("span",{className:"set-title",children:"Settings"}),(0,a.jsxs)("span",{className:"set-onprem",title:"Runs inside your network",children:[(0,a.jsx)("span",{className:"dot",style:{background:"var(--accent)"}})," Self-hosted"]})]}),(0,a.jsx)("div",{className:"set-tabs",children:["models","general","security"].map(n=>(0,a.jsx)("button",{type:"button",className:"set-tab","data-on":e===n,onClick:()=>t(n),children:"models"===n?"Local Models":"general"===n?"General":"Security"},n))}),(0,a.jsxs)("div",{className:"set-body",children:["models"===e&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)("div",{className:"set-sec-h",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("div",{className:"set-sec-t",children:"Model gateway"}),(0,a.jsx)("div",{className:"set-sec-d",children:"Credentials are stored locally by the Keiko loopback server; secrets are never returned to the browser."})]}),(0,a.jsxs)("button",{type:"button",className:"set-add",onClick:()=>p(!0),children:[(0,a.jsx)(S.plus,{size:14}),x?"Update credentials":"Connect gateway"]})]}),(0,a.jsxs)("div",{className:"ml-row",children:[(0,a.jsx)("span",{className:"ml-ico",children:(0,a.jsx)(S.cube,{size:16})}),(0,a.jsxs)("div",{className:"ml-info",children:[(0,a.jsxs)("div",{className:"ml-top",children:[(0,a.jsx)("span",{className:"ml-name",children:x?"Gateway connected":"Gateway setup required"}),(0,a.jsxs)("span",{className:"ml-type mono",children:[n.length.toString()," models"]}),(0,a.jsxs)("span",{className:"ml-type mono",children:[h.toString()," chat"]})]}),(0,a.jsx)("div",{className:"ml-url mono",children:x?"Keiko can use the configured gateway models for chat and agent workflows.":"Enter the gateway base URL and API token before using chat or agent workflows."})]}),(0,a.jsx)("span",{className:"ml-status "+(x?"connected":"untested"),title:x?"connected":"setup required"})]}),void 0!==d?(0,a.jsx)("div",{className:"gw-error",children:d}):null,o?(0,a.jsx)("div",{className:"set-placeholder",children:"Loading gateway models..."}):0===n.length?(0,a.jsx)("div",{className:"set-placeholder",children:"No models are configured yet. Connect the gateway to load configured model capabilities."}):(0,a.jsx)("div",{className:"set-list",children:n.map(e=>(0,a.jsx)(nM,{model:e},e.id))}),m?(0,a.jsx)(eU,{onCancel:()=>p(!1)}):null]}),"general"===e&&(0,a.jsx)(nP,{}),"security"===e&&(0,a.jsx)("div",{className:"set-placeholder",children:"SSO \xb7 audit log \xb7 data residency — coming soon."})]})]})}function nT(e,t){let n=e[t];return"string"==typeof n?n:void 0}eA("project",()=>(0,a.jsx)(tr,{})),eA("search",()=>(0,a.jsx)(tu,{})),eA("plugins",()=>(0,a.jsx)(tx,{})),eA("automations",()=>(0,a.jsx)(tw,{})),eA("mobile",()=>(0,a.jsx)(tb,{})),eA("inspector",()=>(0,a.jsx)(tN,{})),eA("notifications",()=>(0,a.jsx)(tS,{})),eA("resources",()=>(0,a.jsx)(tC,{})),eA("activity",()=>(0,a.jsx)(tE,{})),eA("keiko",()=>(0,a.jsx)(nC,{})),eA("settings",()=>(0,a.jsx)(nR,{})),eA("files",(e,t)=>{let n=nT(e,"root"),l=(e,n)=>{t.updateCfg({activeFilePath:null!=e?e:void 0,resolvedRoot:null!=n?n:void 0})};return void 0!==n?(0,a.jsx)(tW,{root:n,onActiveFileChange:l}):(0,a.jsx)(tW,{onActiveFileChange:l})}),eA("editor",e=>{let t=nT(e,"file");return void 0!==t?(0,a.jsx)(tU,{file:t}):(0,a.jsx)(tU,{})}),eA("browser",e=>{let t=nT(e,"url");return void 0!==t?(0,a.jsx)(tZ,{url:t}):(0,a.jsx)(tZ,{})}),eA("terminal",e=>{let t=nT(e,"cwd"),n=nT(e,"projectPath"),l={};return void 0!==t&&(l.cwd=t),void 0!==n&&(l.projectPath=n),(0,a.jsx)(t3,{...l})}),eA("review",e=>{let t=nT(e,"runId");return void 0!==t&&""!==t?(0,a.jsx)(ns,{runId:t}):(0,a.jsx)(ns,{})}),eA("agents",(e,t)=>(0,a.jsx)(nm,{cfg:function(e){let t={},n=nT(e,"workflow");void 0!==n&&(t.workflow=n);let l=nT(e,"model");void 0!==l&&(t.model=l);let s=nT(e,"runId");void 0!==s&&(t.runId=s);let a=nT(e,"fingerprint");void 0!==a&&(t.fingerprint=a);let i=nT(e,"workspaceRoot");void 0!==i&&(t.workspaceRoot=i);let r=nT(e,"inputJson");void 0!==r&&(t.inputJson=r);let o=function(e,t){let n=e[t];return"boolean"==typeof n?n:void 0}(e,"keikoMode");void 0!==o&&(t.keikoMode=o);let c=function(e){let t=e.access;return"ask"===t||"full"===t?t:void 0}(e);return void 0!==c&&(t.access=c),t}(e),linkedRoot:t.linkedRoot,linkedFilePath:t.linkedFilePath})),eA("integ",e=>{let t=nT(e,"provider");return void 0!==t?(0,a.jsx)(nh,{provider:t}):(0,a.jsx)(nh,{})});let nA=["chat","files","editor","browser","terminal","review","agents","integ"],nL=["project","search","plugins","automations","mobile","inspector","activity","notifications","resources"];function nD(){var e,t;let{theme:n,toggle:l}=function(){let[e,t]=(0,i.useState)(e5),[n,l]=(0,i.useState)(!1);return(0,i.useEffect)(()=>{t(function(){try{let e=window.localStorage.getItem(e2);return"light"===e||"dark"===e?e:e5}catch(e){return e5}}()),l(!0)},[]),(0,i.useEffect)(()=>{if(n){"undefined"!=typeof document&&(document.documentElement.dataset.theme=e);try{window.localStorage.setItem(e2,e)}catch(e){}}},[e,n]),{theme:e,toggle:(0,i.useCallback)(()=>{t(e=>"light"===e?"dark":"light")},[])}}(),s=b(),r=function(){let[e,t]=(0,i.useState)(eg),[n,l]=(0,i.useState)(""),[s,a]=(0,i.useState)(!0),[r,o]=(0,i.useState)(!1),[c,d]=(0,i.useState)();(0,i.useEffect)(()=>{let e=!1;return async function(){a(!0),d(void 0);try{let n=await ev();e||t(e=>({...e,...n}))}catch(t){e||d(ex(t))}finally{e||a(!1)}}(),()=>{e=!0}},[]);let u=(0,i.useCallback)(e=>{t(t=>({...t,selectedModel:e}))},[]),m=(0,i.useCallback)(async n=>{d(void 0);try{var l,s;let a={modelId:e.selectedModel,title:eh},i=null!=(s=null==n?void 0:n.path)?s:null==(l=e.activeProject)?void 0:l.path;void 0!==i&&(a.projectPath=i);let r=await eo(a);t({projects:Array.from(r.projects),chats:ef(r.chats),messages:Array.from(r.messages),models:e.models,activeProject:r.project,activeChat:r.chat,selectedModel:r.chat.selectedModel})}catch(e){d(ex(e))}},[e.selectedModel,e.activeProject,e.models]),p=(0,i.useCallback)(async e=>{d(void 0),t(t=>({...t,activeProject:e}));try{let n=await ei(e.path),l=ef(n.chats),s=l[0];if(void 0===s)return void await m(e);let a=await er(s.id,e.path);t(e=>({...e,chats:l,activeChat:s,selectedModel:s.selectedModel,messages:Array.from(a.messages)}))}catch(e){d(ex(e))}},[m]),h=(0,i.useCallback)(async e=>{d(void 0);try{let n=await er(e.id,e.projectPath);t(t=>{let l=t.projects.find(t=>t.path===e.projectPath);return{...t,activeProject:l,activeChat:e,selectedModel:e.selectedModel,messages:Array.from(n.messages)}})}catch(e){d(ex(e))}},[]),x=(0,i.useCallback)(async e=>{let n=e.trim();if(0!==n.length){d(void 0);try{let e=await ea({path:n}),l=await es();t(e=>({...e,projects:Array.from(l.projects)})),await m(e.project)}catch(e){d(ex(e))}}},[m]),f=(0,i.useCallback)(async()=>{let s=n.trim(),a=e.activeChat,i=e.activeProject;if(0===s.length||void 0===a||void 0===i)return;let r={id:"local-".concat(String(Date.now())),chatId:a.id,role:"user",content:s,timestamp:Date.now()};l(""),o(!0),d(void 0),t(e=>({...e,messages:[...e.messages,r]}));try{let n=await ec({chatId:a.id,projectPath:i.path,content:s,modelId:e.selectedModel});t(e=>({...e,activeChat:n.chat,chats:ef([n.chat,...e.chats.filter(e=>e.id!==n.chat.id)]),messages:[...e.messages.filter(e=>e.id!==r.id),...Array.from(n.messages)]}))}catch(e){d(ex(e));try{let e=await er(a.id,i.path);t(t=>({...t,messages:Array.from(e.messages)}))}catch(e){t(e=>({...e,messages:e.messages.filter(e=>e.id!==r.id)}))}}finally{o(!1)}},[n,e.activeChat,e.activeProject,e.selectedModel]);return{projects:e.projects,chats:e.chats,messages:e.messages,models:e.models,activeProject:e.activeProject,activeChat:e.activeChat,selectedModel:e.selectedModel,draft:n,loading:s,sending:r,error:c,setDraft:l,setSelectedModel:u,openNewChat:m,openProject:p,openChat:h,addProject:x,sendMessage:f}}(),c=(0,i.useRef)(null),d=function(e){var t,n,l,s,a,r;let[o,c]=(0,i.useState)(null),[d,u]=(0,i.useState)(null),[m,p]=(0,i.useState)(!1),[h,x]=(0,i.useState)([]),[f,g]=(0,i.useState)(null),[v,j]=(0,i.useState)(te),y=(0,i.useRef)(3),w=(0,i.useRef)(null),b=(0,i.useRef)([]);b.current=null!=o?o:[];let N=(0,i.useRef)([]);N.current=h;let k=(0,i.useRef)(null);k.current=f;let S=(0,i.useRef)(null),C=(0,i.useRef)(()=>void 0),{viewRef:M,worldVP:z,zoomTo:E,resetView:P,panBy:R,rect:T}=function(e){let{wsRef:t,view:n,setView:l}=e,s=(0,i.useRef)(n);s.current=n,(0,i.useEffect)(()=>{ts(e9,n)},[n]),(0,i.useEffect)(()=>{let e=t.current;if(null===e)return;let n=t=>{if(t.metaKey||t.ctrlKey){t.preventDefault();let n=e.getBoundingClientRect(),a=s.current,i=tt(a.zoom*Math.exp(-(.0015*t.deltaY))),r=(t.clientX-n.left-a.x)/a.zoom,o=(t.clientY-n.top-a.y)/a.zoom;l({zoom:i,x:t.clientX-n.left-r*i,y:t.clientY-n.top-o*i});return}let n=t.target;n instanceof Element&&null!==n.closest(".window")||(t.preventDefault(),l(e=>({...e,x:e.x-t.deltaX,y:e.y-t.deltaY})))};return e.addEventListener("wheel",n,{passive:!1}),()=>{e.removeEventListener("wheel",n)}},[t,l]);let a=(0,i.useCallback)(()=>null===t.current?null:t.current.getBoundingClientRect(),[t]),r=(0,i.useCallback)(()=>{let e=a();if(null===e)return null;let t=s.current;return{x:-t.x/t.zoom,y:-t.y/t.zoom,w:e.width/t.zoom,h:e.height/t.zoom}},[a]),o=(0,i.useCallback)(e=>{let t=a();if(null===t)return;let n=s.current,i=t.width/2,r=t.height/2,o=(i-n.x)/n.zoom,c=(r-n.y)/n.zoom,d=tt(e);l({zoom:d,x:i-o*d,y:r-c*d})},[a,l]);return{viewRef:s,worldVP:r,zoomTo:o,resetView:(0,i.useCallback)(()=>l({zoom:1,x:0,y:0}),[l]),panBy:(0,i.useCallback)((e,t)=>l(n=>({...n,x:n.x+e,y:n.y+t})),[l]),rect:a}}({wsRef:e,view:v,setView:j});!function(e){let{wsRef:t,setWins:n,setConns:l,zc:s}=e;(0,i.useLayoutEffect)(()=>{let e=t.current;if(null===e)return;let a=e.getBoundingClientRect(),i=null;try{i=function(e){if(null===e)return null;try{let t=JSON.parse(e);if(Array.isArray(t)&&t.length>0)return t}catch(e){}return null}(window.localStorage.getItem(e8))}catch(e){i=null}null===i&&(i=function(e,t){let n=Math.round((e-28-14)*.54),l=e-28-14-n,s=Math.round((t-28-14)*.52);return[{id:"chat-0",type:"chat",x:14,y:14,w:n,h:t-28,z:3,cfg:{},max:!1,zoom:1},{id:"files-0",type:"files",x:14+n+14,y:14,w:l,h:s,z:2,cfg:{},max:!1,zoom:1},{id:"term-0",type:"terminal",x:14+n+14,y:14+s+14,w:l,h:t-28-s-14,z:1,cfg:{},max:!1,zoom:1}]}(a.width,a.height)),s.current=Math.max(1,...i.map(e=>e.z)),n(i);try{l(function(e){if(null===e)return[];try{let t=JSON.parse(e);if(Array.isArray(t))return t}catch(e){}return[]}(window.localStorage.getItem(e7)))}catch(e){}},[t,n,l,s])}({wsRef:e,setWins:c,setConns:x,zc:y}),(0,i.useEffect)(()=>{ts(e7,h)},[h]),(0,i.useEffect)(()=>{null!==o&&x(e=>{let t=e.filter(e=>void 0!==o.find(t=>t.id===e.a)&&void 0!==o.find(t=>t.id===e.b));return t.length===e.length?e:t})},[o,x]),(0,i.useEffect)(()=>{null!==o&&ts(e8,o)},[o]),function(e){let{setWins:t,rect:n,cancelConnectRef:l}=e;(0,i.useEffect)(()=>{let e=e=>{var s,a,i;if(null!==(s=document.activeElement)&&("INPUT"===s.tagName||"TEXTAREA"===s.tagName||"SELECT"===s.tagName))return;if("Escape"===e.key)return void l.current();if((e.metaKey||e.ctrlKey)&&["=","+","-","_","0"].includes(e.key)){e.preventDefault(),a=e.key,t(e=>{var t,n;if(null===e||0===e.length)return e;let l=tl(e),s=(n=null!=(t=l.zoom)?t:1,"0"===a?1:"-"===a||"_"===a?tn(n-.1):tn(n+.1));return e.map(e=>e.id===l.id?{...e,zoom:s}:e)});return}if(!/^Arrow/.test(e.key))return;let r=e.metaKey||e.ctrlKey,o=e.altKey;if(!r&&!o)return;e.preventDefault();let c=n();null!==c&&(i={key:e.key,shift:e.shiftKey},t(e=>{if(null===e||0===e.length)return e;let t=tl(e),n=o?function(e,t,n){let l=n.shift?1:16,s=e.w,a=e.h;"ArrowRight"===n.key?s+=l:"ArrowLeft"===n.key?s-=l:"ArrowDown"===n.key?a+=l:"ArrowUp"===n.key&&(a-=l);let i=eL[e.type].min;return s=Math.max(i.w,Math.min(t.width,s)),a=Math.max(i.h,Math.min(t.height,a)),{x:e.x,y:e.y,w:s,h:a}}(t,c,i):function(e,t,n){let l=n.shift?1:16,s=e.x,a=e.y;return"ArrowRight"===n.key?s+=l:"ArrowLeft"===n.key?s-=l:"ArrowDown"===n.key?a+=l:"ArrowUp"===n.key&&(a-=l),{x:s=Math.max(-(e.w-120),Math.min(t.width-120,s)),y:a=Math.max(0,Math.min(t.height-38,a)),w:e.w,h:e.h}}(t,c,i);return e.map(e=>e.id===t.id?{...e,...n,max:!1}:e)}))};return window.addEventListener("keydown",e),()=>{window.removeEventListener("keydown",e)}},[t,n,l])}({setWins:c,rect:T,cancelConnectRef:C}),function(e){let{wsRef:t,viewRef:n,setWins:l}=e;(0,i.useEffect)(()=>{let e=t.current;if(null===e||"undefined"==typeof ResizeObserver)return;let s=new ResizeObserver(()=>{let t=e.getBoundingClientRect(),s=n.current,a={x:-s.x/s.zoom,y:-s.y/s.zoom,w:t.width/s.zoom,h:t.height/s.zoom};l(e=>null===e?e:e.map(e=>e.max?{...e,x:a.x,y:a.y,w:a.w,h:a.h}:e))});return s.observe(e),()=>{s.disconnect()}},[t,n,l])}({wsRef:e,viewRef:M,setWins:c});let{update:A,focus:L,close:D,maximize:F,add:I,toggleTool:O}={update:(n=(t={setWins:c,zc:y,worldVP:z}).setWins,(e,t)=>n(n=>null===n?n:n.map(n=>n.id===e?{...n,...t}:n))),focus:(l=t.setWins,s=t.zc,e=>l(t=>null===t?t:t.map(t=>t.id===e?{...t,z:++s.current}:t))),close:(a=t.setWins,e=>a(t=>null===t?t:t.filter(t=>t.id!==e))),maximize:function(e){let{setWins:t,zc:n,worldVP:l}=e;return e=>t(t=>{if(null===t)return t;let s=l();return null===s?t:t.map(t=>t.id!==e?t:t.max&&void 0!==t.prev?{...t,x:t.prev.x,y:t.prev.y,w:t.prev.w,h:t.prev.h,max:!1,z:++n.current}:{...t,max:!0,prev:{x:t.x,y:t.y,w:t.w,h:t.h},x:s.x,y:s.y,w:s.w,h:s.h,z:++n.current})})}(t),add:function(e){let{setWins:t,zc:n,worldVP:l}=e;return(e,s)=>{let a=eL[e],i=null;return t(t=>{let r=l();if(null===r)return t;let o=null!=t?t:[];if(!0===a.singleton){let t=o.find(t=>t.type===e);if(void 0!==t)return i=t.id,o.map(e=>e.id===t.id?{...e,z:++n.current}:e)}let{x:c,y:d}=e3(r,a.w,a.h,o.length,40),u=!0===a.singleton?e:"".concat(e,"-").concat(Date.now().toString(36));return i=u,[...o,{id:u,type:e,x:c,y:d,w:a.w,h:a.h,z:++n.current,cfg:null!=s?s:{},max:!1,zoom:1}]}),i}}(t),toggleTool:function(e){let{setWins:t,zc:n,worldVP:l}=e;return e=>{let s=eL[e];t(t=>{let a=l();if(null===a)return t;let i=null!=t?t:[];if(void 0!==i.find(t=>t.type===e))return i.filter(t=>t.type!==e);let{x:r,y:o}=e3(a,s.w,s.h,i.length,28);return[...i,{id:e,type:e,x:r,y:o,w:s.w,h:s.h,z:++n.current,cfg:{},max:!1,zoom:1}]})}}(t)},{tileAll:W,splitFront:K,cascade:U}={tileAll:function(e){let{setWins:t,worldVP:n}=e;return()=>t(e=>{if(null===e||0===e.length)return e;let t=n();if(null===t)return e;let l=e.length,s=Math.ceil(Math.sqrt(l)),a=Math.ceil(l/s),i=(t.w-12*(s+1))/s,r=(t.h-12*(a+1))/a;return e.map((e,n)=>{let l=Math.floor(n/s);return{...e4(e),max:!1,x:t.x+12+n%s*(i+12),y:t.y+12+l*(r+12),w:i,h:r}})})}(r={setWins:c,worldVP:z}),splitFront:function(e){let{setWins:t,worldVP:n}=e;return()=>t(e=>{if(null===e||0===e.length)return e;let t=n();if(null===t)return e;let l=[...e].sort((e,t)=>t.z-e.z).slice(0,2).map(e=>e.id);return e.map(e=>{let n=l.indexOf(e.id);return 0===n?{...e4(e),max:!1,x:t.x,y:t.y,w:t.w/2,h:t.h}:1===n?{...e4(e),max:!1,x:t.x+t.w/2,y:t.y,w:t.w/2,h:t.h}:e})})}(r),cascade:function(e){let{setWins:t,worldVP:n}=e;return()=>t(e=>{if(null===e)return e;let t=n();return null===t?e:e.map((e,n)=>({...e4(e),max:!1,x:t.x+24+30*n,y:t.y+24+30*n,w:Math.min(560,t.w-80),h:Math.min(420,t.h-80),z:n+1}))})}(r)},{setSnap:B,commitSnap:q}=function(e){let{setSnapPrev:t,snapZone:n,worldVP:l,update:s}=e;return{setSnap:e=>{if(n.current=e,null===e)return void t(null);let s=l();null!==s&&t(V(s)[e])},commitSnap:e=>{let a=n.current;if(n.current=null,t(null),null===a)return;let i=l();if(null===i)return;let r={...V(i)[a],max:"maxi"===a};"maxi"===a&&(r.prev={x:i.x+40,y:i.y+40,w:480,h:360}),s(e,r)}}}({setSnapPrev:u,snapZone:w,worldVP:z,update:A}),{startConnect:J,confirmConnect:Y,cancelConnect:H,removeConn:X,connect:G,linkedFilesRoot:Z,linkedFilesContext:Q,currentFilesContext:$}=function(e){let{wsRef:t,viewRef:n,winsRef:l,connsRef:s,connectingRef:a,connectCleanupRef:i,focus:r,setConns:o,setConnecting:c}=e,d=()=>{null!==i.current&&(i.current(),i.current=null),a.current=null,c(null)},u=e=>{if("files"!==e.type)return null;let t=e.cfg.resolvedRoot,n=e.cfg.root,l="string"==typeof t&&t.length>0?t:"string"==typeof n&&n.length>0?n:"src",s=e.cfg.activeFilePath;return{id:e.id,root:l,..."string"==typeof s&&s.length>0?{activeFilePath:s}:{}}},m=e=>{for(let t of s.current){let n=t.a===e?t.b:t.b===e?t.a:null;if(null===n)continue;let s=l.current.find(e=>e.id===n);if(void 0!==s)return u(s)}return null};return{startConnect:(e,l)=>{if(l.preventDefault(),l.stopPropagation(),null!==a.current&&a.current.from===e)return void d();let s=t.current;if(null===s)return;let r=s.getBoundingClientRect(),o=n.current,u=e=>(e-r.left-o.x)/o.zoom,m=e=>(e-r.top-o.y)/o.zoom;null!==i.current&&(i.current(),i.current=null);let p={from:e,x:u(l.clientX),y:m(l.clientY)};a.current=p,c(p);let h=t=>{let n={from:e,x:u(t.clientX),y:m(t.clientY)};a.current=n,c(n)};window.addEventListener("pointermove",h),i.current=()=>{window.removeEventListener("pointermove",h)}},confirmConnect:(e,t)=>{t.preventDefault(),t.stopPropagation();let n=a.current;if(null===n)return;let s=l.current,i=s.find(e=>e.id===n.from),c=s.find(t=>t.id===e);void 0!==i&&void 0!==c&&_(i.type,c.type)&&(o(t=>e6(t,n.from,e)?t:[...t,{id:"".concat(n.from,"~").concat(e),a:n.from,b:e}]),r(e)),d()},cancelConnect:d,removeConn:e=>o(t=>t.filter(t=>t.id!==e)),connect:(e,t)=>{let n=l.current,s=n.find(t=>t.id===e),a=n.find(e=>e.id===t);void 0!==s&&void 0!==a&&_(s.type,a.type)&&o(n=>e6(n,e,t)?n:[...n,{id:"".concat(e,"~").concat(t),a:e,b:t}])},linkedFilesRoot:e=>{var t,n;return null!=(n=null==(t=m(e))?void 0:t.root)?n:null},linkedFilesContext:m,currentFilesContext:()=>{var e;let t=l.current.map(e=>u(e)).filter(e=>null!==e);if(1===t.length)return null!=(e=t[0])?e:null;let n=[...l.current].filter(e=>"files"===e.type).sort((e,t)=>t.z-e.z)[0];return void 0===n?null:u(n)}}}({wsRef:e,viewRef:M,winsRef:b,connsRef:N,connectingRef:k,connectCleanupRef:S,focus:L,setConns:x,setConnecting:g});return C.current=H,(0,i.useEffect)(()=>()=>{null!==S.current&&(S.current(),S.current=null)},[]),{wins:o,snapPrev:d,palOpen:m,setPalOpen:p,conns:h,connecting:f,view:v,api:{add:I,toggleTool:O,focus:L,close:D,maximize:F,update:A,setSnap:B,commitSnap:q,tileAll:W,splitFront:K,cascade:U,startConnect:J,confirmConnect:Y,cancelConnect:H,removeConn:X,connect:G,linkedFilesRoot:Z,linkedFilesContext:Q,currentFilesContext:$,zoomTo:E,resetView:P,panBy:R,rect:T}}}(c),[u,m]=(0,i.useState)(!1),[p,h]=(0,i.useState)(null),[x,f]=(0,i.useState)(!1),g=null!=(t=null==(e=d.wins)?void 0:e.length)?t:0,v=function(e){if(null===e||0===e.length)return null;let t=e[0];for(let n=1;n<e.length;n++){let l=e[n];l.z>t.z&&(t=l)}return t}(d.wins),j=(0,i.useMemo)(()=>(function(e){if(null===e)return new Set;let t=new Set;for(let n of e)!0===eL[n.type].tool&&t.add(n.type);return t})(d.wins),[d.wins]),y=(0,i.useMemo)(()=>{var e;return{wins:null!=(e=d.wins)?e:[],active:v,winCount:g}},[d.wins,v,g]),w=(0,i.useCallback)(()=>m(!0),[]),k=(0,i.useCallback)(()=>m(!1),[]),S=(0,i.useCallback)(e=>{m(!1),h(e)},[]),M=(0,i.useCallback)(e=>{h(t=>{if(null!==t){let{__connectFilesId:n,...l}=e,s=d.api.add(t,l);"agents"===t&&null!==s&&"string"==typeof n&&n.length>0&&d.api.connect(s,n)}return null})},[d.api]),z=(0,i.useCallback)(()=>h(null),[]),E=(0,i.useCallback)(()=>f(!1),[]),P=(0,i.useCallback)(e=>{e in eL&&d.api.toggleTool(e)},[d.api]),R=(0,i.useCallback)(()=>S("chat"),[S]);(0,i.useEffect)(()=>{let e=e=>{(e.metaKey||e.ctrlKey)&&("k"===e.key||"K"===e.key)&&(e.preventDefault(),f(e=>!e))};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[]);let T=(0,i.useMemo)(()=>(function(e,t,n,l){let s=[];for(let e of nA){let n=eL[e];s.push({id:"new-".concat(e),label:"New ".concat(n.title),group:"Create",icon:n.icon,run:()=>t(e)})}for(let t of nL){let n=eL[t];s.push({id:"open-".concat(t),label:"Open ".concat(n.title),group:"Tools",icon:n.icon,run:()=>e.toggleTool(t)})}return s.push({id:"tile",label:"Tile all windows",group:"Layout",icon:"tile",run:e.tileAll}),s.push({id:"split",label:"Split front windows",group:"Layout",icon:"split",run:e.splitFront}),s.push({id:"cascade",label:"Cascade windows",group:"Layout",icon:"cascade",run:e.cascade}),s.push({id:"theme",label:"Toggle light / dark theme",group:"View",icon:"light"===n?"moon":"sun",run:l}),s})(d.api,S,n,l),[d.api,S,n,l]),A=!r.loading&&0===r.models.length,D=u?(0,a.jsx)(e1,{types:eL,order:nA,onAdd:S,onClose:k}):null;return(0,a.jsx)(o,{value:r,children:(0,a.jsx)(N.Provider,{value:y,children:(0,a.jsxs)("div",{className:"app",children:[(0,a.jsx)(L,{mode:s.mode,onModeChange:s.setMode,openPalette:w,onTileAll:d.api.tileAll,onSplitFront:d.api.splitFront,onCascade:d.api.cascade}),(0,a.jsxs)("div",{className:"mid",children:[(0,a.jsx)(O,{openTools:j,onTool:P,onNewChat:R,theme:n,onToggleTheme:l}),(0,a.jsx)("div",{className:"stage",children:(0,a.jsx)(eW,{ws:d,wsRef:c,openPalette:w,palette:D})}),(0,a.jsx)(K,{openTools:j,onTool:P})]}),(0,a.jsx)(C,{winCount:g,mode:s.mode}),null!==p&&(0,a.jsx)(e0,{type:p,types:eL,filesContext:d.api.currentFilesContext(),onConfirm:M,onClose:z}),x&&(0,a.jsx)(eK,{commands:T,onClose:E}),A?(0,a.jsx)(eU,{}):null]})})})}function nF(){let[e,t]=(0,i.useState)(!1);return((0,i.useEffect)(()=>{t(!0)},[]),e)?(0,a.jsx)(w,{children:(0,a.jsx)(nD,{})}):(0,a.jsx)("div",{className:"app","aria-hidden":"true"})}function nI(){return(0,a.jsx)(nF,{})}}}]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
<!DOCTYPE html><!--
|
|
1
|
+
<!DOCTYPE html><!--vHP365Z8U38dG6vdAzGnl--><html lang="en"><head><meta charSet="utf-8"/><meta name="viewport" content="width=device-width, initial-scale=1"/><link rel="stylesheet" href="/_next/static/css/3f36649d8ca8f3e7.css" data-precedence="next"/><link rel="preload" as="script" fetchPriority="low" href="/_next/static/chunks/webpack-4a462cecab786e93.js"/><script src="/_next/static/chunks/4bd1b696-c023c6e3521b1417.js" async=""></script><script src="/_next/static/chunks/255-d47fd57964443afe.js" async=""></script><script src="/_next/static/chunks/main-app-e8144a306630b76d.js" async=""></script><script src="/_next/static/chunks/44-ee3006ace87402b4.js" async=""></script><script src="/_next/static/chunks/app/page-2006f21df58c2bb9.js" async=""></script><title>Keiko</title><meta name="description" content="Keiko local developer-assist workspace."/><script src="/_next/static/chunks/polyfills-42372ed130431b0a.js" noModule=""></script></head><body><div hidden=""><!--$--><!--/$--></div><div class="app" aria-hidden="true"></div><!--$--><!--/$--><script src="/_next/static/chunks/webpack-4a462cecab786e93.js" id="_R_" async=""></script><script>(self.__next_f=self.__next_f||[]).push([0])</script><script>self.__next_f.push([1,"1:\"$Sreact.fragment\"\n2:I[9766,[],\"\"]\n3:I[8924,[],\"\"]\n4:I[1959,[],\"ClientPageRoot\"]\n5:I[8534,[\"44\",\"static/chunks/44-ee3006ace87402b4.js\",\"974\",\"static/chunks/app/page-2006f21df58c2bb9.js\"],\"KeikoDesktop\"]\n8:I[4431,[],\"OutletBoundary\"]\na:I[5278,[],\"AsyncMetadataOutlet\"]\nc:I[4431,[],\"ViewportBoundary\"]\ne:I[4431,[],\"MetadataBoundary\"]\nf:\"$Sreact.suspense\"\n11:I[7150,[],\"\"]\n:HL[\"/_next/static/css/3f36649d8ca8f3e7.css\",\"style\"]\n"])</script><script>self.__next_f.push([1,"0:{\"P\":null,\"b\":\"vHP365Z8U38dG6vdAzGnl\",\"p\":\"\",\"c\":[\"\",\"\"],\"i\":false,\"f\":[[[\"\",{\"children\":[\"__PAGE__\",{}]},\"$undefined\",\"$undefined\",true],[\"\",[\"$\",\"$1\",\"c\",{\"children\":[[[\"$\",\"link\",\"0\",{\"rel\":\"stylesheet\",\"href\":\"/_next/static/css/3f36649d8ca8f3e7.css\",\"precedence\":\"next\",\"crossOrigin\":\"$undefined\",\"nonce\":\"$undefined\"}]],[\"$\",\"html\",null,{\"lang\":\"en\",\"children\":[\"$\",\"body\",null,{\"children\":[\"$\",\"$L2\",null,{\"parallelRouterKey\":\"children\",\"error\":\"$undefined\",\"errorStyles\":\"$undefined\",\"errorScripts\":\"$undefined\",\"template\":[\"$\",\"$L3\",null,{}],\"templateStyles\":\"$undefined\",\"templateScripts\":\"$undefined\",\"notFound\":[[[\"$\",\"title\",null,{\"children\":\"404: This page could not be found.\"}],[\"$\",\"div\",null,{\"style\":{\"fontFamily\":\"system-ui,\\\"Segoe UI\\\",Roboto,Helvetica,Arial,sans-serif,\\\"Apple Color Emoji\\\",\\\"Segoe UI Emoji\\\"\",\"height\":\"100vh\",\"textAlign\":\"center\",\"display\":\"flex\",\"flexDirection\":\"column\",\"alignItems\":\"center\",\"justifyContent\":\"center\"},\"children\":[\"$\",\"div\",null,{\"children\":[[\"$\",\"style\",null,{\"dangerouslySetInnerHTML\":{\"__html\":\"body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}\"}}],[\"$\",\"h1\",null,{\"className\":\"next-error-h1\",\"style\":{\"display\":\"inline-block\",\"margin\":\"0 20px 0 0\",\"padding\":\"0 23px 0 0\",\"fontSize\":24,\"fontWeight\":500,\"verticalAlign\":\"top\",\"lineHeight\":\"49px\"},\"children\":404}],[\"$\",\"div\",null,{\"style\":{\"display\":\"inline-block\"},\"children\":[\"$\",\"h2\",null,{\"style\":{\"fontSize\":14,\"fontWeight\":400,\"lineHeight\":\"49px\",\"margin\":0},\"children\":\"This page could not be found.\"}]}]]}]}]],[]],\"forbidden\":\"$undefined\",\"unauthorized\":\"$undefined\"}]}]}]]}],{\"children\":[\"__PAGE__\",[\"$\",\"$1\",\"c\",{\"children\":[[\"$\",\"$L4\",null,{\"Component\":\"$5\",\"searchParams\":{},\"params\":{},\"promises\":[\"$@6\",\"$@7\"]}],null,[\"$\",\"$L8\",null,{\"children\":[\"$L9\",[\"$\",\"$La\",null,{\"promise\":\"$@b\"}]]}]]}],{},null,false]},null,false],[\"$\",\"$1\",\"h\",{\"children\":[null,[[\"$\",\"$Lc\",null,{\"children\":\"$Ld\"}],null],[\"$\",\"$Le\",null,{\"children\":[\"$\",\"div\",null,{\"hidden\":true,\"children\":[\"$\",\"$f\",null,{\"fallback\":null,\"children\":\"$L10\"}]}]}]]}],false]],\"m\":\"$undefined\",\"G\":[\"$11\",[]],\"s\":false,\"S\":true}\n"])</script><script>self.__next_f.push([1,"6:{}\n7:\"$0:f:0:1:2:children:1:props:children:0:props:params\"\n"])</script><script>self.__next_f.push([1,"d:[[\"$\",\"meta\",\"0\",{\"charSet\":\"utf-8\"}],[\"$\",\"meta\",\"1\",{\"name\":\"viewport\",\"content\":\"width=device-width, initial-scale=1\"}]]\n9:null\n"])</script><script>self.__next_f.push([1,"b:{\"metadata\":[[\"$\",\"title\",\"0\",{\"children\":\"Keiko\"}],[\"$\",\"meta\",\"1\",{\"name\":\"description\",\"content\":\"Keiko local developer-assist workspace.\"}]],\"error\":null,\"digest\":\"$undefined\"}\n"])</script><script>self.__next_f.push([1,"10:\"$b:metadata\"\n"])</script></body></html>
|