@pixelbyte-software/pixcode 1.52.1 → 1.52.2

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.
@@ -217,7 +217,7 @@ import{j as i,a as qN,R as KN,o as YN,_ as D6,b as O6,T as ZN,P as XN,S as kc,E
217
217
  *
218
218
  * This source code is licensed under the ISC license.
219
219
  * See the LICENSE file in the root directory of this source tree.
220
- */const vD=[["rect",{width:"8",height:"8",x:"3",y:"3",rx:"2",key:"by2w9f"}],["path",{d:"M7 11v4a2 2 0 0 0 2 2h4",key:"xkn7yn"}],["rect",{width:"8",height:"8",x:"13",y:"13",rx:"2",key:"1cgmvn"}]],wD=jt("workflow",vD),L4=k4,kD=N7,lk=w7,SD=p7,D4=b7,CD=w4,Mn=N4,Go=o8,Fn=c8,ND=u8,mn=y7,zn=w4,su=S7,O4=f7,Ku=r8,Yu=a8,Ug=T7,at=S4,_t=S4,Zu=R7,ED=j7,TD=fP,tn=O8,wr=F8,Gt=e8,Wa=J7,M4=rP,Hr=LP,Cc=j4,AD=j4,ou=H7,No=m8,Cs=E4,us=x8,Eo=A8,Dr=I8,qr=K8,Bn=G8,ji=W8,jD=vP,ID=eP,$g=oP,Hg=AP,RD=P7,_D=V7,PD=qP,F4=A4,cf=bP,LD=Z8,df=A4,z4=kP,Ut=CP,Br=YP,B4=_8,ys=uP,Ct=I4,uf=I4,Nc=UP,Gg=z7,DD=M7,pf=D7,OD=L8,Un=C4,MD=C4,FD=XP,vs=QP,Vg=Y7,To=q7,Wg=g8,Ec=$8,qg=B8,xn=J8,Ii=E4,Tc=T4,zD=T4,U4=iP,Tn=cP,$4=mP,Xu=C8,H4=VP,BD=EP,ca=_P,UD=IP,Ht=v8,G4=l7,Ac=E8,$n=MP,Ei=zP,V4=HP,Rr=k8,Kg=U7,$D=cL,Ui=fL,Yg=_4,HD=_4,Kr=ZL,Ud=JL,Ju=eD,Ms=oL,Fs=uL,GD=mL,_l=bL,mo=yL,ck=kL,Pl=CL,fl=AL,VD=IL,W4=$L,mf=_L,ia=OL,gl=LL,dk=FL,bl=BL,hf=GL,WD=WL,ff=KL,so=aD,Ll=sD,oi=lD,zs=dD,qD=pD,gf=hD,KD=bD,xl=yD,pr=wD,Qu=EL,YD=rD,ZD=[{type:"key",id:"esc",label:"Esc",sequence:"\x1B"},{type:"key",id:"tab",label:"Tab",sequence:" "},{type:"key",id:"shift-tab",label:"⇧Tab",sequence:"\x1B[Z"},{type:"modifier",id:"ctrl",label:"CTRL",modifier:"ctrl"},{type:"modifier",id:"alt",label:"ALT",modifier:"alt"},{type:"arrow",id:"arrow-up",sequence:"\x1B[A",icon:"up"},{type:"arrow",id:"arrow-down",sequence:"\x1B[B",icon:"down"},{type:"arrow",id:"arrow-left",sequence:"\x1B[D",icon:"left"},{type:"arrow",id:"arrow-right",sequence:"\x1B[C",icon:"right"}],XD={up:kD,down:L4,left:SD,right:D4},yl=e=>e.preventDefault(),uk="shrink-0 rounded-md border border-gray-600 bg-gray-700 px-2.5 py-1.5 text-xs font-medium text-gray-100 transition-colors select-none active:bg-blue-600 active:text-white active:border-blue-600 disabled:cursor-not-allowed disabled:opacity-40",JD="shrink-0 rounded-md border border-blue-500 bg-blue-600 px-2.5 py-1.5 text-xs font-medium text-white transition-colors select-none disabled:cursor-not-allowed disabled:opacity-40",Qp="shrink-0 rounded-md border border-gray-600 bg-gray-700 p-1.5 text-gray-100 transition-colors select-none active:bg-blue-600 active:text-white active:border-blue-600 disabled:cursor-not-allowed disabled:opacity-40";function pk({wsRef:e,terminalRef:t,isConnected:r,bottomOffset:n="bottom-0"}){const{t:a}=He("settings"),[s,o]=m.useState(!1),[l,c]=m.useState(!1),[d,u]=m.useState(!1),p=m.useCallback(b=>{ls(e.current,{type:"input",data:b})},[e]),f=m.useCallback(()=>{t.current?.scrollToBottom()},[t]),h=m.useCallback(async()=>{if(typeof navigator>"u"||!navigator.clipboard?.readText){u(!0);return}try{const b=await navigator.clipboard.readText();u(!1),b.length>0&&p(b)}catch{u(!0)}},[p]);m.useEffect(()=>{if(!d)return;const b=window.setTimeout(()=>u(!1),2500);return()=>window.clearTimeout(b)},[d]);const g=m.useCallback(b=>{let x=b;if(s&&b.length===1){const y=b.toLowerCase().charCodeAt(0);y>=97&&y<=122&&(x=String.fromCharCode(y-96)),o(!1)}l&&b.length===1&&(x="\x1B"+x,c(!1)),p(x)},[s,l,p]);return i.jsx("div",{className:`pointer-events-none fixed inset-x-0 ${n} z-20 px-2 md:hidden`,children:i.jsxs("div",{className:"pointer-events-auto flex items-center gap-1 overflow-x-auto rounded-lg border border-gray-700/80 bg-gray-900/95 px-1.5 py-1.5 shadow-lg backdrop-blur-sm [-webkit-overflow-scrolling:touch] [scrollbar-width:none] [&::-webkit-scrollbar]:hidden",children:[d&&i.jsx("span",{className:"shrink-0 rounded-md border border-yellow-500/50 bg-yellow-500/15 px-2 py-1 text-[11px] text-yellow-100",children:"Clipboard blocked"}),i.jsx("button",{type:"button",onPointerDown:yl,onClick:()=>{h()},disabled:!r,className:Qp,title:a("terminalShortcuts.paste",{defaultValue:"Paste"}),"aria-label":a("terminalShortcuts.paste",{defaultValue:"Paste"}),children:i.jsx(No,{className:"h-4 w-4"})}),ZD.map(b=>{if(b.type==="modifier"){const x=b.modifier==="ctrl"?s:l,y=b.modifier==="ctrl"?()=>o(v=>!v):()=>c(v=>!v);return i.jsx("button",{type:"button",onPointerDown:yl,onClick:y,disabled:!r,className:x?JD:uk,children:b.label},b.id)}if(b.type==="arrow"){const x=XD[b.icon];return i.jsx("button",{type:"button",onPointerDown:yl,onClick:()=>p(b.sequence),disabled:!r,className:Qp,children:i.jsx(x,{className:"h-4 w-4"})},b.id)}return i.jsx("button",{type:"button",onPointerDown:yl,onClick:()=>g(b.sequence),disabled:!r,className:uk,children:b.label},b.id)}),i.jsx("button",{type:"button",onPointerDown:yl,onClick:f,disabled:!r,className:Qp,title:a("terminalShortcuts.scrollDown"),"aria-label":a("terminalShortcuts.scrollDown"),children:i.jsx(CD,{className:"h-4 w-4"})})]})})}function QD({tabId:e,selectedProject:t=null,selectedSession:r=null,initialCommand:n=null,isPlainShell:a=!1,onProcessComplete:s=null,minimal:o=!1,autoConnect:l=!1,forceNewSession:c=!1,startupInput:d=null,hermesLaunchId:u=null,permissionOverride:p=null,provider:f=null,isActive:h=!0,onClose:g=null}){const{t:b}=He("chat"),[x,y]=m.useState(!1),[v,w]=m.useState(null),k=m.useRef(null),S=m.useRef(null),{terminalContainerRef:N,terminalRef:E,wsRef:I,isConnected:A,isInitialized:T,isConnecting:_,authUrl:j,authUrlVersion:R,connectToShell:C,disconnectFromShell:D,openAuthUrlInBrowser:B,copyAuthUrlToClipboard:F}=r7({tabId:e,selectedProject:t,selectedSession:r,initialCommand:n,isPlainShell:a,minimal:o,autoConnect:l,forceNewSession:c,startupInput:d,hermesLaunchId:u,permissionOverride:p,provider:f,isRestarting:x,onProcessComplete:s,onOutputRef:S}),V=m.useCallback(()=>{const ve=E.current;if(!ve)return;const je=ve.buffer.active,M=je.baseY+je.cursorY,ae=Math.min(je.baseY+je.length-1,M+10),ue=Math.max(0,M-j_),Y=[];for(let le=ue;le<=ae;le++){const Ee=je.getLine(le);Ee&&Y.push(Ee.translateToString().trimEnd())}let U=-1;for(let le=Y.length-1;le>=0;le--)if(/esc to cancel/i.test(Y[le])||/enter to select/i.test(Y[le])){U=le;break}if(U===-1){w(null);return}const Q=new Map,J=Math.max(0,U-I_);for(let le=U-1;le>=J;le--){const Ee=Y[le].match(/^\s*[❯›>]?\s*(\d+)\.\s+(.+)/);if(Ee){const fe=Ee[1],ne=Ee[2].trim();parseInt(fe,10)<=R_&&ne.length>0&&!Q.has(fe)&&Q.set(fe,ne)}}const re=[];for(let le=1;le<=Q.size&&Q.has(String(le));le++)re.push({number:String(le),label:Q.get(String(le))});w(re.length>=__?re:null)},[E]),K=m.useCallback(()=>{k.current&&clearTimeout(k.current),k.current=setTimeout(V,A_)},[V]);m.useEffect(()=>{S.current=K},[K]),m.useEffect(()=>()=>{k.current&&clearTimeout(k.current)},[]),m.useEffect(()=>{A||(k.current&&(clearTimeout(k.current),k.current=null),w(null))},[A]),m.useEffect(()=>{if(!h||!T||!A)return;const ve=()=>{E.current?.focus()},je=window.requestAnimationFrame(ve),M=window.setTimeout(ve,0);return()=>{window.cancelAnimationFrame(je),window.clearTimeout(M)}},[h,A,T,E]);const L=m.useCallback(ve=>{ls(I.current,{type:"input",data:ve})},[I]),G=m.useMemo(()=>Z_(r),[r]),H=m.useMemo(()=>f||(r?.__provider?r.__provider:window.localStorage.getItem("selected-provider")||"claude"),[f,r?.__provider]),z=dn[H]??"Claude Code",te=m.useMemo(()=>G?G.slice(0,30):null,[G]),se=m.useMemo(()=>G?G.slice(0,50):null,[G]),me=m.useCallback(()=>{y(!0),window.setTimeout(()=>{y(!1)},E_)},[]),de=m.useCallback(()=>{D(),g?.()},[D,g]);if(!t)return i.jsx(a7,{title:b("shell.selectProject.title"),description:b("shell.selectProject.description")});if(o)return i.jsxs(i.Fragment,{children:[i.jsx(s7,{terminalContainerRef:N,authUrl:j,authUrlVersion:R,initialCommand:n,isConnected:A,openAuthUrlInBrowser:B,copyAuthUrlToClipboard:F}),i.jsx(pk,{wsRef:I,terminalRef:E,isConnected:A,bottomOffset:"bottom-0"})]});const ce=a?b("shell.runCommand",{command:n||b("shell.defaultCommand"),projectName:t.displayName}):r?b("shell.resumeSession",{displayName:se}):b("shell.startProviderSession",{provider:z,defaultValue:"Start a new {{provider}} session"}),ye=a?b("shell.runCommand",{command:n||b("shell.defaultCommand"),projectName:t.displayName}):b("shell.startProviderCli",{provider:z,projectName:t.displayName,defaultValue:"Starting {{provider}} in {{projectName}}"}),he=T?_?"connecting":A?null:"connect":"loading",ke=he==="connecting"?ye:ce;return i.jsxs("div",{className:"flex h-full w-full flex-col bg-gray-900",children:[i.jsx(i7,{isConnected:A,isInitialized:T,isRestarting:x,hasSession:!!r,sessionDisplayNameShort:te,onDisconnect:de,onRestart:me,statusNewSessionText:b("shell.status.newSession"),statusInitializingText:b("shell.status.initializing"),statusRestartingText:b("shell.status.restarting"),disconnectLabel:b("shell.actions.disconnect"),disconnectTitle:b("shell.actions.disconnectTitle"),restartLabel:b("shell.actions.restart"),restartTitle:b("shell.actions.restartTitle"),disableRestart:x||A}),i.jsxs("div",{className:"relative flex-1 overflow-hidden p-2",children:[i.jsx("div",{ref:N,className:"h-full w-full focus:outline-none",style:{outline:"none"}}),he&&i.jsx(n7,{mode:he,description:ke,loadingLabel:b("shell.loading"),connectLabel:b("shell.actions.connect"),connectTitle:b("shell.actions.connectTitle"),connectingLabel:b("shell.connecting"),onConnect:C}),v&&A&&i.jsx("div",{className:"absolute inset-x-0 bottom-0 z-10 border-t border-gray-700/80 bg-gray-800/95 px-3 py-2 backdrop-blur-sm",onMouseDown:ve=>ve.preventDefault(),children:i.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[v.map(ve=>i.jsxs("button",{type:"button",onClick:()=>{L(`${ve.number}\r`),w(null)},className:"max-w-36 truncate rounded bg-blue-600 px-3 py-1.5 text-xs font-medium text-white transition-colors hover:bg-blue-700",title:`${ve.number}. ${ve.label}`,children:[ve.number,". ",ve.label]},ve.number)),i.jsx("button",{type:"button",onClick:()=>{L("\x1B"),w(null)},className:"rounded bg-gray-700 px-3 py-1.5 text-xs font-medium text-gray-200 transition-colors hover:bg-gray-600",children:"Esc"})]})})]}),i.jsx(pk,{wsRef:I,terminalRef:E,isConnected:A})]})}function eO({className:e}){return i.jsx("div",{className:`flex h-full items-center justify-center ${e}`,children:i.jsxs("div",{className:"text-center text-gray-500 dark:text-gray-400",children:[i.jsx("div",{className:"mx-auto mb-4 flex h-16 w-16 items-center justify-center rounded-full bg-gray-100 dark:bg-gray-800",children:i.jsx("svg",{className:"h-8 w-8 text-gray-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M8 9l3 3-3 3m5 0h3M5 20h14a2 2 0 002-2V6a2 2 0 00-2-2H5a2 2 0 002 2z"})})}),i.jsx("h3",{className:"mb-2 text-lg font-semibold",children:"No Project Selected"}),i.jsx("p",{children:"A project is required to open a shell"})]})})}function tO({title:e,isCompleted:t,onClose:r=null}){return i.jsx("div",{className:"flex-shrink-0 border-b border-gray-700 bg-gray-800 px-4 py-2",children:i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsxs("div",{className:"flex items-center space-x-2",children:[i.jsx("h3",{className:"text-sm font-medium text-gray-200",children:e}),t&&i.jsx("span",{className:"text-xs text-green-400",children:"(Completed)"})]}),r&&i.jsx("button",{onClick:r,className:"text-gray-400 hover:text-white",title:"Close",children:i.jsx("svg",{className:"h-4 w-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]})})}function Ao({project:e=null,session:t=null,command:r=null,isPlainShell:n=null,isActive:a=!0,autoConnect:s=!0,onComplete:o=null,onClose:l=null,title:c=null,className:d="",showHeader:u=!0,compact:p=!1,minimal:f=!1,forceNewSession:h=!1,startupInput:g=null,hermesLaunchId:b=null,permissionOverride:x=null,provider:y=null,tabId:v=null}){const[w,k]=m.useState(!1),S=m.useMemo(()=>v||`tab_${crypto.randomUUID()}`,[v]),N=n!==null?n:r!==null,E=m.useCallback(I=>{k(!0),o?.(I)},[o]);return e?i.jsxs("div",{className:`flex h-full w-full flex-col ${d}`,children:[!f&&u&&c&&i.jsx(tO,{title:c,isCompleted:w,onClose:l}),i.jsx("div",{className:"min-h-0 w-full flex-1",children:i.jsx(QD,{tabId:S,selectedProject:e,selectedSession:t,initialCommand:r,isPlainShell:N,isActive:a,onProcessComplete:E,minimal:f,autoConnect:f?!0:s,forceNewSession:h,startupInput:g,hermesLaunchId:b,permissionOverride:x,provider:y,onClose:l})})]}):i.jsx(eO,{className:d})}const rO=(e,t)=>t||(e==="claude"?"claude --dangerously-skip-permissions /login":e==="cursor"?"cursor-agent login":e==="codex"?"codex login":e==="qwen"?"qwen auth":e==="opencode"?"opencode auth login":"gemini"),nO={claude:{keyLabel:"Anthropic API Key",keyExample:"sk-ant-...",supportsBaseUrl:!0,baseUrlExample:"https://api.anthropic.com",keyConsoleUrl:"https://console.anthropic.com/settings/keys",keyConsoleLabel:"Anthropic Console"},codex:{keyLabel:"OpenAI API Key",keyExample:"sk-...",supportsBaseUrl:!0,baseUrlExample:"https://api.openai.com/v1",keyConsoleUrl:"https://platform.openai.com/api-keys",keyConsoleLabel:"OpenAI Platform"},gemini:{keyLabel:"Gemini API Key",keyExample:"AI...",supportsBaseUrl:!1,keyConsoleUrl:"https://aistudio.google.com/app/apikey",keyConsoleLabel:"Google AI Studio"},qwen:{keyLabel:"OpenAI-Compatible API Key",keyExample:"sk-... or sk-sp-...",supportsBaseUrl:!0,baseUrlExample:"https://dashscope-intl.aliyuncs.com/compatible-mode/v1",keyConsoleUrl:"https://github.com/QwenLM/qwen-code",keyConsoleLabel:"Qwen Code Docs",notes:"Accepts any OpenAI-compatible endpoint — Alibaba Cloud, ModelScope, OpenRouter, self-hosted, etc."},opencode:{keyLabel:"Anthropic API Key (default backend)",keyExample:"sk-ant-...",supportsBaseUrl:!0,baseUrlExample:"https://api.anthropic.com",keyConsoleUrl:"https://console.anthropic.com/settings/keys",keyConsoleLabel:"Anthropic Console",notes:"OpenCode is multi-provider — this sets the Anthropic credentials. Switch providers via `opencode auth login` or opencode.json."}};function mk({active:e,children:t,onClick:r}){return i.jsx("button",{onClick:r,className:`flex-1 border-b-2 px-4 py-2.5 text-sm font-medium transition-colors ${e?"border-primary text-foreground":"border-transparent text-muted-foreground hover:text-foreground"}`,children:t})}function aO({provider:e}){const[t,r]=m.useState(""),[n,a]=m.useState(!1),[s,o]=m.useState("idle"),[l,c]=m.useState(null),d=async()=>{const u=t.trim();if(u){a(!0),c(null),o("idle");try{const p=await Ce(`/api/providers/${e}/oauth-paste`,{method:"POST",body:JSON.stringify({callbackUrl:u})}),f=await p.json().catch(()=>({}));if(!p.ok||!f?.success)throw new Error(f?.error||`Request failed (${p.status})`);o("ok"),r("")}catch(p){c(p?.message||"Forward failed"),o("error")}finally{a(!1)}}};return i.jsxs("div",{className:"mt-3 rounded-lg border border-border/60 bg-muted/30 p-3 text-sm",children:[i.jsx("div",{className:"mb-2 font-medium text-foreground",children:"Remote login? Paste the callback URL here"}),i.jsxs("p",{className:"mb-3 text-xs text-muted-foreground",children:["When the CLI shows ",i.jsx("code",{className:"rounded bg-background px-1 font-mono text-[11px]",children:"http://127.0.0.1:PORT/…"})," and your browser can't reach it (VPS setups), copy the failing URL from your address bar and paste it below. Pixcode forwards the token exchange to the CLI process on this host."]}),i.jsxs("div",{className:"flex gap-2",children:[i.jsx("input",{type:"url",value:t,onChange:u=>r(u.target.value),placeholder:"http://127.0.0.1:49312/callback?code=...",className:"flex-1 rounded-md border border-border bg-background px-3 py-2 font-mono text-xs text-foreground focus:border-primary focus:outline-none",onKeyDown:u=>{u.key==="Enter"&&d()}}),i.jsx("button",{onClick:()=>void d(),disabled:n||!t.trim(),className:"flex items-center gap-1.5 rounded-md bg-foreground px-3 py-2 text-xs font-medium text-background transition-opacity hover:opacity-90 disabled:opacity-40",children:n?i.jsx(_t,{className:"h-3.5 w-3.5 animate-spin"}):"Forward"})]}),s==="ok"&&i.jsxs("div",{className:"mt-2 flex items-center gap-1.5 text-xs text-emerald-600 dark:text-emerald-400",children:[i.jsx(Gt,{className:"h-3.5 w-3.5"})," Forwarded — check the terminal above for the completion message."]}),s==="error"&&l&&i.jsx("div",{className:"mt-2 text-xs text-red-600 dark:text-red-400",children:l})]})}function iO({provider:e,onSaved:t}){const r=nO[e],[n,a]=m.useState(""),[s,o]=m.useState(""),[l,c]=m.useState(!1),[d,u]=m.useState("idle"),[p,f]=m.useState(null);m.useEffect(()=>{let g=!1;return(async()=>{try{const x=await(await Ce("/api/providers/credentials")).json().catch(()=>({}));if(g||!x?.success)return;const y=x.data?.[e];y?.baseUrl&&o(y.baseUrl)}catch{}})(),()=>{g=!0}},[e]);const h=async()=>{const g=n.trim();if(g){c(!0),f(null),u("idle");try{const b=await Ce(`/api/providers/${e}/auth/api-key`,{method:"POST",body:JSON.stringify({apiKey:g,baseUrl:r.supportsBaseUrl&&s.trim()?s.trim():""})}),x=await b.json().catch(()=>({}));if(!b.ok||!x?.success)throw new Error(x?.error||`Request failed (${b.status})`);u("ok"),a(""),t()}catch(b){f(b?.message||"Save failed"),u("error")}finally{c(!1)}}};return r?i.jsx("div",{className:"flex h-full flex-col overflow-y-auto p-6",children:i.jsxs("div",{className:"mx-auto w-full max-w-lg space-y-5",children:[i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsx("div",{className:"flex h-10 w-10 items-center justify-center rounded-full bg-muted",children:i.jsx(zD,{className:"h-5 w-5 text-foreground"})}),i.jsxs("div",{children:[i.jsx("h4",{className:"text-base font-semibold text-foreground",children:r.keyLabel}),i.jsxs("a",{href:r.keyConsoleUrl,target:"_blank",rel:"noreferrer",className:"inline-flex items-center gap-1 text-xs text-muted-foreground hover:text-foreground",children:["Get a key from ",r.keyConsoleLabel,i.jsx(mn,{className:"h-3 w-3"})]})]})]}),r.notes&&i.jsx("div",{className:"rounded-md border border-border/60 bg-muted/40 p-3 text-xs text-muted-foreground",children:r.notes}),i.jsxs("div",{className:"space-y-1.5",children:[i.jsx("label",{className:"text-xs font-medium text-foreground",children:"API Key"}),i.jsx("input",{type:"password",value:n,onChange:g=>a(g.target.value),placeholder:r.keyExample,className:"w-full rounded-md border border-border bg-background px-3 py-2 font-mono text-sm text-foreground focus:border-primary focus:outline-none",autoComplete:"off",spellCheck:!1}),i.jsxs("p",{className:"text-[11px] text-muted-foreground",children:["Stored locally at ",i.jsx("code",{className:"rounded bg-muted px-1 font-mono text-[10px]",children:"~/.pixcode/provider-credentials.json"})," with 0600 permissions."]})]}),r.supportsBaseUrl&&i.jsxs("div",{className:"space-y-1.5",children:[i.jsxs("label",{className:"text-xs font-medium text-foreground",children:["Base URL ",i.jsx("span",{className:"font-normal text-muted-foreground",children:"(optional — use a custom endpoint)"})]}),i.jsx("input",{type:"url",value:s,onChange:g=>o(g.target.value),placeholder:r.baseUrlExample,className:"w-full rounded-md border border-border bg-background px-3 py-2 font-mono text-sm text-foreground focus:border-primary focus:outline-none",autoComplete:"off",spellCheck:!1}),i.jsx("p",{className:"text-[11px] text-muted-foreground",children:"Point at any OpenAI-compatible proxy (OpenRouter, local LLM, self-hosted, budget provider) to cut costs or hit different models."})]}),i.jsxs("div",{className:"flex items-center gap-3 pt-2",children:[i.jsxs("button",{onClick:()=>void h(),disabled:l||!n.trim(),className:"inline-flex items-center gap-2 rounded-md bg-foreground px-4 py-2 text-sm font-medium text-background transition-opacity hover:opacity-90 disabled:opacity-40",children:[l?i.jsx(_t,{className:"h-4 w-4 animate-spin"}):i.jsx(Gt,{className:"h-4 w-4"}),"Save API Key"]}),d==="ok"&&i.jsx("span",{className:"text-xs text-emerald-600 dark:text-emerald-400",children:"Saved — reconnect to pick it up."}),d==="error"&&p&&i.jsx("span",{className:"text-xs text-red-600 dark:text-red-400",children:p})]})]})}):i.jsx("div",{className:"p-6 text-sm text-muted-foreground",children:"This provider uses OAuth only — use the Browser tab to log in."})}function q4({isOpen:e,onClose:t,provider:r="claude",onComplete:n,customCommand:a,isAuthenticated:s=!1}){const{t:o}=He("common"),l=r!=="cursor",[c,d]=m.useState(l?"apiKey":"browser");m.useEffect(()=>{e&&d(l?"apiKey":"browser")},[e,r,l]);const u=m.useMemo(()=>`${dn[r]??r} Login`,[r]);if(!e)return null;const p=rO(r,a),f=h=>n?.(h);return i.jsx("div",{className:"fixed inset-0 z-[9999] flex items-center justify-center bg-black bg-opacity-50 max-md:items-stretch max-md:justify-stretch",children:i.jsxs("div",{className:"flex h-3/4 w-full max-w-4xl flex-col rounded-lg bg-white shadow-xl dark:bg-gray-800 max-md:m-0 max-md:h-full max-md:max-w-none max-md:rounded-none md:m-4 md:h-3/4 md:max-w-4xl md:rounded-lg",children:[i.jsxs("div",{className:"flex items-center justify-between border-b border-gray-200 p-4 dark:border-gray-700",children:[i.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white",children:u}),i.jsx("button",{onClick:t,className:"text-gray-400 transition-colors hover:text-gray-600 dark:hover:text-gray-300","aria-label":"Close login modal",children:i.jsx(Ct,{className:"h-6 w-6"})})]}),i.jsxs("div",{className:"flex border-b border-gray-200 dark:border-gray-700",children:[i.jsx(mk,{active:c==="browser",onClick:()=>d("browser"),children:"Browser / OAuth"}),l&&i.jsx(mk,{active:c==="apiKey",onClick:()=>d("apiKey"),children:"API Key"})]}),i.jsx("div",{className:"flex flex-1 flex-col overflow-hidden",children:c==="browser"?i.jsxs("div",{className:"flex flex-1 flex-col overflow-hidden",children:[i.jsx("div",{className:"min-h-0 flex-1",children:i.jsx(Ao,{project:m_,command:p,onComplete:f,minimal:!0})}),i.jsx("div",{className:"border-t border-border/40 bg-background/50 px-4 py-3",children:i.jsx(aO,{provider:r})})]}):i.jsx(iO,{provider:r,onSaved:()=>f(0)})})]})})}const sO=({className:e="w-5 h-5"})=>i.jsx("img",{src:"/icons/claude-ai-icon.svg",alt:"Claude",className:e}),oO=({className:e="w-5 h-5"})=>{const{isDarkMode:t}=ri();return i.jsx("img",{src:t?"/icons/codex-white.svg":"/icons/codex.svg",alt:"Codex",className:e})},lO=({className:e="w-5 h-5"})=>{const{isDarkMode:t}=ri();return i.jsx("img",{src:t?"/icons/cursor-white.svg":"/icons/cursor.svg",alt:"Cursor",className:e})},cO=({className:e="w-5 h-5"})=>i.jsx("img",{src:"/icons/gemini-ai-icon.svg",alt:"Gemini",className:e}),dO=({className:e="w-5 h-5"})=>{const{isDarkMode:t}=ri(),r=t?"/icons/opencode-logo-dark.svg":"/icons/opencode-logo-light.svg";return i.jsx("img",{src:r,alt:"OpenCode",className:e})},uO=({className:e="w-5 h-5"})=>i.jsx("img",{src:"/icons/qwen-logo.svg",alt:"Qwen Code",className:e});function er({provider:e="claude",className:t="w-5 h-5"}){return e==="cursor"?i.jsx(lO,{className:t}):e==="codex"?i.jsx(oO,{className:t}):e==="gemini"?i.jsx(cO,{className:t}):e==="qwen"?i.jsx(uO,{className:t}):e==="opencode"?i.jsx(dO,{className:t}):e==="hermes"?i.jsx(pr,{className:t}):i.jsx(sO,{className:t})}function pO({provider:e,title:t,status:r,connectedClassName:n,iconContainerClassName:a,loginButtonClassName:s,onLogin:o}){const l=r.authenticated?n:"border-border bg-card",c=r.loading?"Checking...":r.authenticated?r.email||"Connected":r.error||"Not connected";return i.jsx("div",{className:`rounded-lg border p-4 transition-colors ${l}`,children:i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsx("div",{className:`flex h-10 w-10 items-center justify-center rounded-full ${a}`,children:i.jsx(er,{provider:e,className:"h-5 w-5"})}),i.jsxs("div",{children:[i.jsxs("div",{className:"flex items-center gap-2 font-medium text-foreground",children:[t,r.authenticated&&i.jsx(Gt,{className:"h-4 w-4 text-green-500"})]}),i.jsx("div",{className:"text-xs text-muted-foreground",children:c})]})]}),!r.authenticated&&!r.loading&&i.jsx("button",{onClick:o,className:`${s} rounded-lg px-4 py-2 text-sm font-medium text-white transition-colors`,children:"Login"})]})})}const mO=[{provider:"claude",title:"Claude Code",connectedClassName:"bg-blue-50 dark:bg-blue-900/20 border-blue-200 dark:border-blue-800",iconContainerClassName:"bg-blue-100 dark:bg-blue-900/30",loginButtonClassName:"bg-blue-600 hover:bg-blue-700"},{provider:"cursor",title:"Cursor",connectedClassName:"bg-purple-50 dark:bg-purple-900/20 border-purple-200 dark:border-purple-800",iconContainerClassName:"bg-purple-100 dark:bg-purple-900/30",loginButtonClassName:"bg-purple-600 hover:bg-purple-700"},{provider:"codex",title:"OpenAI Codex",connectedClassName:"bg-gray-100 dark:bg-gray-800/50 border-gray-300 dark:border-gray-600",iconContainerClassName:"bg-gray-100 dark:bg-gray-800",loginButtonClassName:"bg-gray-800 hover:bg-gray-900 dark:bg-gray-700 dark:hover:bg-gray-600"},{provider:"gemini",title:"Gemini",connectedClassName:"bg-teal-50 dark:bg-teal-900/20 border-teal-200 dark:border-teal-800",iconContainerClassName:"bg-teal-100 dark:bg-teal-900/30",loginButtonClassName:"bg-teal-600 hover:bg-teal-700"},{provider:"qwen",title:"Qwen Code",connectedClassName:"bg-orange-50 dark:bg-orange-900/20 border-orange-200 dark:border-orange-800",iconContainerClassName:"bg-orange-100 dark:bg-orange-900/30",loginButtonClassName:"bg-orange-600 hover:bg-orange-700"}];function hk({providerStatuses:e,onOpenProviderLogin:t}){return i.jsxs("div",{className:"space-y-6",children:[i.jsxs("div",{className:"mb-6 text-center",children:[i.jsx("h2",{className:"mb-2 text-2xl font-bold text-foreground",children:"Connect Your AI Agents"}),i.jsx("p",{className:"text-muted-foreground",children:"Login to one or more AI coding assistants. All are optional."})]}),i.jsx("div",{className:"space-y-3",children:mO.map(r=>i.jsx(pO,{provider:r.provider,title:r.title,status:e[r.provider],connectedClassName:r.connectedClassName,iconContainerClassName:r.iconContainerClassName,loginButtonClassName:r.loginButtonClassName,onLogin:()=>t(r.provider)},r.provider))}),i.jsx("div",{className:"pt-2 text-center text-sm text-muted-foreground",children:i.jsx("p",{children:"You can configure these later in Settings."})})]})}function hO({gitName:e,gitEmail:t,isSubmitting:r,onGitNameChange:n,onGitEmailChange:a}){return i.jsxs("div",{className:"space-y-6",children:[i.jsxs("div",{className:"mb-8 text-center",children:[i.jsx("div",{className:"mx-auto mb-4 flex h-16 w-16 items-center justify-center rounded-full bg-blue-100 dark:bg-blue-900/30",children:i.jsx(Kr,{className:"h-8 w-8 text-blue-600 dark:text-blue-400"})}),i.jsx("h2",{className:"mb-2 text-2xl font-bold text-foreground",children:"Git Configuration"}),i.jsx("p",{className:"text-muted-foreground",children:"Configure your git identity to ensure proper attribution for commits."})]}),i.jsxs("div",{className:"space-y-4",children:[i.jsxs("div",{children:[i.jsxs("label",{htmlFor:"gitName",className:"mb-2 flex items-center gap-2 text-sm font-medium text-foreground",children:[i.jsx(FD,{className:"h-4 w-4"}),"Git Name ",i.jsx("span",{className:"text-red-500",children:"*"})]}),i.jsx("input",{type:"text",id:"gitName",value:e,onChange:s=>n(s.target.value),className:"w-full rounded-lg border border-border bg-background px-4 py-3 text-foreground focus:border-transparent focus:outline-none focus:ring-2 focus:ring-blue-500",placeholder:"John Doe",required:!0,disabled:r}),i.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:"Saved as `git config --global user.name`."})]}),i.jsxs("div",{children:[i.jsxs("label",{htmlFor:"gitEmail",className:"mb-2 flex items-center gap-2 text-sm font-medium text-foreground",children:[i.jsx(OD,{className:"h-4 w-4"}),"Git Email ",i.jsx("span",{className:"text-red-500",children:"*"})]}),i.jsx("input",{type:"email",id:"gitEmail",value:t,onChange:s=>a(s.target.value),className:"w-full rounded-lg border border-border bg-background px-4 py-3 text-foreground focus:border-transparent focus:outline-none focus:ring-2 focus:ring-blue-500",placeholder:"john@example.com",required:!0,disabled:r}),i.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:"Saved as `git config --global user.email`."})]})]})]})}const fk=[{title:"Git Configuration",icon:Kr,required:!0},{title:"Connect Agents",icon:O4,required:!1}];function fO({currentStep:e}){return i.jsx("div",{className:"mb-8",children:i.jsx("div",{className:"flex items-center justify-between",children:fk.map((t,r)=>{const n=r<e,a=r===e,s=t.icon;return i.jsxs("div",{className:"contents",children:[i.jsxs("div",{className:"flex flex-1 flex-col items-center",children:[i.jsx("div",{className:`flex h-12 w-12 items-center justify-center rounded-full border-2 transition-colors duration-200 ${n?"border-green-500 bg-green-500 text-white":a?"border-blue-600 bg-blue-600 text-white":"border-border bg-background text-muted-foreground"}`,children:n?i.jsx(Gt,{className:"h-6 w-6"}):i.jsx(s,{className:"h-6 w-6"})}),i.jsxs("div",{className:"mt-2 text-center",children:[i.jsx("p",{className:`text-sm font-medium ${a?"text-foreground":"text-muted-foreground"}`,children:t.title}),t.required&&i.jsx("span",{className:"text-xs text-red-500",children:"Required"})]})]}),r<fk.length-1&&i.jsx("div",{className:`mx-2 h-0.5 flex-1 transition-colors duration-200 ${n?"bg-green-500":"bg-border"}`})]},t.title)})})})}const gk=/^[^\s@]+@[^\s@]+\.[^\s@]+$/,bk=async(e,t)=>{try{return(await e.json()).error||t}catch{return t}};function gO({onComplete:e}){const[t,r]=m.useState(0),[n,a]=m.useState(""),[s,o]=m.useState(""),[l,c]=m.useState(!1),[d,u]=m.useState(""),[p,f]=m.useState(null),{providerAuthStatus:h,checkProviderAuthStatus:g,refreshProviderAuthStatuses:b}=qu(),x=m.useRef(void 0),y=m.useCallback(async()=>{try{const I=await Ce("/api/user/git-config");if(!I.ok)return;const A=await I.json();A.gitName&&a(A.gitName),A.gitEmail&&o(A.gitEmail)}catch(I){console.error("Error loading git config:",I)}},[]);m.useEffect(()=>{y(),b()},[y,b]),m.useEffect(()=>{const I=x.current;x.current=p,I!=null&&p===null&&b()},[p,b]);const v=I=>{f(I)},w=I=>{I===0&&p&&g(p)},k=async()=>{if(u(""),t!==0){r(I=>I+1);return}if(!n.trim()||!s.trim()){u("Both git name and email are required.");return}if(!gk.test(s)){u("Please enter a valid email address.");return}c(!0);try{const I=await Ce("/api/user/git-config",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({gitName:n,gitEmail:s})});if(!I.ok){const A=await bk(I,"Failed to save git configuration");throw new Error(A)}r(A=>A+1)}catch(I){u(I instanceof Error?I.message:"Failed to save git configuration")}finally{c(!1)}},S=()=>{u(""),r(I=>I-1)},N=async()=>{c(!0),u("");try{const I=await Ce("/api/user/complete-onboarding",{method:"POST"});if(!I.ok){const A=await bk(I,"Failed to complete onboarding");throw new Error(A)}await e?.()}catch(I){u(I instanceof Error?I.message:"Failed to complete onboarding")}finally{c(!1)}},E=t===0?!!(n.trim()&&s.trim()&&gk.test(s)):!0;return i.jsxs(i.Fragment,{children:[i.jsx("div",{className:"flex min-h-screen items-center justify-center bg-background p-4",children:i.jsxs("div",{className:"w-full max-w-2xl",children:[i.jsx(fO,{currentStep:t}),i.jsxs("div",{className:"rounded-lg border border-border bg-card p-8 shadow-lg",children:[t===0?i.jsx(hO,{gitName:n,gitEmail:s,isSubmitting:l,onGitNameChange:a,onGitEmailChange:o}):t===1?i.jsx(hk,{providerStatuses:h,onOpenProviderLogin:v}):i.jsx(hk,{providerStatuses:h,onOpenProviderLogin:v}),d&&i.jsx("div",{className:"mt-6 rounded-lg border border-red-300 bg-red-100 p-4 dark:border-red-800 dark:bg-red-900/20",children:i.jsx("p",{className:"text-sm text-red-700 dark:text-red-400",children:d})}),i.jsxs("div",{className:"mt-8 flex items-center justify-between border-t border-border pt-6",children:[i.jsxs("button",{onClick:S,disabled:t===0||l,className:"flex items-center gap-2 px-4 py-2 text-sm font-medium text-muted-foreground transition-colors duration-200 hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50",children:[i.jsx(Go,{className:"h-4 w-4"}),"Previous"]}),i.jsx("div",{className:"flex items-center gap-3",children:t<1?i.jsx("button",{onClick:k,disabled:!E||l,className:"flex items-center gap-2 rounded-lg bg-blue-600 px-6 py-3 font-medium text-white transition-colors duration-200 hover:bg-blue-700 disabled:cursor-not-allowed disabled:bg-blue-400",children:l?i.jsxs(i.Fragment,{children:[i.jsx(_t,{className:"h-4 w-4 animate-spin"}),"Saving..."]}):i.jsxs(i.Fragment,{children:["Next",i.jsx(Fn,{className:"h-4 w-4"})]})}):i.jsx("button",{onClick:N,disabled:l,className:"flex items-center gap-2 rounded-lg bg-green-600 px-6 py-3 font-medium text-white transition-colors duration-200 hover:bg-green-700 disabled:cursor-not-allowed disabled:bg-green-400",children:l?i.jsxs(i.Fragment,{children:[i.jsx(_t,{className:"h-4 w-4 animate-spin"}),"Completing..."]}):i.jsxs(i.Fragment,{children:[i.jsx(Gt,{className:"h-4 w-4"}),"Complete Setup"]})})})]})]})]})}),p&&i.jsx(q4,{isOpen:!!p,onClose:()=>f(null),provider:p,onComplete:w})]})}const bO=["0s","0.1s","0.2s"];function xO(){return i.jsx("div",{className:"flex min-h-screen items-center justify-center bg-background p-4",children:i.jsxs("div",{className:"text-center",children:[i.jsx("div",{className:"mb-4 flex justify-center",children:i.jsx("div",{className:"flex h-16 w-16 items-center justify-center rounded-lg bg-primary shadow-sm",children:i.jsx(Un,{className:"h-8 w-8 text-primary-foreground"})})}),i.jsx("h1",{className:"mb-2 text-2xl font-bold text-foreground",children:"Pixcode"}),i.jsx("div",{className:"flex items-center justify-center space-x-2",children:bO.map(e=>i.jsx("div",{className:"h-2 w-2 animate-bounce rounded-full bg-blue-500",style:{animationDelay:e}},e))}),i.jsx("p",{className:"mt-2 text-muted-foreground",children:"Loading..."})]})})}function K4({errorMessage:e}){return e?i.jsx("div",{className:"rounded-md border border-red-300 bg-red-100 p-3 dark:border-red-800 dark:bg-red-900/20",children:i.jsx("p",{className:"text-sm text-red-700 dark:text-red-400",children:e})}):null}function as({id:e,label:t,value:r,onChange:n,placeholder:a,isDisabled:s,type:o="text",name:l,autoComplete:c}){return i.jsxs("div",{children:[i.jsx("label",{htmlFor:e,className:"mb-1 block text-sm font-medium text-foreground",children:t}),i.jsx("input",{id:e,type:o,name:l??e,autoComplete:c,value:r,onChange:d=>n(d.target.value),className:"w-full rounded-md border border-border bg-background px-3 py-2 text-foreground focus:border-transparent focus:outline-none focus:ring-2 focus:ring-blue-500",placeholder:a,required:!0,disabled:s})]})}function Y4({title:e,description:t,children:r,footerText:n,logo:a}){return i.jsx("div",{className:"flex min-h-screen items-center justify-center bg-background p-4",children:i.jsx("div",{className:"w-full max-w-md",children:i.jsxs("div",{className:"space-y-6 rounded-lg border border-border bg-card p-8 shadow-lg",children:[i.jsxs("div",{className:"text-center",children:[i.jsx("div",{className:"mb-4 flex justify-center",children:a??i.jsx("div",{className:"flex h-16 w-16 items-center justify-center rounded-lg bg-primary shadow-sm",children:i.jsx(Un,{className:"h-8 w-8 text-primary-foreground"})})}),i.jsx("h1",{className:"text-2xl font-bold text-foreground",children:e}),i.jsx("p",{className:"mt-2 text-muted-foreground",children:t})]}),r,i.jsx("div",{className:"text-center",children:i.jsx("p",{className:"text-sm text-muted-foreground",children:n})}),i.jsxs("div",{className:"flex items-center justify-center gap-1.5 pt-2",children:[i.jsx("svg",{className:"h-3.5 w-3.5 text-muted-foreground/50",fill:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:i.jsx("path",{d:"M12 2C6.477 2 2 6.484 2 12.017c0 4.425 2.865 8.18 6.839 9.504.5.092.682-.217.682-.483 0-.237-.008-.868-.013-1.703-2.782.605-3.369-1.343-3.369-1.343-.454-1.158-1.11-1.466-1.11-1.466-.908-.62.069-.608.069-.608 1.003.07 1.531 1.032 1.531 1.032.892 1.53 2.341 1.088 2.91.832.092-.647.35-1.088.636-1.338-2.22-.253-4.555-1.113-4.555-4.951 0-1.093.39-1.988 1.029-2.688-.103-.253-.446-1.272.098-2.65 0 0 .84-.27 2.75 1.026A9.564 9.564 0 0112 6.844c.85.004 1.705.115 2.504.337 1.909-1.296 2.747-1.027 2.747-1.027.546 1.379.202 2.398.1 2.651.64.7 1.028 1.595 1.028 2.688 0 3.848-2.339 4.695-4.566 4.943.359.309.678.92.678 1.855 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.019 10.019 0 0022 12.017C22 6.484 17.522 2 12 2z"})}),i.jsx("a",{href:"https://github.com/alicomert/pixcode",target:"_blank",rel:"noopener noreferrer",className:"text-xs text-muted-foreground/50 transition-colors hover:text-muted-foreground",children:"Pixcode is open source"})]})]})})})}const yO={username:"",password:""};function vO(){const{t:e}=He("auth"),{login:t}=Sc(),[r,n]=m.useState(yO),[a,s]=m.useState(""),[o,l]=m.useState(!1),c=m.useCallback((u,p)=>{n(f=>({...f,[u]:p}))},[]),d=m.useCallback(async u=>{if(u.preventDefault(),s(""),!r.username.trim()||!r.password){s(e("login.errors.requiredFields"));return}l(!0);const p=await t(r.username.trim(),r.password);p.success||s(p.error),l(!1)},[r.password,r.username,t,e]);return i.jsx(Y4,{title:e("login.title"),description:e("login.description"),footerText:"Enter your credentials to access Pixcode",children:i.jsxs("form",{onSubmit:d,className:"space-y-4",children:[i.jsx(as,{id:"username",label:e("login.username"),value:r.username,onChange:u=>c("username",u),placeholder:e("login.placeholders.username"),isDisabled:o,autoComplete:"username"}),i.jsx(as,{id:"password",label:e("login.password"),value:r.password,onChange:u=>c("password",u),placeholder:e("login.placeholders.password"),isDisabled:o,type:"password",autoComplete:"current-password"}),i.jsx(K4,{errorMessage:a}),i.jsx("button",{type:"submit",disabled:o,className:"w-full rounded-md bg-blue-600 px-4 py-2 font-medium text-white transition-colors duration-200 hover:bg-blue-700 disabled:bg-blue-400",children:e(o?"login.loading":"login.submit")})]})})}const wO={username:"",password:"",confirmPassword:"",connectionMode:"local",remoteUrl:"",remoteApiKey:""};function kO(e){return!e.username.trim()||!e.password||!e.confirmPassword?"Please fill in all fields.":e.username.trim().length<3?"Username must be at least 3 characters long.":e.password.length<6?"Password must be at least 6 characters long.":e.password!==e.confirmPassword?"Passwords do not match.":e.connectionMode==="remote"&&!e.remoteUrl.trim()?"Remote Pixcode server URL is required.":null}function SO(){const{register:e}=Sc(),[t,r]=m.useState(wO),[n,a]=m.useState(""),[s,o]=m.useState(!1),l=m.useCallback((d,u)=>{r(p=>({...p,[d]:u}))},[]),c=m.useCallback(async d=>{d.preventDefault(),a("");const u=kO(t);if(u){a(u);return}o(!0);const p=await fetch("/api/auth/connection-mode",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({mode:t.connectionMode,remoteUrl:t.connectionMode==="remote"?t.remoteUrl.trim():null,apiKey:t.connectionMode==="remote"?t.remoteApiKey.trim():null})});if(!p.ok){const h=await p.json().catch(()=>null);a(h?.error||"Could not save connection mode."),o(!1);return}const f=await e(t.username.trim(),t.password);f.success||a(f.error),o(!1)},[t,e]);return i.jsx(Y4,{title:"Welcome to Pixcode",description:"Create the first admin account to get started",footerText:"The first account becomes admin and can add more users later.",logo:i.jsx("img",{src:"/logo.svg",alt:"Pixcode",className:"h-16 w-16"}),children:i.jsxs("form",{onSubmit:c,className:"space-y-4",children:[i.jsxs("div",{className:"grid gap-2 rounded-lg border border-border/70 bg-muted/30 p-2 sm:grid-cols-2",children:[i.jsxs("button",{type:"button",onClick:()=>l("connectionMode","local"),disabled:s,className:`rounded-md px-3 py-2 text-left text-sm transition-colors ${t.connectionMode==="local"?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:bg-background/60 hover:text-foreground"}`,children:[i.jsx("span",{className:"block font-medium",children:"Use this computer directly"}),i.jsx("span",{className:"block text-xs opacity-80",children:"Run Pixcode and CLIs on this machine."})]}),i.jsxs("button",{type:"button",onClick:()=>l("connectionMode","remote"),disabled:s,className:`rounded-md px-3 py-2 text-left text-sm transition-colors ${t.connectionMode==="remote"?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:bg-background/60 hover:text-foreground"}`,children:[i.jsx("span",{className:"block font-medium",children:"Connect to a remote Pixcode server"}),i.jsx("span",{className:"block text-xs opacity-80",children:"Control another always-on Pixcode host by API."})]})]}),t.connectionMode==="remote"&&i.jsxs("div",{className:"space-y-3 rounded-lg border border-border/70 bg-muted/20 p-3",children:[i.jsx(as,{id:"remoteUrl",name:"remoteUrl",label:"Remote API URL",value:t.remoteUrl,onChange:d=>l("remoteUrl",d),placeholder:"https://your-server.example.com",isDisabled:s,autoComplete:"url"}),i.jsx(as,{id:"remoteApiKey",name:"remoteApiKey",label:"Remote API Key",value:t.remoteApiKey,onChange:d=>l("remoteApiKey",d),placeholder:"px_...",isDisabled:s,type:"password",autoComplete:"off"})]}),i.jsx(as,{id:"username",name:"username",label:"Username",value:t.username,onChange:d=>l("username",d),placeholder:"Enter your username",isDisabled:s,autoComplete:"username"}),i.jsx(as,{id:"password",name:"password",label:"Password",value:t.password,onChange:d=>l("password",d),placeholder:"Enter your password",isDisabled:s,type:"password",autoComplete:"new-password"}),i.jsx(as,{id:"confirmPassword",name:"confirmPassword",label:"Confirm Password",value:t.confirmPassword,onChange:d=>l("confirmPassword",d),placeholder:"Confirm your password",isDisabled:s,type:"password",autoComplete:"new-password"}),i.jsx(K4,{errorMessage:n}),i.jsx("button",{type:"submit",disabled:s,className:"w-full rounded-md bg-blue-600 px-4 py-2 font-medium text-white transition-colors duration-200 hover:bg-blue-700 disabled:bg-blue-400",children:s?"Setting up...":"Create Account"})]})})}function CO({children:e}){const{user:t,isLoading:r,needsSetup:n,hasCompletedOnboarding:a,refreshOnboardingStatus:s}=Sc();return r?i.jsx(xO,{}):n?i.jsx(SO,{}):t?a?i.jsx(i.Fragment,{children:e}):i.jsx(gO,{onComplete:s}):i.jsx(vO,{})}const Z4=m.createContext(null),X4=()=>{const e=m.useContext(Z4);if(!e)throw new Error("useWebSocket must be used within a WebSocketProvider");return e},NO=e=>{const t=window.location.protocol==="https:"?"wss:":"ws:";return e?`${t}//${window.location.host}/ws?token=${encodeURIComponent(e)}`:null},EO=()=>{const e=m.useRef(null),t=m.useRef(!1),r=m.useRef(!1),[n,a]=m.useState(null),[s,o]=m.useState(!1),l=m.useRef(null),{token:c}=Sc(),d=m.useCallback(()=>{if(!t.current)try{const f=NO(c);if(!f)return console.warn("No authentication token found for WebSocket connection");const h=new WebSocket(f);h.onopen=()=>{o(!0),e.current=h,r.current&&a({type:"websocket-reconnected",timestamp:Date.now()}),r.current=!0},h.onmessage=g=>{try{const b=JSON.parse(g.data);a(b)}catch(b){console.error("Error parsing WebSocket message:",b)}},h.onclose=()=>{o(!1),e.current=null,l.current=setTimeout(()=>{t.current||d()},3e3)},h.onerror=g=>{console.error("WebSocket error:",g)}}catch(f){console.error("Error creating WebSocket connection:",f)}},[c]);m.useEffect(()=>(d(),()=>{t.current=!0,l.current&&clearTimeout(l.current),e.current&&e.current.close()}),[d]);const u=m.useCallback(f=>{const h=e.current;h&&h.readyState===WebSocket.OPEN?h.send(JSON.stringify(f)):console.warn("WebSocket not connected")},[]);return m.useMemo(()=>({ws:e.current,sendMessage:u,latestMessage:n,isConnected:s}),[u,n,s])},TO=({children:e})=>{const t=EO();return i.jsx(Z4.Provider,{value:t,children:e})},J4=m.createContext(null);function ep(){const e=m.useContext(J4);if(!e)throw new Error("usePlugins must be used within a PluginsProvider");return e}function AO({children:e}){const{user:t,token:r,isLoading:n}=Sc(),[a,s]=m.useState([]),[o,l]=m.useState(!0),[c,d]=m.useState(null),u=!!(t&&r),p=m.useCallback(async()=>{if(!u){s([]),d(null),l(!1);return}l(!0);try{const x=await Ce("/api/plugins");if(x.ok){const y=await x.json();s(y.plugins||[]),d(null)}else{let y=`Failed to fetch plugins (${x.status})`;try{const v=await x.json();y=v.details||v.error||y}catch{y=x.statusText||y}d(y)}}catch(x){const y=x instanceof Error?x.message:"Failed to fetch plugins";d(y),console.error("[Plugins] Failed to fetch plugins:",x)}finally{l(!1)}},[u]);m.useEffect(()=>{n||p()},[n,p]);const f=m.useCallback(async x=>{try{const y=await Ce("/api/plugins/install",{method:"POST",body:JSON.stringify({url:x})}),v=await y.json();return y.ok?(await p(),{success:!0}):{success:!1,error:v.details||v.error||"Install failed"}}catch(y){return{success:!1,error:y instanceof Error?y.message:"Install failed"}}},[p]),h=m.useCallback(async x=>{try{const y=await Ce(`/api/plugins/${encodeURIComponent(x)}`,{method:"DELETE"}),v=await y.json();return y.ok?(await p(),{success:!0}):{success:!1,error:v.details||v.error||"Uninstall failed"}}catch(y){return{success:!1,error:y instanceof Error?y.message:"Uninstall failed"}}},[p]),g=m.useCallback(async x=>{try{const y=await Ce(`/api/plugins/${encodeURIComponent(x)}/update`,{method:"POST"}),v=await y.json();return y.ok?(await p(),{success:!0}):{success:!1,error:v.details||v.error||"Update failed"}}catch(y){return{success:!1,error:y instanceof Error?y.message:"Update failed"}}},[p]),b=m.useCallback(async(x,y)=>{try{const v=await Ce(`/api/plugins/${encodeURIComponent(x)}/enable`,{method:"PUT",body:JSON.stringify({enabled:y})});if(!v.ok){let w=`Toggle failed (${v.status})`;try{const k=await v.json();w=k.details||k.error||w}catch{w=v.statusText||w}return{success:!1,error:w}}return await p(),{success:!0,error:null}}catch(v){return{success:!1,error:v instanceof Error?v.message:"Toggle failed"}}},[p]);return i.jsx(J4.Provider,{value:{plugins:a,loading:o,pluginsError:c,refreshPlugins:p,installPlugin:f,uninstallPlugin:h,updatePlugin:g,togglePlugin:b},children:e})}const xk=e=>typeof window>"u"?!1:window.innerWidth<e,yk=()=>{if(typeof window>"u")return!1;const e=window.navigator;return window.matchMedia("(display-mode: standalone)").matches||!!e.standalone||document.referrer.includes("android-app://")};function Zg(e={}){const{mobileBreakpoint:t=768,trackMobile:r=!0,trackPWA:n=!0}=e,[a,s]=m.useState(()=>r?xk(t):!1),[o,l]=m.useState(()=>n?yk():!1);return m.useEffect(()=>{if(!r||typeof window>"u")return;const c=()=>{s(xk(t))};return c(),window.addEventListener("resize",c),()=>{window.removeEventListener("resize",c)}},[t,r]),m.useEffect(()=>{if(!n||typeof window>"u")return;const c=window.matchMedia("(display-mode: standalone)"),d=()=>{l(yk())};return d(),typeof c.addEventListener=="function"?(c.addEventListener("change",d),()=>{c.removeEventListener("change",d)}):(c.addListener(d),()=>{c.removeListener(d)})},[n]),{isMobile:a,isPWA:o}}const Xg="pixcode.updateCheck.preferences",bf="pixcode:update-check-settings-changed",Jg=[{value:"30m",label:"Every 30 minutes",intervalMs:1800*1e3},{value:"24h",label:"Daily",intervalMs:1440*60*1e3},{value:"12h",label:"Every 12 hours",intervalMs:720*60*1e3},{value:"6h",label:"Every 6 hours",intervalMs:360*60*1e3},{value:"7d",label:"Weekly",intervalMs:10080*60*1e3},{value:"off",label:"Manual only",intervalMs:null}],xf={frequency:"30m"};function vk(e){return Jg.find(t=>t.value===e.frequency)?.intervalMs??null}function Q4(e){if(!e||typeof e!="object")return xf;const t=e.frequency;return Jg.some(r=>r.value===t)?{frequency:t}:xf}function wk(){try{const e=localStorage.getItem(Xg);return Q4(e?JSON.parse(e):null)}catch{return xf}}function jO(e){const t=Q4(e);localStorage.setItem(Xg,JSON.stringify(t)),window.dispatchEvent(new CustomEvent(bf,{detail:t}))}const em=(e,t)=>{const r=e.split(".").map(Number),n=t.split(".").map(Number);for(let a=0;a<Math.max(r.length,n.length);a++){const s=r[a]||0,o=n[a]||0;if(s!==o)return s-o}return 0},IO="1.52.1",lu="pixcode:update-available",RO=360*60*1e3,tm=new Map;function eE(e,t){return`pixcode.updateCheck.cache.${e}.${t}`}function _O(e,t){try{const r=localStorage.getItem(eE(e,t));if(!r)return null;const n=JSON.parse(r);return{fetchedAt:typeof n.fetchedAt=="number"?n.fetchedAt:null,latestVersion:typeof n.latestVersion=="string"?n.latestVersion:null,releaseInfo:n.releaseInfo??null,rateLimitedUntil:typeof n.rateLimitedUntil=="number"?n.rateLimitedUntil:void 0}}catch{return null}}function kk(e,t,r){localStorage.setItem(eE(e,t),JSON.stringify(r))}function PO(e,t){const r=`${e}/${t}`,n=tm.get(r);if(n)return n;const a=fetch(`https://api.github.com/repos/${e}/${t}/releases/latest`,{cache:"no-store",headers:{Accept:"application/vnd.github+json"}}).then(async s=>({status:s.status,ok:s.ok,data:await s.json().catch(()=>({}))})).finally(()=>{tm.delete(r)});return tm.set(r,a),a}const Qg=(e,t)=>{const[r,n]=m.useState(!1),[a,s]=m.useState(null),[o,l]=m.useState(null),[c,d]=m.useState("git"),[u,p]=m.useState("idle"),[f,h]=m.useState(null),[g,b]=m.useState(()=>wk()),[x,y]=m.useState(IO),v=m.useRef(null),w=m.useCallback(S=>{jO(S),b(S)},[]);m.useEffect(()=>{const S=()=>b(wk()),N=E=>{E.key===Xg&&S()};return window.addEventListener("storage",N),window.addEventListener(bf,S),()=>{window.removeEventListener("storage",N),window.removeEventListener(bf,S)}},[]),m.useEffect(()=>{let S=!1;const N=async()=>{try{const A=await(await fetch("/health",{cache:"no-store"})).json();if(S)return;(A.installMode==="npm"||A.installMode==="git")&&d(A.installMode),typeof A.version=="string"&&/^\d+\.\d+\.\d+/.test(A.version)&&y(A.version)}catch{}};N();const E=()=>{N()};return window.addEventListener("focus",E),()=>{S=!0,window.removeEventListener("focus",E)}},[]),m.useEffect(()=>{if(!x)return;let S=!1;const N=(j,R,C,D)=>({updateAvailable:!!(j&&em(j,x)>0),latestVersion:j,releaseInfo:R,currentVersion:x,checkedAt:C,status:D}),E=j=>{!j.updateAvailable||!j.latestVersion||!j.releaseInfo||window.dispatchEvent(new CustomEvent(lu,{detail:j}))},I=(j,R,C,D="success")=>{if(!j||!R)return n(!1),s(null),l(null),h(C),N(null,null,C,D);s(j),n(em(j,x)>0),l(R),h(C);const B=N(j,R,C,D);return E(B),B},A=async({force:j=!1}={})=>{const R=vk(g),C=_O(e,t),D=Date.now();if(!j&&R===null)return p("idle"),I(C?.latestVersion??null,C?.releaseInfo??null,C?.fetchedAt??null,"idle");if(!j&&C?.fetchedAt&&R!==null&&D-C.fetchedAt<R)return p("success"),I(C.latestVersion,C.releaseInfo,C.fetchedAt,"success");if(!j&&C?.rateLimitedUntil&&C.rateLimitedUntil>D)return p("error"),I(C.latestVersion,C.releaseInfo,C.fetchedAt,"error");try{p("checking");const B=await PO(e,t);if(S)return N(C?.latestVersion??null,C?.releaseInfo??null,C?.fetchedAt??null,"idle");const F=B.data;if(!B.ok)return B.status===403&&kk(e,t,{fetchedAt:C?.fetchedAt??null,latestVersion:C?.latestVersion??null,releaseInfo:C?.releaseInfo??null,rateLimitedUntil:D+Math.max(R??0,RO)}),p("error"),I(C?.latestVersion??null,C?.releaseInfo??null,C?.fetchedAt??null,"error");if(F.tag_name){const V=F.tag_name.replace(/^v/,""),K=em(V,x)>0,L={title:F.name||F.tag_name,body:F.body||"",htmlUrl:F.html_url||`https://github.com/${e}/${t}/releases/latest`,publishedAt:F.published_at||""};kk(e,t,{fetchedAt:D,latestVersion:V,releaseInfo:L}),s(V),n(K),K&&m4({key:`app-update:${V}`,title:"Pixcode update available",body:`Pixcode ${x} can update to ${V}.`,tag:"pixcode-app-update",data:{type:"app-update",latestVersion:V,installMode:c}}),l(L),p("success"),h(D);const G=N(V,L,D,"success");return E(G),G}else return n(!1),s(null),l(null),p("error"),N(null,null,null,"error")}catch(B){return console.error("Version check failed:",B),n(!1),s(null),l(null),p("error"),N(null,null,null,"error")}};v.current=A,A();const T=vk(g),_=T===null?null:window.setInterval(()=>{A()},T);return()=>{S=!0,_!==null&&window.clearInterval(_)}},[e,t,x,c,g]);const k=m.useCallback(async()=>v.current?await v.current({force:!0}):null,[]);return{updateAvailable:r,latestVersion:a,currentVersion:x,releaseInfo:o,installMode:c,checkStatus:u,lastCheckedAt:f,manualCheck:k,updateCheckPreferences:g,updatePreferences:w}},is={autoExpandTools:!1,showRawParameters:!1,showThinking:!0,autoScrollToBottom:!0,sendByCtrlEnter:!1,changeAwareness:!1,sidebarVisible:!0,historyView:"flat",autoShowAgentDiff:"openOnly"},LO=["flat","grouped"],DO=e=>typeof e=="string"&&LO.includes(e),OO=["always","openOnly","off"],MO=e=>typeof e=="string"&&OO.includes(e),cu=Object.keys(is),FO=new Set(cu),rm="ui-preferences:sync",zO=(e,t)=>{if(typeof e=="boolean")return e;if(typeof e=="string"){if(e==="true")return!0;if(e==="false")return!1}return t},du=(e,t,r)=>e==="historyView"?DO(t)?t:r:e==="autoShowAgentDiff"?MO(t)?t:r:zO(t,r),BO=(e,t)=>{try{const r=localStorage.getItem(e);if(r===null)return t;const n=JSON.parse(r);return du(e,n,t)}catch{return t}},UO=e=>{if(typeof window>"u")return is;try{const t=localStorage.getItem(e);if(t){const r=JSON.parse(t);if(r&&typeof r=="object"&&!Array.isArray(r)){const n=r;return cu.reduce((a,s)=>(a[s]=du(s,n[s],is[s]),a),{...is})}}}catch{}return cu.reduce((t,r)=>(t[r]=BO(r,is[r]),t),{...is})};function $O(e,t){switch(t.type){case"set":{const{key:r,value:n}=t;if(!FO.has(r))return e;const a=du(r,n,e[r]);return e[r]===a?e:{...e,[r]:a}}case"set_many":{const r=t.value||{};let n=!1;const a={...e};for(const s of cu){if(!(s in r))continue;const o=r[s],l=du(s,o,e[s]);a[s]!==l&&(a[s]=l,n=!0)}return n?a:e}case"reset":return{...is,...t.value||{}};default:return e}}function tp(e="uiPreferences"){const t=m.useRef(`ui-preferences-${Math.random().toString(36).slice(2)}`),[r,n]=m.useReducer($O,e,UO);return m.useEffect(()=>{typeof window>"u"||(localStorage.setItem(e,JSON.stringify(r)),window.dispatchEvent(new CustomEvent(rm,{detail:{storageKey:e,sourceId:t.current,value:r}})))},[r,e]),m.useEffect(()=>{if(typeof window>"u")return;const l=u=>{!u||typeof u!="object"||Array.isArray(u)||n({type:"set_many",value:u})},c=u=>{if(!(u.key!==e||u.newValue===null))try{const p=JSON.parse(u.newValue);l(p)}catch{}},d=u=>{const f=u.detail;!f||f.storageKey!==e||f.sourceId===t.current||l(f.value)};return window.addEventListener("storage",c),window.addEventListener(rm,d),()=>{window.removeEventListener("storage",c),window.removeEventListener(rm,d)}},[e]),{preferences:r,setPreference:(l,c)=>{n({type:"set",key:l,value:c})},setPreferences:l=>{n({type:"set_many",value:l})},resetPreferences:l=>{n({type:"reset",value:l})},dispatch:n}}const HO=()=>{try{const e=localStorage.getItem("claude-settings");return e&&JSON.parse(e).projectSortOrder==="date"?"date":"name"}catch{return"name"}},GO=()=>{try{const e=localStorage.getItem("starredProjects");return e?new Set(JSON.parse(e)):new Set}catch{return new Set}},VO=e=>{try{localStorage.setItem("starredProjects",JSON.stringify([...e]))}catch{}},Sk=(e,t)=>`${e}::${t}`,WO=()=>{try{const e=localStorage.getItem("starredSessions");return e?new Set(JSON.parse(e)):new Set}catch{return new Set}},qO=e=>{try{localStorage.setItem("starredSessions",JSON.stringify([...e]))}catch{}},KO=/(?:^|[\s/\\(\[`"'])([\w./-]+?\.(?:ts|tsx|js|jsx|mjs|cjs|py|rb|go|rs|java|kt|swift|c|cc|cpp|h|hpp|cs|php|sh|bash|zsh|json|ya?ml|toml|md|mdx|html?|css|scss|less|sql|prisma|graphql|gql|vue|svelte|astro|dart|lua|r|pl|ps1|tf|dockerfile|env))(?:$|[\s:,)\]`"'])/i,YO=e=>{if(!e)return[];const t=new Set,r=new RegExp(KO.source,"gi");let n;for(;(n=r.exec(e))!==null;){const a=n[1],s=a.lastIndexOf(".");if(s>-1){const o=a.slice(s+1).toLowerCase();o&&o.length<=10&&t.add(o)}if(t.size>=3)break}return[...t]},ps=e=>e.__provider==="cursor"?new Date(e.createdAt||0):e.__provider==="codex"?new Date(e.createdAt||e.lastActivity||0):new Date(e.lastActivity||e.createdAt||0),ZO=(e,t)=>e.__provider==="cursor"?e.summary||e.name||t("projects.untitledSession"):e.__provider==="codex"?e.summary||e.name||t("projects.codexSession"):e.__provider==="gemini"||e.__provider==="qwen"||e.__provider==="opencode"?e.summary||e.name||t("projects.newSession"):e.summary||t("projects.newSession"),XO=e=>e.__provider==="cursor"?String(e.createdAt||""):e.__provider==="codex"?String(e.createdAt||e.lastActivity||""):String(e.lastActivity||e.createdAt||""),JO=(e,t,r)=>{const n=ps(e),a=Math.floor((t.getTime()-n.getTime())/(1e3*60));return{isCursorSession:e.__provider==="cursor",isCodexSession:e.__provider==="codex",isGeminiSession:e.__provider==="gemini",isQwenSession:e.__provider==="qwen",isOpencodeSession:e.__provider==="opencode",isActive:a<10,sessionName:ZO(e,r),sessionTime:XO(e),messageCount:Number(e.messageCount||0)}},tE=(e,t)=>{const r=[...e.sessions||[],...t[e.name]||[]].map(g=>({...g,__provider:"claude"})),n=(e.cursorSessions||[]).map(g=>({...g,__provider:"cursor"})),a=(e.codexSessions||[]).map(g=>({...g,__provider:"codex"})),s=g=>typeof g.id=="string"&&g.id.startsWith("qwen_")||g.provider==="qwen",o=g=>typeof g.id=="string"&&g.id.startsWith("opencode_")||g.provider==="opencode",l=e.geminiSessions||[],c=l.filter(g=>!s(g)&&!o(g)).map(g=>({...g,__provider:"gemini"})),d=l.filter(g=>s(g)).map(g=>({...g,__provider:"qwen"})),u=l.filter(g=>o(g)).map(g=>({...g,__provider:"opencode"})),p=[...(e.qwenSessions||[]).map(g=>({...g,__provider:"qwen"})),...d],f=[...(e.opencodeSessions||[]).map(g=>({...g,__provider:"opencode"})),...u],h=new Map;for(const g of[...r,...n,...a,...c,...p,...f])h.has(g.id)||h.set(g.id,g);return[...h.values()].sort((g,b)=>ps(b).getTime()-ps(g).getTime())},Ck=(e,t)=>{const r=tE(e,t);return r.length===0?new Date(0):r.reduce((n,a)=>{const s=ps(a);return s>n?s:n},new Date(0))},QO=(e,t,r,n)=>{const a=[...e];return a.sort((s,o)=>{const l=r.has(s.name),c=r.has(o.name);return l&&!c?-1:!l&&c?1:t==="date"?Ck(o,n).getTime()-Ck(s,n).getTime():(s.displayName||s.name).localeCompare(o.displayName||o.name)}),a},eM=(e,t)=>{const r=t.trim().toLowerCase();return r?e.filter(n=>{const a=(n.displayName||n.name).toLowerCase(),s=n.name.toLowerCase();return a.includes(r)||s.includes(r)}):e},tM=e=>{const t=typeof e.fullPath=="string"&&e.fullPath.length>0?e.fullPath:typeof e.path=="string"?e.path:"";return{name:e.name,displayName:typeof e.displayName=="string"&&e.displayName.trim().length>0?e.displayName:e.name,fullPath:t,path:typeof e.path=="string"&&e.path.length>0?e.path:t}};function rM({projects:e,selectedProject:t,selectedSession:r,isLoading:n,isMobile:a,t:s,onRefresh:o,onProjectSelect:l,onSessionSelect:c,onSessionDelete:d,onProjectDelete:u,setSidebarVisible:p,sidebarVisible:f}){const[h,g]=m.useState(new Set),[b,x]=m.useState(null),[y,v]=m.useState(!1),[w,k]=m.useState(""),[S,N]=m.useState({}),[E,I]=m.useState({}),[A,T]=m.useState(new Set),[_,j]=m.useState(new Date),[R,C]=m.useState("name"),[D,B]=m.useState(!1),[F,V]=m.useState({}),[K,L]=m.useState(null),[G,H]=m.useState(""),[z,te]=m.useState(""),[se,me]=m.useState(new Set),[de,ce]=m.useState(null),[ye,he]=m.useState(null),[ke,ve]=m.useState(!1),[je,M]=m.useState(()=>GO()),[ae,ue]=m.useState(()=>WO()),[Y,U]=m.useState("projects"),[Q,J]=m.useState(null),[re,le]=m.useState(!1),[Ee,fe]=m.useState(null),ne=m.useRef(null),Z=m.useRef(0),W=m.useRef(null),pe=!a&&!f;m.useEffect(()=>{const Ue=setInterval(()=>{j(new Date)},6e4);return()=>clearInterval(Ue)},[]),m.useEffect(()=>{I({}),T(new Set),V({})},[e]),m.useEffect(()=>{t&&g(Ue=>{if(Ue.has(t.name))return Ue;const Xe=new Set(Ue);return Xe.add(t.name),Xe})},[r,t]),m.useEffect(()=>{if(e.length>0&&!n){const Ue=new Set;e.forEach(Xe=>{Xe.sessions&&Xe.sessions.length>=0&&Ue.add(Xe.name)}),T(Ue)}},[e,n]),m.useEffect(()=>{const Ue=()=>{C(HO())};Ue();const Xe=lt=>{lt.key==="claude-settings"&&Ue()},ht=()=>Ue();return window.addEventListener("storage",Xe),window.addEventListener("pixcode:settings-changed",ht),()=>{window.removeEventListener("storage",Xe),window.removeEventListener("pixcode:settings-changed",ht)}},[]),m.useEffect(()=>{ne.current&&clearTimeout(ne.current),W.current&&(W.current.close(),W.current=null);const Ue=z.trim();if(Y!=="conversations"||Ue.length<2){Z.current+=1,J(null),fe(null),le(!1);return}le(!0);const Xe=++Z.current;return ne.current=setTimeout(()=>{if(Xe!==Z.current)return;const ht=Lt.searchConversationsUrl(Ue),lt=new EventSource(ht);W.current=lt;const kt=[];let Wt=0;lt.addEventListener("result",ee=>{if(Xe!==Z.current){lt.close();return}try{const Te=JSON.parse(ee.data);kt.push(Te.projectResult),Wt=Te.totalMatches,J({results:[...kt],totalMatches:Wt,query:Ue}),fe({scannedProjects:Te.scannedProjects,totalProjects:Te.totalProjects})}catch{}}),lt.addEventListener("progress",ee=>{if(Xe!==Z.current){lt.close();return}try{const Te=JSON.parse(ee.data);Wt=Te.totalMatches,fe({scannedProjects:Te.scannedProjects,totalProjects:Te.totalProjects})}catch{}}),lt.addEventListener("done",()=>{if(Xe!==Z.current){lt.close();return}lt.close(),W.current=null,le(!1),fe(null),kt.length===0&&J({results:[],totalMatches:0,query:Ue})}),lt.addEventListener("error",()=>{if(Xe!==Z.current){lt.close();return}lt.close(),W.current=null,le(!1),fe(null),kt.length===0&&J({results:[],totalMatches:0,query:Ue})})},400),()=>{ne.current&&clearTimeout(ne.current),W.current&&(W.current.close(),W.current=null)}},[z,Y]);const Ae=m.useCallback(Ue=>{g(Xe=>{const ht=new Set;return Xe.has(Ue)||ht.add(Ue),ht})},[]),Le=m.useCallback((Ue,Xe)=>{c({...Ue,__projectName:Xe})},[c]),Ge=m.useCallback(Ue=>{M(Xe=>{const ht=new Set(Xe);return ht.has(Ue)?ht.delete(Ue):ht.add(Ue),VO(ht),ht})},[]),rt=m.useCallback(Ue=>je.has(Ue),[je]),Ke=m.useCallback((Ue,Xe)=>{ue(ht=>{const lt=Sk(Ue,Xe),kt=new Set(ht);return kt.has(lt)?kt.delete(lt):kt.add(lt),qO(kt),kt})},[]),ct=m.useCallback((Ue,Xe)=>ae.has(Sk(Ue,Xe)),[ae]),st=m.useCallback(Ue=>tE(Ue,E),[E]),nt=m.useMemo(()=>e.map(Ue=>{const Xe=F[Ue.name];return Xe===void 0?Ue:{...Ue,sessionMeta:{...Ue.sessionMeta,hasMore:Xe}}}),[F,e]),bt=m.useMemo(()=>QO(nt,R,je,E),[E,R,nt,je]),Nt=m.useMemo(()=>eM(bt,z),[z,bt]),Pt=m.useCallback(Ue=>{x(Ue.name),k(Ue.displayName)},[]),Bt=m.useCallback(()=>{x(null),k("")},[]),Ar=m.useCallback(async Ue=>{try{(await Lt.renameProject(Ue,w)).ok?window.refreshProjects?await window.refreshProjects():window.location.reload():console.error("Failed to rename project")}catch(Xe){console.error("Error renaming project:",Xe)}finally{x(null),k("")}},[w]),Vt=m.useCallback((Ue,Xe,ht,lt="claude")=>{he({projectName:Ue,sessionId:Xe,sessionTitle:ht,provider:lt})},[]),br=m.useCallback(async()=>{if(!ye)return;const{projectName:Ue,sessionId:Xe,provider:ht}=ye;he(null);try{let lt;if(ht==="codex"?lt=await Lt.deleteCodexSession(Xe):ht==="gemini"?lt=await Lt.deleteGeminiSession(Xe):ht==="qwen"?lt=await Lt.deleteQwenSession(Xe):lt=await Lt.deleteSession(Ue,Xe),lt.ok)d?.(Xe);else{const kt=await lt.text();console.error("[Sidebar] Failed to delete session:",{status:lt.status,error:kt}),alert(s("messages.deleteSessionFailed"))}}catch(lt){console.error("[Sidebar] Error deleting session:",lt),alert(s("messages.deleteSessionError"))}},[d,ye,s]),tr=m.useCallback(Ue=>{ce({project:Ue,sessionCount:st(Ue).length})},[st]),Fe=m.useCallback(async(Ue=!1)=>{if(!de)return;const{project:Xe,sessionCount:ht}=de,lt=ht===0;ce(null),me(kt=>new Set([...kt,Xe.name]));try{const kt=await Lt.deleteProject(Xe.name,!lt,Ue);if(kt.ok)u?.(Xe.name);else{const Wt=await kt.json();alert(Wt.error||s("messages.deleteProjectFailed"))}}catch(kt){console.error("Error deleting project:",kt),alert(s("messages.deleteProjectError"))}finally{me(kt=>{const Wt=new Set(kt);return Wt.delete(Xe.name),Wt})}},[de,u,s]),Re=m.useCallback(async Ue=>{const Xe=F[Ue.name];if(!(!(Xe!==void 0?Xe:Ue.sessionMeta?.hasMore===!0)||S[Ue.name])){N(lt=>({...lt,[Ue.name]:!0}));try{const lt=(Ue.sessions?.length||0)+(E[Ue.name]?.length||0),kt=await Lt.sessions(Ue.name,5,lt);if(!kt.ok)return;const Wt=await kt.json();I(ee=>({...ee,[Ue.name]:[...ee[Ue.name]||[],...Wt.sessions||[]]})),Wt.hasMore===!1&&V(ee=>({...ee,[Ue.name]:!1}))}catch(lt){console.error("Error loading more sessions:",lt)}finally{N(lt=>({...lt,[Ue.name]:!1}))}}},[E,S,F]),Me=m.useCallback(Ue=>{l(Ue)},[l]),Ze=m.useCallback(async()=>{B(!0);try{await o()}finally{B(!1)}},[o]),xt=m.useCallback(async(Ue,Xe,ht,lt)=>{const kt=ht.trim();if(!kt){L(null),H("");return}try{const Wt=await Lt.renameSession(Xe,kt,lt);Wt.ok?await o():(console.error("[Sidebar] Failed to rename session:",Wt.status),alert(s("messages.renameSessionFailed")))}catch(Wt){console.error("[Sidebar] Error renaming session:",Wt),alert(s("messages.renameSessionError"))}finally{L(null),H("")}},[o,s]),yt=m.useCallback(()=>{p(!1)},[p]),zt=m.useCallback(()=>{p(!0)},[p]);return{isSidebarCollapsed:pe,expandedProjects:h,editingProject:b,showNewProject:y,editingName:w,loadingSessions:S,additionalSessions:E,initialSessionsLoaded:A,currentTime:_,projectSortOrder:R,isRefreshing:D,editingSession:K,editingSessionName:G,searchFilter:z,deletingProjects:se,deleteConfirmation:de,sessionDeleteConfirmation:ye,showVersionModal:ke,starredProjects:je,starredSessions:ae,filteredProjects:Nt,toggleProject:Ae,handleSessionClick:Le,toggleStarProject:Ge,isProjectStarred:rt,toggleStarSession:Ke,isSessionStarred:ct,getProjectSessions:st,startEditing:Pt,cancelEditing:Bt,saveProjectName:Ar,showDeleteSessionConfirmation:Vt,confirmDeleteSession:br,requestProjectDelete:tr,confirmDeleteProject:Fe,loadMoreSessions:Re,handleProjectSelect:Me,refreshProjects:Ze,updateSessionSummary:xt,collapseSidebar:yt,expandSidebar:zt,setShowNewProject:v,setEditingName:k,setEditingSession:L,setEditingSessionName:H,searchMode:Y,setSearchMode:U,conversationResults:Q,isSearching:re,searchProgress:Ee,clearConversationResults:m.useCallback(()=>{Z.current+=1,W.current&&(W.current.close(),W.current=null),le(!1),fe(null),J(null)},[]),setSearchFilter:te,setDeleteConfirmation:ce,setSessionDeleteConfirmation:he,setShowVersionModal:ve}}const nM="https://discord.gg/buxwujPNRE",aM="https://github.com/alicomert/pixcode/issues/new";function iM({className:e}){return i.jsx("svg",{className:e,fill:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:i.jsx("path",{d:"M20.317 4.37a19.791 19.791 0 0 0-4.885-1.515.074.074 0 0 0-.079.037c-.21.375-.444.864-.608 1.25a18.27 18.27 0 0 0-5.487 0 12.64 12.64 0 0 0-.617-1.25.077.077 0 0 0-.079-.037A19.736 19.736 0 0 0 3.677 4.37a.07.07 0 0 0-.032.027C.533 9.046-.32 13.58.099 18.057a.082.082 0 0 0 .031.057 19.9 19.9 0 0 0 5.993 3.03.078.078 0 0 0 .084-.028c.462-.63.874-1.295 1.226-1.994a.076.076 0 0 0-.041-.106 13.107 13.107 0 0 1-1.872-.892.077.077 0 0 1-.008-.128 10.2 10.2 0 0 0 .372-.292.074.074 0 0 1 .077-.01c3.928 1.793 8.18 1.793 12.062 0a.074.074 0 0 1 .078.01c.12.098.246.198.373.292a.077.077 0 0 1-.006.127 12.299 12.299 0 0 1-1.873.892.077.077 0 0 0-.041.107c.36.698.772 1.362 1.225 1.993a.076.076 0 0 0 .084.028 19.839 19.839 0 0 0 6.002-3.03.077.077 0 0 0 .032-.054c.5-5.177-.838-9.674-3.549-13.66a.061.061 0 0 0-.031-.03zM8.02 15.33c-1.183 0-2.157-1.085-2.157-2.419 0-1.333.956-2.419 2.157-2.419 1.21 0 2.176 1.095 2.157 2.42 0 1.333-.956 2.418-2.157 2.418zm7.975 0c-1.183 0-2.157-1.085-2.157-2.419 0-1.333.955-2.419 2.157-2.419 1.21 0 2.176 1.095 2.157 2.42 0 1.333-.946 2.418-2.157 2.418z"})})}function sM({onExpand:e,onOpenControlRoom:t,onShowSettings:r,updateAvailable:n,onShowVersionModal:a,t:s}){return i.jsxs("div",{className:"flex h-full w-12 flex-col items-center gap-1 bg-background/80 py-3 backdrop-blur-sm",children:[i.jsx("button",{onClick:e,className:"group flex h-8 w-8 items-center justify-center rounded-lg transition-colors hover:bg-accent/80","aria-label":s("common:versionUpdate.ariaLabels.showSidebar"),title:s("common:versionUpdate.ariaLabels.showSidebar"),children:i.jsx(Yu,{className:"h-4 w-4 text-muted-foreground transition-colors group-hover:text-foreground"})}),i.jsx("div",{className:"nav-divider my-1 w-6"}),t&&i.jsx("button",{onClick:t,className:"group flex h-8 w-8 items-center justify-center rounded-lg border border-primary/25 bg-primary/10 transition-colors hover:bg-primary/15","aria-label":s("actions.controlRoom",{defaultValue:"Control Room"}),title:s("actions.controlRoom",{defaultValue:"Control Room"}),children:i.jsx($n,{className:"h-4 w-4 text-primary"})}),i.jsx("button",{onClick:r,className:"group flex h-8 w-8 items-center justify-center rounded-lg transition-colors hover:bg-accent/80","aria-label":s("actions.settings"),title:s("actions.settings"),children:i.jsx(Ht,{className:"h-4 w-4 text-muted-foreground transition-colors group-hover:text-foreground"})}),i.jsx("a",{href:aM,target:"_blank",rel:"noopener noreferrer",className:"group flex h-8 w-8 items-center justify-center rounded-lg transition-colors hover:bg-accent/80","aria-label":s("actions.reportIssue"),title:s("actions.reportIssue"),children:i.jsx(To,{className:"h-4 w-4 text-muted-foreground transition-colors group-hover:text-foreground"})}),i.jsx("a",{href:nM,target:"_blank",rel:"noopener noreferrer",className:"group flex h-8 w-8 items-center justify-center rounded-lg transition-colors hover:bg-accent/80","aria-label":s("actions.joinCommunity"),title:s("actions.joinCommunity"),children:i.jsx(iM,{className:"h-4 w-4 text-muted-foreground transition-colors group-hover:text-foreground"})}),n&&i.jsxs("button",{onClick:a,className:"relative flex h-8 w-8 items-center justify-center rounded-lg transition-colors hover:bg-accent/80","aria-label":s("common:versionUpdate.ariaLabels.updateAvailable"),title:s("common:versionUpdate.ariaLabels.updateAvailable"),children:[i.jsx($n,{className:"h-4 w-4 text-blue-500"}),i.jsx("span",{className:"absolute right-1.5 top-1.5 h-1.5 w-1.5 animate-pulse rounded-full bg-blue-500"})]})]})}function rE(e){var t,r,n="";if(typeof e=="string"||typeof e=="number")n+=e;else if(typeof e=="object")if(Array.isArray(e)){var a=e.length;for(t=0;t<a;t++)e[t]&&(r=rE(e[t]))&&(n&&(n+=" "),n+=r)}else for(r in e)e[r]&&(n&&(n+=" "),n+=r);return n}function nE(){for(var e,t,r=0,n="",a=arguments.length;r<a;r++)(e=arguments[r])&&(t=rE(e))&&(n&&(n+=" "),n+=t);return n}const Nk=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,Ek=nE,e0=(e,t)=>r=>{var n;if(t?.variants==null)return Ek(e,r?.class,r?.className);const{variants:a,defaultVariants:s}=t,o=Object.keys(a).map(d=>{const u=r?.[d],p=s?.[d];if(u===null)return null;const f=Nk(u)||Nk(p);return a[d][f]}),l=r&&Object.entries(r).reduce((d,u)=>{let[p,f]=u;return f===void 0||(d[p]=f),d},{}),c=t==null||(n=t.compoundVariants)===null||n===void 0?void 0:n.reduce((d,u)=>{let{class:p,className:f,...h}=u;return Object.entries(h).every(g=>{let[b,x]=g;return Array.isArray(x)?x.includes({...s,...l}[b]):{...s,...l}[b]===x})?[...d,p,f]:d},[]);return Ek(e,o,c,r?.class,r?.className)},t0="-",oM=e=>{const t=cM(e),{conflictingClassGroups:r,conflictingClassGroupModifiers:n}=e;return{getClassGroupId:o=>{const l=o.split(t0);return l[0]===""&&l.length!==1&&l.shift(),aE(l,t)||lM(o)},getConflictingClassGroupIds:(o,l)=>{const c=r[o]||[];return l&&n[o]?[...c,...n[o]]:c}}},aE=(e,t)=>{if(e.length===0)return t.classGroupId;const r=e[0],n=t.nextPart.get(r),a=n?aE(e.slice(1),n):void 0;if(a)return a;if(t.validators.length===0)return;const s=e.join(t0);return t.validators.find(({validator:o})=>o(s))?.classGroupId},Tk=/^\[(.+)\]$/,lM=e=>{if(Tk.test(e)){const t=Tk.exec(e)[1],r=t?.substring(0,t.indexOf(":"));if(r)return"arbitrary.."+r}},cM=e=>{const{theme:t,classGroups:r}=e,n={nextPart:new Map,validators:[]};for(const a in r)yf(r[a],n,a,t);return n},yf=(e,t,r,n)=>{e.forEach(a=>{if(typeof a=="string"){const s=a===""?t:Ak(t,a);s.classGroupId=r;return}if(typeof a=="function"){if(dM(a)){yf(a(n),t,r,n);return}t.validators.push({validator:a,classGroupId:r});return}Object.entries(a).forEach(([s,o])=>{yf(o,Ak(t,s),r,n)})})},Ak=(e,t)=>{let r=e;return t.split(t0).forEach(n=>{r.nextPart.has(n)||r.nextPart.set(n,{nextPart:new Map,validators:[]}),r=r.nextPart.get(n)}),r},dM=e=>e.isThemeGetter,uM=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,r=new Map,n=new Map;const a=(s,o)=>{r.set(s,o),t++,t>e&&(t=0,n=r,r=new Map)};return{get(s){let o=r.get(s);if(o!==void 0)return o;if((o=n.get(s))!==void 0)return a(s,o),o},set(s,o){r.has(s)?r.set(s,o):a(s,o)}}},vf="!",wf=":",pM=wf.length,mM=e=>{const{prefix:t,experimentalParseClassName:r}=e;let n=a=>{const s=[];let o=0,l=0,c=0,d;for(let g=0;g<a.length;g++){let b=a[g];if(o===0&&l===0){if(b===wf){s.push(a.slice(c,g)),c=g+pM;continue}if(b==="/"){d=g;continue}}b==="["?o++:b==="]"?o--:b==="("?l++:b===")"&&l--}const u=s.length===0?a:a.substring(c),p=hM(u),f=p!==u,h=d&&d>c?d-c:void 0;return{modifiers:s,hasImportantModifier:f,baseClassName:p,maybePostfixModifierPosition:h}};if(t){const a=t+wf,s=n;n=o=>o.startsWith(a)?s(o.substring(a.length)):{isExternal:!0,modifiers:[],hasImportantModifier:!1,baseClassName:o,maybePostfixModifierPosition:void 0}}if(r){const a=n;n=s=>r({className:s,parseClassName:a})}return n},hM=e=>e.endsWith(vf)?e.substring(0,e.length-1):e.startsWith(vf)?e.substring(1):e,fM=e=>{const t=Object.fromEntries(e.orderSensitiveModifiers.map(n=>[n,!0]));return n=>{if(n.length<=1)return n;const a=[];let s=[];return n.forEach(o=>{o[0]==="["||t[o]?(a.push(...s.sort(),o),s=[]):s.push(o)}),a.push(...s.sort()),a}},gM=e=>({cache:uM(e.cacheSize),parseClassName:mM(e),sortModifiers:fM(e),...oM(e)}),bM=/\s+/,xM=(e,t)=>{const{parseClassName:r,getClassGroupId:n,getConflictingClassGroupIds:a,sortModifiers:s}=t,o=[],l=e.trim().split(bM);let c="";for(let d=l.length-1;d>=0;d-=1){const u=l[d],{isExternal:p,modifiers:f,hasImportantModifier:h,baseClassName:g,maybePostfixModifierPosition:b}=r(u);if(p){c=u+(c.length>0?" "+c:c);continue}let x=!!b,y=n(x?g.substring(0,b):g);if(!y){if(!x){c=u+(c.length>0?" "+c:c);continue}if(y=n(g),!y){c=u+(c.length>0?" "+c:c);continue}x=!1}const v=s(f).join(":"),w=h?v+vf:v,k=w+y;if(o.includes(k))continue;o.push(k);const S=a(y,x);for(let N=0;N<S.length;++N){const E=S[N];o.push(w+E)}c=u+(c.length>0?" "+c:c)}return c};function yM(){let e=0,t,r,n="";for(;e<arguments.length;)(t=arguments[e++])&&(r=iE(t))&&(n&&(n+=" "),n+=r);return n}const iE=e=>{if(typeof e=="string")return e;let t,r="";for(let n=0;n<e.length;n++)e[n]&&(t=iE(e[n]))&&(r&&(r+=" "),r+=t);return r};function vM(e,...t){let r,n,a,s=o;function o(c){const d=t.reduce((u,p)=>p(u),e());return r=gM(d),n=r.cache.get,a=r.cache.set,s=l,l(c)}function l(c){const d=n(c);if(d)return d;const u=xM(c,r);return a(c,u),u}return function(){return s(yM.apply(null,arguments))}}const jr=e=>{const t=r=>r[e]||[];return t.isThemeGetter=!0,t},sE=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,oE=/^\((?:(\w[\w-]*):)?(.+)\)$/i,wM=/^\d+\/\d+$/,kM=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,SM=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,CM=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,NM=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,EM=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Bs=e=>wM.test(e),St=e=>!!e&&!Number.isNaN(Number(e)),li=e=>!!e&&Number.isInteger(Number(e)),nm=e=>e.endsWith("%")&&St(e.slice(0,-1)),La=e=>kM.test(e),TM=()=>!0,AM=e=>SM.test(e)&&!CM.test(e),lE=()=>!1,jM=e=>NM.test(e),IM=e=>EM.test(e),RM=e=>!Qe(e)&&!et(e),_M=e=>Vo(e,uE,lE),Qe=e=>sE.test(e),Ki=e=>Vo(e,pE,AM),am=e=>Vo(e,MM,St),jk=e=>Vo(e,cE,lE),PM=e=>Vo(e,dE,IM),Jc=e=>Vo(e,mE,jM),et=e=>oE.test(e),vl=e=>Wo(e,pE),LM=e=>Wo(e,FM),Ik=e=>Wo(e,cE),DM=e=>Wo(e,uE),OM=e=>Wo(e,dE),Qc=e=>Wo(e,mE,!0),Vo=(e,t,r)=>{const n=sE.exec(e);return n?n[1]?t(n[1]):r(n[2]):!1},Wo=(e,t,r=!1)=>{const n=oE.exec(e);return n?n[1]?t(n[1]):r:!1},cE=e=>e==="position"||e==="percentage",dE=e=>e==="image"||e==="url",uE=e=>e==="length"||e==="size"||e==="bg-size",pE=e=>e==="length",MM=e=>e==="number",FM=e=>e==="family-name",mE=e=>e==="shadow",zM=()=>{const e=jr("color"),t=jr("font"),r=jr("text"),n=jr("font-weight"),a=jr("tracking"),s=jr("leading"),o=jr("breakpoint"),l=jr("container"),c=jr("spacing"),d=jr("radius"),u=jr("shadow"),p=jr("inset-shadow"),f=jr("text-shadow"),h=jr("drop-shadow"),g=jr("blur"),b=jr("perspective"),x=jr("aspect"),y=jr("ease"),v=jr("animate"),w=()=>["auto","avoid","all","avoid-page","page","left","right","column"],k=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],S=()=>[...k(),et,Qe],N=()=>["auto","hidden","clip","visible","scroll"],E=()=>["auto","contain","none"],I=()=>[et,Qe,c],A=()=>[Bs,"full","auto",...I()],T=()=>[li,"none","subgrid",et,Qe],_=()=>["auto",{span:["full",li,et,Qe]},li,et,Qe],j=()=>[li,"auto",et,Qe],R=()=>["auto","min","max","fr",et,Qe],C=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],D=()=>["start","end","center","stretch","center-safe","end-safe"],B=()=>["auto",...I()],F=()=>[Bs,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...I()],V=()=>[e,et,Qe],K=()=>[...k(),Ik,jk,{position:[et,Qe]}],L=()=>["no-repeat",{repeat:["","x","y","space","round"]}],G=()=>["auto","cover","contain",DM,_M,{size:[et,Qe]}],H=()=>[nm,vl,Ki],z=()=>["","none","full",d,et,Qe],te=()=>["",St,vl,Ki],se=()=>["solid","dashed","dotted","double"],me=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],de=()=>[St,nm,Ik,jk],ce=()=>["","none",g,et,Qe],ye=()=>["none",St,et,Qe],he=()=>["none",St,et,Qe],ke=()=>[St,et,Qe],ve=()=>[Bs,"full",...I()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[La],breakpoint:[La],color:[TM],container:[La],"drop-shadow":[La],ease:["in","out","in-out"],font:[RM],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[La],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[La],shadow:[La],spacing:["px",St],text:[La],"text-shadow":[La],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",Bs,Qe,et,x]}],container:["container"],columns:[{columns:[St,Qe,et,l]}],"break-after":[{"break-after":w()}],"break-before":[{"break-before":w()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:S()}],overflow:[{overflow:N()}],"overflow-x":[{"overflow-x":N()}],"overflow-y":[{"overflow-y":N()}],overscroll:[{overscroll:E()}],"overscroll-x":[{"overscroll-x":E()}],"overscroll-y":[{"overscroll-y":E()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:A()}],"inset-x":[{"inset-x":A()}],"inset-y":[{"inset-y":A()}],start:[{start:A()}],end:[{end:A()}],top:[{top:A()}],right:[{right:A()}],bottom:[{bottom:A()}],left:[{left:A()}],visibility:["visible","invisible","collapse"],z:[{z:[li,"auto",et,Qe]}],basis:[{basis:[Bs,"full","auto",l,...I()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[St,Bs,"auto","initial","none",Qe]}],grow:[{grow:["",St,et,Qe]}],shrink:[{shrink:["",St,et,Qe]}],order:[{order:[li,"first","last","none",et,Qe]}],"grid-cols":[{"grid-cols":T()}],"col-start-end":[{col:_()}],"col-start":[{"col-start":j()}],"col-end":[{"col-end":j()}],"grid-rows":[{"grid-rows":T()}],"row-start-end":[{row:_()}],"row-start":[{"row-start":j()}],"row-end":[{"row-end":j()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":R()}],"auto-rows":[{"auto-rows":R()}],gap:[{gap:I()}],"gap-x":[{"gap-x":I()}],"gap-y":[{"gap-y":I()}],"justify-content":[{justify:[...C(),"normal"]}],"justify-items":[{"justify-items":[...D(),"normal"]}],"justify-self":[{"justify-self":["auto",...D()]}],"align-content":[{content:["normal",...C()]}],"align-items":[{items:[...D(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...D(),{baseline:["","last"]}]}],"place-content":[{"place-content":C()}],"place-items":[{"place-items":[...D(),"baseline"]}],"place-self":[{"place-self":["auto",...D()]}],p:[{p:I()}],px:[{px:I()}],py:[{py:I()}],ps:[{ps:I()}],pe:[{pe:I()}],pt:[{pt:I()}],pr:[{pr:I()}],pb:[{pb:I()}],pl:[{pl:I()}],m:[{m:B()}],mx:[{mx:B()}],my:[{my:B()}],ms:[{ms:B()}],me:[{me:B()}],mt:[{mt:B()}],mr:[{mr:B()}],mb:[{mb:B()}],ml:[{ml:B()}],"space-x":[{"space-x":I()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":I()}],"space-y-reverse":["space-y-reverse"],size:[{size:F()}],w:[{w:[l,"screen",...F()]}],"min-w":[{"min-w":[l,"screen","none",...F()]}],"max-w":[{"max-w":[l,"screen","none","prose",{screen:[o]},...F()]}],h:[{h:["screen","lh",...F()]}],"min-h":[{"min-h":["screen","lh","none",...F()]}],"max-h":[{"max-h":["screen","lh",...F()]}],"font-size":[{text:["base",r,vl,Ki]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[n,et,am]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",nm,Qe]}],"font-family":[{font:[LM,Qe,t]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[a,et,Qe]}],"line-clamp":[{"line-clamp":[St,"none",et,am]}],leading:[{leading:[s,...I()]}],"list-image":[{"list-image":["none",et,Qe]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",et,Qe]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:V()}],"text-color":[{text:V()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...se(),"wavy"]}],"text-decoration-thickness":[{decoration:[St,"from-font","auto",et,Ki]}],"text-decoration-color":[{decoration:V()}],"underline-offset":[{"underline-offset":[St,"auto",et,Qe]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:I()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",et,Qe]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",et,Qe]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:K()}],"bg-repeat":[{bg:L()}],"bg-size":[{bg:G()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},li,et,Qe],radial:["",et,Qe],conic:[li,et,Qe]},OM,PM]}],"bg-color":[{bg:V()}],"gradient-from-pos":[{from:H()}],"gradient-via-pos":[{via:H()}],"gradient-to-pos":[{to:H()}],"gradient-from":[{from:V()}],"gradient-via":[{via:V()}],"gradient-to":[{to:V()}],rounded:[{rounded:z()}],"rounded-s":[{"rounded-s":z()}],"rounded-e":[{"rounded-e":z()}],"rounded-t":[{"rounded-t":z()}],"rounded-r":[{"rounded-r":z()}],"rounded-b":[{"rounded-b":z()}],"rounded-l":[{"rounded-l":z()}],"rounded-ss":[{"rounded-ss":z()}],"rounded-se":[{"rounded-se":z()}],"rounded-ee":[{"rounded-ee":z()}],"rounded-es":[{"rounded-es":z()}],"rounded-tl":[{"rounded-tl":z()}],"rounded-tr":[{"rounded-tr":z()}],"rounded-br":[{"rounded-br":z()}],"rounded-bl":[{"rounded-bl":z()}],"border-w":[{border:te()}],"border-w-x":[{"border-x":te()}],"border-w-y":[{"border-y":te()}],"border-w-s":[{"border-s":te()}],"border-w-e":[{"border-e":te()}],"border-w-t":[{"border-t":te()}],"border-w-r":[{"border-r":te()}],"border-w-b":[{"border-b":te()}],"border-w-l":[{"border-l":te()}],"divide-x":[{"divide-x":te()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":te()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...se(),"hidden","none"]}],"divide-style":[{divide:[...se(),"hidden","none"]}],"border-color":[{border:V()}],"border-color-x":[{"border-x":V()}],"border-color-y":[{"border-y":V()}],"border-color-s":[{"border-s":V()}],"border-color-e":[{"border-e":V()}],"border-color-t":[{"border-t":V()}],"border-color-r":[{"border-r":V()}],"border-color-b":[{"border-b":V()}],"border-color-l":[{"border-l":V()}],"divide-color":[{divide:V()}],"outline-style":[{outline:[...se(),"none","hidden"]}],"outline-offset":[{"outline-offset":[St,et,Qe]}],"outline-w":[{outline:["",St,vl,Ki]}],"outline-color":[{outline:V()}],shadow:[{shadow:["","none",u,Qc,Jc]}],"shadow-color":[{shadow:V()}],"inset-shadow":[{"inset-shadow":["none",p,Qc,Jc]}],"inset-shadow-color":[{"inset-shadow":V()}],"ring-w":[{ring:te()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:V()}],"ring-offset-w":[{"ring-offset":[St,Ki]}],"ring-offset-color":[{"ring-offset":V()}],"inset-ring-w":[{"inset-ring":te()}],"inset-ring-color":[{"inset-ring":V()}],"text-shadow":[{"text-shadow":["none",f,Qc,Jc]}],"text-shadow-color":[{"text-shadow":V()}],opacity:[{opacity:[St,et,Qe]}],"mix-blend":[{"mix-blend":[...me(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":me()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[St]}],"mask-image-linear-from-pos":[{"mask-linear-from":de()}],"mask-image-linear-to-pos":[{"mask-linear-to":de()}],"mask-image-linear-from-color":[{"mask-linear-from":V()}],"mask-image-linear-to-color":[{"mask-linear-to":V()}],"mask-image-t-from-pos":[{"mask-t-from":de()}],"mask-image-t-to-pos":[{"mask-t-to":de()}],"mask-image-t-from-color":[{"mask-t-from":V()}],"mask-image-t-to-color":[{"mask-t-to":V()}],"mask-image-r-from-pos":[{"mask-r-from":de()}],"mask-image-r-to-pos":[{"mask-r-to":de()}],"mask-image-r-from-color":[{"mask-r-from":V()}],"mask-image-r-to-color":[{"mask-r-to":V()}],"mask-image-b-from-pos":[{"mask-b-from":de()}],"mask-image-b-to-pos":[{"mask-b-to":de()}],"mask-image-b-from-color":[{"mask-b-from":V()}],"mask-image-b-to-color":[{"mask-b-to":V()}],"mask-image-l-from-pos":[{"mask-l-from":de()}],"mask-image-l-to-pos":[{"mask-l-to":de()}],"mask-image-l-from-color":[{"mask-l-from":V()}],"mask-image-l-to-color":[{"mask-l-to":V()}],"mask-image-x-from-pos":[{"mask-x-from":de()}],"mask-image-x-to-pos":[{"mask-x-to":de()}],"mask-image-x-from-color":[{"mask-x-from":V()}],"mask-image-x-to-color":[{"mask-x-to":V()}],"mask-image-y-from-pos":[{"mask-y-from":de()}],"mask-image-y-to-pos":[{"mask-y-to":de()}],"mask-image-y-from-color":[{"mask-y-from":V()}],"mask-image-y-to-color":[{"mask-y-to":V()}],"mask-image-radial":[{"mask-radial":[et,Qe]}],"mask-image-radial-from-pos":[{"mask-radial-from":de()}],"mask-image-radial-to-pos":[{"mask-radial-to":de()}],"mask-image-radial-from-color":[{"mask-radial-from":V()}],"mask-image-radial-to-color":[{"mask-radial-to":V()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":k()}],"mask-image-conic-pos":[{"mask-conic":[St]}],"mask-image-conic-from-pos":[{"mask-conic-from":de()}],"mask-image-conic-to-pos":[{"mask-conic-to":de()}],"mask-image-conic-from-color":[{"mask-conic-from":V()}],"mask-image-conic-to-color":[{"mask-conic-to":V()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:K()}],"mask-repeat":[{mask:L()}],"mask-size":[{mask:G()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",et,Qe]}],filter:[{filter:["","none",et,Qe]}],blur:[{blur:ce()}],brightness:[{brightness:[St,et,Qe]}],contrast:[{contrast:[St,et,Qe]}],"drop-shadow":[{"drop-shadow":["","none",h,Qc,Jc]}],"drop-shadow-color":[{"drop-shadow":V()}],grayscale:[{grayscale:["",St,et,Qe]}],"hue-rotate":[{"hue-rotate":[St,et,Qe]}],invert:[{invert:["",St,et,Qe]}],saturate:[{saturate:[St,et,Qe]}],sepia:[{sepia:["",St,et,Qe]}],"backdrop-filter":[{"backdrop-filter":["","none",et,Qe]}],"backdrop-blur":[{"backdrop-blur":ce()}],"backdrop-brightness":[{"backdrop-brightness":[St,et,Qe]}],"backdrop-contrast":[{"backdrop-contrast":[St,et,Qe]}],"backdrop-grayscale":[{"backdrop-grayscale":["",St,et,Qe]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[St,et,Qe]}],"backdrop-invert":[{"backdrop-invert":["",St,et,Qe]}],"backdrop-opacity":[{"backdrop-opacity":[St,et,Qe]}],"backdrop-saturate":[{"backdrop-saturate":[St,et,Qe]}],"backdrop-sepia":[{"backdrop-sepia":["",St,et,Qe]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":I()}],"border-spacing-x":[{"border-spacing-x":I()}],"border-spacing-y":[{"border-spacing-y":I()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",et,Qe]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[St,"initial",et,Qe]}],ease:[{ease:["linear","initial",y,et,Qe]}],delay:[{delay:[St,et,Qe]}],animate:[{animate:["none",v,et,Qe]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[b,et,Qe]}],"perspective-origin":[{"perspective-origin":S()}],rotate:[{rotate:ye()}],"rotate-x":[{"rotate-x":ye()}],"rotate-y":[{"rotate-y":ye()}],"rotate-z":[{"rotate-z":ye()}],scale:[{scale:he()}],"scale-x":[{"scale-x":he()}],"scale-y":[{"scale-y":he()}],"scale-z":[{"scale-z":he()}],"scale-3d":["scale-3d"],skew:[{skew:ke()}],"skew-x":[{"skew-x":ke()}],"skew-y":[{"skew-y":ke()}],transform:[{transform:[et,Qe,"","none","gpu","cpu"]}],"transform-origin":[{origin:S()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:ve()}],"translate-x":[{"translate-x":ve()}],"translate-y":[{"translate-y":ve()}],"translate-z":[{"translate-z":ve()}],"translate-none":["translate-none"],accent:[{accent:V()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:V()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",et,Qe]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":I()}],"scroll-mx":[{"scroll-mx":I()}],"scroll-my":[{"scroll-my":I()}],"scroll-ms":[{"scroll-ms":I()}],"scroll-me":[{"scroll-me":I()}],"scroll-mt":[{"scroll-mt":I()}],"scroll-mr":[{"scroll-mr":I()}],"scroll-mb":[{"scroll-mb":I()}],"scroll-ml":[{"scroll-ml":I()}],"scroll-p":[{"scroll-p":I()}],"scroll-px":[{"scroll-px":I()}],"scroll-py":[{"scroll-py":I()}],"scroll-ps":[{"scroll-ps":I()}],"scroll-pe":[{"scroll-pe":I()}],"scroll-pt":[{"scroll-pt":I()}],"scroll-pr":[{"scroll-pr":I()}],"scroll-pb":[{"scroll-pb":I()}],"scroll-pl":[{"scroll-pl":I()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",et,Qe]}],fill:[{fill:["none",...V()]}],"stroke-w":[{stroke:[St,vl,Ki,am]}],stroke:[{stroke:["none",...V()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}},BM=vM(zM);function xe(...e){return BM(nE(e))}function UM(e){if(!e||typeof e!="string")return null;try{return JSON.parse(e)}catch{return null}}const $M=e0("relative grid w-full grid-cols-[0_1fr] items-start gap-y-0.5 rounded-lg border px-4 py-3 text-sm has-[>svg]:grid-cols-[calc(var(--spacing)*4)_1fr] has-[>svg]:gap-x-3 [&>svg]:size-4 [&>svg]:translate-y-0.5 [&>svg]:text-current",{variants:{variant:{default:"bg-card text-card-foreground",destructive:"bg-card text-destructive *:data-[slot=alert-description]:text-destructive/90 [&>svg]:text-current"}},defaultVariants:{variant:"default"}}),hE=m.forwardRef(({className:e,variant:t,...r},n)=>i.jsx("div",{ref:n,role:"alert","data-slot":"alert",className:xe($M({variant:t}),e),...r}));hE.displayName="Alert";const HM=m.forwardRef(({className:e,...t},r)=>i.jsx("div",{ref:r,"data-slot":"alert-title",className:xe("col-start-2 line-clamp-1 min-h-4 font-medium tracking-tight",e),...t}));HM.displayName="AlertTitle";const GM=m.forwardRef(({className:e,...t},r)=>i.jsx("div",{ref:r,"data-slot":"alert-description",className:xe("text-muted-foreground col-start-2 grid justify-items-start gap-1 text-sm [&_p]:leading-relaxed",e),...t}));GM.displayName="AlertDescription";const VM=e0("inline-flex items-center rounded-md border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground shadow hover:bg-primary/80",secondary:"border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80",destructive:"border-transparent bg-destructive text-destructive-foreground shadow hover:bg-destructive/80",outline:"text-foreground"}},defaultVariants:{variant:"default"}});function Tt({className:e,variant:t,...r}){return i.jsx("div",{className:xe(VM({variant:t}),e),...r})}const WM=e0("inline-flex touch-manipulation items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",{variants:{variant:{default:"bg-primary text-primary-foreground shadow hover:bg-primary/90 active:bg-primary/80",destructive:"bg-destructive text-destructive-foreground shadow-sm hover:bg-destructive/90 active:bg-destructive/80",outline:"border border-input bg-background shadow-sm hover:bg-accent hover:text-accent-foreground active:bg-accent/80",secondary:"bg-secondary text-secondary-foreground shadow-sm hover:bg-secondary/80 active:bg-secondary/70",ghost:"hover:bg-accent hover:text-accent-foreground active:bg-accent/80",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-10 px-4 py-2",sm:"h-9 rounded-md px-3 text-sm",lg:"h-11 rounded-md px-8",icon:"h-10 w-10"}},defaultVariants:{variant:"default",size:"default"}}),Ne=m.forwardRef(({className:e,variant:t,size:r,...n},a)=>i.jsx("button",{className:xe(WM({variant:t,size:r,className:e})),ref:a,...n}));Ne.displayName="Button";const fE=m.createContext(null),gE=()=>{const e=m.useContext(fE);if(!e)throw new Error("Confirmation components must be used within Confirmation");return e},bE=({className:e,approval:t="pending",children:r,...n})=>{const a=m.useMemo(()=>({approval:t}),[t]);return i.jsx(fE.Provider,{value:a,children:i.jsx(hE,{className:xe("flex flex-col gap-2",e),...n,children:r})})};bE.displayName="Confirmation";const xE=({className:e,...t})=>i.jsx("div",{"data-slot":"confirmation-title",className:xe("text-muted-foreground inline text-sm",e),...t});xE.displayName="ConfirmationTitle";const yE=({children:e})=>{const{approval:t}=gE();return t!=="pending"?null:i.jsx(i.Fragment,{children:e})};yE.displayName="ConfirmationRequest";const vE=({className:e,...t})=>{const{approval:r}=gE();return r!=="pending"?null:i.jsx("div",{"data-slot":"confirmation-actions",className:xe("flex items-center justify-end gap-2 self-end",e),...t})};vE.displayName="ConfirmationActions";const $d=({variant:e="default",...t})=>i.jsx(Ne,{className:"h-8 px-3 text-sm",variant:e,type:"button",...t});$d.displayName="ConfirmationAction";const wE=m.forwardRef(({className:e,...t},r)=>i.jsx("div",{ref:r,className:xe("rounded-xl border bg-card text-card-foreground shadow-sm",e),...t}));wE.displayName="Card";const kE=m.forwardRef(({className:e,...t},r)=>i.jsx("div",{ref:r,className:xe("flex flex-col space-y-1.5 p-4",e),...t}));kE.displayName="CardHeader";const SE=m.forwardRef(({className:e,...t},r)=>i.jsx("h3",{ref:r,className:xe("font-semibold leading-none tracking-tight",e),...t}));SE.displayName="CardTitle";const qM=m.forwardRef(({className:e,...t},r)=>i.jsx("p",{ref:r,className:xe("text-sm text-muted-foreground",e),...t}));qM.displayName="CardDescription";const CE=m.forwardRef(({className:e,...t},r)=>i.jsx("div",{ref:r,className:xe("p-4 pt-0",e),...t}));CE.displayName="CardContent";const NE=m.forwardRef(({className:e,...t},r)=>i.jsx("div",{ref:r,className:xe("flex items-center p-4 pt-0",e),...t}));NE.displayName="CardFooter";const KM=m.forwardRef(({className:e,...t},r)=>i.jsx("div",{ref:r,className:xe("ml-auto shrink-0",e),...t}));KM.displayName="CardAction";const EE=m.createContext(null);function TE(){const e=m.useContext(EE);if(!e)throw new Error("Collapsible components must be used within <Collapsible>");return e}const Ri=m.forwardRef(({defaultOpen:e=!1,open:t,onOpenChange:r,className:n,children:a,...s},o)=>{const[l,c]=m.useState(e),d=t!==void 0,u=d?t:l,p=m.useCallback(h=>{d||c(h),r?.(h)},[d,r]),f=m.useMemo(()=>({open:u,onOpenChange:p}),[u,p]);return i.jsx(EE.Provider,{value:f,children:i.jsx("div",{ref:o,"data-state":u?"open":"closed",className:n,...s,children:a})})});Ri.displayName="Collapsible";const qa=m.forwardRef(({onClick:e,children:t,className:r,...n},a)=>{const{open:s,onOpenChange:o}=TE(),l=m.useCallback(c=>{o(!s),e?.(c)},[s,o,e]);return i.jsx("button",{ref:a,type:"button","aria-expanded":s,"data-state":s?"open":"closed",onClick:l,className:r,...n,children:t})});qa.displayName="CollapsibleTrigger";const _i=m.forwardRef(({className:e,children:t,...r},n)=>{const{open:a}=TE();return i.jsx("div",{ref:n,"data-state":a?"open":"closed",className:xe("grid transition-[grid-template-rows] duration-200 ease-out",a?"grid-rows-[1fr]":"grid-rows-[0fr]",e),...r,children:i.jsx("div",{className:"overflow-hidden",children:t})})});_i.displayName="CollapsibleContent";const AE=m.createContext(null);function r0(){const e=m.useContext(AE);if(!e)throw new Error("Command components must be used within <Command>");return e}const jE=m.forwardRef(({className:e,children:t,...r},n)=>{const[a,s]=m.useState(""),o=m.useRef(new Map),[l,c]=m.useState(0),d=m.useCallback(v=>{o.current.set(v.id,v),c(w=>w+1)},[]),u=m.useCallback(v=>{o.current.delete(v),c(w=>w+1)},[]),p=m.useCallback((v,w)=>{const k=o.current.get(v);k&&Object.assign(k,w)},[]),f=m.useMemo(()=>{const v=a.toLowerCase(),w=new Set;for(const[k,S]of o.current)(!v||S.value.includes(v))&&w.add(k);return w},[a,l]),h=m.useMemo(()=>{const v=[];for(const[,w]of o.current)f.has(w.id)&&v.push(w);return v},[f]),[g,b]=m.useState(null);m.useEffect(()=>{b(h.length>0?h[0].id:null)},[h]);const x=m.useCallback(v=>{if(v.key==="ArrowDown"||v.key==="ArrowUp"||v.key==="Enter")v.preventDefault();else return;const w=h;if(w.length===0)return;if(v.key==="Enter"){w.find(A=>A.id===g)?.onSelect();return}const k=w.findIndex(I=>I.id===g);let S;v.key==="ArrowDown"?S=k<w.length-1?k+1:0:S=k>0?k-1:w.length-1;const N=w[S].id;b(N),w[S].element?.scrollIntoView({block:"nearest"})},[h,g]),y=m.useMemo(()=>({search:a,setSearch:s,visibleIds:f,activeId:g,setActiveId:b,register:d,unregister:u,updateEntry:p}),[a,f,g,d,u,p]);return i.jsx(AE.Provider,{value:y,children:i.jsx("div",{ref:n,role:"combobox","aria-expanded":"true","aria-haspopup":"listbox",className:xe("flex flex-col",e),onKeyDown:x,...r,children:t})})});jE.displayName="Command";const IE=m.forwardRef(({className:e,placeholder:t="Search...",...r},n)=>{const{search:a,setSearch:s}=r0();return i.jsxs("div",{className:"flex items-center border-b px-3",role:"presentation",children:[i.jsx(ys,{className:"mr-2 h-4 w-4 shrink-0 text-muted-foreground","aria-hidden":!0}),i.jsx("input",{ref:n,type:"text",role:"searchbox","aria-autocomplete":"list",autoComplete:"off",autoCorrect:"off",spellCheck:!1,value:a,onChange:o=>s(o.target.value),placeholder:t,className:xe("flex h-11 w-full rounded-md bg-transparent py-3 text-sm outline-none","placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50",e),...r})]})});IE.displayName="CommandInput";const RE=m.forwardRef(({className:e,...t},r)=>i.jsx("div",{ref:r,role:"listbox",className:xe("max-h-[300px] overflow-y-auto overflow-x-hidden",e),...t}));RE.displayName="CommandList";const _E=m.forwardRef(({className:e,...t},r)=>{const{search:n,visibleIds:a}=r0();return!n||a.size>0?null:i.jsx("div",{ref:r,className:xe("py-6 text-center text-sm text-muted-foreground",e),...t})});_E.displayName="CommandEmpty";const PE=m.forwardRef(({className:e,heading:t,children:r,...n},a)=>i.jsxs("div",{ref:a,className:xe("overflow-hidden p-1",e),role:"group","aria-label":typeof t=="string"?t:void 0,...n,children:[t&&i.jsx("div",{className:"px-2 py-1.5 text-xs font-medium text-muted-foreground",role:"presentation",children:t}),r]}));PE.displayName="CommandGroup";const LE=m.forwardRef(({className:e,value:t,onSelect:r,disabled:n,children:a,...s},o)=>{const{visibleIds:l,activeId:c,setActiveId:d,register:u,unregister:p,updateEntry:f}=r0(),h=m.useId(),g=m.useRef(null),b=t||(typeof a=="string"?a:"");m.useEffect(()=>(u({id:h,value:b.toLowerCase(),onSelect:r||(()=>{}),element:g.current}),()=>p(h)),[h,b,u,p]),m.useEffect(()=>{f(h,{onSelect:r||(()=>{})})},[h,r,f]);const x=m.useCallback(v=>{g.current=v,f(h,{element:v}),typeof o=="function"?o(v):o&&(o.current=v)},[h,f,o]);if(!l.has(h))return null;const y=c===h;return i.jsx("div",{ref:x,role:"option","aria-selected":y,"aria-disabled":n||void 0,"data-active":y||void 0,className:xe("relative flex cursor-pointer select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none",y&&"bg-accent text-accent-foreground",n&&"pointer-events-none opacity-50",e),onPointerMove:()=>{!n&&c!==h&&d(h)},onClick:()=>!n&&r?.(),...s,children:a})});LE.displayName="CommandItem";const YM=m.forwardRef(({className:e,...t},r)=>i.jsx("div",{ref:r,className:xe("-mx-1 h-px bg-border",e),...t}));YM.displayName="CommandSeparator";function uu({checked:e,onToggle:t,ariaLabel:r="Toggle dark mode"}){const{isDarkMode:n,toggleDarkMode:a}=ri(),s=typeof e=="boolean"&&typeof t=="function",o=s?e:n,l=()=>{if(s&&t){t(!o);return}a()};return i.jsxs("button",{onClick:l,className:xe("relative inline-flex h-7 w-12 flex-shrink-0 touch-manipulation cursor-pointer items-center rounded-full border-2 transition-colors duration-200","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background",o?"border-primary bg-primary":"border-border bg-muted"),role:"switch","aria-checked":o,"aria-label":r,children:[i.jsx("span",{className:"sr-only",children:r}),i.jsx("span",{className:xe("flex h-5 w-5 transform items-center justify-center rounded-full shadow-sm transition-transform duration-200",o?"translate-x-[22px] bg-white":"translate-x-[2px] bg-foreground/60 dark:bg-foreground/80"),children:o?i.jsx($4,{className:"h-3 w-3 text-primary"}):i.jsx(V4,{className:"h-3 w-3 text-white dark:text-background"})})]})}const DE=m.createContext(null);function OE(){const e=m.useContext(DE);if(!e)throw new Error("Dialog components must be used within <Dialog>");return e}const ME=({open:e,onOpenChange:t,defaultOpen:r=!1,children:n})=>{const[a,s]=m.useState(r),o=m.useRef(null),l=e!==void 0,c=l?e:a,d=m.useCallback(p=>{l||s(p),t?.(p)},[l,t]),u=m.useMemo(()=>({open:c,onOpenChange:d,triggerRef:o}),[c,d]);return i.jsx(DE.Provider,{value:u,children:n})},ZM=m.forwardRef(({onClick:e,children:t,asChild:r,...n},a)=>{const{onOpenChange:s,triggerRef:o}=OE(),l=m.useCallback(c=>{s(!0),e?.(c)},[s,e]);if(r&&m.isValidElement(t)){const c=t;return m.cloneElement(c,{onClick:d=>{s(!0),c.props.onClick?.(d)},ref:d=>{o.current=d,typeof a=="function"?a(d):a&&(a.current=d)}})}return i.jsx("button",{ref:c=>{o.current=c,typeof a=="function"?a(c):a&&(a.current=c)},type:"button",onClick:l,...n,children:t})});ZM.displayName="DialogTrigger";const Rk='a[href], button:not([disabled]), input:not([disabled]), textarea:not([disabled]), select:not([disabled]), [tabindex]:not([tabindex="-1"])',n0=m.forwardRef(({className:e,children:t,onEscapeKeyDown:r,onPointerDownOutside:n,...a},s)=>{const{open:o,onOpenChange:l,triggerRef:c}=OE(),d=m.useRef(null),u=m.useRef(null);return m.useEffect(()=>{o?u.current=document.activeElement:u.current&&((c.current||u.current)?.focus(),u.current=null)},[o,c]),m.useEffect(()=>{if(!o)return;const p=h=>{if(h.key==="Escape"){h.stopPropagation(),r?.(),l(!1);return}if(h.key==="Tab"&&d.current){const g=Array.from(d.current.querySelectorAll(Rk));if(g.length===0)return;const b=g[0],x=g[g.length-1];h.shiftKey&&document.activeElement===b?(h.preventDefault(),x.focus()):!h.shiftKey&&document.activeElement===x&&(h.preventDefault(),b.focus())}};document.addEventListener("keydown",p,!0);const f=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.removeEventListener("keydown",p,!0),document.body.style.overflow=f}},[o,l,r]),m.useEffect(()=>{o&&d.current&&requestAnimationFrame(()=>{d.current?.querySelector(Rk)?.focus()})},[o]),o?Vu.createPortal(i.jsxs("div",{className:"fixed inset-0 z-50",children:[i.jsx("div",{className:"fixed inset-0 animate-dialog-overlay-show bg-black/50 backdrop-blur-sm",onClick:()=>{n?.(),l(!1)},"aria-hidden":!0}),i.jsx("div",{ref:p=>{d.current=p,typeof s=="function"?s(p):s&&(s.current=p)},role:"dialog","aria-modal":"true",className:xe("fixed left-1/2 top-1/2 z-50 w-full max-w-lg -translate-x-1/2 -translate-y-1/2","rounded-xl border bg-popover text-popover-foreground shadow-lg","animate-dialog-content-show",e),...a,children:t})]}),document.body):null});n0.displayName="DialogContent";const a0=m.forwardRef(({className:e,...t},r)=>i.jsx("h2",{ref:r,className:xe("sr-only",e),...t}));a0.displayName="DialogTitle";const Je=m.forwardRef(({className:e,type:t,...r},n)=>i.jsx("input",{type:t,className:xe("flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-sm shadow-sm transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50",e),ref:n,...r}));Je.displayName="Input";const i0=m.forwardRef(({className:e,contentClassName:t,children:r,...n},a)=>i.jsx("div",{className:xe("relative overflow-hidden",e),...n,children:i.jsx("div",{ref:a,className:xe("h-full w-full overflow-auto rounded-[inherit]",t),style:{WebkitOverflowScrolling:"touch",touchAction:"pan-y"},children:r})}));i0.displayName="ScrollArea";const pu=m.memo(({children:e,className:t,as:r="span"})=>i.jsx(r,{className:xe("animate-shimmer inline-block bg-[length:250%_100%] bg-clip-text text-transparent","bg-[linear-gradient(90deg,transparent_33%,hsl(var(--foreground))_50%,transparent_67%),linear-gradient(hsl(var(--muted-foreground)),hsl(var(--muted-foreground)))]",t),children:e}));pu.displayName="Shimmer";const FE=m.createContext(null),XM=()=>{const e=m.useContext(FE);if(!e)throw new Error("Reasoning components must be used within Reasoning");return e},JM=1e3,QM=1e3,kf=m.memo(({className:e,isStreaming:t=!1,open:r,defaultOpen:n,onOpenChange:a,duration:s,children:o,...l})=>{const c=n??t,d=n===!1,[u,p]=m.useState(c),f=r!==void 0,h=f?r:u,g=m.useCallback(N=>{f||p(N),a?.(N)},[f,a]),[b,x]=m.useState(s),y=m.useRef(t),[v,w]=m.useState(!1),k=m.useRef(null);m.useEffect(()=>{s!==void 0&&x(s)},[s]),m.useEffect(()=>{t?(y.current=!0,k.current===null&&(k.current=Date.now())):k.current!==null&&(x(Math.ceil((Date.now()-k.current)/QM)),k.current=null)},[t]),m.useEffect(()=>{t&&!h&&!d&&g(!0)},[t,h,g,d]),m.useEffect(()=>{if(y.current&&!t&&h&&!v){const N=setTimeout(()=>{g(!1),w(!0)},JM);return()=>clearTimeout(N)}},[t,h,g,v]);const S=m.useMemo(()=>({duration:b,isOpen:h,isStreaming:t,setIsOpen:g}),[b,h,t,g]);return i.jsx(FE.Provider,{value:S,children:i.jsx(Ri,{open:h,onOpenChange:g,className:xe("not-prose",e),...l,children:o})})});kf.displayName="Reasoning";const e9=(e,t)=>e||t===0?i.jsx(pu,{children:"Thinking..."}):t===void 0?i.jsx("p",{children:"Thought for a few seconds"}):i.jsxs("p",{children:["Thought for ",t," seconds"]}),Sf=m.memo(({className:e,children:t,getThinkingMessage:r=e9,...n})=>{const{isStreaming:a,isOpen:s,duration:o}=XM();return i.jsx(qa,{className:xe("flex w-full items-center gap-2 text-sm text-muted-foreground transition-colors hover:text-foreground",e),...n,children:t??i.jsxs(i.Fragment,{children:[i.jsx(HD,{className:"h-4 w-4"}),r(a,o),i.jsx(N4,{className:xe("h-4 w-4 transition-transform",s?"rotate-180":"rotate-0")})]})})});Sf.displayName="ReasoningTrigger";const Cf=m.memo(({className:e,children:t,...r})=>i.jsx(_i,{className:xe("mt-4 text-sm text-muted-foreground",e),...r,children:t}));Cf.displayName="ReasoningContent";function t9(e){switch(e){case"top":return"top-full left-1/2 transform -translate-x-1/2 border-t-gray-900 dark:border-t-gray-100";case"bottom":return"bottom-full left-1/2 transform -translate-x-1/2 border-b-gray-900 dark:border-b-gray-100";case"left":return"left-full top-1/2 transform -translate-y-1/2 border-l-gray-900 dark:border-l-gray-100";case"right":return"right-full top-1/2 transform -translate-y-1/2 border-r-gray-900 dark:border-r-gray-100";default:return"top-full left-1/2 transform -translate-x-1/2 border-t-gray-900 dark:border-t-gray-100"}}function Nf({children:e,content:t,position:r="top",className:n="",delay:a=350}){const[s,o]=m.useState(!1),l=m.useRef(null),c=m.useRef(!1),d=m.useRef(null),u=m.useRef(null),[p,f]=m.useState(null),h=m.useCallback(()=>{const w=d.current;if(!w)return;const k=w.getBoundingClientRect(),S=8,N={position:"fixed",zIndex:9999};switch(r){case"bottom":N.left=k.left+k.width/2,N.top=k.bottom+S,N.transform="translateX(-50%)";break;case"left":N.left=k.left-S,N.top=k.top+k.height/2,N.transform="translate(-100%, -50%)";break;case"right":N.left=k.right+S,N.top=k.top+k.height/2,N.transform="translateY(-50%)";break;case"top":default:N.left=k.left+k.width/2,N.top=k.top-S,N.transform="translate(-50%, -100%)";break}f(N)},[r]),g=()=>{l.current!==null&&(window.clearTimeout(l.current),l.current=null)},b=()=>{g(),l.current=window.setTimeout(()=>{o(!0)},a)},x=()=>{g(),o(!1)},y=()=>{g(),c.current=!1,l.current=window.setTimeout(()=>{c.current=!0,o(!0)},a)},v=()=>{g(),!c.current&&o(!1)};return m.useEffect(()=>()=>{g()},[]),m.useEffect(()=>{if(!s||typeof document>"u")return;const w=k=>{const S=k.target;S instanceof Node&&d.current?.contains(S)||(o(!1),c.current=!1)};return document.addEventListener("pointerdown",w,!0),()=>document.removeEventListener("pointerdown",w,!0)},[s]),m.useEffect(()=>{if(!s){f(null);return}const w=window.requestAnimationFrame(h),k=()=>h();return window.addEventListener("resize",k),window.addEventListener("scroll",k,!0),()=>{window.cancelAnimationFrame(w),window.removeEventListener("resize",k),window.removeEventListener("scroll",k,!0)}},[s,h]),t?i.jsxs("div",{ref:d,className:"relative inline-block",onMouseEnter:b,onMouseLeave:x,onTouchStart:y,onTouchEnd:v,onTouchCancel:v,children:[e,s&&typeof document<"u"&&Vu.createPortal(i.jsxs("div",{ref:u,style:p||{position:"fixed",top:"-9999px",left:"-9999px",opacity:0},className:xe("px-2 py-1 text-xs font-medium text-white bg-gray-900 dark:bg-gray-100 dark:text-gray-900 rounded shadow-lg whitespace-nowrap pointer-events-none","animate-in fade-in-0 zoom-in-95 duration-200",n),children:[t,i.jsx("div",{className:xe("absolute w-0 h-0 border-4 border-transparent",t9(r))})]}),document.body)]}):i.jsx(i.Fragment,{children:e})}const zE=m.createContext(null),BE=m.forwardRef(({className:e,status:t="ready",children:r,...n},a)=>{const s=m.useMemo(()=>({status:t}),[t]);return i.jsx(zE.Provider,{value:s,children:i.jsx("form",{ref:a,"data-slot":"prompt-input",className:xe("relative overflow-hidden rounded-xl border border-border/70 bg-zinc-50/95 shadow-sm shadow-zinc-950/5 backdrop-blur-sm transition-all duration-200 focus-within:border-primary/40 focus-within:shadow-md focus-within:ring-1 focus-within:ring-primary/20 dark:bg-zinc-950/90",e),...n,children:r})})});BE.displayName="PromptInput";const UE=m.forwardRef(({className:e,...t},r)=>i.jsx("div",{ref:r,"data-slot":"prompt-input-header",className:xe("px-3 pt-3",e),...t}));UE.displayName="PromptInputHeader";const $E=m.forwardRef(({className:e,...t},r)=>i.jsx("div",{ref:r,"data-slot":"prompt-input-body",className:xe("relative",e),...t}));$E.displayName="PromptInputBody";const HE=m.forwardRef(({className:e,...t},r)=>i.jsx("textarea",{ref:r,"data-slot":"prompt-input-textarea",className:xe("chat-input-placeholder block max-h-[40vh] w-full resize-none overflow-y-auto bg-transparent px-4 py-2 font-mono text-sm leading-6 text-foreground placeholder-muted-foreground/50 focus:outline-none sm:max-h-[300px]",e),...t}));HE.displayName="PromptInputTextarea";const GE=m.forwardRef(({className:e,...t},r)=>i.jsx("div",{ref:r,"data-slot":"prompt-input-footer",className:xe("flex items-center justify-between border-t border-border/30 px-3 py-2",e),...t}));GE.displayName="PromptInputFooter";const VE=m.forwardRef(({className:e,...t},r)=>i.jsx("div",{ref:r,"data-slot":"prompt-input-tools",className:xe("flex items-center gap-1",e),...t}));VE.displayName="PromptInputTools";const Hd=m.forwardRef(({className:e,tooltip:t,children:r,...n},a)=>{const s=i.jsx(Ne,{ref:a,type:"button",variant:"ghost",size:"icon",className:xe("h-8 w-8 [&_svg]:size-4",e),...n,children:r});return t?i.jsx(Nf,{content:t.shortcut?i.jsxs("span",{className:"flex items-center gap-1.5",children:[t.content,i.jsx("kbd",{className:"rounded bg-white/20 px-1 text-[10px]",children:t.shortcut})]}):t.content,position:t.side??"top",children:s}):s});Hd.displayName="PromptInputButton";const WE=m.forwardRef(({className:e,status:t,children:r,...n},a)=>{const s=m.useContext(zE),o=t??s?.status??"ready",l=o==="submitted"||o==="streaming";return i.jsx(Ne,{ref:a,type:l?"button":"submit",variant:"default",size:"icon",className:xe("h-8 w-8 rounded-lg",e),...n,children:r??(l?i.jsx(Nc,{className:"h-3.5 w-3.5 fill-current"}):i.jsx(TD,{className:"h-4 w-4"}))})});WE.displayName="PromptInputSubmit";function rp({children:e,className:t}){return i.jsx("div",{className:xe("inline-flex items-center gap-[2px] rounded-lg bg-muted/60 p-[3px]",t),children:e})}function np({isActive:e,onClick:t,children:r,className:n}){return i.jsx("button",{onClick:t,className:xe("flex touch-manipulation items-center gap-1.5 rounded-md px-3 py-2 text-sm font-medium transition-all duration-150",e?"bg-background text-foreground shadow-sm":"text-muted-foreground active:bg-background/50",n),children:r})}const qE=m.createContext(null);function KE(){const e=m.useContext(qE);if(!e)throw new Error("QueueItem sub-components must be used within <QueueItem>");return e}const YE=m.forwardRef(({className:e,...t},r)=>i.jsx("div",{ref:r,"data-slot":"queue",role:"list",className:xe("space-y-0.5",e),...t}));YE.displayName="Queue";const ZE=m.forwardRef(({status:e="pending",className:t,children:r,...n},a)=>{const s=m.useMemo(()=>({status:e}),[e]);return i.jsx(qE.Provider,{value:s,children:i.jsx("div",{ref:a,"data-slot":"queue-item","data-status":e,role:"listitem",className:xe("flex items-start gap-2 py-0.5",t),...n,children:r})})});ZE.displayName="QueueItem";const XE=m.forwardRef(({className:e,...t},r)=>{const{status:n}=KE();return i.jsxs("div",{ref:r,"data-slot":"queue-item-indicator","aria-hidden":"true",className:xe("mt-0.5 flex h-3.5 w-3.5 flex-shrink-0 items-center justify-center",e),...t,children:[n==="completed"&&i.jsx("svg",{className:"h-3.5 w-3.5 text-green-500 dark:text-green-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z"})}),n==="in_progress"&&i.jsx("span",{className:"h-2 w-2 animate-pulse rounded-full bg-blue-500 dark:bg-blue-400"}),n==="pending"&&i.jsx("svg",{className:"h-3.5 w-3.5 text-muted-foreground/50",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:i.jsx("circle",{cx:"12",cy:"12",r:"9",strokeWidth:2})})]})});XE.displayName="QueueItemIndicator";const JE=m.forwardRef(({className:e,children:t,...r},n)=>{const{status:a}=KE();return i.jsx("div",{ref:n,"data-slot":"queue-item-content",className:xe("min-w-0 flex-1 text-xs",a==="completed"&&"text-muted-foreground line-through",a==="in_progress"&&"font-medium text-foreground",a==="pending"&&"text-foreground",e),...r,children:t})});JE.displayName="QueueItemContent";const _k="https://github.com/alicomert/pixcode/issues/new",r9="https://github.com/alicomert/pixcode",Pk="https://discord.gg/buxwujPNRE";function Lk({className:e}){return i.jsx("svg",{className:e,fill:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:i.jsx("path",{d:"M20.317 4.37a19.791 19.791 0 0 0-4.885-1.515.074.074 0 0 0-.079.037c-.21.375-.444.864-.608 1.25a18.27 18.27 0 0 0-5.487 0 12.64 12.64 0 0 0-.617-1.25.077.077 0 0 0-.079-.037A19.736 19.736 0 0 0 3.677 4.37a.07.07 0 0 0-.032.027C.533 9.046-.32 13.58.099 18.057a.082.082 0 0 0 .031.057 19.9 19.9 0 0 0 5.993 3.03.078.078 0 0 0 .084-.028c.462-.63.874-1.295 1.226-1.994a.076.076 0 0 0-.041-.106 13.107 13.107 0 0 1-1.872-.892.077.077 0 0 1-.008-.128 10.2 10.2 0 0 0 .372-.292.074.074 0 0 1 .077-.01c3.928 1.793 8.18 1.793 12.062 0a.074.074 0 0 1 .078.01c.12.098.246.198.373.292a.077.077 0 0 1-.006.127 12.299 12.299 0 0 1-1.873.892.077.077 0 0 0-.041.107c.36.698.772 1.362 1.225 1.993a.076.076 0 0 0 .084.028 19.839 19.839 0 0 0 6.002-3.03.077.077 0 0 0 .032-.054c.5-5.177-.838-9.674-3.549-13.66a.061.061 0 0 0-.031-.03zM8.02 15.33c-1.183 0-2.157-1.085-2.157-2.419 0-1.333.956-2.419 2.157-2.419 1.21 0 2.176 1.095 2.157 2.42 0 1.333-.956 2.418-2.157 2.418zm7.975 0c-1.183 0-2.157-1.085-2.157-2.419 0-1.333.955-2.419 2.157-2.419 1.21 0 2.176 1.095 2.157 2.42 0 1.333-.946 2.418-2.157 2.418z"})})}function n9({updateAvailable:e,releaseInfo:t,latestVersion:r,currentVersion:n,onShowVersionModal:a,onOpenControlRoom:s,onShowSettings:o,t:l}){return i.jsxs("div",{className:"flex-shrink-0",style:{paddingBottom:"env(safe-area-inset-bottom, 0)"},children:[e&&i.jsxs(i.Fragment,{children:[i.jsx("div",{className:"nav-divider"}),i.jsx("div",{className:"hidden px-2 py-1.5 md:block",children:i.jsxs("button",{className:"group flex w-full items-center gap-2.5 rounded-lg px-2.5 py-2 text-left transition-colors hover:bg-blue-50/80 dark:hover:bg-blue-900/15",onClick:a,children:[i.jsxs("div",{className:"relative flex-shrink-0",children:[i.jsx(lk,{className:"h-4 w-4 text-blue-500 dark:text-blue-400"}),i.jsx("span",{className:"absolute -right-0.5 -top-0.5 h-1.5 w-1.5 animate-pulse rounded-full bg-blue-500"})]}),i.jsxs("div",{className:"min-w-0 flex-1",children:[i.jsx("span",{className:"block truncate text-sm font-medium text-blue-600 dark:text-blue-300",children:t?.title||`v${r}`}),i.jsx("span",{className:"text-[10px] text-blue-500/70 dark:text-blue-400/60",children:l("version.updateAvailable")})]})]})}),i.jsx("div",{className:"px-3 py-2 md:hidden",children:i.jsxs("button",{className:"flex h-11 w-full items-center gap-3 rounded-xl border border-blue-200/60 bg-blue-50/80 px-3.5 transition-all active:scale-[0.98] dark:border-blue-700/40 dark:bg-blue-900/15",onClick:a,children:[i.jsxs("div",{className:"relative flex-shrink-0",children:[i.jsx(lk,{className:"w-4.5 h-4.5 text-blue-500 dark:text-blue-400"}),i.jsx("span",{className:"absolute -right-0.5 -top-0.5 h-1.5 w-1.5 animate-pulse rounded-full bg-blue-500"})]}),i.jsxs("div",{className:"min-w-0 flex-1 text-left",children:[i.jsx("span",{className:"block truncate text-sm font-medium text-blue-600 dark:text-blue-300",children:t?.title||`v${r}`}),i.jsx("span",{className:"text-xs text-blue-500/70 dark:text-blue-400/60",children:l("version.updateAvailable")})]})]})})]}),i.jsx("div",{className:"nav-divider"}),i.jsx("div",{className:"hidden px-2 pt-1.5 md:block",children:i.jsxs("a",{href:_k,target:"_blank",rel:"noopener noreferrer",className:"flex w-full items-center gap-2 rounded-lg px-2.5 py-1.5 text-muted-foreground transition-colors hover:bg-accent/60 hover:text-foreground",children:[i.jsx(To,{className:"h-3.5 w-3.5"}),i.jsx("span",{className:"text-sm",children:l("actions.reportIssue")})]})}),i.jsx("div",{className:"hidden px-2 md:block",children:i.jsxs("a",{href:Pk,target:"_blank",rel:"noopener noreferrer",className:"flex w-full items-center gap-2 rounded-lg px-2.5 py-1.5 text-muted-foreground transition-colors hover:bg-accent/60 hover:text-foreground",children:[i.jsx(Lk,{className:"h-3.5 w-3.5"}),i.jsx("span",{className:"text-sm",children:l("actions.joinCommunity")})]})}),s&&i.jsx("div",{className:"hidden px-2 pt-1.5 md:block",children:i.jsxs("button",{className:"group flex w-full items-center gap-2.5 rounded-lg border border-primary/25 bg-primary/5 px-2.5 py-2 text-left transition-colors hover:bg-primary/10",onClick:s,children:[i.jsx("div",{className:"flex h-7 w-7 items-center justify-center rounded-md bg-primary/10 text-primary",children:i.jsx($n,{className:"h-3.5 w-3.5"})}),i.jsxs("div",{className:"min-w-0 flex-1",children:[i.jsx("span",{className:"block truncate text-sm font-semibold text-foreground",children:l("actions.controlRoom",{defaultValue:"Control Room"})}),i.jsx("span",{className:"block truncate text-[10px] text-muted-foreground",children:l("actions.controlRoomDescription",{defaultValue:"Admin, access, runs"})})]})]})}),i.jsx("div",{className:"hidden px-2 py-1.5 md:block",children:i.jsxs("button",{className:"flex w-full items-center gap-2 rounded-lg px-2.5 py-1.5 text-muted-foreground transition-colors hover:bg-accent/60 hover:text-foreground",onClick:o,children:[i.jsx(Ht,{className:"h-3.5 w-3.5"}),i.jsx("span",{className:"text-sm",children:l("actions.settings")})]})}),i.jsx("div",{className:"hidden px-3 py-2 text-center md:block",children:i.jsxs("a",{href:r9,target:"_blank",rel:"noopener noreferrer",className:"text-[10px] text-muted-foreground/40 transition-colors hover:text-muted-foreground",children:["Pixcode v",n," – ",l("branding.openSource")]})}),i.jsx("div",{className:"px-3 pt-3 md:hidden",children:i.jsxs("a",{href:_k,target:"_blank",rel:"noopener noreferrer",className:"flex h-12 w-full items-center gap-3.5 rounded-xl bg-muted/40 px-4 transition-all hover:bg-muted/60 active:scale-[0.98]",children:[i.jsx("div",{className:"flex h-8 w-8 items-center justify-center rounded-xl bg-background/80",children:i.jsx(To,{className:"w-4.5 h-4.5 text-muted-foreground"})}),i.jsx("span",{className:"text-base font-medium text-foreground",children:l("actions.reportIssue")})]})}),i.jsx("div",{className:"px-3 pt-2 md:hidden",children:i.jsxs("a",{href:Pk,target:"_blank",rel:"noopener noreferrer",className:"flex h-12 w-full items-center gap-3.5 rounded-xl bg-muted/40 px-4 transition-all hover:bg-muted/60 active:scale-[0.98]",children:[i.jsx("div",{className:"flex h-8 w-8 items-center justify-center rounded-xl bg-background/80",children:i.jsx(Lk,{className:"w-4.5 h-4.5 text-muted-foreground"})}),i.jsx("span",{className:"text-base font-medium text-foreground",children:l("actions.joinCommunity")})]})}),s&&i.jsx("div",{className:"px-3 pt-2 md:hidden",children:i.jsxs("button",{className:"flex h-14 w-full items-center gap-3.5 rounded-xl border border-primary/25 bg-primary/10 px-4 transition-all hover:bg-primary/15 active:scale-[0.98]",onClick:s,children:[i.jsx("div",{className:"flex h-9 w-9 items-center justify-center rounded-xl bg-primary/15",children:i.jsx($n,{className:"w-4.5 h-4.5 text-primary"})}),i.jsxs("div",{className:"min-w-0 flex-1 text-left",children:[i.jsx("span",{className:"block truncate text-base font-semibold text-foreground",children:l("actions.controlRoom",{defaultValue:"Control Room"})}),i.jsx("span",{className:"block truncate text-xs text-muted-foreground",children:l("actions.controlRoomDescription",{defaultValue:"Admin, access, runs"})})]})]})}),i.jsx("div",{className:"px-3 pb-3 pt-2 md:hidden",children:i.jsxs("button",{className:"flex h-12 w-full items-center gap-3.5 rounded-xl bg-muted/40 px-4 transition-all hover:bg-muted/60 active:scale-[0.98]",onClick:o,children:[i.jsx("div",{className:"flex h-8 w-8 items-center justify-center rounded-xl bg-background/80",children:i.jsx(Ht,{className:"w-4.5 h-4.5 text-muted-foreground"})}),i.jsx("span",{className:"text-base font-medium text-foreground",children:l("actions.settings")})]})})]})}const Dk="PIXCODE_GITHUB_STARS",Ok="PIXCODE_HIDE_GITHUB_STAR",a9=3600*1e3,i9=(e,t)=>{const[r,n]=m.useState(null),[a,s]=m.useState(()=>{try{return localStorage.getItem(Ok)==="true"}catch{return!1}});m.useEffect(()=>{if(a)return;try{const d=localStorage.getItem(Dk);if(d){const u=JSON.parse(d);if(Date.now()-u.timestamp<a9){n(u.count);return}}}catch{}(async()=>{try{const d=await fetch(`https://api.github.com/repos/${e}/${t}`);if(!d.ok)return;const p=(await d.json()).stargazers_count;if(typeof p=="number"){n(p);try{localStorage.setItem(Dk,JSON.stringify({count:p,timestamp:Date.now()}))}catch{}}}catch{}})()},[e,t,a]);const o=m.useCallback(()=>{s(!0);try{localStorage.setItem(Ok,"true")}catch{}},[]),l=r!==null?r>=1e3?`${(r/1e3).toFixed(1)}k`:`${r}`:null;return{starCount:r,formattedCount:l,isDismissed:a,dismiss:o}},s9="https://github.com/alicomert/pixcode";function o9({className:e}){return i.jsx("svg",{className:e,fill:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:i.jsx("path",{d:"M12 2C6.477 2 2 6.484 2 12.017c0 4.425 2.865 8.18 6.839 9.504.5.092.682-.217.682-.483 0-.237-.008-.868-.013-1.703-2.782.605-3.369-1.343-3.369-1.343-.454-1.158-1.11-1.466-1.11-1.466-.908-.62.069-.608.069-.608 1.003.07 1.531 1.032 1.531 1.032.892 1.53 2.341 1.088 2.91.832.092-.647.35-1.088.636-1.338-2.22-.253-4.555-1.113-4.555-4.951 0-1.093.39-1.988 1.029-2.688-.103-.253-.446-1.272.098-2.65 0 0 .84-.27 2.75 1.026A9.564 9.564 0 0112 6.844c.85.004 1.705.115 2.504.337 1.909-1.296 2.747-1.027 2.747-1.027.546 1.379.202 2.398.1 2.651.64.7 1.028 1.595 1.028 2.688 0 3.848-2.339 4.695-4.566 4.943.359.309.678.92.678 1.855 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.019 10.019 0 0022 12.017C22 6.484 17.522 2 12 2z"})})}function l9(){const{formattedCount:e,isDismissed:t,dismiss:r}=i9("alicomert","pixcode");return t?null:i.jsxs("div",{className:"group/star relative hidden md:block",children:[i.jsxs("a",{href:s9,target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-1.5 rounded-lg border border-border/50 bg-muted/30 px-2.5 py-1 text-xs text-muted-foreground transition-colors hover:bg-muted/50 hover:text-foreground",children:[i.jsx(o9,{className:"h-3.5 w-3.5"}),i.jsx(Ei,{className:"h-3 w-3"}),i.jsx("span",{className:"font-medium",children:"Star"}),e&&i.jsx("span",{className:"border-l border-border/50 pl-1.5 tabular-nums",children:e})]}),i.jsx("button",{onClick:n=>{n.preventDefault(),n.stopPropagation(),r()},className:"absolute -right-1.5 -top-1.5 hidden h-4 w-4 items-center justify-center rounded-full border border-border/50 bg-muted text-muted-foreground transition-colors hover:text-foreground group-hover/star:flex","aria-label":"Dismiss",children:i.jsx(Ct,{className:"h-2.5 w-2.5"})})]})}function Mk({value:e,onChange:t,t:r}){const n="flex flex-1 items-center justify-center gap-1 rounded-md px-2 py-1 text-[11px] font-medium transition-all";return i.jsxs("div",{role:"tablist","aria-label":r("tooltips.historyView",{defaultValue:"History view"}),className:"flex rounded-lg bg-muted/40 p-0.5",children:[i.jsxs("button",{type:"button",role:"tab","aria-selected":e==="flat",onClick:()=>t("flat"),className:xe(n,e==="flat"?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),title:r("tooltips.historyViewFlat",{defaultValue:"Recent conversations"}),children:[i.jsx($g,{className:"h-3 w-3"}),r("historyView.flat",{defaultValue:"Recent"})]}),i.jsxs("button",{type:"button",role:"tab","aria-selected":e==="grouped",onClick:()=>t("grouped"),className:xe(n,e==="grouped"?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),title:r("tooltips.historyViewGrouped",{defaultValue:"Grouped by project"}),children:[i.jsx(RD,{className:"h-3 w-3"}),r("historyView.grouped",{defaultValue:"By project"})]})]})}function c9({isPWA:e,isMobile:t,isLoading:r,projectsCount:n,searchFilter:a,onSearchFilterChange:s,onClearSearchFilter:o,searchMode:l,onSearchModeChange:c,onRefresh:d,isRefreshing:u,onCreateProject:p,onQuickStartSession:f,onCollapseSidebar:h,historyView:g,onHistoryViewChange:b,t:x}){const y=()=>i.jsxs("div",{className:"flex min-w-0 items-center gap-2.5",children:[i.jsx("svg",{className:"h-6 w-6 flex-shrink-0",viewBox:"0 0 500 500","aria-hidden":"true",children:i.jsx("g",{transform:"translate(250 250) scale(1.25) translate(-250 -250)",children:i.jsxs("g",{transform:"translate(0 500) scale(0.1 -0.1)",fill:"#5C3FFC",children:[i.jsx("path",{d:"M2037 3800 c-104 -40 -191 -134 -231 -250 -23 -67 -20 -82 22 -109 31 -20 287 -177 1009 -618 40 -24 82 -56 93 -70 27 -34 27 -102 0 -136 -11 -13 -106 -78 -212 -143 -106 -64 -201 -124 -210 -132 -16 -14 -18 -41 -18 -302 0 -291 2 -310 38 -310 16 0 267 148 610 359 180 111 270 173 310 213 216 217 215 574 -3 793 -37 38 -107 89 -185 136 -69 42 -253 154 -410 249 -434 264 -509 307 -563 326 -57 20 -191 17 -250 -6z"}),i.jsx("path",{d:"M1803 2994 c-10 -5 -13 -156 -13 -709 0 -671 1 -706 20 -767 27 -89 93 -184 167 -240 89 -67 157 -90 281 -96 92 -4 105 -2 117 14 12 16 14 134 15 735 0 669 -1 718 -17 737 -20 23 -514 322 -541 327 -9 2 -23 2 -29 -1z"})]})})}),i.jsx("h1",{className:"truncate text-sm font-semibold tracking-tight text-foreground",children:x("app.title")})]});return i.jsxs("div",{className:"flex-shrink-0",children:[i.jsxs("div",{className:"hidden px-4 pb-3 pt-4 md:block",style:{},children:[i.jsxs("div",{className:"flex items-center justify-between gap-2",children:[i.jsx(y,{}),i.jsxs("div",{className:"flex flex-shrink-0 items-center gap-0.5",children:[i.jsx(Ne,{variant:"ghost",size:"sm",className:"h-8 w-8 rounded-lg p-0 text-muted-foreground hover:bg-accent/80 hover:text-foreground",onClick:d,disabled:u,title:x("tooltips.refresh"),children:i.jsx(at,{className:`h-4 w-4 ${u?"animate-spin":""}`})}),i.jsx(Ne,{variant:"ghost",size:"sm",className:"h-8 w-8 rounded-lg p-0 text-muted-foreground hover:bg-accent/80 hover:text-foreground",onClick:p,title:x("tooltips.createProject"),children:i.jsx(Ut,{className:"h-4 w-4"})}),i.jsx(Ne,{variant:"ghost",size:"sm",className:"h-8 w-8 rounded-lg p-0 text-muted-foreground hover:bg-accent/80 hover:text-foreground",onClick:h,title:x("tooltips.hideSidebar"),children:i.jsx(Ku,{className:"h-4 w-4"})})]})]}),i.jsx(l9,{}),f&&i.jsxs("button",{type:"button",onClick:()=>{f()},className:"mt-2.5 flex w-full items-center justify-center gap-2 rounded-lg border border-primary/20 bg-primary/5 px-3 py-2 text-sm font-medium text-primary transition-colors hover:bg-primary/10",children:[i.jsx($n,{className:"h-4 w-4"}),x("sidebar.newChat",{defaultValue:"New chat"})]}),n>0&&!r&&i.jsxs("div",{className:"mt-2.5 space-y-2",children:[i.jsx(Mk,{value:g,onChange:b,t:x}),i.jsxs("div",{className:"flex rounded-lg bg-muted/50 p-0.5",children:[i.jsxs("button",{onClick:()=>c("projects"),"aria-pressed":l==="projects",className:xe("flex-1 flex items-center justify-center gap-1.5 rounded-md px-2 py-1.5 text-xs font-medium transition-all",l==="projects"?"bg-background shadow-sm text-foreground":"text-muted-foreground hover:text-foreground"),children:[i.jsx(qr,{className:"h-3 w-3"}),x("search.modeProjects")]}),i.jsxs("button",{onClick:()=>c("conversations"),"aria-pressed":l==="conversations",className:xe("flex-1 flex items-center justify-center gap-1.5 rounded-md px-2 py-1.5 text-xs font-medium transition-all",l==="conversations"?"bg-background shadow-sm text-foreground":"text-muted-foreground hover:text-foreground"),children:[i.jsx(Un,{className:"h-3 w-3"}),x("search.modeConversations")]})]}),i.jsxs("div",{className:"relative",children:[i.jsx(ys,{className:"pointer-events-none absolute left-3 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-muted-foreground/50"}),i.jsx(Je,{type:"text",placeholder:x(l==="conversations"?"search.conversationsPlaceholder":"projects.searchPlaceholder"),value:a,onChange:v=>s(v.target.value),className:"nav-search-input h-9 rounded-xl border-0 pl-9 pr-8 text-sm transition-all duration-200 placeholder:text-muted-foreground/40 focus-visible:ring-0 focus-visible:ring-offset-0"}),a&&i.jsx("button",{onClick:o,"aria-label":x("tooltips.clearSearch"),className:"absolute right-2.5 top-1/2 -translate-y-1/2 rounded-md p-0.5 hover:bg-accent",children:i.jsx(Ct,{className:"h-3 w-3 text-muted-foreground"})})]})]})]}),i.jsx("div",{className:"nav-divider hidden md:block"}),i.jsxs("div",{className:"p-3 pb-2 md:hidden",style:e&&t?{paddingTop:"16px"}:{},children:[i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsx(y,{}),i.jsxs("div",{className:"flex flex-shrink-0 gap-1.5",children:[i.jsx("button",{className:"flex h-8 w-8 items-center justify-center rounded-lg bg-muted/50 transition-all active:scale-95",onClick:d,disabled:u,children:i.jsx(at,{className:`h-4 w-4 text-muted-foreground ${u?"animate-spin":""}`})}),i.jsx("button",{className:"flex h-8 w-8 items-center justify-center rounded-lg bg-primary/90 text-primary-foreground transition-all active:scale-95",onClick:p,children:i.jsx(ji,{className:"h-4 w-4"})})]})]}),n>0&&!r&&i.jsxs("div",{className:"mt-2.5 space-y-2",children:[l==="projects"&&i.jsx(Mk,{value:g,onChange:b,t:x}),i.jsxs("div",{className:"flex rounded-lg bg-muted/50 p-0.5",children:[i.jsxs("button",{onClick:()=>c("projects"),"aria-pressed":l==="projects",className:xe("flex-1 flex items-center justify-center gap-1.5 rounded-md px-2 py-1.5 text-xs font-medium transition-all",l==="projects"?"bg-background shadow-sm text-foreground":"text-muted-foreground hover:text-foreground"),children:[i.jsx(qr,{className:"h-3 w-3"}),x("search.modeProjects")]}),i.jsxs("button",{onClick:()=>c("conversations"),"aria-pressed":l==="conversations",className:xe("flex-1 flex items-center justify-center gap-1.5 rounded-md px-2 py-1.5 text-xs font-medium transition-all",l==="conversations"?"bg-background shadow-sm text-foreground":"text-muted-foreground hover:text-foreground"),children:[i.jsx(Un,{className:"h-3 w-3"}),x("search.modeConversations")]})]}),i.jsxs("div",{className:"relative",children:[i.jsx(ys,{className:"pointer-events-none absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground/50"}),i.jsx(Je,{type:"text",placeholder:x(l==="conversations"?"search.conversationsPlaceholder":"projects.searchPlaceholder"),value:a,onChange:v=>s(v.target.value),className:"nav-search-input h-10 rounded-xl border-0 pl-10 pr-9 text-sm transition-all duration-200 placeholder:text-muted-foreground/40 focus-visible:ring-0 focus-visible:ring-offset-0"}),a&&i.jsx("button",{onClick:o,"aria-label":x("tooltips.clearSearch"),className:"absolute right-2.5 top-1/2 -translate-y-1/2 rounded-md p-1 hover:bg-accent",children:i.jsx(Ct,{className:"h-3.5 w-3.5 text-muted-foreground"})})]})]})]}),i.jsx("div",{className:"nav-divider md:hidden"})]})}const d9=160,Fk=180;function QE({actions:e,className:t,triggerLabel:r}){const[n,a]=m.useState(!1),[s,o]=m.useState(null),l=m.useRef(null),c=m.useRef(null);m.useLayoutEffect(()=>{if(!n||!l.current)return;const u=l.current.getBoundingClientRect();let p=u.right-d9;p<8&&(p=8);let f=u.bottom+4;f+Fk>window.innerHeight&&(f=Math.max(8,u.top-4-Fk)),o({top:f,left:p})},[n]),m.useEffect(()=>{if(!n)return;const u=h=>{const g=h.target;l.current?.contains(g)||c.current?.contains(g)||a(!1)},p=h=>{h.key==="Escape"&&a(!1)},f=()=>a(!1);return document.addEventListener("mousedown",u),document.addEventListener("keydown",p),window.addEventListener("scroll",f,!0),window.addEventListener("resize",f),()=>{document.removeEventListener("mousedown",u),document.removeEventListener("keydown",p),window.removeEventListener("scroll",f,!0),window.removeEventListener("resize",f)}},[n]);const d=u=>p=>{p.stopPropagation(),p.preventDefault(),a(!1),u.onClick()};return i.jsxs(i.Fragment,{children:[i.jsx("button",{ref:l,type:"button","aria-haspopup":"menu","aria-expanded":n,"aria-label":r||"Actions",title:r||"Actions",onClick:u=>{u.stopPropagation(),u.preventDefault(),a(p=>!p)},className:xe("flex h-6 w-6 items-center justify-center rounded-md text-muted-foreground","opacity-0 transition-all duration-150 hover:bg-accent hover:text-foreground","group-hover:opacity-100 focus-visible:opacity-100 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-primary","touch:opacity-100",n&&"bg-accent text-foreground opacity-100",t),children:i.jsx(B4,{className:"h-3.5 w-3.5"})}),n&&s&&Vu.createPortal(i.jsx("div",{ref:c,role:"menu",style:{position:"fixed",top:s.top,left:s.left,zIndex:9999},className:xe("w-40 rounded-xl border border-border/60 bg-popover p-1 shadow-lg","animate-in fade-in-0 zoom-in-95 duration-100"),onClick:u=>u.stopPropagation(),onMouseDown:u=>u.stopPropagation(),children:e.map((u,p)=>{const f=u.icon,h=e[p-1],g=p>0&&u.danger&&!h?.danger;return i.jsxs("div",{children:[g&&i.jsx("div",{className:"my-1 h-px bg-border/60"}),i.jsxs("button",{type:"button",role:"menuitem",onClick:d(u),className:xe("flex w-full items-center gap-2 rounded-md px-2 py-1.5 text-left text-xs",u.danger?"text-red-600 hover:bg-red-50 dark:text-red-400 dark:hover:bg-red-900/20":"text-foreground hover:bg-accent"),children:[i.jsx(f,{className:"h-3 w-3"}),u.label]})]},u.id)})}),document.body)]})}const u9=(e,t,r)=>{const n=new Date(e),a=t;if(isNaN(n.getTime()))return r?r("status.unknown"):"Unknown";const s=a.getTime()-n.getTime(),o=Math.floor(s/1e3),l=Math.floor(s/(1e3*60)),c=Math.floor(s/(1e3*60*60)),d=Math.floor(s/(1e3*60*60*24));return o<60?r?r("time.justNow"):"Just now":l===1?r?r("time.oneMinuteAgo"):"1 min ago":l<60?r?r("time.minutesAgo",{count:l}):`${l} mins ago`:c===1?r?r("time.oneHourAgo"):"1 hour ago":c<24?r?r("time.hoursAgo",{count:c}):`${c} hours ago`:d===1?r?r("time.oneDayAgo"):"1 day ago":d<7?r?r("time.daysAgo",{count:d}):`${d} days ago`:n.toLocaleDateString()};function zk({isStarred:e,canDelete:t,onRename:r,onToggleStar:n,onDelete:a,t:s,className:o}){const l=d=>i.jsx(Ei,{className:`${d.className??""} ${e?"fill-yellow-400 text-yellow-500":""}`}),c=[{id:"rename",label:s("actions.rename"),icon:F4,onClick:r},{id:"star",label:e?s("actions.unstarSession",{defaultValue:"Remove star"}):s("actions.starSession",{defaultValue:"Star"}),icon:l,onClick:n}];return t&&c.push({id:"delete",label:s("actions.delete"),icon:Br,onClick:a,danger:!0}),i.jsx(QE,{actions:c,className:o,triggerLabel:s("tooltips.sessionActions",{defaultValue:"Session actions"})})}const p9={claude:"Claude",cursor:"Cursor",codex:"Codex",gemini:"Gemini",qwen:"Qwen Code",opencode:"OpenCode"},Bk={claude:"bg-orange-500/10 text-orange-600 dark:bg-orange-400/10 dark:text-orange-300 ring-1 ring-orange-500/15",cursor:"bg-sky-500/10 text-sky-600 dark:bg-sky-400/10 dark:text-sky-300 ring-1 ring-sky-500/15",codex:"bg-violet-500/10 text-violet-600 dark:bg-violet-400/10 dark:text-violet-300 ring-1 ring-violet-500/15",gemini:"bg-emerald-500/10 text-emerald-600 dark:bg-emerald-400/10 dark:text-emerald-300 ring-1 ring-emerald-500/15",qwen:"bg-amber-500/10 text-amber-600 dark:bg-amber-400/10 dark:text-amber-300 ring-1 ring-amber-500/15",opencode:"bg-teal-500/10 text-teal-600 dark:bg-teal-400/10 dark:text-teal-300 ring-1 ring-teal-500/15"};function e3({project:e,session:t,selectedSession:r,currentTime:n,editingSession:a,editingSessionName:s,isStarred:o,compact:l=!1,onEditingSessionNameChange:c,onStartEditingSession:d,onCancelEditingSession:u,onSaveEditingSession:p,onToggleStarSession:f,onProjectSelect:h,onSessionSelect:g,onDeleteSession:b,t:x}){const y=JO(t,n,x),v=r?.id===t.id,w=a===t.id,k=t.__provider,S=p9[k]??k,N=Bk[k]??Bk.claude,E=YO(y.sessionName),I=()=>{h(e),g(t,e.name)},A=()=>{p(e.name,t.id,s,k)},T=()=>{b(e.name,t.id,y.sessionName,k)},_=()=>d(t.id,y.sessionName),j=()=>f(e.name,t.id),R=i.jsxs("div",{className:"mt-0.5 flex min-w-0 flex-wrap items-center gap-1 text-[10px] leading-tight",children:[i.jsxs("span",{className:xe("inline-flex items-center gap-1 rounded-full px-1.5 py-px font-medium",N),children:[i.jsx(er,{provider:k,className:"h-2.5 w-2.5"}),S]}),i.jsx("span",{className:"text-muted-foreground/80",children:u9(y.sessionTime,n,x)}),y.isActive&&i.jsxs("span",{className:"inline-flex items-center gap-1 text-green-600 dark:text-green-400",children:[i.jsx("span",{className:"h-1.5 w-1.5 animate-pulse rounded-full bg-green-500"}),x("status.active",{defaultValue:"Active"})]}),E.slice(0,3).map(F=>i.jsxs("span",{className:"rounded-md bg-muted/60 px-1 py-px font-mono text-[9px] uppercase tracking-wide text-muted-foreground ring-1 ring-border/40",children:[".",F]},F))]}),C=i.jsxs(i.Fragment,{children:[i.jsx("input",{type:"text",value:s,onChange:F=>c(F.target.value),onKeyDown:F=>{F.stopPropagation(),F.key==="Enter"?A():F.key==="Escape"&&u()},onClick:F=>F.stopPropagation(),className:"w-full rounded-md border border-primary/40 bg-background px-2 py-1 text-xs focus:outline-none focus:ring-1 focus:ring-primary",autoFocus:!0}),i.jsx("button",{className:"flex h-6 w-6 items-center justify-center rounded-md bg-green-50 hover:bg-green-100 dark:bg-green-900/20 dark:hover:bg-green-900/40",onClick:F=>{F.stopPropagation(),A()},title:x("tooltips.save"),children:i.jsx(Gt,{className:"h-3 w-3 text-green-600 dark:text-green-400"})}),i.jsx("button",{className:"flex h-6 w-6 items-center justify-center rounded-md bg-gray-50 hover:bg-gray-100 dark:bg-gray-900/20 dark:hover:bg-gray-900/40",onClick:F=>{F.stopPropagation(),u()},title:x("tooltips.cancel"),children:i.jsx(Ct,{className:"h-3 w-3 text-gray-600 dark:text-gray-400"})})]}),D=i.jsx("div",{className:"md:hidden",children:i.jsx("div",{className:xe("relative mx-3 my-0.5 rounded-lg border border-border/30 bg-card p-2 transition-all duration-150 active:scale-[0.98]",v&&"border-primary/30 bg-primary/5 shadow-sm",!v&&y.isActive&&"border-green-500/25 bg-green-50/5 dark:bg-green-900/5",o&&!v&&"ring-1 ring-yellow-300/50 dark:ring-yellow-500/30"),onClick:w?void 0:I,children:w?i.jsx("div",{className:"flex items-center gap-1",children:C}):i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("div",{className:xe("flex h-6 w-6 flex-shrink-0 items-center justify-center rounded-md",v?"bg-primary/10":"bg-muted/60"),children:i.jsx(er,{provider:k,className:"h-3 w-3"})}),i.jsxs("div",{className:"min-w-0 flex-1",children:[i.jsxs("div",{className:"flex items-center gap-1",children:[o&&i.jsx("span",{className:"text-yellow-500","aria-hidden":!0,children:"★"}),i.jsx("span",{className:"truncate text-xs font-medium text-foreground",children:y.sessionName})]}),R]}),i.jsx("div",{className:"flex-shrink-0",onClick:F=>F.stopPropagation(),children:i.jsx(zk,{isStarred:o,canDelete:!y.isCursorSession,onRename:_,onToggleStar:j,onDelete:T,t:x,className:"!opacity-100"})})]})})}),B=i.jsxs("div",{className:xe("group/item relative hidden md:block"),children:[i.jsxs(Ne,{variant:"ghost",className:xe("relative h-auto w-full justify-start overflow-hidden p-0 text-left font-normal transition-colors duration-150","hover:bg-accent/60",v&&"bg-accent text-accent-foreground",o&&!v&&"bg-yellow-50/40 hover:bg-yellow-100/40 dark:bg-yellow-900/10 dark:hover:bg-yellow-900/20",l?"rounded-xl px-3 py-2.5":"rounded-lg px-3 py-2"),onClick:w?void 0:()=>g(t,e.name),children:[v&&i.jsx("span",{"aria-hidden":!0,className:"absolute left-0 top-1/2 h-5 w-0.5 -translate-y-1/2 rounded-r bg-primary"}),!v&&!w&&i.jsx("span",{"aria-hidden":!0,className:"session-item-accent"}),i.jsxs("div",{className:"flex w-full min-w-0 items-start gap-2 pr-6",children:[i.jsx("div",{className:xe("mt-0.5 flex h-5 w-5 flex-shrink-0 items-center justify-center rounded-md",v?"bg-primary/10":"bg-muted/50 group-hover/item:bg-muted/80"),children:i.jsx(er,{provider:k,className:"h-3 w-3"})}),i.jsx("div",{className:"min-w-0 flex-1",children:w?i.jsx("div",{className:"flex items-center gap-1",children:C}):i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:"flex min-w-0 items-center gap-1",children:[o&&i.jsx("span",{className:"flex-shrink-0 text-yellow-500","aria-hidden":!0,children:"★"}),i.jsx("span",{className:"truncate text-xs font-medium text-foreground",children:y.sessionName})]}),R]})})]})]}),!w&&i.jsx("div",{className:"absolute right-1.5 top-1/2 -translate-y-1/2",onClick:F=>F.stopPropagation(),children:i.jsx(zk,{isStarred:o,canDelete:!y.isCursorSession,onRename:_,onToggleStar:j,onDelete:T,t:x,className:"opacity-0 focus-visible:opacity-100 group-hover/item:opacity-100"})})]});return i.jsxs("div",{className:"group relative",children:[D,B]})}const m9=e=>e==="claude-code"?"claude":e==="codex"?"codex":e==="gemini"?"gemini":e==="qwen"?"qwen":e==="opencode"?"opencode":null;function h9(){return i.jsx(i.Fragment,{children:Array.from({length:3}).map((e,t)=>i.jsx("div",{className:"rounded-md p-2",children:i.jsxs("div",{className:"flex items-start gap-2",children:[i.jsx("div",{className:"mt-0.5 h-3 w-3 animate-pulse rounded-full bg-muted"}),i.jsxs("div",{className:"flex-1 space-y-1",children:[i.jsx("div",{className:"h-3 animate-pulse rounded bg-muted",style:{width:`${60+t*15}%`}}),i.jsx("div",{className:"h-2 w-1/2 animate-pulse rounded bg-muted"})]})]})},t))})}function f9({project:e,isExpanded:t,sessions:r,selectedSession:n,initialSessionsLoaded:a,isLoadingSessions:s,currentTime:o,editingSession:l,editingSessionName:c,isSessionStarred:d,onEditingSessionNameChange:u,onStartEditingSession:p,onCancelEditingSession:f,onSaveEditingSession:h,onToggleStarSession:g,onProjectSelect:b,onSessionSelect:x,onDeleteSession:y,onLoadMoreSessions:v,onNewSession:w,onOpenOrchestration:k,t:S}){const[N,E]=m.useState([]);if(m.useEffect(()=>{if(!t)return;let T=!1;const _=async()=>{const R=await Ce(`/api/orchestration/workflows/runs?projectId=${encodeURIComponent(e.name)}`);if(!R.ok)return;const C=await R.json();T||E((C.runs??[]).slice(0,5))};_();const j=window.setInterval(()=>{_()},15e3);return()=>{T=!0,window.clearInterval(j)}},[t,e.name]),!t)return null;const I=r.length>0,A=e.sessionMeta?.hasMore===!0;return i.jsxs("div",{className:"ml-3 space-y-1 border-l border-border pl-3",children:[i.jsx("div",{className:"px-3 pb-1 pt-1 md:hidden",children:i.jsxs("button",{className:"flex h-8 w-full items-center justify-center gap-2 rounded-md bg-primary text-xs font-medium text-primary-foreground transition-all duration-150 hover:bg-primary/90 active:scale-[0.98]",onClick:()=>{b(e),w(e)},children:[i.jsx(Ut,{className:"h-3 w-3"}),S("sessions.newSession")]})}),i.jsxs(Ne,{variant:"default",size:"sm",className:"hidden h-8 w-full justify-start gap-2 bg-primary text-xs font-medium text-primary-foreground transition-colors hover:bg-primary/90 md:flex",onClick:()=>w(e),children:[i.jsx(Ut,{className:"h-3 w-3"}),S("sessions.newSession")]}),N.length>0&&i.jsxs("div",{className:"space-y-1",children:[i.jsxs("div",{className:"flex items-center gap-1 px-3 pt-2 text-[10px] font-semibold uppercase tracking-wide text-muted-foreground",children:[i.jsx(pr,{className:"h-3 w-3"}),S("orchestration.section")]}),N.map(T=>{const _=[...new Set(T.nodeRuns.map(j=>m9(j.adapterId)).filter(Boolean))];return i.jsx("button",{type:"button",onClick:()=>k?.(e,T.id),className:"w-full rounded-lg px-3 py-2 text-left transition-colors hover:bg-accent/60",children:i.jsxs("div",{className:"flex min-w-0 items-start gap-2",children:[i.jsx(pr,{className:"mt-0.5 h-4 w-4 flex-shrink-0 text-primary"}),i.jsxs("div",{className:"min-w-0 flex-1",children:[i.jsx("div",{className:"truncate text-xs font-medium text-foreground",children:T.input||S("orchestration.fallbackTitle")}),i.jsxs("div",{className:"mt-1 flex items-center gap-1",children:[_.slice(0,4).map(j=>i.jsx("span",{className:"flex h-4 w-4 items-center justify-center rounded bg-muted",children:i.jsx(er,{provider:j,className:"h-3 w-3"})},j)),i.jsx("span",{className:"text-[10px] text-muted-foreground",children:S(`common:orchestration.status.${T.status}`,{defaultValue:T.status})})]})]})]})},T.id)})]}),a?!I&&!s?i.jsx("div",{className:"px-3 py-2 text-left",children:i.jsx("p",{className:"text-xs text-muted-foreground",children:S("sessions.noSessions")})}):r.map(T=>i.jsx(e3,{project:e,session:T,selectedSession:n,currentTime:o,editingSession:l,editingSessionName:c,isStarred:d(e.name,T.id),onEditingSessionNameChange:u,onStartEditingSession:p,onCancelEditingSession:f,onSaveEditingSession:h,onToggleStarSession:g,onProjectSelect:b,onSessionSelect:x,onDeleteSession:y,t:S},T.id)):i.jsx(h9,{}),I&&A&&i.jsx(Ne,{variant:"ghost",size:"sm",className:"mt-2 w-full justify-center gap-2 text-muted-foreground",onClick:()=>v(e),disabled:s,children:s?i.jsxs(i.Fragment,{children:[i.jsx("div",{className:"h-3 w-3 animate-spin rounded-full border border-muted-foreground border-t-transparent"}),S("sessions.loading")]}):i.jsxs(i.Fragment,{children:[i.jsx(Mn,{className:"h-3 w-3"}),S("sessions.showMore")]})})]})}const g9=(e,t)=>{const r=e.length;return t&&r>=5?`${r}+`:`${r}`};function b9({project:e,selectedProject:t,selectedSession:r,isExpanded:n,isDeleting:a,isStarred:s,editingProject:o,editingName:l,sessions:c,initialSessionsLoaded:d,isLoadingSessions:u,currentTime:p,editingSession:f,editingSessionName:h,isSessionStarred:g,onEditingNameChange:b,onToggleProject:x,onProjectSelect:y,onToggleStarProject:v,onToggleStarSession:w,onStartEditingProject:k,onCancelEditingProject:S,onSaveProjectName:N,onDeleteProject:E,onSessionSelect:I,onDeleteSession:A,onLoadMoreSessions:T,onNewSession:_,onOpenOrchestration:j,onEditingSessionNameChange:R,onStartEditingSession:C,onCancelEditingSession:D,onSaveEditingSession:B,t:F}){const V=t?.name===e.name,K=o===e.name,L=e.sessionMeta?.hasMore===!0,G=g9(c,L),H=`${G} session${c.length===1?"":"s"}`,z=()=>x(e.name),te=()=>v(e.name),se=()=>{N(e.name)},me=()=>{t?.name!==e.name&&y(e),z()};return i.jsxs("div",{className:xe("md:space-y-1",a&&"opacity-50 pointer-events-none"),children:[i.jsxs("div",{className:"md:group group",children:[i.jsx("div",{className:"md:hidden",children:i.jsx("div",{className:xe("p-3 mx-3 my-1 rounded-lg bg-card border border-border/50 active:scale-[0.98] transition-all duration-150",V&&"bg-primary/5 border-primary/20",s&&!V&&"bg-yellow-50/50 dark:bg-yellow-900/5 border-yellow-200/30 dark:border-yellow-800/30"),onClick:z,children:i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsxs("div",{className:"flex min-w-0 flex-1 items-center gap-3",children:[i.jsx("div",{className:xe("w-8 h-8 rounded-lg flex items-center justify-center transition-colors",n?"bg-primary/10":"bg-muted"),children:n?i.jsx(Bn,{className:"h-4 w-4 text-primary"}):i.jsx(qr,{className:"h-4 w-4 text-muted-foreground"})}),i.jsx("div",{className:"min-w-0 flex-1",children:K?i.jsx("input",{type:"text",value:l,onChange:de=>b(de.target.value),className:"w-full rounded-lg border-2 border-primary/40 bg-background px-3 py-2 text-sm text-foreground shadow-sm transition-all duration-200 focus:border-primary focus:shadow-md focus:outline-none",placeholder:F("projects.projectNamePlaceholder"),autoFocus:!0,autoComplete:"off",onClick:de=>de.stopPropagation(),onKeyDown:de=>{de.key==="Enter"&&se(),de.key==="Escape"&&S()},style:{fontSize:"16px",WebkitAppearance:"none",borderRadius:"8px"}}):i.jsxs(i.Fragment,{children:[i.jsx("div",{className:"flex min-w-0 flex-1 items-center justify-between",children:i.jsx("h3",{className:"truncate text-sm font-medium text-foreground",children:e.displayName})}),i.jsx("p",{className:"text-xs text-muted-foreground",children:H})]})})]}),i.jsx("div",{className:"flex items-center gap-1",children:K?i.jsxs(i.Fragment,{children:[i.jsx("button",{className:"flex h-8 w-8 items-center justify-center rounded-lg bg-green-500 shadow-sm transition-all duration-150 active:scale-90 active:shadow-none dark:bg-green-600",onClick:de=>{de.stopPropagation(),se()},children:i.jsx(Gt,{className:"h-4 w-4 text-white"})}),i.jsx("button",{className:"flex h-8 w-8 items-center justify-center rounded-lg bg-gray-500 shadow-sm transition-all duration-150 active:scale-90 active:shadow-none dark:bg-gray-600",onClick:de=>{de.stopPropagation(),S()},children:i.jsx(Ct,{className:"h-4 w-4 text-white"})})]}):i.jsxs(i.Fragment,{children:[i.jsx("button",{className:xe("w-8 h-8 rounded-lg flex items-center justify-center active:scale-90 transition-all duration-150 border",s?"bg-yellow-500/10 dark:bg-yellow-900/30 border-yellow-200 dark:border-yellow-800":"bg-gray-500/10 dark:bg-gray-900/30 border-gray-200 dark:border-gray-800"),onClick:de=>{de.stopPropagation(),te()},title:F(s?"tooltips.removeFromFavorites":"tooltips.addToFavorites"),children:i.jsx(Ei,{className:xe("w-4 h-4 transition-colors",s?"text-yellow-600 dark:text-yellow-400 fill-current":"text-gray-600 dark:text-gray-400")})}),i.jsx("button",{className:"flex h-8 w-8 items-center justify-center rounded-lg border border-red-200 bg-red-500/10 active:scale-90 dark:border-red-800 dark:bg-red-900/30",onClick:de=>{de.stopPropagation(),E(e)},children:i.jsx(Br,{className:"h-4 w-4 text-red-600 dark:text-red-400"})}),i.jsx("button",{className:"flex h-8 w-8 items-center justify-center rounded-lg border border-primary/20 bg-primary/10 active:scale-90 dark:border-primary/30 dark:bg-primary/20",onClick:de=>{de.stopPropagation(),k(e)},children:i.jsx(cf,{className:"h-4 w-4 text-primary"})}),i.jsx("div",{className:"flex h-6 w-6 items-center justify-center rounded-md bg-muted/30",children:n?i.jsx(Mn,{className:"h-3 w-3 text-muted-foreground"}):i.jsx(Fn,{className:"h-3 w-3 text-muted-foreground"})})]})})]})})}),i.jsxs(Ne,{variant:"ghost",className:xe("hidden md:flex w-full justify-between p-2 h-auto font-normal hover:bg-accent/50",V&&"bg-accent text-accent-foreground",s&&!V&&"bg-yellow-50/50 dark:bg-yellow-900/10 hover:bg-yellow-100/50 dark:hover:bg-yellow-900/20"),onClick:me,children:[i.jsxs("div",{className:"flex min-w-0 flex-1 items-center gap-3",children:[n?i.jsx(Bn,{className:"h-4 w-4 flex-shrink-0 text-primary"}):i.jsx(qr,{className:"h-4 w-4 flex-shrink-0 text-muted-foreground"}),i.jsx("div",{className:"min-w-0 flex-1 text-left",children:K?i.jsxs("div",{className:"space-y-1",children:[i.jsx("input",{type:"text",value:l,onChange:de=>b(de.target.value),className:"w-full rounded border border-border bg-background px-2 py-1 text-sm text-foreground focus:ring-2 focus:ring-primary/20",placeholder:F("projects.projectNamePlaceholder"),autoFocus:!0,onKeyDown:de=>{de.key==="Enter"&&se(),de.key==="Escape"&&S()}}),i.jsx("div",{className:"truncate text-xs text-muted-foreground",title:e.fullPath,children:e.fullPath})]}):i.jsxs("div",{children:[i.jsx("div",{className:"truncate text-sm font-semibold text-foreground",title:e.displayName,children:e.displayName}),i.jsxs("div",{className:"text-xs text-muted-foreground",children:[G,e.fullPath!==e.displayName&&i.jsxs("span",{className:"ml-1 opacity-60",title:e.fullPath,children:[" - ",e.fullPath.length>25?`...${e.fullPath.slice(-22)}`:e.fullPath]})]})]})})]}),i.jsx("div",{className:"flex flex-shrink-0 items-center gap-1",children:K?i.jsxs(i.Fragment,{children:[i.jsx("div",{className:"flex h-6 w-6 cursor-pointer items-center justify-center rounded text-green-600 transition-colors hover:bg-green-50 hover:text-green-700 dark:hover:bg-green-900/20",onClick:de=>{de.stopPropagation(),se()},children:i.jsx(Gt,{className:"h-3 w-3"})}),i.jsx("div",{className:"flex h-6 w-6 cursor-pointer items-center justify-center rounded text-gray-500 transition-colors hover:bg-gray-50 hover:text-gray-700 dark:hover:bg-gray-800",onClick:de=>{de.stopPropagation(),S()},children:i.jsx(Ct,{className:"h-3 w-3"})})]}):i.jsxs(i.Fragment,{children:[s&&i.jsx("div",{className:"flex h-6 w-6 cursor-pointer items-center justify-center rounded hover:bg-yellow-50 dark:hover:bg-yellow-900/20",onClick:de=>{de.stopPropagation(),te()},title:F("tooltips.removeFromFavorites"),children:i.jsx(Ei,{className:"h-3 w-3 fill-current text-yellow-600 dark:text-yellow-400"})}),i.jsx(QE,{triggerLabel:F("tooltips.projectActions",{defaultValue:"Project actions"}),actions:[{id:"rename",label:F("actions.rename"),icon:cf,onClick:()=>k(e)},{id:"star",label:F(s?"tooltips.removeFromFavorites":"tooltips.addToFavorites"),icon:Ei,onClick:te},{id:"delete",label:F("actions.delete",{defaultValue:"Delete"}),icon:Br,onClick:()=>E(e),danger:!0}]}),n?i.jsx(Mn,{className:"h-4 w-4 text-muted-foreground transition-colors group-hover:text-foreground"}):i.jsx(Fn,{className:"h-4 w-4 text-muted-foreground transition-colors group-hover:text-foreground"})]})})]})]}),i.jsx(f9,{project:e,isExpanded:n,sessions:c,selectedSession:r,initialSessionsLoaded:d,isLoadingSessions:u,currentTime:p,editingSession:f,editingSessionName:h,isSessionStarred:g,onEditingSessionNameChange:R,onStartEditingSession:C,onCancelEditingSession:D,onSaveEditingSession:B,onToggleStarSession:w,onProjectSelect:y,onSessionSelect:I,onDeleteSession:A,onLoadMoreSessions:T,onNewSession:_,onOpenOrchestration:j,t:F})]})}function t3({isLoading:e,loadingProgress:t,projectsCount:r,filteredProjectsCount:n,t:a}){return e?i.jsxs("div",{className:"px-4 py-12 text-center md:py-8",children:[i.jsx("div",{className:"mx-auto mb-4 flex h-12 w-12 items-center justify-center rounded-lg bg-muted md:mb-3",children:i.jsx("div",{className:"h-6 w-6 animate-spin rounded-full border-2 border-muted-foreground border-t-transparent"})}),i.jsx("h3",{className:"mb-2 text-base font-medium text-foreground md:mb-1",children:a("projects.loadingProjects")}),t&&t.total>0?i.jsxs("div",{className:"space-y-2",children:[i.jsx("div",{className:"h-2 w-full overflow-hidden rounded-full bg-muted",children:i.jsx("div",{className:"h-full bg-primary transition-all duration-300 ease-out",style:{width:`${t.current/t.total*100}%`}})}),i.jsxs("p",{className:"text-sm text-muted-foreground",children:[t.current,"/",t.total," ",a("projects.projects")]}),t.currentProject&&i.jsx("p",{className:"mx-auto max-w-[200px] truncate text-xs text-muted-foreground/70",title:t.currentProject,children:t.currentProject.split("-").slice(-2).join("/")})]}):i.jsx("p",{className:"text-sm text-muted-foreground",children:a("projects.fetchingProjects")})]}):r===0?i.jsxs("div",{className:"px-4 py-12 text-center md:py-8",children:[i.jsx("div",{className:"mx-auto mb-4 flex h-12 w-12 items-center justify-center rounded-lg bg-muted md:mb-3",children:i.jsx(qr,{className:"h-6 w-6 text-muted-foreground"})}),i.jsx("h3",{className:"mb-2 text-base font-medium text-foreground md:mb-1",children:a("projects.noProjects")}),i.jsx("p",{className:"text-sm text-muted-foreground",children:a("projects.runClaudeCli")})]}):n===0?i.jsxs("div",{className:"px-4 py-12 text-center md:py-8",children:[i.jsx("div",{className:"mx-auto mb-4 flex h-12 w-12 items-center justify-center rounded-lg bg-muted md:mb-3",children:i.jsx(ys,{className:"h-6 w-6 text-muted-foreground"})}),i.jsx("h3",{className:"mb-2 text-base font-medium text-foreground md:mb-1",children:a("projects.noMatchingProjects")}),i.jsx("p",{className:"text-sm text-muted-foreground",children:a("projects.tryDifferentSearch")})]}):null}function x9({projects:e,filteredProjects:t,selectedProject:r,selectedSession:n,isLoading:a,loadingProgress:s,expandedProjects:o,editingProject:l,editingName:c,loadingSessions:d,initialSessionsLoaded:u,currentTime:p,editingSession:f,editingSessionName:h,deletingProjects:g,getProjectSessions:b,isProjectStarred:x,isSessionStarred:y,onEditingNameChange:v,onToggleProject:w,onProjectSelect:k,onToggleStarProject:S,onToggleStarSession:N,onStartEditingProject:E,onCancelEditingProject:I,onSaveProjectName:A,onDeleteProject:T,onSessionSelect:_,onDeleteSession:j,onLoadMoreSessions:R,onNewSession:C,onOpenOrchestration:D,onEditingSessionNameChange:B,onStartEditingSession:F,onCancelEditingSession:V,onSaveEditingSession:K,t:L}){const G=i.jsx(t3,{isLoading:a,loadingProgress:s,projectsCount:e.length,filteredProjectsCount:t.length,t:L});m.useEffect(()=>{let de="Pixcode";const ce=r?.displayName?.trim();ce&&(de=`${ce} - ${de}`),document.title=de},[r]);const H=!a&&e.length>0&&t.length>0,z=de=>de.source==="history"||de.autoDiscovered===!0&&de.isManuallyAdded!==!0,te=t.filter(de=>!z(de)),se=t.filter(de=>z(de)),me=de=>i.jsx(b9,{project:de,selectedProject:r,selectedSession:n,isExpanded:o.has(de.name),isDeleting:g.has(de.name),isStarred:x(de.name),editingProject:l,editingName:c,sessions:b(de),initialSessionsLoaded:u.has(de.name),isLoadingSessions:!!d[de.name],currentTime:p,editingSession:f,editingSessionName:h,isSessionStarred:y,onEditingNameChange:v,onToggleProject:w,onProjectSelect:k,onToggleStarProject:S,onToggleStarSession:N,onStartEditingProject:E,onCancelEditingProject:I,onSaveProjectName:A,onDeleteProject:T,onSessionSelect:_,onDeleteSession:j,onLoadMoreSessions:R,onNewSession:C,onOpenOrchestration:D,onEditingSessionNameChange:B,onStartEditingSession:F,onCancelEditingSession:V,onSaveEditingSession:K,t:L},de.name);return i.jsx("div",{className:"pb-safe-area-inset-bottom md:space-y-1",children:H?i.jsxs(i.Fragment,{children:[te.map(de=>me(de)),se.length>0&&i.jsxs(i.Fragment,{children:[i.jsx("div",{className:"px-3 pb-1 pt-3 text-[11px] font-semibold uppercase tracking-wide text-gray-500 dark:text-gray-400",children:L("projects.detectedFromHistory")}),se.map(de=>me(de))]})]}):G})}function Ma(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function r3(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,e.__proto__=t}/*!
220
+ */const vD=[["rect",{width:"8",height:"8",x:"3",y:"3",rx:"2",key:"by2w9f"}],["path",{d:"M7 11v4a2 2 0 0 0 2 2h4",key:"xkn7yn"}],["rect",{width:"8",height:"8",x:"13",y:"13",rx:"2",key:"1cgmvn"}]],wD=jt("workflow",vD),L4=k4,kD=N7,lk=w7,SD=p7,D4=b7,CD=w4,Mn=N4,Go=o8,Fn=c8,ND=u8,mn=y7,zn=w4,su=S7,O4=f7,Ku=r8,Yu=a8,Ug=T7,at=S4,_t=S4,Zu=R7,ED=j7,TD=fP,tn=O8,wr=F8,Gt=e8,Wa=J7,M4=rP,Hr=LP,Cc=j4,AD=j4,ou=H7,No=m8,Cs=E4,us=x8,Eo=A8,Dr=I8,qr=K8,Bn=G8,ji=W8,jD=vP,ID=eP,$g=oP,Hg=AP,RD=P7,_D=V7,PD=qP,F4=A4,cf=bP,LD=Z8,df=A4,z4=kP,Ut=CP,Br=YP,B4=_8,ys=uP,Ct=I4,uf=I4,Nc=UP,Gg=z7,DD=M7,pf=D7,OD=L8,Un=C4,MD=C4,FD=XP,vs=QP,Vg=Y7,To=q7,Wg=g8,Ec=$8,qg=B8,xn=J8,Ii=E4,Tc=T4,zD=T4,U4=iP,Tn=cP,$4=mP,Xu=C8,H4=VP,BD=EP,ca=_P,UD=IP,Ht=v8,G4=l7,Ac=E8,$n=MP,Ei=zP,V4=HP,Rr=k8,Kg=U7,$D=cL,Ui=fL,Yg=_4,HD=_4,Kr=ZL,Ud=JL,Ju=eD,Ms=oL,Fs=uL,GD=mL,_l=bL,mo=yL,ck=kL,Pl=CL,fl=AL,VD=IL,W4=$L,mf=_L,ia=OL,gl=LL,dk=FL,bl=BL,hf=GL,WD=WL,ff=KL,so=aD,Ll=sD,oi=lD,zs=dD,qD=pD,gf=hD,KD=bD,xl=yD,pr=wD,Qu=EL,YD=rD,ZD=[{type:"key",id:"esc",label:"Esc",sequence:"\x1B"},{type:"key",id:"tab",label:"Tab",sequence:" "},{type:"key",id:"shift-tab",label:"⇧Tab",sequence:"\x1B[Z"},{type:"modifier",id:"ctrl",label:"CTRL",modifier:"ctrl"},{type:"modifier",id:"alt",label:"ALT",modifier:"alt"},{type:"arrow",id:"arrow-up",sequence:"\x1B[A",icon:"up"},{type:"arrow",id:"arrow-down",sequence:"\x1B[B",icon:"down"},{type:"arrow",id:"arrow-left",sequence:"\x1B[D",icon:"left"},{type:"arrow",id:"arrow-right",sequence:"\x1B[C",icon:"right"}],XD={up:kD,down:L4,left:SD,right:D4},yl=e=>e.preventDefault(),uk="shrink-0 rounded-md border border-gray-600 bg-gray-700 px-2.5 py-1.5 text-xs font-medium text-gray-100 transition-colors select-none active:bg-blue-600 active:text-white active:border-blue-600 disabled:cursor-not-allowed disabled:opacity-40",JD="shrink-0 rounded-md border border-blue-500 bg-blue-600 px-2.5 py-1.5 text-xs font-medium text-white transition-colors select-none disabled:cursor-not-allowed disabled:opacity-40",Qp="shrink-0 rounded-md border border-gray-600 bg-gray-700 p-1.5 text-gray-100 transition-colors select-none active:bg-blue-600 active:text-white active:border-blue-600 disabled:cursor-not-allowed disabled:opacity-40";function pk({wsRef:e,terminalRef:t,isConnected:r,bottomOffset:n="bottom-0"}){const{t:a}=He("settings"),[s,o]=m.useState(!1),[l,c]=m.useState(!1),[d,u]=m.useState(!1),p=m.useCallback(b=>{ls(e.current,{type:"input",data:b})},[e]),f=m.useCallback(()=>{t.current?.scrollToBottom()},[t]),h=m.useCallback(async()=>{if(typeof navigator>"u"||!navigator.clipboard?.readText){u(!0);return}try{const b=await navigator.clipboard.readText();u(!1),b.length>0&&p(b)}catch{u(!0)}},[p]);m.useEffect(()=>{if(!d)return;const b=window.setTimeout(()=>u(!1),2500);return()=>window.clearTimeout(b)},[d]);const g=m.useCallback(b=>{let x=b;if(s&&b.length===1){const y=b.toLowerCase().charCodeAt(0);y>=97&&y<=122&&(x=String.fromCharCode(y-96)),o(!1)}l&&b.length===1&&(x="\x1B"+x,c(!1)),p(x)},[s,l,p]);return i.jsx("div",{className:`pointer-events-none fixed inset-x-0 ${n} z-20 px-2 md:hidden`,children:i.jsxs("div",{className:"pointer-events-auto flex items-center gap-1 overflow-x-auto rounded-lg border border-gray-700/80 bg-gray-900/95 px-1.5 py-1.5 shadow-lg backdrop-blur-sm [-webkit-overflow-scrolling:touch] [scrollbar-width:none] [&::-webkit-scrollbar]:hidden",children:[d&&i.jsx("span",{className:"shrink-0 rounded-md border border-yellow-500/50 bg-yellow-500/15 px-2 py-1 text-[11px] text-yellow-100",children:"Clipboard blocked"}),i.jsx("button",{type:"button",onPointerDown:yl,onClick:()=>{h()},disabled:!r,className:Qp,title:a("terminalShortcuts.paste",{defaultValue:"Paste"}),"aria-label":a("terminalShortcuts.paste",{defaultValue:"Paste"}),children:i.jsx(No,{className:"h-4 w-4"})}),ZD.map(b=>{if(b.type==="modifier"){const x=b.modifier==="ctrl"?s:l,y=b.modifier==="ctrl"?()=>o(v=>!v):()=>c(v=>!v);return i.jsx("button",{type:"button",onPointerDown:yl,onClick:y,disabled:!r,className:x?JD:uk,children:b.label},b.id)}if(b.type==="arrow"){const x=XD[b.icon];return i.jsx("button",{type:"button",onPointerDown:yl,onClick:()=>p(b.sequence),disabled:!r,className:Qp,children:i.jsx(x,{className:"h-4 w-4"})},b.id)}return i.jsx("button",{type:"button",onPointerDown:yl,onClick:()=>g(b.sequence),disabled:!r,className:uk,children:b.label},b.id)}),i.jsx("button",{type:"button",onPointerDown:yl,onClick:f,disabled:!r,className:Qp,title:a("terminalShortcuts.scrollDown"),"aria-label":a("terminalShortcuts.scrollDown"),children:i.jsx(CD,{className:"h-4 w-4"})})]})})}function QD({tabId:e,selectedProject:t=null,selectedSession:r=null,initialCommand:n=null,isPlainShell:a=!1,onProcessComplete:s=null,minimal:o=!1,autoConnect:l=!1,forceNewSession:c=!1,startupInput:d=null,hermesLaunchId:u=null,permissionOverride:p=null,provider:f=null,isActive:h=!0,onClose:g=null}){const{t:b}=He("chat"),[x,y]=m.useState(!1),[v,w]=m.useState(null),k=m.useRef(null),S=m.useRef(null),{terminalContainerRef:N,terminalRef:E,wsRef:I,isConnected:A,isInitialized:T,isConnecting:_,authUrl:j,authUrlVersion:R,connectToShell:C,disconnectFromShell:D,openAuthUrlInBrowser:B,copyAuthUrlToClipboard:F}=r7({tabId:e,selectedProject:t,selectedSession:r,initialCommand:n,isPlainShell:a,minimal:o,autoConnect:l,forceNewSession:c,startupInput:d,hermesLaunchId:u,permissionOverride:p,provider:f,isRestarting:x,onProcessComplete:s,onOutputRef:S}),V=m.useCallback(()=>{const ve=E.current;if(!ve)return;const je=ve.buffer.active,M=je.baseY+je.cursorY,ae=Math.min(je.baseY+je.length-1,M+10),ue=Math.max(0,M-j_),Y=[];for(let le=ue;le<=ae;le++){const Ee=je.getLine(le);Ee&&Y.push(Ee.translateToString().trimEnd())}let U=-1;for(let le=Y.length-1;le>=0;le--)if(/esc to cancel/i.test(Y[le])||/enter to select/i.test(Y[le])){U=le;break}if(U===-1){w(null);return}const Q=new Map,J=Math.max(0,U-I_);for(let le=U-1;le>=J;le--){const Ee=Y[le].match(/^\s*[❯›>]?\s*(\d+)\.\s+(.+)/);if(Ee){const fe=Ee[1],ne=Ee[2].trim();parseInt(fe,10)<=R_&&ne.length>0&&!Q.has(fe)&&Q.set(fe,ne)}}const re=[];for(let le=1;le<=Q.size&&Q.has(String(le));le++)re.push({number:String(le),label:Q.get(String(le))});w(re.length>=__?re:null)},[E]),K=m.useCallback(()=>{k.current&&clearTimeout(k.current),k.current=setTimeout(V,A_)},[V]);m.useEffect(()=>{S.current=K},[K]),m.useEffect(()=>()=>{k.current&&clearTimeout(k.current)},[]),m.useEffect(()=>{A||(k.current&&(clearTimeout(k.current),k.current=null),w(null))},[A]),m.useEffect(()=>{if(!h||!T||!A)return;const ve=()=>{E.current?.focus()},je=window.requestAnimationFrame(ve),M=window.setTimeout(ve,0);return()=>{window.cancelAnimationFrame(je),window.clearTimeout(M)}},[h,A,T,E]);const L=m.useCallback(ve=>{ls(I.current,{type:"input",data:ve})},[I]),G=m.useMemo(()=>Z_(r),[r]),H=m.useMemo(()=>f||(r?.__provider?r.__provider:window.localStorage.getItem("selected-provider")||"claude"),[f,r?.__provider]),z=dn[H]??"Claude Code",te=m.useMemo(()=>G?G.slice(0,30):null,[G]),se=m.useMemo(()=>G?G.slice(0,50):null,[G]),me=m.useCallback(()=>{y(!0),window.setTimeout(()=>{y(!1)},E_)},[]),de=m.useCallback(()=>{D(),g?.()},[D,g]);if(!t)return i.jsx(a7,{title:b("shell.selectProject.title"),description:b("shell.selectProject.description")});if(o)return i.jsxs(i.Fragment,{children:[i.jsx(s7,{terminalContainerRef:N,authUrl:j,authUrlVersion:R,initialCommand:n,isConnected:A,openAuthUrlInBrowser:B,copyAuthUrlToClipboard:F}),i.jsx(pk,{wsRef:I,terminalRef:E,isConnected:A,bottomOffset:"bottom-0"})]});const ce=a?b("shell.runCommand",{command:n||b("shell.defaultCommand"),projectName:t.displayName}):r?b("shell.resumeSession",{displayName:se}):b("shell.startProviderSession",{provider:z,defaultValue:"Start a new {{provider}} session"}),ye=a?b("shell.runCommand",{command:n||b("shell.defaultCommand"),projectName:t.displayName}):b("shell.startProviderCli",{provider:z,projectName:t.displayName,defaultValue:"Starting {{provider}} in {{projectName}}"}),he=T?_?"connecting":A?null:"connect":"loading",ke=he==="connecting"?ye:ce;return i.jsxs("div",{className:"flex h-full w-full flex-col bg-gray-900",children:[i.jsx(i7,{isConnected:A,isInitialized:T,isRestarting:x,hasSession:!!r,sessionDisplayNameShort:te,onDisconnect:de,onRestart:me,statusNewSessionText:b("shell.status.newSession"),statusInitializingText:b("shell.status.initializing"),statusRestartingText:b("shell.status.restarting"),disconnectLabel:b("shell.actions.disconnect"),disconnectTitle:b("shell.actions.disconnectTitle"),restartLabel:b("shell.actions.restart"),restartTitle:b("shell.actions.restartTitle"),disableRestart:x||A}),i.jsxs("div",{className:"relative flex-1 overflow-hidden p-2",children:[i.jsx("div",{ref:N,className:"h-full w-full focus:outline-none",style:{outline:"none"}}),he&&i.jsx(n7,{mode:he,description:ke,loadingLabel:b("shell.loading"),connectLabel:b("shell.actions.connect"),connectTitle:b("shell.actions.connectTitle"),connectingLabel:b("shell.connecting"),onConnect:C}),v&&A&&i.jsx("div",{className:"absolute inset-x-0 bottom-0 z-10 border-t border-gray-700/80 bg-gray-800/95 px-3 py-2 backdrop-blur-sm",onMouseDown:ve=>ve.preventDefault(),children:i.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[v.map(ve=>i.jsxs("button",{type:"button",onClick:()=>{L(`${ve.number}\r`),w(null)},className:"max-w-36 truncate rounded bg-blue-600 px-3 py-1.5 text-xs font-medium text-white transition-colors hover:bg-blue-700",title:`${ve.number}. ${ve.label}`,children:[ve.number,". ",ve.label]},ve.number)),i.jsx("button",{type:"button",onClick:()=>{L("\x1B"),w(null)},className:"rounded bg-gray-700 px-3 py-1.5 text-xs font-medium text-gray-200 transition-colors hover:bg-gray-600",children:"Esc"})]})})]}),i.jsx(pk,{wsRef:I,terminalRef:E,isConnected:A})]})}function eO({className:e}){return i.jsx("div",{className:`flex h-full items-center justify-center ${e}`,children:i.jsxs("div",{className:"text-center text-gray-500 dark:text-gray-400",children:[i.jsx("div",{className:"mx-auto mb-4 flex h-16 w-16 items-center justify-center rounded-full bg-gray-100 dark:bg-gray-800",children:i.jsx("svg",{className:"h-8 w-8 text-gray-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M8 9l3 3-3 3m5 0h3M5 20h14a2 2 0 002-2V6a2 2 0 00-2-2H5a2 2 0 002 2z"})})}),i.jsx("h3",{className:"mb-2 text-lg font-semibold",children:"No Project Selected"}),i.jsx("p",{children:"A project is required to open a shell"})]})})}function tO({title:e,isCompleted:t,onClose:r=null}){return i.jsx("div",{className:"flex-shrink-0 border-b border-gray-700 bg-gray-800 px-4 py-2",children:i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsxs("div",{className:"flex items-center space-x-2",children:[i.jsx("h3",{className:"text-sm font-medium text-gray-200",children:e}),t&&i.jsx("span",{className:"text-xs text-green-400",children:"(Completed)"})]}),r&&i.jsx("button",{onClick:r,className:"text-gray-400 hover:text-white",title:"Close",children:i.jsx("svg",{className:"h-4 w-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]})})}function Ao({project:e=null,session:t=null,command:r=null,isPlainShell:n=null,isActive:a=!0,autoConnect:s=!0,onComplete:o=null,onClose:l=null,title:c=null,className:d="",showHeader:u=!0,compact:p=!1,minimal:f=!1,forceNewSession:h=!1,startupInput:g=null,hermesLaunchId:b=null,permissionOverride:x=null,provider:y=null,tabId:v=null}){const[w,k]=m.useState(!1),S=m.useMemo(()=>v||`tab_${crypto.randomUUID()}`,[v]),N=n!==null?n:r!==null,E=m.useCallback(I=>{k(!0),o?.(I)},[o]);return e?i.jsxs("div",{className:`flex h-full w-full flex-col ${d}`,children:[!f&&u&&c&&i.jsx(tO,{title:c,isCompleted:w,onClose:l}),i.jsx("div",{className:"min-h-0 w-full flex-1",children:i.jsx(QD,{tabId:S,selectedProject:e,selectedSession:t,initialCommand:r,isPlainShell:N,isActive:a,onProcessComplete:E,minimal:f,autoConnect:f?!0:s,forceNewSession:h,startupInput:g,hermesLaunchId:b,permissionOverride:x,provider:y,onClose:l})})]}):i.jsx(eO,{className:d})}const rO=(e,t)=>t||(e==="claude"?"claude --dangerously-skip-permissions /login":e==="cursor"?"cursor-agent login":e==="codex"?"codex login":e==="qwen"?"qwen auth":e==="opencode"?"opencode auth login":"gemini"),nO={claude:{keyLabel:"Anthropic API Key",keyExample:"sk-ant-...",supportsBaseUrl:!0,baseUrlExample:"https://api.anthropic.com",keyConsoleUrl:"https://console.anthropic.com/settings/keys",keyConsoleLabel:"Anthropic Console"},codex:{keyLabel:"OpenAI API Key",keyExample:"sk-...",supportsBaseUrl:!0,baseUrlExample:"https://api.openai.com/v1",keyConsoleUrl:"https://platform.openai.com/api-keys",keyConsoleLabel:"OpenAI Platform"},gemini:{keyLabel:"Gemini API Key",keyExample:"AI...",supportsBaseUrl:!1,keyConsoleUrl:"https://aistudio.google.com/app/apikey",keyConsoleLabel:"Google AI Studio"},qwen:{keyLabel:"OpenAI-Compatible API Key",keyExample:"sk-... or sk-sp-...",supportsBaseUrl:!0,baseUrlExample:"https://dashscope-intl.aliyuncs.com/compatible-mode/v1",keyConsoleUrl:"https://github.com/QwenLM/qwen-code",keyConsoleLabel:"Qwen Code Docs",notes:"Accepts any OpenAI-compatible endpoint — Alibaba Cloud, ModelScope, OpenRouter, self-hosted, etc."},opencode:{keyLabel:"Anthropic API Key (default backend)",keyExample:"sk-ant-...",supportsBaseUrl:!0,baseUrlExample:"https://api.anthropic.com",keyConsoleUrl:"https://console.anthropic.com/settings/keys",keyConsoleLabel:"Anthropic Console",notes:"OpenCode is multi-provider — this sets the Anthropic credentials. Switch providers via `opencode auth login` or opencode.json."}};function mk({active:e,children:t,onClick:r}){return i.jsx("button",{onClick:r,className:`flex-1 border-b-2 px-4 py-2.5 text-sm font-medium transition-colors ${e?"border-primary text-foreground":"border-transparent text-muted-foreground hover:text-foreground"}`,children:t})}function aO({provider:e}){const[t,r]=m.useState(""),[n,a]=m.useState(!1),[s,o]=m.useState("idle"),[l,c]=m.useState(null),d=async()=>{const u=t.trim();if(u){a(!0),c(null),o("idle");try{const p=await Ce(`/api/providers/${e}/oauth-paste`,{method:"POST",body:JSON.stringify({callbackUrl:u})}),f=await p.json().catch(()=>({}));if(!p.ok||!f?.success)throw new Error(f?.error||`Request failed (${p.status})`);o("ok"),r("")}catch(p){c(p?.message||"Forward failed"),o("error")}finally{a(!1)}}};return i.jsxs("div",{className:"mt-3 rounded-lg border border-border/60 bg-muted/30 p-3 text-sm",children:[i.jsx("div",{className:"mb-2 font-medium text-foreground",children:"Remote login? Paste the callback URL here"}),i.jsxs("p",{className:"mb-3 text-xs text-muted-foreground",children:["When the CLI shows ",i.jsx("code",{className:"rounded bg-background px-1 font-mono text-[11px]",children:"http://127.0.0.1:PORT/…"})," and your browser can't reach it (VPS setups), copy the failing URL from your address bar and paste it below. Pixcode forwards the token exchange to the CLI process on this host."]}),i.jsxs("div",{className:"flex gap-2",children:[i.jsx("input",{type:"url",value:t,onChange:u=>r(u.target.value),placeholder:"http://127.0.0.1:49312/callback?code=...",className:"flex-1 rounded-md border border-border bg-background px-3 py-2 font-mono text-xs text-foreground focus:border-primary focus:outline-none",onKeyDown:u=>{u.key==="Enter"&&d()}}),i.jsx("button",{onClick:()=>void d(),disabled:n||!t.trim(),className:"flex items-center gap-1.5 rounded-md bg-foreground px-3 py-2 text-xs font-medium text-background transition-opacity hover:opacity-90 disabled:opacity-40",children:n?i.jsx(_t,{className:"h-3.5 w-3.5 animate-spin"}):"Forward"})]}),s==="ok"&&i.jsxs("div",{className:"mt-2 flex items-center gap-1.5 text-xs text-emerald-600 dark:text-emerald-400",children:[i.jsx(Gt,{className:"h-3.5 w-3.5"})," Forwarded — check the terminal above for the completion message."]}),s==="error"&&l&&i.jsx("div",{className:"mt-2 text-xs text-red-600 dark:text-red-400",children:l})]})}function iO({provider:e,onSaved:t}){const r=nO[e],[n,a]=m.useState(""),[s,o]=m.useState(""),[l,c]=m.useState(!1),[d,u]=m.useState("idle"),[p,f]=m.useState(null);m.useEffect(()=>{let g=!1;return(async()=>{try{const x=await(await Ce("/api/providers/credentials")).json().catch(()=>({}));if(g||!x?.success)return;const y=x.data?.[e];y?.baseUrl&&o(y.baseUrl)}catch{}})(),()=>{g=!0}},[e]);const h=async()=>{const g=n.trim();if(g){c(!0),f(null),u("idle");try{const b=await Ce(`/api/providers/${e}/auth/api-key`,{method:"POST",body:JSON.stringify({apiKey:g,baseUrl:r.supportsBaseUrl&&s.trim()?s.trim():""})}),x=await b.json().catch(()=>({}));if(!b.ok||!x?.success)throw new Error(x?.error||`Request failed (${b.status})`);u("ok"),a(""),t()}catch(b){f(b?.message||"Save failed"),u("error")}finally{c(!1)}}};return r?i.jsx("div",{className:"flex h-full flex-col overflow-y-auto p-6",children:i.jsxs("div",{className:"mx-auto w-full max-w-lg space-y-5",children:[i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsx("div",{className:"flex h-10 w-10 items-center justify-center rounded-full bg-muted",children:i.jsx(zD,{className:"h-5 w-5 text-foreground"})}),i.jsxs("div",{children:[i.jsx("h4",{className:"text-base font-semibold text-foreground",children:r.keyLabel}),i.jsxs("a",{href:r.keyConsoleUrl,target:"_blank",rel:"noreferrer",className:"inline-flex items-center gap-1 text-xs text-muted-foreground hover:text-foreground",children:["Get a key from ",r.keyConsoleLabel,i.jsx(mn,{className:"h-3 w-3"})]})]})]}),r.notes&&i.jsx("div",{className:"rounded-md border border-border/60 bg-muted/40 p-3 text-xs text-muted-foreground",children:r.notes}),i.jsxs("div",{className:"space-y-1.5",children:[i.jsx("label",{className:"text-xs font-medium text-foreground",children:"API Key"}),i.jsx("input",{type:"password",value:n,onChange:g=>a(g.target.value),placeholder:r.keyExample,className:"w-full rounded-md border border-border bg-background px-3 py-2 font-mono text-sm text-foreground focus:border-primary focus:outline-none",autoComplete:"off",spellCheck:!1}),i.jsxs("p",{className:"text-[11px] text-muted-foreground",children:["Stored locally at ",i.jsx("code",{className:"rounded bg-muted px-1 font-mono text-[10px]",children:"~/.pixcode/provider-credentials.json"})," with 0600 permissions."]})]}),r.supportsBaseUrl&&i.jsxs("div",{className:"space-y-1.5",children:[i.jsxs("label",{className:"text-xs font-medium text-foreground",children:["Base URL ",i.jsx("span",{className:"font-normal text-muted-foreground",children:"(optional — use a custom endpoint)"})]}),i.jsx("input",{type:"url",value:s,onChange:g=>o(g.target.value),placeholder:r.baseUrlExample,className:"w-full rounded-md border border-border bg-background px-3 py-2 font-mono text-sm text-foreground focus:border-primary focus:outline-none",autoComplete:"off",spellCheck:!1}),i.jsx("p",{className:"text-[11px] text-muted-foreground",children:"Point at any OpenAI-compatible proxy (OpenRouter, local LLM, self-hosted, budget provider) to cut costs or hit different models."})]}),i.jsxs("div",{className:"flex items-center gap-3 pt-2",children:[i.jsxs("button",{onClick:()=>void h(),disabled:l||!n.trim(),className:"inline-flex items-center gap-2 rounded-md bg-foreground px-4 py-2 text-sm font-medium text-background transition-opacity hover:opacity-90 disabled:opacity-40",children:[l?i.jsx(_t,{className:"h-4 w-4 animate-spin"}):i.jsx(Gt,{className:"h-4 w-4"}),"Save API Key"]}),d==="ok"&&i.jsx("span",{className:"text-xs text-emerald-600 dark:text-emerald-400",children:"Saved — reconnect to pick it up."}),d==="error"&&p&&i.jsx("span",{className:"text-xs text-red-600 dark:text-red-400",children:p})]})]})}):i.jsx("div",{className:"p-6 text-sm text-muted-foreground",children:"This provider uses OAuth only — use the Browser tab to log in."})}function q4({isOpen:e,onClose:t,provider:r="claude",onComplete:n,customCommand:a,isAuthenticated:s=!1}){const{t:o}=He("common"),l=r!=="cursor",[c,d]=m.useState(l?"apiKey":"browser");m.useEffect(()=>{e&&d(l?"apiKey":"browser")},[e,r,l]);const u=m.useMemo(()=>`${dn[r]??r} Login`,[r]);if(!e)return null;const p=rO(r,a),f=h=>n?.(h);return i.jsx("div",{className:"fixed inset-0 z-[9999] flex items-center justify-center bg-black bg-opacity-50 max-md:items-stretch max-md:justify-stretch",children:i.jsxs("div",{className:"flex h-3/4 w-full max-w-4xl flex-col rounded-lg bg-white shadow-xl dark:bg-gray-800 max-md:m-0 max-md:h-full max-md:max-w-none max-md:rounded-none md:m-4 md:h-3/4 md:max-w-4xl md:rounded-lg",children:[i.jsxs("div",{className:"flex items-center justify-between border-b border-gray-200 p-4 dark:border-gray-700",children:[i.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white",children:u}),i.jsx("button",{onClick:t,className:"text-gray-400 transition-colors hover:text-gray-600 dark:hover:text-gray-300","aria-label":"Close login modal",children:i.jsx(Ct,{className:"h-6 w-6"})})]}),i.jsxs("div",{className:"flex border-b border-gray-200 dark:border-gray-700",children:[i.jsx(mk,{active:c==="browser",onClick:()=>d("browser"),children:"Browser / OAuth"}),l&&i.jsx(mk,{active:c==="apiKey",onClick:()=>d("apiKey"),children:"API Key"})]}),i.jsx("div",{className:"flex flex-1 flex-col overflow-hidden",children:c==="browser"?i.jsxs("div",{className:"flex flex-1 flex-col overflow-hidden",children:[i.jsx("div",{className:"min-h-0 flex-1",children:i.jsx(Ao,{project:m_,command:p,onComplete:f,minimal:!0})}),i.jsx("div",{className:"border-t border-border/40 bg-background/50 px-4 py-3",children:i.jsx(aO,{provider:r})})]}):i.jsx(iO,{provider:r,onSaved:()=>f(0)})})]})})}const sO=({className:e="w-5 h-5"})=>i.jsx("img",{src:"/icons/claude-ai-icon.svg",alt:"Claude",className:e}),oO=({className:e="w-5 h-5"})=>{const{isDarkMode:t}=ri();return i.jsx("img",{src:t?"/icons/codex-white.svg":"/icons/codex.svg",alt:"Codex",className:e})},lO=({className:e="w-5 h-5"})=>{const{isDarkMode:t}=ri();return i.jsx("img",{src:t?"/icons/cursor-white.svg":"/icons/cursor.svg",alt:"Cursor",className:e})},cO=({className:e="w-5 h-5"})=>i.jsx("img",{src:"/icons/gemini-ai-icon.svg",alt:"Gemini",className:e}),dO=({className:e="w-5 h-5"})=>{const{isDarkMode:t}=ri(),r=t?"/icons/opencode-logo-dark.svg":"/icons/opencode-logo-light.svg";return i.jsx("img",{src:r,alt:"OpenCode",className:e})},uO=({className:e="w-5 h-5"})=>i.jsx("img",{src:"/icons/qwen-logo.svg",alt:"Qwen Code",className:e});function er({provider:e="claude",className:t="w-5 h-5"}){return e==="cursor"?i.jsx(lO,{className:t}):e==="codex"?i.jsx(oO,{className:t}):e==="gemini"?i.jsx(cO,{className:t}):e==="qwen"?i.jsx(uO,{className:t}):e==="opencode"?i.jsx(dO,{className:t}):e==="hermes"?i.jsx(pr,{className:t}):i.jsx(sO,{className:t})}function pO({provider:e,title:t,status:r,connectedClassName:n,iconContainerClassName:a,loginButtonClassName:s,onLogin:o}){const l=r.authenticated?n:"border-border bg-card",c=r.loading?"Checking...":r.authenticated?r.email||"Connected":r.error||"Not connected";return i.jsx("div",{className:`rounded-lg border p-4 transition-colors ${l}`,children:i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsx("div",{className:`flex h-10 w-10 items-center justify-center rounded-full ${a}`,children:i.jsx(er,{provider:e,className:"h-5 w-5"})}),i.jsxs("div",{children:[i.jsxs("div",{className:"flex items-center gap-2 font-medium text-foreground",children:[t,r.authenticated&&i.jsx(Gt,{className:"h-4 w-4 text-green-500"})]}),i.jsx("div",{className:"text-xs text-muted-foreground",children:c})]})]}),!r.authenticated&&!r.loading&&i.jsx("button",{onClick:o,className:`${s} rounded-lg px-4 py-2 text-sm font-medium text-white transition-colors`,children:"Login"})]})})}const mO=[{provider:"claude",title:"Claude Code",connectedClassName:"bg-blue-50 dark:bg-blue-900/20 border-blue-200 dark:border-blue-800",iconContainerClassName:"bg-blue-100 dark:bg-blue-900/30",loginButtonClassName:"bg-blue-600 hover:bg-blue-700"},{provider:"cursor",title:"Cursor",connectedClassName:"bg-purple-50 dark:bg-purple-900/20 border-purple-200 dark:border-purple-800",iconContainerClassName:"bg-purple-100 dark:bg-purple-900/30",loginButtonClassName:"bg-purple-600 hover:bg-purple-700"},{provider:"codex",title:"OpenAI Codex",connectedClassName:"bg-gray-100 dark:bg-gray-800/50 border-gray-300 dark:border-gray-600",iconContainerClassName:"bg-gray-100 dark:bg-gray-800",loginButtonClassName:"bg-gray-800 hover:bg-gray-900 dark:bg-gray-700 dark:hover:bg-gray-600"},{provider:"gemini",title:"Gemini",connectedClassName:"bg-teal-50 dark:bg-teal-900/20 border-teal-200 dark:border-teal-800",iconContainerClassName:"bg-teal-100 dark:bg-teal-900/30",loginButtonClassName:"bg-teal-600 hover:bg-teal-700"},{provider:"qwen",title:"Qwen Code",connectedClassName:"bg-orange-50 dark:bg-orange-900/20 border-orange-200 dark:border-orange-800",iconContainerClassName:"bg-orange-100 dark:bg-orange-900/30",loginButtonClassName:"bg-orange-600 hover:bg-orange-700"}];function hk({providerStatuses:e,onOpenProviderLogin:t}){return i.jsxs("div",{className:"space-y-6",children:[i.jsxs("div",{className:"mb-6 text-center",children:[i.jsx("h2",{className:"mb-2 text-2xl font-bold text-foreground",children:"Connect Your AI Agents"}),i.jsx("p",{className:"text-muted-foreground",children:"Login to one or more AI coding assistants. All are optional."})]}),i.jsx("div",{className:"space-y-3",children:mO.map(r=>i.jsx(pO,{provider:r.provider,title:r.title,status:e[r.provider],connectedClassName:r.connectedClassName,iconContainerClassName:r.iconContainerClassName,loginButtonClassName:r.loginButtonClassName,onLogin:()=>t(r.provider)},r.provider))}),i.jsx("div",{className:"pt-2 text-center text-sm text-muted-foreground",children:i.jsx("p",{children:"You can configure these later in Settings."})})]})}function hO({gitName:e,gitEmail:t,isSubmitting:r,onGitNameChange:n,onGitEmailChange:a}){return i.jsxs("div",{className:"space-y-6",children:[i.jsxs("div",{className:"mb-8 text-center",children:[i.jsx("div",{className:"mx-auto mb-4 flex h-16 w-16 items-center justify-center rounded-full bg-blue-100 dark:bg-blue-900/30",children:i.jsx(Kr,{className:"h-8 w-8 text-blue-600 dark:text-blue-400"})}),i.jsx("h2",{className:"mb-2 text-2xl font-bold text-foreground",children:"Git Configuration"}),i.jsx("p",{className:"text-muted-foreground",children:"Configure your git identity to ensure proper attribution for commits."})]}),i.jsxs("div",{className:"space-y-4",children:[i.jsxs("div",{children:[i.jsxs("label",{htmlFor:"gitName",className:"mb-2 flex items-center gap-2 text-sm font-medium text-foreground",children:[i.jsx(FD,{className:"h-4 w-4"}),"Git Name ",i.jsx("span",{className:"text-red-500",children:"*"})]}),i.jsx("input",{type:"text",id:"gitName",value:e,onChange:s=>n(s.target.value),className:"w-full rounded-lg border border-border bg-background px-4 py-3 text-foreground focus:border-transparent focus:outline-none focus:ring-2 focus:ring-blue-500",placeholder:"John Doe",required:!0,disabled:r}),i.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:"Saved as `git config --global user.name`."})]}),i.jsxs("div",{children:[i.jsxs("label",{htmlFor:"gitEmail",className:"mb-2 flex items-center gap-2 text-sm font-medium text-foreground",children:[i.jsx(OD,{className:"h-4 w-4"}),"Git Email ",i.jsx("span",{className:"text-red-500",children:"*"})]}),i.jsx("input",{type:"email",id:"gitEmail",value:t,onChange:s=>a(s.target.value),className:"w-full rounded-lg border border-border bg-background px-4 py-3 text-foreground focus:border-transparent focus:outline-none focus:ring-2 focus:ring-blue-500",placeholder:"john@example.com",required:!0,disabled:r}),i.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:"Saved as `git config --global user.email`."})]})]})]})}const fk=[{title:"Git Configuration",icon:Kr,required:!0},{title:"Connect Agents",icon:O4,required:!1}];function fO({currentStep:e}){return i.jsx("div",{className:"mb-8",children:i.jsx("div",{className:"flex items-center justify-between",children:fk.map((t,r)=>{const n=r<e,a=r===e,s=t.icon;return i.jsxs("div",{className:"contents",children:[i.jsxs("div",{className:"flex flex-1 flex-col items-center",children:[i.jsx("div",{className:`flex h-12 w-12 items-center justify-center rounded-full border-2 transition-colors duration-200 ${n?"border-green-500 bg-green-500 text-white":a?"border-blue-600 bg-blue-600 text-white":"border-border bg-background text-muted-foreground"}`,children:n?i.jsx(Gt,{className:"h-6 w-6"}):i.jsx(s,{className:"h-6 w-6"})}),i.jsxs("div",{className:"mt-2 text-center",children:[i.jsx("p",{className:`text-sm font-medium ${a?"text-foreground":"text-muted-foreground"}`,children:t.title}),t.required&&i.jsx("span",{className:"text-xs text-red-500",children:"Required"})]})]}),r<fk.length-1&&i.jsx("div",{className:`mx-2 h-0.5 flex-1 transition-colors duration-200 ${n?"bg-green-500":"bg-border"}`})]},t.title)})})})}const gk=/^[^\s@]+@[^\s@]+\.[^\s@]+$/,bk=async(e,t)=>{try{return(await e.json()).error||t}catch{return t}};function gO({onComplete:e}){const[t,r]=m.useState(0),[n,a]=m.useState(""),[s,o]=m.useState(""),[l,c]=m.useState(!1),[d,u]=m.useState(""),[p,f]=m.useState(null),{providerAuthStatus:h,checkProviderAuthStatus:g,refreshProviderAuthStatuses:b}=qu(),x=m.useRef(void 0),y=m.useCallback(async()=>{try{const I=await Ce("/api/user/git-config");if(!I.ok)return;const A=await I.json();A.gitName&&a(A.gitName),A.gitEmail&&o(A.gitEmail)}catch(I){console.error("Error loading git config:",I)}},[]);m.useEffect(()=>{y(),b()},[y,b]),m.useEffect(()=>{const I=x.current;x.current=p,I!=null&&p===null&&b()},[p,b]);const v=I=>{f(I)},w=I=>{I===0&&p&&g(p)},k=async()=>{if(u(""),t!==0){r(I=>I+1);return}if(!n.trim()||!s.trim()){u("Both git name and email are required.");return}if(!gk.test(s)){u("Please enter a valid email address.");return}c(!0);try{const I=await Ce("/api/user/git-config",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({gitName:n,gitEmail:s})});if(!I.ok){const A=await bk(I,"Failed to save git configuration");throw new Error(A)}r(A=>A+1)}catch(I){u(I instanceof Error?I.message:"Failed to save git configuration")}finally{c(!1)}},S=()=>{u(""),r(I=>I-1)},N=async()=>{c(!0),u("");try{const I=await Ce("/api/user/complete-onboarding",{method:"POST"});if(!I.ok){const A=await bk(I,"Failed to complete onboarding");throw new Error(A)}await e?.()}catch(I){u(I instanceof Error?I.message:"Failed to complete onboarding")}finally{c(!1)}},E=t===0?!!(n.trim()&&s.trim()&&gk.test(s)):!0;return i.jsxs(i.Fragment,{children:[i.jsx("div",{className:"flex min-h-screen items-center justify-center bg-background p-4",children:i.jsxs("div",{className:"w-full max-w-2xl",children:[i.jsx(fO,{currentStep:t}),i.jsxs("div",{className:"rounded-lg border border-border bg-card p-8 shadow-lg",children:[t===0?i.jsx(hO,{gitName:n,gitEmail:s,isSubmitting:l,onGitNameChange:a,onGitEmailChange:o}):t===1?i.jsx(hk,{providerStatuses:h,onOpenProviderLogin:v}):i.jsx(hk,{providerStatuses:h,onOpenProviderLogin:v}),d&&i.jsx("div",{className:"mt-6 rounded-lg border border-red-300 bg-red-100 p-4 dark:border-red-800 dark:bg-red-900/20",children:i.jsx("p",{className:"text-sm text-red-700 dark:text-red-400",children:d})}),i.jsxs("div",{className:"mt-8 flex items-center justify-between border-t border-border pt-6",children:[i.jsxs("button",{onClick:S,disabled:t===0||l,className:"flex items-center gap-2 px-4 py-2 text-sm font-medium text-muted-foreground transition-colors duration-200 hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50",children:[i.jsx(Go,{className:"h-4 w-4"}),"Previous"]}),i.jsx("div",{className:"flex items-center gap-3",children:t<1?i.jsx("button",{onClick:k,disabled:!E||l,className:"flex items-center gap-2 rounded-lg bg-blue-600 px-6 py-3 font-medium text-white transition-colors duration-200 hover:bg-blue-700 disabled:cursor-not-allowed disabled:bg-blue-400",children:l?i.jsxs(i.Fragment,{children:[i.jsx(_t,{className:"h-4 w-4 animate-spin"}),"Saving..."]}):i.jsxs(i.Fragment,{children:["Next",i.jsx(Fn,{className:"h-4 w-4"})]})}):i.jsx("button",{onClick:N,disabled:l,className:"flex items-center gap-2 rounded-lg bg-green-600 px-6 py-3 font-medium text-white transition-colors duration-200 hover:bg-green-700 disabled:cursor-not-allowed disabled:bg-green-400",children:l?i.jsxs(i.Fragment,{children:[i.jsx(_t,{className:"h-4 w-4 animate-spin"}),"Completing..."]}):i.jsxs(i.Fragment,{children:[i.jsx(Gt,{className:"h-4 w-4"}),"Complete Setup"]})})})]})]})]})}),p&&i.jsx(q4,{isOpen:!!p,onClose:()=>f(null),provider:p,onComplete:w})]})}const bO=["0s","0.1s","0.2s"];function xO(){return i.jsx("div",{className:"flex min-h-screen items-center justify-center bg-background p-4",children:i.jsxs("div",{className:"text-center",children:[i.jsx("div",{className:"mb-4 flex justify-center",children:i.jsx("div",{className:"flex h-16 w-16 items-center justify-center rounded-lg bg-primary shadow-sm",children:i.jsx(Un,{className:"h-8 w-8 text-primary-foreground"})})}),i.jsx("h1",{className:"mb-2 text-2xl font-bold text-foreground",children:"Pixcode"}),i.jsx("div",{className:"flex items-center justify-center space-x-2",children:bO.map(e=>i.jsx("div",{className:"h-2 w-2 animate-bounce rounded-full bg-blue-500",style:{animationDelay:e}},e))}),i.jsx("p",{className:"mt-2 text-muted-foreground",children:"Loading..."})]})})}function K4({errorMessage:e}){return e?i.jsx("div",{className:"rounded-md border border-red-300 bg-red-100 p-3 dark:border-red-800 dark:bg-red-900/20",children:i.jsx("p",{className:"text-sm text-red-700 dark:text-red-400",children:e})}):null}function as({id:e,label:t,value:r,onChange:n,placeholder:a,isDisabled:s,type:o="text",name:l,autoComplete:c}){return i.jsxs("div",{children:[i.jsx("label",{htmlFor:e,className:"mb-1 block text-sm font-medium text-foreground",children:t}),i.jsx("input",{id:e,type:o,name:l??e,autoComplete:c,value:r,onChange:d=>n(d.target.value),className:"w-full rounded-md border border-border bg-background px-3 py-2 text-foreground focus:border-transparent focus:outline-none focus:ring-2 focus:ring-blue-500",placeholder:a,required:!0,disabled:s})]})}function Y4({title:e,description:t,children:r,footerText:n,logo:a}){return i.jsx("div",{className:"flex min-h-screen items-center justify-center bg-background p-4",children:i.jsx("div",{className:"w-full max-w-md",children:i.jsxs("div",{className:"space-y-6 rounded-lg border border-border bg-card p-8 shadow-lg",children:[i.jsxs("div",{className:"text-center",children:[i.jsx("div",{className:"mb-4 flex justify-center",children:a??i.jsx("div",{className:"flex h-16 w-16 items-center justify-center rounded-lg bg-primary shadow-sm",children:i.jsx(Un,{className:"h-8 w-8 text-primary-foreground"})})}),i.jsx("h1",{className:"text-2xl font-bold text-foreground",children:e}),i.jsx("p",{className:"mt-2 text-muted-foreground",children:t})]}),r,i.jsx("div",{className:"text-center",children:i.jsx("p",{className:"text-sm text-muted-foreground",children:n})}),i.jsxs("div",{className:"flex items-center justify-center gap-1.5 pt-2",children:[i.jsx("svg",{className:"h-3.5 w-3.5 text-muted-foreground/50",fill:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:i.jsx("path",{d:"M12 2C6.477 2 2 6.484 2 12.017c0 4.425 2.865 8.18 6.839 9.504.5.092.682-.217.682-.483 0-.237-.008-.868-.013-1.703-2.782.605-3.369-1.343-3.369-1.343-.454-1.158-1.11-1.466-1.11-1.466-.908-.62.069-.608.069-.608 1.003.07 1.531 1.032 1.531 1.032.892 1.53 2.341 1.088 2.91.832.092-.647.35-1.088.636-1.338-2.22-.253-4.555-1.113-4.555-4.951 0-1.093.39-1.988 1.029-2.688-.103-.253-.446-1.272.098-2.65 0 0 .84-.27 2.75 1.026A9.564 9.564 0 0112 6.844c.85.004 1.705.115 2.504.337 1.909-1.296 2.747-1.027 2.747-1.027.546 1.379.202 2.398.1 2.651.64.7 1.028 1.595 1.028 2.688 0 3.848-2.339 4.695-4.566 4.943.359.309.678.92.678 1.855 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.019 10.019 0 0022 12.017C22 6.484 17.522 2 12 2z"})}),i.jsx("a",{href:"https://github.com/alicomert/pixcode",target:"_blank",rel:"noopener noreferrer",className:"text-xs text-muted-foreground/50 transition-colors hover:text-muted-foreground",children:"Pixcode is open source"})]})]})})})}const yO={username:"",password:""};function vO(){const{t:e}=He("auth"),{login:t}=Sc(),[r,n]=m.useState(yO),[a,s]=m.useState(""),[o,l]=m.useState(!1),c=m.useCallback((u,p)=>{n(f=>({...f,[u]:p}))},[]),d=m.useCallback(async u=>{if(u.preventDefault(),s(""),!r.username.trim()||!r.password){s(e("login.errors.requiredFields"));return}l(!0);const p=await t(r.username.trim(),r.password);p.success||s(p.error),l(!1)},[r.password,r.username,t,e]);return i.jsx(Y4,{title:e("login.title"),description:e("login.description"),footerText:"Enter your credentials to access Pixcode",children:i.jsxs("form",{onSubmit:d,className:"space-y-4",children:[i.jsx(as,{id:"username",label:e("login.username"),value:r.username,onChange:u=>c("username",u),placeholder:e("login.placeholders.username"),isDisabled:o,autoComplete:"username"}),i.jsx(as,{id:"password",label:e("login.password"),value:r.password,onChange:u=>c("password",u),placeholder:e("login.placeholders.password"),isDisabled:o,type:"password",autoComplete:"current-password"}),i.jsx(K4,{errorMessage:a}),i.jsx("button",{type:"submit",disabled:o,className:"w-full rounded-md bg-blue-600 px-4 py-2 font-medium text-white transition-colors duration-200 hover:bg-blue-700 disabled:bg-blue-400",children:e(o?"login.loading":"login.submit")})]})})}const wO={username:"",password:"",confirmPassword:"",connectionMode:"local",remoteUrl:"",remoteApiKey:""};function kO(e){return!e.username.trim()||!e.password||!e.confirmPassword?"Please fill in all fields.":e.username.trim().length<3?"Username must be at least 3 characters long.":e.password.length<6?"Password must be at least 6 characters long.":e.password!==e.confirmPassword?"Passwords do not match.":e.connectionMode==="remote"&&!e.remoteUrl.trim()?"Remote Pixcode server URL is required.":null}function SO(){const{register:e}=Sc(),[t,r]=m.useState(wO),[n,a]=m.useState(""),[s,o]=m.useState(!1),l=m.useCallback((d,u)=>{r(p=>({...p,[d]:u}))},[]),c=m.useCallback(async d=>{d.preventDefault(),a("");const u=kO(t);if(u){a(u);return}o(!0);const p=await fetch("/api/auth/connection-mode",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({mode:t.connectionMode,remoteUrl:t.connectionMode==="remote"?t.remoteUrl.trim():null,apiKey:t.connectionMode==="remote"?t.remoteApiKey.trim():null})});if(!p.ok){const h=await p.json().catch(()=>null);a(h?.error||"Could not save connection mode."),o(!1);return}const f=await e(t.username.trim(),t.password);f.success||a(f.error),o(!1)},[t,e]);return i.jsx(Y4,{title:"Welcome to Pixcode",description:"Create the first admin account to get started",footerText:"The first account becomes admin and can add more users later.",logo:i.jsx("img",{src:"/logo.svg",alt:"Pixcode",className:"h-16 w-16"}),children:i.jsxs("form",{onSubmit:c,className:"space-y-4",children:[i.jsxs("div",{className:"grid gap-2 rounded-lg border border-border/70 bg-muted/30 p-2 sm:grid-cols-2",children:[i.jsxs("button",{type:"button",onClick:()=>l("connectionMode","local"),disabled:s,className:`rounded-md px-3 py-2 text-left text-sm transition-colors ${t.connectionMode==="local"?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:bg-background/60 hover:text-foreground"}`,children:[i.jsx("span",{className:"block font-medium",children:"Use this computer directly"}),i.jsx("span",{className:"block text-xs opacity-80",children:"Run Pixcode and CLIs on this machine."})]}),i.jsxs("button",{type:"button",onClick:()=>l("connectionMode","remote"),disabled:s,className:`rounded-md px-3 py-2 text-left text-sm transition-colors ${t.connectionMode==="remote"?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:bg-background/60 hover:text-foreground"}`,children:[i.jsx("span",{className:"block font-medium",children:"Connect to a remote Pixcode server"}),i.jsx("span",{className:"block text-xs opacity-80",children:"Control another always-on Pixcode host by API."})]})]}),t.connectionMode==="remote"&&i.jsxs("div",{className:"space-y-3 rounded-lg border border-border/70 bg-muted/20 p-3",children:[i.jsx(as,{id:"remoteUrl",name:"remoteUrl",label:"Remote API URL",value:t.remoteUrl,onChange:d=>l("remoteUrl",d),placeholder:"https://your-server.example.com",isDisabled:s,autoComplete:"url"}),i.jsx(as,{id:"remoteApiKey",name:"remoteApiKey",label:"Remote API Key",value:t.remoteApiKey,onChange:d=>l("remoteApiKey",d),placeholder:"px_...",isDisabled:s,type:"password",autoComplete:"off"})]}),i.jsx(as,{id:"username",name:"username",label:"Username",value:t.username,onChange:d=>l("username",d),placeholder:"Enter your username",isDisabled:s,autoComplete:"username"}),i.jsx(as,{id:"password",name:"password",label:"Password",value:t.password,onChange:d=>l("password",d),placeholder:"Enter your password",isDisabled:s,type:"password",autoComplete:"new-password"}),i.jsx(as,{id:"confirmPassword",name:"confirmPassword",label:"Confirm Password",value:t.confirmPassword,onChange:d=>l("confirmPassword",d),placeholder:"Confirm your password",isDisabled:s,type:"password",autoComplete:"new-password"}),i.jsx(K4,{errorMessage:n}),i.jsx("button",{type:"submit",disabled:s,className:"w-full rounded-md bg-blue-600 px-4 py-2 font-medium text-white transition-colors duration-200 hover:bg-blue-700 disabled:bg-blue-400",children:s?"Setting up...":"Create Account"})]})})}function CO({children:e}){const{user:t,isLoading:r,needsSetup:n,hasCompletedOnboarding:a,refreshOnboardingStatus:s}=Sc();return r?i.jsx(xO,{}):n?i.jsx(SO,{}):t?a?i.jsx(i.Fragment,{children:e}):i.jsx(gO,{onComplete:s}):i.jsx(vO,{})}const Z4=m.createContext(null),X4=()=>{const e=m.useContext(Z4);if(!e)throw new Error("useWebSocket must be used within a WebSocketProvider");return e},NO=e=>{const t=window.location.protocol==="https:"?"wss:":"ws:";return e?`${t}//${window.location.host}/ws?token=${encodeURIComponent(e)}`:null},EO=()=>{const e=m.useRef(null),t=m.useRef(!1),r=m.useRef(!1),[n,a]=m.useState(null),[s,o]=m.useState(!1),l=m.useRef(null),{token:c}=Sc(),d=m.useCallback(()=>{if(!t.current)try{const f=NO(c);if(!f)return console.warn("No authentication token found for WebSocket connection");const h=new WebSocket(f);h.onopen=()=>{o(!0),e.current=h,r.current&&a({type:"websocket-reconnected",timestamp:Date.now()}),r.current=!0},h.onmessage=g=>{try{const b=JSON.parse(g.data);a(b)}catch(b){console.error("Error parsing WebSocket message:",b)}},h.onclose=()=>{o(!1),e.current=null,l.current=setTimeout(()=>{t.current||d()},3e3)},h.onerror=g=>{console.error("WebSocket error:",g)}}catch(f){console.error("Error creating WebSocket connection:",f)}},[c]);m.useEffect(()=>(d(),()=>{t.current=!0,l.current&&clearTimeout(l.current),e.current&&e.current.close()}),[d]);const u=m.useCallback(f=>{const h=e.current;h&&h.readyState===WebSocket.OPEN?h.send(JSON.stringify(f)):console.warn("WebSocket not connected")},[]);return m.useMemo(()=>({ws:e.current,sendMessage:u,latestMessage:n,isConnected:s}),[u,n,s])},TO=({children:e})=>{const t=EO();return i.jsx(Z4.Provider,{value:t,children:e})},J4=m.createContext(null);function ep(){const e=m.useContext(J4);if(!e)throw new Error("usePlugins must be used within a PluginsProvider");return e}function AO({children:e}){const{user:t,token:r,isLoading:n}=Sc(),[a,s]=m.useState([]),[o,l]=m.useState(!0),[c,d]=m.useState(null),u=!!(t&&r),p=m.useCallback(async()=>{if(!u){s([]),d(null),l(!1);return}l(!0);try{const x=await Ce("/api/plugins");if(x.ok){const y=await x.json();s(y.plugins||[]),d(null)}else{let y=`Failed to fetch plugins (${x.status})`;try{const v=await x.json();y=v.details||v.error||y}catch{y=x.statusText||y}d(y)}}catch(x){const y=x instanceof Error?x.message:"Failed to fetch plugins";d(y),console.error("[Plugins] Failed to fetch plugins:",x)}finally{l(!1)}},[u]);m.useEffect(()=>{n||p()},[n,p]);const f=m.useCallback(async x=>{try{const y=await Ce("/api/plugins/install",{method:"POST",body:JSON.stringify({url:x})}),v=await y.json();return y.ok?(await p(),{success:!0}):{success:!1,error:v.details||v.error||"Install failed"}}catch(y){return{success:!1,error:y instanceof Error?y.message:"Install failed"}}},[p]),h=m.useCallback(async x=>{try{const y=await Ce(`/api/plugins/${encodeURIComponent(x)}`,{method:"DELETE"}),v=await y.json();return y.ok?(await p(),{success:!0}):{success:!1,error:v.details||v.error||"Uninstall failed"}}catch(y){return{success:!1,error:y instanceof Error?y.message:"Uninstall failed"}}},[p]),g=m.useCallback(async x=>{try{const y=await Ce(`/api/plugins/${encodeURIComponent(x)}/update`,{method:"POST"}),v=await y.json();return y.ok?(await p(),{success:!0}):{success:!1,error:v.details||v.error||"Update failed"}}catch(y){return{success:!1,error:y instanceof Error?y.message:"Update failed"}}},[p]),b=m.useCallback(async(x,y)=>{try{const v=await Ce(`/api/plugins/${encodeURIComponent(x)}/enable`,{method:"PUT",body:JSON.stringify({enabled:y})});if(!v.ok){let w=`Toggle failed (${v.status})`;try{const k=await v.json();w=k.details||k.error||w}catch{w=v.statusText||w}return{success:!1,error:w}}return await p(),{success:!0,error:null}}catch(v){return{success:!1,error:v instanceof Error?v.message:"Toggle failed"}}},[p]);return i.jsx(J4.Provider,{value:{plugins:a,loading:o,pluginsError:c,refreshPlugins:p,installPlugin:f,uninstallPlugin:h,updatePlugin:g,togglePlugin:b},children:e})}const xk=e=>typeof window>"u"?!1:window.innerWidth<e,yk=()=>{if(typeof window>"u")return!1;const e=window.navigator;return window.matchMedia("(display-mode: standalone)").matches||!!e.standalone||document.referrer.includes("android-app://")};function Zg(e={}){const{mobileBreakpoint:t=768,trackMobile:r=!0,trackPWA:n=!0}=e,[a,s]=m.useState(()=>r?xk(t):!1),[o,l]=m.useState(()=>n?yk():!1);return m.useEffect(()=>{if(!r||typeof window>"u")return;const c=()=>{s(xk(t))};return c(),window.addEventListener("resize",c),()=>{window.removeEventListener("resize",c)}},[t,r]),m.useEffect(()=>{if(!n||typeof window>"u")return;const c=window.matchMedia("(display-mode: standalone)"),d=()=>{l(yk())};return d(),typeof c.addEventListener=="function"?(c.addEventListener("change",d),()=>{c.removeEventListener("change",d)}):(c.addListener(d),()=>{c.removeListener(d)})},[n]),{isMobile:a,isPWA:o}}const Xg="pixcode.updateCheck.preferences",bf="pixcode:update-check-settings-changed",Jg=[{value:"30m",label:"Every 30 minutes",intervalMs:1800*1e3},{value:"24h",label:"Daily",intervalMs:1440*60*1e3},{value:"12h",label:"Every 12 hours",intervalMs:720*60*1e3},{value:"6h",label:"Every 6 hours",intervalMs:360*60*1e3},{value:"7d",label:"Weekly",intervalMs:10080*60*1e3},{value:"off",label:"Manual only",intervalMs:null}],xf={frequency:"30m"};function vk(e){return Jg.find(t=>t.value===e.frequency)?.intervalMs??null}function Q4(e){if(!e||typeof e!="object")return xf;const t=e.frequency;return Jg.some(r=>r.value===t)?{frequency:t}:xf}function wk(){try{const e=localStorage.getItem(Xg);return Q4(e?JSON.parse(e):null)}catch{return xf}}function jO(e){const t=Q4(e);localStorage.setItem(Xg,JSON.stringify(t)),window.dispatchEvent(new CustomEvent(bf,{detail:t}))}const em=(e,t)=>{const r=e.split(".").map(Number),n=t.split(".").map(Number);for(let a=0;a<Math.max(r.length,n.length);a++){const s=r[a]||0,o=n[a]||0;if(s!==o)return s-o}return 0},IO="1.52.2",lu="pixcode:update-available",RO=360*60*1e3,tm=new Map;function eE(e,t){return`pixcode.updateCheck.cache.${e}.${t}`}function _O(e,t){try{const r=localStorage.getItem(eE(e,t));if(!r)return null;const n=JSON.parse(r);return{fetchedAt:typeof n.fetchedAt=="number"?n.fetchedAt:null,latestVersion:typeof n.latestVersion=="string"?n.latestVersion:null,releaseInfo:n.releaseInfo??null,rateLimitedUntil:typeof n.rateLimitedUntil=="number"?n.rateLimitedUntil:void 0}}catch{return null}}function kk(e,t,r){localStorage.setItem(eE(e,t),JSON.stringify(r))}function PO(e,t){const r=`${e}/${t}`,n=tm.get(r);if(n)return n;const a=fetch(`https://api.github.com/repos/${e}/${t}/releases/latest`,{cache:"no-store",headers:{Accept:"application/vnd.github+json"}}).then(async s=>({status:s.status,ok:s.ok,data:await s.json().catch(()=>({}))})).finally(()=>{tm.delete(r)});return tm.set(r,a),a}const Qg=(e,t)=>{const[r,n]=m.useState(!1),[a,s]=m.useState(null),[o,l]=m.useState(null),[c,d]=m.useState("git"),[u,p]=m.useState("idle"),[f,h]=m.useState(null),[g,b]=m.useState(()=>wk()),[x,y]=m.useState(IO),v=m.useRef(null),w=m.useCallback(S=>{jO(S),b(S)},[]);m.useEffect(()=>{const S=()=>b(wk()),N=E=>{E.key===Xg&&S()};return window.addEventListener("storage",N),window.addEventListener(bf,S),()=>{window.removeEventListener("storage",N),window.removeEventListener(bf,S)}},[]),m.useEffect(()=>{let S=!1;const N=async()=>{try{const A=await(await fetch("/health",{cache:"no-store"})).json();if(S)return;(A.installMode==="npm"||A.installMode==="git")&&d(A.installMode),typeof A.version=="string"&&/^\d+\.\d+\.\d+/.test(A.version)&&y(A.version)}catch{}};N();const E=()=>{N()};return window.addEventListener("focus",E),()=>{S=!0,window.removeEventListener("focus",E)}},[]),m.useEffect(()=>{if(!x)return;let S=!1;const N=(j,R,C,D)=>({updateAvailable:!!(j&&em(j,x)>0),latestVersion:j,releaseInfo:R,currentVersion:x,checkedAt:C,status:D}),E=j=>{!j.updateAvailable||!j.latestVersion||!j.releaseInfo||window.dispatchEvent(new CustomEvent(lu,{detail:j}))},I=(j,R,C,D="success")=>{if(!j||!R)return n(!1),s(null),l(null),h(C),N(null,null,C,D);s(j),n(em(j,x)>0),l(R),h(C);const B=N(j,R,C,D);return E(B),B},A=async({force:j=!1}={})=>{const R=vk(g),C=_O(e,t),D=Date.now();if(!j&&R===null)return p("idle"),I(C?.latestVersion??null,C?.releaseInfo??null,C?.fetchedAt??null,"idle");if(!j&&C?.fetchedAt&&R!==null&&D-C.fetchedAt<R)return p("success"),I(C.latestVersion,C.releaseInfo,C.fetchedAt,"success");if(!j&&C?.rateLimitedUntil&&C.rateLimitedUntil>D)return p("error"),I(C.latestVersion,C.releaseInfo,C.fetchedAt,"error");try{p("checking");const B=await PO(e,t);if(S)return N(C?.latestVersion??null,C?.releaseInfo??null,C?.fetchedAt??null,"idle");const F=B.data;if(!B.ok)return B.status===403&&kk(e,t,{fetchedAt:C?.fetchedAt??null,latestVersion:C?.latestVersion??null,releaseInfo:C?.releaseInfo??null,rateLimitedUntil:D+Math.max(R??0,RO)}),p("error"),I(C?.latestVersion??null,C?.releaseInfo??null,C?.fetchedAt??null,"error");if(F.tag_name){const V=F.tag_name.replace(/^v/,""),K=em(V,x)>0,L={title:F.name||F.tag_name,body:F.body||"",htmlUrl:F.html_url||`https://github.com/${e}/${t}/releases/latest`,publishedAt:F.published_at||""};kk(e,t,{fetchedAt:D,latestVersion:V,releaseInfo:L}),s(V),n(K),K&&m4({key:`app-update:${V}`,title:"Pixcode update available",body:`Pixcode ${x} can update to ${V}.`,tag:"pixcode-app-update",data:{type:"app-update",latestVersion:V,installMode:c}}),l(L),p("success"),h(D);const G=N(V,L,D,"success");return E(G),G}else return n(!1),s(null),l(null),p("error"),N(null,null,null,"error")}catch(B){return console.error("Version check failed:",B),n(!1),s(null),l(null),p("error"),N(null,null,null,"error")}};v.current=A,A();const T=vk(g),_=T===null?null:window.setInterval(()=>{A()},T);return()=>{S=!0,_!==null&&window.clearInterval(_)}},[e,t,x,c,g]);const k=m.useCallback(async()=>v.current?await v.current({force:!0}):null,[]);return{updateAvailable:r,latestVersion:a,currentVersion:x,releaseInfo:o,installMode:c,checkStatus:u,lastCheckedAt:f,manualCheck:k,updateCheckPreferences:g,updatePreferences:w}},is={autoExpandTools:!1,showRawParameters:!1,showThinking:!0,autoScrollToBottom:!0,sendByCtrlEnter:!1,changeAwareness:!1,sidebarVisible:!0,historyView:"flat",autoShowAgentDiff:"openOnly"},LO=["flat","grouped"],DO=e=>typeof e=="string"&&LO.includes(e),OO=["always","openOnly","off"],MO=e=>typeof e=="string"&&OO.includes(e),cu=Object.keys(is),FO=new Set(cu),rm="ui-preferences:sync",zO=(e,t)=>{if(typeof e=="boolean")return e;if(typeof e=="string"){if(e==="true")return!0;if(e==="false")return!1}return t},du=(e,t,r)=>e==="historyView"?DO(t)?t:r:e==="autoShowAgentDiff"?MO(t)?t:r:zO(t,r),BO=(e,t)=>{try{const r=localStorage.getItem(e);if(r===null)return t;const n=JSON.parse(r);return du(e,n,t)}catch{return t}},UO=e=>{if(typeof window>"u")return is;try{const t=localStorage.getItem(e);if(t){const r=JSON.parse(t);if(r&&typeof r=="object"&&!Array.isArray(r)){const n=r;return cu.reduce((a,s)=>(a[s]=du(s,n[s],is[s]),a),{...is})}}}catch{}return cu.reduce((t,r)=>(t[r]=BO(r,is[r]),t),{...is})};function $O(e,t){switch(t.type){case"set":{const{key:r,value:n}=t;if(!FO.has(r))return e;const a=du(r,n,e[r]);return e[r]===a?e:{...e,[r]:a}}case"set_many":{const r=t.value||{};let n=!1;const a={...e};for(const s of cu){if(!(s in r))continue;const o=r[s],l=du(s,o,e[s]);a[s]!==l&&(a[s]=l,n=!0)}return n?a:e}case"reset":return{...is,...t.value||{}};default:return e}}function tp(e="uiPreferences"){const t=m.useRef(`ui-preferences-${Math.random().toString(36).slice(2)}`),[r,n]=m.useReducer($O,e,UO);return m.useEffect(()=>{typeof window>"u"||(localStorage.setItem(e,JSON.stringify(r)),window.dispatchEvent(new CustomEvent(rm,{detail:{storageKey:e,sourceId:t.current,value:r}})))},[r,e]),m.useEffect(()=>{if(typeof window>"u")return;const l=u=>{!u||typeof u!="object"||Array.isArray(u)||n({type:"set_many",value:u})},c=u=>{if(!(u.key!==e||u.newValue===null))try{const p=JSON.parse(u.newValue);l(p)}catch{}},d=u=>{const f=u.detail;!f||f.storageKey!==e||f.sourceId===t.current||l(f.value)};return window.addEventListener("storage",c),window.addEventListener(rm,d),()=>{window.removeEventListener("storage",c),window.removeEventListener(rm,d)}},[e]),{preferences:r,setPreference:(l,c)=>{n({type:"set",key:l,value:c})},setPreferences:l=>{n({type:"set_many",value:l})},resetPreferences:l=>{n({type:"reset",value:l})},dispatch:n}}const HO=()=>{try{const e=localStorage.getItem("claude-settings");return e&&JSON.parse(e).projectSortOrder==="date"?"date":"name"}catch{return"name"}},GO=()=>{try{const e=localStorage.getItem("starredProjects");return e?new Set(JSON.parse(e)):new Set}catch{return new Set}},VO=e=>{try{localStorage.setItem("starredProjects",JSON.stringify([...e]))}catch{}},Sk=(e,t)=>`${e}::${t}`,WO=()=>{try{const e=localStorage.getItem("starredSessions");return e?new Set(JSON.parse(e)):new Set}catch{return new Set}},qO=e=>{try{localStorage.setItem("starredSessions",JSON.stringify([...e]))}catch{}},KO=/(?:^|[\s/\\(\[`"'])([\w./-]+?\.(?:ts|tsx|js|jsx|mjs|cjs|py|rb|go|rs|java|kt|swift|c|cc|cpp|h|hpp|cs|php|sh|bash|zsh|json|ya?ml|toml|md|mdx|html?|css|scss|less|sql|prisma|graphql|gql|vue|svelte|astro|dart|lua|r|pl|ps1|tf|dockerfile|env))(?:$|[\s:,)\]`"'])/i,YO=e=>{if(!e)return[];const t=new Set,r=new RegExp(KO.source,"gi");let n;for(;(n=r.exec(e))!==null;){const a=n[1],s=a.lastIndexOf(".");if(s>-1){const o=a.slice(s+1).toLowerCase();o&&o.length<=10&&t.add(o)}if(t.size>=3)break}return[...t]},ps=e=>e.__provider==="cursor"?new Date(e.createdAt||0):e.__provider==="codex"?new Date(e.createdAt||e.lastActivity||0):new Date(e.lastActivity||e.createdAt||0),ZO=(e,t)=>e.__provider==="cursor"?e.summary||e.name||t("projects.untitledSession"):e.__provider==="codex"?e.summary||e.name||t("projects.codexSession"):e.__provider==="gemini"||e.__provider==="qwen"||e.__provider==="opencode"?e.summary||e.name||t("projects.newSession"):e.summary||t("projects.newSession"),XO=e=>e.__provider==="cursor"?String(e.createdAt||""):e.__provider==="codex"?String(e.createdAt||e.lastActivity||""):String(e.lastActivity||e.createdAt||""),JO=(e,t,r)=>{const n=ps(e),a=Math.floor((t.getTime()-n.getTime())/(1e3*60));return{isCursorSession:e.__provider==="cursor",isCodexSession:e.__provider==="codex",isGeminiSession:e.__provider==="gemini",isQwenSession:e.__provider==="qwen",isOpencodeSession:e.__provider==="opencode",isActive:a<10,sessionName:ZO(e,r),sessionTime:XO(e),messageCount:Number(e.messageCount||0)}},tE=(e,t)=>{const r=[...e.sessions||[],...t[e.name]||[]].map(g=>({...g,__provider:"claude"})),n=(e.cursorSessions||[]).map(g=>({...g,__provider:"cursor"})),a=(e.codexSessions||[]).map(g=>({...g,__provider:"codex"})),s=g=>typeof g.id=="string"&&g.id.startsWith("qwen_")||g.provider==="qwen",o=g=>typeof g.id=="string"&&g.id.startsWith("opencode_")||g.provider==="opencode",l=e.geminiSessions||[],c=l.filter(g=>!s(g)&&!o(g)).map(g=>({...g,__provider:"gemini"})),d=l.filter(g=>s(g)).map(g=>({...g,__provider:"qwen"})),u=l.filter(g=>o(g)).map(g=>({...g,__provider:"opencode"})),p=[...(e.qwenSessions||[]).map(g=>({...g,__provider:"qwen"})),...d],f=[...(e.opencodeSessions||[]).map(g=>({...g,__provider:"opencode"})),...u],h=new Map;for(const g of[...r,...n,...a,...c,...p,...f])h.has(g.id)||h.set(g.id,g);return[...h.values()].sort((g,b)=>ps(b).getTime()-ps(g).getTime())},Ck=(e,t)=>{const r=tE(e,t);return r.length===0?new Date(0):r.reduce((n,a)=>{const s=ps(a);return s>n?s:n},new Date(0))},QO=(e,t,r,n)=>{const a=[...e];return a.sort((s,o)=>{const l=r.has(s.name),c=r.has(o.name);return l&&!c?-1:!l&&c?1:t==="date"?Ck(o,n).getTime()-Ck(s,n).getTime():(s.displayName||s.name).localeCompare(o.displayName||o.name)}),a},eM=(e,t)=>{const r=t.trim().toLowerCase();return r?e.filter(n=>{const a=(n.displayName||n.name).toLowerCase(),s=n.name.toLowerCase();return a.includes(r)||s.includes(r)}):e},tM=e=>{const t=typeof e.fullPath=="string"&&e.fullPath.length>0?e.fullPath:typeof e.path=="string"?e.path:"";return{name:e.name,displayName:typeof e.displayName=="string"&&e.displayName.trim().length>0?e.displayName:e.name,fullPath:t,path:typeof e.path=="string"&&e.path.length>0?e.path:t}};function rM({projects:e,selectedProject:t,selectedSession:r,isLoading:n,isMobile:a,t:s,onRefresh:o,onProjectSelect:l,onSessionSelect:c,onSessionDelete:d,onProjectDelete:u,setSidebarVisible:p,sidebarVisible:f}){const[h,g]=m.useState(new Set),[b,x]=m.useState(null),[y,v]=m.useState(!1),[w,k]=m.useState(""),[S,N]=m.useState({}),[E,I]=m.useState({}),[A,T]=m.useState(new Set),[_,j]=m.useState(new Date),[R,C]=m.useState("name"),[D,B]=m.useState(!1),[F,V]=m.useState({}),[K,L]=m.useState(null),[G,H]=m.useState(""),[z,te]=m.useState(""),[se,me]=m.useState(new Set),[de,ce]=m.useState(null),[ye,he]=m.useState(null),[ke,ve]=m.useState(!1),[je,M]=m.useState(()=>GO()),[ae,ue]=m.useState(()=>WO()),[Y,U]=m.useState("projects"),[Q,J]=m.useState(null),[re,le]=m.useState(!1),[Ee,fe]=m.useState(null),ne=m.useRef(null),Z=m.useRef(0),W=m.useRef(null),pe=!a&&!f;m.useEffect(()=>{const Ue=setInterval(()=>{j(new Date)},6e4);return()=>clearInterval(Ue)},[]),m.useEffect(()=>{I({}),T(new Set),V({})},[e]),m.useEffect(()=>{t&&g(Ue=>{if(Ue.has(t.name))return Ue;const Xe=new Set(Ue);return Xe.add(t.name),Xe})},[r,t]),m.useEffect(()=>{if(e.length>0&&!n){const Ue=new Set;e.forEach(Xe=>{Xe.sessions&&Xe.sessions.length>=0&&Ue.add(Xe.name)}),T(Ue)}},[e,n]),m.useEffect(()=>{const Ue=()=>{C(HO())};Ue();const Xe=lt=>{lt.key==="claude-settings"&&Ue()},ht=()=>Ue();return window.addEventListener("storage",Xe),window.addEventListener("pixcode:settings-changed",ht),()=>{window.removeEventListener("storage",Xe),window.removeEventListener("pixcode:settings-changed",ht)}},[]),m.useEffect(()=>{ne.current&&clearTimeout(ne.current),W.current&&(W.current.close(),W.current=null);const Ue=z.trim();if(Y!=="conversations"||Ue.length<2){Z.current+=1,J(null),fe(null),le(!1);return}le(!0);const Xe=++Z.current;return ne.current=setTimeout(()=>{if(Xe!==Z.current)return;const ht=Lt.searchConversationsUrl(Ue),lt=new EventSource(ht);W.current=lt;const kt=[];let Wt=0;lt.addEventListener("result",ee=>{if(Xe!==Z.current){lt.close();return}try{const Te=JSON.parse(ee.data);kt.push(Te.projectResult),Wt=Te.totalMatches,J({results:[...kt],totalMatches:Wt,query:Ue}),fe({scannedProjects:Te.scannedProjects,totalProjects:Te.totalProjects})}catch{}}),lt.addEventListener("progress",ee=>{if(Xe!==Z.current){lt.close();return}try{const Te=JSON.parse(ee.data);Wt=Te.totalMatches,fe({scannedProjects:Te.scannedProjects,totalProjects:Te.totalProjects})}catch{}}),lt.addEventListener("done",()=>{if(Xe!==Z.current){lt.close();return}lt.close(),W.current=null,le(!1),fe(null),kt.length===0&&J({results:[],totalMatches:0,query:Ue})}),lt.addEventListener("error",()=>{if(Xe!==Z.current){lt.close();return}lt.close(),W.current=null,le(!1),fe(null),kt.length===0&&J({results:[],totalMatches:0,query:Ue})})},400),()=>{ne.current&&clearTimeout(ne.current),W.current&&(W.current.close(),W.current=null)}},[z,Y]);const Ae=m.useCallback(Ue=>{g(Xe=>{const ht=new Set;return Xe.has(Ue)||ht.add(Ue),ht})},[]),Le=m.useCallback((Ue,Xe)=>{c({...Ue,__projectName:Xe})},[c]),Ge=m.useCallback(Ue=>{M(Xe=>{const ht=new Set(Xe);return ht.has(Ue)?ht.delete(Ue):ht.add(Ue),VO(ht),ht})},[]),rt=m.useCallback(Ue=>je.has(Ue),[je]),Ke=m.useCallback((Ue,Xe)=>{ue(ht=>{const lt=Sk(Ue,Xe),kt=new Set(ht);return kt.has(lt)?kt.delete(lt):kt.add(lt),qO(kt),kt})},[]),ct=m.useCallback((Ue,Xe)=>ae.has(Sk(Ue,Xe)),[ae]),st=m.useCallback(Ue=>tE(Ue,E),[E]),nt=m.useMemo(()=>e.map(Ue=>{const Xe=F[Ue.name];return Xe===void 0?Ue:{...Ue,sessionMeta:{...Ue.sessionMeta,hasMore:Xe}}}),[F,e]),bt=m.useMemo(()=>QO(nt,R,je,E),[E,R,nt,je]),Nt=m.useMemo(()=>eM(bt,z),[z,bt]),Pt=m.useCallback(Ue=>{x(Ue.name),k(Ue.displayName)},[]),Bt=m.useCallback(()=>{x(null),k("")},[]),Ar=m.useCallback(async Ue=>{try{(await Lt.renameProject(Ue,w)).ok?window.refreshProjects?await window.refreshProjects():window.location.reload():console.error("Failed to rename project")}catch(Xe){console.error("Error renaming project:",Xe)}finally{x(null),k("")}},[w]),Vt=m.useCallback((Ue,Xe,ht,lt="claude")=>{he({projectName:Ue,sessionId:Xe,sessionTitle:ht,provider:lt})},[]),br=m.useCallback(async()=>{if(!ye)return;const{projectName:Ue,sessionId:Xe,provider:ht}=ye;he(null);try{let lt;if(ht==="codex"?lt=await Lt.deleteCodexSession(Xe):ht==="gemini"?lt=await Lt.deleteGeminiSession(Xe):ht==="qwen"?lt=await Lt.deleteQwenSession(Xe):lt=await Lt.deleteSession(Ue,Xe),lt.ok)d?.(Xe);else{const kt=await lt.text();console.error("[Sidebar] Failed to delete session:",{status:lt.status,error:kt}),alert(s("messages.deleteSessionFailed"))}}catch(lt){console.error("[Sidebar] Error deleting session:",lt),alert(s("messages.deleteSessionError"))}},[d,ye,s]),tr=m.useCallback(Ue=>{ce({project:Ue,sessionCount:st(Ue).length})},[st]),Fe=m.useCallback(async(Ue=!1)=>{if(!de)return;const{project:Xe,sessionCount:ht}=de,lt=ht===0;ce(null),me(kt=>new Set([...kt,Xe.name]));try{const kt=await Lt.deleteProject(Xe.name,!lt,Ue);if(kt.ok)u?.(Xe.name);else{const Wt=await kt.json();alert(Wt.error||s("messages.deleteProjectFailed"))}}catch(kt){console.error("Error deleting project:",kt),alert(s("messages.deleteProjectError"))}finally{me(kt=>{const Wt=new Set(kt);return Wt.delete(Xe.name),Wt})}},[de,u,s]),Re=m.useCallback(async Ue=>{const Xe=F[Ue.name];if(!(!(Xe!==void 0?Xe:Ue.sessionMeta?.hasMore===!0)||S[Ue.name])){N(lt=>({...lt,[Ue.name]:!0}));try{const lt=(Ue.sessions?.length||0)+(E[Ue.name]?.length||0),kt=await Lt.sessions(Ue.name,5,lt);if(!kt.ok)return;const Wt=await kt.json();I(ee=>({...ee,[Ue.name]:[...ee[Ue.name]||[],...Wt.sessions||[]]})),Wt.hasMore===!1&&V(ee=>({...ee,[Ue.name]:!1}))}catch(lt){console.error("Error loading more sessions:",lt)}finally{N(lt=>({...lt,[Ue.name]:!1}))}}},[E,S,F]),Me=m.useCallback(Ue=>{l(Ue)},[l]),Ze=m.useCallback(async()=>{B(!0);try{await o()}finally{B(!1)}},[o]),xt=m.useCallback(async(Ue,Xe,ht,lt)=>{const kt=ht.trim();if(!kt){L(null),H("");return}try{const Wt=await Lt.renameSession(Xe,kt,lt);Wt.ok?await o():(console.error("[Sidebar] Failed to rename session:",Wt.status),alert(s("messages.renameSessionFailed")))}catch(Wt){console.error("[Sidebar] Error renaming session:",Wt),alert(s("messages.renameSessionError"))}finally{L(null),H("")}},[o,s]),yt=m.useCallback(()=>{p(!1)},[p]),zt=m.useCallback(()=>{p(!0)},[p]);return{isSidebarCollapsed:pe,expandedProjects:h,editingProject:b,showNewProject:y,editingName:w,loadingSessions:S,additionalSessions:E,initialSessionsLoaded:A,currentTime:_,projectSortOrder:R,isRefreshing:D,editingSession:K,editingSessionName:G,searchFilter:z,deletingProjects:se,deleteConfirmation:de,sessionDeleteConfirmation:ye,showVersionModal:ke,starredProjects:je,starredSessions:ae,filteredProjects:Nt,toggleProject:Ae,handleSessionClick:Le,toggleStarProject:Ge,isProjectStarred:rt,toggleStarSession:Ke,isSessionStarred:ct,getProjectSessions:st,startEditing:Pt,cancelEditing:Bt,saveProjectName:Ar,showDeleteSessionConfirmation:Vt,confirmDeleteSession:br,requestProjectDelete:tr,confirmDeleteProject:Fe,loadMoreSessions:Re,handleProjectSelect:Me,refreshProjects:Ze,updateSessionSummary:xt,collapseSidebar:yt,expandSidebar:zt,setShowNewProject:v,setEditingName:k,setEditingSession:L,setEditingSessionName:H,searchMode:Y,setSearchMode:U,conversationResults:Q,isSearching:re,searchProgress:Ee,clearConversationResults:m.useCallback(()=>{Z.current+=1,W.current&&(W.current.close(),W.current=null),le(!1),fe(null),J(null)},[]),setSearchFilter:te,setDeleteConfirmation:ce,setSessionDeleteConfirmation:he,setShowVersionModal:ve}}const nM="https://discord.gg/buxwujPNRE",aM="https://github.com/alicomert/pixcode/issues/new";function iM({className:e}){return i.jsx("svg",{className:e,fill:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:i.jsx("path",{d:"M20.317 4.37a19.791 19.791 0 0 0-4.885-1.515.074.074 0 0 0-.079.037c-.21.375-.444.864-.608 1.25a18.27 18.27 0 0 0-5.487 0 12.64 12.64 0 0 0-.617-1.25.077.077 0 0 0-.079-.037A19.736 19.736 0 0 0 3.677 4.37a.07.07 0 0 0-.032.027C.533 9.046-.32 13.58.099 18.057a.082.082 0 0 0 .031.057 19.9 19.9 0 0 0 5.993 3.03.078.078 0 0 0 .084-.028c.462-.63.874-1.295 1.226-1.994a.076.076 0 0 0-.041-.106 13.107 13.107 0 0 1-1.872-.892.077.077 0 0 1-.008-.128 10.2 10.2 0 0 0 .372-.292.074.074 0 0 1 .077-.01c3.928 1.793 8.18 1.793 12.062 0a.074.074 0 0 1 .078.01c.12.098.246.198.373.292a.077.077 0 0 1-.006.127 12.299 12.299 0 0 1-1.873.892.077.077 0 0 0-.041.107c.36.698.772 1.362 1.225 1.993a.076.076 0 0 0 .084.028 19.839 19.839 0 0 0 6.002-3.03.077.077 0 0 0 .032-.054c.5-5.177-.838-9.674-3.549-13.66a.061.061 0 0 0-.031-.03zM8.02 15.33c-1.183 0-2.157-1.085-2.157-2.419 0-1.333.956-2.419 2.157-2.419 1.21 0 2.176 1.095 2.157 2.42 0 1.333-.956 2.418-2.157 2.418zm7.975 0c-1.183 0-2.157-1.085-2.157-2.419 0-1.333.955-2.419 2.157-2.419 1.21 0 2.176 1.095 2.157 2.42 0 1.333-.946 2.418-2.157 2.418z"})})}function sM({onExpand:e,onOpenControlRoom:t,onShowSettings:r,updateAvailable:n,onShowVersionModal:a,t:s}){return i.jsxs("div",{className:"flex h-full w-12 flex-col items-center gap-1 bg-background/80 py-3 backdrop-blur-sm",children:[i.jsx("button",{onClick:e,className:"group flex h-8 w-8 items-center justify-center rounded-lg transition-colors hover:bg-accent/80","aria-label":s("common:versionUpdate.ariaLabels.showSidebar"),title:s("common:versionUpdate.ariaLabels.showSidebar"),children:i.jsx(Yu,{className:"h-4 w-4 text-muted-foreground transition-colors group-hover:text-foreground"})}),i.jsx("div",{className:"nav-divider my-1 w-6"}),t&&i.jsx("button",{onClick:t,className:"group flex h-8 w-8 items-center justify-center rounded-lg border border-primary/25 bg-primary/10 transition-colors hover:bg-primary/15","aria-label":s("actions.controlRoom",{defaultValue:"Control Room"}),title:s("actions.controlRoom",{defaultValue:"Control Room"}),children:i.jsx($n,{className:"h-4 w-4 text-primary"})}),i.jsx("button",{onClick:r,className:"group flex h-8 w-8 items-center justify-center rounded-lg transition-colors hover:bg-accent/80","aria-label":s("actions.settings"),title:s("actions.settings"),children:i.jsx(Ht,{className:"h-4 w-4 text-muted-foreground transition-colors group-hover:text-foreground"})}),i.jsx("a",{href:aM,target:"_blank",rel:"noopener noreferrer",className:"group flex h-8 w-8 items-center justify-center rounded-lg transition-colors hover:bg-accent/80","aria-label":s("actions.reportIssue"),title:s("actions.reportIssue"),children:i.jsx(To,{className:"h-4 w-4 text-muted-foreground transition-colors group-hover:text-foreground"})}),i.jsx("a",{href:nM,target:"_blank",rel:"noopener noreferrer",className:"group flex h-8 w-8 items-center justify-center rounded-lg transition-colors hover:bg-accent/80","aria-label":s("actions.joinCommunity"),title:s("actions.joinCommunity"),children:i.jsx(iM,{className:"h-4 w-4 text-muted-foreground transition-colors group-hover:text-foreground"})}),n&&i.jsxs("button",{onClick:a,className:"relative flex h-8 w-8 items-center justify-center rounded-lg transition-colors hover:bg-accent/80","aria-label":s("common:versionUpdate.ariaLabels.updateAvailable"),title:s("common:versionUpdate.ariaLabels.updateAvailable"),children:[i.jsx($n,{className:"h-4 w-4 text-blue-500"}),i.jsx("span",{className:"absolute right-1.5 top-1.5 h-1.5 w-1.5 animate-pulse rounded-full bg-blue-500"})]})]})}function rE(e){var t,r,n="";if(typeof e=="string"||typeof e=="number")n+=e;else if(typeof e=="object")if(Array.isArray(e)){var a=e.length;for(t=0;t<a;t++)e[t]&&(r=rE(e[t]))&&(n&&(n+=" "),n+=r)}else for(r in e)e[r]&&(n&&(n+=" "),n+=r);return n}function nE(){for(var e,t,r=0,n="",a=arguments.length;r<a;r++)(e=arguments[r])&&(t=rE(e))&&(n&&(n+=" "),n+=t);return n}const Nk=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,Ek=nE,e0=(e,t)=>r=>{var n;if(t?.variants==null)return Ek(e,r?.class,r?.className);const{variants:a,defaultVariants:s}=t,o=Object.keys(a).map(d=>{const u=r?.[d],p=s?.[d];if(u===null)return null;const f=Nk(u)||Nk(p);return a[d][f]}),l=r&&Object.entries(r).reduce((d,u)=>{let[p,f]=u;return f===void 0||(d[p]=f),d},{}),c=t==null||(n=t.compoundVariants)===null||n===void 0?void 0:n.reduce((d,u)=>{let{class:p,className:f,...h}=u;return Object.entries(h).every(g=>{let[b,x]=g;return Array.isArray(x)?x.includes({...s,...l}[b]):{...s,...l}[b]===x})?[...d,p,f]:d},[]);return Ek(e,o,c,r?.class,r?.className)},t0="-",oM=e=>{const t=cM(e),{conflictingClassGroups:r,conflictingClassGroupModifiers:n}=e;return{getClassGroupId:o=>{const l=o.split(t0);return l[0]===""&&l.length!==1&&l.shift(),aE(l,t)||lM(o)},getConflictingClassGroupIds:(o,l)=>{const c=r[o]||[];return l&&n[o]?[...c,...n[o]]:c}}},aE=(e,t)=>{if(e.length===0)return t.classGroupId;const r=e[0],n=t.nextPart.get(r),a=n?aE(e.slice(1),n):void 0;if(a)return a;if(t.validators.length===0)return;const s=e.join(t0);return t.validators.find(({validator:o})=>o(s))?.classGroupId},Tk=/^\[(.+)\]$/,lM=e=>{if(Tk.test(e)){const t=Tk.exec(e)[1],r=t?.substring(0,t.indexOf(":"));if(r)return"arbitrary.."+r}},cM=e=>{const{theme:t,classGroups:r}=e,n={nextPart:new Map,validators:[]};for(const a in r)yf(r[a],n,a,t);return n},yf=(e,t,r,n)=>{e.forEach(a=>{if(typeof a=="string"){const s=a===""?t:Ak(t,a);s.classGroupId=r;return}if(typeof a=="function"){if(dM(a)){yf(a(n),t,r,n);return}t.validators.push({validator:a,classGroupId:r});return}Object.entries(a).forEach(([s,o])=>{yf(o,Ak(t,s),r,n)})})},Ak=(e,t)=>{let r=e;return t.split(t0).forEach(n=>{r.nextPart.has(n)||r.nextPart.set(n,{nextPart:new Map,validators:[]}),r=r.nextPart.get(n)}),r},dM=e=>e.isThemeGetter,uM=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,r=new Map,n=new Map;const a=(s,o)=>{r.set(s,o),t++,t>e&&(t=0,n=r,r=new Map)};return{get(s){let o=r.get(s);if(o!==void 0)return o;if((o=n.get(s))!==void 0)return a(s,o),o},set(s,o){r.has(s)?r.set(s,o):a(s,o)}}},vf="!",wf=":",pM=wf.length,mM=e=>{const{prefix:t,experimentalParseClassName:r}=e;let n=a=>{const s=[];let o=0,l=0,c=0,d;for(let g=0;g<a.length;g++){let b=a[g];if(o===0&&l===0){if(b===wf){s.push(a.slice(c,g)),c=g+pM;continue}if(b==="/"){d=g;continue}}b==="["?o++:b==="]"?o--:b==="("?l++:b===")"&&l--}const u=s.length===0?a:a.substring(c),p=hM(u),f=p!==u,h=d&&d>c?d-c:void 0;return{modifiers:s,hasImportantModifier:f,baseClassName:p,maybePostfixModifierPosition:h}};if(t){const a=t+wf,s=n;n=o=>o.startsWith(a)?s(o.substring(a.length)):{isExternal:!0,modifiers:[],hasImportantModifier:!1,baseClassName:o,maybePostfixModifierPosition:void 0}}if(r){const a=n;n=s=>r({className:s,parseClassName:a})}return n},hM=e=>e.endsWith(vf)?e.substring(0,e.length-1):e.startsWith(vf)?e.substring(1):e,fM=e=>{const t=Object.fromEntries(e.orderSensitiveModifiers.map(n=>[n,!0]));return n=>{if(n.length<=1)return n;const a=[];let s=[];return n.forEach(o=>{o[0]==="["||t[o]?(a.push(...s.sort(),o),s=[]):s.push(o)}),a.push(...s.sort()),a}},gM=e=>({cache:uM(e.cacheSize),parseClassName:mM(e),sortModifiers:fM(e),...oM(e)}),bM=/\s+/,xM=(e,t)=>{const{parseClassName:r,getClassGroupId:n,getConflictingClassGroupIds:a,sortModifiers:s}=t,o=[],l=e.trim().split(bM);let c="";for(let d=l.length-1;d>=0;d-=1){const u=l[d],{isExternal:p,modifiers:f,hasImportantModifier:h,baseClassName:g,maybePostfixModifierPosition:b}=r(u);if(p){c=u+(c.length>0?" "+c:c);continue}let x=!!b,y=n(x?g.substring(0,b):g);if(!y){if(!x){c=u+(c.length>0?" "+c:c);continue}if(y=n(g),!y){c=u+(c.length>0?" "+c:c);continue}x=!1}const v=s(f).join(":"),w=h?v+vf:v,k=w+y;if(o.includes(k))continue;o.push(k);const S=a(y,x);for(let N=0;N<S.length;++N){const E=S[N];o.push(w+E)}c=u+(c.length>0?" "+c:c)}return c};function yM(){let e=0,t,r,n="";for(;e<arguments.length;)(t=arguments[e++])&&(r=iE(t))&&(n&&(n+=" "),n+=r);return n}const iE=e=>{if(typeof e=="string")return e;let t,r="";for(let n=0;n<e.length;n++)e[n]&&(t=iE(e[n]))&&(r&&(r+=" "),r+=t);return r};function vM(e,...t){let r,n,a,s=o;function o(c){const d=t.reduce((u,p)=>p(u),e());return r=gM(d),n=r.cache.get,a=r.cache.set,s=l,l(c)}function l(c){const d=n(c);if(d)return d;const u=xM(c,r);return a(c,u),u}return function(){return s(yM.apply(null,arguments))}}const jr=e=>{const t=r=>r[e]||[];return t.isThemeGetter=!0,t},sE=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,oE=/^\((?:(\w[\w-]*):)?(.+)\)$/i,wM=/^\d+\/\d+$/,kM=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,SM=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,CM=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,NM=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,EM=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Bs=e=>wM.test(e),St=e=>!!e&&!Number.isNaN(Number(e)),li=e=>!!e&&Number.isInteger(Number(e)),nm=e=>e.endsWith("%")&&St(e.slice(0,-1)),La=e=>kM.test(e),TM=()=>!0,AM=e=>SM.test(e)&&!CM.test(e),lE=()=>!1,jM=e=>NM.test(e),IM=e=>EM.test(e),RM=e=>!Qe(e)&&!et(e),_M=e=>Vo(e,uE,lE),Qe=e=>sE.test(e),Ki=e=>Vo(e,pE,AM),am=e=>Vo(e,MM,St),jk=e=>Vo(e,cE,lE),PM=e=>Vo(e,dE,IM),Jc=e=>Vo(e,mE,jM),et=e=>oE.test(e),vl=e=>Wo(e,pE),LM=e=>Wo(e,FM),Ik=e=>Wo(e,cE),DM=e=>Wo(e,uE),OM=e=>Wo(e,dE),Qc=e=>Wo(e,mE,!0),Vo=(e,t,r)=>{const n=sE.exec(e);return n?n[1]?t(n[1]):r(n[2]):!1},Wo=(e,t,r=!1)=>{const n=oE.exec(e);return n?n[1]?t(n[1]):r:!1},cE=e=>e==="position"||e==="percentage",dE=e=>e==="image"||e==="url",uE=e=>e==="length"||e==="size"||e==="bg-size",pE=e=>e==="length",MM=e=>e==="number",FM=e=>e==="family-name",mE=e=>e==="shadow",zM=()=>{const e=jr("color"),t=jr("font"),r=jr("text"),n=jr("font-weight"),a=jr("tracking"),s=jr("leading"),o=jr("breakpoint"),l=jr("container"),c=jr("spacing"),d=jr("radius"),u=jr("shadow"),p=jr("inset-shadow"),f=jr("text-shadow"),h=jr("drop-shadow"),g=jr("blur"),b=jr("perspective"),x=jr("aspect"),y=jr("ease"),v=jr("animate"),w=()=>["auto","avoid","all","avoid-page","page","left","right","column"],k=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],S=()=>[...k(),et,Qe],N=()=>["auto","hidden","clip","visible","scroll"],E=()=>["auto","contain","none"],I=()=>[et,Qe,c],A=()=>[Bs,"full","auto",...I()],T=()=>[li,"none","subgrid",et,Qe],_=()=>["auto",{span:["full",li,et,Qe]},li,et,Qe],j=()=>[li,"auto",et,Qe],R=()=>["auto","min","max","fr",et,Qe],C=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],D=()=>["start","end","center","stretch","center-safe","end-safe"],B=()=>["auto",...I()],F=()=>[Bs,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...I()],V=()=>[e,et,Qe],K=()=>[...k(),Ik,jk,{position:[et,Qe]}],L=()=>["no-repeat",{repeat:["","x","y","space","round"]}],G=()=>["auto","cover","contain",DM,_M,{size:[et,Qe]}],H=()=>[nm,vl,Ki],z=()=>["","none","full",d,et,Qe],te=()=>["",St,vl,Ki],se=()=>["solid","dashed","dotted","double"],me=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],de=()=>[St,nm,Ik,jk],ce=()=>["","none",g,et,Qe],ye=()=>["none",St,et,Qe],he=()=>["none",St,et,Qe],ke=()=>[St,et,Qe],ve=()=>[Bs,"full",...I()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[La],breakpoint:[La],color:[TM],container:[La],"drop-shadow":[La],ease:["in","out","in-out"],font:[RM],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[La],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[La],shadow:[La],spacing:["px",St],text:[La],"text-shadow":[La],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",Bs,Qe,et,x]}],container:["container"],columns:[{columns:[St,Qe,et,l]}],"break-after":[{"break-after":w()}],"break-before":[{"break-before":w()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:S()}],overflow:[{overflow:N()}],"overflow-x":[{"overflow-x":N()}],"overflow-y":[{"overflow-y":N()}],overscroll:[{overscroll:E()}],"overscroll-x":[{"overscroll-x":E()}],"overscroll-y":[{"overscroll-y":E()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:A()}],"inset-x":[{"inset-x":A()}],"inset-y":[{"inset-y":A()}],start:[{start:A()}],end:[{end:A()}],top:[{top:A()}],right:[{right:A()}],bottom:[{bottom:A()}],left:[{left:A()}],visibility:["visible","invisible","collapse"],z:[{z:[li,"auto",et,Qe]}],basis:[{basis:[Bs,"full","auto",l,...I()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[St,Bs,"auto","initial","none",Qe]}],grow:[{grow:["",St,et,Qe]}],shrink:[{shrink:["",St,et,Qe]}],order:[{order:[li,"first","last","none",et,Qe]}],"grid-cols":[{"grid-cols":T()}],"col-start-end":[{col:_()}],"col-start":[{"col-start":j()}],"col-end":[{"col-end":j()}],"grid-rows":[{"grid-rows":T()}],"row-start-end":[{row:_()}],"row-start":[{"row-start":j()}],"row-end":[{"row-end":j()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":R()}],"auto-rows":[{"auto-rows":R()}],gap:[{gap:I()}],"gap-x":[{"gap-x":I()}],"gap-y":[{"gap-y":I()}],"justify-content":[{justify:[...C(),"normal"]}],"justify-items":[{"justify-items":[...D(),"normal"]}],"justify-self":[{"justify-self":["auto",...D()]}],"align-content":[{content:["normal",...C()]}],"align-items":[{items:[...D(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...D(),{baseline:["","last"]}]}],"place-content":[{"place-content":C()}],"place-items":[{"place-items":[...D(),"baseline"]}],"place-self":[{"place-self":["auto",...D()]}],p:[{p:I()}],px:[{px:I()}],py:[{py:I()}],ps:[{ps:I()}],pe:[{pe:I()}],pt:[{pt:I()}],pr:[{pr:I()}],pb:[{pb:I()}],pl:[{pl:I()}],m:[{m:B()}],mx:[{mx:B()}],my:[{my:B()}],ms:[{ms:B()}],me:[{me:B()}],mt:[{mt:B()}],mr:[{mr:B()}],mb:[{mb:B()}],ml:[{ml:B()}],"space-x":[{"space-x":I()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":I()}],"space-y-reverse":["space-y-reverse"],size:[{size:F()}],w:[{w:[l,"screen",...F()]}],"min-w":[{"min-w":[l,"screen","none",...F()]}],"max-w":[{"max-w":[l,"screen","none","prose",{screen:[o]},...F()]}],h:[{h:["screen","lh",...F()]}],"min-h":[{"min-h":["screen","lh","none",...F()]}],"max-h":[{"max-h":["screen","lh",...F()]}],"font-size":[{text:["base",r,vl,Ki]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[n,et,am]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",nm,Qe]}],"font-family":[{font:[LM,Qe,t]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[a,et,Qe]}],"line-clamp":[{"line-clamp":[St,"none",et,am]}],leading:[{leading:[s,...I()]}],"list-image":[{"list-image":["none",et,Qe]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",et,Qe]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:V()}],"text-color":[{text:V()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...se(),"wavy"]}],"text-decoration-thickness":[{decoration:[St,"from-font","auto",et,Ki]}],"text-decoration-color":[{decoration:V()}],"underline-offset":[{"underline-offset":[St,"auto",et,Qe]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:I()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",et,Qe]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",et,Qe]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:K()}],"bg-repeat":[{bg:L()}],"bg-size":[{bg:G()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},li,et,Qe],radial:["",et,Qe],conic:[li,et,Qe]},OM,PM]}],"bg-color":[{bg:V()}],"gradient-from-pos":[{from:H()}],"gradient-via-pos":[{via:H()}],"gradient-to-pos":[{to:H()}],"gradient-from":[{from:V()}],"gradient-via":[{via:V()}],"gradient-to":[{to:V()}],rounded:[{rounded:z()}],"rounded-s":[{"rounded-s":z()}],"rounded-e":[{"rounded-e":z()}],"rounded-t":[{"rounded-t":z()}],"rounded-r":[{"rounded-r":z()}],"rounded-b":[{"rounded-b":z()}],"rounded-l":[{"rounded-l":z()}],"rounded-ss":[{"rounded-ss":z()}],"rounded-se":[{"rounded-se":z()}],"rounded-ee":[{"rounded-ee":z()}],"rounded-es":[{"rounded-es":z()}],"rounded-tl":[{"rounded-tl":z()}],"rounded-tr":[{"rounded-tr":z()}],"rounded-br":[{"rounded-br":z()}],"rounded-bl":[{"rounded-bl":z()}],"border-w":[{border:te()}],"border-w-x":[{"border-x":te()}],"border-w-y":[{"border-y":te()}],"border-w-s":[{"border-s":te()}],"border-w-e":[{"border-e":te()}],"border-w-t":[{"border-t":te()}],"border-w-r":[{"border-r":te()}],"border-w-b":[{"border-b":te()}],"border-w-l":[{"border-l":te()}],"divide-x":[{"divide-x":te()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":te()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...se(),"hidden","none"]}],"divide-style":[{divide:[...se(),"hidden","none"]}],"border-color":[{border:V()}],"border-color-x":[{"border-x":V()}],"border-color-y":[{"border-y":V()}],"border-color-s":[{"border-s":V()}],"border-color-e":[{"border-e":V()}],"border-color-t":[{"border-t":V()}],"border-color-r":[{"border-r":V()}],"border-color-b":[{"border-b":V()}],"border-color-l":[{"border-l":V()}],"divide-color":[{divide:V()}],"outline-style":[{outline:[...se(),"none","hidden"]}],"outline-offset":[{"outline-offset":[St,et,Qe]}],"outline-w":[{outline:["",St,vl,Ki]}],"outline-color":[{outline:V()}],shadow:[{shadow:["","none",u,Qc,Jc]}],"shadow-color":[{shadow:V()}],"inset-shadow":[{"inset-shadow":["none",p,Qc,Jc]}],"inset-shadow-color":[{"inset-shadow":V()}],"ring-w":[{ring:te()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:V()}],"ring-offset-w":[{"ring-offset":[St,Ki]}],"ring-offset-color":[{"ring-offset":V()}],"inset-ring-w":[{"inset-ring":te()}],"inset-ring-color":[{"inset-ring":V()}],"text-shadow":[{"text-shadow":["none",f,Qc,Jc]}],"text-shadow-color":[{"text-shadow":V()}],opacity:[{opacity:[St,et,Qe]}],"mix-blend":[{"mix-blend":[...me(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":me()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[St]}],"mask-image-linear-from-pos":[{"mask-linear-from":de()}],"mask-image-linear-to-pos":[{"mask-linear-to":de()}],"mask-image-linear-from-color":[{"mask-linear-from":V()}],"mask-image-linear-to-color":[{"mask-linear-to":V()}],"mask-image-t-from-pos":[{"mask-t-from":de()}],"mask-image-t-to-pos":[{"mask-t-to":de()}],"mask-image-t-from-color":[{"mask-t-from":V()}],"mask-image-t-to-color":[{"mask-t-to":V()}],"mask-image-r-from-pos":[{"mask-r-from":de()}],"mask-image-r-to-pos":[{"mask-r-to":de()}],"mask-image-r-from-color":[{"mask-r-from":V()}],"mask-image-r-to-color":[{"mask-r-to":V()}],"mask-image-b-from-pos":[{"mask-b-from":de()}],"mask-image-b-to-pos":[{"mask-b-to":de()}],"mask-image-b-from-color":[{"mask-b-from":V()}],"mask-image-b-to-color":[{"mask-b-to":V()}],"mask-image-l-from-pos":[{"mask-l-from":de()}],"mask-image-l-to-pos":[{"mask-l-to":de()}],"mask-image-l-from-color":[{"mask-l-from":V()}],"mask-image-l-to-color":[{"mask-l-to":V()}],"mask-image-x-from-pos":[{"mask-x-from":de()}],"mask-image-x-to-pos":[{"mask-x-to":de()}],"mask-image-x-from-color":[{"mask-x-from":V()}],"mask-image-x-to-color":[{"mask-x-to":V()}],"mask-image-y-from-pos":[{"mask-y-from":de()}],"mask-image-y-to-pos":[{"mask-y-to":de()}],"mask-image-y-from-color":[{"mask-y-from":V()}],"mask-image-y-to-color":[{"mask-y-to":V()}],"mask-image-radial":[{"mask-radial":[et,Qe]}],"mask-image-radial-from-pos":[{"mask-radial-from":de()}],"mask-image-radial-to-pos":[{"mask-radial-to":de()}],"mask-image-radial-from-color":[{"mask-radial-from":V()}],"mask-image-radial-to-color":[{"mask-radial-to":V()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":k()}],"mask-image-conic-pos":[{"mask-conic":[St]}],"mask-image-conic-from-pos":[{"mask-conic-from":de()}],"mask-image-conic-to-pos":[{"mask-conic-to":de()}],"mask-image-conic-from-color":[{"mask-conic-from":V()}],"mask-image-conic-to-color":[{"mask-conic-to":V()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:K()}],"mask-repeat":[{mask:L()}],"mask-size":[{mask:G()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",et,Qe]}],filter:[{filter:["","none",et,Qe]}],blur:[{blur:ce()}],brightness:[{brightness:[St,et,Qe]}],contrast:[{contrast:[St,et,Qe]}],"drop-shadow":[{"drop-shadow":["","none",h,Qc,Jc]}],"drop-shadow-color":[{"drop-shadow":V()}],grayscale:[{grayscale:["",St,et,Qe]}],"hue-rotate":[{"hue-rotate":[St,et,Qe]}],invert:[{invert:["",St,et,Qe]}],saturate:[{saturate:[St,et,Qe]}],sepia:[{sepia:["",St,et,Qe]}],"backdrop-filter":[{"backdrop-filter":["","none",et,Qe]}],"backdrop-blur":[{"backdrop-blur":ce()}],"backdrop-brightness":[{"backdrop-brightness":[St,et,Qe]}],"backdrop-contrast":[{"backdrop-contrast":[St,et,Qe]}],"backdrop-grayscale":[{"backdrop-grayscale":["",St,et,Qe]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[St,et,Qe]}],"backdrop-invert":[{"backdrop-invert":["",St,et,Qe]}],"backdrop-opacity":[{"backdrop-opacity":[St,et,Qe]}],"backdrop-saturate":[{"backdrop-saturate":[St,et,Qe]}],"backdrop-sepia":[{"backdrop-sepia":["",St,et,Qe]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":I()}],"border-spacing-x":[{"border-spacing-x":I()}],"border-spacing-y":[{"border-spacing-y":I()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",et,Qe]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[St,"initial",et,Qe]}],ease:[{ease:["linear","initial",y,et,Qe]}],delay:[{delay:[St,et,Qe]}],animate:[{animate:["none",v,et,Qe]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[b,et,Qe]}],"perspective-origin":[{"perspective-origin":S()}],rotate:[{rotate:ye()}],"rotate-x":[{"rotate-x":ye()}],"rotate-y":[{"rotate-y":ye()}],"rotate-z":[{"rotate-z":ye()}],scale:[{scale:he()}],"scale-x":[{"scale-x":he()}],"scale-y":[{"scale-y":he()}],"scale-z":[{"scale-z":he()}],"scale-3d":["scale-3d"],skew:[{skew:ke()}],"skew-x":[{"skew-x":ke()}],"skew-y":[{"skew-y":ke()}],transform:[{transform:[et,Qe,"","none","gpu","cpu"]}],"transform-origin":[{origin:S()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:ve()}],"translate-x":[{"translate-x":ve()}],"translate-y":[{"translate-y":ve()}],"translate-z":[{"translate-z":ve()}],"translate-none":["translate-none"],accent:[{accent:V()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:V()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",et,Qe]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":I()}],"scroll-mx":[{"scroll-mx":I()}],"scroll-my":[{"scroll-my":I()}],"scroll-ms":[{"scroll-ms":I()}],"scroll-me":[{"scroll-me":I()}],"scroll-mt":[{"scroll-mt":I()}],"scroll-mr":[{"scroll-mr":I()}],"scroll-mb":[{"scroll-mb":I()}],"scroll-ml":[{"scroll-ml":I()}],"scroll-p":[{"scroll-p":I()}],"scroll-px":[{"scroll-px":I()}],"scroll-py":[{"scroll-py":I()}],"scroll-ps":[{"scroll-ps":I()}],"scroll-pe":[{"scroll-pe":I()}],"scroll-pt":[{"scroll-pt":I()}],"scroll-pr":[{"scroll-pr":I()}],"scroll-pb":[{"scroll-pb":I()}],"scroll-pl":[{"scroll-pl":I()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",et,Qe]}],fill:[{fill:["none",...V()]}],"stroke-w":[{stroke:[St,vl,Ki,am]}],stroke:[{stroke:["none",...V()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}},BM=vM(zM);function xe(...e){return BM(nE(e))}function UM(e){if(!e||typeof e!="string")return null;try{return JSON.parse(e)}catch{return null}}const $M=e0("relative grid w-full grid-cols-[0_1fr] items-start gap-y-0.5 rounded-lg border px-4 py-3 text-sm has-[>svg]:grid-cols-[calc(var(--spacing)*4)_1fr] has-[>svg]:gap-x-3 [&>svg]:size-4 [&>svg]:translate-y-0.5 [&>svg]:text-current",{variants:{variant:{default:"bg-card text-card-foreground",destructive:"bg-card text-destructive *:data-[slot=alert-description]:text-destructive/90 [&>svg]:text-current"}},defaultVariants:{variant:"default"}}),hE=m.forwardRef(({className:e,variant:t,...r},n)=>i.jsx("div",{ref:n,role:"alert","data-slot":"alert",className:xe($M({variant:t}),e),...r}));hE.displayName="Alert";const HM=m.forwardRef(({className:e,...t},r)=>i.jsx("div",{ref:r,"data-slot":"alert-title",className:xe("col-start-2 line-clamp-1 min-h-4 font-medium tracking-tight",e),...t}));HM.displayName="AlertTitle";const GM=m.forwardRef(({className:e,...t},r)=>i.jsx("div",{ref:r,"data-slot":"alert-description",className:xe("text-muted-foreground col-start-2 grid justify-items-start gap-1 text-sm [&_p]:leading-relaxed",e),...t}));GM.displayName="AlertDescription";const VM=e0("inline-flex items-center rounded-md border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground shadow hover:bg-primary/80",secondary:"border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80",destructive:"border-transparent bg-destructive text-destructive-foreground shadow hover:bg-destructive/80",outline:"text-foreground"}},defaultVariants:{variant:"default"}});function Tt({className:e,variant:t,...r}){return i.jsx("div",{className:xe(VM({variant:t}),e),...r})}const WM=e0("inline-flex touch-manipulation items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",{variants:{variant:{default:"bg-primary text-primary-foreground shadow hover:bg-primary/90 active:bg-primary/80",destructive:"bg-destructive text-destructive-foreground shadow-sm hover:bg-destructive/90 active:bg-destructive/80",outline:"border border-input bg-background shadow-sm hover:bg-accent hover:text-accent-foreground active:bg-accent/80",secondary:"bg-secondary text-secondary-foreground shadow-sm hover:bg-secondary/80 active:bg-secondary/70",ghost:"hover:bg-accent hover:text-accent-foreground active:bg-accent/80",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-10 px-4 py-2",sm:"h-9 rounded-md px-3 text-sm",lg:"h-11 rounded-md px-8",icon:"h-10 w-10"}},defaultVariants:{variant:"default",size:"default"}}),Ne=m.forwardRef(({className:e,variant:t,size:r,...n},a)=>i.jsx("button",{className:xe(WM({variant:t,size:r,className:e})),ref:a,...n}));Ne.displayName="Button";const fE=m.createContext(null),gE=()=>{const e=m.useContext(fE);if(!e)throw new Error("Confirmation components must be used within Confirmation");return e},bE=({className:e,approval:t="pending",children:r,...n})=>{const a=m.useMemo(()=>({approval:t}),[t]);return i.jsx(fE.Provider,{value:a,children:i.jsx(hE,{className:xe("flex flex-col gap-2",e),...n,children:r})})};bE.displayName="Confirmation";const xE=({className:e,...t})=>i.jsx("div",{"data-slot":"confirmation-title",className:xe("text-muted-foreground inline text-sm",e),...t});xE.displayName="ConfirmationTitle";const yE=({children:e})=>{const{approval:t}=gE();return t!=="pending"?null:i.jsx(i.Fragment,{children:e})};yE.displayName="ConfirmationRequest";const vE=({className:e,...t})=>{const{approval:r}=gE();return r!=="pending"?null:i.jsx("div",{"data-slot":"confirmation-actions",className:xe("flex items-center justify-end gap-2 self-end",e),...t})};vE.displayName="ConfirmationActions";const $d=({variant:e="default",...t})=>i.jsx(Ne,{className:"h-8 px-3 text-sm",variant:e,type:"button",...t});$d.displayName="ConfirmationAction";const wE=m.forwardRef(({className:e,...t},r)=>i.jsx("div",{ref:r,className:xe("rounded-xl border bg-card text-card-foreground shadow-sm",e),...t}));wE.displayName="Card";const kE=m.forwardRef(({className:e,...t},r)=>i.jsx("div",{ref:r,className:xe("flex flex-col space-y-1.5 p-4",e),...t}));kE.displayName="CardHeader";const SE=m.forwardRef(({className:e,...t},r)=>i.jsx("h3",{ref:r,className:xe("font-semibold leading-none tracking-tight",e),...t}));SE.displayName="CardTitle";const qM=m.forwardRef(({className:e,...t},r)=>i.jsx("p",{ref:r,className:xe("text-sm text-muted-foreground",e),...t}));qM.displayName="CardDescription";const CE=m.forwardRef(({className:e,...t},r)=>i.jsx("div",{ref:r,className:xe("p-4 pt-0",e),...t}));CE.displayName="CardContent";const NE=m.forwardRef(({className:e,...t},r)=>i.jsx("div",{ref:r,className:xe("flex items-center p-4 pt-0",e),...t}));NE.displayName="CardFooter";const KM=m.forwardRef(({className:e,...t},r)=>i.jsx("div",{ref:r,className:xe("ml-auto shrink-0",e),...t}));KM.displayName="CardAction";const EE=m.createContext(null);function TE(){const e=m.useContext(EE);if(!e)throw new Error("Collapsible components must be used within <Collapsible>");return e}const Ri=m.forwardRef(({defaultOpen:e=!1,open:t,onOpenChange:r,className:n,children:a,...s},o)=>{const[l,c]=m.useState(e),d=t!==void 0,u=d?t:l,p=m.useCallback(h=>{d||c(h),r?.(h)},[d,r]),f=m.useMemo(()=>({open:u,onOpenChange:p}),[u,p]);return i.jsx(EE.Provider,{value:f,children:i.jsx("div",{ref:o,"data-state":u?"open":"closed",className:n,...s,children:a})})});Ri.displayName="Collapsible";const qa=m.forwardRef(({onClick:e,children:t,className:r,...n},a)=>{const{open:s,onOpenChange:o}=TE(),l=m.useCallback(c=>{o(!s),e?.(c)},[s,o,e]);return i.jsx("button",{ref:a,type:"button","aria-expanded":s,"data-state":s?"open":"closed",onClick:l,className:r,...n,children:t})});qa.displayName="CollapsibleTrigger";const _i=m.forwardRef(({className:e,children:t,...r},n)=>{const{open:a}=TE();return i.jsx("div",{ref:n,"data-state":a?"open":"closed",className:xe("grid transition-[grid-template-rows] duration-200 ease-out",a?"grid-rows-[1fr]":"grid-rows-[0fr]",e),...r,children:i.jsx("div",{className:"overflow-hidden",children:t})})});_i.displayName="CollapsibleContent";const AE=m.createContext(null);function r0(){const e=m.useContext(AE);if(!e)throw new Error("Command components must be used within <Command>");return e}const jE=m.forwardRef(({className:e,children:t,...r},n)=>{const[a,s]=m.useState(""),o=m.useRef(new Map),[l,c]=m.useState(0),d=m.useCallback(v=>{o.current.set(v.id,v),c(w=>w+1)},[]),u=m.useCallback(v=>{o.current.delete(v),c(w=>w+1)},[]),p=m.useCallback((v,w)=>{const k=o.current.get(v);k&&Object.assign(k,w)},[]),f=m.useMemo(()=>{const v=a.toLowerCase(),w=new Set;for(const[k,S]of o.current)(!v||S.value.includes(v))&&w.add(k);return w},[a,l]),h=m.useMemo(()=>{const v=[];for(const[,w]of o.current)f.has(w.id)&&v.push(w);return v},[f]),[g,b]=m.useState(null);m.useEffect(()=>{b(h.length>0?h[0].id:null)},[h]);const x=m.useCallback(v=>{if(v.key==="ArrowDown"||v.key==="ArrowUp"||v.key==="Enter")v.preventDefault();else return;const w=h;if(w.length===0)return;if(v.key==="Enter"){w.find(A=>A.id===g)?.onSelect();return}const k=w.findIndex(I=>I.id===g);let S;v.key==="ArrowDown"?S=k<w.length-1?k+1:0:S=k>0?k-1:w.length-1;const N=w[S].id;b(N),w[S].element?.scrollIntoView({block:"nearest"})},[h,g]),y=m.useMemo(()=>({search:a,setSearch:s,visibleIds:f,activeId:g,setActiveId:b,register:d,unregister:u,updateEntry:p}),[a,f,g,d,u,p]);return i.jsx(AE.Provider,{value:y,children:i.jsx("div",{ref:n,role:"combobox","aria-expanded":"true","aria-haspopup":"listbox",className:xe("flex flex-col",e),onKeyDown:x,...r,children:t})})});jE.displayName="Command";const IE=m.forwardRef(({className:e,placeholder:t="Search...",...r},n)=>{const{search:a,setSearch:s}=r0();return i.jsxs("div",{className:"flex items-center border-b px-3",role:"presentation",children:[i.jsx(ys,{className:"mr-2 h-4 w-4 shrink-0 text-muted-foreground","aria-hidden":!0}),i.jsx("input",{ref:n,type:"text",role:"searchbox","aria-autocomplete":"list",autoComplete:"off",autoCorrect:"off",spellCheck:!1,value:a,onChange:o=>s(o.target.value),placeholder:t,className:xe("flex h-11 w-full rounded-md bg-transparent py-3 text-sm outline-none","placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50",e),...r})]})});IE.displayName="CommandInput";const RE=m.forwardRef(({className:e,...t},r)=>i.jsx("div",{ref:r,role:"listbox",className:xe("max-h-[300px] overflow-y-auto overflow-x-hidden",e),...t}));RE.displayName="CommandList";const _E=m.forwardRef(({className:e,...t},r)=>{const{search:n,visibleIds:a}=r0();return!n||a.size>0?null:i.jsx("div",{ref:r,className:xe("py-6 text-center text-sm text-muted-foreground",e),...t})});_E.displayName="CommandEmpty";const PE=m.forwardRef(({className:e,heading:t,children:r,...n},a)=>i.jsxs("div",{ref:a,className:xe("overflow-hidden p-1",e),role:"group","aria-label":typeof t=="string"?t:void 0,...n,children:[t&&i.jsx("div",{className:"px-2 py-1.5 text-xs font-medium text-muted-foreground",role:"presentation",children:t}),r]}));PE.displayName="CommandGroup";const LE=m.forwardRef(({className:e,value:t,onSelect:r,disabled:n,children:a,...s},o)=>{const{visibleIds:l,activeId:c,setActiveId:d,register:u,unregister:p,updateEntry:f}=r0(),h=m.useId(),g=m.useRef(null),b=t||(typeof a=="string"?a:"");m.useEffect(()=>(u({id:h,value:b.toLowerCase(),onSelect:r||(()=>{}),element:g.current}),()=>p(h)),[h,b,u,p]),m.useEffect(()=>{f(h,{onSelect:r||(()=>{})})},[h,r,f]);const x=m.useCallback(v=>{g.current=v,f(h,{element:v}),typeof o=="function"?o(v):o&&(o.current=v)},[h,f,o]);if(!l.has(h))return null;const y=c===h;return i.jsx("div",{ref:x,role:"option","aria-selected":y,"aria-disabled":n||void 0,"data-active":y||void 0,className:xe("relative flex cursor-pointer select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none",y&&"bg-accent text-accent-foreground",n&&"pointer-events-none opacity-50",e),onPointerMove:()=>{!n&&c!==h&&d(h)},onClick:()=>!n&&r?.(),...s,children:a})});LE.displayName="CommandItem";const YM=m.forwardRef(({className:e,...t},r)=>i.jsx("div",{ref:r,className:xe("-mx-1 h-px bg-border",e),...t}));YM.displayName="CommandSeparator";function uu({checked:e,onToggle:t,ariaLabel:r="Toggle dark mode"}){const{isDarkMode:n,toggleDarkMode:a}=ri(),s=typeof e=="boolean"&&typeof t=="function",o=s?e:n,l=()=>{if(s&&t){t(!o);return}a()};return i.jsxs("button",{onClick:l,className:xe("relative inline-flex h-7 w-12 flex-shrink-0 touch-manipulation cursor-pointer items-center rounded-full border-2 transition-colors duration-200","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background",o?"border-primary bg-primary":"border-border bg-muted"),role:"switch","aria-checked":o,"aria-label":r,children:[i.jsx("span",{className:"sr-only",children:r}),i.jsx("span",{className:xe("flex h-5 w-5 transform items-center justify-center rounded-full shadow-sm transition-transform duration-200",o?"translate-x-[22px] bg-white":"translate-x-[2px] bg-foreground/60 dark:bg-foreground/80"),children:o?i.jsx($4,{className:"h-3 w-3 text-primary"}):i.jsx(V4,{className:"h-3 w-3 text-white dark:text-background"})})]})}const DE=m.createContext(null);function OE(){const e=m.useContext(DE);if(!e)throw new Error("Dialog components must be used within <Dialog>");return e}const ME=({open:e,onOpenChange:t,defaultOpen:r=!1,children:n})=>{const[a,s]=m.useState(r),o=m.useRef(null),l=e!==void 0,c=l?e:a,d=m.useCallback(p=>{l||s(p),t?.(p)},[l,t]),u=m.useMemo(()=>({open:c,onOpenChange:d,triggerRef:o}),[c,d]);return i.jsx(DE.Provider,{value:u,children:n})},ZM=m.forwardRef(({onClick:e,children:t,asChild:r,...n},a)=>{const{onOpenChange:s,triggerRef:o}=OE(),l=m.useCallback(c=>{s(!0),e?.(c)},[s,e]);if(r&&m.isValidElement(t)){const c=t;return m.cloneElement(c,{onClick:d=>{s(!0),c.props.onClick?.(d)},ref:d=>{o.current=d,typeof a=="function"?a(d):a&&(a.current=d)}})}return i.jsx("button",{ref:c=>{o.current=c,typeof a=="function"?a(c):a&&(a.current=c)},type:"button",onClick:l,...n,children:t})});ZM.displayName="DialogTrigger";const Rk='a[href], button:not([disabled]), input:not([disabled]), textarea:not([disabled]), select:not([disabled]), [tabindex]:not([tabindex="-1"])',n0=m.forwardRef(({className:e,children:t,onEscapeKeyDown:r,onPointerDownOutside:n,...a},s)=>{const{open:o,onOpenChange:l,triggerRef:c}=OE(),d=m.useRef(null),u=m.useRef(null);return m.useEffect(()=>{o?u.current=document.activeElement:u.current&&((c.current||u.current)?.focus(),u.current=null)},[o,c]),m.useEffect(()=>{if(!o)return;const p=h=>{if(h.key==="Escape"){h.stopPropagation(),r?.(),l(!1);return}if(h.key==="Tab"&&d.current){const g=Array.from(d.current.querySelectorAll(Rk));if(g.length===0)return;const b=g[0],x=g[g.length-1];h.shiftKey&&document.activeElement===b?(h.preventDefault(),x.focus()):!h.shiftKey&&document.activeElement===x&&(h.preventDefault(),b.focus())}};document.addEventListener("keydown",p,!0);const f=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.removeEventListener("keydown",p,!0),document.body.style.overflow=f}},[o,l,r]),m.useEffect(()=>{o&&d.current&&requestAnimationFrame(()=>{d.current?.querySelector(Rk)?.focus()})},[o]),o?Vu.createPortal(i.jsxs("div",{className:"fixed inset-0 z-50",children:[i.jsx("div",{className:"fixed inset-0 animate-dialog-overlay-show bg-black/50 backdrop-blur-sm",onClick:()=>{n?.(),l(!1)},"aria-hidden":!0}),i.jsx("div",{ref:p=>{d.current=p,typeof s=="function"?s(p):s&&(s.current=p)},role:"dialog","aria-modal":"true",className:xe("fixed left-1/2 top-1/2 z-50 w-full max-w-lg -translate-x-1/2 -translate-y-1/2","rounded-xl border bg-popover text-popover-foreground shadow-lg","animate-dialog-content-show",e),...a,children:t})]}),document.body):null});n0.displayName="DialogContent";const a0=m.forwardRef(({className:e,...t},r)=>i.jsx("h2",{ref:r,className:xe("sr-only",e),...t}));a0.displayName="DialogTitle";const Je=m.forwardRef(({className:e,type:t,...r},n)=>i.jsx("input",{type:t,className:xe("flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-sm shadow-sm transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50",e),ref:n,...r}));Je.displayName="Input";const i0=m.forwardRef(({className:e,contentClassName:t,children:r,...n},a)=>i.jsx("div",{className:xe("relative overflow-hidden",e),...n,children:i.jsx("div",{ref:a,className:xe("h-full w-full overflow-auto rounded-[inherit]",t),style:{WebkitOverflowScrolling:"touch",touchAction:"pan-y"},children:r})}));i0.displayName="ScrollArea";const pu=m.memo(({children:e,className:t,as:r="span"})=>i.jsx(r,{className:xe("animate-shimmer inline-block bg-[length:250%_100%] bg-clip-text text-transparent","bg-[linear-gradient(90deg,transparent_33%,hsl(var(--foreground))_50%,transparent_67%),linear-gradient(hsl(var(--muted-foreground)),hsl(var(--muted-foreground)))]",t),children:e}));pu.displayName="Shimmer";const FE=m.createContext(null),XM=()=>{const e=m.useContext(FE);if(!e)throw new Error("Reasoning components must be used within Reasoning");return e},JM=1e3,QM=1e3,kf=m.memo(({className:e,isStreaming:t=!1,open:r,defaultOpen:n,onOpenChange:a,duration:s,children:o,...l})=>{const c=n??t,d=n===!1,[u,p]=m.useState(c),f=r!==void 0,h=f?r:u,g=m.useCallback(N=>{f||p(N),a?.(N)},[f,a]),[b,x]=m.useState(s),y=m.useRef(t),[v,w]=m.useState(!1),k=m.useRef(null);m.useEffect(()=>{s!==void 0&&x(s)},[s]),m.useEffect(()=>{t?(y.current=!0,k.current===null&&(k.current=Date.now())):k.current!==null&&(x(Math.ceil((Date.now()-k.current)/QM)),k.current=null)},[t]),m.useEffect(()=>{t&&!h&&!d&&g(!0)},[t,h,g,d]),m.useEffect(()=>{if(y.current&&!t&&h&&!v){const N=setTimeout(()=>{g(!1),w(!0)},JM);return()=>clearTimeout(N)}},[t,h,g,v]);const S=m.useMemo(()=>({duration:b,isOpen:h,isStreaming:t,setIsOpen:g}),[b,h,t,g]);return i.jsx(FE.Provider,{value:S,children:i.jsx(Ri,{open:h,onOpenChange:g,className:xe("not-prose",e),...l,children:o})})});kf.displayName="Reasoning";const e9=(e,t)=>e||t===0?i.jsx(pu,{children:"Thinking..."}):t===void 0?i.jsx("p",{children:"Thought for a few seconds"}):i.jsxs("p",{children:["Thought for ",t," seconds"]}),Sf=m.memo(({className:e,children:t,getThinkingMessage:r=e9,...n})=>{const{isStreaming:a,isOpen:s,duration:o}=XM();return i.jsx(qa,{className:xe("flex w-full items-center gap-2 text-sm text-muted-foreground transition-colors hover:text-foreground",e),...n,children:t??i.jsxs(i.Fragment,{children:[i.jsx(HD,{className:"h-4 w-4"}),r(a,o),i.jsx(N4,{className:xe("h-4 w-4 transition-transform",s?"rotate-180":"rotate-0")})]})})});Sf.displayName="ReasoningTrigger";const Cf=m.memo(({className:e,children:t,...r})=>i.jsx(_i,{className:xe("mt-4 text-sm text-muted-foreground",e),...r,children:t}));Cf.displayName="ReasoningContent";function t9(e){switch(e){case"top":return"top-full left-1/2 transform -translate-x-1/2 border-t-gray-900 dark:border-t-gray-100";case"bottom":return"bottom-full left-1/2 transform -translate-x-1/2 border-b-gray-900 dark:border-b-gray-100";case"left":return"left-full top-1/2 transform -translate-y-1/2 border-l-gray-900 dark:border-l-gray-100";case"right":return"right-full top-1/2 transform -translate-y-1/2 border-r-gray-900 dark:border-r-gray-100";default:return"top-full left-1/2 transform -translate-x-1/2 border-t-gray-900 dark:border-t-gray-100"}}function Nf({children:e,content:t,position:r="top",className:n="",delay:a=350}){const[s,o]=m.useState(!1),l=m.useRef(null),c=m.useRef(!1),d=m.useRef(null),u=m.useRef(null),[p,f]=m.useState(null),h=m.useCallback(()=>{const w=d.current;if(!w)return;const k=w.getBoundingClientRect(),S=8,N={position:"fixed",zIndex:9999};switch(r){case"bottom":N.left=k.left+k.width/2,N.top=k.bottom+S,N.transform="translateX(-50%)";break;case"left":N.left=k.left-S,N.top=k.top+k.height/2,N.transform="translate(-100%, -50%)";break;case"right":N.left=k.right+S,N.top=k.top+k.height/2,N.transform="translateY(-50%)";break;case"top":default:N.left=k.left+k.width/2,N.top=k.top-S,N.transform="translate(-50%, -100%)";break}f(N)},[r]),g=()=>{l.current!==null&&(window.clearTimeout(l.current),l.current=null)},b=()=>{g(),l.current=window.setTimeout(()=>{o(!0)},a)},x=()=>{g(),o(!1)},y=()=>{g(),c.current=!1,l.current=window.setTimeout(()=>{c.current=!0,o(!0)},a)},v=()=>{g(),!c.current&&o(!1)};return m.useEffect(()=>()=>{g()},[]),m.useEffect(()=>{if(!s||typeof document>"u")return;const w=k=>{const S=k.target;S instanceof Node&&d.current?.contains(S)||(o(!1),c.current=!1)};return document.addEventListener("pointerdown",w,!0),()=>document.removeEventListener("pointerdown",w,!0)},[s]),m.useEffect(()=>{if(!s){f(null);return}const w=window.requestAnimationFrame(h),k=()=>h();return window.addEventListener("resize",k),window.addEventListener("scroll",k,!0),()=>{window.cancelAnimationFrame(w),window.removeEventListener("resize",k),window.removeEventListener("scroll",k,!0)}},[s,h]),t?i.jsxs("div",{ref:d,className:"relative inline-block",onMouseEnter:b,onMouseLeave:x,onTouchStart:y,onTouchEnd:v,onTouchCancel:v,children:[e,s&&typeof document<"u"&&Vu.createPortal(i.jsxs("div",{ref:u,style:p||{position:"fixed",top:"-9999px",left:"-9999px",opacity:0},className:xe("px-2 py-1 text-xs font-medium text-white bg-gray-900 dark:bg-gray-100 dark:text-gray-900 rounded shadow-lg whitespace-nowrap pointer-events-none","animate-in fade-in-0 zoom-in-95 duration-200",n),children:[t,i.jsx("div",{className:xe("absolute w-0 h-0 border-4 border-transparent",t9(r))})]}),document.body)]}):i.jsx(i.Fragment,{children:e})}const zE=m.createContext(null),BE=m.forwardRef(({className:e,status:t="ready",children:r,...n},a)=>{const s=m.useMemo(()=>({status:t}),[t]);return i.jsx(zE.Provider,{value:s,children:i.jsx("form",{ref:a,"data-slot":"prompt-input",className:xe("relative overflow-hidden rounded-xl border border-border/70 bg-zinc-50/95 shadow-sm shadow-zinc-950/5 backdrop-blur-sm transition-all duration-200 focus-within:border-primary/40 focus-within:shadow-md focus-within:ring-1 focus-within:ring-primary/20 dark:bg-zinc-950/90",e),...n,children:r})})});BE.displayName="PromptInput";const UE=m.forwardRef(({className:e,...t},r)=>i.jsx("div",{ref:r,"data-slot":"prompt-input-header",className:xe("px-3 pt-3",e),...t}));UE.displayName="PromptInputHeader";const $E=m.forwardRef(({className:e,...t},r)=>i.jsx("div",{ref:r,"data-slot":"prompt-input-body",className:xe("relative",e),...t}));$E.displayName="PromptInputBody";const HE=m.forwardRef(({className:e,...t},r)=>i.jsx("textarea",{ref:r,"data-slot":"prompt-input-textarea",className:xe("chat-input-placeholder block max-h-[40vh] w-full resize-none overflow-y-auto bg-transparent px-4 py-2 font-mono text-sm leading-6 text-foreground placeholder-muted-foreground/50 focus:outline-none sm:max-h-[300px]",e),...t}));HE.displayName="PromptInputTextarea";const GE=m.forwardRef(({className:e,...t},r)=>i.jsx("div",{ref:r,"data-slot":"prompt-input-footer",className:xe("flex items-center justify-between border-t border-border/30 px-3 py-2",e),...t}));GE.displayName="PromptInputFooter";const VE=m.forwardRef(({className:e,...t},r)=>i.jsx("div",{ref:r,"data-slot":"prompt-input-tools",className:xe("flex items-center gap-1",e),...t}));VE.displayName="PromptInputTools";const Hd=m.forwardRef(({className:e,tooltip:t,children:r,...n},a)=>{const s=i.jsx(Ne,{ref:a,type:"button",variant:"ghost",size:"icon",className:xe("h-8 w-8 [&_svg]:size-4",e),...n,children:r});return t?i.jsx(Nf,{content:t.shortcut?i.jsxs("span",{className:"flex items-center gap-1.5",children:[t.content,i.jsx("kbd",{className:"rounded bg-white/20 px-1 text-[10px]",children:t.shortcut})]}):t.content,position:t.side??"top",children:s}):s});Hd.displayName="PromptInputButton";const WE=m.forwardRef(({className:e,status:t,children:r,...n},a)=>{const s=m.useContext(zE),o=t??s?.status??"ready",l=o==="submitted"||o==="streaming";return i.jsx(Ne,{ref:a,type:l?"button":"submit",variant:"default",size:"icon",className:xe("h-8 w-8 rounded-lg",e),...n,children:r??(l?i.jsx(Nc,{className:"h-3.5 w-3.5 fill-current"}):i.jsx(TD,{className:"h-4 w-4"}))})});WE.displayName="PromptInputSubmit";function rp({children:e,className:t}){return i.jsx("div",{className:xe("inline-flex items-center gap-[2px] rounded-lg bg-muted/60 p-[3px]",t),children:e})}function np({isActive:e,onClick:t,children:r,className:n}){return i.jsx("button",{onClick:t,className:xe("flex touch-manipulation items-center gap-1.5 rounded-md px-3 py-2 text-sm font-medium transition-all duration-150",e?"bg-background text-foreground shadow-sm":"text-muted-foreground active:bg-background/50",n),children:r})}const qE=m.createContext(null);function KE(){const e=m.useContext(qE);if(!e)throw new Error("QueueItem sub-components must be used within <QueueItem>");return e}const YE=m.forwardRef(({className:e,...t},r)=>i.jsx("div",{ref:r,"data-slot":"queue",role:"list",className:xe("space-y-0.5",e),...t}));YE.displayName="Queue";const ZE=m.forwardRef(({status:e="pending",className:t,children:r,...n},a)=>{const s=m.useMemo(()=>({status:e}),[e]);return i.jsx(qE.Provider,{value:s,children:i.jsx("div",{ref:a,"data-slot":"queue-item","data-status":e,role:"listitem",className:xe("flex items-start gap-2 py-0.5",t),...n,children:r})})});ZE.displayName="QueueItem";const XE=m.forwardRef(({className:e,...t},r)=>{const{status:n}=KE();return i.jsxs("div",{ref:r,"data-slot":"queue-item-indicator","aria-hidden":"true",className:xe("mt-0.5 flex h-3.5 w-3.5 flex-shrink-0 items-center justify-center",e),...t,children:[n==="completed"&&i.jsx("svg",{className:"h-3.5 w-3.5 text-green-500 dark:text-green-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z"})}),n==="in_progress"&&i.jsx("span",{className:"h-2 w-2 animate-pulse rounded-full bg-blue-500 dark:bg-blue-400"}),n==="pending"&&i.jsx("svg",{className:"h-3.5 w-3.5 text-muted-foreground/50",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:i.jsx("circle",{cx:"12",cy:"12",r:"9",strokeWidth:2})})]})});XE.displayName="QueueItemIndicator";const JE=m.forwardRef(({className:e,children:t,...r},n)=>{const{status:a}=KE();return i.jsx("div",{ref:n,"data-slot":"queue-item-content",className:xe("min-w-0 flex-1 text-xs",a==="completed"&&"text-muted-foreground line-through",a==="in_progress"&&"font-medium text-foreground",a==="pending"&&"text-foreground",e),...r,children:t})});JE.displayName="QueueItemContent";const _k="https://github.com/alicomert/pixcode/issues/new",r9="https://github.com/alicomert/pixcode",Pk="https://discord.gg/buxwujPNRE";function Lk({className:e}){return i.jsx("svg",{className:e,fill:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:i.jsx("path",{d:"M20.317 4.37a19.791 19.791 0 0 0-4.885-1.515.074.074 0 0 0-.079.037c-.21.375-.444.864-.608 1.25a18.27 18.27 0 0 0-5.487 0 12.64 12.64 0 0 0-.617-1.25.077.077 0 0 0-.079-.037A19.736 19.736 0 0 0 3.677 4.37a.07.07 0 0 0-.032.027C.533 9.046-.32 13.58.099 18.057a.082.082 0 0 0 .031.057 19.9 19.9 0 0 0 5.993 3.03.078.078 0 0 0 .084-.028c.462-.63.874-1.295 1.226-1.994a.076.076 0 0 0-.041-.106 13.107 13.107 0 0 1-1.872-.892.077.077 0 0 1-.008-.128 10.2 10.2 0 0 0 .372-.292.074.074 0 0 1 .077-.01c3.928 1.793 8.18 1.793 12.062 0a.074.074 0 0 1 .078.01c.12.098.246.198.373.292a.077.077 0 0 1-.006.127 12.299 12.299 0 0 1-1.873.892.077.077 0 0 0-.041.107c.36.698.772 1.362 1.225 1.993a.076.076 0 0 0 .084.028 19.839 19.839 0 0 0 6.002-3.03.077.077 0 0 0 .032-.054c.5-5.177-.838-9.674-3.549-13.66a.061.061 0 0 0-.031-.03zM8.02 15.33c-1.183 0-2.157-1.085-2.157-2.419 0-1.333.956-2.419 2.157-2.419 1.21 0 2.176 1.095 2.157 2.42 0 1.333-.956 2.418-2.157 2.418zm7.975 0c-1.183 0-2.157-1.085-2.157-2.419 0-1.333.955-2.419 2.157-2.419 1.21 0 2.176 1.095 2.157 2.42 0 1.333-.946 2.418-2.157 2.418z"})})}function n9({updateAvailable:e,releaseInfo:t,latestVersion:r,currentVersion:n,onShowVersionModal:a,onOpenControlRoom:s,onShowSettings:o,t:l}){return i.jsxs("div",{className:"flex-shrink-0",style:{paddingBottom:"env(safe-area-inset-bottom, 0)"},children:[e&&i.jsxs(i.Fragment,{children:[i.jsx("div",{className:"nav-divider"}),i.jsx("div",{className:"hidden px-2 py-1.5 md:block",children:i.jsxs("button",{className:"group flex w-full items-center gap-2.5 rounded-lg px-2.5 py-2 text-left transition-colors hover:bg-blue-50/80 dark:hover:bg-blue-900/15",onClick:a,children:[i.jsxs("div",{className:"relative flex-shrink-0",children:[i.jsx(lk,{className:"h-4 w-4 text-blue-500 dark:text-blue-400"}),i.jsx("span",{className:"absolute -right-0.5 -top-0.5 h-1.5 w-1.5 animate-pulse rounded-full bg-blue-500"})]}),i.jsxs("div",{className:"min-w-0 flex-1",children:[i.jsx("span",{className:"block truncate text-sm font-medium text-blue-600 dark:text-blue-300",children:t?.title||`v${r}`}),i.jsx("span",{className:"text-[10px] text-blue-500/70 dark:text-blue-400/60",children:l("version.updateAvailable")})]})]})}),i.jsx("div",{className:"px-3 py-2 md:hidden",children:i.jsxs("button",{className:"flex h-11 w-full items-center gap-3 rounded-xl border border-blue-200/60 bg-blue-50/80 px-3.5 transition-all active:scale-[0.98] dark:border-blue-700/40 dark:bg-blue-900/15",onClick:a,children:[i.jsxs("div",{className:"relative flex-shrink-0",children:[i.jsx(lk,{className:"w-4.5 h-4.5 text-blue-500 dark:text-blue-400"}),i.jsx("span",{className:"absolute -right-0.5 -top-0.5 h-1.5 w-1.5 animate-pulse rounded-full bg-blue-500"})]}),i.jsxs("div",{className:"min-w-0 flex-1 text-left",children:[i.jsx("span",{className:"block truncate text-sm font-medium text-blue-600 dark:text-blue-300",children:t?.title||`v${r}`}),i.jsx("span",{className:"text-xs text-blue-500/70 dark:text-blue-400/60",children:l("version.updateAvailable")})]})]})})]}),i.jsx("div",{className:"nav-divider"}),i.jsx("div",{className:"hidden px-2 pt-1.5 md:block",children:i.jsxs("a",{href:_k,target:"_blank",rel:"noopener noreferrer",className:"flex w-full items-center gap-2 rounded-lg px-2.5 py-1.5 text-muted-foreground transition-colors hover:bg-accent/60 hover:text-foreground",children:[i.jsx(To,{className:"h-3.5 w-3.5"}),i.jsx("span",{className:"text-sm",children:l("actions.reportIssue")})]})}),i.jsx("div",{className:"hidden px-2 md:block",children:i.jsxs("a",{href:Pk,target:"_blank",rel:"noopener noreferrer",className:"flex w-full items-center gap-2 rounded-lg px-2.5 py-1.5 text-muted-foreground transition-colors hover:bg-accent/60 hover:text-foreground",children:[i.jsx(Lk,{className:"h-3.5 w-3.5"}),i.jsx("span",{className:"text-sm",children:l("actions.joinCommunity")})]})}),s&&i.jsx("div",{className:"hidden px-2 pt-1.5 md:block",children:i.jsxs("button",{className:"group flex w-full items-center gap-2.5 rounded-lg border border-primary/25 bg-primary/5 px-2.5 py-2 text-left transition-colors hover:bg-primary/10",onClick:s,children:[i.jsx("div",{className:"flex h-7 w-7 items-center justify-center rounded-md bg-primary/10 text-primary",children:i.jsx($n,{className:"h-3.5 w-3.5"})}),i.jsxs("div",{className:"min-w-0 flex-1",children:[i.jsx("span",{className:"block truncate text-sm font-semibold text-foreground",children:l("actions.controlRoom",{defaultValue:"Control Room"})}),i.jsx("span",{className:"block truncate text-[10px] text-muted-foreground",children:l("actions.controlRoomDescription",{defaultValue:"Admin, access, runs"})})]})]})}),i.jsx("div",{className:"hidden px-2 py-1.5 md:block",children:i.jsxs("button",{className:"flex w-full items-center gap-2 rounded-lg px-2.5 py-1.5 text-muted-foreground transition-colors hover:bg-accent/60 hover:text-foreground",onClick:o,children:[i.jsx(Ht,{className:"h-3.5 w-3.5"}),i.jsx("span",{className:"text-sm",children:l("actions.settings")})]})}),i.jsx("div",{className:"hidden px-3 py-2 text-center md:block",children:i.jsxs("a",{href:r9,target:"_blank",rel:"noopener noreferrer",className:"text-[10px] text-muted-foreground/40 transition-colors hover:text-muted-foreground",children:["Pixcode v",n," – ",l("branding.openSource")]})}),i.jsx("div",{className:"px-3 pt-3 md:hidden",children:i.jsxs("a",{href:_k,target:"_blank",rel:"noopener noreferrer",className:"flex h-12 w-full items-center gap-3.5 rounded-xl bg-muted/40 px-4 transition-all hover:bg-muted/60 active:scale-[0.98]",children:[i.jsx("div",{className:"flex h-8 w-8 items-center justify-center rounded-xl bg-background/80",children:i.jsx(To,{className:"w-4.5 h-4.5 text-muted-foreground"})}),i.jsx("span",{className:"text-base font-medium text-foreground",children:l("actions.reportIssue")})]})}),i.jsx("div",{className:"px-3 pt-2 md:hidden",children:i.jsxs("a",{href:Pk,target:"_blank",rel:"noopener noreferrer",className:"flex h-12 w-full items-center gap-3.5 rounded-xl bg-muted/40 px-4 transition-all hover:bg-muted/60 active:scale-[0.98]",children:[i.jsx("div",{className:"flex h-8 w-8 items-center justify-center rounded-xl bg-background/80",children:i.jsx(Lk,{className:"w-4.5 h-4.5 text-muted-foreground"})}),i.jsx("span",{className:"text-base font-medium text-foreground",children:l("actions.joinCommunity")})]})}),s&&i.jsx("div",{className:"px-3 pt-2 md:hidden",children:i.jsxs("button",{className:"flex h-14 w-full items-center gap-3.5 rounded-xl border border-primary/25 bg-primary/10 px-4 transition-all hover:bg-primary/15 active:scale-[0.98]",onClick:s,children:[i.jsx("div",{className:"flex h-9 w-9 items-center justify-center rounded-xl bg-primary/15",children:i.jsx($n,{className:"w-4.5 h-4.5 text-primary"})}),i.jsxs("div",{className:"min-w-0 flex-1 text-left",children:[i.jsx("span",{className:"block truncate text-base font-semibold text-foreground",children:l("actions.controlRoom",{defaultValue:"Control Room"})}),i.jsx("span",{className:"block truncate text-xs text-muted-foreground",children:l("actions.controlRoomDescription",{defaultValue:"Admin, access, runs"})})]})]})}),i.jsx("div",{className:"px-3 pb-3 pt-2 md:hidden",children:i.jsxs("button",{className:"flex h-12 w-full items-center gap-3.5 rounded-xl bg-muted/40 px-4 transition-all hover:bg-muted/60 active:scale-[0.98]",onClick:o,children:[i.jsx("div",{className:"flex h-8 w-8 items-center justify-center rounded-xl bg-background/80",children:i.jsx(Ht,{className:"w-4.5 h-4.5 text-muted-foreground"})}),i.jsx("span",{className:"text-base font-medium text-foreground",children:l("actions.settings")})]})})]})}const Dk="PIXCODE_GITHUB_STARS",Ok="PIXCODE_HIDE_GITHUB_STAR",a9=3600*1e3,i9=(e,t)=>{const[r,n]=m.useState(null),[a,s]=m.useState(()=>{try{return localStorage.getItem(Ok)==="true"}catch{return!1}});m.useEffect(()=>{if(a)return;try{const d=localStorage.getItem(Dk);if(d){const u=JSON.parse(d);if(Date.now()-u.timestamp<a9){n(u.count);return}}}catch{}(async()=>{try{const d=await fetch(`https://api.github.com/repos/${e}/${t}`);if(!d.ok)return;const p=(await d.json()).stargazers_count;if(typeof p=="number"){n(p);try{localStorage.setItem(Dk,JSON.stringify({count:p,timestamp:Date.now()}))}catch{}}}catch{}})()},[e,t,a]);const o=m.useCallback(()=>{s(!0);try{localStorage.setItem(Ok,"true")}catch{}},[]),l=r!==null?r>=1e3?`${(r/1e3).toFixed(1)}k`:`${r}`:null;return{starCount:r,formattedCount:l,isDismissed:a,dismiss:o}},s9="https://github.com/alicomert/pixcode";function o9({className:e}){return i.jsx("svg",{className:e,fill:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:i.jsx("path",{d:"M12 2C6.477 2 2 6.484 2 12.017c0 4.425 2.865 8.18 6.839 9.504.5.092.682-.217.682-.483 0-.237-.008-.868-.013-1.703-2.782.605-3.369-1.343-3.369-1.343-.454-1.158-1.11-1.466-1.11-1.466-.908-.62.069-.608.069-.608 1.003.07 1.531 1.032 1.531 1.032.892 1.53 2.341 1.088 2.91.832.092-.647.35-1.088.636-1.338-2.22-.253-4.555-1.113-4.555-4.951 0-1.093.39-1.988 1.029-2.688-.103-.253-.446-1.272.098-2.65 0 0 .84-.27 2.75 1.026A9.564 9.564 0 0112 6.844c.85.004 1.705.115 2.504.337 1.909-1.296 2.747-1.027 2.747-1.027.546 1.379.202 2.398.1 2.651.64.7 1.028 1.595 1.028 2.688 0 3.848-2.339 4.695-4.566 4.943.359.309.678.92.678 1.855 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.019 10.019 0 0022 12.017C22 6.484 17.522 2 12 2z"})})}function l9(){const{formattedCount:e,isDismissed:t,dismiss:r}=i9("alicomert","pixcode");return t?null:i.jsxs("div",{className:"group/star relative hidden md:block",children:[i.jsxs("a",{href:s9,target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-1.5 rounded-lg border border-border/50 bg-muted/30 px-2.5 py-1 text-xs text-muted-foreground transition-colors hover:bg-muted/50 hover:text-foreground",children:[i.jsx(o9,{className:"h-3.5 w-3.5"}),i.jsx(Ei,{className:"h-3 w-3"}),i.jsx("span",{className:"font-medium",children:"Star"}),e&&i.jsx("span",{className:"border-l border-border/50 pl-1.5 tabular-nums",children:e})]}),i.jsx("button",{onClick:n=>{n.preventDefault(),n.stopPropagation(),r()},className:"absolute -right-1.5 -top-1.5 hidden h-4 w-4 items-center justify-center rounded-full border border-border/50 bg-muted text-muted-foreground transition-colors hover:text-foreground group-hover/star:flex","aria-label":"Dismiss",children:i.jsx(Ct,{className:"h-2.5 w-2.5"})})]})}function Mk({value:e,onChange:t,t:r}){const n="flex flex-1 items-center justify-center gap-1 rounded-md px-2 py-1 text-[11px] font-medium transition-all";return i.jsxs("div",{role:"tablist","aria-label":r("tooltips.historyView",{defaultValue:"History view"}),className:"flex rounded-lg bg-muted/40 p-0.5",children:[i.jsxs("button",{type:"button",role:"tab","aria-selected":e==="flat",onClick:()=>t("flat"),className:xe(n,e==="flat"?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),title:r("tooltips.historyViewFlat",{defaultValue:"Recent conversations"}),children:[i.jsx($g,{className:"h-3 w-3"}),r("historyView.flat",{defaultValue:"Recent"})]}),i.jsxs("button",{type:"button",role:"tab","aria-selected":e==="grouped",onClick:()=>t("grouped"),className:xe(n,e==="grouped"?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),title:r("tooltips.historyViewGrouped",{defaultValue:"Grouped by project"}),children:[i.jsx(RD,{className:"h-3 w-3"}),r("historyView.grouped",{defaultValue:"By project"})]})]})}function c9({isPWA:e,isMobile:t,isLoading:r,projectsCount:n,searchFilter:a,onSearchFilterChange:s,onClearSearchFilter:o,searchMode:l,onSearchModeChange:c,onRefresh:d,isRefreshing:u,onCreateProject:p,onQuickStartSession:f,onCollapseSidebar:h,historyView:g,onHistoryViewChange:b,t:x}){const y=()=>i.jsxs("div",{className:"flex min-w-0 items-center gap-2.5",children:[i.jsx("svg",{className:"h-6 w-6 flex-shrink-0",viewBox:"0 0 500 500","aria-hidden":"true",children:i.jsx("g",{transform:"translate(250 250) scale(1.25) translate(-250 -250)",children:i.jsxs("g",{transform:"translate(0 500) scale(0.1 -0.1)",fill:"#5C3FFC",children:[i.jsx("path",{d:"M2037 3800 c-104 -40 -191 -134 -231 -250 -23 -67 -20 -82 22 -109 31 -20 287 -177 1009 -618 40 -24 82 -56 93 -70 27 -34 27 -102 0 -136 -11 -13 -106 -78 -212 -143 -106 -64 -201 -124 -210 -132 -16 -14 -18 -41 -18 -302 0 -291 2 -310 38 -310 16 0 267 148 610 359 180 111 270 173 310 213 216 217 215 574 -3 793 -37 38 -107 89 -185 136 -69 42 -253 154 -410 249 -434 264 -509 307 -563 326 -57 20 -191 17 -250 -6z"}),i.jsx("path",{d:"M1803 2994 c-10 -5 -13 -156 -13 -709 0 -671 1 -706 20 -767 27 -89 93 -184 167 -240 89 -67 157 -90 281 -96 92 -4 105 -2 117 14 12 16 14 134 15 735 0 669 -1 718 -17 737 -20 23 -514 322 -541 327 -9 2 -23 2 -29 -1z"})]})})}),i.jsx("h1",{className:"truncate text-sm font-semibold tracking-tight text-foreground",children:x("app.title")})]});return i.jsxs("div",{className:"flex-shrink-0",children:[i.jsxs("div",{className:"hidden px-4 pb-3 pt-4 md:block",style:{},children:[i.jsxs("div",{className:"flex items-center justify-between gap-2",children:[i.jsx(y,{}),i.jsxs("div",{className:"flex flex-shrink-0 items-center gap-0.5",children:[i.jsx(Ne,{variant:"ghost",size:"sm",className:"h-8 w-8 rounded-lg p-0 text-muted-foreground hover:bg-accent/80 hover:text-foreground",onClick:d,disabled:u,title:x("tooltips.refresh"),children:i.jsx(at,{className:`h-4 w-4 ${u?"animate-spin":""}`})}),i.jsx(Ne,{variant:"ghost",size:"sm",className:"h-8 w-8 rounded-lg p-0 text-muted-foreground hover:bg-accent/80 hover:text-foreground",onClick:p,title:x("tooltips.createProject"),children:i.jsx(Ut,{className:"h-4 w-4"})}),i.jsx(Ne,{variant:"ghost",size:"sm",className:"h-8 w-8 rounded-lg p-0 text-muted-foreground hover:bg-accent/80 hover:text-foreground",onClick:h,title:x("tooltips.hideSidebar"),children:i.jsx(Ku,{className:"h-4 w-4"})})]})]}),i.jsx(l9,{}),f&&i.jsxs("button",{type:"button",onClick:()=>{f()},className:"mt-2.5 flex w-full items-center justify-center gap-2 rounded-lg border border-primary/20 bg-primary/5 px-3 py-2 text-sm font-medium text-primary transition-colors hover:bg-primary/10",children:[i.jsx($n,{className:"h-4 w-4"}),x("sidebar.newChat",{defaultValue:"New chat"})]}),n>0&&!r&&i.jsxs("div",{className:"mt-2.5 space-y-2",children:[i.jsx(Mk,{value:g,onChange:b,t:x}),i.jsxs("div",{className:"flex rounded-lg bg-muted/50 p-0.5",children:[i.jsxs("button",{onClick:()=>c("projects"),"aria-pressed":l==="projects",className:xe("flex-1 flex items-center justify-center gap-1.5 rounded-md px-2 py-1.5 text-xs font-medium transition-all",l==="projects"?"bg-background shadow-sm text-foreground":"text-muted-foreground hover:text-foreground"),children:[i.jsx(qr,{className:"h-3 w-3"}),x("search.modeProjects")]}),i.jsxs("button",{onClick:()=>c("conversations"),"aria-pressed":l==="conversations",className:xe("flex-1 flex items-center justify-center gap-1.5 rounded-md px-2 py-1.5 text-xs font-medium transition-all",l==="conversations"?"bg-background shadow-sm text-foreground":"text-muted-foreground hover:text-foreground"),children:[i.jsx(Un,{className:"h-3 w-3"}),x("search.modeConversations")]})]}),i.jsxs("div",{className:"relative",children:[i.jsx(ys,{className:"pointer-events-none absolute left-3 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-muted-foreground/50"}),i.jsx(Je,{type:"text",placeholder:x(l==="conversations"?"search.conversationsPlaceholder":"projects.searchPlaceholder"),value:a,onChange:v=>s(v.target.value),className:"nav-search-input h-9 rounded-xl border-0 pl-9 pr-8 text-sm transition-all duration-200 placeholder:text-muted-foreground/40 focus-visible:ring-0 focus-visible:ring-offset-0"}),a&&i.jsx("button",{onClick:o,"aria-label":x("tooltips.clearSearch"),className:"absolute right-2.5 top-1/2 -translate-y-1/2 rounded-md p-0.5 hover:bg-accent",children:i.jsx(Ct,{className:"h-3 w-3 text-muted-foreground"})})]})]})]}),i.jsx("div",{className:"nav-divider hidden md:block"}),i.jsxs("div",{className:"p-3 pb-2 md:hidden",style:e&&t?{paddingTop:"16px"}:{},children:[i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsx(y,{}),i.jsxs("div",{className:"flex flex-shrink-0 gap-1.5",children:[i.jsx("button",{className:"flex h-8 w-8 items-center justify-center rounded-lg bg-muted/50 transition-all active:scale-95",onClick:d,disabled:u,children:i.jsx(at,{className:`h-4 w-4 text-muted-foreground ${u?"animate-spin":""}`})}),i.jsx("button",{className:"flex h-8 w-8 items-center justify-center rounded-lg bg-primary/90 text-primary-foreground transition-all active:scale-95",onClick:p,children:i.jsx(ji,{className:"h-4 w-4"})})]})]}),n>0&&!r&&i.jsxs("div",{className:"mt-2.5 space-y-2",children:[l==="projects"&&i.jsx(Mk,{value:g,onChange:b,t:x}),i.jsxs("div",{className:"flex rounded-lg bg-muted/50 p-0.5",children:[i.jsxs("button",{onClick:()=>c("projects"),"aria-pressed":l==="projects",className:xe("flex-1 flex items-center justify-center gap-1.5 rounded-md px-2 py-1.5 text-xs font-medium transition-all",l==="projects"?"bg-background shadow-sm text-foreground":"text-muted-foreground hover:text-foreground"),children:[i.jsx(qr,{className:"h-3 w-3"}),x("search.modeProjects")]}),i.jsxs("button",{onClick:()=>c("conversations"),"aria-pressed":l==="conversations",className:xe("flex-1 flex items-center justify-center gap-1.5 rounded-md px-2 py-1.5 text-xs font-medium transition-all",l==="conversations"?"bg-background shadow-sm text-foreground":"text-muted-foreground hover:text-foreground"),children:[i.jsx(Un,{className:"h-3 w-3"}),x("search.modeConversations")]})]}),i.jsxs("div",{className:"relative",children:[i.jsx(ys,{className:"pointer-events-none absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground/50"}),i.jsx(Je,{type:"text",placeholder:x(l==="conversations"?"search.conversationsPlaceholder":"projects.searchPlaceholder"),value:a,onChange:v=>s(v.target.value),className:"nav-search-input h-10 rounded-xl border-0 pl-10 pr-9 text-sm transition-all duration-200 placeholder:text-muted-foreground/40 focus-visible:ring-0 focus-visible:ring-offset-0"}),a&&i.jsx("button",{onClick:o,"aria-label":x("tooltips.clearSearch"),className:"absolute right-2.5 top-1/2 -translate-y-1/2 rounded-md p-1 hover:bg-accent",children:i.jsx(Ct,{className:"h-3.5 w-3.5 text-muted-foreground"})})]})]})]}),i.jsx("div",{className:"nav-divider md:hidden"})]})}const d9=160,Fk=180;function QE({actions:e,className:t,triggerLabel:r}){const[n,a]=m.useState(!1),[s,o]=m.useState(null),l=m.useRef(null),c=m.useRef(null);m.useLayoutEffect(()=>{if(!n||!l.current)return;const u=l.current.getBoundingClientRect();let p=u.right-d9;p<8&&(p=8);let f=u.bottom+4;f+Fk>window.innerHeight&&(f=Math.max(8,u.top-4-Fk)),o({top:f,left:p})},[n]),m.useEffect(()=>{if(!n)return;const u=h=>{const g=h.target;l.current?.contains(g)||c.current?.contains(g)||a(!1)},p=h=>{h.key==="Escape"&&a(!1)},f=()=>a(!1);return document.addEventListener("mousedown",u),document.addEventListener("keydown",p),window.addEventListener("scroll",f,!0),window.addEventListener("resize",f),()=>{document.removeEventListener("mousedown",u),document.removeEventListener("keydown",p),window.removeEventListener("scroll",f,!0),window.removeEventListener("resize",f)}},[n]);const d=u=>p=>{p.stopPropagation(),p.preventDefault(),a(!1),u.onClick()};return i.jsxs(i.Fragment,{children:[i.jsx("button",{ref:l,type:"button","aria-haspopup":"menu","aria-expanded":n,"aria-label":r||"Actions",title:r||"Actions",onClick:u=>{u.stopPropagation(),u.preventDefault(),a(p=>!p)},className:xe("flex h-6 w-6 items-center justify-center rounded-md text-muted-foreground","opacity-0 transition-all duration-150 hover:bg-accent hover:text-foreground","group-hover:opacity-100 focus-visible:opacity-100 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-primary","touch:opacity-100",n&&"bg-accent text-foreground opacity-100",t),children:i.jsx(B4,{className:"h-3.5 w-3.5"})}),n&&s&&Vu.createPortal(i.jsx("div",{ref:c,role:"menu",style:{position:"fixed",top:s.top,left:s.left,zIndex:9999},className:xe("w-40 rounded-xl border border-border/60 bg-popover p-1 shadow-lg","animate-in fade-in-0 zoom-in-95 duration-100"),onClick:u=>u.stopPropagation(),onMouseDown:u=>u.stopPropagation(),children:e.map((u,p)=>{const f=u.icon,h=e[p-1],g=p>0&&u.danger&&!h?.danger;return i.jsxs("div",{children:[g&&i.jsx("div",{className:"my-1 h-px bg-border/60"}),i.jsxs("button",{type:"button",role:"menuitem",onClick:d(u),className:xe("flex w-full items-center gap-2 rounded-md px-2 py-1.5 text-left text-xs",u.danger?"text-red-600 hover:bg-red-50 dark:text-red-400 dark:hover:bg-red-900/20":"text-foreground hover:bg-accent"),children:[i.jsx(f,{className:"h-3 w-3"}),u.label]})]},u.id)})}),document.body)]})}const u9=(e,t,r)=>{const n=new Date(e),a=t;if(isNaN(n.getTime()))return r?r("status.unknown"):"Unknown";const s=a.getTime()-n.getTime(),o=Math.floor(s/1e3),l=Math.floor(s/(1e3*60)),c=Math.floor(s/(1e3*60*60)),d=Math.floor(s/(1e3*60*60*24));return o<60?r?r("time.justNow"):"Just now":l===1?r?r("time.oneMinuteAgo"):"1 min ago":l<60?r?r("time.minutesAgo",{count:l}):`${l} mins ago`:c===1?r?r("time.oneHourAgo"):"1 hour ago":c<24?r?r("time.hoursAgo",{count:c}):`${c} hours ago`:d===1?r?r("time.oneDayAgo"):"1 day ago":d<7?r?r("time.daysAgo",{count:d}):`${d} days ago`:n.toLocaleDateString()};function zk({isStarred:e,canDelete:t,onRename:r,onToggleStar:n,onDelete:a,t:s,className:o}){const l=d=>i.jsx(Ei,{className:`${d.className??""} ${e?"fill-yellow-400 text-yellow-500":""}`}),c=[{id:"rename",label:s("actions.rename"),icon:F4,onClick:r},{id:"star",label:e?s("actions.unstarSession",{defaultValue:"Remove star"}):s("actions.starSession",{defaultValue:"Star"}),icon:l,onClick:n}];return t&&c.push({id:"delete",label:s("actions.delete"),icon:Br,onClick:a,danger:!0}),i.jsx(QE,{actions:c,className:o,triggerLabel:s("tooltips.sessionActions",{defaultValue:"Session actions"})})}const p9={claude:"Claude",cursor:"Cursor",codex:"Codex",gemini:"Gemini",qwen:"Qwen Code",opencode:"OpenCode"},Bk={claude:"bg-orange-500/10 text-orange-600 dark:bg-orange-400/10 dark:text-orange-300 ring-1 ring-orange-500/15",cursor:"bg-sky-500/10 text-sky-600 dark:bg-sky-400/10 dark:text-sky-300 ring-1 ring-sky-500/15",codex:"bg-violet-500/10 text-violet-600 dark:bg-violet-400/10 dark:text-violet-300 ring-1 ring-violet-500/15",gemini:"bg-emerald-500/10 text-emerald-600 dark:bg-emerald-400/10 dark:text-emerald-300 ring-1 ring-emerald-500/15",qwen:"bg-amber-500/10 text-amber-600 dark:bg-amber-400/10 dark:text-amber-300 ring-1 ring-amber-500/15",opencode:"bg-teal-500/10 text-teal-600 dark:bg-teal-400/10 dark:text-teal-300 ring-1 ring-teal-500/15"};function e3({project:e,session:t,selectedSession:r,currentTime:n,editingSession:a,editingSessionName:s,isStarred:o,compact:l=!1,onEditingSessionNameChange:c,onStartEditingSession:d,onCancelEditingSession:u,onSaveEditingSession:p,onToggleStarSession:f,onProjectSelect:h,onSessionSelect:g,onDeleteSession:b,t:x}){const y=JO(t,n,x),v=r?.id===t.id,w=a===t.id,k=t.__provider,S=p9[k]??k,N=Bk[k]??Bk.claude,E=YO(y.sessionName),I=()=>{h(e),g(t,e.name)},A=()=>{p(e.name,t.id,s,k)},T=()=>{b(e.name,t.id,y.sessionName,k)},_=()=>d(t.id,y.sessionName),j=()=>f(e.name,t.id),R=i.jsxs("div",{className:"mt-0.5 flex min-w-0 flex-wrap items-center gap-1 text-[10px] leading-tight",children:[i.jsxs("span",{className:xe("inline-flex items-center gap-1 rounded-full px-1.5 py-px font-medium",N),children:[i.jsx(er,{provider:k,className:"h-2.5 w-2.5"}),S]}),i.jsx("span",{className:"text-muted-foreground/80",children:u9(y.sessionTime,n,x)}),y.isActive&&i.jsxs("span",{className:"inline-flex items-center gap-1 text-green-600 dark:text-green-400",children:[i.jsx("span",{className:"h-1.5 w-1.5 animate-pulse rounded-full bg-green-500"}),x("status.active",{defaultValue:"Active"})]}),E.slice(0,3).map(F=>i.jsxs("span",{className:"rounded-md bg-muted/60 px-1 py-px font-mono text-[9px] uppercase tracking-wide text-muted-foreground ring-1 ring-border/40",children:[".",F]},F))]}),C=i.jsxs(i.Fragment,{children:[i.jsx("input",{type:"text",value:s,onChange:F=>c(F.target.value),onKeyDown:F=>{F.stopPropagation(),F.key==="Enter"?A():F.key==="Escape"&&u()},onClick:F=>F.stopPropagation(),className:"w-full rounded-md border border-primary/40 bg-background px-2 py-1 text-xs focus:outline-none focus:ring-1 focus:ring-primary",autoFocus:!0}),i.jsx("button",{className:"flex h-6 w-6 items-center justify-center rounded-md bg-green-50 hover:bg-green-100 dark:bg-green-900/20 dark:hover:bg-green-900/40",onClick:F=>{F.stopPropagation(),A()},title:x("tooltips.save"),children:i.jsx(Gt,{className:"h-3 w-3 text-green-600 dark:text-green-400"})}),i.jsx("button",{className:"flex h-6 w-6 items-center justify-center rounded-md bg-gray-50 hover:bg-gray-100 dark:bg-gray-900/20 dark:hover:bg-gray-900/40",onClick:F=>{F.stopPropagation(),u()},title:x("tooltips.cancel"),children:i.jsx(Ct,{className:"h-3 w-3 text-gray-600 dark:text-gray-400"})})]}),D=i.jsx("div",{className:"md:hidden",children:i.jsx("div",{className:xe("relative mx-3 my-0.5 rounded-lg border border-border/30 bg-card p-2 transition-all duration-150 active:scale-[0.98]",v&&"border-primary/30 bg-primary/5 shadow-sm",!v&&y.isActive&&"border-green-500/25 bg-green-50/5 dark:bg-green-900/5",o&&!v&&"ring-1 ring-yellow-300/50 dark:ring-yellow-500/30"),onClick:w?void 0:I,children:w?i.jsx("div",{className:"flex items-center gap-1",children:C}):i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("div",{className:xe("flex h-6 w-6 flex-shrink-0 items-center justify-center rounded-md",v?"bg-primary/10":"bg-muted/60"),children:i.jsx(er,{provider:k,className:"h-3 w-3"})}),i.jsxs("div",{className:"min-w-0 flex-1",children:[i.jsxs("div",{className:"flex items-center gap-1",children:[o&&i.jsx("span",{className:"text-yellow-500","aria-hidden":!0,children:"★"}),i.jsx("span",{className:"truncate text-xs font-medium text-foreground",children:y.sessionName})]}),R]}),i.jsx("div",{className:"flex-shrink-0",onClick:F=>F.stopPropagation(),children:i.jsx(zk,{isStarred:o,canDelete:!y.isCursorSession,onRename:_,onToggleStar:j,onDelete:T,t:x,className:"!opacity-100"})})]})})}),B=i.jsxs("div",{className:xe("group/item relative hidden md:block"),children:[i.jsxs(Ne,{variant:"ghost",className:xe("relative h-auto w-full justify-start overflow-hidden p-0 text-left font-normal transition-colors duration-150","hover:bg-accent/60",v&&"bg-accent text-accent-foreground",o&&!v&&"bg-yellow-50/40 hover:bg-yellow-100/40 dark:bg-yellow-900/10 dark:hover:bg-yellow-900/20",l?"rounded-xl px-3 py-2.5":"rounded-lg px-3 py-2"),onClick:w?void 0:()=>g(t,e.name),children:[v&&i.jsx("span",{"aria-hidden":!0,className:"absolute left-0 top-1/2 h-5 w-0.5 -translate-y-1/2 rounded-r bg-primary"}),!v&&!w&&i.jsx("span",{"aria-hidden":!0,className:"session-item-accent"}),i.jsxs("div",{className:"flex w-full min-w-0 items-start gap-2 pr-6",children:[i.jsx("div",{className:xe("mt-0.5 flex h-5 w-5 flex-shrink-0 items-center justify-center rounded-md",v?"bg-primary/10":"bg-muted/50 group-hover/item:bg-muted/80"),children:i.jsx(er,{provider:k,className:"h-3 w-3"})}),i.jsx("div",{className:"min-w-0 flex-1",children:w?i.jsx("div",{className:"flex items-center gap-1",children:C}):i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:"flex min-w-0 items-center gap-1",children:[o&&i.jsx("span",{className:"flex-shrink-0 text-yellow-500","aria-hidden":!0,children:"★"}),i.jsx("span",{className:"truncate text-xs font-medium text-foreground",children:y.sessionName})]}),R]})})]})]}),!w&&i.jsx("div",{className:"absolute right-1.5 top-1/2 -translate-y-1/2",onClick:F=>F.stopPropagation(),children:i.jsx(zk,{isStarred:o,canDelete:!y.isCursorSession,onRename:_,onToggleStar:j,onDelete:T,t:x,className:"opacity-0 focus-visible:opacity-100 group-hover/item:opacity-100"})})]});return i.jsxs("div",{className:"group relative",children:[D,B]})}const m9=e=>e==="claude-code"?"claude":e==="codex"?"codex":e==="gemini"?"gemini":e==="qwen"?"qwen":e==="opencode"?"opencode":null;function h9(){return i.jsx(i.Fragment,{children:Array.from({length:3}).map((e,t)=>i.jsx("div",{className:"rounded-md p-2",children:i.jsxs("div",{className:"flex items-start gap-2",children:[i.jsx("div",{className:"mt-0.5 h-3 w-3 animate-pulse rounded-full bg-muted"}),i.jsxs("div",{className:"flex-1 space-y-1",children:[i.jsx("div",{className:"h-3 animate-pulse rounded bg-muted",style:{width:`${60+t*15}%`}}),i.jsx("div",{className:"h-2 w-1/2 animate-pulse rounded bg-muted"})]})]})},t))})}function f9({project:e,isExpanded:t,sessions:r,selectedSession:n,initialSessionsLoaded:a,isLoadingSessions:s,currentTime:o,editingSession:l,editingSessionName:c,isSessionStarred:d,onEditingSessionNameChange:u,onStartEditingSession:p,onCancelEditingSession:f,onSaveEditingSession:h,onToggleStarSession:g,onProjectSelect:b,onSessionSelect:x,onDeleteSession:y,onLoadMoreSessions:v,onNewSession:w,onOpenOrchestration:k,t:S}){const[N,E]=m.useState([]);if(m.useEffect(()=>{if(!t)return;let T=!1;const _=async()=>{const R=await Ce(`/api/orchestration/workflows/runs?projectId=${encodeURIComponent(e.name)}`);if(!R.ok)return;const C=await R.json();T||E((C.runs??[]).slice(0,5))};_();const j=window.setInterval(()=>{_()},15e3);return()=>{T=!0,window.clearInterval(j)}},[t,e.name]),!t)return null;const I=r.length>0,A=e.sessionMeta?.hasMore===!0;return i.jsxs("div",{className:"ml-3 space-y-1 border-l border-border pl-3",children:[i.jsx("div",{className:"px-3 pb-1 pt-1 md:hidden",children:i.jsxs("button",{className:"flex h-8 w-full items-center justify-center gap-2 rounded-md bg-primary text-xs font-medium text-primary-foreground transition-all duration-150 hover:bg-primary/90 active:scale-[0.98]",onClick:()=>{b(e),w(e)},children:[i.jsx(Ut,{className:"h-3 w-3"}),S("sessions.newSession")]})}),i.jsxs(Ne,{variant:"default",size:"sm",className:"hidden h-8 w-full justify-start gap-2 bg-primary text-xs font-medium text-primary-foreground transition-colors hover:bg-primary/90 md:flex",onClick:()=>w(e),children:[i.jsx(Ut,{className:"h-3 w-3"}),S("sessions.newSession")]}),N.length>0&&i.jsxs("div",{className:"space-y-1",children:[i.jsxs("div",{className:"flex items-center gap-1 px-3 pt-2 text-[10px] font-semibold uppercase tracking-wide text-muted-foreground",children:[i.jsx(pr,{className:"h-3 w-3"}),S("orchestration.section")]}),N.map(T=>{const _=[...new Set(T.nodeRuns.map(j=>m9(j.adapterId)).filter(Boolean))];return i.jsx("button",{type:"button",onClick:()=>k?.(e,T.id),className:"w-full rounded-lg px-3 py-2 text-left transition-colors hover:bg-accent/60",children:i.jsxs("div",{className:"flex min-w-0 items-start gap-2",children:[i.jsx(pr,{className:"mt-0.5 h-4 w-4 flex-shrink-0 text-primary"}),i.jsxs("div",{className:"min-w-0 flex-1",children:[i.jsx("div",{className:"truncate text-xs font-medium text-foreground",children:T.input||S("orchestration.fallbackTitle")}),i.jsxs("div",{className:"mt-1 flex items-center gap-1",children:[_.slice(0,4).map(j=>i.jsx("span",{className:"flex h-4 w-4 items-center justify-center rounded bg-muted",children:i.jsx(er,{provider:j,className:"h-3 w-3"})},j)),i.jsx("span",{className:"text-[10px] text-muted-foreground",children:S(`common:orchestration.status.${T.status}`,{defaultValue:T.status})})]})]})]})},T.id)})]}),a?!I&&!s?i.jsx("div",{className:"px-3 py-2 text-left",children:i.jsx("p",{className:"text-xs text-muted-foreground",children:S("sessions.noSessions")})}):r.map(T=>i.jsx(e3,{project:e,session:T,selectedSession:n,currentTime:o,editingSession:l,editingSessionName:c,isStarred:d(e.name,T.id),onEditingSessionNameChange:u,onStartEditingSession:p,onCancelEditingSession:f,onSaveEditingSession:h,onToggleStarSession:g,onProjectSelect:b,onSessionSelect:x,onDeleteSession:y,t:S},T.id)):i.jsx(h9,{}),I&&A&&i.jsx(Ne,{variant:"ghost",size:"sm",className:"mt-2 w-full justify-center gap-2 text-muted-foreground",onClick:()=>v(e),disabled:s,children:s?i.jsxs(i.Fragment,{children:[i.jsx("div",{className:"h-3 w-3 animate-spin rounded-full border border-muted-foreground border-t-transparent"}),S("sessions.loading")]}):i.jsxs(i.Fragment,{children:[i.jsx(Mn,{className:"h-3 w-3"}),S("sessions.showMore")]})})]})}const g9=(e,t)=>{const r=e.length;return t&&r>=5?`${r}+`:`${r}`};function b9({project:e,selectedProject:t,selectedSession:r,isExpanded:n,isDeleting:a,isStarred:s,editingProject:o,editingName:l,sessions:c,initialSessionsLoaded:d,isLoadingSessions:u,currentTime:p,editingSession:f,editingSessionName:h,isSessionStarred:g,onEditingNameChange:b,onToggleProject:x,onProjectSelect:y,onToggleStarProject:v,onToggleStarSession:w,onStartEditingProject:k,onCancelEditingProject:S,onSaveProjectName:N,onDeleteProject:E,onSessionSelect:I,onDeleteSession:A,onLoadMoreSessions:T,onNewSession:_,onOpenOrchestration:j,onEditingSessionNameChange:R,onStartEditingSession:C,onCancelEditingSession:D,onSaveEditingSession:B,t:F}){const V=t?.name===e.name,K=o===e.name,L=e.sessionMeta?.hasMore===!0,G=g9(c,L),H=`${G} session${c.length===1?"":"s"}`,z=()=>x(e.name),te=()=>v(e.name),se=()=>{N(e.name)},me=()=>{t?.name!==e.name&&y(e),z()};return i.jsxs("div",{className:xe("md:space-y-1",a&&"opacity-50 pointer-events-none"),children:[i.jsxs("div",{className:"md:group group",children:[i.jsx("div",{className:"md:hidden",children:i.jsx("div",{className:xe("p-3 mx-3 my-1 rounded-lg bg-card border border-border/50 active:scale-[0.98] transition-all duration-150",V&&"bg-primary/5 border-primary/20",s&&!V&&"bg-yellow-50/50 dark:bg-yellow-900/5 border-yellow-200/30 dark:border-yellow-800/30"),onClick:z,children:i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsxs("div",{className:"flex min-w-0 flex-1 items-center gap-3",children:[i.jsx("div",{className:xe("w-8 h-8 rounded-lg flex items-center justify-center transition-colors",n?"bg-primary/10":"bg-muted"),children:n?i.jsx(Bn,{className:"h-4 w-4 text-primary"}):i.jsx(qr,{className:"h-4 w-4 text-muted-foreground"})}),i.jsx("div",{className:"min-w-0 flex-1",children:K?i.jsx("input",{type:"text",value:l,onChange:de=>b(de.target.value),className:"w-full rounded-lg border-2 border-primary/40 bg-background px-3 py-2 text-sm text-foreground shadow-sm transition-all duration-200 focus:border-primary focus:shadow-md focus:outline-none",placeholder:F("projects.projectNamePlaceholder"),autoFocus:!0,autoComplete:"off",onClick:de=>de.stopPropagation(),onKeyDown:de=>{de.key==="Enter"&&se(),de.key==="Escape"&&S()},style:{fontSize:"16px",WebkitAppearance:"none",borderRadius:"8px"}}):i.jsxs(i.Fragment,{children:[i.jsx("div",{className:"flex min-w-0 flex-1 items-center justify-between",children:i.jsx("h3",{className:"truncate text-sm font-medium text-foreground",children:e.displayName})}),i.jsx("p",{className:"text-xs text-muted-foreground",children:H})]})})]}),i.jsx("div",{className:"flex items-center gap-1",children:K?i.jsxs(i.Fragment,{children:[i.jsx("button",{className:"flex h-8 w-8 items-center justify-center rounded-lg bg-green-500 shadow-sm transition-all duration-150 active:scale-90 active:shadow-none dark:bg-green-600",onClick:de=>{de.stopPropagation(),se()},children:i.jsx(Gt,{className:"h-4 w-4 text-white"})}),i.jsx("button",{className:"flex h-8 w-8 items-center justify-center rounded-lg bg-gray-500 shadow-sm transition-all duration-150 active:scale-90 active:shadow-none dark:bg-gray-600",onClick:de=>{de.stopPropagation(),S()},children:i.jsx(Ct,{className:"h-4 w-4 text-white"})})]}):i.jsxs(i.Fragment,{children:[i.jsx("button",{className:xe("w-8 h-8 rounded-lg flex items-center justify-center active:scale-90 transition-all duration-150 border",s?"bg-yellow-500/10 dark:bg-yellow-900/30 border-yellow-200 dark:border-yellow-800":"bg-gray-500/10 dark:bg-gray-900/30 border-gray-200 dark:border-gray-800"),onClick:de=>{de.stopPropagation(),te()},title:F(s?"tooltips.removeFromFavorites":"tooltips.addToFavorites"),children:i.jsx(Ei,{className:xe("w-4 h-4 transition-colors",s?"text-yellow-600 dark:text-yellow-400 fill-current":"text-gray-600 dark:text-gray-400")})}),i.jsx("button",{className:"flex h-8 w-8 items-center justify-center rounded-lg border border-red-200 bg-red-500/10 active:scale-90 dark:border-red-800 dark:bg-red-900/30",onClick:de=>{de.stopPropagation(),E(e)},children:i.jsx(Br,{className:"h-4 w-4 text-red-600 dark:text-red-400"})}),i.jsx("button",{className:"flex h-8 w-8 items-center justify-center rounded-lg border border-primary/20 bg-primary/10 active:scale-90 dark:border-primary/30 dark:bg-primary/20",onClick:de=>{de.stopPropagation(),k(e)},children:i.jsx(cf,{className:"h-4 w-4 text-primary"})}),i.jsx("div",{className:"flex h-6 w-6 items-center justify-center rounded-md bg-muted/30",children:n?i.jsx(Mn,{className:"h-3 w-3 text-muted-foreground"}):i.jsx(Fn,{className:"h-3 w-3 text-muted-foreground"})})]})})]})})}),i.jsxs(Ne,{variant:"ghost",className:xe("hidden md:flex w-full justify-between p-2 h-auto font-normal hover:bg-accent/50",V&&"bg-accent text-accent-foreground",s&&!V&&"bg-yellow-50/50 dark:bg-yellow-900/10 hover:bg-yellow-100/50 dark:hover:bg-yellow-900/20"),onClick:me,children:[i.jsxs("div",{className:"flex min-w-0 flex-1 items-center gap-3",children:[n?i.jsx(Bn,{className:"h-4 w-4 flex-shrink-0 text-primary"}):i.jsx(qr,{className:"h-4 w-4 flex-shrink-0 text-muted-foreground"}),i.jsx("div",{className:"min-w-0 flex-1 text-left",children:K?i.jsxs("div",{className:"space-y-1",children:[i.jsx("input",{type:"text",value:l,onChange:de=>b(de.target.value),className:"w-full rounded border border-border bg-background px-2 py-1 text-sm text-foreground focus:ring-2 focus:ring-primary/20",placeholder:F("projects.projectNamePlaceholder"),autoFocus:!0,onKeyDown:de=>{de.key==="Enter"&&se(),de.key==="Escape"&&S()}}),i.jsx("div",{className:"truncate text-xs text-muted-foreground",title:e.fullPath,children:e.fullPath})]}):i.jsxs("div",{children:[i.jsx("div",{className:"truncate text-sm font-semibold text-foreground",title:e.displayName,children:e.displayName}),i.jsxs("div",{className:"text-xs text-muted-foreground",children:[G,e.fullPath!==e.displayName&&i.jsxs("span",{className:"ml-1 opacity-60",title:e.fullPath,children:[" - ",e.fullPath.length>25?`...${e.fullPath.slice(-22)}`:e.fullPath]})]})]})})]}),i.jsx("div",{className:"flex flex-shrink-0 items-center gap-1",children:K?i.jsxs(i.Fragment,{children:[i.jsx("div",{className:"flex h-6 w-6 cursor-pointer items-center justify-center rounded text-green-600 transition-colors hover:bg-green-50 hover:text-green-700 dark:hover:bg-green-900/20",onClick:de=>{de.stopPropagation(),se()},children:i.jsx(Gt,{className:"h-3 w-3"})}),i.jsx("div",{className:"flex h-6 w-6 cursor-pointer items-center justify-center rounded text-gray-500 transition-colors hover:bg-gray-50 hover:text-gray-700 dark:hover:bg-gray-800",onClick:de=>{de.stopPropagation(),S()},children:i.jsx(Ct,{className:"h-3 w-3"})})]}):i.jsxs(i.Fragment,{children:[s&&i.jsx("div",{className:"flex h-6 w-6 cursor-pointer items-center justify-center rounded hover:bg-yellow-50 dark:hover:bg-yellow-900/20",onClick:de=>{de.stopPropagation(),te()},title:F("tooltips.removeFromFavorites"),children:i.jsx(Ei,{className:"h-3 w-3 fill-current text-yellow-600 dark:text-yellow-400"})}),i.jsx(QE,{triggerLabel:F("tooltips.projectActions",{defaultValue:"Project actions"}),actions:[{id:"rename",label:F("actions.rename"),icon:cf,onClick:()=>k(e)},{id:"star",label:F(s?"tooltips.removeFromFavorites":"tooltips.addToFavorites"),icon:Ei,onClick:te},{id:"delete",label:F("actions.delete",{defaultValue:"Delete"}),icon:Br,onClick:()=>E(e),danger:!0}]}),n?i.jsx(Mn,{className:"h-4 w-4 text-muted-foreground transition-colors group-hover:text-foreground"}):i.jsx(Fn,{className:"h-4 w-4 text-muted-foreground transition-colors group-hover:text-foreground"})]})})]})]}),i.jsx(f9,{project:e,isExpanded:n,sessions:c,selectedSession:r,initialSessionsLoaded:d,isLoadingSessions:u,currentTime:p,editingSession:f,editingSessionName:h,isSessionStarred:g,onEditingSessionNameChange:R,onStartEditingSession:C,onCancelEditingSession:D,onSaveEditingSession:B,onToggleStarSession:w,onProjectSelect:y,onSessionSelect:I,onDeleteSession:A,onLoadMoreSessions:T,onNewSession:_,onOpenOrchestration:j,t:F})]})}function t3({isLoading:e,loadingProgress:t,projectsCount:r,filteredProjectsCount:n,t:a}){return e?i.jsxs("div",{className:"px-4 py-12 text-center md:py-8",children:[i.jsx("div",{className:"mx-auto mb-4 flex h-12 w-12 items-center justify-center rounded-lg bg-muted md:mb-3",children:i.jsx("div",{className:"h-6 w-6 animate-spin rounded-full border-2 border-muted-foreground border-t-transparent"})}),i.jsx("h3",{className:"mb-2 text-base font-medium text-foreground md:mb-1",children:a("projects.loadingProjects")}),t&&t.total>0?i.jsxs("div",{className:"space-y-2",children:[i.jsx("div",{className:"h-2 w-full overflow-hidden rounded-full bg-muted",children:i.jsx("div",{className:"h-full bg-primary transition-all duration-300 ease-out",style:{width:`${t.current/t.total*100}%`}})}),i.jsxs("p",{className:"text-sm text-muted-foreground",children:[t.current,"/",t.total," ",a("projects.projects")]}),t.currentProject&&i.jsx("p",{className:"mx-auto max-w-[200px] truncate text-xs text-muted-foreground/70",title:t.currentProject,children:t.currentProject.split("-").slice(-2).join("/")})]}):i.jsx("p",{className:"text-sm text-muted-foreground",children:a("projects.fetchingProjects")})]}):r===0?i.jsxs("div",{className:"px-4 py-12 text-center md:py-8",children:[i.jsx("div",{className:"mx-auto mb-4 flex h-12 w-12 items-center justify-center rounded-lg bg-muted md:mb-3",children:i.jsx(qr,{className:"h-6 w-6 text-muted-foreground"})}),i.jsx("h3",{className:"mb-2 text-base font-medium text-foreground md:mb-1",children:a("projects.noProjects")}),i.jsx("p",{className:"text-sm text-muted-foreground",children:a("projects.runClaudeCli")})]}):n===0?i.jsxs("div",{className:"px-4 py-12 text-center md:py-8",children:[i.jsx("div",{className:"mx-auto mb-4 flex h-12 w-12 items-center justify-center rounded-lg bg-muted md:mb-3",children:i.jsx(ys,{className:"h-6 w-6 text-muted-foreground"})}),i.jsx("h3",{className:"mb-2 text-base font-medium text-foreground md:mb-1",children:a("projects.noMatchingProjects")}),i.jsx("p",{className:"text-sm text-muted-foreground",children:a("projects.tryDifferentSearch")})]}):null}function x9({projects:e,filteredProjects:t,selectedProject:r,selectedSession:n,isLoading:a,loadingProgress:s,expandedProjects:o,editingProject:l,editingName:c,loadingSessions:d,initialSessionsLoaded:u,currentTime:p,editingSession:f,editingSessionName:h,deletingProjects:g,getProjectSessions:b,isProjectStarred:x,isSessionStarred:y,onEditingNameChange:v,onToggleProject:w,onProjectSelect:k,onToggleStarProject:S,onToggleStarSession:N,onStartEditingProject:E,onCancelEditingProject:I,onSaveProjectName:A,onDeleteProject:T,onSessionSelect:_,onDeleteSession:j,onLoadMoreSessions:R,onNewSession:C,onOpenOrchestration:D,onEditingSessionNameChange:B,onStartEditingSession:F,onCancelEditingSession:V,onSaveEditingSession:K,t:L}){const G=i.jsx(t3,{isLoading:a,loadingProgress:s,projectsCount:e.length,filteredProjectsCount:t.length,t:L});m.useEffect(()=>{let de="Pixcode";const ce=r?.displayName?.trim();ce&&(de=`${ce} - ${de}`),document.title=de},[r]);const H=!a&&e.length>0&&t.length>0,z=de=>de.source==="history"||de.autoDiscovered===!0&&de.isManuallyAdded!==!0,te=t.filter(de=>!z(de)),se=t.filter(de=>z(de)),me=de=>i.jsx(b9,{project:de,selectedProject:r,selectedSession:n,isExpanded:o.has(de.name),isDeleting:g.has(de.name),isStarred:x(de.name),editingProject:l,editingName:c,sessions:b(de),initialSessionsLoaded:u.has(de.name),isLoadingSessions:!!d[de.name],currentTime:p,editingSession:f,editingSessionName:h,isSessionStarred:y,onEditingNameChange:v,onToggleProject:w,onProjectSelect:k,onToggleStarProject:S,onToggleStarSession:N,onStartEditingProject:E,onCancelEditingProject:I,onSaveProjectName:A,onDeleteProject:T,onSessionSelect:_,onDeleteSession:j,onLoadMoreSessions:R,onNewSession:C,onOpenOrchestration:D,onEditingSessionNameChange:B,onStartEditingSession:F,onCancelEditingSession:V,onSaveEditingSession:K,t:L},de.name);return i.jsx("div",{className:"pb-safe-area-inset-bottom md:space-y-1",children:H?i.jsxs(i.Fragment,{children:[te.map(de=>me(de)),se.length>0&&i.jsxs(i.Fragment,{children:[i.jsx("div",{className:"px-3 pb-1 pt-3 text-[11px] font-semibold uppercase tracking-wide text-gray-500 dark:text-gray-400",children:L("projects.detectedFromHistory")}),se.map(de=>me(de))]})]}):G})}function Ma(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function r3(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,e.__proto__=t}/*!
221
221
  * GSAP 3.15.0
222
222
  * https://gsap.com
223
223
  *
@@ -666,15 +666,15 @@ https://github.com/nodeca/pako/blob/main/LICENSE
666
666
  `)}):null]})]})]})})]})}function Ire(e,t=68){const r=String(e||"").replace(/\s+/g," ").trim();return r.length>t?`${r.slice(0,t-1)}...`:r}async function Wh(e,t){const r=await Ce(e,t),n=await r.json().catch(()=>({}));if(!r.ok)throw new Error(n?.error?.message||n?.error||`HTTP ${r.status}`);return n}function $I(){const[e,t]=m.useState(null),[r,n]=m.useState([]),[a,s]=m.useState(null),[o,l]=m.useState(!1),c=m.useCallback(async()=>{l(!0),s(null);try{const[p,f]=await Promise.all([Wh("/api/remote/control-room"),Wh("/api/orchestration/workflows/approvals")]);t(p.controlRoom),n(f.pendingApprovals)}catch(p){s(p instanceof Error?p.message:String(p))}finally{l(!1)}},[]);m.useEffect(()=>{c()},[c]);const d=m.useCallback(async(p,f)=>{await Wh(`/api/orchestration/workflows/approvals/${encodeURIComponent(p)}`,{method:"POST",body:JSON.stringify({allow:f,source:"ui"})}),await c()},[c]),u=e?.totals;return i.jsxs("div",{className:"flex h-full min-h-0 flex-col overflow-hidden bg-background",children:[i.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3 border-b border-border/60 px-4 py-3",children:[i.jsxs("div",{className:"min-w-0",children:[i.jsxs("div",{className:"flex items-center gap-2 text-sm font-semibold text-foreground",children:[i.jsx(Ac,{className:"h-4 w-4"}),"Remote console"]}),i.jsx("div",{className:"mt-0.5 truncate text-xs text-muted-foreground",children:e?.generatedAt?new Date(e.generatedAt).toLocaleString():"Not synced"})]}),i.jsxs(Ne,{size:"sm",variant:"outline",onClick:()=>{c()},disabled:o,children:[i.jsx(at,{className:`h-3.5 w-3.5 ${o?"animate-spin":""}`}),"Refresh"]})]}),i.jsxs("div",{className:"min-h-0 flex-1 overflow-auto px-4 py-4",children:[a&&i.jsx("div",{className:"mb-4 rounded-md border border-destructive/30 bg-destructive/10 px-3 py-2 text-sm text-destructive",children:a}),i.jsxs("div",{className:"grid gap-2 sm:grid-cols-2 xl:grid-cols-4",children:[i.jsx(Rd,{label:"Projects",value:u?.projects??0,icon:pr}),i.jsx(Rd,{label:"Active runs",value:u?.activeRuns??0,icon:Cs}),i.jsx(Rd,{label:"Approval queue",value:r.length,icon:Cc}),i.jsx(Rd,{label:"Webhooks",value:`${u?.enabledWebhooks??0}/${u?.webhooks??0}`,icon:Kg})]}),i.jsxs("div",{className:"mt-4 grid gap-4 xl:grid-cols-[minmax(0,1.4fr)_minmax(320px,0.8fr)]",children:[i.jsxs("section",{className:"min-w-0 rounded-md border border-border/60",children:[i.jsx(qh,{title:"Multi-project control room"}),i.jsxs("div",{className:"divide-y divide-border/50",children:[(e?.projects??[]).map(p=>i.jsxs("div",{className:"px-3 py-3",children:[i.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-2",children:[i.jsxs("div",{className:"min-w-0",children:[i.jsx("div",{className:"truncate text-sm font-medium text-foreground",children:p.name}),i.jsx("div",{className:"truncate text-xs text-muted-foreground",children:p.path})]}),i.jsxs("div",{className:"flex flex-wrap gap-1",children:[i.jsxs(Tt,{variant:"secondary",children:[p.activeRunCount," active"]}),p.pendingApprovalCount>0&&i.jsxs(Tt,{variant:"destructive",children:[p.pendingApprovalCount," approvals"]})]})]}),i.jsxs("div",{className:"mt-2 grid gap-2 text-xs text-muted-foreground sm:grid-cols-3",children:[i.jsxs("span",{children:[p.sessionCount," sessions"]}),i.jsxs("span",{children:[p.failedRunCount," failed runs"]}),i.jsxs("span",{children:[p.latestRuns.length," recent runs"]})]})]},p.id)),e&&e.projects.length===0&&i.jsx("div",{className:"px-3 py-6 text-sm text-muted-foreground",children:"No projects available."})]})]}),i.jsxs("section",{className:"min-w-0 rounded-md border border-border/60",children:[i.jsx(qh,{title:"Approval queue"}),i.jsxs("div",{className:"divide-y divide-border/50",children:[r.map(p=>i.jsxs("div",{className:"px-3 py-3",children:[i.jsx("div",{className:"text-sm font-medium text-foreground",children:Ire(p.summary||p.reason||p.id)}),i.jsxs("div",{className:"mt-1 text-xs text-muted-foreground",children:["Run ",p.runId]}),i.jsxs("div",{className:"mt-3 flex gap-2",children:[i.jsxs(Ne,{size:"sm",onClick:()=>{d(p.id,!0)},children:[i.jsx(Wa,{className:"h-3.5 w-3.5"}),"Allow"]}),i.jsx(Ne,{size:"sm",variant:"outline",onClick:()=>{d(p.id,!1)},children:"Deny"})]})]},p.id)),r.length===0&&i.jsx("div",{className:"px-3 py-6 text-sm text-muted-foreground",children:"No pending approvals."})]})]})]}),i.jsxs("section",{className:"mt-4 rounded-md border border-border/60",children:[i.jsx(qh,{title:"Webhook health"}),i.jsxs("div",{className:"divide-y divide-border/50",children:[(e?.webhooks??[]).map(p=>i.jsxs("div",{className:"grid gap-2 px-3 py-3 md:grid-cols-[minmax(0,1fr)_minmax(220px,0.6fr)]",children:[i.jsxs("div",{className:"min-w-0",children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("span",{className:"truncate text-sm font-medium text-foreground",children:p.name}),i.jsx(Tt,{variant:p.enabled?"default":"secondary",children:p.enabled?"on":"off"})]}),i.jsx("div",{className:"truncate text-xs text-muted-foreground",children:p.url})]}),i.jsx("div",{className:"text-xs text-muted-foreground",children:p.lastDelivery?`${p.lastDelivery.ok?"ok":"failed"} ${p.lastDelivery.eventType||""} ${p.lastDelivery.status||""}`:"No delivery yet"})]},p.id)),e&&e.webhooks.length===0&&i.jsx("div",{className:"px-3 py-6 text-sm text-muted-foreground",children:"No webhooks configured."})]})]})]})]})}function Rd({label:e,value:t,icon:r}){return i.jsxs("div",{className:"rounded-md border border-border/60 px-3 py-3",children:[i.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[i.jsx(r,{className:"h-3.5 w-3.5"}),e]}),i.jsx("div",{className:"mt-2 text-xl font-semibold text-foreground",children:t})]})}function qh({title:e}){return i.jsx("div",{className:"border-b border-border/60 px-3 py-2 text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:e})}const Hc={neutral:"border-border/60 bg-background text-foreground",success:"border-emerald-500/30 bg-emerald-500/8 text-emerald-700 dark:text-emerald-300",warning:"border-amber-500/30 bg-amber-500/8 text-amber-700 dark:text-amber-300",danger:"border-destructive/30 bg-destructive/8 text-destructive",info:"border-primary/25 bg-primary/5 text-primary"};function Rre({icon:e,title:t,description:r,meta:n,value:a,tone:s="neutral",isActive:o=!1,onClick:l}){return i.jsxs("button",{type:"button","data-gsap-list-item":!0,onClick:l,className:xe("group min-h-[132px] rounded-lg border p-4 text-left transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/35","hover:border-primary/35 hover:bg-primary/5",Hc[s],o&&"border-primary/50 bg-primary/10"),children:[i.jsxs("div",{className:"flex items-start justify-between gap-3",children:[i.jsx("span",{className:"flex h-11 w-11 shrink-0 items-center justify-center rounded-md bg-background/70 text-foreground shadow-sm ring-1 ring-border/60",children:i.jsx(e,{className:"h-5 w-5"})}),a!==void 0&&i.jsx("span",{className:"rounded-md bg-background/80 px-2.5 py-1 text-sm font-semibold text-foreground ring-1 ring-border/60",children:a})]}),i.jsx("div",{className:"mt-4 text-sm font-semibold text-foreground",children:t}),i.jsx("p",{className:"mt-1 text-xs leading-5 text-muted-foreground",children:r}),i.jsxs("div",{className:"mt-3 flex min-h-[22px] items-center justify-between gap-2 text-xs",children:[i.jsx("span",{className:"truncate text-muted-foreground",children:n}),i.jsx(D4,{className:"h-4 w-4 text-muted-foreground transition-transform group-hover:translate-x-0.5 group-hover:text-foreground"})]})]})}function Or({label:e,value:t,icon:r,tone:n="neutral"}){return i.jsxs("div",{"data-gsap-list-item":!0,className:xe("rounded-lg border px-4 py-3",Hc[n]),children:[i.jsxs("div",{className:"flex items-center justify-between gap-3",children:[i.jsx("span",{className:"text-xs text-muted-foreground",children:e}),i.jsx(r,{className:"h-4 w-4 text-muted-foreground"})]}),i.jsx("div",{className:"mt-2 text-2xl font-semibold text-foreground",children:t})]})}function Ea({title:e,description:t,children:r,action:n,className:a}){return i.jsxs("section",{className:xe("min-w-0 rounded-lg border border-border/60 bg-background",a),children:[i.jsxs("div",{className:"flex flex-col gap-3 border-b border-border/60 px-4 py-4 sm:flex-row sm:items-start sm:justify-between",children:[i.jsxs("div",{className:"min-w-0",children:[i.jsx("h3",{className:"text-sm font-semibold text-foreground",children:e}),t&&i.jsx("p",{className:"mt-1 text-xs leading-5 text-muted-foreground",children:t})]}),n]}),i.jsx("div",{className:"p-4",children:r})]})}function _re({title:e,description:t,children:r,className:n}){return i.jsxs("aside",{className:xe("min-h-0 rounded-lg border border-border/60 bg-muted/15",n),children:[i.jsxs("div",{className:"border-b border-border/60 px-4 py-4",children:[i.jsx("div",{className:"text-sm font-semibold text-foreground",children:e}),t&&i.jsx("p",{className:"mt-1 text-xs leading-5 text-muted-foreground",children:t})]}),i.jsx("div",{className:"space-y-4 p-4",children:r})]})}function Sa({title:e="What this means",description:t,action:r,tone:n="info"}){return i.jsxs("div",{className:xe("rounded-lg border px-4 py-3",Hc[n]),children:[i.jsx("div",{className:"text-sm font-semibold text-foreground",children:e}),i.jsx("p",{className:"mt-1 text-xs leading-5 text-muted-foreground",children:t}),r&&i.jsx("div",{className:"mt-3",children:r})]})}function zi({title:e,description:t,actionLabel:r,onAction:n}){return i.jsxs("div",{className:"rounded-lg border border-dashed border-border/70 px-4 py-6 text-sm",children:[i.jsx("div",{className:"font-medium text-foreground",children:e}),i.jsx("p",{className:"mt-1 text-xs leading-5 text-muted-foreground",children:t}),r&&n&&i.jsx(Ne,{className:"mt-4 min-h-[44px]",variant:"outline",onClick:n,children:r})]})}function HI({time:e,actor:t,action:r,result:n,tone:a="neutral",children:s}){return i.jsxs("div",{"data-gsap-list-item":!0,className:"relative pl-6",children:[i.jsx("span",{className:xe("absolute left-0 top-1.5 h-3 w-3 rounded-full border bg-background",Hc[a])}),i.jsxs("div",{className:"rounded-lg border border-border/60 bg-background px-3 py-3",children:[i.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2 text-xs text-muted-foreground",children:[i.jsx("span",{children:e}),i.jsx(Tt,{variant:"secondary",children:t})]}),i.jsx("div",{className:"mt-2 text-sm font-medium text-foreground",children:r}),i.jsx("p",{className:"mt-1 text-xs leading-5 text-muted-foreground",children:n}),s&&i.jsx("div",{className:"mt-3",children:s})]})]})}function zo({title:e,description:t,status:r,action:n}){return i.jsxs("div",{"data-gsap-list-item":!0,className:"flex flex-col gap-3 border-b border-border/50 px-3 py-3 last:border-b-0 sm:flex-row sm:items-center sm:justify-between",children:[i.jsxs("div",{className:"min-w-0",children:[i.jsx("div",{className:"text-sm font-medium text-foreground",children:e}),t&&i.jsx("p",{className:"mt-1 text-xs leading-5 text-muted-foreground",children:t})]}),i.jsxs("div",{className:"flex shrink-0 flex-wrap items-center gap-2",children:[r&&i.jsx(Tt,{variant:"secondary",children:r}),n]})]})}function Bi({items:e,empty:t,render:r}){return e.length===0?i.jsx(i.Fragment,{children:t}):i.jsx("div",{className:"divide-y divide-border/50",children:e.map(r)})}function Lp({title:e,description:t,children:r,defaultOpen:n=!1}){return i.jsxs("details",{className:"group rounded-lg border border-border/60 bg-muted/10",open:n,children:[i.jsxs("summary",{className:"flex min-h-[44px] cursor-pointer list-none items-center justify-between gap-3 px-4 py-3 text-sm font-medium text-foreground",children:[i.jsxs("span",{children:[e,t&&i.jsx("span",{className:"mt-0.5 block text-xs font-normal leading-5 text-muted-foreground",children:t})]}),i.jsx(Mn,{className:"h-4 w-4 transition-transform group-open:rotate-180"})]}),i.jsx("div",{className:"border-t border-border/60 p-4",children:r})]})}function nN({tone:e,children:t,className:r}){return i.jsx("div",{className:xe("rounded-lg border px-4 py-3 text-sm",Hc[e],r),children:t})}const Kh={production:{issueRuns:[],reviewQueue:[],schedulerJobs:[],checkpoints:[]},platform:{roles:{},adminUsers:[],projectCollaborators:[],secrets:[],marketplacePlugins:[],evaluationSuites:[],evaluationRuns:[],usageSummary:[],securityAuditRuns:[],auditLog:[]}},_d=[{id:"operations",label:"Operations",description:"Runs, reviews, approvals, scheduler, checkpoints",icon:pr},{id:"people",label:"People",description:"Admins, collaborators, roles, activity",icon:vs},{id:"access",label:"Access",description:"LAN, Tailscale, tunnel, domain guidance",icon:xn},{id:"security",label:"Security",description:"Secrets, permission risk, audit checks",icon:Cc},{id:"insights",label:"Insights",description:"Usage, evaluations, marketplace health",icon:Vg}],Pre=[{id:"overview-card-attention",title:"What needs attention",description:"Errors, reviews, security findings, and failed evaluation work are grouped here first.",meta:"Recommended next step",group:"operations",icon:wr,tone:"warning",value:e=>VI(e)},{id:"overview-card-running",title:"Running now",description:"Active agent work, scheduled jobs, and issue-to-PR runs without opening every list.",meta:"Live operational state",group:"operations",icon:Cs,tone:"info",value:e=>WI(e)},{id:"overview-card-reviews",title:"Reviews and approvals",description:"Human checkpoints, review queue items, and decisions that should not be hidden.",meta:"Action queue",group:"operations",icon:ia,value:e=>e.production.reviewQueue?.length||0},{id:"overview-card-team-access",title:"Team and access",description:"Sub-users, project collaborators, and the right way for people to reach this server.",meta:"People + connection path",group:"people",icon:vs,value:e=>(e.platform.adminUsers?.length||0)+(e.platform.projectCollaborators?.length||0)},{id:"overview-card-security-secrets",title:"Security and secrets",description:"Scoped env values, audit runs, permission risk, and sensitive workflow state.",meta:"Guardrails",group:"security",icon:Cc,tone:"danger",value:e=>(e.platform.secrets?.length||0)+(e.platform.securityAuditRuns?.length||0)},{id:"overview-card-usage-evals",title:"Usage and evaluations",description:"Cost, token, latency, model comparisons, and marketplace health in one place.",meta:"Run timeline",group:"insights",icon:Vg,tone:"success",value:e=>(e.platform.usageSummary?.length||0)+(e.platform.evaluationRuns?.length||0)}],GI=["opencode","claude","codex","cursor","gemini","qwen"],Lre=["owner","admin","member","viewer","project_partner","project_worker","project_reviewer"],Dre=["partner","worker","reviewer","viewer"],Ore=["global","provider","project","workflow","telegram","api"],Mre=["dependency_audit","secret_scan","permission_audit","agent_output_leak_detection"];function VI(e){const t=(e.production.reviewQueue||[]).filter(s=>s.status==="needs_fix"||s.status==="review_requested").length,r=(e.platform.securityAuditRuns||[]).reduce((s,o)=>s+(o.findings?.length||0),0),n=(e.platform.evaluationRuns||[]).filter(s=>Number(s.summary?.failed||0)>0).length,a=(e.production.issueRuns||[]).filter(s=>/fail|error/i.test(s.status||"")).length;return t+r+n+a}function WI(e){const t=(e.production.issueRuns||[]).filter(n=>/queued|running|active/i.test(n.status||"")).length,r=(e.production.schedulerJobs||[]).filter(n=>/queued|running|watch|cron|active/i.test(n.status||n.mode||"")).length;return t+r}function Fre(e,t=90){const r=String(e??"").replace(/\s+/g," ").trim();return r.length>t?`${r.slice(0,t-1)}...`:r}function Bo(e){return e.split(/\r?\n/).map(t=>t.trim()).filter(Boolean)}function Bl(e){if(!e)return"Never";try{return new Date(e).toLocaleString()}catch{return e}}function zre(e){const t=Number(e||0);return new Intl.NumberFormat().format(t)}function Bre(e){const t=Number(e||0);return`$${t.toFixed(t>=1?2:4)}`}async function pn(e,t){const r=await Ce(e,t),n=await r.json().catch(()=>({}));if(!r.ok)throw new Error(n?.error?.message||n?.error||`HTTP ${r.status}`);return n}function Ure(e){const t=(e.production.issueRuns||[]).slice(0,8).map(s=>({id:`issue-${s.id}`,time:Bl(s.updatedAt||s.createdAt),actor:s.provider||"agent",action:s.title||s.issueUrl||"Issue-to-PR run",result:`Status: ${s.status||"queued"}${s.branchName?`, branch ${s.branchName}`:""}`,tone:/fail|error/i.test(s.status||"")?"danger":/done|complete|merged/i.test(s.status||"")?"success":"info"})),r=(e.production.reviewQueue||[]).slice(0,8).map(s=>({id:`review-${s.id}`,time:Bl(s.updatedAt||s.createdAt),actor:"review",action:s.title||"Review requested",result:`Status: ${s.status||"review_requested"}${s.changedFiles?.length?`, ${s.changedFiles.length} changed files`:""}`,tone:s.status==="needs_fix"?"warning":"neutral"})),n=(e.production.checkpoints||[]).slice(0,6).map(s=>({id:`checkpoint-${s.id}`,time:Bl(s.createdAt),actor:"checkpoint",action:s.reason||"Workspace checkpoint",result:`${s.changedFiles?.length||0} changed files captured`,tone:"success"})),a=(e.platform.auditLog||[]).slice(0,8).map(s=>({id:`audit-${s.id}`,time:Bl(s.createdAt),actor:s.actorId||"system",action:s.action||"Audit event",result:Fre(JSON.stringify(s.details||{}),120),tone:/delete|disable|secret|error/i.test(s.action||"")?"warning":"neutral"}));return[...t,...r,...n,...a].slice(0,18)}function Ig({selectedProject:e}){const{t}=He("common"),r=m.useRef(null),n=m.useRef(null),a=m.useRef(null),s=m.useRef(null),[o,l]=m.useState("operations"),[c,d]=m.useState(Kh),[u,p]=m.useState(!1),[f,h]=m.useState(null),[g,b]=m.useState(null),[x,y]=m.useState(""),[v,w]=m.useState(null),[k,S]=m.useState({issueUrl:"",title:"",provider:"opencode",model:"",baseBranch:"main",acceptanceCriteria:`Implementation is visible in the UI
667
667
  Responsive layout is verified
668
668
  Build and smoke checks pass`}),[N,E]=m.useState(""),[I,A]=m.useState({title:"",notes:"",changedFiles:""}),[T,_]=m.useState({name:"",mode:"manual",cron:"",prompt:""}),[j,R]=m.useState({username:"",password:"",role:"member",status:"active"}),[C,D]=m.useState({userRef:"",role:"worker",allowedRoots:"."}),[B,F]=m.useState({name:"",envName:"",scope:"project",target:"",value:""}),[V,K]=m.useState({provider:"opencode",model:"",workflow:"manual",inputTokens:"1000",outputTokens:"500",costUsd:"0.02",latencyMs:"1200",status:"ok"}),[L,G]=m.useState({checks:Mre.join(`
669
- `),findingTitle:""}),[H,z]=m.useState({name:"",type:"mcp-server",source:"",installCommand:"",permissionScopes:""}),[te,se]=m.useState({name:"",description:"",taskTitle:"",acceptanceCriteria:""}),me=e?.name||e?.displayName||"",de=e?.path||e?.fullPath||"",ce=m.useMemo(()=>Ure(c),[c]),ye=_d.find(ae=>ae.id===o)||_d[0],he=m.useCallback((ae,ue,Y)=>t(`controlRoom.${ae}`,{defaultValue:ue,...Y}),[t]);C0(r,"fade-up"),zF(n,o),BF(a,`${o}-${ce.length}`),UF(s,g||f);const ke=m.useCallback(async()=>{p(!0),h(null);try{const[ae,ue]=await Promise.all([pn("/api/production-agent-loop"),pn("/api/platformization")]);d({production:ae.state||Kh.production,platform:ue.state||Kh.platform})}catch(ae){h(ae instanceof Error?ae.message:String(ae))}finally{p(!1)}},[]);m.useEffect(()=>{ke()},[ke]);const ve=m.useCallback(async(ae,ue)=>{h(null),b(null);try{await ue(),b(ae),await ke()}catch(Y){h(Y instanceof Error?Y.message:String(Y))}},[ke]),je=m.useMemo(()=>{const ae=x.trim().toLowerCase(),ue=c.platform.auditLog||[];return ae?ue.filter(Y=>JSON.stringify(Y).toLowerCase().includes(ae)):ue},[x,c.platform.auditLog]),M={attention:VI(c),running:WI(c),reviews:c.production.reviewQueue?.length||0,users:c.platform.adminUsers?.length||0,collaborators:c.platform.projectCollaborators?.length||0,secrets:c.platform.secrets?.length||0,plugins:c.platform.marketplacePlugins?.length||0,evalRuns:c.platform.evaluationRuns?.length||0,audits:c.platform.securityAuditRuns?.length||0};return i.jsxs("div",{ref:r,className:"flex h-full min-h-0 flex-col overflow-hidden bg-background",children:[i.jsxs("header",{className:"flex flex-col gap-3 border-b border-border/60 px-4 py-4 sm:flex-row sm:items-center sm:justify-between",children:[i.jsxs("div",{className:"min-w-0",children:[i.jsxs("div",{className:"flex items-center gap-2 text-sm font-semibold text-foreground",children:[i.jsx($n,{className:"h-4 w-4"}),he("title","Control room")]}),i.jsx("p",{className:"mt-1 max-w-3xl text-xs leading-5 text-muted-foreground",children:he("subtitle","A task-first command surface for {{target}}. Start with what needs attention, then open detail only when needed.",{target:e?.displayName||he("thisServer","this self-hosted server")})})]}),i.jsxs(Ne,{className:"min-h-[44px] shrink-0",size:"sm",variant:"outline",onClick:()=>{ke()},disabled:u,children:[i.jsx(at,{className:xe("h-4 w-4",u&&"animate-spin")}),he("refresh","Refresh")]})]}),i.jsxs("div",{className:"grid min-h-0 flex-1 grid-cols-1 overflow-hidden lg:grid-cols-[220px_minmax(0,1fr)_320px]",children:[i.jsx("nav",{className:"hidden border-r border-border/60 bg-muted/15 p-3 lg:block",children:i.jsx("div",{className:"space-y-2",children:_d.map(ae=>i.jsx($re,{group:ae,isActive:o===ae.id,onClick:()=>l(ae.id)},ae.id))})}),i.jsxs("main",{ref:n,className:"min-h-0 overflow-auto",children:[i.jsx("div",{className:"overflow-x-auto lg:hidden",children:i.jsx("div",{className:"flex gap-2 border-b border-border/60 bg-muted/15 px-4 py-3",children:_d.map(ae=>i.jsxs("button",{type:"button",onClick:()=>l(ae.id),className:xe("inline-flex h-11 shrink-0 items-center gap-2 rounded-md border px-3 text-sm font-medium",o===ae.id?"border-primary/40 bg-primary/10 text-foreground":"border-border/60 bg-background text-muted-foreground"),children:[i.jsx(ae.icon,{className:"h-4 w-4"}),ae.label]},ae.id))})}),i.jsxs("div",{className:"space-y-6 p-4 md:p-6",children:[i.jsxs("div",{ref:s,children:[f&&i.jsx(nN,{tone:"danger",children:f}),g&&i.jsx(nN,{tone:"success",children:g})]}),i.jsxs("section",{children:[i.jsxs("div",{className:"mb-4 flex flex-col gap-2 sm:flex-row sm:items-end sm:justify-between",children:[i.jsxs("div",{children:[i.jsx("h2",{className:"text-base font-semibold text-foreground",children:he("overview.commandSurface","Command surface")}),i.jsx("p",{className:"mt-1 text-sm text-muted-foreground",children:he("overview.commandSurfaceDescription","Six cards, one decision: what should you look at next?")})]}),i.jsxs(Tt,{variant:"secondary",children:[he("overview.currentGroup","Current group"),": ",ye.label]})]}),i.jsx("div",{ref:a,className:"grid gap-3 sm:grid-cols-2 xl:grid-cols-3",children:Pre.map(ae=>i.jsx(Rre,{icon:ae.icon,title:he(`overviewCards.${ae.id}.title`,ae.title),description:he(`overviewCards.${ae.id}.description`,ae.description),meta:he(`overviewCards.${ae.id}.meta`,ae.meta),value:ae.value(c),tone:ae.tone,isActive:o===ae.group,onClick:()=>l(ae.group)},ae.id))})]}),o==="operations"&&i.jsx(Hre,{cr:he,totals:M,timeline:ce,snapshot:c,defaultProjectName:me,defaultProjectPath:de,issueForm:k,setIssueForm:S,ciLog:N,setCiLog:E,repairPlan:v,setRepairPlan:w,reviewForm:I,setReviewForm:A,schedulerForm:T,setSchedulerForm:_,action:ve}),o==="people"&&i.jsx(Gre,{cr:he,snapshot:c,defaultProjectName:me,defaultProjectPath:de,adminForm:j,setAdminForm:R,collaboratorForm:C,setCollaboratorForm:D,auditQuery:x,setAuditQuery:y,filteredAudit:je,action:ve}),o==="access"&&i.jsx(Vre,{cr:he,selectedProject:e}),o==="security"&&i.jsx(Wre,{cr:he,snapshot:c,defaultProjectName:me,defaultProjectPath:de,secretForm:B,setSecretForm:F,securityForm:L,setSecurityForm:G,action:ve}),o==="insights"&&i.jsx(qre,{cr:he,snapshot:c,usageForm:V,setUsageForm:K,pluginForm:H,setPluginForm:z,evalSuiteForm:te,setEvalSuiteForm:se,defaultProjectPath:de,action:ve})]})]}),i.jsxs(_re,{className:"hidden min-h-0 overflow-auto rounded-none border-y-0 border-r-0 lg:block",title:"What this means",description:ye.description,children:[i.jsx(Sa,{title:"Recommended next step",description:Kre(o,M)}),i.jsx(Ea,{title:"Run timeline",description:"Readable activity feed for agents, reviewers, checkpoints, and audit events.",children:i.jsx("div",{className:"space-y-3",children:i.jsx(Bi,{items:ce.slice(0,5),empty:i.jsx(zi,{title:"No run timeline yet",description:"Run activity appears here after issue runs, reviews, checkpoints, or audit events are recorded."}),render:ae=>i.jsx(HI,{time:ae.time,actor:ae.actor,action:ae.action,result:ae.result,tone:ae.tone},ae.id)})})}),i.jsx(Ea,{title:"Server signal",description:"The first screen avoids raw backend sections and shows only current status.",children:i.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[i.jsx(Or,{label:"Attention",value:M.attention,icon:wr,tone:M.attention?"warning":"success"}),i.jsx(Or,{label:"Running",value:M.running,icon:Cs,tone:"info"})]})})]})]})]})}function $re({group:e,isActive:t,onClick:r}){return i.jsxs("button",{type:"button",onClick:r,className:xe("flex min-h-[44px] w-full items-start gap-3 rounded-lg border px-3 py-3 text-left transition-colors",t?"border-primary/40 bg-primary/10 text-foreground":"border-transparent text-muted-foreground hover:border-border/70 hover:bg-background"),children:[i.jsx(e.icon,{className:"mt-0.5 h-4 w-4 shrink-0"}),i.jsxs("span",{className:"min-w-0",children:[i.jsx("span",{className:"block text-sm font-medium",children:e.label}),i.jsx("span",{className:"mt-0.5 block text-xs leading-4 text-muted-foreground",children:e.description})]})]})}function Hre({cr:e,totals:t,timeline:r,snapshot:n,defaultProjectName:a,defaultProjectPath:s,issueForm:o,setIssueForm:l,ciLog:c,setCiLog:d,repairPlan:u,setRepairPlan:p,reviewForm:f,setReviewForm:h,schedulerForm:g,setSchedulerForm:b,action:x}){return i.jsxs("section",{className:"space-y-4",children:[i.jsx(Sa,{description:e("guidance.operations","Use Operations when something is actively running, waiting for review, or needs repair. Forms stay hidden until you intentionally open them.")}),i.jsxs("div",{className:"grid gap-3 sm:grid-cols-2 xl:grid-cols-4",children:[i.jsx(Or,{label:"Needs attention",value:t.attention,icon:wr,tone:t.attention?"warning":"success"}),i.jsx(Or,{label:"Running now",value:t.running,icon:Cs,tone:"info"}),i.jsx(Or,{label:"Reviews",value:t.reviews,icon:ia}),i.jsx(Or,{label:"Checkpoints",value:n.production.checkpoints?.length||0,icon:Wa,tone:"success"})]}),i.jsx(Ea,{title:"Run timeline",description:"Readable actor, action, and result history without raw JSON.",children:i.jsx("div",{className:"space-y-3",children:i.jsx(Bi,{items:r,empty:i.jsx(zi,{title:"No activity yet",description:"Issue runs, review decisions, checkpoints, and audit events will appear here as a vertical timeline."}),render:y=>i.jsx(HI,{time:y.time,actor:y.actor,action:y.action,result:y.result,tone:y.tone,children:y.details},y.id)})})}),i.jsx(Ea,{title:"Action queue",description:"Review items are shown as mobile-friendly rows instead of a cramped table.",children:i.jsx(Bi,{items:n.production.reviewQueue||[],empty:i.jsx(zi,{title:"No review items",description:"Create a review item when changed files need an accept/fix decision."}),render:y=>i.jsx(zo,{title:y.title||"Review requested",description:`${y.changedFiles?.length||0} changed files`,status:y.status||"review_requested",action:i.jsx(Ne,{size:"sm",variant:"outline",onClick:()=>{x("Review marked accepted.",async()=>{await pn(`/api/production-agent-loop/review-queue/${encodeURIComponent(y.id)}`,{method:"PATCH",body:JSON.stringify({status:"accepted"})})})},children:"Accept"})},y.id)})}),i.jsx(Lp,{title:"Advanced operations",description:"Queue runs, parse CI failures, create reviews, or schedule background work.",children:i.jsxs("div",{className:"grid gap-4 xl:grid-cols-2",children:[i.jsxs(Ca,{title:"Queue issue-to-PR run",children:[i.jsx(Je,{placeholder:"GitHub issue URL",value:o.issueUrl,onChange:y=>l({...o,issueUrl:y.target.value})}),i.jsxs("div",{className:"mt-2 grid gap-2 sm:grid-cols-2",children:[i.jsx(Je,{placeholder:"Manual title fallback",value:o.title,onChange:y=>l({...o,title:y.target.value})}),i.jsx(Je,{placeholder:"Model",value:o.model,onChange:y=>l({...o,model:y.target.value})}),i.jsx(Va,{value:o.provider,onChange:y=>l({...o,provider:y}),options:GI}),i.jsx(Je,{placeholder:"Base branch",value:o.baseBranch,onChange:y=>l({...o,baseBranch:y.target.value})})]}),i.jsx(Ni,{className:"mt-2",rows:4,value:o.acceptanceCriteria,onChange:y=>l({...o,acceptanceCriteria:y.target.value})}),i.jsxs(Ne,{className:"mt-3 min-h-[44px]",onClick:()=>{x("Issue-to-PR run queued.",async()=>{await pn("/api/production-agent-loop/github/issue-to-pr",{method:"POST",body:JSON.stringify({...o,projectName:a,projectPath:s,acceptanceCriteria:Bo(o.acceptanceCriteria)})})})},children:[i.jsx(Ut,{className:"h-4 w-4"}),"Queue run"]})]}),i.jsxs(Ca,{title:"CI repair and review queue",children:[i.jsx(Ni,{rows:5,placeholder:"Paste failing CI, lint, typecheck, or build output",value:c,onChange:y=>d(y.target.value)}),i.jsx(Ne,{className:"mt-3 min-h-[44px]",variant:"outline",onClick:()=>{x("CI repair plan generated.",async()=>{const y=await pn("/api/production-agent-loop/ci/repair-plan",{method:"POST",body:JSON.stringify({log:c})});p(y.repairPlan)})},children:"Parse failure"}),u&&i.jsx("pre",{className:"mt-3 max-h-56 overflow-auto rounded-md bg-muted/30 p-3 text-xs text-muted-foreground",children:u.repairPrompt}),i.jsx(Je,{className:"mt-4",placeholder:"Review title",value:f.title,onChange:y=>h({...f,title:y.target.value})}),i.jsx(Ni,{className:"mt-2",rows:3,placeholder:"Changed files, one per line",value:f.changedFiles,onChange:y=>h({...f,changedFiles:y.target.value})}),i.jsx(Ne,{className:"mt-3 min-h-[44px]",onClick:()=>{x("Review item created.",async()=>{await pn("/api/production-agent-loop/review-queue",{method:"POST",body:JSON.stringify({projectName:a,projectPath:s,title:f.title||"Review requested",notes:f.notes,changedFiles:Bo(f.changedFiles)})})})},children:"Create review item"})]}),i.jsxs(Ca,{title:"Background job",children:[i.jsxs("div",{className:"grid gap-2 sm:grid-cols-2",children:[i.jsx(Je,{placeholder:"Job name",value:g.name,onChange:y=>b({...g,name:y.target.value})}),i.jsx(Va,{value:g.mode,onChange:y=>b({...g,mode:y}),options:["manual","watch","cron"]}),i.jsx(Je,{placeholder:"Cron or watch expression",value:g.cron,onChange:y=>b({...g,cron:y.target.value})})]}),i.jsx(Ni,{className:"mt-2",rows:3,placeholder:"Background agent prompt",value:g.prompt,onChange:y=>b({...g,prompt:y.target.value})}),i.jsx(Ne,{className:"mt-3 min-h-[44px]",onClick:()=>{x("Background job scheduled.",async()=>{await pn("/api/production-agent-loop/scheduler/jobs",{method:"POST",body:JSON.stringify({...g,projectName:a,provider:o.provider})})})},children:"Schedule job"})]})]})})]})}function Gre({cr:e,snapshot:t,defaultProjectName:r,defaultProjectPath:n,adminForm:a,setAdminForm:s,collaboratorForm:o,setCollaboratorForm:l,auditQuery:c,setAuditQuery:d,filteredAudit:u,action:p}){const f=!!(r&&o.userRef?.trim());return i.jsxs("section",{className:"space-y-4",children:[i.jsx(Sa,{description:e("guidance.people","People is for who can enter the self-hosted server and what they can do inside each project.")}),i.jsxs("div",{className:"grid gap-3 sm:grid-cols-2 xl:grid-cols-4",children:[i.jsx(Or,{label:"Sub-users",value:t.platform.adminUsers?.length||0,icon:vs}),i.jsx(Or,{label:"Collaborators",value:t.platform.projectCollaborators?.length||0,icon:vs,tone:"info"}),i.jsx(Or,{label:"Roles",value:Object.keys(t.platform.roles||{}).length,icon:Tn}),i.jsx(Or,{label:"Audit events",value:t.platform.auditLog?.length||0,icon:ia})]}),i.jsx(Ea,{title:"Project collaborators",description:"Project partners and workers are not global admins. They get scoped access to assigned projects.",children:i.jsx(Bi,{items:t.platform.projectCollaborators||[],empty:i.jsx(zi,{title:"No collaborators yet",description:"Create a sub-user first, then assign that person to a project role."}),render:h=>i.jsx(zo,{title:h.userRef,description:`${h.projectName||"Project"} - ${Object.keys(h.capabilities||{}).filter(g=>h.capabilities[g]).join(", ")||"role scoped"}`,status:h.role},h.id)})}),i.jsxs(Ea,{title:"Audit log",description:"Search what sub-users, project partners, and workers changed without opening a raw database view.",children:[i.jsx(Je,{className:"mb-3 h-11",placeholder:"Search actor, action, project, or detail",value:c,onChange:h=>d(h.target.value)}),i.jsx(Bi,{items:u,empty:i.jsx(zi,{title:"No audit events match",description:"User and project access activity appears here after actions are recorded."}),render:h=>i.jsx(zo,{title:h.actorId||"system",description:`${h.action||"Audit event"} - ${Bl(h.createdAt)}`,status:h.resource||h.target||"audit"},h.id)})]}),i.jsx(Lp,{title:"Advanced people management",description:"Create users and assign project roles only when needed.",children:i.jsxs("div",{className:"grid gap-4 xl:grid-cols-2",children:[i.jsxs(Ca,{title:"Create sub-user",children:[i.jsx(Je,{placeholder:"Username or email",value:a.username,onChange:h=>s({...a,username:h.target.value})}),i.jsx(Je,{className:"mt-2",type:"password",placeholder:"Temporary password",value:a.password,onChange:h=>s({...a,password:h.target.value})}),i.jsxs("div",{className:"mt-2 grid gap-2 sm:grid-cols-2",children:[i.jsx(Va,{value:a.role,onChange:h=>s({...a,role:h}),options:Lre}),i.jsx(Va,{value:a.status,onChange:h=>s({...a,status:h}),options:["active","disabled"]})]}),i.jsx(Ne,{className:"mt-3 min-h-[44px]",onClick:()=>{p("Sub-user created.",async()=>{await pn("/api/platformization/admin/users",{method:"POST",body:JSON.stringify(a)}),s({...a,username:"",password:""})})},children:"Create user"})]}),i.jsxs(Ca,{title:"Assign project collaborator",children:[i.jsx(Je,{placeholder:"User email or username",value:o.userRef,onChange:h=>l({...o,userRef:h.target.value})}),i.jsx(Va,{className:"mt-2",value:o.role,onChange:h=>l({...o,role:h}),options:Dre}),i.jsx(Ni,{className:"mt-2",rows:3,placeholder:"Allowed folders, one per line. Use . for whole project.",value:o.allowedRoots,onChange:h=>l({...o,allowedRoots:h.target.value})}),i.jsx(Sa,{title:"Recommended next step",description:r?`Assign this person to ${r}, then share an access URL from Settings > Access.`:"Select a project before assigning scoped access."}),i.jsx(Ne,{className:"mt-3 min-h-[44px]",disabled:!f,onClick:()=>{p("Project collaborator added.",async()=>{await pn("/api/platformization/project-collaborators",{method:"POST",body:JSON.stringify({...o,allowedRoots:Bo(o.allowedRoots),projectName:r,projectPath:n})}),l({...o,userRef:"",allowedRoots:"."})})},children:"Add collaborator"})]})]})})]})}function Vre({cr:e,selectedProject:t}){return i.jsxs("section",{className:"space-y-4",children:[i.jsx(Sa,{description:e("guidance.access","Access explains how people reach Pixcode. The actual server-wide setup belongs in Settings > Access because it affects every project and user."),action:i.jsx(Ne,{className:"min-h-[44px]",variant:"outline",onClick:()=>window.openSettings?.("access"),children:"Open Settings > Access"})}),i.jsxs("div",{className:"grid gap-3 md:grid-cols-3",children:[i.jsx(Sa,{title:"LAN and local",description:"Use when the browser is on the same machine or network. Start here before private or public tunnels."}),i.jsx(Sa,{title:"Tailscale private access",description:"Best when a team needs private access without exposing Pixcode publicly. The UI should guide install, login, and URL sharing."}),i.jsx(Sa,{title:"Cloudflare or custom domain",description:"Best when users need a stable HTTPS URL. Configure the tunnel/domain once and share it with assigned users."})]}),i.jsx(Ea,{title:"How users connect",description:"This keeps Access understandable for non-technical users.",children:i.jsxs("div",{className:"grid gap-3 md:grid-cols-3",children:[i.jsx(Yh,{number:"1",title:"Create the user",description:"Add them in People so the server knows who they are."}),i.jsx(Yh,{number:"2",title:"Assign project role",description:`Give them project access${t?.displayName?` for ${t.displayName}`:""}.`}),i.jsx(Yh,{number:"3",title:"Share one URL",description:"Use a LAN, Tailscale, Cloudflare Tunnel, or custom domain URL from Settings > Access."})]})})]})}function Wre({cr:e,snapshot:t,defaultProjectName:r,defaultProjectPath:n,secretForm:a,setSecretForm:s,securityForm:o,setSecurityForm:l,action:c}){return i.jsxs("section",{className:"space-y-4",children:[i.jsx(Sa,{description:e("guidance.security","Security keeps sensitive values, permission checks, and audit risk visible without exposing raw secrets."),tone:"warning"}),i.jsxs("div",{className:"grid gap-3 sm:grid-cols-2 xl:grid-cols-4",children:[i.jsx(Or,{label:"Scoped secrets",value:t.platform.secrets?.length||0,icon:Tc}),i.jsx(Or,{label:"Audit runs",value:t.platform.securityAuditRuns?.length||0,icon:Cc,tone:"warning"}),i.jsx(Or,{label:"Findings",value:(t.platform.securityAuditRuns||[]).reduce((d,u)=>d+(u.findings?.length||0),0),icon:wr,tone:"danger"}),i.jsx(Or,{label:"Audit events",value:t.platform.auditLog?.length||0,icon:ia})]}),i.jsx(Ea,{title:"Secret vault",description:"Rows show scope, target, and redacted env names. Values stay hidden.",children:i.jsx(Bi,{items:t.platform.secrets||[],empty:i.jsx(zi,{title:"No secrets stored",description:"Store provider, project, workflow, Telegram, or API env values from the advanced form."}),render:d=>i.jsx(zo,{title:d.envName,description:`${d.name} - ${d.target||"global"} - ${d.redacted}`,status:d.scope},d.id)})}),i.jsx(Lp,{title:"Advanced security actions",description:"Store scoped env values or queue audit checks.",children:i.jsxs("div",{className:"grid gap-4 xl:grid-cols-2",children:[i.jsxs(Ca,{title:"Create secret",children:[i.jsxs("div",{className:"grid gap-2 sm:grid-cols-2",children:[i.jsx(Je,{placeholder:"Secret name",value:a.name,onChange:d=>s({...a,name:d.target.value})}),i.jsx(Je,{placeholder:"ENV_NAME",value:a.envName,onChange:d=>s({...a,envName:d.target.value})}),i.jsx(Va,{value:a.scope,onChange:d=>s({...a,scope:d}),options:Ore}),i.jsx(Je,{placeholder:"Target project/provider/workflow",value:a.target||n,onChange:d=>s({...a,target:d.target.value})})]}),i.jsx(Je,{className:"mt-2",type:"password",placeholder:"Secret value",value:a.value,onChange:d=>s({...a,value:d.target.value})}),i.jsx(Ne,{className:"mt-3 min-h-[44px]",onClick:()=>{c("Secret stored in the vault.",async()=>{await pn("/api/platformization/secrets",{method:"POST",body:JSON.stringify({...a,target:a.target||n})}),s({...a,value:""})})},children:"Store secret"})]}),i.jsxs(Ca,{title:"Create audit run",children:[i.jsx(Ni,{rows:5,value:o.checks,onChange:d=>l({...o,checks:d.target.value})}),i.jsx(Je,{className:"mt-2",placeholder:"Optional finding title",value:o.findingTitle,onChange:d=>l({...o,findingTitle:d.target.value})}),i.jsx(Ne,{className:"mt-3 min-h-[44px]",onClick:()=>{c("Security audit queued.",async()=>{await pn("/api/platformization/security/audit-runs",{method:"POST",body:JSON.stringify({projectName:r,projectPath:n,checks:Bo(o.checks),findings:o.findingTitle?[{title:o.findingTitle,severity:"medium"}]:[]})})})},children:"Create audit"})]})]})})]})}function qre({cr:e,snapshot:t,usageForm:r,setUsageForm:n,pluginForm:a,setPluginForm:s,evalSuiteForm:o,setEvalSuiteForm:l,defaultProjectPath:c,action:d}){return i.jsxs("section",{className:"space-y-4",children:[i.jsx(Sa,{description:e("guidance.insights","Insights is for model/runtime decisions: cost, latency, eval quality, and marketplace health."),tone:"success"}),i.jsxs("div",{className:"grid gap-3 sm:grid-cols-2 xl:grid-cols-4",children:[i.jsx(Or,{label:"Usage rows",value:t.platform.usageSummary?.length||0,icon:Vg}),i.jsx(Or,{label:"Eval runs",value:t.platform.evaluationRuns?.length||0,icon:pr,tone:"success"}),i.jsx(Or,{label:"Eval suites",value:t.platform.evaluationSuites?.length||0,icon:Wa}),i.jsx(Or,{label:"Marketplace",value:t.platform.marketplacePlugins?.length||0,icon:ca,tone:"info"})]}),i.jsx(Ea,{title:"Usage summary",description:"Provider metrics are stacked as cards on mobile instead of forcing a wide table.",children:i.jsx(Bi,{items:t.platform.usageSummary||[],empty:i.jsx(zi,{title:"No usage events yet",description:"Usage appears after provider or workflow events are recorded."}),render:(u,p)=>i.jsx(zo,{title:`${u.provider||"provider"} ${u.model||""}`.trim(),description:`${zre(u.totalTokens)} tokens - ${Bre(u.costUsd)} - ${u.averageLatencyMs||0}ms avg`,status:`${u.errorRate||0}% errors`},`${u.provider}-${u.model}-${u.workflow}-${p}`)})}),i.jsx(Ea,{title:"Marketplace health",description:"MCP servers, workflow templates, provider adapters, and notification channels stay visible without crowding the overview.",children:i.jsx(Bi,{items:t.platform.marketplacePlugins||[],empty:i.jsx(zi,{title:"No marketplace entries",description:"Register entries only when a plugin or workflow template is ready to install."}),render:u=>i.jsx(zo,{title:u.name,description:u.source||"No source configured",status:`${u.type} - ${u.health?.status||"unknown"}`},u.id)})}),i.jsx(Lp,{title:"Advanced insight actions",description:"Record usage, create evaluation suites, or register marketplace entries.",children:i.jsxs("div",{className:"grid gap-4 xl:grid-cols-3",children:[i.jsxs(Ca,{title:"Record usage",children:[i.jsxs("div",{className:"grid gap-2 sm:grid-cols-2",children:[i.jsx(Va,{value:r.provider,onChange:u=>n({...r,provider:u}),options:GI}),i.jsx(Je,{placeholder:"Model",value:r.model,onChange:u=>n({...r,model:u.target.value})}),i.jsx(Je,{placeholder:"Workflow",value:r.workflow,onChange:u=>n({...r,workflow:u.target.value})}),i.jsx(Va,{value:r.status,onChange:u=>n({...r,status:u}),options:["ok","error","timeout"]}),i.jsx(Je,{placeholder:"Input tokens",value:r.inputTokens,onChange:u=>n({...r,inputTokens:u.target.value})}),i.jsx(Je,{placeholder:"Output tokens",value:r.outputTokens,onChange:u=>n({...r,outputTokens:u.target.value})}),i.jsx(Je,{placeholder:"Cost USD",value:r.costUsd,onChange:u=>n({...r,costUsd:u.target.value})}),i.jsx(Je,{placeholder:"Latency ms",value:r.latencyMs,onChange:u=>n({...r,latencyMs:u.target.value})})]}),i.jsx(Ne,{className:"mt-3 min-h-[44px]",onClick:()=>{d("Usage event recorded.",async()=>{await pn("/api/platformization/usage/events",{method:"POST",body:JSON.stringify(r)})})},children:"Record usage"})]}),i.jsxs(Ca,{title:"Create eval suite",children:[i.jsx(Je,{placeholder:"Suite name",value:o.name,onChange:u=>l({...o,name:u.target.value})}),i.jsx(Je,{className:"mt-2",placeholder:"Description",value:o.description,onChange:u=>l({...o,description:u.target.value})}),i.jsx(Je,{className:"mt-2",placeholder:"First task title",value:o.taskTitle,onChange:u=>l({...o,taskTitle:u.target.value})}),i.jsx(Ni,{className:"mt-2",rows:3,placeholder:"Acceptance criteria, one per line",value:o.acceptanceCriteria,onChange:u=>l({...o,acceptanceCriteria:u.target.value})}),i.jsx(Ne,{className:"mt-3 min-h-[44px]",onClick:()=>{d("Evaluation suite created.",async()=>{await pn("/api/platformization/eval/suites",{method:"POST",body:JSON.stringify({name:o.name||"Regression suite",description:o.description,tasks:[{title:o.taskTitle||"Demo task",projectPath:c,acceptanceCriteria:Bo(o.acceptanceCriteria)}]})})})},children:"Create suite"})]}),i.jsxs(Ca,{title:"Register marketplace entry",children:[i.jsx(Je,{placeholder:"Name",value:a.name,onChange:u=>s({...a,name:u.target.value})}),i.jsx(Va,{className:"mt-2",value:a.type,onChange:u=>s({...a,type:u}),options:["mcp-server","workflow-template","provider-adapter","notification-channel"]}),i.jsx(Je,{className:"mt-2",placeholder:"Source package or repository",value:a.source,onChange:u=>s({...a,source:u.target.value})}),i.jsx(Je,{className:"mt-2",placeholder:"Install command",value:a.installCommand,onChange:u=>s({...a,installCommand:u.target.value})}),i.jsx(Ni,{className:"mt-2",rows:3,placeholder:"Permission scopes, one per line",value:a.permissionScopes,onChange:u=>s({...a,permissionScopes:u.target.value})}),i.jsx(Ne,{className:"mt-3 min-h-[44px]",onClick:()=>{d("Marketplace entry saved.",async()=>{await pn("/api/platformization/marketplace/plugins",{method:"POST",body:JSON.stringify({...a,permissionScopes:Bo(a.permissionScopes)})})})},children:"Save entry"})]})]})})]})}function Kre(e,t){return t.attention>0?"Open Operations first. Clear reviews, errors, failed evals, or security findings before starting new work.":e==="access"?"Open Settings > Access and save the one URL your users should use. Then assign project roles in People.":e==="people"?"Create sub-users first, assign project roles second, then share an access path.":e==="security"?"Store secrets with the smallest scope that works, then run a permission or secret scan.":e==="insights"?"Compare provider cost, latency, and eval pass rate before changing model defaults.":"Review Running now and the timeline. If nothing needs attention, start the next issue-to-PR or scheduled job."}function Ca({title:e,children:t}){return i.jsxs("div",{className:"rounded-lg border border-border/60 bg-background p-4",children:[i.jsx("div",{className:"mb-3 text-sm font-semibold text-foreground",children:e}),t]})}function Yh({number:e,title:t,description:r}){return i.jsxs("div",{className:"rounded-lg border border-border/60 bg-background px-4 py-4",children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("span",{className:"flex h-7 w-7 items-center justify-center rounded-md bg-primary/10 text-xs font-semibold text-primary",children:e}),i.jsx("div",{className:"text-sm font-semibold text-foreground",children:t})]}),i.jsx("p",{className:"mt-2 text-xs leading-5 text-muted-foreground",children:r})]})}function Va({value:e,options:t,onChange:r,className:n=""}){return i.jsx("select",{value:e,onChange:a=>r(a.target.value),className:xe("flex h-11 w-full rounded-md border border-input bg-background px-3 py-1 text-sm shadow-sm focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring",n),children:t.map(a=>i.jsx("option",{value:a,children:a},a))})}function Ni(e){return i.jsx("textarea",{...e,className:xe("w-full rounded-md border border-input bg-background px-3 py-2 text-sm shadow-sm placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring",e.className)})}function aN(e,t,r){return{theme:e?"dark":"light",project:t?{name:t.name,path:t.fullPath||t.path||""}:null,session:r?{id:r.id,title:r.title||r.name||r.id}:null}}function qI({pluginName:e,selectedProject:t,selectedSession:r}){const n=m.useRef(null),{isDarkMode:a}=ri(),{plugins:s}=ep(),o=m.useRef(aN(a,t,r)),l=m.useRef(new Set),c=m.useRef(null),d=s.find(u=>u.name===e);return m.useEffect(()=>{const u=aN(a,t,r);o.current=u;for(const p of l.current)try{p(u)}catch{}},[a,t,r]),m.useEffect(()=>{if(!n.current||!d?.enabled)return;let u=!0;const p=n.current,f=d?.entry??"index.js",h=l.current;return(async()=>{try{const g=`/api/plugins/${encodeURIComponent(e)}/assets/${encodeURIComponent(f)}`,b=await Ce(g);if(!b.ok)throw new Error(`Failed to fetch plugin (HTTP ${b.status})`);const x=await b.text(),y=new Blob([x],{type:"application/javascript"}),v=URL.createObjectURL(y),w=await import(v).finally(()=>URL.revokeObjectURL(v));if(!u||!n.current)return;c.current=w;const k={get context(){return o.current},onContextChange(S){return h.add(S),()=>h.delete(S)},async rpc(S,N,E){const I=String(N).replace(/^\//,""),A=await Ce(`/api/plugins/${encodeURIComponent(e)}/rpc/${I}`,{method:S||"GET",...E!==void 0?{body:JSON.stringify(E)}:{}});if(!A.ok)throw new Error(`RPC error ${A.status}`);return A.json()}};if(await w.mount?.(p,k),!u){try{w.unmount?.(p)}catch{}c.current=null;return}}catch(g){if(!u)return;if(console.error(`[Plugin:${e}] Failed to load:`,g),n.current){const b=document.createElement("div");b.style.cssText="padding:16px;font-size:13px;color:#dc2626",b.textContent=`Plugin failed to load: ${String(g)}`,n.current.replaceChildren(b)}}})(),()=>{u=!1;try{c.current?.unmount?.(p)}catch{}h.clear(),c.current=null}},[e,d?.entry,d?.enabled]),i.jsx("div",{ref:n,className:"h-full w-full overflow-auto"})}const Rg="quickSettingsHandlePosition",Ul=50,Yre=10,Zre=90,Xre=5,_g="flex items-center justify-between p-3 rounded-lg bg-gray-50 dark:bg-gray-800 hover:bg-gray-100 dark:hover:bg-gray-700 transition-colors border border-transparent hover:border-gray-300 dark:hover:border-gray-600",Jre=`${_g} cursor-pointer`,Qre="h-4 w-4 rounded border-gray-300 dark:border-gray-600 text-blue-600 dark:text-blue-500 focus:ring-blue-500 focus:ring-2 dark:focus:ring-blue-400 bg-gray-100 dark:bg-gray-800 checked:bg-blue-600 dark:checked:bg-blue-600",ene=[{key:"autoExpandTools",labelKey:"quickSettings.autoExpandTools",icon:Zu},{key:"showRawParameters",labelKey:"quickSettings.showRawParameters",icon:Ec},{key:"showThinking",labelKey:"quickSettings.showThinking",icon:Yg}],tne=[{key:"autoScrollToBottom",labelKey:"quickSettings.autoScrollToBottom",icon:L4}],rne=[{key:"sendByCtrlEnter",labelKey:"quickSettings.sendByCtrlEnter",icon:U4}],KI=e=>Math.max(Yre,Math.min(Zre,e)),nne=()=>{if(typeof window>"u")return Ul;const e=localStorage.getItem(Rg);if(!e)return Ul;try{const t=JSON.parse(e);if(typeof t.y=="number"&&Number.isFinite(t.y))return KI(t.y)}catch{return localStorage.removeItem(Rg),Ul}return Ul},iN=e=>e.type.includes("touch"),sN=e=>"touches"in e?e.touches[0]?.clientY??null:"clientY"in e&&typeof e.clientY=="number"?e.clientY:null;function ane({isMobile:e}){const[t,r]=m.useState(nne),[n,a]=m.useState(!1),[s,o]=m.useState(!1),l=m.useRef(null),c=m.useRef(Ul),d=m.useRef(!1),u=m.useRef(!1),p=m.useRef(!1),f=m.useCallback(()=>{p.current&&(document.body.style.cursor="",document.body.style.userSelect="",document.body.style.overflow="",document.body.style.position="",document.body.style.width="",p.current=!1)},[]),h=m.useCallback(w=>{p.current||(document.body.style.cursor="grabbing",document.body.style.userSelect="none",w&&(document.body.style.overflow="hidden",document.body.style.position="fixed",document.body.style.width="100%"),p.current=!0)},[]),g=m.useCallback(()=>{!n&&l.current===null||(u.current=d.current,d.current=!1,l.current=null,a(!1),o(!1),f())},[f,n]),b=m.useCallback(w=>{if(!n||l.current===null)return;const k=sN(w);if(k===null)return;const S=k-l.current,N=Math.abs(S)>Xre;if(!d.current&&N&&(d.current=!0,o(!0),h(iN(w))),!d.current)return;iN(w)&&w.preventDefault();const E=Math.max(window.innerHeight,1),I=S/E*100,A=e?-I:I;r(KI(c.current+A))},[h,e,n]),x=m.useCallback(w=>{w.stopPropagation();const k=sN(w);k!==null&&(l.current=k,c.current=t,d.current=!1,o(!1),a(!0))},[t]);m.useEffect(()=>{localStorage.setItem(Rg,JSON.stringify({y:t}))},[t]),m.useEffect(()=>{if(!n)return;const w=E=>{b(E)},k=()=>{g()},S=E=>{b(E)},N=()=>{g()};return document.addEventListener("mousemove",w),document.addEventListener("mouseup",k),document.addEventListener("touchmove",S,{passive:!1}),document.addEventListener("touchend",N),()=>{document.removeEventListener("mousemove",w),document.removeEventListener("mouseup",k),document.removeEventListener("touchmove",S),document.removeEventListener("touchend",N)}},[g,b,n]),m.useEffect(()=>()=>{f()},[f]);const y=m.useCallback(()=>u.current?(u.current=!1,!0):!1,[]),v=m.useMemo(()=>!e||typeof window>"u"?{top:`${t}%`,transform:"translateY(-50%)"}:{bottom:`${window.innerHeight*t/100}px`},[t,e]);return{isDragging:s,handleStyle:v,startDrag:x,endDrag:g,consumeSuppressedClick:y}}function jl({title:e,children:t,className:r=""}){return i.jsxs("div",{className:`space-y-2 ${r}`,children:[i.jsx("h4",{className:"mb-2 text-xs font-semibold uppercase tracking-wider text-gray-500 dark:text-gray-400",children:e}),t]})}function ine({label:e,icon:t,checked:r,onCheckedChange:n}){return i.jsxs("label",{className:Jre,children:[i.jsxs("span",{className:"flex items-center gap-2 text-sm text-gray-900 dark:text-white",children:[i.jsx(t,{className:"h-4 w-4 text-gray-600 dark:text-gray-400"}),e]}),i.jsx("input",{type:"checkbox",checked:r,onChange:a=>n(a.target.checked),className:Qre})]})}const sne=m.memo(ine),one=[{value:"off",labelKey:"quickSettings.autoShowAgentDiffOff"},{value:"openOnly",labelKey:"quickSettings.autoShowAgentDiffOpenOnly"},{value:"always",labelKey:"quickSettings.autoShowAgentDiffAlways"}];function lne({isDarkMode:e,preferences:t,onPreferenceChange:r,onSelectChange:n}){const{t:a}=He("settings"),s=o=>o.map(({key:l,labelKey:c,icon:d})=>i.jsx(sne,{label:a(c),icon:d,checked:t[l],onCheckedChange:u=>r(l,u)},l));return i.jsxs("div",{className:"flex-1 space-y-6 overflow-y-auto overflow-x-hidden bg-background p-4",children:[i.jsxs(jl,{title:a("quickSettings.sections.appearance"),children:[i.jsxs("div",{className:_g,children:[i.jsxs("span",{className:"flex items-center gap-2 text-sm text-gray-900 dark:text-white",children:[e?i.jsx($4,{className:"h-4 w-4 text-gray-600 dark:text-gray-400"}):i.jsx(V4,{className:"h-4 w-4 text-gray-600 dark:text-gray-400"}),a("quickSettings.darkMode")]}),i.jsx(uu,{})]}),i.jsx(cT,{compact:!0})]}),i.jsx(jl,{title:a("quickSettings.sections.toolDisplay"),children:s(ene)}),i.jsx(jl,{title:a("quickSettings.sections.viewOptions"),children:s(tne)}),i.jsx(jl,{title:a("quickSettings.sections.agentDiff","Agent diff"),children:i.jsxs("div",{className:_g,children:[i.jsx("span",{className:"text-sm text-gray-900 dark:text-white",children:a("quickSettings.autoShowAgentDiff","Show agent edits as diff")}),i.jsx(rp,{children:one.map(({value:o,labelKey:l})=>i.jsx(np,{isActive:t.autoShowAgentDiff===o,onClick:()=>n("autoShowAgentDiff",o),children:a(l)},o))})]})}),i.jsxs(jl,{title:a("quickSettings.sections.inputSettings"),children:[s(rne),i.jsx("p",{className:"ml-3 text-xs text-gray-500 dark:text-gray-400",children:a("quickSettings.sendByCtrlEnterDescription")})]})]})}function cne({isOpen:e,isDragging:t,style:r,onClick:n,onMouseDown:a,onTouchStart:s}){const{t:o}=He("settings"),l=e?"right-64":"right-0",c=t?"border-blue-500 dark:border-blue-400":"border-gray-200 dark:border-gray-700",d=t?"":"transition-all duration-150 ease-out",u=t?"cursor-grabbing":"cursor-pointer",p=o(t?"quickSettings.dragHandle.dragging":e?"quickSettings.dragHandle.closePanel":"quickSettings.dragHandle.openPanel"),f=o(t?"quickSettings.dragHandle.draggingStatus":"quickSettings.dragHandle.toggleAndMove");return i.jsx("button",{type:"button",onClick:n,onMouseDown:a,onTouchStart:s,className:`fixed ${l} z-50 ${d} border bg-white dark:bg-gray-800 ${c} rounded-l-md p-2 shadow-lg transition-colors hover:bg-gray-100 dark:hover:bg-gray-700 ${u} touch-none`,style:{...r,touchAction:"none",WebkitTouchCallout:"none",WebkitUserSelect:"none"},"aria-label":p,title:f,children:t?i.jsx(YD,{className:"h-5 w-5 text-blue-500 dark:text-blue-400"}):e?i.jsx(Fn,{className:"h-5 w-5 text-gray-600 dark:text-gray-400"}):i.jsx(Go,{className:"h-5 w-5 text-gray-600 dark:text-gray-400"})})}function dne(){const{t:e}=He("settings");return i.jsx("div",{className:"border-b border-gray-200 bg-gray-50 p-4 dark:border-gray-700 dark:bg-gray-900",children:i.jsxs("h3",{className:"flex items-center gap-2 text-lg font-semibold text-gray-900 dark:text-white",children:[i.jsx(G4,{className:"h-5 w-5 text-gray-600 dark:text-gray-400"}),e("quickSettings.title")]})})}function une(){const[e,t]=m.useState(!1),{isMobile:r}=Zg({trackPWA:!1}),{isDarkMode:n}=ri(),{preferences:a,setPreference:s}=tp(),{isDragging:o,handleStyle:l,startDrag:c,consumeSuppressedClick:d}=ane({isMobile:r}),u=m.useMemo(()=>({autoExpandTools:a.autoExpandTools,showRawParameters:a.showRawParameters,showThinking:a.showThinking,autoScrollToBottom:a.autoScrollToBottom,sendByCtrlEnter:a.sendByCtrlEnter,autoShowAgentDiff:a.autoShowAgentDiff}),[a.autoExpandTools,a.autoScrollToBottom,a.sendByCtrlEnter,a.showRawParameters,a.showThinking,a.autoShowAgentDiff]),p=m.useCallback((g,b)=>{s(g,b)},[s]),f=m.useCallback((g,b)=>{s(g,b)},[s]),h=m.useCallback(g=>{if(d()){g.preventDefault();return}t(b=>!b)},[d]);return i.jsxs(i.Fragment,{children:[i.jsx(cne,{isOpen:e,isDragging:o,style:l,onClick:h,onMouseDown:c,onTouchStart:c}),i.jsx("div",{className:`fixed right-0 top-0 z-40 h-full w-64 transform border-l border-border bg-background shadow-xl transition-transform duration-150 ease-out ${e?"translate-x-0":"translate-x-full"} ${r?"h-screen":""}`,children:i.jsxs("div",{className:"flex h-full flex-col",children:[i.jsx(dne,{}),i.jsx(lne,{isDarkMode:n,preferences:u,onPreferenceChange:p,onSelectChange:f})]})}),e&&i.jsx("div",{className:"fixed inset-0 z-30 bg-background/80 backdrop-blur-sm transition-opacity duration-150 ease-out",onClick:()=>t(!1)})]})}const pne=[{key:"modified",status:"M"},{key:"added",status:"A"},{key:"deleted",status:"D"},{key:"untracked",status:"U"}];function YI(e){if(!e)return[];const t=new Set,r=[];return pne.forEach(({key:n,status:a})=>{(e[n]||[]).forEach(s=>{const o=String(s||"").replace(/\\/g,"/").trim();!o||t.has(o)||(t.add(o),r.push({path:o,status:a,source:"git"}))})}),r}function mne(e,t){return e?t.filter(r=>!e.has(r.path)):[]}const hne=new Set(["edit","multiedit","write","applypatch","apply_patch","filechanges"]),fne=["file_path","filePath","path","filename"];function Gc(e){return!!(e&&typeof e=="object"&&!Array.isArray(e))}function Vc(e){return String(e||"").replace(/\\/g,"/").trim()}function zu(e){return String(e||"").replace(/[\s-]/g,"").toLowerCase()}function ZI(e){if(typeof e!="string")return e;const t=e.trim();if(!t||!t.startsWith("{")&&!t.startsWith("["))return e;try{return JSON.parse(t)}catch{return e}}function gne(e){const t=Gc(e.state)?e.state:null;return e.toolInput??e.input??e.parameters??e.args??e.arguments??t?.input}function bne(e){return String(e.toolName??e.tool_name??e.name??e.tool??"").trim()}function xne(e,t){for(const r of t){const n=e[r];if(typeof n=="string"&&n.length>0)return n}}function yne(e){const t=zu(e);return hne.has(t)?t==="write"?"A":"M":null}function vne(e,t){if(zu(e)==="write"){const s=t.content;return typeof s=="string"?{old_string:"",new_string:s}:null}const n=t.old_string,a=t.new_string;if(typeof n=="string"||typeof a=="string")return{old_string:typeof n=="string"?n:"",new_string:typeof a=="string"?a:""};if(Array.isArray(t.edits)){const s=[],o=[];if(t.edits.forEach(l=>{Gc(l)&&(typeof l.old_string=="string"&&s.push(l.old_string),typeof l.new_string=="string"&&o.push(l.new_string))}),s.length>0||o.length>0)return{old_string:s.join(`
669
+ `),findingTitle:""}),[H,z]=m.useState({name:"",type:"mcp-server",source:"",installCommand:"",permissionScopes:""}),[te,se]=m.useState({name:"",description:"",taskTitle:"",acceptanceCriteria:""}),me=e?.name||e?.displayName||"",de=e?.path||e?.fullPath||"",ce=m.useMemo(()=>Ure(c),[c]),ye=_d.find(ae=>ae.id===o)||_d[0],he=m.useCallback((ae,ue,Y)=>t(`controlRoom.${ae}`,{defaultValue:ue,...Y}),[t]);C0(r,"fade-up"),zF(n,o),BF(a,`${o}-${ce.length}`),UF(s,g||f);const ke=m.useCallback(async()=>{p(!0),h(null);try{const[ae,ue]=await Promise.all([pn("/api/production-agent-loop"),pn("/api/platformization")]);d({production:ae.state||Kh.production,platform:ue.state||Kh.platform})}catch(ae){h(ae instanceof Error?ae.message:String(ae))}finally{p(!1)}},[]);m.useEffect(()=>{ke()},[ke]);const ve=m.useCallback(async(ae,ue)=>{h(null),b(null);try{await ue(),b(ae),await ke()}catch(Y){h(Y instanceof Error?Y.message:String(Y))}},[ke]),je=m.useMemo(()=>{const ae=x.trim().toLowerCase(),ue=c.platform.auditLog||[];return ae?ue.filter(Y=>JSON.stringify(Y).toLowerCase().includes(ae)):ue},[x,c.platform.auditLog]),M={attention:VI(c),running:WI(c),reviews:c.production.reviewQueue?.length||0,users:c.platform.adminUsers?.length||0,collaborators:c.platform.projectCollaborators?.length||0,secrets:c.platform.secrets?.length||0,plugins:c.platform.marketplacePlugins?.length||0,evalRuns:c.platform.evaluationRuns?.length||0,audits:c.platform.securityAuditRuns?.length||0};return i.jsxs("div",{ref:r,className:"flex h-full min-h-0 flex-col overflow-hidden bg-background",children:[i.jsxs("header",{className:"flex flex-col gap-3 border-b border-border/60 px-4 py-4 sm:flex-row sm:items-center sm:justify-between",children:[i.jsxs("div",{className:"min-w-0",children:[i.jsxs("div",{className:"flex items-center gap-2 text-sm font-semibold text-foreground",children:[i.jsx($n,{className:"h-4 w-4"}),he("title","Control room")]}),i.jsx("p",{className:"mt-1 max-w-3xl text-xs leading-5 text-muted-foreground",children:he("subtitle","A task-first command surface for {{target}}. Start with what needs attention, then open detail only when needed.",{target:e?.displayName||he("thisServer","this self-hosted server")})})]}),i.jsxs(Ne,{className:"min-h-[44px] shrink-0",size:"sm",variant:"outline",onClick:()=>{ke()},disabled:u,children:[i.jsx(at,{className:xe("h-4 w-4",u&&"animate-spin")}),he("refresh","Refresh")]})]}),i.jsxs("div",{className:"grid min-h-0 flex-1 grid-cols-1 overflow-hidden lg:grid-cols-[220px_minmax(0,1fr)_320px]",children:[i.jsx("nav",{className:"hidden border-r border-border/60 bg-muted/15 p-3 lg:block",children:i.jsx("div",{className:"space-y-2",children:_d.map(ae=>i.jsx($re,{group:ae,isActive:o===ae.id,onClick:()=>l(ae.id)},ae.id))})}),i.jsxs("main",{ref:n,className:"min-h-0 overflow-auto",children:[i.jsx("div",{className:"overflow-x-auto lg:hidden",children:i.jsx("div",{className:"flex gap-2 border-b border-border/60 bg-muted/15 px-4 py-3",children:_d.map(ae=>i.jsxs("button",{type:"button",onClick:()=>l(ae.id),className:xe("inline-flex h-11 shrink-0 items-center gap-2 rounded-md border px-3 text-sm font-medium",o===ae.id?"border-primary/40 bg-primary/10 text-foreground":"border-border/60 bg-background text-muted-foreground"),children:[i.jsx(ae.icon,{className:"h-4 w-4"}),ae.label]},ae.id))})}),i.jsxs("div",{className:"space-y-6 p-4 md:p-6",children:[i.jsxs("div",{ref:s,children:[f&&i.jsx(nN,{tone:"danger",children:f}),g&&i.jsx(nN,{tone:"success",children:g})]}),i.jsxs("section",{children:[i.jsxs("div",{className:"mb-4 flex flex-col gap-2 sm:flex-row sm:items-end sm:justify-between",children:[i.jsxs("div",{children:[i.jsx("h2",{className:"text-base font-semibold text-foreground",children:he("overview.commandSurface","Command surface")}),i.jsx("p",{className:"mt-1 text-sm text-muted-foreground",children:he("overview.commandSurfaceDescription","Six cards, one decision: what should you look at next?")})]}),i.jsxs(Tt,{variant:"secondary",children:[he("overview.currentGroup","Current group"),": ",ye.label]})]}),i.jsx("div",{ref:a,className:"grid gap-3 sm:grid-cols-2 xl:grid-cols-3",children:Pre.map(ae=>i.jsx(Rre,{icon:ae.icon,title:he(`overviewCards.${ae.id}.title`,ae.title),description:he(`overviewCards.${ae.id}.description`,ae.description),meta:he(`overviewCards.${ae.id}.meta`,ae.meta),value:ae.value(c),tone:ae.tone,isActive:o===ae.group,onClick:()=>l(ae.group)},ae.id))})]}),o==="operations"&&i.jsx(Hre,{cr:he,totals:M,timeline:ce,snapshot:c,defaultProjectName:me,defaultProjectPath:de,issueForm:k,setIssueForm:S,ciLog:N,setCiLog:E,repairPlan:v,setRepairPlan:w,reviewForm:I,setReviewForm:A,schedulerForm:T,setSchedulerForm:_,action:ve}),o==="people"&&i.jsx(Gre,{cr:he,snapshot:c,defaultProjectName:me,defaultProjectPath:de,adminForm:j,setAdminForm:R,collaboratorForm:C,setCollaboratorForm:D,auditQuery:x,setAuditQuery:y,filteredAudit:je,action:ve}),o==="access"&&i.jsx(Vre,{cr:he,selectedProject:e}),o==="security"&&i.jsx(Wre,{cr:he,snapshot:c,defaultProjectName:me,defaultProjectPath:de,secretForm:B,setSecretForm:F,securityForm:L,setSecurityForm:G,action:ve}),o==="insights"&&i.jsx(qre,{cr:he,snapshot:c,usageForm:V,setUsageForm:K,pluginForm:H,setPluginForm:z,evalSuiteForm:te,setEvalSuiteForm:se,defaultProjectPath:de,action:ve})]})]}),i.jsxs(_re,{className:"hidden min-h-0 overflow-auto rounded-none border-y-0 border-r-0 lg:block",title:"What this means",description:ye.description,children:[i.jsx(Sa,{title:"Recommended next step",description:Kre(o,M)}),i.jsx(Ea,{title:"Run timeline",description:"Readable activity feed for agents, reviewers, checkpoints, and audit events.",children:i.jsx("div",{className:"space-y-3",children:i.jsx(Bi,{items:ce.slice(0,5),empty:i.jsx(zi,{title:"No run timeline yet",description:"Run activity appears here after issue runs, reviews, checkpoints, or audit events are recorded."}),render:ae=>i.jsx(HI,{time:ae.time,actor:ae.actor,action:ae.action,result:ae.result,tone:ae.tone},ae.id)})})}),i.jsx(Ea,{title:"Server signal",description:"The first screen avoids raw backend sections and shows only current status.",children:i.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[i.jsx(Or,{label:"Attention",value:M.attention,icon:wr,tone:M.attention?"warning":"success"}),i.jsx(Or,{label:"Running",value:M.running,icon:Cs,tone:"info"})]})})]})]})]})}function $re({group:e,isActive:t,onClick:r}){return i.jsxs("button",{type:"button",onClick:r,className:xe("flex min-h-[44px] w-full items-start gap-3 rounded-lg border px-3 py-3 text-left transition-colors",t?"border-primary/40 bg-primary/10 text-foreground":"border-transparent text-muted-foreground hover:border-border/70 hover:bg-background"),children:[i.jsx(e.icon,{className:"mt-0.5 h-4 w-4 shrink-0"}),i.jsxs("span",{className:"min-w-0",children:[i.jsx("span",{className:"block text-sm font-medium",children:e.label}),i.jsx("span",{className:"mt-0.5 block text-xs leading-4 text-muted-foreground",children:e.description})]})]})}function Hre({cr:e,totals:t,timeline:r,snapshot:n,defaultProjectName:a,defaultProjectPath:s,issueForm:o,setIssueForm:l,ciLog:c,setCiLog:d,repairPlan:u,setRepairPlan:p,reviewForm:f,setReviewForm:h,schedulerForm:g,setSchedulerForm:b,action:x}){return i.jsxs("section",{className:"space-y-4",children:[i.jsx(Sa,{description:e("guidance.operations","Use Operations when something is actively running, waiting for review, or needs repair. Forms stay hidden until you intentionally open them.")}),i.jsxs("div",{className:"grid gap-3 sm:grid-cols-2 xl:grid-cols-4",children:[i.jsx(Or,{label:"Needs attention",value:t.attention,icon:wr,tone:t.attention?"warning":"success"}),i.jsx(Or,{label:"Running now",value:t.running,icon:Cs,tone:"info"}),i.jsx(Or,{label:"Reviews",value:t.reviews,icon:ia}),i.jsx(Or,{label:"Checkpoints",value:n.production.checkpoints?.length||0,icon:Wa,tone:"success"})]}),i.jsx(Ea,{title:"Run timeline",description:"Readable actor, action, and result history without raw JSON.",children:i.jsx("div",{className:"space-y-3",children:i.jsx(Bi,{items:r,empty:i.jsx(zi,{title:"No activity yet",description:"Issue runs, review decisions, checkpoints, and audit events will appear here as a vertical timeline."}),render:y=>i.jsx(HI,{time:y.time,actor:y.actor,action:y.action,result:y.result,tone:y.tone,children:y.details},y.id)})})}),i.jsx(Ea,{title:"Action queue",description:"Review items are shown as mobile-friendly rows instead of a cramped table.",children:i.jsx(Bi,{items:n.production.reviewQueue||[],empty:i.jsx(zi,{title:"No review items",description:"Create a review item when changed files need an accept/fix decision."}),render:y=>i.jsx(zo,{title:y.title||"Review requested",description:`${y.changedFiles?.length||0} changed files`,status:y.status||"review_requested",action:i.jsx(Ne,{size:"sm",variant:"outline",onClick:()=>{x("Review marked accepted.",async()=>{await pn(`/api/production-agent-loop/review-queue/${encodeURIComponent(y.id)}`,{method:"PATCH",body:JSON.stringify({status:"accepted"})})})},children:"Accept"})},y.id)})}),i.jsx(Lp,{title:"Advanced operations",description:"Queue runs, parse CI failures, create reviews, or schedule background work.",children:i.jsxs("div",{className:"grid gap-4 xl:grid-cols-2",children:[i.jsxs(Ca,{title:"Queue issue-to-PR run",children:[i.jsx(Je,{placeholder:"GitHub issue URL",value:o.issueUrl,onChange:y=>l({...o,issueUrl:y.target.value})}),i.jsxs("div",{className:"mt-2 grid gap-2 sm:grid-cols-2",children:[i.jsx(Je,{placeholder:"Manual title fallback",value:o.title,onChange:y=>l({...o,title:y.target.value})}),i.jsx(Je,{placeholder:"Model",value:o.model,onChange:y=>l({...o,model:y.target.value})}),i.jsx(Va,{value:o.provider,onChange:y=>l({...o,provider:y}),options:GI}),i.jsx(Je,{placeholder:"Base branch",value:o.baseBranch,onChange:y=>l({...o,baseBranch:y.target.value})})]}),i.jsx(Ni,{className:"mt-2",rows:4,value:o.acceptanceCriteria,onChange:y=>l({...o,acceptanceCriteria:y.target.value})}),i.jsxs(Ne,{className:"mt-3 min-h-[44px]",onClick:()=>{x("Issue-to-PR run queued.",async()=>{await pn("/api/production-agent-loop/github/issue-to-pr",{method:"POST",body:JSON.stringify({...o,projectName:a,projectPath:s,acceptanceCriteria:Bo(o.acceptanceCriteria)})})})},children:[i.jsx(Ut,{className:"h-4 w-4"}),"Queue run"]})]}),i.jsxs(Ca,{title:"CI repair and review queue",children:[i.jsx(Ni,{rows:5,placeholder:"Paste failing CI, lint, typecheck, or build output",value:c,onChange:y=>d(y.target.value)}),i.jsx(Ne,{className:"mt-3 min-h-[44px]",variant:"outline",onClick:()=>{x("CI repair plan generated.",async()=>{const y=await pn("/api/production-agent-loop/ci/repair-plan",{method:"POST",body:JSON.stringify({log:c})});p(y.repairPlan)})},children:"Parse failure"}),u&&i.jsx("pre",{className:"mt-3 max-h-56 overflow-auto rounded-md bg-muted/30 p-3 text-xs text-muted-foreground",children:u.repairPrompt}),i.jsx(Je,{className:"mt-4",placeholder:"Review title",value:f.title,onChange:y=>h({...f,title:y.target.value})}),i.jsx(Ni,{className:"mt-2",rows:3,placeholder:"Changed files, one per line",value:f.changedFiles,onChange:y=>h({...f,changedFiles:y.target.value})}),i.jsx(Ne,{className:"mt-3 min-h-[44px]",onClick:()=>{x("Review item created.",async()=>{await pn("/api/production-agent-loop/review-queue",{method:"POST",body:JSON.stringify({projectName:a,projectPath:s,title:f.title||"Review requested",notes:f.notes,changedFiles:Bo(f.changedFiles)})})})},children:"Create review item"})]}),i.jsxs(Ca,{title:"Background job",children:[i.jsxs("div",{className:"grid gap-2 sm:grid-cols-2",children:[i.jsx(Je,{placeholder:"Job name",value:g.name,onChange:y=>b({...g,name:y.target.value})}),i.jsx(Va,{value:g.mode,onChange:y=>b({...g,mode:y}),options:["manual","watch","cron"]}),i.jsx(Je,{placeholder:"Cron or watch expression",value:g.cron,onChange:y=>b({...g,cron:y.target.value})})]}),i.jsx(Ni,{className:"mt-2",rows:3,placeholder:"Background agent prompt",value:g.prompt,onChange:y=>b({...g,prompt:y.target.value})}),i.jsx(Ne,{className:"mt-3 min-h-[44px]",onClick:()=>{x("Background job scheduled.",async()=>{await pn("/api/production-agent-loop/scheduler/jobs",{method:"POST",body:JSON.stringify({...g,projectName:a,provider:o.provider})})})},children:"Schedule job"})]})]})})]})}function Gre({cr:e,snapshot:t,defaultProjectName:r,defaultProjectPath:n,adminForm:a,setAdminForm:s,collaboratorForm:o,setCollaboratorForm:l,auditQuery:c,setAuditQuery:d,filteredAudit:u,action:p}){const f=!!(r&&o.userRef?.trim());return i.jsxs("section",{className:"space-y-4",children:[i.jsx(Sa,{description:e("guidance.people","People is for who can enter the self-hosted server and what they can do inside each project.")}),i.jsxs("div",{className:"grid gap-3 sm:grid-cols-2 xl:grid-cols-4",children:[i.jsx(Or,{label:"Sub-users",value:t.platform.adminUsers?.length||0,icon:vs}),i.jsx(Or,{label:"Collaborators",value:t.platform.projectCollaborators?.length||0,icon:vs,tone:"info"}),i.jsx(Or,{label:"Roles",value:Object.keys(t.platform.roles||{}).length,icon:Tn}),i.jsx(Or,{label:"Audit events",value:t.platform.auditLog?.length||0,icon:ia})]}),i.jsx(Ea,{title:"Project collaborators",description:"Project partners and workers are not global admins. They get scoped access to assigned projects.",children:i.jsx(Bi,{items:t.platform.projectCollaborators||[],empty:i.jsx(zi,{title:"No collaborators yet",description:"Create a sub-user first, then assign that person to a project role."}),render:h=>i.jsx(zo,{title:h.userRef,description:`${h.projectName||"Project"} - ${Object.keys(h.capabilities||{}).filter(g=>h.capabilities[g]).join(", ")||"role scoped"}`,status:h.role},h.id)})}),i.jsxs(Ea,{title:"Audit log",description:"Search what sub-users, project partners, and workers changed without opening a raw database view.",children:[i.jsx(Je,{className:"mb-3 h-11",placeholder:"Search actor, action, project, or detail",value:c,onChange:h=>d(h.target.value)}),i.jsx(Bi,{items:u,empty:i.jsx(zi,{title:"No audit events match",description:"User and project access activity appears here after actions are recorded."}),render:h=>i.jsx(zo,{title:h.actorId||"system",description:`${h.action||"Audit event"} - ${Bl(h.createdAt)}`,status:h.resource||h.target||"audit"},h.id)})]}),i.jsx(Lp,{title:"Advanced people management",description:"Create users and assign project roles only when needed.",children:i.jsxs("div",{className:"grid gap-4 xl:grid-cols-2",children:[i.jsxs(Ca,{title:"Create sub-user",children:[i.jsx(Je,{placeholder:"Username or email",value:a.username,onChange:h=>s({...a,username:h.target.value})}),i.jsx(Je,{className:"mt-2",type:"password",placeholder:"Temporary password",value:a.password,onChange:h=>s({...a,password:h.target.value})}),i.jsxs("div",{className:"mt-2 grid gap-2 sm:grid-cols-2",children:[i.jsx(Va,{value:a.role,onChange:h=>s({...a,role:h}),options:Lre}),i.jsx(Va,{value:a.status,onChange:h=>s({...a,status:h}),options:["active","disabled"]})]}),i.jsx(Ne,{className:"mt-3 min-h-[44px]",onClick:()=>{p("Sub-user created.",async()=>{await pn("/api/platformization/admin/users",{method:"POST",body:JSON.stringify(a)}),s({...a,username:"",password:""})})},children:"Create user"})]}),i.jsxs(Ca,{title:"Assign project collaborator",children:[i.jsx(Je,{placeholder:"User email or username",value:o.userRef,onChange:h=>l({...o,userRef:h.target.value})}),i.jsx(Va,{className:"mt-2",value:o.role,onChange:h=>l({...o,role:h}),options:Dre}),i.jsx(Ni,{className:"mt-2",rows:3,placeholder:"Allowed folders, one per line. Use . for whole project.",value:o.allowedRoots,onChange:h=>l({...o,allowedRoots:h.target.value})}),i.jsx(Sa,{title:"Recommended next step",description:r?`Assign this person to ${r}, then share an access URL from Settings > Access.`:"Select a project before assigning scoped access."}),i.jsx(Ne,{className:"mt-3 min-h-[44px]",disabled:!f,onClick:()=>{p("Project collaborator added.",async()=>{await pn("/api/platformization/project-collaborators",{method:"POST",body:JSON.stringify({...o,allowedRoots:Bo(o.allowedRoots),projectName:r,projectPath:n})}),l({...o,userRef:"",allowedRoots:"."})})},children:"Add collaborator"})]})]})})]})}function Vre({cr:e,selectedProject:t}){return i.jsxs("section",{className:"space-y-4",children:[i.jsx(Sa,{description:e("guidance.access","Access explains how people reach Pixcode. The actual server-wide setup belongs in Settings > Access because it affects every project and user."),action:i.jsx(Ne,{className:"min-h-[44px]",variant:"outline",onClick:()=>window.openSettings?.("access"),children:"Open Settings > Access"})}),i.jsxs("div",{className:"grid gap-3 md:grid-cols-3",children:[i.jsx(Sa,{title:"LAN and local",description:"Use when the browser is on the same machine or network. Start here before private or public tunnels."}),i.jsx(Sa,{title:"Tailscale private access",description:"Best when a team needs private access without exposing Pixcode publicly. The UI should guide install, login, and URL sharing."}),i.jsx(Sa,{title:"Cloudflare or custom domain",description:"Best when users need a stable HTTPS URL. Configure the tunnel/domain once and share it with assigned users."})]}),i.jsx(Ea,{title:"How users connect",description:"This keeps Access understandable for non-technical users.",children:i.jsxs("div",{className:"grid gap-3 md:grid-cols-3",children:[i.jsx(Yh,{number:"1",title:"Create the user",description:"Add them in People so the server knows who they are."}),i.jsx(Yh,{number:"2",title:"Assign project role",description:`Give them project access${t?.displayName?` for ${t.displayName}`:""}.`}),i.jsx(Yh,{number:"3",title:"Share one URL",description:"Use a LAN, Tailscale, Cloudflare Tunnel, or custom domain URL from Settings > Access."})]})})]})}function Wre({cr:e,snapshot:t,defaultProjectName:r,defaultProjectPath:n,secretForm:a,setSecretForm:s,securityForm:o,setSecurityForm:l,action:c}){return i.jsxs("section",{className:"space-y-4",children:[i.jsx(Sa,{description:e("guidance.security","Security keeps sensitive values, permission checks, and audit risk visible without exposing raw secrets."),tone:"warning"}),i.jsxs("div",{className:"grid gap-3 sm:grid-cols-2 xl:grid-cols-4",children:[i.jsx(Or,{label:"Scoped secrets",value:t.platform.secrets?.length||0,icon:Tc}),i.jsx(Or,{label:"Audit runs",value:t.platform.securityAuditRuns?.length||0,icon:Cc,tone:"warning"}),i.jsx(Or,{label:"Findings",value:(t.platform.securityAuditRuns||[]).reduce((d,u)=>d+(u.findings?.length||0),0),icon:wr,tone:"danger"}),i.jsx(Or,{label:"Audit events",value:t.platform.auditLog?.length||0,icon:ia})]}),i.jsx(Ea,{title:"Secret vault",description:"Rows show scope, target, and redacted env names. Values stay hidden.",children:i.jsx(Bi,{items:t.platform.secrets||[],empty:i.jsx(zi,{title:"No secrets stored",description:"Store provider, project, workflow, Telegram, or API env values from the advanced form."}),render:d=>i.jsx(zo,{title:d.envName,description:`${d.name} - ${d.target||"global"} - ${d.redacted}`,status:d.scope},d.id)})}),i.jsx(Lp,{title:"Advanced security actions",description:"Store scoped env values or queue audit checks.",children:i.jsxs("div",{className:"grid gap-4 xl:grid-cols-2",children:[i.jsxs(Ca,{title:"Create secret",children:[i.jsxs("div",{className:"grid gap-2 sm:grid-cols-2",children:[i.jsx(Je,{placeholder:"Secret name",value:a.name,onChange:d=>s({...a,name:d.target.value})}),i.jsx(Je,{placeholder:"ENV_NAME",value:a.envName,onChange:d=>s({...a,envName:d.target.value})}),i.jsx(Va,{value:a.scope,onChange:d=>s({...a,scope:d}),options:Ore}),i.jsx(Je,{placeholder:"Target project/provider/workflow",value:a.target||n,onChange:d=>s({...a,target:d.target.value})})]}),i.jsx(Je,{className:"mt-2",type:"password",placeholder:"Secret value",value:a.value,onChange:d=>s({...a,value:d.target.value})}),i.jsx(Ne,{className:"mt-3 min-h-[44px]",onClick:()=>{c("Secret stored in the vault.",async()=>{await pn("/api/platformization/secrets",{method:"POST",body:JSON.stringify({...a,target:a.target||n})}),s({...a,value:""})})},children:"Store secret"})]}),i.jsxs(Ca,{title:"Create audit run",children:[i.jsx(Ni,{rows:5,value:o.checks,onChange:d=>l({...o,checks:d.target.value})}),i.jsx(Je,{className:"mt-2",placeholder:"Optional finding title",value:o.findingTitle,onChange:d=>l({...o,findingTitle:d.target.value})}),i.jsx(Ne,{className:"mt-3 min-h-[44px]",onClick:()=>{c("Security audit queued.",async()=>{await pn("/api/platformization/security/audit-runs",{method:"POST",body:JSON.stringify({projectName:r,projectPath:n,checks:Bo(o.checks),findings:o.findingTitle?[{title:o.findingTitle,severity:"medium"}]:[]})})})},children:"Create audit"})]})]})})]})}function qre({cr:e,snapshot:t,usageForm:r,setUsageForm:n,pluginForm:a,setPluginForm:s,evalSuiteForm:o,setEvalSuiteForm:l,defaultProjectPath:c,action:d}){return i.jsxs("section",{className:"space-y-4",children:[i.jsx(Sa,{description:e("guidance.insights","Insights is for model/runtime decisions: cost, latency, eval quality, and marketplace health."),tone:"success"}),i.jsxs("div",{className:"grid gap-3 sm:grid-cols-2 xl:grid-cols-4",children:[i.jsx(Or,{label:"Usage rows",value:t.platform.usageSummary?.length||0,icon:Vg}),i.jsx(Or,{label:"Eval runs",value:t.platform.evaluationRuns?.length||0,icon:pr,tone:"success"}),i.jsx(Or,{label:"Eval suites",value:t.platform.evaluationSuites?.length||0,icon:Wa}),i.jsx(Or,{label:"Marketplace",value:t.platform.marketplacePlugins?.length||0,icon:ca,tone:"info"})]}),i.jsx(Ea,{title:"Usage summary",description:"Provider metrics are stacked as cards on mobile instead of forcing a wide table.",children:i.jsx(Bi,{items:t.platform.usageSummary||[],empty:i.jsx(zi,{title:"No usage events yet",description:"Usage appears after provider or workflow events are recorded."}),render:(u,p)=>i.jsx(zo,{title:`${u.provider||"provider"} ${u.model||""}`.trim(),description:`${zre(u.totalTokens)} tokens - ${Bre(u.costUsd)} - ${u.averageLatencyMs||0}ms avg`,status:`${u.errorRate||0}% errors`},`${u.provider}-${u.model}-${u.workflow}-${p}`)})}),i.jsx(Ea,{title:"Marketplace health",description:"MCP servers, workflow templates, provider adapters, and notification channels stay visible without crowding the overview.",children:i.jsx(Bi,{items:t.platform.marketplacePlugins||[],empty:i.jsx(zi,{title:"No marketplace entries",description:"Register entries only when a plugin or workflow template is ready to install."}),render:u=>i.jsx(zo,{title:u.name,description:u.source||"No source configured",status:`${u.type} - ${u.health?.status||"unknown"}`},u.id)})}),i.jsx(Lp,{title:"Advanced insight actions",description:"Record usage, create evaluation suites, or register marketplace entries.",children:i.jsxs("div",{className:"grid gap-4 xl:grid-cols-3",children:[i.jsxs(Ca,{title:"Record usage",children:[i.jsxs("div",{className:"grid gap-2 sm:grid-cols-2",children:[i.jsx(Va,{value:r.provider,onChange:u=>n({...r,provider:u}),options:GI}),i.jsx(Je,{placeholder:"Model",value:r.model,onChange:u=>n({...r,model:u.target.value})}),i.jsx(Je,{placeholder:"Workflow",value:r.workflow,onChange:u=>n({...r,workflow:u.target.value})}),i.jsx(Va,{value:r.status,onChange:u=>n({...r,status:u}),options:["ok","error","timeout"]}),i.jsx(Je,{placeholder:"Input tokens",value:r.inputTokens,onChange:u=>n({...r,inputTokens:u.target.value})}),i.jsx(Je,{placeholder:"Output tokens",value:r.outputTokens,onChange:u=>n({...r,outputTokens:u.target.value})}),i.jsx(Je,{placeholder:"Cost USD",value:r.costUsd,onChange:u=>n({...r,costUsd:u.target.value})}),i.jsx(Je,{placeholder:"Latency ms",value:r.latencyMs,onChange:u=>n({...r,latencyMs:u.target.value})})]}),i.jsx(Ne,{className:"mt-3 min-h-[44px]",onClick:()=>{d("Usage event recorded.",async()=>{await pn("/api/platformization/usage/events",{method:"POST",body:JSON.stringify(r)})})},children:"Record usage"})]}),i.jsxs(Ca,{title:"Create eval suite",children:[i.jsx(Je,{placeholder:"Suite name",value:o.name,onChange:u=>l({...o,name:u.target.value})}),i.jsx(Je,{className:"mt-2",placeholder:"Description",value:o.description,onChange:u=>l({...o,description:u.target.value})}),i.jsx(Je,{className:"mt-2",placeholder:"First task title",value:o.taskTitle,onChange:u=>l({...o,taskTitle:u.target.value})}),i.jsx(Ni,{className:"mt-2",rows:3,placeholder:"Acceptance criteria, one per line",value:o.acceptanceCriteria,onChange:u=>l({...o,acceptanceCriteria:u.target.value})}),i.jsx(Ne,{className:"mt-3 min-h-[44px]",onClick:()=>{d("Evaluation suite created.",async()=>{await pn("/api/platformization/eval/suites",{method:"POST",body:JSON.stringify({name:o.name||"Regression suite",description:o.description,tasks:[{title:o.taskTitle||"Demo task",projectPath:c,acceptanceCriteria:Bo(o.acceptanceCriteria)}]})})})},children:"Create suite"})]}),i.jsxs(Ca,{title:"Register marketplace entry",children:[i.jsx(Je,{placeholder:"Name",value:a.name,onChange:u=>s({...a,name:u.target.value})}),i.jsx(Va,{className:"mt-2",value:a.type,onChange:u=>s({...a,type:u}),options:["mcp-server","workflow-template","provider-adapter","notification-channel"]}),i.jsx(Je,{className:"mt-2",placeholder:"Source package or repository",value:a.source,onChange:u=>s({...a,source:u.target.value})}),i.jsx(Je,{className:"mt-2",placeholder:"Install command",value:a.installCommand,onChange:u=>s({...a,installCommand:u.target.value})}),i.jsx(Ni,{className:"mt-2",rows:3,placeholder:"Permission scopes, one per line",value:a.permissionScopes,onChange:u=>s({...a,permissionScopes:u.target.value})}),i.jsx(Ne,{className:"mt-3 min-h-[44px]",onClick:()=>{d("Marketplace entry saved.",async()=>{await pn("/api/platformization/marketplace/plugins",{method:"POST",body:JSON.stringify({...a,permissionScopes:Bo(a.permissionScopes)})})})},children:"Save entry"})]})]})})]})}function Kre(e,t){return t.attention>0?"Open Operations first. Clear reviews, errors, failed evals, or security findings before starting new work.":e==="access"?"Open Settings > Access and save the one URL your users should use. Then assign project roles in People.":e==="people"?"Create sub-users first, assign project roles second, then share an access path.":e==="security"?"Store secrets with the smallest scope that works, then run a permission or secret scan.":e==="insights"?"Compare provider cost, latency, and eval pass rate before changing model defaults.":"Review Running now and the timeline. If nothing needs attention, start the next issue-to-PR or scheduled job."}function Ca({title:e,children:t}){return i.jsxs("div",{className:"rounded-lg border border-border/60 bg-background p-4",children:[i.jsx("div",{className:"mb-3 text-sm font-semibold text-foreground",children:e}),t]})}function Yh({number:e,title:t,description:r}){return i.jsxs("div",{className:"rounded-lg border border-border/60 bg-background px-4 py-4",children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("span",{className:"flex h-7 w-7 items-center justify-center rounded-md bg-primary/10 text-xs font-semibold text-primary",children:e}),i.jsx("div",{className:"text-sm font-semibold text-foreground",children:t})]}),i.jsx("p",{className:"mt-2 text-xs leading-5 text-muted-foreground",children:r})]})}function Va({value:e,options:t,onChange:r,className:n=""}){return i.jsx("select",{value:e,onChange:a=>r(a.target.value),className:xe("flex h-11 w-full rounded-md border border-input bg-background px-3 py-1 text-sm shadow-sm focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring",n),children:t.map(a=>i.jsx("option",{value:a,children:a},a))})}function Ni(e){return i.jsx("textarea",{...e,className:xe("w-full rounded-md border border-input bg-background px-3 py-2 text-sm shadow-sm placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring",e.className)})}function aN(e,t,r){return{theme:e?"dark":"light",project:t?{name:t.name,path:t.fullPath||t.path||""}:null,session:r?{id:r.id,title:r.title||r.name||r.id}:null}}function qI({pluginName:e,selectedProject:t,selectedSession:r}){const n=m.useRef(null),{isDarkMode:a}=ri(),{plugins:s}=ep(),o=m.useRef(aN(a,t,r)),l=m.useRef(new Set),c=m.useRef(null),d=s.find(u=>u.name===e);return m.useEffect(()=>{const u=aN(a,t,r);o.current=u;for(const p of l.current)try{p(u)}catch{}},[a,t,r]),m.useEffect(()=>{if(!n.current||!d?.enabled)return;let u=!0;const p=n.current,f=d?.entry??"index.js",h=l.current;return(async()=>{try{const g=`/api/plugins/${encodeURIComponent(e)}/assets/${encodeURIComponent(f)}`,b=await Ce(g);if(!b.ok)throw new Error(`Failed to fetch plugin (HTTP ${b.status})`);const x=await b.text(),y=new Blob([x],{type:"application/javascript"}),v=URL.createObjectURL(y),w=await import(v).finally(()=>URL.revokeObjectURL(v));if(!u||!n.current)return;c.current=w;const k={get context(){return o.current},onContextChange(S){return h.add(S),()=>h.delete(S)},async rpc(S,N,E){const I=String(N).replace(/^\//,""),A=await Ce(`/api/plugins/${encodeURIComponent(e)}/rpc/${I}`,{method:S||"GET",...E!==void 0?{body:JSON.stringify(E)}:{}});if(!A.ok)throw new Error(`RPC error ${A.status}`);return A.json()}};if(await w.mount?.(p,k),!u){try{w.unmount?.(p)}catch{}c.current=null;return}}catch(g){if(!u)return;if(console.error(`[Plugin:${e}] Failed to load:`,g),n.current){const b=document.createElement("div");b.style.cssText="padding:16px;font-size:13px;color:#dc2626",b.textContent=`Plugin failed to load: ${String(g)}`,n.current.replaceChildren(b)}}})(),()=>{u=!1;try{c.current?.unmount?.(p)}catch{}h.clear(),c.current=null}},[e,d?.entry,d?.enabled]),i.jsx("div",{ref:n,className:"h-full w-full overflow-auto"})}const Yre=[{key:"modified",status:"M"},{key:"added",status:"A"},{key:"deleted",status:"D"},{key:"untracked",status:"U"}];function KI(e){if(!e)return[];const t=new Set,r=[];return Yre.forEach(({key:n,status:a})=>{(e[n]||[]).forEach(s=>{const o=String(s||"").replace(/\\/g,"/").trim();!o||t.has(o)||(t.add(o),r.push({path:o,status:a,source:"git"}))})}),r}function Zre(e,t){return e?t.filter(r=>!e.has(r.path)):[]}const Xre=new Set(["edit","multiedit","write","applypatch","apply_patch","filechanges"]),Jre=["file_path","filePath","path","filename"];function Gc(e){return!!(e&&typeof e=="object"&&!Array.isArray(e))}function Vc(e){return String(e||"").replace(/\\/g,"/").trim()}function zu(e){return String(e||"").replace(/[\s-]/g,"").toLowerCase()}function YI(e){if(typeof e!="string")return e;const t=e.trim();if(!t||!t.startsWith("{")&&!t.startsWith("["))return e;try{return JSON.parse(t)}catch{return e}}function Qre(e){const t=Gc(e.state)?e.state:null;return e.toolInput??e.input??e.parameters??e.args??e.arguments??t?.input}function ene(e){return String(e.toolName??e.tool_name??e.name??e.tool??"").trim()}function tne(e,t){for(const r of t){const n=e[r];if(typeof n=="string"&&n.length>0)return n}}function rne(e){const t=zu(e);return Xre.has(t)?t==="write"?"A":"M":null}function nne(e,t){if(zu(e)==="write"){const s=t.content;return typeof s=="string"?{old_string:"",new_string:s}:null}const n=t.old_string,a=t.new_string;if(typeof n=="string"||typeof a=="string")return{old_string:typeof n=="string"?n:"",new_string:typeof a=="string"?a:""};if(Array.isArray(t.edits)){const s=[],o=[];if(t.edits.forEach(l=>{Gc(l)&&(typeof l.old_string=="string"&&s.push(l.old_string),typeof l.new_string=="string"&&o.push(l.new_string))}),s.length>0||o.length>0)return{old_string:s.join(`
670
670
 
671
671
  `),new_string:o.join(`
672
672
 
673
- `)}}return null}function wne(e){if(typeof e!="string"||!e.trim())return[];const t=[],r=new Set,n=(a,s="M")=>{const o=Vc(a);!o||r.has(o)||(r.add(o),t.push({path:o,status:s,source:"agent"}))};return e.split(/\r?\n/).forEach(a=>{const s=/^(?:\*\*\* )?(Update|Add|Delete) File:\s+(.+)$/.exec(a.trim());if(s){const[,c,d]=s;n(d,c==="Add"?"A":c==="Delete"?"D":"M");return}const o=/^diff --git a\/(.+?) b\/(.+)$/.exec(a.trim());if(o){n(o[2],"M");return}const l=/^\+\+\+ b\/(.+)$/.exec(a.trim());l&&n(l[1],"M")}),t}function kne(e){return Gc(e)?YI(e).map(t=>({...t,source:"agent"})):[]}function Sne(e,t){const r=yne(e),n=ZI(t);if(!r)return[];const a=kne(n);if(zu(e)==="filechanges"&&a.length>0)return a;if(!Gc(n))return[];const s=xne(n,fne),o=vne(e,n);if(s){const l=Vc(s);return l?[{path:l,status:r,diffInfo:o,source:"agent"}]:[]}return zu(e).includes("patch")?wne(n.patch??n.content):[]}function XI(e){const t=[],r=new Set,n=s=>{s.forEach(o=>{const l=Vc(o.path);if(!l)return;const c=`${o.status}:${l}:${o.diffInfo?.old_string??""}:${o.diffInfo?.new_string??""}`;r.has(c)||(r.add(c),t.push({...o,path:l,source:o.source??"agent"}))})},a=(s,o=0)=>{if(o>6)return;const l=ZI(s);if(Array.isArray(l)){l.forEach(u=>a(u,o+1));return}if(!Gc(l))return;const c=bne(l),d=gne(l);c&&d!==void 0&&n(Sne(c,d)),Array.isArray(l.subagentTools)&&l.subagentTools.forEach(u=>a(u,o+1)),Array.isArray(l.childTools)&&l.childTools.forEach(u=>a(u,o+1)),a(l.tool,o+1),a(l.part,o+1),a(l.message,o+1),a(l.data,o+1)};return a(e),t}function Pd(...e){const t=new Map;return e.forEach(r=>{r.forEach(n=>{const a=Vc(n.path);if(!a)return;const s=t.get(a);if(!s){t.set(a,{...n,path:a,diffInfo:n.diffInfo??null});return}t.set(a,{...n,...s,path:a,diffInfo:s.diffInfo??n.diffInfo??null,source:s.source??n.source})})}),Array.from(t.values())}function Cne(e){return e?typeof e.old_string=="string"||typeof e.new_string=="string":!1}function Nne(e,t){const r=t?.path?.replace(/\\/g,"/").replace(/\/+$/,""),n=Vc(e.path);if(!r)return{...e,path:n};const a=r.toLowerCase(),s=n.toLowerCase(),o=`${a}/`;return s.startsWith(o)?{...e,path:n.slice(r.length+1)}:{...e,path:n}}function Ene(e){if(!e||typeof e!="object")return String(e??"");const t=e;return String(t.id??t.toolId??t.requestId??`${t.kind??t.type??"message"}:${t.sessionId??""}:${t.timestamp??""}`)}function JI(e,t,r){const[n,a]=m.useState(null),s=m.useRef(null);return m.useEffect(()=>{if(r==="off"||!e||!t)return;const o=Ene(t);if(s.current===o)return;s.current=o;const l=XI(t).map(d=>Nne(d,e)).filter(d=>Cne(d.diffInfo));if(l.length===0)return;const c=l[0];a({path:c.path,status:c.status,diffInfo:c.diffInfo,detectedAt:Date.now()})},[t,e,r]),{latestDetectedFile:n}}const Tne=400;function QI(e,t,r,n){const a=m.useRef(new Map),s=m.useCallback(async(l,c)=>{try{const d=await Ce(`/api/git/file-with-diff?project=${encodeURIComponent(l)}&file=${encodeURIComponent(c)}`,{cache:"no-store"}),u=await d.json();if(d.ok&&!u.error&&typeof u.currentContent=="string"&&typeof u.oldContent=="string")return{old_string:u.oldContent,new_string:u.currentContent}}catch{}try{const d=await Ce(`/api/projects/${encodeURIComponent(l)}/file?path=${encodeURIComponent(c)}`,{cache:"no-store"}),u=await d.json();if(d.ok&&typeof u.content=="string")return{old_string:"",new_string:u.content}}catch{}return null},[]),o=m.useCallback(async(l,c)=>{if(t==="off"||!e)return;const d=r.map(h=>h.replace(/\\/g,"/")),u=c.replace(/\\/g,"/");if(!d.includes(u)&&t!=="always")return;const f=await s(l,c);f&&n(c,f)},[s,t,n,r,e]);m.useEffect(()=>{if(t==="off"||!e)return;const l=a.current,c=d=>{const u=d.detail,p=u?.projectName,f=u?.changedFile;if(!p||!f||p!==e.name)return;const h=a.current.get(f);h&&window.clearTimeout(h);const g=window.setTimeout(()=>{a.current.delete(f),o(p,f)},Tne);a.current.set(f,g)};return window.addEventListener("pixcode:file-tree-refresh",c),()=>{window.removeEventListener("pixcode:file-tree-refresh",c),l.forEach(d=>window.clearTimeout(d)),l.clear()}},[o,t,e])}const Ane=4e3,jne=80;function Ine(e){return e instanceof Error?e.message:String(e)}function oN(e,t){const r=t?.path?.replace(/\\/g,"/").replace(/\/+$/,""),n=e.path.replace(/\\/g,"/");if(!r)return{...e,path:n};const a=r.toLowerCase(),s=n.toLowerCase(),o=`${a}/`;return s.startsWith(o)?{...e,path:n.slice(r.length+1)}:{...e,path:n}}function Rne(e){if(!e||typeof e!="object")return String(e??"");const t=e;return String(t.id??t.toolId??t.requestId??`${t.kind??t.type??"message"}:${t.sessionId??""}:${t.timestamp??""}`)}function _ne(e,t,r,n="local"){const[a,s]=m.useState([]),[o,l]=m.useState(!1),[c,d]=m.useState(null),[u,p]=m.useState(null),[f,h]=m.useState(null),g=m.useRef(null),b=m.useRef([]),x=m.useRef([]),y=m.useRef(null),v=m.useRef(e?.name??null),w=m.useRef(0),k=m.useRef(null);m.useEffect(()=>{v.current=e?.name??null,g.current=null,b.current=[],x.current=[],y.current=null,s([]),d(null),p(null),h(null)},[e?.name,n]);const S=m.useCallback(async(N="manual")=>{if(!t||!e)return;const E=w.current+1;w.current=E;const I=e.name;(N==="initial"||N==="manual")&&l(!0);try{const A=new URLSearchParams({project:I,mode:n}),T=await Ce(`/api/git/status?${A.toString()}`,{cache:"no-store"}),_=await T.json();if(w.current!==E||v.current!==I)return;if(!T.ok||_.error){const B=_.details??_.error??`Git status failed (${T.status})`;d(B),n==="git"&&(b.current=[],s([]));return}const j=YI(_).map(B=>oN(B,e)),R=n==="local"&&_.trackingMode==="filesystem"?Pd(b.current,j):j,C=new Set(R.map(B=>B.path)),D=n==="local"&&_.trackingMode==="filesystem"?j:mne(g.current,R);g.current=C,b.current=R,s(n==="local"?Pd(x.current,R):R),p(Date.now()),d(null),D.length>0&&h({...D[0],detectedAt:Date.now()})}catch(A){if(w.current!==E||v.current!==I)return;d(Ine(A))}finally{w.current===E&&l(!1)}},[t,e,n]);return m.useEffect(()=>{if(!t||!e||!r||n!=="local")return;const N=Rne(r);if(y.current===N)return;y.current=N;const E=XI(r).map(A=>oN(A,e));if(E.length===0)return;x.current=Pd(E,x.current).slice(0,jne),s(Pd(x.current,b.current));const I=Date.now();h({...E[0],detectedAt:I}),p(I),d(null)},[t,r,e,n]),m.useEffect(()=>{if(!t||!e)return;const N=E=>{const I=E.detail;I?.projectName&&I.projectName!==e.name||(k.current&&window.clearTimeout(k.current),k.current=window.setTimeout(()=>{k.current=null,S("run-state")},300))};return window.addEventListener(Uf,N),()=>{window.removeEventListener(Uf,N),k.current&&(window.clearTimeout(k.current),k.current=null)}},[t,S,e]),m.useEffect(()=>{if(!t||!e){g.current=null,s([]),d(null),l(!1);return}S("initial");const N=window.setInterval(()=>{S("poll")},Ane),E=()=>{S("focus")};return window.addEventListener("focus",E),()=>{window.clearInterval(N),window.removeEventListener("focus",E)}},[t,S,e]),{changedFiles:a,isLoading:o,error:c,lastCheckedAt:u,latestDetectedFile:f,refresh:S}}const Pne=({selectedProject:e,isMobile:t,initialWidth:r=600})=>{const[n,a]=m.useState(null),[s,o]=m.useState(r),[l,c]=m.useState(!1),[d,u]=m.useState(!1),[p,f]=m.useState(!1),h=m.useRef(null),g=m.useCallback((v,w=null)=>{const S=v.replace(/\\/g,"/").split("/").pop()||v;a({name:S,path:v,projectName:e?.name,diffInfo:w})},[e?.name]),b=m.useCallback(()=>{a(null),c(!1)},[]),x=m.useCallback(()=>{c(v=>!v)},[]),y=m.useCallback(v=>{t||(f(!0),u(!0),v.preventDefault())},[t]);return m.useEffect(()=>{const v=k=>{if(!d)return;const N=h.current?.parentElement?.parentElement;if(!N)return;const E=N.getBoundingClientRect(),I=E.right-k.clientX,A=300,T=E.width*.8;I>=A&&I<=T&&o(I)},w=()=>{u(!1)};return d&&(document.addEventListener("mousemove",v),document.addEventListener("mouseup",w),document.body.style.cursor="col-resize",document.body.style.userSelect="none"),()=>{document.removeEventListener("mousemove",v),document.removeEventListener("mouseup",w),document.body.style.cursor="",document.body.style.userSelect=""}},[d]),{editingFile:n,editorWidth:s,editorExpanded:l,hasManualWidth:p,resizeHandleRef:h,handleFileOpen:g,handleCloseEditor:b,handleToggleEditorExpand:x,handleResizeStart:y}};class Er{constructor(t,r,n,a){this.fromA=t,this.toA=r,this.fromB=n,this.toB=a}offset(t,r=t){return new Er(this.fromA+t,this.toA+t,this.fromB+r,this.toB+r)}}function ks(e,t,r,n,a,s){if(e==n)return[];let o=kw(e,t,r,n,a,s),l=Sw(e,t+o,r,n,a+o,s);t+=o,r-=l,a+=o,s-=l;let c=r-t,d=s-a;if(!c||!d)return[new Er(t,r,a,s)];if(c>d){let p=e.slice(t,r).indexOf(n.slice(a,s));if(p>-1)return[new Er(t,t+p,a,a),new Er(t+p+d,r,s,s)]}else if(d>c){let p=n.slice(a,s).indexOf(e.slice(t,r));if(p>-1)return[new Er(t,t,a,a+p),new Er(r,r,a+p+c,s)]}if(c==1||d==1)return[new Er(t,r,a,s)];let u=r6(e,t,r,n,a,s);if(u){let[p,f,h]=u;return ks(e,t,p,n,a,f).concat(ks(e,p+h,r,n,f+h,s))}return Lne(e,t,r,n,a,s)}let $l=1e9,Hl=0,ww=!1;function Lne(e,t,r,n,a,s){let o=r-t,l=s-a;if($l<1e9&&Math.min(o,l)>$l*16||Hl>0&&Date.now()>Hl)return Math.min(o,l)>$l*64?[new Er(t,r,a,s)]:lN(e,t,r,n,a,s);let c=Math.ceil((o+l)/2);Zh.reset(c),Xh.reset(c);let d=(h,g)=>e.charCodeAt(t+h)==n.charCodeAt(a+g),u=(h,g)=>e.charCodeAt(r-h-1)==n.charCodeAt(s-g-1),p=(o-l)%2!=0?Xh:null,f=p?null:Zh;for(let h=0;h<c;h++){if(h>$l||Hl>0&&!(h&63)&&Date.now()>Hl)return lN(e,t,r,n,a,s);let g=Zh.advance(h,o,l,c,p,!1,d)||Xh.advance(h,o,l,c,f,!0,u);if(g)return Dne(e,t,r,t+g[0],n,a,s,a+g[1])}return[new Er(t,r,a,s)]}class e6{constructor(){this.vec=[]}reset(t){this.len=t<<1;for(let r=0;r<this.len;r++)this.vec[r]=-1;this.vec[t+1]=0,this.start=this.end=0}advance(t,r,n,a,s,o,l){for(let c=-t+this.start;c<=t-this.end;c+=2){let d=a+c,u=c==-t||c!=t&&this.vec[d-1]<this.vec[d+1]?this.vec[d+1]:this.vec[d-1]+1,p=u-c;for(;u<r&&p<n&&l(u,p);)u++,p++;if(this.vec[d]=u,u>r)this.end+=2;else if(p>n)this.start+=2;else if(s){let f=a+(r-n)-c;if(f>=0&&f<this.len&&s.vec[f]!=-1)if(o){let h=s.vec[f];if(h>=r-u)return[h,a+h-f]}else{let h=r-s.vec[f];if(u>=h)return[u,p]}}}return null}}const Zh=new e6,Xh=new e6;function Dne(e,t,r,n,a,s,o,l){let c=!1;return!Uo(e,n)&&++n==r&&(c=!0),!Uo(a,l)&&++l==o&&(c=!0),c?[new Er(t,r,s,o)]:ks(e,t,n,a,s,l).concat(ks(e,n,r,a,l,o))}function t6(e,t){let r=1,n=Math.min(e,t);for(;r<n;)r=r<<1;return r}function kw(e,t,r,n,a,s){if(t==r||t==s||e.charCodeAt(t)!=n.charCodeAt(a))return 0;let o=t6(r-t,s-a);for(let l=t,c=a;;){let d=l+o,u=c+o;if(d>r||u>s||e.slice(l,d)!=n.slice(c,u)){if(o==1)return l-t-(Uo(e,l)?0:1);o=o>>1}else{if(d==r||u==s)return d-t;l=d,c=u}}}function Sw(e,t,r,n,a,s){if(t==r||a==s||e.charCodeAt(r-1)!=n.charCodeAt(s-1))return 0;let o=t6(r-t,s-a);for(let l=r,c=s;;){let d=l-o,u=c-o;if(d<t||u<a||e.slice(d,l)!=n.slice(u,c)){if(o==1)return r-l-(Uo(e,l)?0:1);o=o>>1}else{if(d==t||u==a)return r-d;l=d,c=u}}}function Pg(e,t,r,n,a,s,o,l){let c=n.slice(a,s),d=null;for(;;){if(d||o<l)return d;for(let u=t+o;;){Uo(e,u)||u++;let p=u+o;if(Uo(e,p)||(p+=p==u+1?1:-1),p>=r)break;let f=e.slice(u,p),h=-1;for(;(h=c.indexOf(f,h+1))!=-1;){let g=kw(e,p,r,n,a+h+f.length,s),b=Sw(e,t,u,n,a,a+h),x=f.length+g+b;(!d||d[2]<x)&&(d=[u-b,a+h-b,x])}u=p}if(l<0)return d;o=o>>1}}function r6(e,t,r,n,a,s){let o=r-t,l=s-a;if(o<l){let c=r6(n,a,s,e,t,r);return c&&[c[1],c[0],c[2]]}return o<4||l*2<o?null:Pg(e,t,r,n,a,s,Math.floor(o/4),-1)}function lN(e,t,r,n,a,s){ww=!0;let o=r-t,l=s-a,c;if(o<l){let f=Pg(n,a,s,e,t,r,Math.floor(o/6),50);c=f&&[f[1],f[0],f[2]]}else c=Pg(e,t,r,n,a,s,Math.floor(l/6),50);if(!c)return[new Er(t,r,a,s)];let[d,u,p]=c;return ks(e,t,d,n,a,u).concat(ks(e,d+p,r,n,u+p,s))}function n6(e,t){for(let r=1;r<e.length;r++){let n=e[r-1],a=e[r];n.toA>a.fromA-t&&n.toB>a.fromB-t&&(e[r-1]=new Er(n.fromA,a.toA,n.fromB,a.toB),e.splice(r--,1))}}function One(e,t,r){for(;;){n6(r,1);let n=!1;for(let a=0;a<r.length;a++){let s=r[a],o,l;(o=kw(e,s.fromA,s.toA,t,s.fromB,s.toB))&&(s=r[a]=new Er(s.fromA+o,s.toA,s.fromB+o,s.toB)),(l=Sw(e,s.fromA,s.toA,t,s.fromB,s.toB))&&(s=r[a]=new Er(s.fromA,s.toA-l,s.fromB,s.toB-l));let c=s.toA-s.fromA,d=s.toB-s.fromB;if(c&&d)continue;let u=s.fromA-(a?r[a-1].toA:0),p=(a<r.length-1?r[a+1].fromA:e.length)-s.toA;if(!u||!p)continue;let f=c?e.slice(s.fromA,s.toA):t.slice(s.fromB,s.toB);u<=f.length&&e.slice(s.fromA-u,s.fromA)==f.slice(f.length-u)?(r[a]=new Er(s.fromA-u,s.toA-u,s.fromB-u,s.toB-u),n=!0):p<=f.length&&e.slice(s.toA,s.toA+p)==f.slice(0,p)&&(r[a]=new Er(s.fromA+p,s.toA+p,s.fromB+p,s.toB+p),n=!0)}if(!n)break}return r}function Mne(e,t,r){for(let n=0,a=0;a<e.length;a++){let s=e[a],o=s.toA-s.fromA,l=s.toB-s.fromB;if(o&&l||o>3||l>3){let c=a==e.length-1?t.length:e[a+1].fromA,d=s.fromA-n,u=c-s.toA,p=dN(t,s.fromA,d),f=cN(t,s.toA,u),h=s.fromA-p,g=f-s.toA;if((!o||!l)&&h&&g){let b=Math.max(o,l),[x,y,v]=o?[t,s.fromA,s.toA]:[r,s.fromB,s.toB];b>h&&t.slice(p,s.fromA)==x.slice(v-h,v)?(s=e[a]=new Er(p,p+o,s.fromB-h,s.toB-h),p=s.fromA,f=cN(t,s.toA,c-s.toA)):b>g&&t.slice(s.toA,f)==x.slice(y,y+g)&&(s=e[a]=new Er(f-o,f,s.fromB+g,s.toB+g),f=s.toA,p=dN(t,s.fromA,s.fromA-n)),h=s.fromA-p,g=f-s.toA}if(h||g)s=e[a]=new Er(s.fromA-h,s.toA+g,s.fromB-h,s.toB+g);else if(o){if(!l){let b=pN(t,s.fromA,s.toA),x,y=b<0?-1:uN(t,s.toA,s.fromA);b>-1&&(x=b-s.fromA)<=u&&t.slice(s.fromA,b)==t.slice(s.toA,s.toA+x)?s=e[a]=s.offset(x):y>-1&&(x=s.toA-y)<=d&&t.slice(s.fromA-x,s.fromA)==t.slice(y,s.toA)&&(s=e[a]=s.offset(-x))}}else{let b=pN(r,s.fromB,s.toB),x,y=b<0?-1:uN(r,s.toB,s.fromB);b>-1&&(x=b-s.fromB)<=u&&r.slice(s.fromB,b)==r.slice(s.toB,s.toB+x)?s=e[a]=s.offset(x):y>-1&&(x=s.toB-y)<=d&&r.slice(s.fromB-x,s.fromB)==r.slice(y,s.toB)&&(s=e[a]=s.offset(-x))}}n=s.toA}return n6(e,3),e}let bs;try{bs=new RegExp("[\\p{Alphabetic}\\p{Number}]","u")}catch{}function a6(e){return e>48&&e<58||e>64&&e<91||e>96&&e<123}function i6(e,t){if(t==e.length)return 0;let r=e.charCodeAt(t);return r<192?a6(r)?1:0:bs?!l6(r)||t==e.length-1?bs.test(String.fromCharCode(r))?1:0:bs.test(e.slice(t,t+2))?2:0:0}function s6(e,t){if(!t)return 0;let r=e.charCodeAt(t-1);return r<192?a6(r)?1:0:bs?!c6(r)||t==1?bs.test(String.fromCharCode(r))?1:0:bs.test(e.slice(t-2,t))?2:0:0}const o6=8;function cN(e,t,r){if(t==e.length||!s6(e,t))return t;for(let n=t,a=t+r,s=0;s<o6;s++){let o=i6(e,n);if(!o||n+o>a)return n;n+=o}return t}function dN(e,t,r){if(!t||!i6(e,t))return t;for(let n=t,a=t-r,s=0;s<o6;s++){let o=s6(e,n);if(!o||n-o<a)return n;n-=o}return t}function uN(e,t,r){for(;t!=r;t--)if(e.charCodeAt(t-1)==10)return t;return-1}function pN(e,t,r){for(;t!=r;t++)if(e.charCodeAt(t)==10)return t;return-1}const l6=e=>e>=55296&&e<=56319,c6=e=>e>=56320&&e<=57343;function Uo(e,t){return!t||t==e.length||!l6(e.charCodeAt(t-1))||!c6(e.charCodeAt(t))}function Fne(e,t,r){var n;return $l=((n=r?.scanLimit)!==null&&n!==void 0?n:1e9)>>1,Hl=r?.timeout?Date.now()+r.timeout:0,ww=!1,One(e,t,ks(e,0,e.length,t,0,t.length))}function d6(){return!ww}function u6(e,t,r){return Mne(Fne(e,t,r),e,t)}const ei=Hu.define({combine:e=>e[0]}),zne=Mg.define(),p6=Hu.define(),ta=kc.define({create(e){return null},update(e,t){for(let r of t.effects)r.is(zne)&&(e=r.value);for(let r of t.state.facet(p6))e=r(e,t);return e}});function Cw(e){let t=e.field(ta,!1);if(!t)return null;let r=e.facet(ei);return{chunks:t,side:r?r.side:null}}class So{constructor(t,r,n,a,s,o=!0){this.changes=t,this.fromA=r,this.toA=n,this.fromB=a,this.toB=s,this.precise=o}offset(t,r){return t||r?new So(this.changes,this.fromA+t,this.toA+t,this.fromB+r,this.toB+r,this.precise):this}get endA(){return Math.max(this.fromA,this.toA-1)}get endB(){return Math.max(this.fromB,this.toB-1)}static build(t,r,n){let a=u6(t.toString(),r.toString(),n);return m6(a,t,r,0,0,d6())}static updateA(t,r,n,a,s){return bN(gN(t,a,!0,n.length),t,r,n,s)}static updateB(t,r,n,a,s){return bN(gN(t,a,!1,r.length),t,r,n,s)}}function mN(e,t,r,n){let a=r.lineAt(e),s=n.lineAt(t);return a.to==e&&s.to==t&&e<r.length&&t<n.length?[e+1,t+1]:[a.from,s.from]}function hN(e,t,r,n){let a=r.lineAt(e),s=n.lineAt(t);return a.from==e&&s.from==t?[e,t]:[a.to+1,s.to+1]}function m6(e,t,r,n,a,s){let o=[];for(let l=0;l<e.length;l++){let c=e[l],[d,u]=mN(c.fromA+n,c.fromB+a,t,r),[p,f]=hN(c.toA+n,c.toB+a,t,r),h=[c.offset(-d+n,-u+a)];for(;l<e.length-1;){let g=e[l+1],[b,x]=mN(g.fromA+n,g.fromB+a,t,r);if(b>p+1&&x>f+1)break;h.push(g.offset(-d+n,-u+a)),[p,f]=hN(g.toA+n,g.toB+a,t,r),l++}o.push(new So(h,d,Math.max(d,p),u,Math.max(u,f),s))}return o}const Ld=1e3;function fN(e,t,r,n){let a=0,s=e.length;for(;;){if(a==s){let u=0,p=0;a&&({toA:u,toB:p}=e[a-1]);let f=t-(r?u:p);return[u+f,p+f]}let o=a+s>>1,l=e[o],[c,d]=r?[l.fromA,l.toA]:[l.fromB,l.toB];if(c>t)s=o;else if(d<=t)a=o+1;else return n?[l.fromA,l.fromB]:[l.toA,l.toB]}}function gN(e,t,r,n){let a=[];return t.iterChangedRanges((s,o,l,c)=>{let d=0,u=r?t.length:n,p=0,f=r?n:t.length;s>Ld&&([d,p]=fN(e,s-Ld,r,!0)),o<t.length-Ld&&([u,f]=fN(e,o+Ld,r,!1));let h=c-l-(o-s),g,[b,x]=r?[h,0]:[0,h];a.length&&(g=a[a.length-1]).toA>=d?a[a.length-1]={fromA:g.fromA,fromB:g.fromB,toA:u,toB:f,diffA:g.diffA+b,diffB:g.diffB+x}:a.push({fromA:d,toA:u,fromB:p,toB:f,diffA:b,diffB:x})}),a}function bN(e,t,r,n,a){if(!e.length)return t;let s=[];for(let o=0,l=0,c=0,d=0;;o++){let u=o==e.length?null:e[o],p=u?u.fromA+l:r.length,f=u?u.fromB+c:n.length;for(;d<t.length;){let x=t[d];if(x.toA+l>p||x.toB+c>f)break;s.push(x.offset(l,c)),d++}if(!u)break;let h=u.toA+l+u.diffA,g=u.toB+c+u.diffB,b=u6(r.sliceString(p,h),n.sliceString(f,g),a);for(let x of m6(b,r,n,p,f,d6()))s.push(x);for(l+=u.diffA,c+=u.diffB;d<t.length;){let x=t[d];if(x.fromA+l>h&&x.fromB+c>g)break;d++}}return s}const Bne={scanLimit:500},h6=Gu.fromClass(class{constructor(e){({deco:this.deco,gutter:this.gutter}=vN(e))}update(e){(e.docChanged||e.viewportChanged||Une(e.startState,e.state)||$ne(e.startState,e.state))&&({deco:this.deco,gutter:this.gutter}=vN(e.view))}},{decorations:e=>e.deco});function Une(e,t){return e.field(ta,!1)!=t.field(ta,!1)}function $ne(e,t){return e.facet(ei)!=t.facet(ei)}const xN=ti.line({class:"cm-changedLine"}),f6=ti.mark({class:"cm-changedText"}),Hne=ti.mark({tagName:"ins",class:"cm-insertedLine"}),Gne=ti.mark({tagName:"del",class:"cm-deletedLine"}),yN=new class extends Fg{constructor(){super(...arguments),this.elementClass="cm-changedLineGutter"}};function Vne(e,t,r,n,a,s){let o=r?e.fromA:e.fromB,l=r?e.toA:e.toB,c=0;if(o!=l){a.add(o,o,xN),a.add(o,l,r?Gne:Hne),s&&s.add(o,o,yN);for(let d=t.iterRange(o,l-1),u=o;!d.next().done;){if(d.lineBreak){u++,a.add(u,u,xN),s&&s.add(u,u,yN);continue}let p=u+d.value.length;if(n)for(;c<e.changes.length;){let f=e.changes[c],h=o+(r?f.fromA:f.fromB),g=o+(r?f.toA:f.toB),b=Math.max(u,h),x=Math.min(p,g);if(b<x&&a.add(b,x,f6),g<p)c++;else break}u=p}}}function vN(e){let t=e.state.field(ta),{side:r,highlightChanges:n,markGutter:a,overrideChunk:s}=e.state.facet(ei),o=r=="a",l=new ru,c=a?new ru:null,{from:d,to:u}=e.viewport;for(let p of t){if((o?p.fromA:p.fromB)>=u)break;(o?p.toA:p.toB)>d&&(!s||!s(e.state,p,l,c))&&Vne(p,e.state.doc,o,n,l,c)}return{deco:l.finish(),gutter:c&&c.finish()}}const Lg=Mg.define({map:(e,t)=>t.mapPos(e)});class Wne extends zg{constructor(t){super(),this.lines=t}eq(t){return this.lines==t.lines}toDOM(t){let r=document.createElement("div");return r.className="cm-collapsedLines",r.textContent=t.state.phrase("$ unchanged lines",this.lines),r.addEventListener("click",n=>{let a=t.posAtDOM(n.target);t.dispatch({effects:Lg.of(a)});let{side:s,sibling:o}=t.state.facet(ei);o&&o().dispatch({effects:Lg.of(qne(a,t.state.field(ta),s=="a"))})}),r}ignoreEvent(t){return t instanceof MouseEvent}get estimatedHeight(){return 27}get type(){return"collapsed-unchanged-code"}}function qne(e,t,r){let n=0,a=0;for(let s=0;;s++){let o=s<t.length?t[s]:null;if(!o||(r?o.fromA:o.fromB)>=e)return a+(e-n);[n,a]=r?[o.toA,o.toB]:[o.toB,o.toA]}}const Kne=kc.define({create(e){return ti.none},update(e,t){e=e.map(t.changes);for(let r of t.effects)r.is(Lg)&&(e=e.update({filter:n=>n!=r.value}));return e},provide:e=>Jn.decorations.from(e)});function Yne({margin:e=3,minSize:t=4}){return Kne.init(r=>Zne(r,e,t))}function Zne(e,t,r){let n=new ru,a=e.facet(ei).side=="a",s=e.field(ta),o=1;for(let l=0;;l++){let c=l<s.length?s[l]:null,d=l?o+t:1,u=c?e.doc.lineAt(a?c.fromA:c.fromB).number-1-t:e.doc.lines,p=u-d+1;if(p>=r&&n.add(e.doc.line(d).from,e.doc.line(u).to,ti.replace({widget:new Wne(p),block:!0})),!c)break;o=e.doc.lineAt(Math.min(e.doc.length,a?c.toA:c.toB)).number}return n.finish()}const Xne=Jn.baseTheme({".cm-mergeView & .cm-scroller, .cm-mergeView &":{height:"auto !important",overflowY:"visible !important"},"&.cm-merge-a .cm-changedLine, .cm-deletedChunk":{backgroundColor:"rgba(160, 128, 100, .08)"},"&.cm-merge-b .cm-changedLine, .cm-inlineChangedLine":{backgroundColor:"rgba(100, 160, 128, .08)"},"&light.cm-merge-a .cm-changedText, &light .cm-deletedChunk .cm-deletedText":{background:"linear-gradient(#ee443366, #ee443366) bottom/100% 2px no-repeat"},"&dark.cm-merge-a .cm-changedText, &dark .cm-deletedChunk .cm-deletedText":{background:"linear-gradient(#ffaa9966, #ffaa9966) bottom/100% 2px no-repeat"},"&light.cm-merge-b .cm-changedText":{background:"linear-gradient(#22bb22aa, #22bb22aa) bottom/100% 2px no-repeat"},"&dark.cm-merge-b .cm-changedText":{background:"linear-gradient(#88ff88aa, #88ff88aa) bottom/100% 2px no-repeat"},"&.cm-merge-b .cm-deletedText":{background:"#ff000033"},".cm-insertedLine, .cm-deletedLine, .cm-deletedLine del":{textDecoration:"none"},".cm-deletedChunk":{paddingLeft:"6px","& .cm-chunkButtons":{position:"absolute",insetInlineEnd:"5px"},"& button":{border:"none",cursor:"pointer",color:"white",margin:"0 2px",borderRadius:"3px","&[name=accept]":{background:"#2a2"},"&[name=reject]":{background:"#d43"}}},".cm-collapsedLines":{padding:"5px 5px 5px 10px",cursor:"pointer","&:before":{content:'"⦚"',marginInlineEnd:"7px"},"&:after":{content:'"⦚"',marginInlineStart:"7px"}},"&light .cm-collapsedLines":{color:"#444",background:"linear-gradient(to bottom, transparent 0, #f3f3f3 30%, #f3f3f3 70%, transparent 100%)"},"&dark .cm-collapsedLines":{color:"#ddd",background:"linear-gradient(to bottom, transparent 0, #222 30%, #222 70%, transparent 100%)"},".cm-changeGutter":{width:"3px",paddingLeft:"1px"},"&light.cm-merge-a .cm-changedLineGutter, &light .cm-deletedLineGutter":{background:"#e43"},"&dark.cm-merge-a .cm-changedLineGutter, &dark .cm-deletedLineGutter":{background:"#fa9"},"&light.cm-merge-b .cm-changedLineGutter":{background:"#2b2"},"&dark.cm-merge-b .cm-changedLineGutter":{background:"#8f8"},".cm-inlineChangedLineGutter":{background:"#75d"}}),Jne=new class extends Fg{constructor(){super(...arguments),this.elementClass="cm-deletedLineGutter"}},Qne=XN.low(M6({class:"cm-changeGutter",markers:e=>{var t;return((t=e.plugin(h6))===null||t===void 0?void 0:t.gutter)||F6.empty},widgetMarker:(e,t)=>t instanceof g6?Jne:null}));function eae(e){var t;let r=typeof e.original=="string"?ZN.of(e.original.split(/\r?\n/)):e.original,n=e.diffConfig||Bne;return[XN.low(h6),aae,Xne,Jn.editorAttributes.of({class:"cm-merge-b"}),p6.of((a,s)=>{let o=s.effects.find(l=>l.is(Nw));return o&&(a=So.updateA(a,o.value.doc,s.startState.doc,o.value.changes,n)),s.docChanged&&(a=So.updateB(a,s.state.field($o),s.newDoc,s.changes,n)),a}),ei.of({highlightChanges:e.highlightChanges!==!1,markGutter:e.gutter!==!1,syntaxHighlightDeletions:e.syntaxHighlightDeletions!==!1,syntaxHighlightDeletionsMaxLength:3e3,mergeControls:(t=e.mergeControls)!==null&&t!==void 0?t:!0,overrideChunk:e.allowInlineDiffs?lae:void 0,side:"b"}),$o.init(()=>r),e.gutter!==!1?Qne:[],e.collapseUnchanged?Yne(e.collapseUnchanged):[],ta.init(a=>So.build(r,a.doc,n))]}const Nw=Mg.define(),$o=kc.define({create:()=>ZN.empty,update(e,t){for(let r of t.effects)r.is(Nw)&&(e=r.value.doc);return e}}),wN=new WeakMap;class g6 extends zg{constructor(t){super(),this.buildDOM=t,this.dom=null}eq(t){return this.dom==t.dom}toDOM(t){return this.dom||(this.dom=this.buildDOM(t))}}function tae(e,t,r){let n=wN.get(t.changes);if(n)return n;let a=o=>{let{highlightChanges:l,syntaxHighlightDeletions:c,syntaxHighlightDeletionsMaxLength:d,mergeControls:u}=e.facet(ei),p=document.createElement("div");if(p.className="cm-deletedChunk",u){let k=p.appendChild(document.createElement("div"));k.className="cm-chunkButtons";let S=E=>{E.preventDefault(),rae(o,o.posAtDOM(p))},N=E=>{E.preventDefault(),nae(o,o.posAtDOM(p))};if(typeof u=="function")k.appendChild(u("accept",S)),k.appendChild(u("reject",N));else{let E=k.appendChild(document.createElement("button"));E.name="accept",E.textContent=e.phrase("Accept"),E.onmousedown=S;let I=k.appendChild(document.createElement("button"));I.name="reject",I.textContent=e.phrase("Reject"),I.onmousedown=N}}if(r||t.fromA>=t.toA)return p;let f=o.state.field($o).sliceString(t.fromA,t.endA),h=c&&e.facet(JN),g=v(),b=t.changes,x=0,y=!1;function v(){let k=p.appendChild(document.createElement("div"));return k.className="cm-deletedLine",k.appendChild(document.createElement("del"))}function w(k,S,N){for(let E=k;E<S;){if(f.charAt(E)==`
673
+ `)}}return null}function ane(e){if(typeof e!="string"||!e.trim())return[];const t=[],r=new Set,n=(a,s="M")=>{const o=Vc(a);!o||r.has(o)||(r.add(o),t.push({path:o,status:s,source:"agent"}))};return e.split(/\r?\n/).forEach(a=>{const s=/^(?:\*\*\* )?(Update|Add|Delete) File:\s+(.+)$/.exec(a.trim());if(s){const[,c,d]=s;n(d,c==="Add"?"A":c==="Delete"?"D":"M");return}const o=/^diff --git a\/(.+?) b\/(.+)$/.exec(a.trim());if(o){n(o[2],"M");return}const l=/^\+\+\+ b\/(.+)$/.exec(a.trim());l&&n(l[1],"M")}),t}function ine(e){return Gc(e)?KI(e).map(t=>({...t,source:"agent"})):[]}function sne(e,t){const r=rne(e),n=YI(t);if(!r)return[];const a=ine(n);if(zu(e)==="filechanges"&&a.length>0)return a;if(!Gc(n))return[];const s=tne(n,Jre),o=nne(e,n);if(s){const l=Vc(s);return l?[{path:l,status:r,diffInfo:o,source:"agent"}]:[]}return zu(e).includes("patch")?ane(n.patch??n.content):[]}function ZI(e){const t=[],r=new Set,n=s=>{s.forEach(o=>{const l=Vc(o.path);if(!l)return;const c=`${o.status}:${l}:${o.diffInfo?.old_string??""}:${o.diffInfo?.new_string??""}`;r.has(c)||(r.add(c),t.push({...o,path:l,source:o.source??"agent"}))})},a=(s,o=0)=>{if(o>6)return;const l=YI(s);if(Array.isArray(l)){l.forEach(u=>a(u,o+1));return}if(!Gc(l))return;const c=ene(l),d=Qre(l);c&&d!==void 0&&n(sne(c,d)),Array.isArray(l.subagentTools)&&l.subagentTools.forEach(u=>a(u,o+1)),Array.isArray(l.childTools)&&l.childTools.forEach(u=>a(u,o+1)),a(l.tool,o+1),a(l.part,o+1),a(l.message,o+1),a(l.data,o+1)};return a(e),t}function Pd(...e){const t=new Map;return e.forEach(r=>{r.forEach(n=>{const a=Vc(n.path);if(!a)return;const s=t.get(a);if(!s){t.set(a,{...n,path:a,diffInfo:n.diffInfo??null});return}t.set(a,{...n,...s,path:a,diffInfo:s.diffInfo??n.diffInfo??null,source:s.source??n.source})})}),Array.from(t.values())}function one(e){return e?typeof e.old_string=="string"||typeof e.new_string=="string":!1}function lne(e,t){const r=t?.path?.replace(/\\/g,"/").replace(/\/+$/,""),n=Vc(e.path);if(!r)return{...e,path:n};const a=r.toLowerCase(),s=n.toLowerCase(),o=`${a}/`;return s.startsWith(o)?{...e,path:n.slice(r.length+1)}:{...e,path:n}}function cne(e){if(!e||typeof e!="object")return String(e??"");const t=e;return String(t.id??t.toolId??t.requestId??`${t.kind??t.type??"message"}:${t.sessionId??""}:${t.timestamp??""}`)}function XI(e,t,r){const[n,a]=m.useState(null),s=m.useRef(null);return m.useEffect(()=>{if(r==="off"||!e||!t)return;const o=cne(t);if(s.current===o)return;s.current=o;const l=ZI(t).map(d=>lne(d,e)).filter(d=>one(d.diffInfo));if(l.length===0)return;const c=l[0];a({path:c.path,status:c.status,diffInfo:c.diffInfo,detectedAt:Date.now()})},[t,e,r]),{latestDetectedFile:n}}const dne=400;function JI(e,t,r,n){const a=m.useRef(new Map),s=m.useCallback(async(l,c)=>{try{const d=await Ce(`/api/git/file-with-diff?project=${encodeURIComponent(l)}&file=${encodeURIComponent(c)}`,{cache:"no-store"}),u=await d.json();if(d.ok&&!u.error&&typeof u.currentContent=="string"&&typeof u.oldContent=="string")return{old_string:u.oldContent,new_string:u.currentContent}}catch{}try{const d=await Ce(`/api/projects/${encodeURIComponent(l)}/file?path=${encodeURIComponent(c)}`,{cache:"no-store"}),u=await d.json();if(d.ok&&typeof u.content=="string")return{old_string:"",new_string:u.content}}catch{}return null},[]),o=m.useCallback(async(l,c)=>{if(t==="off"||!e)return;const d=r.map(h=>h.replace(/\\/g,"/")),u=c.replace(/\\/g,"/");if(!d.includes(u)&&t!=="always")return;const f=await s(l,c);f&&n(c,f)},[s,t,n,r,e]);m.useEffect(()=>{if(t==="off"||!e)return;const l=a.current,c=d=>{const u=d.detail,p=u?.projectName,f=u?.changedFile;if(!p||!f||p!==e.name)return;const h=a.current.get(f);h&&window.clearTimeout(h);const g=window.setTimeout(()=>{a.current.delete(f),o(p,f)},dne);a.current.set(f,g)};return window.addEventListener("pixcode:file-tree-refresh",c),()=>{window.removeEventListener("pixcode:file-tree-refresh",c),l.forEach(d=>window.clearTimeout(d)),l.clear()}},[o,t,e])}const une=4e3,pne=80;function mne(e){return e instanceof Error?e.message:String(e)}function iN(e,t){const r=t?.path?.replace(/\\/g,"/").replace(/\/+$/,""),n=e.path.replace(/\\/g,"/");if(!r)return{...e,path:n};const a=r.toLowerCase(),s=n.toLowerCase(),o=`${a}/`;return s.startsWith(o)?{...e,path:n.slice(r.length+1)}:{...e,path:n}}function hne(e){if(!e||typeof e!="object")return String(e??"");const t=e;return String(t.id??t.toolId??t.requestId??`${t.kind??t.type??"message"}:${t.sessionId??""}:${t.timestamp??""}`)}function fne(e,t,r,n="local"){const[a,s]=m.useState([]),[o,l]=m.useState(!1),[c,d]=m.useState(null),[u,p]=m.useState(null),[f,h]=m.useState(null),g=m.useRef(null),b=m.useRef([]),x=m.useRef([]),y=m.useRef(null),v=m.useRef(e?.name??null),w=m.useRef(0),k=m.useRef(null);m.useEffect(()=>{v.current=e?.name??null,g.current=null,b.current=[],x.current=[],y.current=null,s([]),d(null),p(null),h(null)},[e?.name,n]);const S=m.useCallback(async(N="manual")=>{if(!t||!e)return;const E=w.current+1;w.current=E;const I=e.name;(N==="initial"||N==="manual")&&l(!0);try{const A=new URLSearchParams({project:I,mode:n}),T=await Ce(`/api/git/status?${A.toString()}`,{cache:"no-store"}),_=await T.json();if(w.current!==E||v.current!==I)return;if(!T.ok||_.error){const B=_.details??_.error??`Git status failed (${T.status})`;d(B),n==="git"&&(b.current=[],s([]));return}const j=KI(_).map(B=>iN(B,e)),R=n==="local"&&_.trackingMode==="filesystem"?Pd(b.current,j):j,C=new Set(R.map(B=>B.path)),D=n==="local"&&_.trackingMode==="filesystem"?j:Zre(g.current,R);g.current=C,b.current=R,s(n==="local"?Pd(x.current,R):R),p(Date.now()),d(null),D.length>0&&h({...D[0],detectedAt:Date.now()})}catch(A){if(w.current!==E||v.current!==I)return;d(mne(A))}finally{w.current===E&&l(!1)}},[t,e,n]);return m.useEffect(()=>{if(!t||!e||!r||n!=="local")return;const N=hne(r);if(y.current===N)return;y.current=N;const E=ZI(r).map(A=>iN(A,e));if(E.length===0)return;x.current=Pd(E,x.current).slice(0,pne),s(Pd(x.current,b.current));const I=Date.now();h({...E[0],detectedAt:I}),p(I),d(null)},[t,r,e,n]),m.useEffect(()=>{if(!t||!e)return;const N=E=>{const I=E.detail;I?.projectName&&I.projectName!==e.name||(k.current&&window.clearTimeout(k.current),k.current=window.setTimeout(()=>{k.current=null,S("run-state")},300))};return window.addEventListener(Uf,N),()=>{window.removeEventListener(Uf,N),k.current&&(window.clearTimeout(k.current),k.current=null)}},[t,S,e]),m.useEffect(()=>{if(!t||!e){g.current=null,s([]),d(null),l(!1);return}S("initial");const N=window.setInterval(()=>{S("poll")},une),E=()=>{S("focus")};return window.addEventListener("focus",E),()=>{window.clearInterval(N),window.removeEventListener("focus",E)}},[t,S,e]),{changedFiles:a,isLoading:o,error:c,lastCheckedAt:u,latestDetectedFile:f,refresh:S}}const gne=({selectedProject:e,isMobile:t,initialWidth:r=600})=>{const[n,a]=m.useState(null),[s,o]=m.useState(r),[l,c]=m.useState(!1),[d,u]=m.useState(!1),[p,f]=m.useState(!1),h=m.useRef(null),g=m.useCallback((v,w=null)=>{const S=v.replace(/\\/g,"/").split("/").pop()||v;a({name:S,path:v,projectName:e?.name,diffInfo:w})},[e?.name]),b=m.useCallback(()=>{a(null),c(!1)},[]),x=m.useCallback(()=>{c(v=>!v)},[]),y=m.useCallback(v=>{t||(f(!0),u(!0),v.preventDefault())},[t]);return m.useEffect(()=>{const v=k=>{if(!d)return;const N=h.current?.parentElement?.parentElement;if(!N)return;const E=N.getBoundingClientRect(),I=E.right-k.clientX,A=300,T=E.width*.8;I>=A&&I<=T&&o(I)},w=()=>{u(!1)};return d&&(document.addEventListener("mousemove",v),document.addEventListener("mouseup",w),document.body.style.cursor="col-resize",document.body.style.userSelect="none"),()=>{document.removeEventListener("mousemove",v),document.removeEventListener("mouseup",w),document.body.style.cursor="",document.body.style.userSelect=""}},[d]),{editingFile:n,editorWidth:s,editorExpanded:l,hasManualWidth:p,resizeHandleRef:h,handleFileOpen:g,handleCloseEditor:b,handleToggleEditorExpand:x,handleResizeStart:y}};class Er{constructor(t,r,n,a){this.fromA=t,this.toA=r,this.fromB=n,this.toB=a}offset(t,r=t){return new Er(this.fromA+t,this.toA+t,this.fromB+r,this.toB+r)}}function ks(e,t,r,n,a,s){if(e==n)return[];let o=kw(e,t,r,n,a,s),l=Sw(e,t+o,r,n,a+o,s);t+=o,r-=l,a+=o,s-=l;let c=r-t,d=s-a;if(!c||!d)return[new Er(t,r,a,s)];if(c>d){let p=e.slice(t,r).indexOf(n.slice(a,s));if(p>-1)return[new Er(t,t+p,a,a),new Er(t+p+d,r,s,s)]}else if(d>c){let p=n.slice(a,s).indexOf(e.slice(t,r));if(p>-1)return[new Er(t,t,a,a+p),new Er(r,r,a+p+c,s)]}if(c==1||d==1)return[new Er(t,r,a,s)];let u=t6(e,t,r,n,a,s);if(u){let[p,f,h]=u;return ks(e,t,p,n,a,f).concat(ks(e,p+h,r,n,f+h,s))}return bne(e,t,r,n,a,s)}let Ul=1e9,$l=0,ww=!1;function bne(e,t,r,n,a,s){let o=r-t,l=s-a;if(Ul<1e9&&Math.min(o,l)>Ul*16||$l>0&&Date.now()>$l)return Math.min(o,l)>Ul*64?[new Er(t,r,a,s)]:sN(e,t,r,n,a,s);let c=Math.ceil((o+l)/2);Zh.reset(c),Xh.reset(c);let d=(h,g)=>e.charCodeAt(t+h)==n.charCodeAt(a+g),u=(h,g)=>e.charCodeAt(r-h-1)==n.charCodeAt(s-g-1),p=(o-l)%2!=0?Xh:null,f=p?null:Zh;for(let h=0;h<c;h++){if(h>Ul||$l>0&&!(h&63)&&Date.now()>$l)return sN(e,t,r,n,a,s);let g=Zh.advance(h,o,l,c,p,!1,d)||Xh.advance(h,o,l,c,f,!0,u);if(g)return xne(e,t,r,t+g[0],n,a,s,a+g[1])}return[new Er(t,r,a,s)]}class QI{constructor(){this.vec=[]}reset(t){this.len=t<<1;for(let r=0;r<this.len;r++)this.vec[r]=-1;this.vec[t+1]=0,this.start=this.end=0}advance(t,r,n,a,s,o,l){for(let c=-t+this.start;c<=t-this.end;c+=2){let d=a+c,u=c==-t||c!=t&&this.vec[d-1]<this.vec[d+1]?this.vec[d+1]:this.vec[d-1]+1,p=u-c;for(;u<r&&p<n&&l(u,p);)u++,p++;if(this.vec[d]=u,u>r)this.end+=2;else if(p>n)this.start+=2;else if(s){let f=a+(r-n)-c;if(f>=0&&f<this.len&&s.vec[f]!=-1)if(o){let h=s.vec[f];if(h>=r-u)return[h,a+h-f]}else{let h=r-s.vec[f];if(u>=h)return[u,p]}}}return null}}const Zh=new QI,Xh=new QI;function xne(e,t,r,n,a,s,o,l){let c=!1;return!Uo(e,n)&&++n==r&&(c=!0),!Uo(a,l)&&++l==o&&(c=!0),c?[new Er(t,r,s,o)]:ks(e,t,n,a,s,l).concat(ks(e,n,r,a,l,o))}function e6(e,t){let r=1,n=Math.min(e,t);for(;r<n;)r=r<<1;return r}function kw(e,t,r,n,a,s){if(t==r||t==s||e.charCodeAt(t)!=n.charCodeAt(a))return 0;let o=e6(r-t,s-a);for(let l=t,c=a;;){let d=l+o,u=c+o;if(d>r||u>s||e.slice(l,d)!=n.slice(c,u)){if(o==1)return l-t-(Uo(e,l)?0:1);o=o>>1}else{if(d==r||u==s)return d-t;l=d,c=u}}}function Sw(e,t,r,n,a,s){if(t==r||a==s||e.charCodeAt(r-1)!=n.charCodeAt(s-1))return 0;let o=e6(r-t,s-a);for(let l=r,c=s;;){let d=l-o,u=c-o;if(d<t||u<a||e.slice(d,l)!=n.slice(u,c)){if(o==1)return r-l-(Uo(e,l)?0:1);o=o>>1}else{if(d==t||u==a)return r-d;l=d,c=u}}}function Rg(e,t,r,n,a,s,o,l){let c=n.slice(a,s),d=null;for(;;){if(d||o<l)return d;for(let u=t+o;;){Uo(e,u)||u++;let p=u+o;if(Uo(e,p)||(p+=p==u+1?1:-1),p>=r)break;let f=e.slice(u,p),h=-1;for(;(h=c.indexOf(f,h+1))!=-1;){let g=kw(e,p,r,n,a+h+f.length,s),b=Sw(e,t,u,n,a,a+h),x=f.length+g+b;(!d||d[2]<x)&&(d=[u-b,a+h-b,x])}u=p}if(l<0)return d;o=o>>1}}function t6(e,t,r,n,a,s){let o=r-t,l=s-a;if(o<l){let c=t6(n,a,s,e,t,r);return c&&[c[1],c[0],c[2]]}return o<4||l*2<o?null:Rg(e,t,r,n,a,s,Math.floor(o/4),-1)}function sN(e,t,r,n,a,s){ww=!0;let o=r-t,l=s-a,c;if(o<l){let f=Rg(n,a,s,e,t,r,Math.floor(o/6),50);c=f&&[f[1],f[0],f[2]]}else c=Rg(e,t,r,n,a,s,Math.floor(l/6),50);if(!c)return[new Er(t,r,a,s)];let[d,u,p]=c;return ks(e,t,d,n,a,u).concat(ks(e,d+p,r,n,u+p,s))}function r6(e,t){for(let r=1;r<e.length;r++){let n=e[r-1],a=e[r];n.toA>a.fromA-t&&n.toB>a.fromB-t&&(e[r-1]=new Er(n.fromA,a.toA,n.fromB,a.toB),e.splice(r--,1))}}function yne(e,t,r){for(;;){r6(r,1);let n=!1;for(let a=0;a<r.length;a++){let s=r[a],o,l;(o=kw(e,s.fromA,s.toA,t,s.fromB,s.toB))&&(s=r[a]=new Er(s.fromA+o,s.toA,s.fromB+o,s.toB)),(l=Sw(e,s.fromA,s.toA,t,s.fromB,s.toB))&&(s=r[a]=new Er(s.fromA,s.toA-l,s.fromB,s.toB-l));let c=s.toA-s.fromA,d=s.toB-s.fromB;if(c&&d)continue;let u=s.fromA-(a?r[a-1].toA:0),p=(a<r.length-1?r[a+1].fromA:e.length)-s.toA;if(!u||!p)continue;let f=c?e.slice(s.fromA,s.toA):t.slice(s.fromB,s.toB);u<=f.length&&e.slice(s.fromA-u,s.fromA)==f.slice(f.length-u)?(r[a]=new Er(s.fromA-u,s.toA-u,s.fromB-u,s.toB-u),n=!0):p<=f.length&&e.slice(s.toA,s.toA+p)==f.slice(0,p)&&(r[a]=new Er(s.fromA+p,s.toA+p,s.fromB+p,s.toB+p),n=!0)}if(!n)break}return r}function vne(e,t,r){for(let n=0,a=0;a<e.length;a++){let s=e[a],o=s.toA-s.fromA,l=s.toB-s.fromB;if(o&&l||o>3||l>3){let c=a==e.length-1?t.length:e[a+1].fromA,d=s.fromA-n,u=c-s.toA,p=lN(t,s.fromA,d),f=oN(t,s.toA,u),h=s.fromA-p,g=f-s.toA;if((!o||!l)&&h&&g){let b=Math.max(o,l),[x,y,v]=o?[t,s.fromA,s.toA]:[r,s.fromB,s.toB];b>h&&t.slice(p,s.fromA)==x.slice(v-h,v)?(s=e[a]=new Er(p,p+o,s.fromB-h,s.toB-h),p=s.fromA,f=oN(t,s.toA,c-s.toA)):b>g&&t.slice(s.toA,f)==x.slice(y,y+g)&&(s=e[a]=new Er(f-o,f,s.fromB+g,s.toB+g),f=s.toA,p=lN(t,s.fromA,s.fromA-n)),h=s.fromA-p,g=f-s.toA}if(h||g)s=e[a]=new Er(s.fromA-h,s.toA+g,s.fromB-h,s.toB+g);else if(o){if(!l){let b=dN(t,s.fromA,s.toA),x,y=b<0?-1:cN(t,s.toA,s.fromA);b>-1&&(x=b-s.fromA)<=u&&t.slice(s.fromA,b)==t.slice(s.toA,s.toA+x)?s=e[a]=s.offset(x):y>-1&&(x=s.toA-y)<=d&&t.slice(s.fromA-x,s.fromA)==t.slice(y,s.toA)&&(s=e[a]=s.offset(-x))}}else{let b=dN(r,s.fromB,s.toB),x,y=b<0?-1:cN(r,s.toB,s.fromB);b>-1&&(x=b-s.fromB)<=u&&r.slice(s.fromB,b)==r.slice(s.toB,s.toB+x)?s=e[a]=s.offset(x):y>-1&&(x=s.toB-y)<=d&&r.slice(s.fromB-x,s.fromB)==r.slice(y,s.toB)&&(s=e[a]=s.offset(-x))}}n=s.toA}return r6(e,3),e}let bs;try{bs=new RegExp("[\\p{Alphabetic}\\p{Number}]","u")}catch{}function n6(e){return e>48&&e<58||e>64&&e<91||e>96&&e<123}function a6(e,t){if(t==e.length)return 0;let r=e.charCodeAt(t);return r<192?n6(r)?1:0:bs?!o6(r)||t==e.length-1?bs.test(String.fromCharCode(r))?1:0:bs.test(e.slice(t,t+2))?2:0:0}function i6(e,t){if(!t)return 0;let r=e.charCodeAt(t-1);return r<192?n6(r)?1:0:bs?!l6(r)||t==1?bs.test(String.fromCharCode(r))?1:0:bs.test(e.slice(t-2,t))?2:0:0}const s6=8;function oN(e,t,r){if(t==e.length||!i6(e,t))return t;for(let n=t,a=t+r,s=0;s<s6;s++){let o=a6(e,n);if(!o||n+o>a)return n;n+=o}return t}function lN(e,t,r){if(!t||!a6(e,t))return t;for(let n=t,a=t-r,s=0;s<s6;s++){let o=i6(e,n);if(!o||n-o<a)return n;n-=o}return t}function cN(e,t,r){for(;t!=r;t--)if(e.charCodeAt(t-1)==10)return t;return-1}function dN(e,t,r){for(;t!=r;t++)if(e.charCodeAt(t)==10)return t;return-1}const o6=e=>e>=55296&&e<=56319,l6=e=>e>=56320&&e<=57343;function Uo(e,t){return!t||t==e.length||!o6(e.charCodeAt(t-1))||!l6(e.charCodeAt(t))}function wne(e,t,r){var n;return Ul=((n=r?.scanLimit)!==null&&n!==void 0?n:1e9)>>1,$l=r?.timeout?Date.now()+r.timeout:0,ww=!1,yne(e,t,ks(e,0,e.length,t,0,t.length))}function c6(){return!ww}function d6(e,t,r){return vne(wne(e,t,r),e,t)}const ei=Hu.define({combine:e=>e[0]}),kne=Mg.define(),u6=Hu.define(),ta=kc.define({create(e){return null},update(e,t){for(let r of t.effects)r.is(kne)&&(e=r.value);for(let r of t.state.facet(u6))e=r(e,t);return e}});function Cw(e){let t=e.field(ta,!1);if(!t)return null;let r=e.facet(ei);return{chunks:t,side:r?r.side:null}}class So{constructor(t,r,n,a,s,o=!0){this.changes=t,this.fromA=r,this.toA=n,this.fromB=a,this.toB=s,this.precise=o}offset(t,r){return t||r?new So(this.changes,this.fromA+t,this.toA+t,this.fromB+r,this.toB+r,this.precise):this}get endA(){return Math.max(this.fromA,this.toA-1)}get endB(){return Math.max(this.fromB,this.toB-1)}static build(t,r,n){let a=d6(t.toString(),r.toString(),n);return p6(a,t,r,0,0,c6())}static updateA(t,r,n,a,s){return fN(hN(t,a,!0,n.length),t,r,n,s)}static updateB(t,r,n,a,s){return fN(hN(t,a,!1,r.length),t,r,n,s)}}function uN(e,t,r,n){let a=r.lineAt(e),s=n.lineAt(t);return a.to==e&&s.to==t&&e<r.length&&t<n.length?[e+1,t+1]:[a.from,s.from]}function pN(e,t,r,n){let a=r.lineAt(e),s=n.lineAt(t);return a.from==e&&s.from==t?[e,t]:[a.to+1,s.to+1]}function p6(e,t,r,n,a,s){let o=[];for(let l=0;l<e.length;l++){let c=e[l],[d,u]=uN(c.fromA+n,c.fromB+a,t,r),[p,f]=pN(c.toA+n,c.toB+a,t,r),h=[c.offset(-d+n,-u+a)];for(;l<e.length-1;){let g=e[l+1],[b,x]=uN(g.fromA+n,g.fromB+a,t,r);if(b>p+1&&x>f+1)break;h.push(g.offset(-d+n,-u+a)),[p,f]=pN(g.toA+n,g.toB+a,t,r),l++}o.push(new So(h,d,Math.max(d,p),u,Math.max(u,f),s))}return o}const Ld=1e3;function mN(e,t,r,n){let a=0,s=e.length;for(;;){if(a==s){let u=0,p=0;a&&({toA:u,toB:p}=e[a-1]);let f=t-(r?u:p);return[u+f,p+f]}let o=a+s>>1,l=e[o],[c,d]=r?[l.fromA,l.toA]:[l.fromB,l.toB];if(c>t)s=o;else if(d<=t)a=o+1;else return n?[l.fromA,l.fromB]:[l.toA,l.toB]}}function hN(e,t,r,n){let a=[];return t.iterChangedRanges((s,o,l,c)=>{let d=0,u=r?t.length:n,p=0,f=r?n:t.length;s>Ld&&([d,p]=mN(e,s-Ld,r,!0)),o<t.length-Ld&&([u,f]=mN(e,o+Ld,r,!1));let h=c-l-(o-s),g,[b,x]=r?[h,0]:[0,h];a.length&&(g=a[a.length-1]).toA>=d?a[a.length-1]={fromA:g.fromA,fromB:g.fromB,toA:u,toB:f,diffA:g.diffA+b,diffB:g.diffB+x}:a.push({fromA:d,toA:u,fromB:p,toB:f,diffA:b,diffB:x})}),a}function fN(e,t,r,n,a){if(!e.length)return t;let s=[];for(let o=0,l=0,c=0,d=0;;o++){let u=o==e.length?null:e[o],p=u?u.fromA+l:r.length,f=u?u.fromB+c:n.length;for(;d<t.length;){let x=t[d];if(x.toA+l>p||x.toB+c>f)break;s.push(x.offset(l,c)),d++}if(!u)break;let h=u.toA+l+u.diffA,g=u.toB+c+u.diffB,b=d6(r.sliceString(p,h),n.sliceString(f,g),a);for(let x of p6(b,r,n,p,f,c6()))s.push(x);for(l+=u.diffA,c+=u.diffB;d<t.length;){let x=t[d];if(x.fromA+l>h&&x.fromB+c>g)break;d++}}return s}const Sne={scanLimit:500},m6=Gu.fromClass(class{constructor(e){({deco:this.deco,gutter:this.gutter}=xN(e))}update(e){(e.docChanged||e.viewportChanged||Cne(e.startState,e.state)||Nne(e.startState,e.state))&&({deco:this.deco,gutter:this.gutter}=xN(e.view))}},{decorations:e=>e.deco});function Cne(e,t){return e.field(ta,!1)!=t.field(ta,!1)}function Nne(e,t){return e.facet(ei)!=t.facet(ei)}const gN=ti.line({class:"cm-changedLine"}),h6=ti.mark({class:"cm-changedText"}),Ene=ti.mark({tagName:"ins",class:"cm-insertedLine"}),Tne=ti.mark({tagName:"del",class:"cm-deletedLine"}),bN=new class extends Fg{constructor(){super(...arguments),this.elementClass="cm-changedLineGutter"}};function Ane(e,t,r,n,a,s){let o=r?e.fromA:e.fromB,l=r?e.toA:e.toB,c=0;if(o!=l){a.add(o,o,gN),a.add(o,l,r?Tne:Ene),s&&s.add(o,o,bN);for(let d=t.iterRange(o,l-1),u=o;!d.next().done;){if(d.lineBreak){u++,a.add(u,u,gN),s&&s.add(u,u,bN);continue}let p=u+d.value.length;if(n)for(;c<e.changes.length;){let f=e.changes[c],h=o+(r?f.fromA:f.fromB),g=o+(r?f.toA:f.toB),b=Math.max(u,h),x=Math.min(p,g);if(b<x&&a.add(b,x,h6),g<p)c++;else break}u=p}}}function xN(e){let t=e.state.field(ta),{side:r,highlightChanges:n,markGutter:a,overrideChunk:s}=e.state.facet(ei),o=r=="a",l=new ru,c=a?new ru:null,{from:d,to:u}=e.viewport;for(let p of t){if((o?p.fromA:p.fromB)>=u)break;(o?p.toA:p.toB)>d&&(!s||!s(e.state,p,l,c))&&Ane(p,e.state.doc,o,n,l,c)}return{deco:l.finish(),gutter:c&&c.finish()}}const _g=Mg.define({map:(e,t)=>t.mapPos(e)});class jne extends zg{constructor(t){super(),this.lines=t}eq(t){return this.lines==t.lines}toDOM(t){let r=document.createElement("div");return r.className="cm-collapsedLines",r.textContent=t.state.phrase("$ unchanged lines",this.lines),r.addEventListener("click",n=>{let a=t.posAtDOM(n.target);t.dispatch({effects:_g.of(a)});let{side:s,sibling:o}=t.state.facet(ei);o&&o().dispatch({effects:_g.of(Ine(a,t.state.field(ta),s=="a"))})}),r}ignoreEvent(t){return t instanceof MouseEvent}get estimatedHeight(){return 27}get type(){return"collapsed-unchanged-code"}}function Ine(e,t,r){let n=0,a=0;for(let s=0;;s++){let o=s<t.length?t[s]:null;if(!o||(r?o.fromA:o.fromB)>=e)return a+(e-n);[n,a]=r?[o.toA,o.toB]:[o.toB,o.toA]}}const Rne=kc.define({create(e){return ti.none},update(e,t){e=e.map(t.changes);for(let r of t.effects)r.is(_g)&&(e=e.update({filter:n=>n!=r.value}));return e},provide:e=>Jn.decorations.from(e)});function _ne({margin:e=3,minSize:t=4}){return Rne.init(r=>Pne(r,e,t))}function Pne(e,t,r){let n=new ru,a=e.facet(ei).side=="a",s=e.field(ta),o=1;for(let l=0;;l++){let c=l<s.length?s[l]:null,d=l?o+t:1,u=c?e.doc.lineAt(a?c.fromA:c.fromB).number-1-t:e.doc.lines,p=u-d+1;if(p>=r&&n.add(e.doc.line(d).from,e.doc.line(u).to,ti.replace({widget:new jne(p),block:!0})),!c)break;o=e.doc.lineAt(Math.min(e.doc.length,a?c.toA:c.toB)).number}return n.finish()}const Lne=Jn.baseTheme({".cm-mergeView & .cm-scroller, .cm-mergeView &":{height:"auto !important",overflowY:"visible !important"},"&.cm-merge-a .cm-changedLine, .cm-deletedChunk":{backgroundColor:"rgba(160, 128, 100, .08)"},"&.cm-merge-b .cm-changedLine, .cm-inlineChangedLine":{backgroundColor:"rgba(100, 160, 128, .08)"},"&light.cm-merge-a .cm-changedText, &light .cm-deletedChunk .cm-deletedText":{background:"linear-gradient(#ee443366, #ee443366) bottom/100% 2px no-repeat"},"&dark.cm-merge-a .cm-changedText, &dark .cm-deletedChunk .cm-deletedText":{background:"linear-gradient(#ffaa9966, #ffaa9966) bottom/100% 2px no-repeat"},"&light.cm-merge-b .cm-changedText":{background:"linear-gradient(#22bb22aa, #22bb22aa) bottom/100% 2px no-repeat"},"&dark.cm-merge-b .cm-changedText":{background:"linear-gradient(#88ff88aa, #88ff88aa) bottom/100% 2px no-repeat"},"&.cm-merge-b .cm-deletedText":{background:"#ff000033"},".cm-insertedLine, .cm-deletedLine, .cm-deletedLine del":{textDecoration:"none"},".cm-deletedChunk":{paddingLeft:"6px","& .cm-chunkButtons":{position:"absolute",insetInlineEnd:"5px"},"& button":{border:"none",cursor:"pointer",color:"white",margin:"0 2px",borderRadius:"3px","&[name=accept]":{background:"#2a2"},"&[name=reject]":{background:"#d43"}}},".cm-collapsedLines":{padding:"5px 5px 5px 10px",cursor:"pointer","&:before":{content:'"⦚"',marginInlineEnd:"7px"},"&:after":{content:'"⦚"',marginInlineStart:"7px"}},"&light .cm-collapsedLines":{color:"#444",background:"linear-gradient(to bottom, transparent 0, #f3f3f3 30%, #f3f3f3 70%, transparent 100%)"},"&dark .cm-collapsedLines":{color:"#ddd",background:"linear-gradient(to bottom, transparent 0, #222 30%, #222 70%, transparent 100%)"},".cm-changeGutter":{width:"3px",paddingLeft:"1px"},"&light.cm-merge-a .cm-changedLineGutter, &light .cm-deletedLineGutter":{background:"#e43"},"&dark.cm-merge-a .cm-changedLineGutter, &dark .cm-deletedLineGutter":{background:"#fa9"},"&light.cm-merge-b .cm-changedLineGutter":{background:"#2b2"},"&dark.cm-merge-b .cm-changedLineGutter":{background:"#8f8"},".cm-inlineChangedLineGutter":{background:"#75d"}}),Dne=new class extends Fg{constructor(){super(...arguments),this.elementClass="cm-deletedLineGutter"}},One=XN.low(M6({class:"cm-changeGutter",markers:e=>{var t;return((t=e.plugin(m6))===null||t===void 0?void 0:t.gutter)||F6.empty},widgetMarker:(e,t)=>t instanceof f6?Dne:null}));function Mne(e){var t;let r=typeof e.original=="string"?ZN.of(e.original.split(/\r?\n/)):e.original,n=e.diffConfig||Sne;return[XN.low(m6),Une,Lne,Jn.editorAttributes.of({class:"cm-merge-b"}),u6.of((a,s)=>{let o=s.effects.find(l=>l.is(Nw));return o&&(a=So.updateA(a,o.value.doc,s.startState.doc,o.value.changes,n)),s.docChanged&&(a=So.updateB(a,s.state.field($o),s.newDoc,s.changes,n)),a}),ei.of({highlightChanges:e.highlightChanges!==!1,markGutter:e.gutter!==!1,syntaxHighlightDeletions:e.syntaxHighlightDeletions!==!1,syntaxHighlightDeletionsMaxLength:3e3,mergeControls:(t=e.mergeControls)!==null&&t!==void 0?t:!0,overrideChunk:e.allowInlineDiffs?Vne:void 0,side:"b"}),$o.init(()=>r),e.gutter!==!1?One:[],e.collapseUnchanged?_ne(e.collapseUnchanged):[],ta.init(a=>So.build(r,a.doc,n))]}const Nw=Mg.define(),$o=kc.define({create:()=>ZN.empty,update(e,t){for(let r of t.effects)r.is(Nw)&&(e=r.value.doc);return e}}),yN=new WeakMap;class f6 extends zg{constructor(t){super(),this.buildDOM=t,this.dom=null}eq(t){return this.dom==t.dom}toDOM(t){return this.dom||(this.dom=this.buildDOM(t))}}function Fne(e,t,r){let n=yN.get(t.changes);if(n)return n;let a=o=>{let{highlightChanges:l,syntaxHighlightDeletions:c,syntaxHighlightDeletionsMaxLength:d,mergeControls:u}=e.facet(ei),p=document.createElement("div");if(p.className="cm-deletedChunk",u){let k=p.appendChild(document.createElement("div"));k.className="cm-chunkButtons";let S=E=>{E.preventDefault(),zne(o,o.posAtDOM(p))},N=E=>{E.preventDefault(),Bne(o,o.posAtDOM(p))};if(typeof u=="function")k.appendChild(u("accept",S)),k.appendChild(u("reject",N));else{let E=k.appendChild(document.createElement("button"));E.name="accept",E.textContent=e.phrase("Accept"),E.onmousedown=S;let I=k.appendChild(document.createElement("button"));I.name="reject",I.textContent=e.phrase("Reject"),I.onmousedown=N}}if(r||t.fromA>=t.toA)return p;let f=o.state.field($o).sliceString(t.fromA,t.endA),h=c&&e.facet(JN),g=v(),b=t.changes,x=0,y=!1;function v(){let k=p.appendChild(document.createElement("div"));return k.className="cm-deletedLine",k.appendChild(document.createElement("del"))}function w(k,S,N){for(let E=k;E<S;){if(f.charAt(E)==`
674
674
  `){g.firstChild||g.appendChild(document.createElement("br")),g=v(),E++;continue}let I=S,A=N+(y?" cm-deletedText":""),T=!1,_=f.indexOf(`
675
- `,E);if(_>-1&&_<S&&(I=_),l&&x<b.length){let j=Math.max(0,y?b[x].toA:b[x].fromA);j<=I&&(I=j,y&&x++,T=!0)}if(I>E){let j=document.createTextNode(f.slice(E,I));if(A){let R=g.appendChild(document.createElement("span"));R.className=A,R.appendChild(j)}else g.appendChild(j);E=I}T&&(y=!y)}}if(h&&t.toA-t.fromA<=d){let k=h.parser.parse(f),S=0;rf(k,{style:N=>QN(e,N)},(N,E,I)=>{N>S&&w(S,N,""),w(N,E,I),S=E}),w(S,f.length,"")}else w(0,f.length,"");return g.firstChild||g.appendChild(document.createElement("br")),p},s=ti.widget({block:!0,side:-1,widget:new g6(a)});return wN.set(t.changes,s),s}function rae(e,t){let{state:r}=e,n=t??r.selection.main.head,a=e.state.field(ta).find(c=>c.fromB<=n&&c.endB>=n);if(!a)return!1;let s=e.state.sliceDoc(a.fromB,Math.max(a.fromB,a.toB-1)),o=e.state.field($o);a.fromB!=a.toB&&a.toA<=o.length&&(s+=e.state.lineBreak);let l=z6.of({from:a.fromA,to:Math.min(o.length,a.toA),insert:s},o.length);return e.dispatch({effects:Nw.of({doc:l.apply(o),changes:l}),userEvent:"accept"}),!0}function nae(e,t){let{state:r}=e,n=t??r.selection.main.head,a=r.field(ta).find(l=>l.fromB<=n&&l.endB>=n);if(!a)return!1;let o=r.field($o).sliceString(a.fromA,Math.max(a.fromA,a.toA-1));return a.fromA!=a.toA&&a.toB<=r.doc.length&&(o+=r.lineBreak),e.dispatch({changes:{from:a.fromB,to:Math.min(r.doc.length,a.toB),insert:o},userEvent:"revert"}),!0}function kN(e){let t=new ru;for(let r of e.field(ta)){let n=e.facet(ei).overrideChunk&&b6(e,r);t.add(r.fromB,r.fromB,tae(e,r,!!n))}return t.finish()}const aae=kc.define({create:e=>kN(e),update(e,t){return t.state.field(ta,!1)!=t.startState.field(ta,!1)?kN(t.state):e},provide:e=>Jn.decorations.from(e)}),SN=new WeakMap;function b6(e,t){let r=SN.get(t);if(r!==void 0)return r;r=null;let n=e.field($o),a=e.doc,s=n.lineAt(t.endA).number-n.lineAt(t.fromA).number+1,o=a.lineAt(t.endB).number-a.lineAt(t.fromB).number+1;e:if(s==o&&s<10){let l=[],c=0,d=t.fromA,u=t.fromB;for(let p of t.changes){if(p.fromA<p.toA){c+=p.toA-p.fromA;let f=n.sliceString(d+p.fromA,d+p.toA);if(/\n/.test(f))break e;l.push(ti.widget({widget:new iae(f),side:-1}).range(u+p.fromB))}p.fromB<p.toB&&l.push(f6.range(u+p.fromB,u+p.toB))}c<t.endA-t.fromA-s*2&&(r=l)}return SN.set(t,r),r}class iae extends zg{constructor(t){super(),this.text=t}eq(t){return this.text==t.text}toDOM(t){let r=document.createElement("del");return r.className="cm-deletedText",r.textContent=this.text,r}}const sae=new class extends Fg{constructor(){super(...arguments),this.elementClass="cm-inlineChangedLineGutter"}},oae=ti.line({class:"cm-inlineChangedLine"});function lae(e,t,r,n){let a=b6(e,t),s=0;if(!a)return!1;for(let o=e.doc.lineAt(t.fromB);;){for(n&&n.add(o.from,o.from,sae),r.add(o.from,o.from,oae);s<a.length&&a[s].to<=o.to;){let l=a[s++];r.add(l.from,l.to,l.value)}if(o.to>=t.endB)break;o=e.doc.lineAt(o.to+1)}return!0}const cae=["zip","tar","gz","rar","7z","bz2","xz","exe","dll","so","dylib","app","dmg","msi","mp3","mp4","wav","avi","mov","mkv","flv","wmv","m4a","ogg","pdf","doc","docx","xls","xlsx","ppt","pptx","odt","ods","odp","ttf","otf","woff","woff2","eot","db","sqlite","sqlite3","bin","dat","iso","img","class","jar","war","pyc","pyo"],dae=e=>{const t=e.split(".").pop()?.toLowerCase();return cae.includes(t??"")},CN=e=>e instanceof Error?e.message:String(e),uae=({file:e,projectPath:t})=>{const[r,n]=m.useState(""),[a,s]=m.useState(!0),[o,l]=m.useState(!1),[c,d]=m.useState(!1),[u,p]=m.useState(null),[f,h]=m.useState(!1),g=e.projectName??t,b=e.path,x=e.name,y=e.diffInfo?.new_string,v=e.diffInfo?.old_string;m.useEffect(()=>{(async()=>{try{if(s(!0),h(!1),dae(e.name)){h(!0),s(!1);return}if(e.diffInfo&&y!==void 0&&v!==void 0){n(y),s(!1);return}if(!g)throw new Error("Missing project identifier");const N=await Lt.readFile(g,b);if(!N.ok)throw new Error(`Failed to load file: ${N.status} ${N.statusText}`);const E=await N.json();n(E.content)}catch(N){const E=CN(N);console.error("Error loading file:",N),n(`// Error loading file: ${E}
675
+ `,E);if(_>-1&&_<S&&(I=_),l&&x<b.length){let j=Math.max(0,y?b[x].toA:b[x].fromA);j<=I&&(I=j,y&&x++,T=!0)}if(I>E){let j=document.createTextNode(f.slice(E,I));if(A){let R=g.appendChild(document.createElement("span"));R.className=A,R.appendChild(j)}else g.appendChild(j);E=I}T&&(y=!y)}}if(h&&t.toA-t.fromA<=d){let k=h.parser.parse(f),S=0;rf(k,{style:N=>QN(e,N)},(N,E,I)=>{N>S&&w(S,N,""),w(N,E,I),S=E}),w(S,f.length,"")}else w(0,f.length,"");return g.firstChild||g.appendChild(document.createElement("br")),p},s=ti.widget({block:!0,side:-1,widget:new f6(a)});return yN.set(t.changes,s),s}function zne(e,t){let{state:r}=e,n=t??r.selection.main.head,a=e.state.field(ta).find(c=>c.fromB<=n&&c.endB>=n);if(!a)return!1;let s=e.state.sliceDoc(a.fromB,Math.max(a.fromB,a.toB-1)),o=e.state.field($o);a.fromB!=a.toB&&a.toA<=o.length&&(s+=e.state.lineBreak);let l=z6.of({from:a.fromA,to:Math.min(o.length,a.toA),insert:s},o.length);return e.dispatch({effects:Nw.of({doc:l.apply(o),changes:l}),userEvent:"accept"}),!0}function Bne(e,t){let{state:r}=e,n=t??r.selection.main.head,a=r.field(ta).find(l=>l.fromB<=n&&l.endB>=n);if(!a)return!1;let o=r.field($o).sliceString(a.fromA,Math.max(a.fromA,a.toA-1));return a.fromA!=a.toA&&a.toB<=r.doc.length&&(o+=r.lineBreak),e.dispatch({changes:{from:a.fromB,to:Math.min(r.doc.length,a.toB),insert:o},userEvent:"revert"}),!0}function vN(e){let t=new ru;for(let r of e.field(ta)){let n=e.facet(ei).overrideChunk&&g6(e,r);t.add(r.fromB,r.fromB,Fne(e,r,!!n))}return t.finish()}const Une=kc.define({create:e=>vN(e),update(e,t){return t.state.field(ta,!1)!=t.startState.field(ta,!1)?vN(t.state):e},provide:e=>Jn.decorations.from(e)}),wN=new WeakMap;function g6(e,t){let r=wN.get(t);if(r!==void 0)return r;r=null;let n=e.field($o),a=e.doc,s=n.lineAt(t.endA).number-n.lineAt(t.fromA).number+1,o=a.lineAt(t.endB).number-a.lineAt(t.fromB).number+1;e:if(s==o&&s<10){let l=[],c=0,d=t.fromA,u=t.fromB;for(let p of t.changes){if(p.fromA<p.toA){c+=p.toA-p.fromA;let f=n.sliceString(d+p.fromA,d+p.toA);if(/\n/.test(f))break e;l.push(ti.widget({widget:new $ne(f),side:-1}).range(u+p.fromB))}p.fromB<p.toB&&l.push(h6.range(u+p.fromB,u+p.toB))}c<t.endA-t.fromA-s*2&&(r=l)}return wN.set(t,r),r}class $ne extends zg{constructor(t){super(),this.text=t}eq(t){return this.text==t.text}toDOM(t){let r=document.createElement("del");return r.className="cm-deletedText",r.textContent=this.text,r}}const Hne=new class extends Fg{constructor(){super(...arguments),this.elementClass="cm-inlineChangedLineGutter"}},Gne=ti.line({class:"cm-inlineChangedLine"});function Vne(e,t,r,n){let a=g6(e,t),s=0;if(!a)return!1;for(let o=e.doc.lineAt(t.fromB);;){for(n&&n.add(o.from,o.from,Hne),r.add(o.from,o.from,Gne);s<a.length&&a[s].to<=o.to;){let l=a[s++];r.add(l.from,l.to,l.value)}if(o.to>=t.endB)break;o=e.doc.lineAt(o.to+1)}return!0}const Wne=["zip","tar","gz","rar","7z","bz2","xz","exe","dll","so","dylib","app","dmg","msi","mp3","mp4","wav","avi","mov","mkv","flv","wmv","m4a","ogg","pdf","doc","docx","xls","xlsx","ppt","pptx","odt","ods","odp","ttf","otf","woff","woff2","eot","db","sqlite","sqlite3","bin","dat","iso","img","class","jar","war","pyc","pyo"],qne=e=>{const t=e.split(".").pop()?.toLowerCase();return Wne.includes(t??"")},kN=e=>e instanceof Error?e.message:String(e),Kne=({file:e,projectPath:t})=>{const[r,n]=m.useState(""),[a,s]=m.useState(!0),[o,l]=m.useState(!1),[c,d]=m.useState(!1),[u,p]=m.useState(null),[f,h]=m.useState(!1),g=e.projectName??t,b=e.path,x=e.name,y=e.diffInfo?.new_string,v=e.diffInfo?.old_string;m.useEffect(()=>{(async()=>{try{if(s(!0),h(!1),qne(e.name)){h(!0),s(!1);return}if(e.diffInfo&&y!==void 0&&v!==void 0){n(y),s(!1);return}if(!g)throw new Error("Missing project identifier");const N=await Lt.readFile(g,b);if(!N.ok)throw new Error(`Failed to load file: ${N.status} ${N.statusText}`);const E=await N.json();n(E.content)}catch(N){const E=kN(N);console.error("Error loading file:",N),n(`// Error loading file: ${E}
676
676
  // File: ${x}
677
- // Path: ${b}`)}finally{s(!1)}})()},[e.diffInfo,e.name,y,v,x,b,g]);const w=m.useCallback(async()=>{l(!0),p(null);try{if(!g)throw new Error("Missing project identifier");const S=await Lt.saveFile(g,b,r);if(!S.ok){if(S.headers.get("content-type")?.includes("application/json")){const I=await S.json();throw new Error(I.error||`Save failed: ${S.status}`)}const E=await S.text();throw console.error("Non-JSON error response:",E),new Error(`Save failed: ${S.status} ${S.statusText}`)}await S.json(),d(!0),setTimeout(()=>d(!1),2e3),window.dispatchEvent(new CustomEvent("pixcode:file-saved",{detail:{path:b}}))}catch(S){const N=CN(S);console.error("Error saving file:",S),p(N)}finally{l(!1)}},[r,b,g]),k=m.useCallback(()=>{const S=new Blob([r],{type:"text/plain"}),N=URL.createObjectURL(S),E=document.createElement("a");E.href=N,E.download=e.name,document.body.appendChild(E),E.click(),document.body.removeChild(E),URL.revokeObjectURL(N)},[r,e.name]);return{content:r,setContent:n,loading:a,saving:o,saveSuccess:c,saveError:u,isBinary:f,handleSave:w,handleDownload:k}},Ba={theme:"codeEditorTheme",wordWrap:"codeEditorWordWrap",showMinimap:"codeEditorShowMinimap",lineNumbers:"codeEditorLineNumbers",fontSize:"codeEditorFontSize"},uo={isDarkMode:!1,minimapEnabled:!0,showLineNumbers:!0,fontSize:"12"},NN="codeEditorSettingsChanged",pae=()=>{const e=localStorage.getItem("theme");return e==="dark"||e==="light"?e==="dark":document.documentElement.classList.contains("dark")?!0:uo.isDarkMode},EN=()=>{const e=localStorage.getItem(Ba.theme);return e==="dark"||e==="light"?e==="dark":pae()},Dd=(e,t,r="false")=>{const n=localStorage.getItem(e);return n===null?t:n!==r},TN=()=>localStorage.getItem(Ba.wordWrap)==="true",AN=()=>{const e=localStorage.getItem(Ba.fontSize);return Number(e??uo.fontSize)},mae=()=>{const[e,t]=m.useState(EN),[r,n]=m.useState(TN),[a,s]=m.useState(()=>Dd(Ba.showMinimap,uo.minimapEnabled)),[o,l]=m.useState(()=>Dd(Ba.lineNumbers,uo.showLineNumbers)),[c,d]=m.useState(AN);return m.useEffect(()=>{localStorage.setItem(Ba.theme,e?"dark":"light")},[e]),m.useEffect(()=>{localStorage.setItem(Ba.wordWrap,String(r))},[r]),m.useEffect(()=>{const u=()=>{t(EN()),n(TN()),s(Dd(Ba.showMinimap,uo.minimapEnabled)),l(Dd(Ba.lineNumbers,uo.showLineNumbers)),d(AN())};return window.addEventListener("storage",u),window.addEventListener(NN,u),()=>{window.removeEventListener("storage",u),window.removeEventListener(NN,u)}},[]),{isDarkMode:e,setIsDarkMode:t,wordWrap:r,setWordWrap:n,minimapEnabled:a,setMinimapEnabled:s,showLineNumbers:o,setShowLineNumbers:l,fontSize:c,setFontSize:d}},hae=({onSave:e,onClose:t,dependency:r})=>{m.useEffect(()=>{const n=a=>{if(a.key==="Escape"){a.preventDefault(),t();return}(a.ctrlKey||a.metaKey)&&a.key.toLowerCase()==="s"&&(a.preventDefault(),e())};return document.addEventListener("keydown",n),()=>{document.removeEventListener("keydown",n)}},[r,t,e])};var fae=function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var a=0,n=Object.getOwnPropertySymbols(e);a<n.length;a++)t.indexOf(n[a])<0&&Object.prototype.propertyIsEnumerable.call(e,n[a])&&(r[n[a]]=e[n[a]]);return r};const nn=Hu.define({combine:e=>{const t=[];for(let r of e){if(!r)continue;const{create:n,gutters:a}=r,s=fae(r,["create","gutters"]);t.push(Object.assign(Object.assign({},s),{enabled:!0,gutters:a?a.filter(o=>Object.keys(o).length>0):void 0}))}return B6(t,{enabled:t.length>0,displayText:"characters",eventHandlers:{},showOverlay:"always",gutters:[]})}}),En={PixelMultiplier:2,SizeRatio:4,MaxWidth:120},gae=Jn.theme({".cm-minimap-overlay-container":{position:"absolute",top:0,height:"100%",width:"100%","&.cm-minimap-overlay-mouse-over":{opacity:0,transition:"visibility 0s linear 300ms, opacity 300ms"},"&.cm-minimap-overlay-mouse-over:hover":{opacity:1,transition:"visibility 0s linear 0ms, opacity 300ms"},"&.cm-minimap-overlay-off":{display:"none"},"& .cm-minimap-overlay":{background:"rgb(121, 121, 121)",opacity:"0.2",position:"absolute",right:0,top:0,width:"100%",transition:"top 0s ease-in 0ms","&:hover":{opacity:"0.3"}},"&.cm-minimap-overlay-active":{opacity:1,visibility:"visible",transition:"visibility 0s linear 0ms, opacity 300ms","& .cm-minimap-overlay":{opacity:"0.4"}}}}),gi=En.PixelMultiplier*En.SizeRatio,bae=Gu.fromClass(class{constructor(e){this.view=e,this._isDragging=!1,e.state.facet(nn).enabled&&this.create(e)}create(e){this.container=Co("div",{class:"cm-minimap-overlay-container"}),this.dom=Co("div",{class:"cm-minimap-overlay"}),this.container.appendChild(this.dom),this.container.addEventListener("mousedown",this.onMouseDown.bind(this)),window.addEventListener("mouseup",this.onMouseUp.bind(this)),window.addEventListener("mousemove",this.onMouseMove.bind(this));const t=e.dom.querySelector(".cm-minimap-inner");t&&t.appendChild(this.container),this.computeShowOverlay(),this.computeHeight(),this.computeTop()}remove(){this.container&&(this.container.removeEventListener("mousedown",this.onMouseDown),window.removeEventListener("mouseup",this.onMouseUp),window.removeEventListener("mousemove",this.onMouseMove),this.container.remove())}update(e){const t=e.startState.facet(nn).enabled,r=e.state.facet(nn).enabled;if(t&&!r){this.remove();return}!t&&r&&this.create(e.view),r&&(this.computeShowOverlay(),e.geometryChanged&&(this.computeHeight(),this.computeTop()))}computeHeight(){if(!this.dom)return;const e=this.view.dom.clientHeight/gi;this.dom.style.height=e+"px"}computeTop(){if(!this._isDragging&&this.dom){const{clientHeight:e,scrollHeight:t,scrollTop:r}=this.view.scrollDOM,n=t-e,a=r/gi,s=e/gi,o=e-s;let l=r/n;isNaN(l)&&(l=0);const c=o*l,d=Math.min(c,a);this.dom.style.top=d+"px"}}computeShowOverlay(){if(!this.container)return;const{showOverlay:e}=this.view.state.facet(nn);e==="mouse-over"?this.container.classList.add("cm-minimap-overlay-mouse-over"):this.container.classList.remove("cm-minimap-overlay-mouse-over");const{clientHeight:t,scrollHeight:r}=this.view.scrollDOM;t===r?this.container.classList.add("cm-minimap-overlay-off"):this.container.classList.remove("cm-minimap-overlay-off")}onMouseDown(e){if(!this.container||e.button===2)return;const{clientY:t,target:r}=e;if(r===this.dom){this._dragStartY=e.clientY,this._isDragging=!0,this.container.classList.add("cm-minimap-overlay-active");return}const{clientHeight:n,scrollHeight:a,scrollTop:s}=this.view.scrollDOM,o=r.getBoundingClientRect().top,l=(t-o)*gi,c=s/(a-n),u=(n*gi-n)*c,p=Math.max(0,s-u);this.view.scrollDOM.scrollTop=p+l-n/2}onMouseUp(e){this._isDragging&&this.container&&(this._dragStartY=void 0,this._isDragging=!1,this.container.classList.remove("cm-minimap-overlay-active"))}onMouseMove(e){if(!this._isDragging||!this.dom)return;if(e.preventDefault(),e.stopPropagation(),!this._dragStartY){this._dragStartY=e.clientY;return}const t=e.clientY-this._dragStartY,r=t<0,n=t>0;this._dragStartY=e.clientY;const a=this.dom.getBoundingClientRect().height,s=this.dom.getBoundingClientRect().y,o=s+a,l=parseFloat(this.dom.style.top),c=this.view.scrollDOM.scrollTop,d=this.view.scrollDOM.clientHeight,u=this.view.scrollDOM.scrollHeight,p=c===0,f=Math.round(c)>=Math.round(u-d);if(p&&r||p&&e.clientY<s||f&&n||f&&e.clientY>o)return;const h=this.view.scrollDOM.scrollHeight,g=this.view.scrollDOM.clientHeight,b=(h-g)/gi,x=g-g/gi,y=l+t,v=y/x,w=(h-g)*v,k=y*gi;this.view.scrollDOM.scrollTop=Math.max(w,k);const S=Math.min(Math.max(0,y),Math.min(x,b));this.dom.style.top=S+"px"}destroy(){this.remove()}},{eventHandlers:{scroll(){requestAnimationFrame(()=>this.computeTop())}}}),xae=[gae,bae];class Ew{constructor(t){this.map=new Map,this.view=t}get(t){return this.map.get(t)}set(t,r){this.map.set(t,r)}}function jN(e){var t;if(!e.facet(nn).enabled)return[];const r=[],n=e.doc.iterLines(),a=U6(e).iter();let s=0;for(n.next();!n.done;){const o=n.value;let l=s,c=l+o.length;for(;a.value&&a.to<l;)a.next();const{from:d,to:u}=a,p=l>=d&&l<u,f=c>d&&c<=u;if(p){let h=(t=r.pop())!==null&&t!==void 0?t:[],g=h.pop();g&&g.folded&&(g.to=u),g&&h.push(g),(!g||!g.folded)&&h.push({from:d,to:u,folded:!0}),f||h.push({from:u,to:c,folded:!1}),r.push(h)}else f?r.push([{from:l,to:d,folded:!1},{from:d,to:u,folded:!0}]):r.push([{from:l,to:c,folded:!1}]);s=c+1,n.next()}return r}const Ho=kc.define({create:e=>jN(e),update:(e,t)=>Dp([t])||t.docChanged?jN(t.state):e});function Dp(e){return e.find(t=>t.effects.find(r=>r.is($6)||r.is(H6)))}class yae extends Ew{constructor(t){super(t),this.count=void 0}shouldUpdate(t){if(!t.state.facet(nn).enabled)return!1;if(t.docChanged)return!0;for(const r of t.transactions)for(const n of r.effects)if(n.is(G6))return!0;return!!(Dp(t.transactions)||this.count===void 0)}update(t){if(!this.shouldUpdate(t))return;this.map.clear();const r=t.state.field(Ho);this.count=V6(t.state),W6(t.state,(n,a,s)=>{const o=this.findLine(a,r),l=this.findLine(s,r);let c=n.severity;for(let d=o;d<=l;d++){const u=this.get(d);u&&(c=[c,u].sort(this.sort.bind(this)).slice(0,1)[0]),this.set(d,c)}})}drawLine(t,r){const{context:n,lineHeight:a,offsetX:s,offsetY:o}=t,l=this.get(r);l&&(n.globalAlpha=.65,n.beginPath(),n.rect(s,o,n.canvas.width-s,a),n.fillStyle=this.color(l),n.fill())}findLine(t,r){return r.findIndex(a=>{const s=a.slice(0,1)[0],o=a.slice(-1)[0];return!s||!o?!1:s.from<=t&&t<=o.to})+1}color(t){return t==="error"?"#d11":t==="warning"?"orange":"#999"}sort(t,r){return this.score(r)-this.score(t)}score(t){switch(t){case"error":return 3;case"warning":return 2;default:return 1}}}function vae(e){return new yae(e)}class wae extends Ew{constructor(t){super(t),this.getDrawInfo(),this._themeClasses=t.dom.classList.value}shouldUpdate(t){return t.state.facet(nn).enabled?!!(t.docChanged||t.selectionSet||this._themeClasses!==this.view.dom.classList.value||Dp(t.transactions)):!1}update(t){if(!this.shouldUpdate(t))return;this.map.clear(),this._themeClasses!==this.view.dom.classList.value&&(this._drawInfo=void 0,this._themeClasses=this.view.dom.classList.value);const{ranges:r}=t.state.selection;let n=0;for(const[a,s]of t.state.field(Ho).entries()){const o=[];let l=0;for(const d of s){do{if(n>=r.length||d.to<r[n].from)continue;if(r[n].from===r[n].to){n++;continue}const u=r[n],p={from:l+Math.max(d.from,u.from)-d.from,to:l+Math.min(d.to,u.to)-d.from,extends:u.to>d.to},f=o.slice(-1)[0];if(f&&f.to===p.from){let{to:h}=p;d.folded&&p.extends?h=p.from+1:d.folded&&!p.extends&&(h=f.to),o[o.length-1]=Object.assign(Object.assign({},f),{to:h,extends:p.extends})}else d.folded||o.push(p);if(p.extends)break;n++}while(n<r.length&&d.to>=r[n].from);l+=d.folded?1:d.to-d.from}if(o.length===0)continue;const c=a+1;this.map.set(c,o)}}drawLine(t,r){let{context:n,lineHeight:a,charWidth:s,offsetX:o,offsetY:l}=t;const c=this.get(r);if(c)for(const d of c){const u=o+d.from*s,p=(d.to-d.from)*s,f=n.canvas.width-u;d.extends&&(n.globalAlpha=.65,n.beginPath(),n.rect(u,l,f,a),n.fillStyle=this.getDrawInfo().backgroundColor,n.fill()),n.globalAlpha=1,n.beginPath(),n.rect(u,l,p,a),n.fillStyle=this.getDrawInfo().backgroundColor,n.fill()}}getDrawInfo(){if(this._drawInfo)return this._drawInfo;const t=document.createElement("span");t.setAttribute("class","cm-selectionBackground"),this.view.dom.appendChild(t);const n={backgroundColor:window.getComputedStyle(t).backgroundColor};return this._drawInfo=n,this.view.dom.removeChild(t),n}}function kae(e){return new wae(e)}class Sae extends Ew{constructor(t){super(t),this._fontInfoMap=new Map,this._themeClasses=new Set(t.dom.classList.values()),t.state.facet(nn).enabled&&this.updateImpl(t.state)}shouldUpdate(t){return!!(t.docChanged||t.state.facet(nn)!==t.startState.facet(nn)||this.themeChanged()||Dp(t.transactions))}update(t){this.shouldUpdate(t)&&(this._highlightingCallbackId&&(typeof window.requestIdleCallback<"u"?cancelIdleCallback(this._highlightingCallbackId):clearTimeout(this._highlightingCallbackId)),this.updateImpl(t.state,t.changes))}updateImpl(t,r){var n;this.map.clear(),this._displayText=t.facet(nn).displayText,this.themeChanged()&&this._fontInfoMap.clear();let a;if(this._previousTree&&r){const p=Iw.addTree(this._previousTree),f=[];r.iterChangedRanges((h,g,b,x)=>f.push({fromA:h,toA:g,fromB:b,toB:x})),a=Iw.applyChanges(p,f)}const s=t.doc.toString(),o=(n=t.facet(JN))===null||n===void 0?void 0:n.parser,l=o?o.parse(s,a):void 0;this._previousTree=l;const c={style:p=>QN(t,p)};let d=[];if(l){const p=t.doc.lineAt(this.view.viewport.from).number,f=t.doc.lineAt(this.view.viewport.to).number,h=f-p,g=p/(t.doc.lines-h),{SizeRatio:b,PixelMultiplier:x}=En,y=h*b*x,v=g*y,w=Math.max(1,Math.floor(p-v)),k=Math.min(f+Math.floor(y-v),t.doc.lines);rf(l,c,(S,N,E)=>{d.push({from:S,to:N,tags:E})},t.doc.line(w).from,t.doc.line(k).to)}this.updateMapImpl(t,d),d=[];const u=()=>{l&&(rf(l,c,(p,f,h)=>{d.push({from:p,to:f,tags:h})}),this.updateMapImpl(t,d),this._highlightingCallbackId=void 0)};this._highlightingCallbackId=typeof window.requestIdleCallback<"u"?requestIdleCallback(u):setTimeout(u)}updateMapImpl(t,r){this.map.clear();const n=t.doc.toString(),a=r.values();let s=a.next();for(const[o,l]of t.field(Ho).entries()){const c=[];for(const u of l){if(u.from===u.to)continue;if(u.folded){c.push({text:"…",tags:""});continue}let p=u.from;for(;!s.done&&s.value.from<u.to;){const{from:f,to:h,tags:g}=s.value;if(h<p){s=a.next();continue}f>p&&c.push({text:n.slice(p,f),tags:""});const b=Math.max(f,u.from),x=Math.min(h,u.to);if(c.push({text:n.slice(b,x),tags:g}),p=x,h>x)break;s=a.next()}p!==u.to&&c.push({text:n.slice(p,u.to),tags:""})}const d=o+1;this.map.set(d,c)}}measure(t){const{color:r,font:n,lineHeight:a}=this.getFontInfo("");return t.textBaseline="ideographic",t.fillStyle=r,t.font=n,{charWidth:t.measureText("_").width,lineHeight:a}}beforeDraw(){this._fontInfoMap.clear()}drawLine(t,r){const n=this.get(r);if(!n)return;let{context:a,charWidth:s,lineHeight:o,offsetX:l,offsetY:c}=t,d;a.textBaseline="ideographic";for(const u of n){const p=this.getFontInfo(u.tags);switch((!d||d.color!==p.color)&&(a.fillStyle=p.color),(!d||d.font!==p.font)&&(a.font=p.font),d=p,o=Math.max(o,p.lineHeight),this._displayText){case"characters":{a.fillText(u.text,l,c+o),l+=u.text.length*s;break}case"blocks":{const f=/\S+/g;let h;for(;(h=f.exec(u.text))!==null;){const g=l+h.index*s;let b=(f.lastIndex-h.index)*s;if(g>a.canvas.width)break;g+b>a.canvas.width&&(b=a.canvas.width-g);const x=2/En.SizeRatio,y=o-x;a.fillStyle=p.color,a.globalAlpha=.65,a.beginPath(),a.rect(g,c,b,y),a.fill()}l+=u.text.length*s;break}}}}getFontInfo(t){const r=this._fontInfoMap.get(t);if(r)return r;const n=Co("span",{class:t}),a=Co("div",{class:"cm-line",style:"display: none"},n);this.view.contentDOM.appendChild(a);const s=window.getComputedStyle(n),o=parseFloat(s.lineHeight)/En.SizeRatio,l={color:s.color,font:`${s.fontStyle} ${s.fontWeight} ${o}px ${s.fontFamily}`,lineHeight:o};return this._fontInfoMap.set(t,l),this.view.contentDOM.removeChild(a),l}themeChanged(){const t=this._themeClasses,r=new Set(this.view.dom.classList.values());if(this._themeClasses=r,!t||(t.delete("cm-focused"),r.delete("cm-focused"),t.size!==r.size))return!0;let n=!0;return t.forEach(a=>{r.has(a)||(n=!1)}),!n}}function Cae(e){return new Sae(e)}const x6=4;function Nae(e,t,r){const n=e[r];n&&(t.context.fillStyle=n,t.context.globalAlpha=1,t.context.beginPath(),t.context.rect(t.offsetX,t.offsetY,x6,t.lineHeight),t.context.fill())}const Eae=Jn.theme({"&":{height:"100%",overflowY:"auto"},"& .cm-minimap-gutter":{borderRight:0,flexShrink:0,left:"unset",position:"sticky",right:0,top:0},"& .cm-minimap-inner":{height:"100%",position:"absolute",right:0,top:0,overflowY:"hidden","& canvas":{display:"block"}},"& .cm-minimap-box-shadow":{boxShadow:"12px 0px 20px 5px #6c6c6c"}}),IN=6,Tae=Gu.fromClass(class{constructor(e){this.view=e,this.text=Cae(e),this.selection=kae(e),this.diagnostic=vae(e),e.state.facet(Gl)&&this.create(e)}create(e){const t=e.state.facet(Gl);if(!t)throw Error("Expected nonnull");this.inner=Co("div",{class:"cm-minimap-inner"}),this.canvas=Co("canvas"),this.dom=t.create(e).dom,this.dom.classList.add("cm-gutters"),this.dom.classList.add("cm-minimap-gutter"),this.inner.appendChild(this.canvas),this.dom.appendChild(this.inner),this.view.scrollDOM.insertBefore(this.dom,this.view.contentDOM.nextSibling);for(const r in this.view.state.facet(nn).eventHandlers){const n=this.view.state.facet(nn).eventHandlers[r];n&&this.dom.addEventListener(r,a=>n(a,this.view))}}remove(){this.dom&&this.dom.remove()}update(e){const t=e.startState.facet(Gl),r=e.state.facet(Gl);if(t&&!r){this.remove();return}!t&&r&&this.create(e.view),r&&(this.text.update(e),this.selection.update(e),this.diagnostic.update(e),this.render())}getWidth(){const e=this.view.dom.clientWidth;if(e<=En.MaxWidth*IN){const t=e/(En.MaxWidth*IN);return En.MaxWidth*t}return En.MaxWidth}render(){if(!this.dom||!this.canvas||!this.inner)return;this.text.beforeDraw(),this.updateBoxShadow(),this.dom.style.width=this.getWidth()+"px",this.canvas.style.maxWidth=this.getWidth()+"px",this.canvas.width=this.getWidth()*En.PixelMultiplier;const e=this.view.dom.getBoundingClientRect().height;this.inner.style.minHeight=e+"px",this.canvas.height=e*En.PixelMultiplier,this.canvas.style.height=e+"px";const t=this.canvas.getContext("2d");if(!t)return;t.clearRect(0,0,this.canvas.width,this.canvas.height);const{charWidth:r,lineHeight:n}=this.text.measure(t);let{startIndex:a,endIndex:s,offsetY:o}=this.canvasStartAndEndIndex(t,n);const l=this.view.state.facet(nn).gutters;for(let c=a;c<s;c++){const d=this.view.state.field(Ho);if(c>=d.length)break;const u={offsetX:0,offsetY:o,context:t,lineHeight:n,charWidth:r};if(l.length){u.offsetX+=2;for(let p of l)Nae(p,u,c+1),u.offsetX+=x6;u.offsetX+=2}this.text.drawLine(u,c+1),this.selection.drawLine(u,c+1),this.diagnostic.drawLine(u,c+1),o+=n}t.restore()}canvasStartAndEndIndex(e,t){let{top:r,bottom:n}=this.view.documentPadding;r/=En.SizeRatio,n/=En.SizeRatio;const a=e.canvas.height,{clientHeight:s,scrollHeight:o,scrollTop:l}=this.view.scrollDOM;let c=l/(o-s);isNaN(c)&&(c=0);const d=this.view.state.field(Ho).length,u=r+n+d*t,p=Math.max(0,c*(u-a)),f=Math.max(0,r-p),h=Math.round(Math.max(0,p-r)/t),g=Math.round((a-f)/t);return{startIndex:h,endIndex:h+g,offsetY:f}}updateBoxShadow(){if(!this.canvas)return;const{clientWidth:e,scrollWidth:t,scrollLeft:r}=this.view.scrollDOM;e+r<t?this.canvas.classList.add("cm-minimap-box-shadow"):this.canvas.classList.remove("cm-minimap-box-shadow")}destroy(){this.remove()}},{eventHandlers:{scroll(){requestAnimationFrame(()=>this.render())}},provide:e=>Jn.scrollMargins.of(t=>{var r;const n=(r=t.plugin(e))===null||r===void 0?void 0:r.getWidth();return n?{right:n}:null})}),Gl=Hu.define({combine:e=>{var t;return(t=e.find(r=>r!==null))!==null&&t!==void 0?t:null},enables:e=>[[nn.compute([e],t=>t.facet(e)),Eae,Ho,Tae,xae]]}),RN=q6.define({token(e){return e.match(/^#.*/)?"comment":e.sol()&&e.match(/^[A-Za-z_][A-Za-z0-9_.]*(?==)/)?"variableName.definition":e.match(/^=/)?"operator":e.match(/^"(?:[^"\\]|\\.)*"?/)||e.match(/^'(?:[^'\\]|\\.)*'?/)?"string":e.match(/^\$\{[^}]*\}?/)||e.match(/^\$[A-Za-z_][A-Za-z0-9_]*/)?"variableName.special":e.match(/^\d+/)?"number":(e.next(),null)}}),Aae=e=>{const t=e.toLowerCase();if(t===".env"||t.startsWith(".env."))return[RN];const r=e.split(".").pop()?.toLowerCase();switch(r){case"js":case"jsx":case"ts":case"tsx":return[J6({jsx:!0,typescript:r.includes("ts")})];case"py":return[X6()];case"html":case"htm":return[Z6()];case"css":case"scss":case"less":return[Y6()];case"json":return[qN()];case"md":case"markdown":return[K6()];case"env":return[RN];default:return[]}},jae=({file:e,showDiff:t,minimapEnabled:r,isDarkMode:n})=>{if(!e.diffInfo||!t||!r)return[];const a={};return[Gl.compute(["doc"],s=>{const l=Cw(s)?.chunks||[];return Object.keys(a).forEach(c=>{delete a[Number(c)]}),l.forEach(c=>{const d=s.doc.lineAt(c.fromB).number,u=s.doc.lineAt(Math.min(c.toB,s.doc.length)).number;for(let p=d;p<=u;p+=1)a[p]=n?"rgba(34, 197, 94, 0.8)":"rgba(34, 197, 94, 1)"}),{create:()=>({dom:document.createElement("div")}),displayText:"blocks",showOverlay:"always",gutters:[a]}})]},Iae=({file:e,showDiff:t})=>!e.diffInfo||!t?[]:[Gu.fromClass(class{constructor(r){setTimeout(()=>{const a=Cw(r.state)?.chunks?.[0];a&&r.dispatch({effects:Jn.scrollIntoView(a.fromB,{y:"center"})})},100)}update(){}destroy(){}})],Rae=e=>`
677
+ // Path: ${b}`)}finally{s(!1)}})()},[e.diffInfo,e.name,y,v,x,b,g]);const w=m.useCallback(async()=>{l(!0),p(null);try{if(!g)throw new Error("Missing project identifier");const S=await Lt.saveFile(g,b,r);if(!S.ok){if(S.headers.get("content-type")?.includes("application/json")){const I=await S.json();throw new Error(I.error||`Save failed: ${S.status}`)}const E=await S.text();throw console.error("Non-JSON error response:",E),new Error(`Save failed: ${S.status} ${S.statusText}`)}await S.json(),d(!0),setTimeout(()=>d(!1),2e3),window.dispatchEvent(new CustomEvent("pixcode:file-saved",{detail:{path:b}}))}catch(S){const N=kN(S);console.error("Error saving file:",S),p(N)}finally{l(!1)}},[r,b,g]),k=m.useCallback(()=>{const S=new Blob([r],{type:"text/plain"}),N=URL.createObjectURL(S),E=document.createElement("a");E.href=N,E.download=e.name,document.body.appendChild(E),E.click(),document.body.removeChild(E),URL.revokeObjectURL(N)},[r,e.name]);return{content:r,setContent:n,loading:a,saving:o,saveSuccess:c,saveError:u,isBinary:f,handleSave:w,handleDownload:k}},Ba={theme:"codeEditorTheme",wordWrap:"codeEditorWordWrap",showMinimap:"codeEditorShowMinimap",lineNumbers:"codeEditorLineNumbers",fontSize:"codeEditorFontSize"},uo={isDarkMode:!1,minimapEnabled:!0,showLineNumbers:!0,fontSize:"12"},SN="codeEditorSettingsChanged",Yne=()=>{const e=localStorage.getItem("theme");return e==="dark"||e==="light"?e==="dark":document.documentElement.classList.contains("dark")?!0:uo.isDarkMode},CN=()=>{const e=localStorage.getItem(Ba.theme);return e==="dark"||e==="light"?e==="dark":Yne()},Dd=(e,t,r="false")=>{const n=localStorage.getItem(e);return n===null?t:n!==r},NN=()=>localStorage.getItem(Ba.wordWrap)==="true",EN=()=>{const e=localStorage.getItem(Ba.fontSize);return Number(e??uo.fontSize)},Zne=()=>{const[e,t]=m.useState(CN),[r,n]=m.useState(NN),[a,s]=m.useState(()=>Dd(Ba.showMinimap,uo.minimapEnabled)),[o,l]=m.useState(()=>Dd(Ba.lineNumbers,uo.showLineNumbers)),[c,d]=m.useState(EN);return m.useEffect(()=>{localStorage.setItem(Ba.theme,e?"dark":"light")},[e]),m.useEffect(()=>{localStorage.setItem(Ba.wordWrap,String(r))},[r]),m.useEffect(()=>{const u=()=>{t(CN()),n(NN()),s(Dd(Ba.showMinimap,uo.minimapEnabled)),l(Dd(Ba.lineNumbers,uo.showLineNumbers)),d(EN())};return window.addEventListener("storage",u),window.addEventListener(SN,u),()=>{window.removeEventListener("storage",u),window.removeEventListener(SN,u)}},[]),{isDarkMode:e,setIsDarkMode:t,wordWrap:r,setWordWrap:n,minimapEnabled:a,setMinimapEnabled:s,showLineNumbers:o,setShowLineNumbers:l,fontSize:c,setFontSize:d}},Xne=({onSave:e,onClose:t,dependency:r})=>{m.useEffect(()=>{const n=a=>{if(a.key==="Escape"){a.preventDefault(),t();return}(a.ctrlKey||a.metaKey)&&a.key.toLowerCase()==="s"&&(a.preventDefault(),e())};return document.addEventListener("keydown",n),()=>{document.removeEventListener("keydown",n)}},[r,t,e])};var Jne=function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var a=0,n=Object.getOwnPropertySymbols(e);a<n.length;a++)t.indexOf(n[a])<0&&Object.prototype.propertyIsEnumerable.call(e,n[a])&&(r[n[a]]=e[n[a]]);return r};const nn=Hu.define({combine:e=>{const t=[];for(let r of e){if(!r)continue;const{create:n,gutters:a}=r,s=Jne(r,["create","gutters"]);t.push(Object.assign(Object.assign({},s),{enabled:!0,gutters:a?a.filter(o=>Object.keys(o).length>0):void 0}))}return B6(t,{enabled:t.length>0,displayText:"characters",eventHandlers:{},showOverlay:"always",gutters:[]})}}),En={PixelMultiplier:2,SizeRatio:4,MaxWidth:120},Qne=Jn.theme({".cm-minimap-overlay-container":{position:"absolute",top:0,height:"100%",width:"100%","&.cm-minimap-overlay-mouse-over":{opacity:0,transition:"visibility 0s linear 300ms, opacity 300ms"},"&.cm-minimap-overlay-mouse-over:hover":{opacity:1,transition:"visibility 0s linear 0ms, opacity 300ms"},"&.cm-minimap-overlay-off":{display:"none"},"& .cm-minimap-overlay":{background:"rgb(121, 121, 121)",opacity:"0.2",position:"absolute",right:0,top:0,width:"100%",transition:"top 0s ease-in 0ms","&:hover":{opacity:"0.3"}},"&.cm-minimap-overlay-active":{opacity:1,visibility:"visible",transition:"visibility 0s linear 0ms, opacity 300ms","& .cm-minimap-overlay":{opacity:"0.4"}}}}),gi=En.PixelMultiplier*En.SizeRatio,eae=Gu.fromClass(class{constructor(e){this.view=e,this._isDragging=!1,e.state.facet(nn).enabled&&this.create(e)}create(e){this.container=Co("div",{class:"cm-minimap-overlay-container"}),this.dom=Co("div",{class:"cm-minimap-overlay"}),this.container.appendChild(this.dom),this.container.addEventListener("mousedown",this.onMouseDown.bind(this)),window.addEventListener("mouseup",this.onMouseUp.bind(this)),window.addEventListener("mousemove",this.onMouseMove.bind(this));const t=e.dom.querySelector(".cm-minimap-inner");t&&t.appendChild(this.container),this.computeShowOverlay(),this.computeHeight(),this.computeTop()}remove(){this.container&&(this.container.removeEventListener("mousedown",this.onMouseDown),window.removeEventListener("mouseup",this.onMouseUp),window.removeEventListener("mousemove",this.onMouseMove),this.container.remove())}update(e){const t=e.startState.facet(nn).enabled,r=e.state.facet(nn).enabled;if(t&&!r){this.remove();return}!t&&r&&this.create(e.view),r&&(this.computeShowOverlay(),e.geometryChanged&&(this.computeHeight(),this.computeTop()))}computeHeight(){if(!this.dom)return;const e=this.view.dom.clientHeight/gi;this.dom.style.height=e+"px"}computeTop(){if(!this._isDragging&&this.dom){const{clientHeight:e,scrollHeight:t,scrollTop:r}=this.view.scrollDOM,n=t-e,a=r/gi,s=e/gi,o=e-s;let l=r/n;isNaN(l)&&(l=0);const c=o*l,d=Math.min(c,a);this.dom.style.top=d+"px"}}computeShowOverlay(){if(!this.container)return;const{showOverlay:e}=this.view.state.facet(nn);e==="mouse-over"?this.container.classList.add("cm-minimap-overlay-mouse-over"):this.container.classList.remove("cm-minimap-overlay-mouse-over");const{clientHeight:t,scrollHeight:r}=this.view.scrollDOM;t===r?this.container.classList.add("cm-minimap-overlay-off"):this.container.classList.remove("cm-minimap-overlay-off")}onMouseDown(e){if(!this.container||e.button===2)return;const{clientY:t,target:r}=e;if(r===this.dom){this._dragStartY=e.clientY,this._isDragging=!0,this.container.classList.add("cm-minimap-overlay-active");return}const{clientHeight:n,scrollHeight:a,scrollTop:s}=this.view.scrollDOM,o=r.getBoundingClientRect().top,l=(t-o)*gi,c=s/(a-n),u=(n*gi-n)*c,p=Math.max(0,s-u);this.view.scrollDOM.scrollTop=p+l-n/2}onMouseUp(e){this._isDragging&&this.container&&(this._dragStartY=void 0,this._isDragging=!1,this.container.classList.remove("cm-minimap-overlay-active"))}onMouseMove(e){if(!this._isDragging||!this.dom)return;if(e.preventDefault(),e.stopPropagation(),!this._dragStartY){this._dragStartY=e.clientY;return}const t=e.clientY-this._dragStartY,r=t<0,n=t>0;this._dragStartY=e.clientY;const a=this.dom.getBoundingClientRect().height,s=this.dom.getBoundingClientRect().y,o=s+a,l=parseFloat(this.dom.style.top),c=this.view.scrollDOM.scrollTop,d=this.view.scrollDOM.clientHeight,u=this.view.scrollDOM.scrollHeight,p=c===0,f=Math.round(c)>=Math.round(u-d);if(p&&r||p&&e.clientY<s||f&&n||f&&e.clientY>o)return;const h=this.view.scrollDOM.scrollHeight,g=this.view.scrollDOM.clientHeight,b=(h-g)/gi,x=g-g/gi,y=l+t,v=y/x,w=(h-g)*v,k=y*gi;this.view.scrollDOM.scrollTop=Math.max(w,k);const S=Math.min(Math.max(0,y),Math.min(x,b));this.dom.style.top=S+"px"}destroy(){this.remove()}},{eventHandlers:{scroll(){requestAnimationFrame(()=>this.computeTop())}}}),tae=[Qne,eae];class Ew{constructor(t){this.map=new Map,this.view=t}get(t){return this.map.get(t)}set(t,r){this.map.set(t,r)}}function TN(e){var t;if(!e.facet(nn).enabled)return[];const r=[],n=e.doc.iterLines(),a=U6(e).iter();let s=0;for(n.next();!n.done;){const o=n.value;let l=s,c=l+o.length;for(;a.value&&a.to<l;)a.next();const{from:d,to:u}=a,p=l>=d&&l<u,f=c>d&&c<=u;if(p){let h=(t=r.pop())!==null&&t!==void 0?t:[],g=h.pop();g&&g.folded&&(g.to=u),g&&h.push(g),(!g||!g.folded)&&h.push({from:d,to:u,folded:!0}),f||h.push({from:u,to:c,folded:!1}),r.push(h)}else f?r.push([{from:l,to:d,folded:!1},{from:d,to:u,folded:!0}]):r.push([{from:l,to:c,folded:!1}]);s=c+1,n.next()}return r}const Ho=kc.define({create:e=>TN(e),update:(e,t)=>Dp([t])||t.docChanged?TN(t.state):e});function Dp(e){return e.find(t=>t.effects.find(r=>r.is($6)||r.is(H6)))}class rae extends Ew{constructor(t){super(t),this.count=void 0}shouldUpdate(t){if(!t.state.facet(nn).enabled)return!1;if(t.docChanged)return!0;for(const r of t.transactions)for(const n of r.effects)if(n.is(G6))return!0;return!!(Dp(t.transactions)||this.count===void 0)}update(t){if(!this.shouldUpdate(t))return;this.map.clear();const r=t.state.field(Ho);this.count=V6(t.state),W6(t.state,(n,a,s)=>{const o=this.findLine(a,r),l=this.findLine(s,r);let c=n.severity;for(let d=o;d<=l;d++){const u=this.get(d);u&&(c=[c,u].sort(this.sort.bind(this)).slice(0,1)[0]),this.set(d,c)}})}drawLine(t,r){const{context:n,lineHeight:a,offsetX:s,offsetY:o}=t,l=this.get(r);l&&(n.globalAlpha=.65,n.beginPath(),n.rect(s,o,n.canvas.width-s,a),n.fillStyle=this.color(l),n.fill())}findLine(t,r){return r.findIndex(a=>{const s=a.slice(0,1)[0],o=a.slice(-1)[0];return!s||!o?!1:s.from<=t&&t<=o.to})+1}color(t){return t==="error"?"#d11":t==="warning"?"orange":"#999"}sort(t,r){return this.score(r)-this.score(t)}score(t){switch(t){case"error":return 3;case"warning":return 2;default:return 1}}}function nae(e){return new rae(e)}class aae extends Ew{constructor(t){super(t),this.getDrawInfo(),this._themeClasses=t.dom.classList.value}shouldUpdate(t){return t.state.facet(nn).enabled?!!(t.docChanged||t.selectionSet||this._themeClasses!==this.view.dom.classList.value||Dp(t.transactions)):!1}update(t){if(!this.shouldUpdate(t))return;this.map.clear(),this._themeClasses!==this.view.dom.classList.value&&(this._drawInfo=void 0,this._themeClasses=this.view.dom.classList.value);const{ranges:r}=t.state.selection;let n=0;for(const[a,s]of t.state.field(Ho).entries()){const o=[];let l=0;for(const d of s){do{if(n>=r.length||d.to<r[n].from)continue;if(r[n].from===r[n].to){n++;continue}const u=r[n],p={from:l+Math.max(d.from,u.from)-d.from,to:l+Math.min(d.to,u.to)-d.from,extends:u.to>d.to},f=o.slice(-1)[0];if(f&&f.to===p.from){let{to:h}=p;d.folded&&p.extends?h=p.from+1:d.folded&&!p.extends&&(h=f.to),o[o.length-1]=Object.assign(Object.assign({},f),{to:h,extends:p.extends})}else d.folded||o.push(p);if(p.extends)break;n++}while(n<r.length&&d.to>=r[n].from);l+=d.folded?1:d.to-d.from}if(o.length===0)continue;const c=a+1;this.map.set(c,o)}}drawLine(t,r){let{context:n,lineHeight:a,charWidth:s,offsetX:o,offsetY:l}=t;const c=this.get(r);if(c)for(const d of c){const u=o+d.from*s,p=(d.to-d.from)*s,f=n.canvas.width-u;d.extends&&(n.globalAlpha=.65,n.beginPath(),n.rect(u,l,f,a),n.fillStyle=this.getDrawInfo().backgroundColor,n.fill()),n.globalAlpha=1,n.beginPath(),n.rect(u,l,p,a),n.fillStyle=this.getDrawInfo().backgroundColor,n.fill()}}getDrawInfo(){if(this._drawInfo)return this._drawInfo;const t=document.createElement("span");t.setAttribute("class","cm-selectionBackground"),this.view.dom.appendChild(t);const n={backgroundColor:window.getComputedStyle(t).backgroundColor};return this._drawInfo=n,this.view.dom.removeChild(t),n}}function iae(e){return new aae(e)}class sae extends Ew{constructor(t){super(t),this._fontInfoMap=new Map,this._themeClasses=new Set(t.dom.classList.values()),t.state.facet(nn).enabled&&this.updateImpl(t.state)}shouldUpdate(t){return!!(t.docChanged||t.state.facet(nn)!==t.startState.facet(nn)||this.themeChanged()||Dp(t.transactions))}update(t){this.shouldUpdate(t)&&(this._highlightingCallbackId&&(typeof window.requestIdleCallback<"u"?cancelIdleCallback(this._highlightingCallbackId):clearTimeout(this._highlightingCallbackId)),this.updateImpl(t.state,t.changes))}updateImpl(t,r){var n;this.map.clear(),this._displayText=t.facet(nn).displayText,this.themeChanged()&&this._fontInfoMap.clear();let a;if(this._previousTree&&r){const p=Iw.addTree(this._previousTree),f=[];r.iterChangedRanges((h,g,b,x)=>f.push({fromA:h,toA:g,fromB:b,toB:x})),a=Iw.applyChanges(p,f)}const s=t.doc.toString(),o=(n=t.facet(JN))===null||n===void 0?void 0:n.parser,l=o?o.parse(s,a):void 0;this._previousTree=l;const c={style:p=>QN(t,p)};let d=[];if(l){const p=t.doc.lineAt(this.view.viewport.from).number,f=t.doc.lineAt(this.view.viewport.to).number,h=f-p,g=p/(t.doc.lines-h),{SizeRatio:b,PixelMultiplier:x}=En,y=h*b*x,v=g*y,w=Math.max(1,Math.floor(p-v)),k=Math.min(f+Math.floor(y-v),t.doc.lines);rf(l,c,(S,N,E)=>{d.push({from:S,to:N,tags:E})},t.doc.line(w).from,t.doc.line(k).to)}this.updateMapImpl(t,d),d=[];const u=()=>{l&&(rf(l,c,(p,f,h)=>{d.push({from:p,to:f,tags:h})}),this.updateMapImpl(t,d),this._highlightingCallbackId=void 0)};this._highlightingCallbackId=typeof window.requestIdleCallback<"u"?requestIdleCallback(u):setTimeout(u)}updateMapImpl(t,r){this.map.clear();const n=t.doc.toString(),a=r.values();let s=a.next();for(const[o,l]of t.field(Ho).entries()){const c=[];for(const u of l){if(u.from===u.to)continue;if(u.folded){c.push({text:"…",tags:""});continue}let p=u.from;for(;!s.done&&s.value.from<u.to;){const{from:f,to:h,tags:g}=s.value;if(h<p){s=a.next();continue}f>p&&c.push({text:n.slice(p,f),tags:""});const b=Math.max(f,u.from),x=Math.min(h,u.to);if(c.push({text:n.slice(b,x),tags:g}),p=x,h>x)break;s=a.next()}p!==u.to&&c.push({text:n.slice(p,u.to),tags:""})}const d=o+1;this.map.set(d,c)}}measure(t){const{color:r,font:n,lineHeight:a}=this.getFontInfo("");return t.textBaseline="ideographic",t.fillStyle=r,t.font=n,{charWidth:t.measureText("_").width,lineHeight:a}}beforeDraw(){this._fontInfoMap.clear()}drawLine(t,r){const n=this.get(r);if(!n)return;let{context:a,charWidth:s,lineHeight:o,offsetX:l,offsetY:c}=t,d;a.textBaseline="ideographic";for(const u of n){const p=this.getFontInfo(u.tags);switch((!d||d.color!==p.color)&&(a.fillStyle=p.color),(!d||d.font!==p.font)&&(a.font=p.font),d=p,o=Math.max(o,p.lineHeight),this._displayText){case"characters":{a.fillText(u.text,l,c+o),l+=u.text.length*s;break}case"blocks":{const f=/\S+/g;let h;for(;(h=f.exec(u.text))!==null;){const g=l+h.index*s;let b=(f.lastIndex-h.index)*s;if(g>a.canvas.width)break;g+b>a.canvas.width&&(b=a.canvas.width-g);const x=2/En.SizeRatio,y=o-x;a.fillStyle=p.color,a.globalAlpha=.65,a.beginPath(),a.rect(g,c,b,y),a.fill()}l+=u.text.length*s;break}}}}getFontInfo(t){const r=this._fontInfoMap.get(t);if(r)return r;const n=Co("span",{class:t}),a=Co("div",{class:"cm-line",style:"display: none"},n);this.view.contentDOM.appendChild(a);const s=window.getComputedStyle(n),o=parseFloat(s.lineHeight)/En.SizeRatio,l={color:s.color,font:`${s.fontStyle} ${s.fontWeight} ${o}px ${s.fontFamily}`,lineHeight:o};return this._fontInfoMap.set(t,l),this.view.contentDOM.removeChild(a),l}themeChanged(){const t=this._themeClasses,r=new Set(this.view.dom.classList.values());if(this._themeClasses=r,!t||(t.delete("cm-focused"),r.delete("cm-focused"),t.size!==r.size))return!0;let n=!0;return t.forEach(a=>{r.has(a)||(n=!1)}),!n}}function oae(e){return new sae(e)}const b6=4;function lae(e,t,r){const n=e[r];n&&(t.context.fillStyle=n,t.context.globalAlpha=1,t.context.beginPath(),t.context.rect(t.offsetX,t.offsetY,b6,t.lineHeight),t.context.fill())}const cae=Jn.theme({"&":{height:"100%",overflowY:"auto"},"& .cm-minimap-gutter":{borderRight:0,flexShrink:0,left:"unset",position:"sticky",right:0,top:0},"& .cm-minimap-inner":{height:"100%",position:"absolute",right:0,top:0,overflowY:"hidden","& canvas":{display:"block"}},"& .cm-minimap-box-shadow":{boxShadow:"12px 0px 20px 5px #6c6c6c"}}),AN=6,dae=Gu.fromClass(class{constructor(e){this.view=e,this.text=oae(e),this.selection=iae(e),this.diagnostic=nae(e),e.state.facet(Hl)&&this.create(e)}create(e){const t=e.state.facet(Hl);if(!t)throw Error("Expected nonnull");this.inner=Co("div",{class:"cm-minimap-inner"}),this.canvas=Co("canvas"),this.dom=t.create(e).dom,this.dom.classList.add("cm-gutters"),this.dom.classList.add("cm-minimap-gutter"),this.inner.appendChild(this.canvas),this.dom.appendChild(this.inner),this.view.scrollDOM.insertBefore(this.dom,this.view.contentDOM.nextSibling);for(const r in this.view.state.facet(nn).eventHandlers){const n=this.view.state.facet(nn).eventHandlers[r];n&&this.dom.addEventListener(r,a=>n(a,this.view))}}remove(){this.dom&&this.dom.remove()}update(e){const t=e.startState.facet(Hl),r=e.state.facet(Hl);if(t&&!r){this.remove();return}!t&&r&&this.create(e.view),r&&(this.text.update(e),this.selection.update(e),this.diagnostic.update(e),this.render())}getWidth(){const e=this.view.dom.clientWidth;if(e<=En.MaxWidth*AN){const t=e/(En.MaxWidth*AN);return En.MaxWidth*t}return En.MaxWidth}render(){if(!this.dom||!this.canvas||!this.inner)return;this.text.beforeDraw(),this.updateBoxShadow(),this.dom.style.width=this.getWidth()+"px",this.canvas.style.maxWidth=this.getWidth()+"px",this.canvas.width=this.getWidth()*En.PixelMultiplier;const e=this.view.dom.getBoundingClientRect().height;this.inner.style.minHeight=e+"px",this.canvas.height=e*En.PixelMultiplier,this.canvas.style.height=e+"px";const t=this.canvas.getContext("2d");if(!t)return;t.clearRect(0,0,this.canvas.width,this.canvas.height);const{charWidth:r,lineHeight:n}=this.text.measure(t);let{startIndex:a,endIndex:s,offsetY:o}=this.canvasStartAndEndIndex(t,n);const l=this.view.state.facet(nn).gutters;for(let c=a;c<s;c++){const d=this.view.state.field(Ho);if(c>=d.length)break;const u={offsetX:0,offsetY:o,context:t,lineHeight:n,charWidth:r};if(l.length){u.offsetX+=2;for(let p of l)lae(p,u,c+1),u.offsetX+=b6;u.offsetX+=2}this.text.drawLine(u,c+1),this.selection.drawLine(u,c+1),this.diagnostic.drawLine(u,c+1),o+=n}t.restore()}canvasStartAndEndIndex(e,t){let{top:r,bottom:n}=this.view.documentPadding;r/=En.SizeRatio,n/=En.SizeRatio;const a=e.canvas.height,{clientHeight:s,scrollHeight:o,scrollTop:l}=this.view.scrollDOM;let c=l/(o-s);isNaN(c)&&(c=0);const d=this.view.state.field(Ho).length,u=r+n+d*t,p=Math.max(0,c*(u-a)),f=Math.max(0,r-p),h=Math.round(Math.max(0,p-r)/t),g=Math.round((a-f)/t);return{startIndex:h,endIndex:h+g,offsetY:f}}updateBoxShadow(){if(!this.canvas)return;const{clientWidth:e,scrollWidth:t,scrollLeft:r}=this.view.scrollDOM;e+r<t?this.canvas.classList.add("cm-minimap-box-shadow"):this.canvas.classList.remove("cm-minimap-box-shadow")}destroy(){this.remove()}},{eventHandlers:{scroll(){requestAnimationFrame(()=>this.render())}},provide:e=>Jn.scrollMargins.of(t=>{var r;const n=(r=t.plugin(e))===null||r===void 0?void 0:r.getWidth();return n?{right:n}:null})}),Hl=Hu.define({combine:e=>{var t;return(t=e.find(r=>r!==null))!==null&&t!==void 0?t:null},enables:e=>[[nn.compute([e],t=>t.facet(e)),cae,Ho,dae,tae]]}),jN=q6.define({token(e){return e.match(/^#.*/)?"comment":e.sol()&&e.match(/^[A-Za-z_][A-Za-z0-9_.]*(?==)/)?"variableName.definition":e.match(/^=/)?"operator":e.match(/^"(?:[^"\\]|\\.)*"?/)||e.match(/^'(?:[^'\\]|\\.)*'?/)?"string":e.match(/^\$\{[^}]*\}?/)||e.match(/^\$[A-Za-z_][A-Za-z0-9_]*/)?"variableName.special":e.match(/^\d+/)?"number":(e.next(),null)}}),uae=e=>{const t=e.toLowerCase();if(t===".env"||t.startsWith(".env."))return[jN];const r=e.split(".").pop()?.toLowerCase();switch(r){case"js":case"jsx":case"ts":case"tsx":return[J6({jsx:!0,typescript:r.includes("ts")})];case"py":return[X6()];case"html":case"htm":return[Z6()];case"css":case"scss":case"less":return[Y6()];case"json":return[qN()];case"md":case"markdown":return[K6()];case"env":return[jN];default:return[]}},pae=({file:e,showDiff:t,minimapEnabled:r,isDarkMode:n})=>{if(!e.diffInfo||!t||!r)return[];const a={};return[Hl.compute(["doc"],s=>{const l=Cw(s)?.chunks||[];return Object.keys(a).forEach(c=>{delete a[Number(c)]}),l.forEach(c=>{const d=s.doc.lineAt(c.fromB).number,u=s.doc.lineAt(Math.min(c.toB,s.doc.length)).number;for(let p=d;p<=u;p+=1)a[p]=n?"rgba(34, 197, 94, 0.8)":"rgba(34, 197, 94, 1)"}),{create:()=>({dom:document.createElement("div")}),displayText:"blocks",showOverlay:"always",gutters:[a]}})]},mae=({file:e,showDiff:t})=>!e.diffInfo||!t?[]:[Gu.fromClass(class{constructor(r){setTimeout(()=>{const a=Cw(r.state)?.chunks?.[0];a&&r.dispatch({effects:Jn.scrollIntoView(a.fromB,{y:"center"})})},100)}update(){}destroy(){}})],hae=e=>`
678
678
  .code-editor-loading {
679
679
  background-color: ${e?"#111827":"#ffffff"} !important;
680
680
  }
@@ -682,7 +682,7 @@ Build and smoke checks pass`}),[N,E]=m.useState(""),[I,A]=m.useState({title:"",n
682
682
  .code-editor-loading:hover {
683
683
  background-color: ${e?"#111827":"#ffffff"} !important;
684
684
  }
685
- `,_ae=e=>`
685
+ `,fae=e=>`
686
686
  .cm-editor {
687
687
  background-color: ${e?"#111827":"#ffffff"} !important;
688
688
  color: ${e?"#e5e7eb":"#111827"} !important;
@@ -762,7 +762,7 @@ Build and smoke checks pass`}),[N,E]=m.useState(""),[I,A]=m.useState({title:"",n
762
762
  opacity: 0.5;
763
763
  cursor: not-allowed;
764
764
  }
765
- `,Pae=e=>e?'<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M13.875 18.825A10.05 10.05 0 0112 19c-4.478 0-8.268-2.943-9.543-7a9.97 9.97 0 011.563-3.029m5.858.908a3 3 0 114.243 4.243M9.878 9.878l4.242 4.242M9.88 9.88l-3.29-3.29m7.532 7.532l3.29 3.29M3 3l3.59 3.59m0 0A9.953 9.953 0 0112 5c4.478 0 8.268 2.943 9.543 7a10.025 10.025 0 01-4.132 5.411m0 0L21 21" />':'<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15 12a3 3 0 11-6 0 3 3 0 016 0z" /><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M2.458 12C3.732 7.943 7.523 5 12 5c4.478 0 8.268 2.943 9.542 7-1.274 4.057-5.064 7-9.542 7-4.477 0-8.268-2.943-9.542-7z" />',Lae=e=>e?'<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 9V4.5M9 9H4.5M9 9L3.75 3.75M9 15v4.5M9 15H4.5M9 15l-5.25 5.25M15 9h4.5M15 9V4.5M15 9l5.25-5.25M15 15h4.5M15 15v4.5m0-4.5l5.25 5.25" />':'<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 8V4m0 0h4M4 4l5 5m11-1V4m0 0h-4m4 0l-5 5M4 16v4m0 0h4m-4 0l5-5m11 5l-5-5m5 5v-4m0 4h-4" />',ts=e=>e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;"),Dae=({file:e,showDiff:t,isSidebar:r,isExpanded:n,onToggleDiff:a,onPopOut:s,onToggleExpand:o,labels:l})=>{if(!!!(e.diffInfo||r&&s||r&&o))return[];const d=u=>{const p=document.createElement("div");p.className="cm-editor-toolbar-panel";let f=0;const h=()=>{const g=!!(e.diffInfo&&t),x=(g?Cw(u.state):null)?.chunks||[],y=x.length,v=Math.max(0,y-1);f=Math.max(0,Math.min(f,v));const w={changes:ts(l.changes),previousChange:ts(l.previousChange),nextChange:ts(l.nextChange),hideDiff:ts(l.hideDiff),showDiff:ts(l.showDiff),collapse:ts(l.collapse),expand:ts(l.expand)},k=Pae(t),S=Lae(n);let N='<div style="display: flex; align-items: center; justify-content: space-between; width: 100%;">';if(N+='<div style="display: flex; align-items: center; gap: 8px;">',g&&(N+=`
765
+ `,gae=e=>e?'<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M13.875 18.825A10.05 10.05 0 0112 19c-4.478 0-8.268-2.943-9.543-7a9.97 9.97 0 011.563-3.029m5.858.908a3 3 0 114.243 4.243M9.878 9.878l4.242 4.242M9.88 9.88l-3.29-3.29m7.532 7.532l3.29 3.29M3 3l3.59 3.59m0 0A9.953 9.953 0 0112 5c4.478 0 8.268 2.943 9.543 7a10.025 10.025 0 01-4.132 5.411m0 0L21 21" />':'<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15 12a3 3 0 11-6 0 3 3 0 016 0z" /><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M2.458 12C3.732 7.943 7.523 5 12 5c4.478 0 8.268 2.943 9.542 7-1.274 4.057-5.064 7-9.542 7-4.477 0-8.268-2.943-9.542-7z" />',bae=e=>e?'<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 9V4.5M9 9H4.5M9 9L3.75 3.75M9 15v4.5M9 15H4.5M9 15l-5.25 5.25M15 9h4.5M15 9V4.5M15 9l5.25-5.25M15 15h4.5M15 15v4.5m0-4.5l5.25 5.25" />':'<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 8V4m0 0h4M4 4l5 5m11-1V4m0 0h-4m4 0l-5 5M4 16v4m0 0h4m-4 0l5-5m11 5l-5-5m5 5v-4m0 4h-4" />',ts=e=>e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;"),xae=({file:e,showDiff:t,isSidebar:r,isExpanded:n,onToggleDiff:a,onPopOut:s,onToggleExpand:o,labels:l})=>{if(!!!(e.diffInfo||r&&s||r&&o))return[];const d=u=>{const p=document.createElement("div");p.className="cm-editor-toolbar-panel";let f=0;const h=()=>{const g=!!(e.diffInfo&&t),x=(g?Cw(u.state):null)?.chunks||[],y=x.length,v=Math.max(0,y-1);f=Math.max(0,Math.min(f,v));const w={changes:ts(l.changes),previousChange:ts(l.previousChange),nextChange:ts(l.nextChange),hideDiff:ts(l.hideDiff),showDiff:ts(l.showDiff),collapse:ts(l.collapse),expand:ts(l.expand)},k=gae(t),S=bae(n);let N='<div style="display: flex; align-items: center; justify-content: space-between; width: 100%;">';if(N+='<div style="display: flex; align-items: center; gap: 8px;">',g&&(N+=`
766
766
  <span style="font-weight: 500;">${y>0?`${f+1}/${y}`:"0"} ${w.changes}</span>
767
767
  <button class="cm-diff-nav-btn cm-diff-nav-prev" title="${w.previousChange}" ${y===0?"disabled":""}>
768
768
  <svg width="16" height="16" fill="none" stroke="currentColor" viewBox="0 0 24 24">
@@ -792,10 +792,10 @@ Build and smoke checks pass`}),[N,E]=m.useState(""),[I,A]=m.useState({title:"",n
792
792
  ${S}
793
793
  </svg>
794
794
  </button>
795
- `),N+="</div>",N+="</div>",p.innerHTML=N,g){const T=p.querySelector(".cm-diff-nav-prev"),_=p.querySelector(".cm-diff-nav-next");T?.addEventListener("click",()=>{if(x.length===0)return;f=f>0?f-1:x.length-1;const j=x[f];j&&u.dispatch({effects:Jn.scrollIntoView(j.fromB,{y:"center"})}),h()}),_?.addEventListener("click",()=>{if(x.length===0)return;f=f<x.length-1?f+1:0;const j=x[f];j&&u.dispatch({effects:Jn.scrollIntoView(j.fromB,{y:"center"})}),h()})}p.querySelector(".cm-toggle-diff-btn")?.addEventListener("click",a),p.querySelector(".cm-popout-btn")?.addEventListener("click",()=>{s?.()}),p.querySelector(".cm-expand-btn")?.addEventListener("click",()=>{o?.()})};return h(),{top:!0,dom:p,update:h}};return[Q6.of(d)]};function Oae({content:e,linesLabel:t,charactersLabel:r,shortcutsLabel:n}){return i.jsxs("div",{className:"flex flex-shrink-0 items-center justify-between border-t border-border bg-muted px-3 py-1.5",children:[i.jsxs("div",{className:"flex items-center gap-3 text-xs text-gray-600 dark:text-gray-400",children:[i.jsxs("span",{children:[t," ",e.split(`
796
- `).length]}),i.jsxs("span",{children:[r," ",e.length]})]}),i.jsx("div",{className:"text-xs text-gray-500 dark:text-gray-400",children:n})]})}function Mae({file:e,isSidebar:t,isFullscreen:r,isMarkdownFile:n,markdownPreview:a,saving:s,saveSuccess:o,onToggleMarkdownPreview:l,onOpenSettings:c,onDownload:d,onSave:u,onToggleFullscreen:p,onClose:f,labels:h}){const g=o?h.saved:s?h.saving:h.save;return i.jsxs("div",{className:"flex min-w-0 flex-shrink-0 items-center justify-between gap-2 border-b border-border px-3 py-1.5",children:[i.jsx("div",{className:"flex min-w-0 flex-1 shrink items-center gap-2",children:i.jsxs("div",{className:"min-w-0 shrink",children:[i.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[i.jsx("h3",{className:"truncate text-sm font-medium text-gray-900 dark:text-white",children:e.name}),e.diffInfo&&i.jsx("span",{className:"shrink-0 whitespace-nowrap rounded bg-blue-100 px-1.5 py-0.5 text-[10px] text-blue-600 dark:bg-blue-900 dark:text-blue-300",children:h.showingChanges})]}),i.jsx("p",{className:"truncate text-xs text-gray-500 dark:text-gray-400",children:e.path})]})}),i.jsxs("div",{className:"flex shrink-0 items-center gap-0.5",children:[n&&i.jsx("button",{type:"button",onClick:l,className:`flex items-center justify-center rounded-md p-1.5 transition-colors ${a?"bg-blue-50 text-blue-600 dark:bg-blue-900/30 dark:text-blue-400":"text-gray-600 hover:bg-gray-100 hover:text-gray-900 dark:text-gray-400 dark:hover:bg-gray-800 dark:hover:text-white"}`,title:a?h.editMarkdown:h.previewMarkdown,children:a?i.jsx(us,{className:"h-4 w-4"}):i.jsx(Ec,{className:"h-4 w-4"})}),i.jsx("button",{type:"button",onClick:c,className:"flex items-center justify-center rounded-md p-1.5 text-gray-600 hover:bg-gray-100 hover:text-gray-900 dark:text-gray-400 dark:hover:bg-gray-800 dark:hover:text-white",title:h.settings,children:i.jsx(Ht,{className:"h-4 w-4"})}),i.jsx("button",{type:"button",onClick:d,className:"flex items-center justify-center rounded-md p-1.5 text-gray-600 hover:bg-gray-100 hover:text-gray-900 dark:text-gray-400 dark:hover:bg-gray-800 dark:hover:text-white",title:h.download,children:i.jsx(zn,{className:"h-4 w-4"})}),i.jsx("button",{type:"button",onClick:u,disabled:s,className:`flex items-center justify-center rounded-md p-1.5 transition-colors disabled:opacity-50 ${o?"bg-green-50 text-green-600 dark:bg-green-900/30 dark:text-green-400":"text-gray-600 hover:bg-gray-100 hover:text-gray-900 dark:text-gray-400 dark:hover:bg-gray-800 dark:hover:text-white"}`,title:g,children:o?i.jsx("svg",{className:"h-4 w-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})}):i.jsx(_D,{className:"h-4 w-4"})}),!t&&i.jsx("button",{type:"button",onClick:p,className:"flex items-center justify-center rounded-md p-1.5 text-gray-600 hover:bg-gray-100 hover:text-gray-900 dark:text-gray-400 dark:hover:bg-gray-800 dark:hover:text-white",title:r?h.exitFullscreen:h.fullscreen,children:r?i.jsx(ED,{className:"h-4 w-4"}):i.jsx(Zu,{className:"h-4 w-4"})}),i.jsx("button",{type:"button",onClick:f,className:"flex items-center justify-center rounded-md p-1.5 text-gray-600 hover:bg-gray-100 hover:text-gray-900 dark:text-gray-400 dark:hover:bg-gray-800 dark:hover:text-white",title:h.close,children:i.jsx(Ct,{className:"h-4 w-4"})})]})]})}function Fae({isDarkMode:e,isSidebar:t,loadingText:r}){return i.jsxs(i.Fragment,{children:[i.jsx("style",{children:Rae(e)}),t?i.jsx("div",{className:"flex h-full w-full items-center justify-center bg-background",children:i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsx("div",{className:"h-6 w-6 animate-spin rounded-full border-b-2 border-blue-600"}),i.jsx("span",{className:"text-gray-900 dark:text-white",children:r})]})}):i.jsx("div",{className:"fixed inset-0 z-[9999] md:flex md:items-center md:justify-center md:bg-black/50",children:i.jsx("div",{className:"code-editor-loading flex h-full w-full items-center justify-center p-8 md:h-auto md:w-auto md:rounded-lg",children:i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsx("div",{className:"h-6 w-6 animate-spin rounded-full border-b-2 border-blue-600"}),i.jsx("span",{className:"text-gray-900 dark:text-white",children:r})]})})})]})}const zae=m.createContext(null),Jh={didCatch:!1,error:null};let y6=class extends m.Component{constructor(t){super(t),this.resetErrorBoundary=this.resetErrorBoundary.bind(this),this.state=Jh}static getDerivedStateFromError(t){return{didCatch:!0,error:t}}resetErrorBoundary(){const{error:t}=this.state;if(t!==null){for(var r,n,a=arguments.length,s=new Array(a),o=0;o<a;o++)s[o]=arguments[o];(r=(n=this.props).onReset)===null||r===void 0||r.call(n,{args:s,reason:"imperative-api"}),this.setState(Jh)}}componentDidCatch(t,r){var n,a;(n=(a=this.props).onError)===null||n===void 0||n.call(a,t,r)}componentDidUpdate(t,r){const{didCatch:n}=this.state,{resetKeys:a}=this.props;if(n&&r.error!==null&&Bae(t.resetKeys,a)){var s,o;(s=(o=this.props).onReset)===null||s===void 0||s.call(o,{next:a,prev:t.resetKeys,reason:"keys"}),this.setState(Jh)}}render(){const{children:t,fallbackRender:r,FallbackComponent:n,fallback:a}=this.props,{didCatch:s,error:o}=this.state;let l=t;if(s){const c={error:o,resetErrorBoundary:this.resetErrorBoundary};if(typeof r=="function")l=r(c);else if(n)l=m.createElement(n,c);else if(a!==void 0)l=a;else throw o}return m.createElement(zae.Provider,{value:{didCatch:s,error:o,resetErrorBoundary:this.resetErrorBoundary}},l)}};function Bae(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[];return e.length!==t.length||e.some((r,n)=>!Object.is(r,t[n]))}function Uae({inline:e,className:t,children:r,node:n,...a}){const[s,o]=m.useState(!1),l=Array.isArray(r)?r.join(""):String(r??""),c=/[\r\n]/.test(l);if(e||!c)return i.jsx("code",{className:`whitespace-pre-wrap break-words rounded-md border border-gray-200 bg-gray-100 px-1.5 py-0.5 font-mono text-[0.9em] text-gray-900 dark:border-gray-700 dark:bg-gray-800/60 dark:text-gray-100 ${t||""}`,...a,children:r});const u=/language-(\w+)/.exec(t||""),p=u?u[1]:"text";return i.jsxs("div",{className:"group relative my-2",children:[p!=="text"&&i.jsx("div",{className:"absolute left-3 top-2 z-10 text-xs font-medium uppercase text-gray-400",children:p}),i.jsx("button",{type:"button",onClick:()=>la(l).then(f=>{f&&(o(!0),setTimeout(()=>o(!1),2e3))}),className:"absolute right-2 top-2 z-10 rounded-md border border-gray-600 bg-gray-700/80 px-2 py-1 text-xs text-white opacity-0 transition-opacity hover:bg-gray-700 group-hover:opacity-100",children:s?"Copied!":"Copy"}),i.jsx(xw,{language:p,style:wI,customStyle:{margin:0,borderRadius:"0.5rem",fontSize:"0.875rem",padding:p!=="text"?"2rem 1rem 1rem 1rem":"1rem"},children:l})]})}const $ae={code:Uae,blockquote:({children:e})=>i.jsx("blockquote",{className:"my-2 border-l-4 border-gray-300 pl-4 italic text-gray-600 dark:border-gray-600 dark:text-gray-400",children:e}),a:({href:e,children:t})=>i.jsx("a",{href:e,className:"text-blue-600 hover:underline dark:text-blue-400",target:"_blank",rel:"noopener noreferrer",children:t}),table:({children:e})=>i.jsx("div",{className:"my-2 overflow-x-auto",children:i.jsx("table",{className:"min-w-full border-collapse border border-gray-200 dark:border-gray-700",children:e})}),thead:({children:e})=>i.jsx("thead",{className:"bg-gray-50 dark:bg-gray-800",children:e}),th:({children:e})=>i.jsx("th",{className:"border border-gray-200 px-3 py-2 text-left text-sm font-semibold dark:border-gray-700",children:e}),td:({children:e})=>i.jsx("td",{className:"border border-gray-200 px-3 py-2 align-top text-sm dark:border-gray-700",children:e})};function Hae({content:e}){const t=m.useMemo(()=>[aj,tI],[]),r=m.useMemo(()=>[dI],[]);return i.jsx(PA,{remarkPlugins:t,rehypePlugins:r,components:$ae,children:e})}const Gae=m.lazy(async()=>{const[e,{ensureLocalMonaco:t}]=await Promise.all([vC(()=>import("./index-ak1p_4ew.js"),__vite__mapDeps([0,1])),vC(()=>import("./localMonaco-DFIbtDNp.js"),__vite__mapDeps([2,0,1]))]);return t(),await e.loader.init(),{default:e.Editor}});function _N(){return i.jsx("div",{className:"flex h-full w-full items-center justify-center bg-white text-sm text-gray-500 dark:bg-gray-900 dark:text-gray-400",children:"Loading editor…"})}const Vae=Jn.theme({"&":{backgroundColor:"#ffffff",color:"#111827"},".cm-scroller":{backgroundColor:"#ffffff"},".cm-content":{caretColor:"#111827"},".cm-cursor, .cm-dropCursor":{borderLeftColor:"#111827"},"&.cm-focused .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection":{backgroundColor:"#bfdbfe"},".cm-gutters":{backgroundColor:"#f8fafc",borderRightColor:"#e5e7eb",color:"#64748b"},".cm-activeLine":{backgroundColor:"#f8fafc"},".cm-activeLineGutter":{backgroundColor:"#eef2ff"},".cm-panels":{backgroundColor:"#ffffff",color:"#111827"},".cm-panels.cm-panels-top":{borderBottomColor:"#e5e7eb"}},{dark:!1});function Wae(e){const t=e.toLowerCase();if(t===".env"||t.startsWith(".env."))return"ini";switch(t.split(".").pop()){case"js":case"jsx":return"javascript";case"ts":case"tsx":return"typescript";case"py":return"python";case"html":case"htm":return"html";case"css":case"scss":case"less":return"css";case"json":return"json";case"md":case"markdown":return"markdown";default:return"plaintext"}}function qae(e,t){return`file:///${(e||t).replace(/\\/g,"/").replace(/^\/+/,"").split("/").filter(Boolean).map(a=>encodeURIComponent(a)).join("/")||encodeURIComponent(t)}`}function Kae({content:e,onChange:t,onSave:r,markdownPreview:n,isMarkdownFile:a,isDarkMode:s,fontSize:o,showLineNumbers:l,wordWrap:c,extensions:d,fileName:u,filePath:p,useMonacoEditor:f}){const h=m.useRef(r);m.useEffect(()=>{h.current=r},[r]);const g=m.useCallback((y,v)=>{const{KeyCode:w,KeyMod:k}=v;y.addCommand(k.CtrlCmd|w.KeyS,()=>{h.current()}),y.focus()},[]),b=m.useMemo(()=>({automaticLayout:!0,contextmenu:!0,copyWithSyntaxHighlighting:!0,cursorBlinking:"blink",folding:!0,fontLigatures:!1,fontSize:o,glyphMargin:!1,lineNumbers:l?"on":"off",minimap:{enabled:!1},mouseWheelZoom:!0,multiCursorModifier:"alt",renderLineHighlight:"all",roundedSelection:!1,scrollBeyondLastLine:!1,selectOnLineNumbers:!0,selectionClipboard:!0,tabCompletion:"on",wordWrap:c?"on":"off"}),[o,l,c]);if(n&&a)return i.jsx("div",{className:"h-full overflow-y-auto bg-white dark:bg-gray-900",children:i.jsx("div",{className:"prose prose-sm mx-auto max-w-none px-8 py-6 dark:prose-invert prose-headings:font-semibold prose-a:text-blue-600 prose-code:text-sm prose-pre:bg-gray-900 prose-img:rounded-lg dark:prose-a:text-blue-400",children:i.jsx(Hae,{content:e})})});const x=i.jsx(KN,{value:e,onChange:t,extensions:d,theme:s?YN:Vae,height:"100%",style:{fontSize:`${o}px`,height:"100%"},basicSetup:{lineNumbers:l,foldGutter:!0,dropCursor:!1,allowMultipleSelections:!1,indentOnInput:!0,bracketMatching:!0,closeBrackets:!0,autocompletion:!0,highlightSelectionMatches:!0,searchKeymap:!0}});return f?i.jsx("div",{className:"h-full min-h-0 w-full overflow-hidden",children:i.jsx(y6,{fallback:x,onError:y=>{console.error("Monaco editor failed to load; falling back to CodeMirror:",y)},children:i.jsx(m.Suspense,{fallback:i.jsx(_N,{}),children:i.jsx(Gae,{value:e,onChange:y=>t(y??""),language:Wae(u),path:qae(p,u),theme:s?"vs-dark":"light",height:"100%",width:"100%",options:b,onMount:g,loading:i.jsx(_N,{})})})})}):x}function Yae({file:e,isSidebar:t,isFullscreen:r,onClose:n,onToggleFullscreen:a,title:s,message:o}){const l=i.jsx("div",{className:"flex h-full w-full flex-col items-center justify-center bg-background p-8 text-muted-foreground",children:i.jsxs("div",{className:"flex max-w-md flex-col items-center gap-4 text-center",children:[i.jsx("div",{className:"flex h-16 w-16 items-center justify-center rounded-full bg-muted",children:i.jsx("svg",{className:"h-8 w-8 text-muted-foreground",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.5,d:"M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z"})})}),i.jsxs("div",{children:[i.jsx("h3",{className:"mb-2 text-lg font-medium text-foreground",children:s}),i.jsx("p",{className:"text-sm text-muted-foreground",children:o})]}),i.jsx("button",{onClick:n,className:"mt-4 rounded-md bg-primary px-4 py-2 text-sm text-primary-foreground transition-colors hover:bg-primary/90",children:"Close"})]})});if(t)return i.jsxs("div",{className:"flex h-full w-full flex-col bg-background",children:[i.jsxs("div",{className:"flex flex-shrink-0 items-center justify-between border-b border-border px-3 py-1.5",children:[i.jsx("div",{className:"flex min-w-0 flex-1 items-center gap-2",children:i.jsx("h3",{className:"truncate text-sm font-medium text-gray-900 dark:text-white",children:e.name})}),i.jsx("button",{type:"button",onClick:n,className:"flex items-center justify-center rounded-md p-1.5 text-gray-600 hover:bg-gray-100 hover:text-gray-900 dark:text-gray-400 dark:hover:bg-gray-800 dark:hover:text-white",title:"Close",children:i.jsx("svg",{className:"h-4 w-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),l]});const c=r?"fixed inset-0 z-[9999] bg-background flex flex-col":"fixed inset-0 z-[9999] md:bg-black/50 md:flex md:items-center md:justify-center md:p-4",d=r?"bg-background flex flex-col w-full h-full":"bg-background shadow-2xl flex flex-col w-full h-full md:rounded-lg md:shadow-2xl md:w-full md:max-w-2xl md:h-auto md:max-h-[60vh]";return i.jsx("div",{className:c,children:i.jsxs("div",{className:d,children:[i.jsxs("div",{className:"flex flex-shrink-0 items-center justify-between border-b border-border px-3 py-1.5",children:[i.jsx("div",{className:"flex min-w-0 flex-1 items-center gap-2",children:i.jsx("h3",{className:"truncate text-sm font-medium text-gray-900 dark:text-white",children:e.name})}),i.jsxs("div",{className:"flex shrink-0 items-center gap-0.5",children:[i.jsx("button",{type:"button",onClick:a,className:"flex items-center justify-center rounded-md p-1.5 text-gray-600 hover:bg-gray-100 hover:text-gray-900 dark:text-gray-400 dark:hover:bg-gray-800 dark:hover:text-white",title:r?"Exit fullscreen":"Fullscreen",children:r?i.jsx("svg",{className:"h-4 w-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 9V4.5M9 9H4.5M9 9L3.5 3.5M9 15v4.5M9 15H4.5M9 15l-5.5 5.5M15 9h4.5M15 9V4.5M15 9l5.5-5.5M15 15h4.5M15 15v4.5m0-4.5l5.5 5.5"})}):i.jsx("svg",{className:"h-4 w-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 8V4m0 0h4M4 4l5 5m11-1V4m0 0h-4m4 0l-5 5M4 16v4m0 0h4m-4 0l5-5m11 5l-5-5m5 5v-4m0 4h-4"})})}),i.jsx("button",{type:"button",onClick:n,className:"flex items-center justify-center rounded-md p-1.5 text-gray-600 hover:bg-gray-100 hover:text-gray-900 dark:text-gray-400 dark:hover:bg-gray-800 dark:hover:text-white",title:"Close",children:i.jsx("svg",{className:"h-4 w-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]})]}),l]})})}function tc({file:e,onClose:t,projectPath:r,isSidebar:n=!1,isExpanded:a=!1,onToggleExpand:s=null,onPopOut:o=null}){const{t:l}=He("codeEditor"),[c,d]=m.useState(!1),[u,p]=m.useState(!!e.diffInfo),[f,h]=m.useState(!1),{isDarkMode:g,wordWrap:b,minimapEnabled:x,showLineNumbers:y,fontSize:v}=mae(),{content:w,setContent:k,loading:S,saving:N,saveSuccess:E,saveError:I,isBinary:A,handleSave:T,handleDownload:_}=uae({file:e,projectPath:r}),j=m.useMemo(()=>{const L=e.name.split(".").pop()?.toLowerCase();return L==="md"||L==="markdown"},[e.name]),R=m.useMemo(()=>jae({file:e,showDiff:u,minimapEnabled:x,isDarkMode:g}),[e,g,x,u]),C=m.useMemo(()=>Iae({file:e,showDiff:u}),[e,u]),D=m.useMemo(()=>Dae({file:e,showDiff:u,isSidebar:n,isExpanded:a,onToggleDiff:()=>p(L=>!L),onPopOut:o,onToggleExpand:s,labels:{changes:l("toolbar.changes"),previousChange:l("toolbar.previousChange"),nextChange:l("toolbar.nextChange"),hideDiff:l("toolbar.hideDiff"),showDiff:l("toolbar.showDiff"),collapse:l("toolbar.collapse"),expand:l("toolbar.expand")}}),[e,a,n,o,s,u,l]),B=m.useMemo(()=>{const L=[...Aae(e.name),...D];return e.diffInfo&&u&&e.diffInfo.old_string!==void 0&&(L.push(eae({original:e.diffInfo.old_string,mergeControls:!1,highlightChanges:!0,syntaxHighlightDeletions:!1,gutter:!0})),L.push(...R),L.push(...C)),b&&L.push(Jn.lineWrapping),L},[e.diffInfo,e.name,R,C,u,D,b]),F=!(e.diffInfo&&e.diffInfo.old_string!==void 0);if(hae({onSave:T,onClose:t,dependency:w}),S)return i.jsx(Fae,{isDarkMode:g,isSidebar:n,loadingText:l("loading",{fileName:e.name})});if(A)return i.jsx(Yae,{file:e,isSidebar:n,isFullscreen:c,onClose:t,onToggleFullscreen:()=>d(L=>!L),title:l("binaryFile.title","Binary File"),message:l("binaryFile.message",'The file "{{fileName}}" cannot be displayed in the text editor because it is a binary file.',{fileName:e.name})});const V=n?"w-full h-full flex flex-col":`fixed inset-0 z-[9999] md:bg-black/50 md:flex md:items-center md:justify-center md:p-4 ${c?"md:p-0":""}`,K=n?"bg-background flex flex-col w-full h-full":`bg-background shadow-2xl flex flex-col w-full h-full md:rounded-lg md:shadow-2xl${c?" md:w-full md:h-full md:rounded-none":" md:w-full md:max-w-6xl md:h-[80vh] md:max-h-[80vh]"}`;return i.jsxs(i.Fragment,{children:[i.jsx("style",{children:_ae(g)}),i.jsx("div",{className:V,children:i.jsxs("div",{className:K,children:[i.jsx(Mae,{file:e,isSidebar:n,isFullscreen:c,isMarkdownFile:j,markdownPreview:f,saving:N,saveSuccess:E,onToggleMarkdownPreview:()=>h(L=>!L),onOpenSettings:()=>window.openSettings?.("appearance"),onDownload:_,onSave:T,onToggleFullscreen:()=>d(L=>!L),onClose:t,labels:{showingChanges:l("header.showingChanges"),editMarkdown:l("actions.editMarkdown"),previewMarkdown:l("actions.previewMarkdown"),settings:l("toolbar.settings"),download:l("actions.download"),save:l("actions.save"),saving:l("actions.saving"),saved:l("actions.saved"),fullscreen:l("actions.fullscreen"),exitFullscreen:l("actions.exitFullscreen"),close:l("actions.close")}}),I&&i.jsx("div",{className:"border-b border-red-200 bg-red-50 px-3 py-1.5 text-xs text-red-700 dark:border-red-900/40 dark:bg-red-900/20 dark:text-red-300",children:I}),i.jsx("div",{className:"flex-1 overflow-hidden",children:i.jsx(Kae,{content:w,onChange:k,onSave:T,markdownPreview:f,isMarkdownFile:j,isDarkMode:g,fontSize:v,showLineNumbers:y,wordWrap:b,extensions:B,fileName:e.name,filePath:e.path,useMonacoEditor:F})}),i.jsx(Oae,{content:w,linesLabel:l("footer.lines"),charactersLabel:l("footer.characters"),shortcutsLabel:l("footer.shortcuts")})]})})]})}const Zae=200,Qh=280;function PN({editingFile:e,isMobile:t,editorExpanded:r,editorWidth:n,hasManualWidth:a,resizeHandleRef:s,onResizeStart:o,onCloseEditor:l,onToggleEditorExpand:c,projectPath:d,fillSpace:u}){const[p,f]=m.useState(!1),h=m.useRef(null),[g,b]=m.useState(n);if(m.useEffect(()=>{if(!e||t||p)return;const y=()=>{if(!h.current)return;const k=h.current.parentElement;if(!k)return;const N=k.clientWidth-Zae;N<Qh?f(!0):n>N?b(N):b(n)};y(),window.addEventListener("resize",y);const v=new ResizeObserver(y),w=h.current?.parentElement;return w&&v.observe(w),()=>{window.removeEventListener("resize",y),v.disconnect()}},[e,t,p,n]),!e)return null;if(t||p)return i.jsx(tc,{file:e,onClose:()=>{f(!1),l()},projectPath:d,isSidebar:!1});const x=r||u&&!a;return i.jsxs("div",{ref:h,className:`flex h-full min-w-0 flex-shrink-0 ${x?"flex-1":""}`,children:[!r&&i.jsx("div",{ref:s,onMouseDown:o,className:"group relative w-1 flex-shrink-0 cursor-col-resize bg-gray-200 transition-colors hover:bg-blue-500 dark:bg-gray-700 dark:hover:bg-blue-600",title:"Drag to resize",children:i.jsx("div",{className:"absolute inset-y-0 left-1/2 w-1 -translate-x-1/2 bg-blue-500 opacity-0 transition-opacity group-hover:opacity-100 dark:bg-blue-600"})}),i.jsx("div",{className:`h-full overflow-hidden border-l border-gray-200 dark:border-gray-700 ${x?"min-w-0 flex-1":`min-w-[ flex-shrink-0${Qh}px]`}`,style:x?void 0:{width:`${g}px`,minWidth:`${Qh}px`},children:i.jsx(tc,{file:e,onClose:l,projectPath:d,isSidebar:!0,isExpanded:r,onToggleExpand:c,onPopOut:()=>f(!0)})})]})}function Xae(e){const t=m.useRef(!1),r=m.useCallback(s=>{s&&(s.preventDefault(),s.stopPropagation()),e()},[e]),n=m.useCallback(s=>{t.current=!0,r(s),window.setTimeout(()=>{t.current=!1},350)},[r]);return{handleMobileMenuClick:m.useCallback(s=>{if(t.current){s.preventDefault(),s.stopPropagation();return}r(s)},[r]),handleMobileMenuTouchEnd:n}}function v6({onMenuClick:e,compact:t=!1}){const{handleMobileMenuClick:r,handleMobileMenuTouchEnd:n}=Xae(e),a=t?"p-1.5 text-muted-foreground hover:text-foreground rounded-lg hover:bg-accent/60 pwa-menu-button":"p-1.5 text-muted-foreground hover:text-foreground rounded-lg hover:bg-accent/60 touch-manipulation active:scale-95 pwa-menu-button flex-shrink-0";return i.jsx("button",{onClick:r,onTouchEnd:n,className:a,"aria-label":"Open menu",children:i.jsx("svg",{className:"h-5 w-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 6h16M4 12h16M4 18h16"})})})}const Jae=[{kind:"builtin",id:"chat",labelKey:"tabs.chat",icon:Un},{kind:"builtin",id:"orchestration",labelKey:"tabs.orchestration",icon:pr},{kind:"builtin",id:"remote",labelKey:"tabs.remote",icon:Ac},{kind:"builtin",id:"shell",labelKey:"tabs.shell",icon:Rr},{kind:"builtin",id:"files",labelKey:"tabs.files",icon:qr},{kind:"builtin",id:"git",labelKey:"tabs.git",icon:Kr},{kind:"builtin",id:"changes",labelKey:"tabs.changes",icon:ia},{kind:"builtin",id:"liveView",labelKey:"tabs.liveView",icon:xn}],Qae=new Set(["files","shell","git","changes","liveView"]);function eie({activeTab:e,setActiveTab:t,liveViewAvailable:r=!1,activeSidePanelTab:n,sidePanelMode:a="split",canUseSidePanelSplit:s=!0,isMobile:o=!1,onCloseSidePanel:l}){const{t:c}=He(),{plugins:d}=ep(),u=d.filter(f=>f.enabled).map(f=>({kind:"plugin",id:`plugin:${f.name}`,label:f.displayName,pluginName:f.name,iconFile:f.icon})),p=[...Jae,...u];return i.jsx(rp,{children:p.map(f=>{const h=f.id===e,g=f.kind==="builtin"?c(f.labelKey):f.label,b=!!(!o&&s&&h&&n===f.id&&Qae.has(f.id)),x=a==="split",v=b?`${g} · ${x?"Split":"Full"} view`:g;return i.jsxs("div",{className:"relative inline-flex items-center",children:[i.jsx(Nf,{content:v,position:"bottom",children:i.jsxs(np,{isActive:h,onClick:()=>t(f.id),className:b?"px-2 py-[5px] pr-7":"px-2.5 py-[5px]",children:[f.kind==="builtin"?i.jsx(f.icon,{className:"h-3.5 w-3.5"}):i.jsx(dT,{pluginName:f.pluginName,iconFile:f.iconFile,className:"flex h-3.5 w-3.5 items-center justify-center [&>svg]:h-full [&>svg]:w-full"}),i.jsx("span",{className:"hidden lg:inline",children:g}),f.id==="liveView"&&r&&i.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-emerald-500 shadow-[0_0_8px_rgba(16,185,129,0.75)]","aria-hidden":"true"}),b&&i.jsx("span",{className:`ml-0.5 inline-flex h-4 w-4 items-center justify-center rounded border ${x?"border-foreground/20 bg-foreground/5 text-foreground/70":"border-border bg-muted/60 text-muted-foreground"}`,"aria-hidden":"true",children:x?i.jsx(Qu,{className:"h-3 w-3"}):i.jsx(Zu,{className:"h-3 w-3"})})]})}),b&&l&&i.jsx(Nf,{content:c("tabs.closeSidePanel","Close side panel"),position:"bottom",children:i.jsx("button",{type:"button",className:"absolute right-1 top-1/2 flex h-4 w-4 -translate-y-1/2 items-center justify-center rounded text-muted-foreground transition-colors hover:bg-destructive/10 hover:text-destructive focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/40",onClick:w=>{w.stopPropagation(),l()},"aria-label":c("tabs.closeSidePanel","Close side panel"),title:c("tabs.closeSidePanel","Close side panel"),children:i.jsx(Ct,{className:"h-3 w-3"})})})]},f.id)})})}function tie(e,t,r){return e.startsWith("plugin:")&&r?r:e==="files"?t("mainContent.projectFiles"):e==="orchestration"?t("tabs.orchestration"):e==="remote"?t("tabs.remote"):e==="controlRoom"?t("tabs.controlRoom"):e==="git"?t("tabs.git"):e==="changes"?t("tabs.changes"):e==="liveView"?t("tabs.liveView"):"Project"}function rie(e){return e.__provider==="cursor"?e.name||"Untitled Session":e.summary||e.name||e.title||"New Session"}function nie({activeTab:e,selectedProject:t,selectedSession:r}){const{t:n}=He(),{plugins:a}=ep(),s=e.startsWith("plugin:")?a.find(d=>d.name===e.replace("plugin:",""))?.displayName:void 0,o=e==="chat"&&!!r,l=e==="chat"&&!r,c=t?.displayName||"Server";return i.jsxs("div",{className:"scrollbar-hide flex min-w-0 flex-1 items-center gap-2 overflow-x-auto",children:[o&&i.jsx("div",{className:"flex h-5 w-5 flex-shrink-0 items-center justify-center",children:i.jsx(er,{provider:r?.__provider,className:"h-4 w-4"})}),i.jsx("div",{className:"min-w-0 flex-1",children:e==="chat"&&r?i.jsxs("div",{className:"min-w-0",children:[i.jsx("h2",{className:"scrollbar-hide overflow-x-auto whitespace-nowrap text-sm font-semibold leading-tight text-foreground",children:rie(r)}),i.jsx("div",{className:"truncate text-[11px] leading-tight text-muted-foreground",children:c})]}):l?i.jsxs("div",{className:"min-w-0",children:[i.jsx("h2",{className:"text-base font-semibold leading-tight text-foreground",children:n("mainContent.newSession")}),i.jsx("div",{className:"truncate text-xs leading-tight text-muted-foreground",children:c})]}):i.jsxs("div",{className:"min-w-0",children:[i.jsx("h2",{className:"text-sm font-semibold leading-tight text-foreground",children:tie(e,n,s)}),i.jsx("div",{className:"truncate text-[11px] leading-tight text-muted-foreground",children:c})]})})]})}function LN({activeTab:e,setActiveTab:t,selectedProject:r,selectedSession:n,liveViewAvailable:a,activeSidePanelTab:s,sidePanelMode:o,canUseSidePanelSplit:l,isMobile:c,onMenuClick:d,onCloseSidePanel:u}){const p=m.useRef(null),[f,h]=m.useState(!1),[g,b]=m.useState(!1),x=m.useCallback(()=>{const y=p.current;y&&(h(y.scrollLeft>2),b(y.scrollLeft<y.scrollWidth-y.clientWidth-2))},[]);return m.useEffect(()=>{const y=p.current;if(!y)return;x();const v=new ResizeObserver(x);return v.observe(y),()=>v.disconnect()},[x]),i.jsx("div",{className:"pwa-header-safe flex-shrink-0 border-b border-border/60 bg-background px-3 py-1.5 sm:px-4 sm:py-2",children:i.jsxs("div",{className:"flex items-center justify-between gap-3",children:[i.jsxs("div",{className:"flex min-w-0 flex-1 items-center gap-2",children:[c&&i.jsx(v6,{onMenuClick:d}),i.jsx(nie,{activeTab:e,selectedProject:r,selectedSession:n})]}),e!=="controlRoom"&&i.jsxs("div",{className:"relative min-w-0 flex-shrink overflow-hidden sm:flex-shrink-0",children:[f&&i.jsx("div",{className:"pointer-events-none absolute inset-y-0 left-0 z-10 w-6 bg-gradient-to-r from-background to-transparent"}),i.jsxs("div",{className:"relative min-w-0 overflow-hidden",children:[i.jsx("div",{ref:p,onScroll:x,className:"scrollbar-hide overflow-x-auto",children:i.jsx(eie,{activeTab:e,setActiveTab:t,liveViewAvailable:a,activeSidePanelTab:s,sidePanelMode:o,canUseSidePanelSplit:l,isMobile:c,onCloseSidePanel:u})}),g&&i.jsx("div",{className:"pointer-events-none absolute inset-y-0 right-0 z-10 w-6 bg-gradient-to-l from-background to-transparent"})]})]})]})})}function Dg({mode:e,isMobile:t,onMenuClick:r,onQuickStartSession:n,onQuickStartOrchestration:a,onOpenControlRoom:s}){const{t:o}=He(),l=e==="loading";return i.jsxs("div",{className:"flex h-full flex-col",children:[t&&i.jsx("div",{className:"pwa-header-safe flex-shrink-0 border-b border-border/50 bg-background/80 p-2 backdrop-blur-sm sm:p-3",children:i.jsx(v6,{onMenuClick:r,compact:!0})}),l?i.jsx("div",{className:"flex flex-1 items-center justify-center",children:i.jsxs("div",{className:"text-center text-muted-foreground",children:[i.jsx("div",{className:"mx-auto mb-4 h-10 w-10",children:i.jsx("div",{className:"h-full w-full rounded-full border-[3px] border-muted border-t-primary",style:{animation:"spin 1s linear infinite",WebkitAnimation:"spin 1s linear infinite",MozAnimation:"spin 1s linear infinite"}})}),i.jsx("h2",{className:"mb-1 text-lg font-semibold text-foreground",children:o("mainContent.loading")}),i.jsx("p",{className:"text-sm",children:o("mainContent.settingUpWorkspace")})]})}):i.jsx("div",{className:"flex flex-1 items-center justify-center overflow-auto p-5",children:i.jsxs("div",{className:"w-full max-w-4xl",children:[i.jsxs("div",{className:"mb-6",children:[i.jsx("div",{className:"mb-4 flex h-12 w-12 items-center justify-center rounded-lg bg-muted/60",children:i.jsx(qr,{className:"h-6 w-6 text-muted-foreground"})}),i.jsx("h2",{className:"text-2xl font-semibold text-foreground",children:o("mainContent.landing.title")}),i.jsx("p",{className:"mt-2 max-w-2xl text-sm leading-6 text-muted-foreground",children:o("mainContent.landing.description")})]}),i.jsxs("div",{className:"grid grid-cols-[repeat(auto-fit,minmax(min(100%,11rem),1fr))] gap-3",children:[i.jsxs("button",{type:"button",onClick:s,className:"rounded-md border border-primary/40 bg-primary/10 p-4 text-left transition-colors hover:bg-primary/15 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/40",children:[i.jsx($n,{className:"mb-3 h-5 w-5 text-primary"}),i.jsx("div",{className:"text-sm font-semibold",children:o("mainContent.openControlRoom",{defaultValue:"Open Control Room"})}),i.jsx("p",{className:"mt-2 text-xs leading-5 text-muted-foreground",children:o("mainContent.openControlRoomDescription",{defaultValue:"See admin users, team access, production runs, secrets, audits, usage, and remote access in one place."})})]}),i.jsxs("button",{type:"button",onClick:()=>{a?.()},className:"rounded-md border border-primary/30 bg-primary/5 p-4 text-left transition-colors hover:bg-primary/10",children:[i.jsx(pr,{className:"mb-3 h-5 w-5 text-primary"}),i.jsx("div",{className:"text-sm font-semibold",children:o("mainContent.landing.startOrchestration")}),i.jsx("p",{className:"mt-2 text-xs leading-5 text-muted-foreground",children:o("mainContent.landing.startOrchestrationDescription")})]}),i.jsxs("button",{type:"button",onClick:()=>{n?.()},className:"rounded-md border border-border p-4 text-left transition-colors hover:bg-muted/40",children:[i.jsx($n,{className:"mb-3 h-5 w-5 text-foreground"}),i.jsx("div",{className:"text-sm font-semibold",children:o("mainContent.landing.startChat")}),i.jsx("p",{className:"mt-2 text-xs leading-5 text-muted-foreground",children:o("mainContent.landing.startChatDescription")})]}),i.jsxs("button",{type:"button",onClick:()=>window.dispatchEvent(new CustomEvent("pixcode:create-project")),className:"rounded-md border border-border p-4 text-left transition-colors hover:bg-muted/40",children:[i.jsx(ji,{className:"mb-3 h-5 w-5 text-foreground"}),i.jsx("div",{className:"text-sm font-semibold",children:o("mainContent.landing.createProject",{defaultValue:"Create New Project"})}),i.jsx("p",{className:"mt-2 text-xs leading-5 text-muted-foreground",children:o("mainContent.landing.createProjectDescription",{defaultValue:"Add an existing workspace or create a folder, then open the provider picker for coding."})})]})]}),i.jsx("div",{className:"mt-5 rounded-md border border-border/70 bg-muted/20 p-4 text-sm text-muted-foreground",children:o("mainContent.landing.sidebarHint")})]})})]})}function aie(e){if(!e||typeof e.new_string!="string")return null;const t=String(e.old_string||"").split(`
795
+ `),N+="</div>",N+="</div>",p.innerHTML=N,g){const T=p.querySelector(".cm-diff-nav-prev"),_=p.querySelector(".cm-diff-nav-next");T?.addEventListener("click",()=>{if(x.length===0)return;f=f>0?f-1:x.length-1;const j=x[f];j&&u.dispatch({effects:Jn.scrollIntoView(j.fromB,{y:"center"})}),h()}),_?.addEventListener("click",()=>{if(x.length===0)return;f=f<x.length-1?f+1:0;const j=x[f];j&&u.dispatch({effects:Jn.scrollIntoView(j.fromB,{y:"center"})}),h()})}p.querySelector(".cm-toggle-diff-btn")?.addEventListener("click",a),p.querySelector(".cm-popout-btn")?.addEventListener("click",()=>{s?.()}),p.querySelector(".cm-expand-btn")?.addEventListener("click",()=>{o?.()})};return h(),{top:!0,dom:p,update:h}};return[Q6.of(d)]};function yae({content:e,linesLabel:t,charactersLabel:r,shortcutsLabel:n}){return i.jsxs("div",{className:"flex flex-shrink-0 items-center justify-between border-t border-border bg-muted px-3 py-1.5",children:[i.jsxs("div",{className:"flex items-center gap-3 text-xs text-gray-600 dark:text-gray-400",children:[i.jsxs("span",{children:[t," ",e.split(`
796
+ `).length]}),i.jsxs("span",{children:[r," ",e.length]})]}),i.jsx("div",{className:"text-xs text-gray-500 dark:text-gray-400",children:n})]})}function vae({file:e,isSidebar:t,isFullscreen:r,isMarkdownFile:n,markdownPreview:a,saving:s,saveSuccess:o,onToggleMarkdownPreview:l,onOpenSettings:c,onDownload:d,onSave:u,onToggleFullscreen:p,onClose:f,labels:h}){const g=o?h.saved:s?h.saving:h.save;return i.jsxs("div",{className:"flex min-w-0 flex-shrink-0 items-center justify-between gap-2 border-b border-border px-3 py-1.5",children:[i.jsx("div",{className:"flex min-w-0 flex-1 shrink items-center gap-2",children:i.jsxs("div",{className:"min-w-0 shrink",children:[i.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[i.jsx("h3",{className:"truncate text-sm font-medium text-gray-900 dark:text-white",children:e.name}),e.diffInfo&&i.jsx("span",{className:"shrink-0 whitespace-nowrap rounded bg-blue-100 px-1.5 py-0.5 text-[10px] text-blue-600 dark:bg-blue-900 dark:text-blue-300",children:h.showingChanges})]}),i.jsx("p",{className:"truncate text-xs text-gray-500 dark:text-gray-400",children:e.path})]})}),i.jsxs("div",{className:"flex shrink-0 items-center gap-0.5",children:[n&&i.jsx("button",{type:"button",onClick:l,className:`flex items-center justify-center rounded-md p-1.5 transition-colors ${a?"bg-blue-50 text-blue-600 dark:bg-blue-900/30 dark:text-blue-400":"text-gray-600 hover:bg-gray-100 hover:text-gray-900 dark:text-gray-400 dark:hover:bg-gray-800 dark:hover:text-white"}`,title:a?h.editMarkdown:h.previewMarkdown,children:a?i.jsx(us,{className:"h-4 w-4"}):i.jsx(Ec,{className:"h-4 w-4"})}),i.jsx("button",{type:"button",onClick:c,className:"flex items-center justify-center rounded-md p-1.5 text-gray-600 hover:bg-gray-100 hover:text-gray-900 dark:text-gray-400 dark:hover:bg-gray-800 dark:hover:text-white",title:h.settings,children:i.jsx(Ht,{className:"h-4 w-4"})}),i.jsx("button",{type:"button",onClick:d,className:"flex items-center justify-center rounded-md p-1.5 text-gray-600 hover:bg-gray-100 hover:text-gray-900 dark:text-gray-400 dark:hover:bg-gray-800 dark:hover:text-white",title:h.download,children:i.jsx(zn,{className:"h-4 w-4"})}),i.jsx("button",{type:"button",onClick:u,disabled:s,className:`flex items-center justify-center rounded-md p-1.5 transition-colors disabled:opacity-50 ${o?"bg-green-50 text-green-600 dark:bg-green-900/30 dark:text-green-400":"text-gray-600 hover:bg-gray-100 hover:text-gray-900 dark:text-gray-400 dark:hover:bg-gray-800 dark:hover:text-white"}`,title:g,children:o?i.jsx("svg",{className:"h-4 w-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})}):i.jsx(_D,{className:"h-4 w-4"})}),!t&&i.jsx("button",{type:"button",onClick:p,className:"flex items-center justify-center rounded-md p-1.5 text-gray-600 hover:bg-gray-100 hover:text-gray-900 dark:text-gray-400 dark:hover:bg-gray-800 dark:hover:text-white",title:r?h.exitFullscreen:h.fullscreen,children:r?i.jsx(ED,{className:"h-4 w-4"}):i.jsx(Zu,{className:"h-4 w-4"})}),i.jsx("button",{type:"button",onClick:f,className:"flex items-center justify-center rounded-md p-1.5 text-gray-600 hover:bg-gray-100 hover:text-gray-900 dark:text-gray-400 dark:hover:bg-gray-800 dark:hover:text-white",title:h.close,children:i.jsx(Ct,{className:"h-4 w-4"})})]})]})}function wae({isDarkMode:e,isSidebar:t,loadingText:r}){return i.jsxs(i.Fragment,{children:[i.jsx("style",{children:hae(e)}),t?i.jsx("div",{className:"flex h-full w-full items-center justify-center bg-background",children:i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsx("div",{className:"h-6 w-6 animate-spin rounded-full border-b-2 border-blue-600"}),i.jsx("span",{className:"text-gray-900 dark:text-white",children:r})]})}):i.jsx("div",{className:"fixed inset-0 z-[9999] md:flex md:items-center md:justify-center md:bg-black/50",children:i.jsx("div",{className:"code-editor-loading flex h-full w-full items-center justify-center p-8 md:h-auto md:w-auto md:rounded-lg",children:i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsx("div",{className:"h-6 w-6 animate-spin rounded-full border-b-2 border-blue-600"}),i.jsx("span",{className:"text-gray-900 dark:text-white",children:r})]})})})]})}const kae=m.createContext(null),Jh={didCatch:!1,error:null};let x6=class extends m.Component{constructor(t){super(t),this.resetErrorBoundary=this.resetErrorBoundary.bind(this),this.state=Jh}static getDerivedStateFromError(t){return{didCatch:!0,error:t}}resetErrorBoundary(){const{error:t}=this.state;if(t!==null){for(var r,n,a=arguments.length,s=new Array(a),o=0;o<a;o++)s[o]=arguments[o];(r=(n=this.props).onReset)===null||r===void 0||r.call(n,{args:s,reason:"imperative-api"}),this.setState(Jh)}}componentDidCatch(t,r){var n,a;(n=(a=this.props).onError)===null||n===void 0||n.call(a,t,r)}componentDidUpdate(t,r){const{didCatch:n}=this.state,{resetKeys:a}=this.props;if(n&&r.error!==null&&Sae(t.resetKeys,a)){var s,o;(s=(o=this.props).onReset)===null||s===void 0||s.call(o,{next:a,prev:t.resetKeys,reason:"keys"}),this.setState(Jh)}}render(){const{children:t,fallbackRender:r,FallbackComponent:n,fallback:a}=this.props,{didCatch:s,error:o}=this.state;let l=t;if(s){const c={error:o,resetErrorBoundary:this.resetErrorBoundary};if(typeof r=="function")l=r(c);else if(n)l=m.createElement(n,c);else if(a!==void 0)l=a;else throw o}return m.createElement(kae.Provider,{value:{didCatch:s,error:o,resetErrorBoundary:this.resetErrorBoundary}},l)}};function Sae(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[];return e.length!==t.length||e.some((r,n)=>!Object.is(r,t[n]))}function Cae({inline:e,className:t,children:r,node:n,...a}){const[s,o]=m.useState(!1),l=Array.isArray(r)?r.join(""):String(r??""),c=/[\r\n]/.test(l);if(e||!c)return i.jsx("code",{className:`whitespace-pre-wrap break-words rounded-md border border-gray-200 bg-gray-100 px-1.5 py-0.5 font-mono text-[0.9em] text-gray-900 dark:border-gray-700 dark:bg-gray-800/60 dark:text-gray-100 ${t||""}`,...a,children:r});const u=/language-(\w+)/.exec(t||""),p=u?u[1]:"text";return i.jsxs("div",{className:"group relative my-2",children:[p!=="text"&&i.jsx("div",{className:"absolute left-3 top-2 z-10 text-xs font-medium uppercase text-gray-400",children:p}),i.jsx("button",{type:"button",onClick:()=>la(l).then(f=>{f&&(o(!0),setTimeout(()=>o(!1),2e3))}),className:"absolute right-2 top-2 z-10 rounded-md border border-gray-600 bg-gray-700/80 px-2 py-1 text-xs text-white opacity-0 transition-opacity hover:bg-gray-700 group-hover:opacity-100",children:s?"Copied!":"Copy"}),i.jsx(xw,{language:p,style:wI,customStyle:{margin:0,borderRadius:"0.5rem",fontSize:"0.875rem",padding:p!=="text"?"2rem 1rem 1rem 1rem":"1rem"},children:l})]})}const Nae={code:Cae,blockquote:({children:e})=>i.jsx("blockquote",{className:"my-2 border-l-4 border-gray-300 pl-4 italic text-gray-600 dark:border-gray-600 dark:text-gray-400",children:e}),a:({href:e,children:t})=>i.jsx("a",{href:e,className:"text-blue-600 hover:underline dark:text-blue-400",target:"_blank",rel:"noopener noreferrer",children:t}),table:({children:e})=>i.jsx("div",{className:"my-2 overflow-x-auto",children:i.jsx("table",{className:"min-w-full border-collapse border border-gray-200 dark:border-gray-700",children:e})}),thead:({children:e})=>i.jsx("thead",{className:"bg-gray-50 dark:bg-gray-800",children:e}),th:({children:e})=>i.jsx("th",{className:"border border-gray-200 px-3 py-2 text-left text-sm font-semibold dark:border-gray-700",children:e}),td:({children:e})=>i.jsx("td",{className:"border border-gray-200 px-3 py-2 align-top text-sm dark:border-gray-700",children:e})};function Eae({content:e}){const t=m.useMemo(()=>[aj,tI],[]),r=m.useMemo(()=>[dI],[]);return i.jsx(PA,{remarkPlugins:t,rehypePlugins:r,components:Nae,children:e})}const Tae=m.lazy(async()=>{const[e,{ensureLocalMonaco:t}]=await Promise.all([vC(()=>import("./index-ak1p_4ew.js"),__vite__mapDeps([0,1])),vC(()=>import("./localMonaco-DFIbtDNp.js"),__vite__mapDeps([2,0,1]))]);return t(),await e.loader.init(),{default:e.Editor}});function IN(){return i.jsx("div",{className:"flex h-full w-full items-center justify-center bg-white text-sm text-gray-500 dark:bg-gray-900 dark:text-gray-400",children:"Loading editor…"})}const Aae=Jn.theme({"&":{backgroundColor:"#ffffff",color:"#111827"},".cm-scroller":{backgroundColor:"#ffffff"},".cm-content":{caretColor:"#111827"},".cm-cursor, .cm-dropCursor":{borderLeftColor:"#111827"},"&.cm-focused .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection":{backgroundColor:"#bfdbfe"},".cm-gutters":{backgroundColor:"#f8fafc",borderRightColor:"#e5e7eb",color:"#64748b"},".cm-activeLine":{backgroundColor:"#f8fafc"},".cm-activeLineGutter":{backgroundColor:"#eef2ff"},".cm-panels":{backgroundColor:"#ffffff",color:"#111827"},".cm-panels.cm-panels-top":{borderBottomColor:"#e5e7eb"}},{dark:!1});function jae(e){const t=e.toLowerCase();if(t===".env"||t.startsWith(".env."))return"ini";switch(t.split(".").pop()){case"js":case"jsx":return"javascript";case"ts":case"tsx":return"typescript";case"py":return"python";case"html":case"htm":return"html";case"css":case"scss":case"less":return"css";case"json":return"json";case"md":case"markdown":return"markdown";default:return"plaintext"}}function Iae(e,t){return`file:///${(e||t).replace(/\\/g,"/").replace(/^\/+/,"").split("/").filter(Boolean).map(a=>encodeURIComponent(a)).join("/")||encodeURIComponent(t)}`}function Rae({content:e,onChange:t,onSave:r,markdownPreview:n,isMarkdownFile:a,isDarkMode:s,fontSize:o,showLineNumbers:l,wordWrap:c,extensions:d,fileName:u,filePath:p,useMonacoEditor:f}){const h=m.useRef(r);m.useEffect(()=>{h.current=r},[r]);const g=m.useCallback((y,v)=>{const{KeyCode:w,KeyMod:k}=v;y.addCommand(k.CtrlCmd|w.KeyS,()=>{h.current()}),y.focus()},[]),b=m.useMemo(()=>({automaticLayout:!0,contextmenu:!0,copyWithSyntaxHighlighting:!0,cursorBlinking:"blink",folding:!0,fontLigatures:!1,fontSize:o,glyphMargin:!1,lineNumbers:l?"on":"off",minimap:{enabled:!1},mouseWheelZoom:!0,multiCursorModifier:"alt",renderLineHighlight:"all",roundedSelection:!1,scrollBeyondLastLine:!1,selectOnLineNumbers:!0,selectionClipboard:!0,tabCompletion:"on",wordWrap:c?"on":"off"}),[o,l,c]);if(n&&a)return i.jsx("div",{className:"h-full overflow-y-auto bg-white dark:bg-gray-900",children:i.jsx("div",{className:"prose prose-sm mx-auto max-w-none px-8 py-6 dark:prose-invert prose-headings:font-semibold prose-a:text-blue-600 prose-code:text-sm prose-pre:bg-gray-900 prose-img:rounded-lg dark:prose-a:text-blue-400",children:i.jsx(Eae,{content:e})})});const x=i.jsx(KN,{value:e,onChange:t,extensions:d,theme:s?YN:Aae,height:"100%",style:{fontSize:`${o}px`,height:"100%"},basicSetup:{lineNumbers:l,foldGutter:!0,dropCursor:!1,allowMultipleSelections:!1,indentOnInput:!0,bracketMatching:!0,closeBrackets:!0,autocompletion:!0,highlightSelectionMatches:!0,searchKeymap:!0}});return f?i.jsx("div",{className:"h-full min-h-0 w-full overflow-hidden",children:i.jsx(x6,{fallback:x,onError:y=>{console.error("Monaco editor failed to load; falling back to CodeMirror:",y)},children:i.jsx(m.Suspense,{fallback:i.jsx(IN,{}),children:i.jsx(Tae,{value:e,onChange:y=>t(y??""),language:jae(u),path:Iae(p,u),theme:s?"vs-dark":"light",height:"100%",width:"100%",options:b,onMount:g,loading:i.jsx(IN,{})})})})}):x}function _ae({file:e,isSidebar:t,isFullscreen:r,onClose:n,onToggleFullscreen:a,title:s,message:o}){const l=i.jsx("div",{className:"flex h-full w-full flex-col items-center justify-center bg-background p-8 text-muted-foreground",children:i.jsxs("div",{className:"flex max-w-md flex-col items-center gap-4 text-center",children:[i.jsx("div",{className:"flex h-16 w-16 items-center justify-center rounded-full bg-muted",children:i.jsx("svg",{className:"h-8 w-8 text-muted-foreground",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.5,d:"M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z"})})}),i.jsxs("div",{children:[i.jsx("h3",{className:"mb-2 text-lg font-medium text-foreground",children:s}),i.jsx("p",{className:"text-sm text-muted-foreground",children:o})]}),i.jsx("button",{onClick:n,className:"mt-4 rounded-md bg-primary px-4 py-2 text-sm text-primary-foreground transition-colors hover:bg-primary/90",children:"Close"})]})});if(t)return i.jsxs("div",{className:"flex h-full w-full flex-col bg-background",children:[i.jsxs("div",{className:"flex flex-shrink-0 items-center justify-between border-b border-border px-3 py-1.5",children:[i.jsx("div",{className:"flex min-w-0 flex-1 items-center gap-2",children:i.jsx("h3",{className:"truncate text-sm font-medium text-gray-900 dark:text-white",children:e.name})}),i.jsx("button",{type:"button",onClick:n,className:"flex items-center justify-center rounded-md p-1.5 text-gray-600 hover:bg-gray-100 hover:text-gray-900 dark:text-gray-400 dark:hover:bg-gray-800 dark:hover:text-white",title:"Close",children:i.jsx("svg",{className:"h-4 w-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),l]});const c=r?"fixed inset-0 z-[9999] bg-background flex flex-col":"fixed inset-0 z-[9999] md:bg-black/50 md:flex md:items-center md:justify-center md:p-4",d=r?"bg-background flex flex-col w-full h-full":"bg-background shadow-2xl flex flex-col w-full h-full md:rounded-lg md:shadow-2xl md:w-full md:max-w-2xl md:h-auto md:max-h-[60vh]";return i.jsx("div",{className:c,children:i.jsxs("div",{className:d,children:[i.jsxs("div",{className:"flex flex-shrink-0 items-center justify-between border-b border-border px-3 py-1.5",children:[i.jsx("div",{className:"flex min-w-0 flex-1 items-center gap-2",children:i.jsx("h3",{className:"truncate text-sm font-medium text-gray-900 dark:text-white",children:e.name})}),i.jsxs("div",{className:"flex shrink-0 items-center gap-0.5",children:[i.jsx("button",{type:"button",onClick:a,className:"flex items-center justify-center rounded-md p-1.5 text-gray-600 hover:bg-gray-100 hover:text-gray-900 dark:text-gray-400 dark:hover:bg-gray-800 dark:hover:text-white",title:r?"Exit fullscreen":"Fullscreen",children:r?i.jsx("svg",{className:"h-4 w-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 9V4.5M9 9H4.5M9 9L3.5 3.5M9 15v4.5M9 15H4.5M9 15l-5.5 5.5M15 9h4.5M15 9V4.5M15 9l5.5-5.5M15 15h4.5M15 15v4.5m0-4.5l5.5 5.5"})}):i.jsx("svg",{className:"h-4 w-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 8V4m0 0h4M4 4l5 5m11-1V4m0 0h-4m4 0l-5 5M4 16v4m0 0h4m-4 0l5-5m11 5l-5-5m5 5v-4m0 4h-4"})})}),i.jsx("button",{type:"button",onClick:n,className:"flex items-center justify-center rounded-md p-1.5 text-gray-600 hover:bg-gray-100 hover:text-gray-900 dark:text-gray-400 dark:hover:bg-gray-800 dark:hover:text-white",title:"Close",children:i.jsx("svg",{className:"h-4 w-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]})]}),l]})})}function tc({file:e,onClose:t,projectPath:r,isSidebar:n=!1,isExpanded:a=!1,onToggleExpand:s=null,onPopOut:o=null}){const{t:l}=He("codeEditor"),[c,d]=m.useState(!1),[u,p]=m.useState(!!e.diffInfo),[f,h]=m.useState(!1),{isDarkMode:g,wordWrap:b,minimapEnabled:x,showLineNumbers:y,fontSize:v}=Zne(),{content:w,setContent:k,loading:S,saving:N,saveSuccess:E,saveError:I,isBinary:A,handleSave:T,handleDownload:_}=Kne({file:e,projectPath:r}),j=m.useMemo(()=>{const L=e.name.split(".").pop()?.toLowerCase();return L==="md"||L==="markdown"},[e.name]),R=m.useMemo(()=>pae({file:e,showDiff:u,minimapEnabled:x,isDarkMode:g}),[e,g,x,u]),C=m.useMemo(()=>mae({file:e,showDiff:u}),[e,u]),D=m.useMemo(()=>xae({file:e,showDiff:u,isSidebar:n,isExpanded:a,onToggleDiff:()=>p(L=>!L),onPopOut:o,onToggleExpand:s,labels:{changes:l("toolbar.changes"),previousChange:l("toolbar.previousChange"),nextChange:l("toolbar.nextChange"),hideDiff:l("toolbar.hideDiff"),showDiff:l("toolbar.showDiff"),collapse:l("toolbar.collapse"),expand:l("toolbar.expand")}}),[e,a,n,o,s,u,l]),B=m.useMemo(()=>{const L=[...uae(e.name),...D];return e.diffInfo&&u&&e.diffInfo.old_string!==void 0&&(L.push(Mne({original:e.diffInfo.old_string,mergeControls:!1,highlightChanges:!0,syntaxHighlightDeletions:!1,gutter:!0})),L.push(...R),L.push(...C)),b&&L.push(Jn.lineWrapping),L},[e.diffInfo,e.name,R,C,u,D,b]),F=!(e.diffInfo&&e.diffInfo.old_string!==void 0);if(Xne({onSave:T,onClose:t,dependency:w}),S)return i.jsx(wae,{isDarkMode:g,isSidebar:n,loadingText:l("loading",{fileName:e.name})});if(A)return i.jsx(_ae,{file:e,isSidebar:n,isFullscreen:c,onClose:t,onToggleFullscreen:()=>d(L=>!L),title:l("binaryFile.title","Binary File"),message:l("binaryFile.message",'The file "{{fileName}}" cannot be displayed in the text editor because it is a binary file.',{fileName:e.name})});const V=n?"w-full h-full flex flex-col":`fixed inset-0 z-[9999] md:bg-black/50 md:flex md:items-center md:justify-center md:p-4 ${c?"md:p-0":""}`,K=n?"bg-background flex flex-col w-full h-full":`bg-background shadow-2xl flex flex-col w-full h-full md:rounded-lg md:shadow-2xl${c?" md:w-full md:h-full md:rounded-none":" md:w-full md:max-w-6xl md:h-[80vh] md:max-h-[80vh]"}`;return i.jsxs(i.Fragment,{children:[i.jsx("style",{children:fae(g)}),i.jsx("div",{className:V,children:i.jsxs("div",{className:K,children:[i.jsx(vae,{file:e,isSidebar:n,isFullscreen:c,isMarkdownFile:j,markdownPreview:f,saving:N,saveSuccess:E,onToggleMarkdownPreview:()=>h(L=>!L),onOpenSettings:()=>window.openSettings?.("appearance"),onDownload:_,onSave:T,onToggleFullscreen:()=>d(L=>!L),onClose:t,labels:{showingChanges:l("header.showingChanges"),editMarkdown:l("actions.editMarkdown"),previewMarkdown:l("actions.previewMarkdown"),settings:l("toolbar.settings"),download:l("actions.download"),save:l("actions.save"),saving:l("actions.saving"),saved:l("actions.saved"),fullscreen:l("actions.fullscreen"),exitFullscreen:l("actions.exitFullscreen"),close:l("actions.close")}}),I&&i.jsx("div",{className:"border-b border-red-200 bg-red-50 px-3 py-1.5 text-xs text-red-700 dark:border-red-900/40 dark:bg-red-900/20 dark:text-red-300",children:I}),i.jsx("div",{className:"flex-1 overflow-hidden",children:i.jsx(Rae,{content:w,onChange:k,onSave:T,markdownPreview:f,isMarkdownFile:j,isDarkMode:g,fontSize:v,showLineNumbers:y,wordWrap:b,extensions:B,fileName:e.name,filePath:e.path,useMonacoEditor:F})}),i.jsx(yae,{content:w,linesLabel:l("footer.lines"),charactersLabel:l("footer.characters"),shortcutsLabel:l("footer.shortcuts")})]})})]})}const Pae=200,Qh=280;function RN({editingFile:e,isMobile:t,editorExpanded:r,editorWidth:n,hasManualWidth:a,resizeHandleRef:s,onResizeStart:o,onCloseEditor:l,onToggleEditorExpand:c,projectPath:d,fillSpace:u}){const[p,f]=m.useState(!1),h=m.useRef(null),[g,b]=m.useState(n);if(m.useEffect(()=>{if(!e||t||p)return;const y=()=>{if(!h.current)return;const k=h.current.parentElement;if(!k)return;const N=k.clientWidth-Pae;N<Qh?f(!0):n>N?b(N):b(n)};y(),window.addEventListener("resize",y);const v=new ResizeObserver(y),w=h.current?.parentElement;return w&&v.observe(w),()=>{window.removeEventListener("resize",y),v.disconnect()}},[e,t,p,n]),!e)return null;if(t||p)return i.jsx(tc,{file:e,onClose:()=>{f(!1),l()},projectPath:d,isSidebar:!1});const x=r||u&&!a;return i.jsxs("div",{ref:h,className:`flex h-full min-w-0 flex-shrink-0 ${x?"flex-1":""}`,children:[!r&&i.jsx("div",{ref:s,onMouseDown:o,className:"group relative w-1 flex-shrink-0 cursor-col-resize bg-gray-200 transition-colors hover:bg-blue-500 dark:bg-gray-700 dark:hover:bg-blue-600",title:"Drag to resize",children:i.jsx("div",{className:"absolute inset-y-0 left-1/2 w-1 -translate-x-1/2 bg-blue-500 opacity-0 transition-opacity group-hover:opacity-100 dark:bg-blue-600"})}),i.jsx("div",{className:`h-full overflow-hidden border-l border-gray-200 dark:border-gray-700 ${x?"min-w-0 flex-1":`min-w-[ flex-shrink-0${Qh}px]`}`,style:x?void 0:{width:`${g}px`,minWidth:`${Qh}px`},children:i.jsx(tc,{file:e,onClose:l,projectPath:d,isSidebar:!0,isExpanded:r,onToggleExpand:c,onPopOut:()=>f(!0)})})]})}function Lae(e){const t=m.useRef(!1),r=m.useCallback(s=>{s&&(s.preventDefault(),s.stopPropagation()),e()},[e]),n=m.useCallback(s=>{t.current=!0,r(s),window.setTimeout(()=>{t.current=!1},350)},[r]);return{handleMobileMenuClick:m.useCallback(s=>{if(t.current){s.preventDefault(),s.stopPropagation();return}r(s)},[r]),handleMobileMenuTouchEnd:n}}function y6({onMenuClick:e,compact:t=!1}){const{handleMobileMenuClick:r,handleMobileMenuTouchEnd:n}=Lae(e),a=t?"p-1.5 text-muted-foreground hover:text-foreground rounded-lg hover:bg-accent/60 pwa-menu-button":"p-1.5 text-muted-foreground hover:text-foreground rounded-lg hover:bg-accent/60 touch-manipulation active:scale-95 pwa-menu-button flex-shrink-0";return i.jsx("button",{onClick:r,onTouchEnd:n,className:a,"aria-label":"Open menu",children:i.jsx("svg",{className:"h-5 w-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 6h16M4 12h16M4 18h16"})})})}const Dae=[{kind:"builtin",id:"chat",labelKey:"tabs.chat",icon:Un},{kind:"builtin",id:"orchestration",labelKey:"tabs.orchestration",icon:pr},{kind:"builtin",id:"remote",labelKey:"tabs.remote",icon:Ac},{kind:"builtin",id:"shell",labelKey:"tabs.shell",icon:Rr},{kind:"builtin",id:"files",labelKey:"tabs.files",icon:qr},{kind:"builtin",id:"git",labelKey:"tabs.git",icon:Kr},{kind:"builtin",id:"changes",labelKey:"tabs.changes",icon:ia},{kind:"builtin",id:"liveView",labelKey:"tabs.liveView",icon:xn}],Oae=new Set(["files","shell","git","changes","liveView"]);function Mae({activeTab:e,setActiveTab:t,liveViewAvailable:r=!1,activeSidePanelTab:n,sidePanelMode:a="split",canUseSidePanelSplit:s=!0,isMobile:o=!1,onCloseSidePanel:l}){const{t:c}=He(),{plugins:d}=ep(),u=d.filter(f=>f.enabled).map(f=>({kind:"plugin",id:`plugin:${f.name}`,label:f.displayName,pluginName:f.name,iconFile:f.icon})),p=[...Dae,...u];return i.jsx(rp,{children:p.map(f=>{const h=f.id===e,g=f.kind==="builtin"?c(f.labelKey):f.label,b=!!(!o&&s&&h&&n===f.id&&Oae.has(f.id)),x=a==="split",v=b?`${g} · ${x?"Split":"Full"} view`:g;return i.jsxs("div",{className:"relative inline-flex items-center",children:[i.jsx(Nf,{content:v,position:"bottom",children:i.jsxs(np,{isActive:h,onClick:()=>t(f.id),className:b?"px-2 py-[5px] pr-7":"px-2.5 py-[5px]",children:[f.kind==="builtin"?i.jsx(f.icon,{className:"h-3.5 w-3.5"}):i.jsx(dT,{pluginName:f.pluginName,iconFile:f.iconFile,className:"flex h-3.5 w-3.5 items-center justify-center [&>svg]:h-full [&>svg]:w-full"}),i.jsx("span",{className:"hidden lg:inline",children:g}),f.id==="liveView"&&r&&i.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-emerald-500 shadow-[0_0_8px_rgba(16,185,129,0.75)]","aria-hidden":"true"}),b&&i.jsx("span",{className:`ml-0.5 inline-flex h-4 w-4 items-center justify-center rounded border ${x?"border-foreground/20 bg-foreground/5 text-foreground/70":"border-border bg-muted/60 text-muted-foreground"}`,"aria-hidden":"true",children:x?i.jsx(Qu,{className:"h-3 w-3"}):i.jsx(Zu,{className:"h-3 w-3"})})]})}),b&&l&&i.jsx(Nf,{content:c("tabs.closeSidePanel","Close side panel"),position:"bottom",children:i.jsx("button",{type:"button",className:"absolute right-1 top-1/2 flex h-4 w-4 -translate-y-1/2 items-center justify-center rounded text-muted-foreground transition-colors hover:bg-destructive/10 hover:text-destructive focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/40",onClick:w=>{w.stopPropagation(),l()},"aria-label":c("tabs.closeSidePanel","Close side panel"),title:c("tabs.closeSidePanel","Close side panel"),children:i.jsx(Ct,{className:"h-3 w-3"})})})]},f.id)})})}function Fae(e,t,r){return e.startsWith("plugin:")&&r?r:e==="files"?t("mainContent.projectFiles"):e==="orchestration"?t("tabs.orchestration"):e==="remote"?t("tabs.remote"):e==="controlRoom"?t("tabs.controlRoom"):e==="git"?t("tabs.git"):e==="changes"?t("tabs.changes"):e==="liveView"?t("tabs.liveView"):"Project"}function zae(e){return e.__provider==="cursor"?e.name||"Untitled Session":e.summary||e.name||e.title||"New Session"}function Bae({activeTab:e,selectedProject:t,selectedSession:r}){const{t:n}=He(),{plugins:a}=ep(),s=e.startsWith("plugin:")?a.find(d=>d.name===e.replace("plugin:",""))?.displayName:void 0,o=e==="chat"&&!!r,l=e==="chat"&&!r,c=t?.displayName||"Server";return i.jsxs("div",{className:"scrollbar-hide flex min-w-0 flex-1 items-center gap-2 overflow-x-auto",children:[o&&i.jsx("div",{className:"flex h-5 w-5 flex-shrink-0 items-center justify-center",children:i.jsx(er,{provider:r?.__provider,className:"h-4 w-4"})}),i.jsx("div",{className:"min-w-0 flex-1",children:e==="chat"&&r?i.jsxs("div",{className:"min-w-0",children:[i.jsx("h2",{className:"scrollbar-hide overflow-x-auto whitespace-nowrap text-sm font-semibold leading-tight text-foreground",children:zae(r)}),i.jsx("div",{className:"truncate text-[11px] leading-tight text-muted-foreground",children:c})]}):l?i.jsxs("div",{className:"min-w-0",children:[i.jsx("h2",{className:"text-base font-semibold leading-tight text-foreground",children:n("mainContent.newSession")}),i.jsx("div",{className:"truncate text-xs leading-tight text-muted-foreground",children:c})]}):i.jsxs("div",{className:"min-w-0",children:[i.jsx("h2",{className:"text-sm font-semibold leading-tight text-foreground",children:Fae(e,n,s)}),i.jsx("div",{className:"truncate text-[11px] leading-tight text-muted-foreground",children:c})]})})]})}function _N({activeTab:e,setActiveTab:t,selectedProject:r,selectedSession:n,liveViewAvailable:a,activeSidePanelTab:s,sidePanelMode:o,canUseSidePanelSplit:l,isMobile:c,onMenuClick:d,onCloseSidePanel:u}){const p=m.useRef(null),[f,h]=m.useState(!1),[g,b]=m.useState(!1),x=m.useCallback(()=>{const y=p.current;y&&(h(y.scrollLeft>2),b(y.scrollLeft<y.scrollWidth-y.clientWidth-2))},[]);return m.useEffect(()=>{const y=p.current;if(!y)return;x();const v=new ResizeObserver(x);return v.observe(y),()=>v.disconnect()},[x]),i.jsx("div",{className:"pwa-header-safe flex-shrink-0 border-b border-border/60 bg-background px-3 py-1.5 sm:px-4 sm:py-2",children:i.jsxs("div",{className:"flex items-center justify-between gap-3",children:[i.jsxs("div",{className:"flex min-w-0 flex-1 items-center gap-2",children:[c&&i.jsx(y6,{onMenuClick:d}),i.jsx(Bae,{activeTab:e,selectedProject:r,selectedSession:n})]}),e!=="controlRoom"&&i.jsxs("div",{className:"relative min-w-0 flex-shrink overflow-hidden sm:flex-shrink-0",children:[f&&i.jsx("div",{className:"pointer-events-none absolute inset-y-0 left-0 z-10 w-6 bg-gradient-to-r from-background to-transparent"}),i.jsxs("div",{className:"relative min-w-0 overflow-hidden",children:[i.jsx("div",{ref:p,onScroll:x,className:"scrollbar-hide overflow-x-auto",children:i.jsx(Mae,{activeTab:e,setActiveTab:t,liveViewAvailable:a,activeSidePanelTab:s,sidePanelMode:o,canUseSidePanelSplit:l,isMobile:c,onCloseSidePanel:u})}),g&&i.jsx("div",{className:"pointer-events-none absolute inset-y-0 right-0 z-10 w-6 bg-gradient-to-l from-background to-transparent"})]})]})]})})}function Pg({mode:e,isMobile:t,onMenuClick:r,onQuickStartSession:n,onQuickStartOrchestration:a,onOpenControlRoom:s}){const{t:o}=He(),l=e==="loading";return i.jsxs("div",{className:"flex h-full flex-col",children:[t&&i.jsx("div",{className:"pwa-header-safe flex-shrink-0 border-b border-border/50 bg-background/80 p-2 backdrop-blur-sm sm:p-3",children:i.jsx(y6,{onMenuClick:r,compact:!0})}),l?i.jsx("div",{className:"flex flex-1 items-center justify-center",children:i.jsxs("div",{className:"text-center text-muted-foreground",children:[i.jsx("div",{className:"mx-auto mb-4 h-10 w-10",children:i.jsx("div",{className:"h-full w-full rounded-full border-[3px] border-muted border-t-primary",style:{animation:"spin 1s linear infinite",WebkitAnimation:"spin 1s linear infinite",MozAnimation:"spin 1s linear infinite"}})}),i.jsx("h2",{className:"mb-1 text-lg font-semibold text-foreground",children:o("mainContent.loading")}),i.jsx("p",{className:"text-sm",children:o("mainContent.settingUpWorkspace")})]})}):i.jsx("div",{className:"flex flex-1 items-center justify-center overflow-auto p-5",children:i.jsxs("div",{className:"w-full max-w-4xl",children:[i.jsxs("div",{className:"mb-6",children:[i.jsx("div",{className:"mb-4 flex h-12 w-12 items-center justify-center rounded-lg bg-muted/60",children:i.jsx(qr,{className:"h-6 w-6 text-muted-foreground"})}),i.jsx("h2",{className:"text-2xl font-semibold text-foreground",children:o("mainContent.landing.title")}),i.jsx("p",{className:"mt-2 max-w-2xl text-sm leading-6 text-muted-foreground",children:o("mainContent.landing.description")})]}),i.jsxs("div",{className:"grid grid-cols-[repeat(auto-fit,minmax(min(100%,11rem),1fr))] gap-3",children:[i.jsxs("button",{type:"button",onClick:s,className:"rounded-md border border-primary/40 bg-primary/10 p-4 text-left transition-colors hover:bg-primary/15 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/40",children:[i.jsx($n,{className:"mb-3 h-5 w-5 text-primary"}),i.jsx("div",{className:"text-sm font-semibold",children:o("mainContent.openControlRoom",{defaultValue:"Open Control Room"})}),i.jsx("p",{className:"mt-2 text-xs leading-5 text-muted-foreground",children:o("mainContent.openControlRoomDescription",{defaultValue:"See admin users, team access, production runs, secrets, audits, usage, and remote access in one place."})})]}),i.jsxs("button",{type:"button",onClick:()=>{a?.()},className:"rounded-md border border-primary/30 bg-primary/5 p-4 text-left transition-colors hover:bg-primary/10",children:[i.jsx(pr,{className:"mb-3 h-5 w-5 text-primary"}),i.jsx("div",{className:"text-sm font-semibold",children:o("mainContent.landing.startOrchestration")}),i.jsx("p",{className:"mt-2 text-xs leading-5 text-muted-foreground",children:o("mainContent.landing.startOrchestrationDescription")})]}),i.jsxs("button",{type:"button",onClick:()=>{n?.()},className:"rounded-md border border-border p-4 text-left transition-colors hover:bg-muted/40",children:[i.jsx($n,{className:"mb-3 h-5 w-5 text-foreground"}),i.jsx("div",{className:"text-sm font-semibold",children:o("mainContent.landing.startChat")}),i.jsx("p",{className:"mt-2 text-xs leading-5 text-muted-foreground",children:o("mainContent.landing.startChatDescription")})]}),i.jsxs("button",{type:"button",onClick:()=>window.dispatchEvent(new CustomEvent("pixcode:create-project")),className:"rounded-md border border-border p-4 text-left transition-colors hover:bg-muted/40",children:[i.jsx(ji,{className:"mb-3 h-5 w-5 text-foreground"}),i.jsx("div",{className:"text-sm font-semibold",children:o("mainContent.landing.createProject",{defaultValue:"Create New Project"})}),i.jsx("p",{className:"mt-2 text-xs leading-5 text-muted-foreground",children:o("mainContent.landing.createProjectDescription",{defaultValue:"Add an existing workspace or create a folder, then open the provider picker for coding."})})]})]}),i.jsx("div",{className:"mt-5 rounded-md border border-border/70 bg-muted/20 p-4 text-sm text-muted-foreground",children:o("mainContent.landing.sidebarHint")})]})})]})}function Uae(e){if(!e||typeof e.new_string!="string")return null;const t=String(e.old_string||"").split(`
797
797
  `),r=e.new_string.split(`
798
- `),n=Math.max(t.length,r.length);for(let a=0;a<n;a+=1)if(t[a]!==r[a])return a+1;return null}function iie(e,t){const r=encodeURIComponent(e);return t&&t>0?`${r}#L${t}`:r}const sie={M:"M",A:"A",D:"D",U:"U"},oie={M:"border-amber-400/40 bg-amber-500/10 text-amber-700 dark:text-amber-200",A:"border-emerald-400/40 bg-emerald-500/10 text-emerald-700 dark:text-emerald-200",D:"border-red-400/40 bg-red-500/10 text-red-700 dark:text-red-200",U:"border-sky-400/40 bg-sky-500/10 text-sky-700 dark:text-sky-200"};function lie(e){return e?new Intl.DateTimeFormat(void 0,{hour:"2-digit",minute:"2-digit",second:"2-digit"}).format(e):null}function cie({changedFiles:e,isLoading:t,error:r,latestChangedFilePath:n,lastCheckedAt:a,trackingMode:s,onTrackingModeChange:o,onRefresh:l,onOpenFile:c,variant:d="rail"}){const u=lie(a),p=d==="panel";return i.jsxs("aside",{className:xe("h-full min-h-0 flex-col overflow-hidden bg-card/45",p?"flex w-full rounded-none border-0":"hidden w-[260px] shrink-0 rounded-lg border border-border/60 shadow-sm xl:flex"),children:[i.jsxs("div",{className:"flex items-center justify-between gap-2 border-b border-border/60 px-3 py-2",children:[i.jsxs("div",{className:"min-w-0",children:[i.jsxs("div",{className:"flex items-center gap-2 text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:[i.jsx("span",{className:"h-2 w-2 rounded-full bg-emerald-500 shadow-[0_0_10px_rgba(16,185,129,0.75)]"}),"Command Center"]}),i.jsx("p",{className:"mt-0.5 truncate text-[11px] text-muted-foreground",children:e.length>0?`${e.length} local change${e.length===1?"":"s"}`:"Watching agent writes"})]}),i.jsx("button",{type:"button",onClick:l,className:"inline-flex h-7 w-7 shrink-0 items-center justify-center rounded-md border border-border bg-background text-muted-foreground transition-colors hover:bg-accent hover:text-foreground","aria-label":"Refresh changed files",title:"Refresh changed files",children:t?i.jsx(_t,{className:"h-3.5 w-3.5 animate-spin"}):i.jsx(at,{className:"h-3.5 w-3.5"})})]}),i.jsx("div",{className:"border-b border-border/60 px-3 py-2",children:i.jsxs("div",{className:"grid grid-cols-2 rounded-md border border-border bg-background p-0.5 text-[11px] font-medium",children:[i.jsx("button",{type:"button",onClick:()=>o("local"),className:`rounded px-2 py-1 transition-colors ${s==="local"?"bg-foreground text-background shadow-sm":"text-muted-foreground hover:bg-muted hover:text-foreground"}`,title:"Local changes: agent writes and filesystem edits",children:"Local changes"}),i.jsx("button",{type:"button",onClick:()=>o("git"),className:`rounded px-2 py-1 transition-colors ${s==="git"?"bg-foreground text-background shadow-sm":"text-muted-foreground hover:bg-muted hover:text-foreground"}`,title:"Git changes: git status only",children:"Git changes"})]})}),r&&i.jsx("div",{className:"mx-3 mt-3 rounded-md border border-amber-500/25 bg-amber-500/10 px-2 py-1.5 text-[11px] leading-5 text-amber-700 dark:text-amber-200",children:r}),i.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto p-2",children:e.length===0?i.jsxs("div",{className:"flex h-full flex-col items-center justify-center px-3 text-center text-muted-foreground",children:[i.jsx(ia,{className:"mb-2 h-8 w-8 opacity-45"}),i.jsx("p",{className:"text-xs font-medium text-foreground",children:"No local changes detected"}),i.jsx("p",{className:"mt-1 text-[11px] leading-5",children:"When an agent writes or edits files, they will appear here."})]}):i.jsxs("div",{className:"space-y-1",children:[e.slice(0,12).map(f=>{const h=n===f.path,g=aie(f.diffInfo),b=g?`L${g}`:null,x=iie(f.path,g);return i.jsxs("button",{type:"button",onClick:()=>c(f),className:`group flex w-full items-center gap-2 rounded-md border px-2 py-1.5 text-left transition-all ${h?"changed-file-flash border-emerald-500/60 bg-emerald-500/15":"border-border/60 bg-background/70 hover:border-emerald-500/35 hover:bg-emerald-500/10"}`,title:x,children:[i.jsx("span",{className:`inline-flex h-5 min-w-5 items-center justify-center rounded border px-1 text-[10px] font-semibold ${oie[f.status]}`,children:sie[f.status]}),i.jsx("span",{className:"min-w-0 flex-1 truncate font-mono text-[11px] text-foreground",children:f.path}),b&&i.jsx("span",{className:"shrink-0 rounded border border-border bg-muted px-1.5 py-0.5 font-mono text-[10px] text-muted-foreground",children:b})]},`${f.status}:${f.path}`)}),e.length>12&&i.jsxs("p",{className:"px-1 pt-1 text-[11px] text-muted-foreground",children:["+",e.length-12," more files"]})]})}),u&&i.jsxs("div",{className:"border-t border-border/60 px-3 py-2 text-[10px] text-muted-foreground",children:["Last check ",u]})]})}function die(e){return e instanceof Error?`${e.name}: ${e.message}`:String(e)}function uie({error:e,resetErrorBoundary:t,showDetails:r,componentStack:n}){return i.jsx("div",{className:"flex flex-col items-center justify-center p-8 text-center",children:i.jsxs("div",{className:"max-w-md rounded-lg border border-red-200 bg-red-50 p-6",children:[i.jsxs("div",{className:"mb-4 flex items-center",children:[i.jsx("div",{className:"flex-shrink-0",children:i.jsx("svg",{className:"h-5 w-5 text-red-400",viewBox:"0 0 20 20",fill:"currentColor",children:i.jsx("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zM8.707 7.293a1 1 0 00-1.414 1.414L8.586 10l-1.293 1.293a1 1 0 101.414 1.414L10 11.414l1.293 1.293a1 1 0 001.414-1.414L11.414 10l1.293-1.293a1 1 0 00-1.414-1.414L10 8.586 8.707 7.293z",clipRule:"evenodd"})})}),i.jsx("h3",{className:"ml-3 text-sm font-medium text-red-800",children:"Something went wrong"})]}),i.jsxs("div",{className:"text-sm text-red-700",children:[i.jsx("p",{className:"mb-2",children:"An error occurred while loading the chat interface."}),r&&i.jsxs("details",{className:"mt-4",children:[i.jsx("summary",{className:"cursor-pointer font-mono text-xs",children:"Error Details"}),i.jsxs("pre",{className:"mt-2 max-h-40 overflow-auto rounded bg-red-100 p-2 text-xs",children:[die(e),n]})]})]}),i.jsx("div",{className:"mt-4",children:i.jsx("button",{onClick:t,className:"rounded bg-red-600 px-4 py-2 text-sm text-white hover:bg-red-700 focus:outline-none focus:ring-2 focus:ring-red-500",children:"Try Again"})})]})})}function pie({children:e,showDetails:t=!1,onRetry:r=void 0,resetKeys:n=void 0}){const[a,s]=m.useState(null),o=m.useCallback((d,u)=>{console.error("ErrorBoundary caught an error:",d,u),s(u?.componentStack??null)},[]),l=m.useCallback(()=>{s(null),r?.()},[r]),c=m.useCallback(({error:d,resetErrorBoundary:u})=>i.jsx(uie,{error:d,resetErrorBoundary:u,showDetails:t,componentStack:a}),[t,a]);return i.jsx(y6,{fallbackRender:c,onError:o,onReset:l,resetKeys:n,children:e})}const mie=new Set(["files","shell","git","changes","liveView"]),hie=40,fie=50,gie=46,DN="command-center-tracking-mode";function Od(e){return mie.has(e)}function bie(e){return Math.min(fie,Math.max(hie,e))}function ON(){return typeof window<"u"&&window.matchMedia?.("(prefers-reduced-motion: reduce)").matches}function xie({selectedProject:e,selectedSession:t,activeTab:r,setActiveTab:n,ws:a,sendMessage:s,latestMessage:o,isMobile:l,onMenuClick:c,isLoading:d,onInputFocusChange:u,onSessionActive:p,onSessionInactive:f,onSessionProcessing:h,onSessionNotProcessing:g,processingSessions:b,onReplaceTemporarySession:x,onNavigateToSession:y,onShowSettings:v,externalMessageUpdate:w,onQuickStartSession:k,onQuickStartOrchestration:S}){const{preferences:N}=tp(),{autoExpandTools:E,showRawParameters:I,showThinking:A,autoScrollToBottom:T,sendByCtrlEnter:_}=N,[j,R]=m.useState("split"),[C,D]=m.useState(gie),[B,F]=m.useState(!1),[V,K]=m.useState(!1),[L,G]=m.useState(()=>typeof window>"u"?"local":window.localStorage.getItem(DN)==="git"?"git":"local"),[H,z]=m.useState(()=>Od(r)?"chat":r),[te,se]=m.useState(()=>typeof window<"u"&&window.innerWidth>=1024),me=Od(r)?r:null,de=!!(me&&!l&&te&&j==="split"),ce=m.useRef(null),ye=m.useRef(null),he=m.useRef(null),ke=m.useRef(null),ve=m.useRef(null);Q3(ce,r);const{editingFile:je,editorWidth:M,editorExpanded:ae,hasManualWidth:ue,resizeHandleRef:Y,handleFileOpen:U,handleCloseEditor:Q,handleToggleEditorExpand:J,handleResizeStart:re}=Pne({selectedProject:e,isMobile:l}),le=H==="orchestration"?"orchestration":"chat",Ee=me?le:r,fe=!!de,ne=!!(me==="files"&&je&&!l),Z=Ee==="chat"&&(!me||fe),W=Ee==="orchestration"&&fe,{changedFiles:pe,isLoading:Ae,error:Le,lastCheckedAt:Ge,latestDetectedFile:rt,refresh:Ke}=_ne(e,!!e,o,L),{latestDetectedFile:ct}=JI(e,o,N.autoShowAgentDiff);QI(e,N.autoShowAgentDiff,je?[je.path]:[],U);const[st,nt]=m.useState(null),bt=m.useRef(0),Nt=m.useRef(0),Pt=m.useMemo(()=>pe.map(Re=>Re.path),[pe]),Bt=m.useCallback(async Re=>{if(Re.diffInfo)return Re.diffInfo;if(!e)return null;try{const Me=await Ce(`/api/git/file-with-diff?project=${encodeURIComponent(e.name)}&file=${encodeURIComponent(Re.path)}`,{cache:"no-store"}),Ze=await Me.json();if(Me.ok&&!Ze.error&&typeof Ze.currentContent=="string"&&typeof Ze.oldContent=="string")return{old_string:Ze.oldContent,new_string:Ze.currentContent}}catch{}if(Re.status==="A"||Re.status==="U")try{const Me=await Lt.readFile(e.name,Re.path);if(!Me.ok)return null;const Ze=await Me.json();if(typeof Ze.content=="string")return{old_string:"",new_string:Ze.content}}catch{return null}return null},[e]),Ar=m.useCallback(Re=>{nt(Re.path),U(Re.path,Re.diffInfo??null),!l&&te&&R("split"),n("files"),Re.diffInfo||Bt(Re).then(Me=>{Me&&U(Re.path,Me)})},[te,U,Bt,l,n]),Vt=m.useCallback(()=>{R("split"),n(le)},[n,le]),br=Re=>Re==="files"?ne?i.jsxs("div",{className:"flex h-full min-w-0 overflow-hidden",children:[!ae&&i.jsx("div",{className:"h-full min-w-[220px] max-w-[50%] flex-[0_0_46%] overflow-hidden border-r border-border/60",children:i.jsx(Ng,{selectedProject:e,onFileOpen:U,changedFilePaths:Pt,focusedFilePath:st})}),i.jsx(PN,{editingFile:je,isMobile:l,editorExpanded:ae,editorWidth:M,hasManualWidth:ue,resizeHandleRef:Y,onResizeStart:re,onCloseEditor:Q,onToggleEditorExpand:J,projectPath:e?.path,fillSpace:!0})]}):i.jsx(Ng,{selectedProject:e,onFileOpen:U,changedFilePaths:Pt,focusedFilePath:st}):Re==="shell"?i.jsx(Ao,{project:e,session:t,showHeader:!1,isActive:r==="shell"}):Re==="changes"?i.jsx(cie,{changedFiles:pe,isLoading:Ae,error:Le,latestChangedFilePath:rt?.path??st,lastCheckedAt:Ge,trackingMode:L,onTrackingModeChange:G,onRefresh:()=>{Ke("manual")},onOpenFile:Ar,variant:"panel"}):Re==="liveView"?e?i.jsx(jre,{selectedProject:e,onAvailabilityChange:K}):null:i.jsx(_I,{selectedProject:e,isMobile:l,onFileOpen:U});m.useEffect(()=>{if(!e){K(!1);return}let Re=!1;return Ce(`/api/live-view/${encodeURIComponent(e.name)}/status`,{cache:"no-store"}).then(Me=>Me.ok?Me.json():null).then(Me=>{Re||K(!!(Me?.target?.available||Me?.session))}).catch(()=>{Re||K(!1)}),()=>{Re=!0}},[e]),m.useEffect(()=>{if(typeof window>"u")return;const Re=()=>{se(window.innerWidth>=1024)};return Re(),window.addEventListener("resize",Re),()=>{window.removeEventListener("resize",Re)}},[]),m.useEffect(()=>{typeof window>"u"||window.localStorage.setItem(DN,L)},[L]),m.useEffect(()=>{Od(r)||z(r)},[r]);const tr=m.useCallback(Re=>{const Me=typeof Re=="function"?Re(r):Re;!l&&te&&Od(Me)?r===Me?(ve.current=ke.current?.getBoundingClientRect()??null,R(Ze=>Ze==="split"?"full":"split")):R("split"):(R("split"),z(Me)),n(Me)},[r,te,l,n]),Fe=m.useCallback(Re=>{if(!ye.current||!fe)return;Re.preventDefault(),Re.currentTarget.setPointerCapture?.(Re.pointerId),F(!0);const Me=yt=>{const zt=ye.current?.getBoundingClientRect();if(!zt||zt.width<=0)return;const Ue=(zt.right-yt)/zt.width*100;D(bie(Ue))};Me(Re.clientX);const Ze=yt=>{Me(yt.clientX)},xt=()=>{F(!1),window.removeEventListener("pointermove",Ze),window.removeEventListener("pointerup",xt),window.removeEventListener("pointercancel",xt)};window.addEventListener("pointermove",Ze),window.addEventListener("pointerup",xt,{once:!0}),window.addEventListener("pointercancel",xt,{once:!0})},[fe]);return m.useLayoutEffect(()=>{const Re=ve.current,Me=ke.current;if(!Re||!Me||ON()){ve.current=null;return}const Ze=Me.getBoundingClientRect();if(Ze.width<=0||Ze.height<=0){ve.current=null;return}const xt=Re.left-Ze.left,yt=Re.width/Ze.width;Ln.fromTo(Me,{x:xt,scaleX:yt,opacity:.94,transformOrigin:"right center"},{x:0,scaleX:1,opacity:1,duration:yr.duration.enter,ease:yr.ease.soft,clearProps:"transform,opacity,transformOrigin"}),ve.current=null},[j,de]),m.useEffect(()=>{de||F(!1)},[de]),m.useEffect(()=>{if(!fe||ON())return;const Re=he.current,Me=ke.current;if(!Re||!Me)return;const Ze=Ln.context(()=>{Ln.fromTo(Re,{opacity:.92,x:-14},{opacity:1,x:0,duration:yr.duration.base,ease:yr.ease.out,clearProps:"transform,opacity"}),Ln.fromTo(Me,{opacity:0,x:28,scaleX:.96,transformOrigin:"right center"},{opacity:1,x:0,scaleX:1,duration:yr.duration.enter,ease:yr.ease.soft,clearProps:"transform,opacity,transformOrigin"})},ye);return()=>Ze.revert()},[me,fe]),m.useEffect(()=>{rt&&rt.detectedAt!==bt.current&&(bt.current=rt.detectedAt,nt(rt.path))},[rt]),m.useEffect(()=>{if(!ct||ct.detectedAt===Nt.current||(Nt.current=ct.detectedAt,N.autoShowAgentDiff==="off"))return;const{path:Re,diffInfo:Me}=ct,Ze=je?.path?.replace(/\\/g,"/"),xt=Re.replace(/\\/g,"/");if(Ze===xt){U(Re,Me);return}N.autoShowAgentDiff==="always"&&(U(Re,Me),!l&&te&&R("split"),n("files"))},[ct,N.autoShowAgentDiff,je?.path,U,l,te,n]),m.useEffect(()=>{if(!st)return;const Re=window.setTimeout(()=>nt(null),7e3);return()=>window.clearTimeout(Re)},[st]),d?i.jsx(Dg,{mode:"loading",isMobile:l,onMenuClick:c}):!e&&r==="controlRoom"?i.jsxs("div",{className:"flex h-full flex-col",children:[i.jsx(LN,{activeTab:r,setActiveTab:tr,selectedProject:null,selectedSession:null,liveViewAvailable:!1,activeSidePanelTab:null,sidePanelMode:j,canUseSidePanelSplit:te,isMobile:l,onMenuClick:c}),i.jsx("div",{className:"flex min-h-0 flex-1 overflow-hidden",children:i.jsx("div",{className:"flex min-h-0 min-w-0 flex-1 flex-col overflow-hidden",children:i.jsx(Ig,{selectedProject:null})})})]}):e?i.jsxs("div",{className:"flex h-full flex-col",children:[i.jsx(LN,{activeTab:r,setActiveTab:tr,selectedProject:e,selectedSession:t,liveViewAvailable:V,activeSidePanelTab:me,sidePanelMode:j,canUseSidePanelSplit:te,isMobile:l,onCloseSidePanel:me?Vt:void 0,onMenuClick:c}),i.jsxs("div",{className:"flex min-h-0 flex-1 overflow-hidden",children:[i.jsxs("div",{ref:ce,className:xe("flex min-h-0 min-w-[200px] flex-1 flex-col overflow-hidden",ae&&"hidden",!je&&!me&&!de&&"mx-auto w-full max-w-[1100px] px-4 md:px-8",!je&&me&&!fe&&"w-full px-3 md:px-4",!je&&fe&&"w-full px-3 md:px-4",!je&&r==="orchestration"&&"max-w-none px-0 md:px-0",!je&&r==="remote"&&"max-w-none px-0 md:px-0",!je&&r==="controlRoom"&&"max-w-none px-0 md:px-0"),children:[(Z||W||me)&&i.jsxs("div",{ref:ye,className:xe("h-full min-h-0",fe&&"flex overflow-hidden",B&&"select-none"),children:[Z&&i.jsx("div",{ref:he,className:xe("min-h-0 overflow-hidden",fe&&"min-w-[320px] flex-none transition-[width,opacity,transform] duration-300 ease-out",B&&"transition-none",!fe&&"h-full"),style:fe?{width:`${100-C}%`}:void 0,children:i.jsx("div",{className:"flex h-full min-h-0 min-w-0 flex-1",children:i.jsx("div",{className:"min-h-0 min-w-0 flex-1 overflow-hidden",children:i.jsx(pie,{showDetails:!0,children:i.jsx($ee,{selectedProject:e,selectedSession:t,ws:a,sendMessage:s,latestMessage:o,onFileOpen:U,onInputFocusChange:u,onSessionActive:p,onSessionInactive:f,onSessionProcessing:h,onSessionNotProcessing:g,processingSessions:b,onReplaceTemporarySession:x,onNavigateToSession:y,onShowSettings:v,autoExpandTools:E,showRawParameters:I,showThinking:A,autoScrollToBottom:T,sendByCtrlEnter:_,externalMessageUpdate:w})})})})}),W&&i.jsx("div",{ref:he,className:xe("min-h-0 overflow-hidden",fe&&"min-w-[320px] flex-none transition-[width,opacity,transform] duration-300 ease-out",B&&"transition-none"),style:fe?{width:`${100-C}%`}:void 0,children:i.jsx("div",{className:"flex h-full min-h-0 min-w-0 flex-1",children:i.jsx("div",{className:"min-h-0 min-w-0 flex-1 overflow-hidden",children:i.jsx(tN,{selectedProject:e})})})}),fe&&i.jsxs("button",{type:"button",className:"group relative z-20 mx-1 flex w-3 shrink-0 cursor-col-resize touch-none items-center justify-center rounded-full focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/40",onPointerDown:Fe,"aria-label":"Resize side panel",title:"Drag to resize",children:[i.jsx("span",{className:"absolute inset-y-3 -left-2 -right-2 rounded-full"}),i.jsx("span",{className:xe("h-16 w-1 rounded-full bg-border transition-all duration-200 group-hover:h-24 group-hover:bg-foreground/40",B&&"h-28 bg-foreground/55 shadow-[0_0_18px_rgba(120,120,120,0.22)]")})]}),me&&i.jsx("div",{ref:ke,className:xe("min-h-0 overflow-hidden rounded-lg border border-border/60 bg-card/40",fe&&"min-w-[360px] flex-none shadow-sm transition-[width,opacity,transform] duration-300 ease-out",B&&"transition-none",!fe&&"h-full w-full"),style:fe?{width:`${C}%`}:void 0,children:br(me)})]}),!me&&r==="orchestration"&&i.jsx("div",{className:"flex h-full min-h-0 min-w-0 overflow-hidden",children:i.jsx("div",{className:"min-h-0 min-w-0 flex-1 overflow-hidden",children:i.jsx(tN,{selectedProject:e})})}),!me&&r==="remote"&&i.jsx("div",{className:"flex h-full min-h-0 min-w-0 overflow-hidden",children:i.jsx("div",{className:"min-h-0 min-w-0 flex-1 overflow-hidden",children:i.jsx($I,{})})}),!me&&r==="controlRoom"&&i.jsx("div",{className:"flex h-full min-h-0 min-w-0 overflow-hidden",children:i.jsx("div",{className:"min-h-0 min-w-0 flex-1 overflow-hidden",children:i.jsx(Ig,{selectedProject:e})})}),i.jsx("div",{className:`h-full overflow-hidden ${r==="preview"?"block":"hidden"}`}),r.startsWith("plugin:")&&i.jsx("div",{className:"h-full overflow-hidden",children:i.jsx(qI,{pluginName:r.replace("plugin:",""),selectedProject:e,selectedSession:t})})]}),!ne&&i.jsx(PN,{editingFile:je,isMobile:l,editorExpanded:ae,editorWidth:M,hasManualWidth:ue,resizeHandleRef:Y,onResizeStart:re,onCloseEditor:Q,onToggleEditorExpand:J,projectPath:e.path,fillSpace:r==="files"})]}),i.jsx(une,{})]}):i.jsx(Dg,{mode:"empty",isMobile:l,onMenuClick:c,onQuickStartSession:k,onQuickStartOrchestration:S,onOpenControlRoom:()=>n("controlRoom")})}const yie=cn.memo(xie),xi="hermes --yolo",vie="hermes sessions browse",wie="hermes model",kie="hermes cron list",Sie="hermes status --deep",Cie=260,Nie=520,Eie=340,Tie=320,Aie=680,jie=420,Iie=150,Rie=560,_ie=256,w6="pixcode.workbench.workspaceTabs.v1",k6="pixcode.workbench.cliState.v1",S6="pixcode.workbench.editorState.v1",C6="pixcode.workbench.hermesState.v1",Tw=10,Aw=["claude","codex","cursor","gemini","qwen","opencode"],N6=30;function ef(e,t,r){return Math.min(r,Math.max(t,e))}function Il(e){return e==="remote"||e==="controlRoom"||e.startsWith("plugin:")}function Pie(e){return e==="git"||e==="changes"?"sourceControl":"explorer"}function Fr(e){return e.fullPath||e.path||e.displayName||e.name}function Bu(e){const t=Fr(e),n=t.replace(/\\/g,"/").split("/").filter(Boolean);return n.length===0?t||e.name:`/${n[n.length-1]}`}function E6(e,t){return typeof e!="number"||!Number.isFinite(e)?t("vscodeWorkbench.projects.fileCountPending",{defaultValue:"Files pending"}):t("vscodeWorkbench.projects.fileCount",{count:e,formattedCount:e.toLocaleString(),defaultValue:"{{formattedCount}} files"})}function ds(e){return(e.fullPath||e.path||e.name).replace(/\\/g,"/")}function io(e){return e?Fr(e).replace(/\\/g,"/"):null}function Lie(e){return e?Fr(e).replace(/\\/g,"/"):null}function Die(e){return typeof e=="string"&&Aw.includes(e)}function Oie(e){if(!e||typeof e!="object"||Array.isArray(e))return!1;const t=e;return typeof t.name=="string"&&typeof t.path=="string"}function Mie(){if(typeof window>"u")return[];try{const e=JSON.parse(window.localStorage.getItem(w6)??"[]");return Array.isArray(e)?e.filter(t=>typeof t.id=="string"&&typeof t.projectName=="string").slice(0,Tw):[]}catch{return[]}}function Fie(e){if(!(typeof window>"u"))try{window.localStorage.setItem(w6,JSON.stringify(e.slice(0,Tw)))}catch{}}function T6(){if(typeof window>"u")return{};try{const e=JSON.parse(window.localStorage.getItem(k6)??"{}");return!e||typeof e!="object"||Array.isArray(e)?{}:e}catch{return{}}}function zie(e){if(!e)return null;const t=T6()[e];return!t||!Die(t.provider)?null:{provider:t.provider,isTerminalOpen:!!t.isTerminalOpen,sessionId:typeof t.sessionId=="string"?t.sessionId:null,updatedAt:typeof t.updatedAt=="number"?t.updatedAt:Date.now()}}function Bie(e,t){if(!(!e||typeof window>"u"))try{const r=T6();window.localStorage.setItem(k6,JSON.stringify({...r,[e]:t}))}catch{}}function A6(){if(typeof window>"u")return{};try{const e=JSON.parse(window.localStorage.getItem(S6)??"{}");return!e||typeof e!="object"||Array.isArray(e)?{}:e}catch{return{}}}function Uie(e){if(!e)return null;const t=A6()[e];if(!t||!Array.isArray(t.tabs))return null;const r=t.tabs.filter(Oie).slice(0,N6),n=typeof t.activePath=="string"&&r.some(s=>s.path===t.activePath)?t.activePath:r[0]?.path??null,a=typeof t.splitPath=="string"&&r.some(s=>s.path===t.splitPath)?t.splitPath:null;return{tabs:r,activePath:n,splitPath:a,updatedAt:typeof t.updatedAt=="number"?t.updatedAt:Date.now()}}function $ie(e,t){if(!(!e||typeof window>"u"))try{const r=A6();window.localStorage.setItem(S6,JSON.stringify({...r,[e]:{...t,tabs:t.tabs.slice(0,N6)}}))}catch{}}function j6(){if(typeof window>"u")return{};try{const e=JSON.parse(window.localStorage.getItem(C6)??"{}");return!e||typeof e!="object"||Array.isArray(e)?{}:e}catch{return{}}}function Hie(e){if(!e)return null;const t=j6()[e];return!t||typeof t!="object"?null:{isOpen:!!t.isOpen,viewMode:t.viewMode==="full"?"full":"half",command:typeof t.command=="string"&&t.command.trim()?t.command:xi,title:typeof t.title=="string"&&t.title.trim()?t.title:null,updatedAt:typeof t.updatedAt=="number"?t.updatedAt:Date.now()}}function Md(e,t){if(!(!e||typeof window>"u"))try{const r=j6();window.localStorage.setItem(C6,JSON.stringify({...r,[e]:t}))}catch{}}function Gie(e,t){return{id:ds(e),projectName:e.name,path:Fr(e),label:t,starred:!1}}function Uu(e){return typeof e.summary=="string"&&e.summary||typeof e.title=="string"&&e.title||typeof e.name=="string"&&e.name||e.id}function Og(e){return typeof e.updated_at=="string"&&e.updated_at||typeof e.lastActivity=="string"&&e.lastActivity||typeof e.created_at=="string"&&e.created_at||typeof e.createdAt=="string"&&e.createdAt||null}function MN(e){const t=Og(e);if(!t)return"";const r=new Date(t);return Number.isNaN(r.getTime())?"":new Intl.DateTimeFormat(void 0,{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"}).format(r)}function Vie({sidebarProps:e,selectedProject:t,selectedSession:r,activeTab:n,setActiveTab:a,latestMessage:s,onMenuClick:o,isLoading:l,onShowSettings:c,onQuickStartSession:d}){const{t:u}=He("common"),p=m.useRef(null),[f,h]=m.useState(Eie),[g,b]=m.useState(jie),[x,y]=m.useState(!1),[v,w]=m.useState(!1),[k,S]=m.useState(null),[N,E]=m.useState(!1),[I,A]=m.useState("shell"),[T,_]=m.useState(0),[j,R]=m.useState(!1),[C,D]=m.useState(null),[B,F]=m.useState(null),[V,K]=m.useState(null),[L,G]=m.useState(_ie),[H,z]=m.useState("half"),[te,se]=m.useState(null),[me,de]=m.useState(null),[ce,ye]=m.useState({state:"idle",log:"",error:null,jobId:null,startAfterInstall:!1}),[he,ke]=m.useState(null),[ve,je]=m.useState(!1),[M,ae]=m.useState(!1),[ue,Y]=m.useState(null),[U,Q]=m.useState(!1),J=Qg("alicomert","pixcode"),{preferences:re}=tp(),{latestDetectedFile:le}=JI(t,s,re.autoShowAgentDiff),[Ee,fe]=m.useState("projects"),[ne,Z]=m.useState(null),[W,pe]=m.useState([]),[Ae,Le]=m.useState(null),[Ge,rt]=m.useState(null),[Ke,ct]=m.useState(null),[st,nt]=m.useState(Mie),[bt,Nt]=m.useState(null),[Pt,Bt]=m.useState(null),Ar=m.useRef(null),Vt=m.useRef(null),br=m.useRef(!1),tr=m.useRef(0),Fe=m.useMemo(()=>Lie(t),[t]),Re=m.useMemo(()=>io(t),[t]),Me=m.useRef(!1),Ze=m.useRef(null),xt=m.useRef(null);m.useEffect(()=>{Il(n)||n==="chat"&&Ee==="projects"||Ee!=="hermes"&&fe(Pie(n))},[n,Ee]),m.useEffect(()=>{if(Ze.current===Fe)return;Ze.current=Fe,Me.current=!0,rt(null),ct(null);const we=Uie(Fe),De=we?.tabs??[];pe(De),Le(we?.activePath??De[0]?.path??null),rt(we?.splitPath?De.find(Ie=>Ie.path===we.splitPath)??null:null)},[Fe]),m.useEffect(()=>{if(Me.current){Me.current=!1;return}if(!Fe)return;const we=Ae&&W.some(Ie=>Ie.path===Ae)?Ae:W[0]?.path??null,De=Ge&&W.some(Ie=>Ie.path===Ge.path)?Ge.path:null;$ie(Fe,{tabs:W,activePath:we,splitPath:De,updatedAt:Date.now()})},[Ae,Fe,W,Ge]),m.useEffect(()=>{t&&nt(we=>{const De=ds(t),Ie=we.find(gt=>gt.id===De);if(Ie)return we.map(gt=>gt.id===De?{...Ie,projectName:t.name,path:Fr(t)}:gt);const Ye=`Workspace ${we.length+1}`;return[...we,Gie(t,Ye)].slice(-Tw)})},[t]),m.useEffect(()=>{Fie(st)},[st]);const yt=m.useCallback((we,De=null)=>{const gt={name:we.replace(/\\/g,"/").split("/").pop()||we,path:we,projectName:t?.name,diffInfo:De};pe(Mt=>{const hr=Mt.findIndex(Cn=>Cn.path===we);if(hr===-1)return[...Mt,gt];const Wn=[...Mt];return Wn[hr]=gt,Wn}),Le(we),a("files")},[t?.name,a]),zt=m.useCallback((we,De)=>{const Ie=we.replace(/\\/g,"/");pe(Ye=>{const gt=Ye.findIndex(hr=>hr.path===Ie);if(gt===-1)return Ye;const Mt=[...Ye];return Mt[gt]={...Mt[gt],diffInfo:De},Mt})},[]),Ue=m.useCallback((we,De)=>{W.some(Ye=>Ye.path===we)?zt(we,De):yt(we,De)},[W,zt,yt]);QI(t,re.autoShowAgentDiff,W.map(we=>we.path),Ue);const Xe=m.useCallback(we=>{const De=we.replace(/\\/g,"/");pe(Ie=>{const Ye=Ie.findIndex(hr=>hr.path===De);if(Ye===-1)return Ie;const gt=Ie[Ye];if(!gt.diffInfo)return Ie;const Mt=[...Ie];return Mt[Ye]={...gt,diffInfo:null},Mt})},[]);m.useEffect(()=>{if(!le||re.autoShowAgentDiff==="off")return;const{path:we,diffInfo:De}=le;if(W.some(Ye=>Ye.path===we)){zt(we,De);return}re.autoShowAgentDiff==="always"&&yt(we,De)},[le,re.autoShowAgentDiff,W,zt,yt]),m.useEffect(()=>{if(typeof window>"u")return;const we=De=>{const Ie=De.detail;typeof Ie?.path=="string"&&Ie.path&&Xe(Ie.path)};return window.addEventListener("pixcode:file-saved",we),()=>{window.removeEventListener("pixcode:file-saved",we)}},[Xe]);const ht=m.useCallback(we=>{pe(De=>{const Ie=De.filter(Ye=>Ye.path!==we);return Le(Ye=>Ye!==we?Ye:Ie[Ie.length-1]?.path??null),Ie})},[]),lt=m.useCallback(()=>{pe([]),Le(null),rt(null),ct(null)},[]),kt=m.useCallback(we=>{navigator.clipboard?.writeText(we),ct(null)},[]),Wt=m.useCallback((we,De=!1)=>{const Ie=W.find(Ye=>Ye.path===we);Ie&&(rt(Ie),De&&pe(Ye=>{const gt=Ye.filter(Mt=>Mt.path!==we);return Le(Mt=>Mt!==we?Mt:gt[gt.length-1]?.path??null),gt}),ct(null))},[W]),ee=m.useCallback((we,De)=>{we.preventDefault(),ct({filePath:De,x:we.clientX,y:we.clientY})},[]),Te=m.useCallback(we=>{Ar.current?.scrollBy({left:we==="left"?-180:180,behavior:"smooth"})},[]),be=m.useCallback((we,De={})=>{const Ie=De.project??t??null,Ye=we==="hermes"?De.command||xi:null,gt=we==="hermes"&&De.title||null;A(we),R(!!De.forceNewSession),D(Ye),F(gt),K(Ie),E(!0),z("half"),_(Mt=>Mt+1),we==="hermes"&&Md(io(Ie),{isOpen:!0,viewMode:"half",command:Ye,title:gt,updatedAt:Date.now()})},[t]),_e=m.useCallback(async()=>{try{const De=await(await Ce("/api/orchestration/hermes/install-status")).json();de({installed:!!De?.installed,command:typeof De?.command=="string"?De.command:null,version:typeof De?.version=="string"?De.version:null,error:typeof De?.error=="string"?De.error:null})}catch{de({installed:!1,command:null,version:null,error:null})}},[]),Ve=m.useCallback(async()=>{je(!0),Y(null);try{const we=new URLSearchParams;t&&we.set("projectPath",Fr(t));const De=we.toString(),Ie=await Ce(`/api/orchestration/hermes/control-plane${De?`?${De}`:""}`),Ye=await Ie.json().catch(()=>null);if(!Ye||!Ie.ok&&!Ye.profiles&&!Ye.capabilities)throw new Error(Ye?.error?.message||Ye?.error||`HTTP ${Ie.status}`);ke(Ye)}catch(we){Y(we instanceof Error?we.message:u("vscodeWorkbench.hermes.controlPlaneFailed",{defaultValue:"Unable to read Hermes control plane."}))}finally{je(!1)}},[t,u]),ot=m.useCallback(async({force:we=!1,startAfterInstall:De=!1}={})=>{try{Vt.current?.close()}catch{}Vt.current=null,be("hermes-install"),ye({state:"running",log:"",error:null,jobId:null,startAfterInstall:De});try{const Ie=await Ce("/api/orchestration/hermes/install",{method:"POST",body:JSON.stringify({force:we,skipBrowser:!0})}),Ye=await Ie.json().catch(()=>({}));if(!Ie.ok||!Ye?.jobId)throw new Error(Ye?.error?.message||Ye?.error||`HTTP ${Ie.status}`);const gt=String(Ye.jobId);ye(Cn=>({...Cn,jobId:gt}));const Mt=window.localStorage.getItem("auth-token")||"",hr=`/api/orchestration/hermes/install/${encodeURIComponent(gt)}/stream${Mt?`?token=${encodeURIComponent(Mt)}`:""}`,Wn=new EventSource(hr);Vt.current=Wn,Wn.addEventListener("log",Cn=>{try{const si=JSON.parse(Cn.data);typeof si.chunk=="string"&&ye(Ls=>({...Ls,log:`${Ls.log}${si.chunk}`}))}catch{}}),Wn.addEventListener("done",Cn=>{try{const si=JSON.parse(Cn.data);if(!si.success)throw new Error(si.error||u("vscodeWorkbench.hermes.installFailed",{defaultValue:"Hermes install failed."}));ye(Ls=>({...Ls,state:"done",error:null})),_e().then(()=>{De&&be("hermes")})}catch(si){ye(Ls=>({...Ls,state:"error",error:si instanceof Error?si.message:u("vscodeWorkbench.hermes.installFailed",{defaultValue:"Hermes install failed."})}))}finally{try{Wn.close()}catch{}Vt.current=null}}),Wn.onerror=()=>{ye(Cn=>Cn.state==="running"?{...Cn,state:"error",error:u("vscodeWorkbench.hermes.installStreamLost",{defaultValue:"Hermes install stream closed early. The install may still be running."})}:Cn)}}catch(Ie){ye({state:"error",log:"",error:Ie instanceof Error?Ie.message:u("vscodeWorkbench.hermes.installFailed",{defaultValue:"Hermes install failed."}),jobId:null,startAfterInstall:De})}},[be,_e,u]);m.useEffect(()=>()=>{try{Vt.current?.close()}catch{}},[]),m.useEffect(()=>{_e()},[_e]),m.useEffect(()=>{Ve()},[Ve,me?.installed]),m.useEffect(()=>{if(xt.current===Re)return;xt.current=Re;const we=Hie(Re);if(!we?.isOpen){I==="hermes"&&(E(!1),K(t??null));return}A("hermes"),R(!1),D(we.command||xi),F(we.title),K(t??null),E(!0),z(we.viewMode),_(De=>De+1)},[I,t,Re]),m.useEffect(()=>{!Pt||!t||Fr(t)===Pt.projectPath&&(Bt(null),be("hermes",{command:Pt.command,title:Pt.title,forceNewSession:Pt.forceNewSession}))},[be,Pt,t]);const tt=m.useMemo(()=>W.find(we=>we.path===Ae)??W[0]??null,[Ae,W]),kr=V??t;m.useEffect(()=>{let we=!1;const De=async()=>{try{const Ye=await Ce("/api/system/update-state",{cache:"no-store"});if(!Ye.ok)return;const gt=await Ye.json();we||Q(!!gt?.state?.pendingRestart)}catch{}};De(),window.addEventListener("focus",De);const Ie=window.setInterval(De,6e4);return()=>{we=!0,window.removeEventListener("focus",De),window.clearInterval(Ie)}},[]);const $t=m.useCallback(()=>{window.dispatchEvent(new CustomEvent(lu,{detail:{updateAvailable:J.updateAvailable,latestVersion:J.latestVersion,currentVersion:J.currentVersion,releaseInfo:J.releaseInfo,installMode:J.installMode}}))},[J]),kn=m.useMemo(()=>[{id:"explorer",icon:qr,label:u("vscodeWorkbench.activity.explorer"),tab:"files"},{id:"projects",icon:Dr,label:u("vscodeWorkbench.activity.projects"),tab:"chat"},{id:"sourceControl",icon:Kr,label:u("vscodeWorkbench.activity.sourceControl"),tab:"git"},{id:"terminal",icon:Rr,label:u("vscodeWorkbench.activity.terminal"),tab:"shell"}],[u]),Jr=m.useMemo(()=>[{id:"controlRoom",icon:$n,label:u("tabs.controlRoom"),tab:"controlRoom"},{id:"remote",icon:ca,label:u("tabs.remote"),tab:"remote"}],[u]),ra=m.useCallback((we,De)=>{De.preventDefault(),De.currentTarget.setPointerCapture?.(De.pointerId),Z(we)},[]);m.useEffect(()=>{if(!ne)return;const we=Ie=>{const Ye=p.current?.getBoundingClientRect();if(Ye){if(ne==="left"){h(ef(Ie.clientX-Ye.left,Cie,Nie));return}if(ne==="bottom"){G(ef(Ye.bottom-Ie.clientY,Iie,Rie));return}b(ef(Ye.right-Ie.clientX,Tie,Aie))}},De=()=>Z(null);return window.addEventListener("pointermove",we),window.addEventListener("pointerup",De,{once:!0}),window.addEventListener("pointercancel",De,{once:!0}),document.body.style.cursor=ne==="bottom"?"ns-resize":"col-resize",document.body.style.userSelect="none",()=>{window.removeEventListener("pointermove",we),window.removeEventListener("pointerup",De),window.removeEventListener("pointercancel",De),document.body.style.cursor="",document.body.style.userSelect=""}},[ne]);const mr=m.useCallback((we,De)=>{if(we==="terminal"){if(!t){fe("projects"),a("chat");return}N&&I==="shell"&&H==="full"?z("half"):N&&I==="shell"?E(!1):be("shell"),n==="shell"&&a("files");return}if(we==="hermes"){fe("hermes"),y(!1),Il(n)&&a("files"),Ve();return}if(fe(we),y(!1),we==="projects"){a("chat");return}(De!=="chat"||!Il(n))&&a(De)},[n,I,H,N,be,Ve,t,a]),ar=m.useCallback((we={})=>{if(!t){const De=e.projects[0];if(De){Bt({projectPath:Fr(De),command:we.command,title:we.title,forceNewSession:we.forceNewSession}),e.onProjectSelect(De),fe("explorer"),a("files");return}fe("projects"),a("chat");return}if(me?.installed!==!0){ot({startAfterInstall:!0});return}be("hermes",we)},[me?.installed,be,t,a,e,ot]),_a=m.useCallback(()=>{if(me?.installed!==!0){ot({startAfterInstall:!0});return}be("hermes",{command:xi,forceNewSession:!0,project:V??t})},[V,me?.installed,be,t,ot]),Ot=m.useCallback(()=>{if(me?.installed!==!0){ot({startAfterInstall:!0});return}be("hermes",{command:vie,title:u("vscodeWorkbench.hermes.history",{defaultValue:"Hermes history"}),forceNewSession:!0,project:V??t})},[V,me?.installed,be,t,ot,u]),ir=m.useCallback(()=>{ot({force:!0})},[ot]),na=m.useCallback(async()=>{if(me?.installed!==!0){ot({startAfterInstall:!0});return}ae(!0),Y(null);try{const we=await Ce("/api/orchestration/hermes/control-plane/repair",{method:"POST",body:JSON.stringify({projectPath:t?Fr(t):void 0,forceRestart:!0})}),De=await we.json().catch(()=>null),Ie=De?.controlPlane??De;if(!Ie||!we.ok&&!Ie.profiles&&!Ie.capabilities)throw new Error(De?.error?.message||De?.error||`HTTP ${we.status}`);ke(Ie)}catch(we){Y(we instanceof Error?we.message:u("vscodeWorkbench.hermes.controlPlaneRepairFailed",{defaultValue:"Unable to repair Hermes control plane."}))}finally{ae(!1),_e()}},[me?.installed,_e,t,ot,u]),Sn=m.useCallback(()=>{ar({command:wie,title:u("vscodeWorkbench.hermes.modelSettings",{defaultValue:"Hermes model"}),forceNewSession:!0,project:t})},[ar,t,u]),Pa=m.useCallback(()=>{ar({command:kie,title:u("vscodeWorkbench.hermes.cronJobs",{defaultValue:"Hermes cron"}),forceNewSession:!0,project:t})},[ar,t,u]),dl=m.useCallback(()=>{ar({command:Sie,title:u("vscodeWorkbench.hermes.deepStatus",{defaultValue:"Hermes status"}),forceNewSession:!0,project:t})},[ar,t,u]),Op=m.useCallback(()=>{I==="hermes"&&Md(io(V),{isOpen:!1,viewMode:"half",command:C||xi,title:B,updatedAt:Date.now()}),E(!1),K(null)},[C,I,V,B]),Mp=m.useCallback(()=>{z("full"),I==="hermes"&&Md(io(V),{isOpen:!0,viewMode:"full",command:C||xi,title:B,updatedAt:Date.now()})},[C,I,V,B]),Fp=m.useCallback(()=>{z("half"),I==="hermes"&&Md(io(V),{isOpen:!0,viewMode:"half",command:C||xi,title:B,updatedAt:Date.now()})},[C,I,V,B]);m.useEffect(()=>{const we=De=>{const Ie=De.detail;if(Ie?.mode==="install"){ir();return}if(Ie?.mode==="command"&&Ie.command){ar({command:Ie.command,title:Ie.title||Ie.command,forceNewSession:!0});return}ar({command:xi})};return window.addEventListener("pixcode:hermes-terminal",we),()=>window.removeEventListener("pixcode:hermes-terminal",we)},[ir,ar]);const Wc=m.useCallback(we=>{a(we)},[a]),ii=m.useCallback(we=>{window.dispatchEvent(new CustomEvent("pixcode:create-project",{detail:{workspaceType:we}}))},[]),da=m.useCallback(we=>{e.onProjectSelect(we),fe("explorer"),a("files")},[a,e]),ul=m.useCallback(we=>{const De=e.projects.find(Ie=>Ie.name===we.projectName||ds(Ie)===we.id);De&&da(De)},[da,e.projects]),pl=m.useCallback(we=>{nt(De=>{const Ie=De.filter(gt=>gt.id!==we);if(t&&ds(t)===we){const gt=Ie[Ie.length-1],Mt=gt?e.projects.find(hr=>hr.name===gt.projectName||ds(hr)===gt.id):null;Mt&&window.setTimeout(()=>da(Mt),0)}return Ie})},[da,t,e.projects]),qc=m.useCallback(we=>{nt(De=>De.filter(Ie=>Ie.id===we))},[]),zp=m.useCallback(()=>{nt([])},[]),Bp=m.useCallback((we,De)=>{const Ie=De.trim();Ie&&nt(Ye=>Ye.map(gt=>gt.id===we?{...gt,label:Ie}:gt))},[]),Up=m.useCallback(we=>{nt(De=>De.map(Ie=>Ie.id===we?{...Ie,starred:!Ie.starred}:Ie))},[]);m.useEffect(()=>{const we=window.localStorage.getItem("auth-token")||"",De=`/api/orchestration/hermes/terminal-launches/stream?after=${tr.current}${we?`&token=${encodeURIComponent(we)}`:""}`,Ie=new EventSource(De),Ye=Mt=>{try{const hr=JSON.parse(Mt.data);if(!hr||typeof hr.id!="number"||hr.id<=tr.current||(tr.current=Math.max(tr.current,hr.id),!br.current))return;const Wn=hr.projectPath?e.projects.find(Cn=>Fr(Cn).replace(/\\/g,"/")===hr.projectPath?.replace(/\\/g,"/")):t;Wn&&Wn!==t&&da(Wn),w(!1),se(hr)}catch{}},gt=Mt=>{try{const hr=JSON.parse(Mt.data);typeof hr.latestId=="number"&&(tr.current=Math.max(tr.current,hr.latestId))}catch{}finally{br.current=!0}};return Ie.addEventListener("terminal-launch",Ye),Ie.addEventListener("ready",gt),()=>{Ie.removeEventListener("terminal-launch",Ye),Ie.removeEventListener("ready",gt),Ie.close()}},[da,t,e.projects]);const $p=()=>Ee==="projects"?i.jsx(ase,{projects:e.projects,selectedProject:t,onProjectSelect:da,onNewSession:e.onNewSession,onOpenProject:()=>ii("existing"),onCloneProject:()=>ii("new"),onRefresh:e.onRefresh,isRefreshing:e.isLoading,t:u}):Ee==="sourceControl"?i.jsx(_I,{selectedProject:t,isMobile:!1,compact:!0,onFileOpen:yt}):Ee==="hermes"?i.jsx(Jie,{project:t,installStatus:me,controlPlane:he,loading:ve,repairing:M,error:ue,onRefresh:()=>void Ve(),onRepair:()=>void na(),onStartHermes:()=>ar(),onNewSession:_a,onHistory:Ot,onInstall:ir,onModel:Sn,onCron:Pa,onStatus:dl,t:u}):i.jsx(Qie,{selectedProject:t,onFileOpen:yt,t:u}),Hp=()=>l?i.jsx(Dg,{mode:"loading",isMobile:!1,onMenuClick:o}):n==="remote"?i.jsx($I,{}):n==="controlRoom"?i.jsx(Ig,{selectedProject:t}):n.startsWith("plugin:")?i.jsx(qI,{pluginName:n.replace("plugin:",""),selectedProject:t,selectedSession:r}):t?tt?i.jsxs("div",{className:"flex h-full min-h-0 flex-col bg-background",children:[i.jsxs("div",{className:"flex h-9 shrink-0 items-center border-b border-border bg-muted/20",children:[i.jsx("button",{type:"button",className:"flex h-full w-8 shrink-0 items-center justify-center border-r border-border text-muted-foreground hover:bg-muted hover:text-foreground",onClick:()=>Te("left"),"aria-label":u("vscodeWorkbench.editor.scrollLeft",{defaultValue:"Scroll tabs left"}),title:u("vscodeWorkbench.editor.scrollLeft",{defaultValue:"Scroll tabs left"}),children:i.jsx(Go,{className:"h-3.5 w-3.5"})}),i.jsx("div",{ref:Ar,className:"flex min-w-0 flex-1 overflow-x-auto [scrollbar-width:none] [&::-webkit-scrollbar]:hidden",children:W.map(we=>{const De=we.path===tt.path;return i.jsxs("button",{type:"button",className:xe("group flex h-9 w-44 shrink-0 items-center gap-2 border-r border-border px-2.5 text-xs transition-colors",De?"bg-background text-foreground":"text-muted-foreground hover:bg-muted/50 hover:text-foreground"),onClick:()=>Le(we.path),onContextMenu:Ie=>ee(Ie,we.path),title:we.path,children:[i.jsx(Dr,{className:"h-3.5 w-3.5 shrink-0"}),i.jsx("span",{className:"min-w-0 flex-1 truncate text-left",children:we.name}),i.jsx("span",{role:"button",tabIndex:0,className:"rounded p-0.5 text-muted-foreground opacity-70 transition hover:bg-muted hover:text-foreground group-hover:opacity-100",onClick:Ie=>{Ie.stopPropagation(),ht(we.path)},onKeyDown:Ie=>{(Ie.key==="Enter"||Ie.key===" ")&&(Ie.preventDefault(),Ie.stopPropagation(),ht(we.path))},"aria-label":u("vscodeWorkbench.editor.closeTab",{file:we.name,defaultValue:"Close {{file}}"}),title:u("vscodeWorkbench.editor.closeTab",{file:we.name,defaultValue:"Close {{file}}"}),children:i.jsx(Ct,{className:"h-3 w-3"})})]},we.path)})}),i.jsx("button",{type:"button",className:"flex h-full w-8 shrink-0 items-center justify-center border-l border-border text-muted-foreground hover:bg-muted hover:text-foreground",onClick:()=>Te("right"),"aria-label":u("vscodeWorkbench.editor.scrollRight",{defaultValue:"Scroll tabs right"}),title:u("vscodeWorkbench.editor.scrollRight",{defaultValue:"Scroll tabs right"}),children:i.jsx(Fn,{className:"h-3.5 w-3.5"})}),i.jsx("button",{type:"button",className:"flex h-full w-8 shrink-0 items-center justify-center border-l border-border text-muted-foreground hover:bg-muted hover:text-foreground",onClick:()=>ct({filePath:tt.path,x:window.innerWidth-220,y:84}),"aria-label":u("vscodeWorkbench.editor.moreActions",{defaultValue:"More tab actions"}),title:u("vscodeWorkbench.editor.moreActions",{defaultValue:"More tab actions"}),children:i.jsx(B4,{className:"h-4 w-4"})})]}),i.jsx("div",{className:"min-h-0 flex-1 overflow-hidden",children:Ge?i.jsxs("div",{className:"flex h-full min-w-0",children:[tt&&i.jsx("div",{className:"min-w-0 flex-1 border-r border-border",children:i.jsx(tc,{file:tt,onClose:()=>ht(tt.path),projectPath:t.path||t.fullPath,isSidebar:!0})}),i.jsxs("div",{className:"min-w-0 flex-1",children:[i.jsxs("div",{className:"flex h-8 items-center justify-between border-b border-border bg-muted/20 px-2",children:[i.jsxs("div",{className:"flex min-w-0 items-center gap-2 text-xs text-muted-foreground",children:[i.jsx(Dr,{className:"h-3.5 w-3.5 shrink-0"}),i.jsx("span",{className:"truncate",children:Ge.name})]}),i.jsx("button",{type:"button",className:"rounded p-1 text-muted-foreground hover:bg-muted hover:text-foreground",onClick:()=>rt(null),"aria-label":u("vscodeWorkbench.editor.closeSplit",{defaultValue:"Close split editor"}),title:u("vscodeWorkbench.editor.closeSplit",{defaultValue:"Close split editor"}),children:i.jsx(Ct,{className:"h-3.5 w-3.5"})})]}),i.jsx("div",{className:"h-[calc(100%-2rem)] min-h-0 overflow-hidden",children:i.jsx(tc,{file:Ge,onClose:()=>rt(null),projectPath:t.path||t.fullPath,isSidebar:!0})})]})]}):i.jsx(tc,{file:tt,onClose:()=>ht(tt.path),projectPath:t.path||t.fullPath,isSidebar:!0})}),Ke&&i.jsx(Yie,{context:Ke,file:W.find(we=>we.path===Ke.filePath)??null,onClose:()=>ct(null),onCloseTab:ht,onCloseAll:lt,onCopyPath:kt,onSplitRight:we=>Wt(we),onSplitMoveRight:we=>Wt(we,!0),t:u})]}):i.jsx("div",{className:"flex h-full items-center justify-center bg-background",children:i.jsxs("div",{className:"max-w-md px-6 text-center",children:[i.jsx(us,{className:"mx-auto mb-4 h-10 w-10 text-muted-foreground/60"}),i.jsx("div",{className:"text-sm font-medium text-foreground",children:u("vscodeWorkbench.editor.emptyTitle")}),i.jsx("p",{className:"mt-2 text-xs leading-5 text-muted-foreground",children:t.displayName||t.name})]})}):i.jsx(ese,{projects:e.projects,onProjectSelect:da,onNewSession:e.onNewSession,onOpenProject:()=>ii("existing"),onCloneProject:()=>ii("new"),onQuickStartSession:d,onOpenHermesAgent:ar,onShowSettings:c,t:u}),Gp=()=>i.jsx(rse,{project:t,session:r,hermesCliLaunch:te,onSessionSelect:e.onSessionSelect,onHeaderContentChange:S,t:u});return i.jsxs("div",{className:"flex h-full min-w-0 flex-1 flex-col overflow-hidden bg-background text-foreground",children:[i.jsx(gT,{...e,isMobile:!1,modalsOnly:!0}),i.jsx(Wie,{t:u,onOpenProject:ii,onActivityPanel:mr,onSystemTab:Wc,onOpenHermesAgent:ar,onShowSettings:c,onQuickStartSession:d}),i.jsx(qie,{tabs:st,projects:e.projects,selectedProject:t,onSelect:ul,onClose:pl,onCloseOthers:qc,onCloseAll:zp,onRename:Bp,onToggleStar:Up,contextMenu:bt,onContextMenuChange:Nt,onAdd:()=>ii("existing"),isCliPanelCollapsed:v,onToggleCliPanel:()=>w(we=>!we),t:u}),i.jsxs("div",{ref:p,className:xe("flex min-h-0 min-w-0 flex-1 overflow-hidden",ne&&"select-none"),children:[i.jsxs("aside",{className:"flex h-full w-12 shrink-0 flex-col border-r border-border bg-muted/30",children:[i.jsx("div",{className:"flex h-11 items-center justify-center border-b border-border",children:i.jsx(Qu,{className:"h-5 w-5 text-primary"})}),i.jsxs("div",{className:"flex flex-1 flex-col items-center gap-1 py-2",children:[kn.map(we=>i.jsx(Rl,{label:we.label,icon:we.icon,active:we.id==="terminal"?N:!x&&Ee===we.id&&!Il(n),onClick:()=>mr(we.id,we.tab)},we.id)),i.jsx(ise,{label:u("vscodeWorkbench.activity.hermes",{defaultValue:"Hermes Agent"}),active:!x&&Ee==="hermes",onClick:()=>mr("hermes","files")}),i.jsx(Rl,{label:U?u("vscodeWorkbench.activity.updateReady",{defaultValue:"Update ready"}):u("vscodeWorkbench.activity.update",{defaultValue:"Update"}),icon:at,active:!1,badge:J.updateAvailable||U,onClick:$t})]}),i.jsxs("div",{className:"flex flex-col items-center gap-1 border-t border-border py-2",children:[Jr.map(we=>i.jsx(Rl,{label:we.label,icon:we.icon,active:n===we.tab,onClick:()=>Wc(we.tab)},we.id)),i.jsx(Rl,{label:u(x?"vscodeWorkbench.activity.showPanel":"vscodeWorkbench.activity.hidePanel"),icon:x?Yu:Ku,active:!1,onClick:()=>y(we=>!we)}),i.jsx(Rl,{label:u("navigation.settings"),icon:Ht,active:!1,onClick:c})]})]}),!x&&i.jsxs(i.Fragment,{children:[i.jsxs("section",{className:"h-full shrink-0 overflow-hidden border-r border-border bg-background",style:{width:f},children:[i.jsx("div",{className:"flex h-10 items-center justify-between border-b border-border px-3",children:i.jsx("div",{className:"truncate text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:u(`vscodeWorkbench.panels.${Ee}`)})}),i.jsx("div",{className:"h-[calc(100%-2.5rem)] min-h-0 overflow-hidden",children:$p()})]}),i.jsx(zN,{label:u("vscodeWorkbench.resize.left"),active:ne==="left",onPointerDown:we=>ra("left",we)})]}),i.jsxs("main",{className:"min-w-0 flex-1 overflow-hidden border-r border-border bg-background",children:[i.jsxs("div",{className:"flex h-10 items-center justify-between border-b border-border px-3",children:[i.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[i.jsx(Xu,{className:"h-4 w-4 text-muted-foreground"}),i.jsx("span",{className:"truncate text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:Il(n)?u(`tabs.${n==="controlRoom"?"controlRoom":n}`):u("vscodeWorkbench.panels.editor")})]}),i.jsx("span",{className:"truncate text-xs text-muted-foreground",children:t?.displayName||t?.name||u("vscodeWorkbench.noProject")})]}),i.jsxs("div",{className:"relative flex h-[calc(100%-2.5rem)] min-h-0 flex-col overflow-hidden",children:[i.jsx("div",{className:xe("min-h-0 flex-1 overflow-hidden",N&&H==="half"&&"border-b border-border"),children:Hp()}),N&&i.jsx(Zie,{project:kr,mode:I,hermesInstallStatus:me,hermesInstallJob:ce,runId:T,forceNewSession:j,command:C,commandTitle:B,height:L,viewMode:H,isActive:!0,onResizeStart:we=>ra("bottom",we),onShowFull:Mp,onShowHalf:Fp,onStartHermes:_a,onOpenHistory:Ot,onInstallHermes:ir,onClose:Op,t:u})]})]}),!v&&i.jsxs(i.Fragment,{children:[i.jsx(zN,{label:u("vscodeWorkbench.resize.right"),active:ne==="right",onPointerDown:we=>ra("right",we)}),i.jsxs("aside",{className:"h-full shrink-0 overflow-hidden bg-background",style:{width:g},children:[i.jsx("div",{className:"flex h-10 items-center justify-between border-b border-border px-3",children:i.jsx("div",{className:"min-w-0 flex-1 overflow-hidden",children:k||i.jsxs("div",{className:"flex min-w-0 items-center gap-1",children:[i.jsx(Ui,{className:"h-4 w-4 text-muted-foreground"}),i.jsx("span",{className:"truncate text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:u("vscodeWorkbench.panels.cli")})]})})}),i.jsx("div",{className:"h-[calc(100%-2.5rem)] min-h-0 overflow-hidden",children:Gp()})]})]})]})]})}function Wie({t:e,onOpenProject:t,onActivityPanel:r,onSystemTab:n,onOpenHermesAgent:a,onShowSettings:s,onQuickStartSession:o}){const[l,c]=m.useState(null),d=m.useMemo(()=>[{label:"File",commands:[{label:e("vscodeWorkbench.menu.openProject",{defaultValue:"Open Project..."}),icon:Bn,type:"existing"},{label:e("vscodeWorkbench.menu.cloneFromGithub",{defaultValue:"Clone Repository..."}),icon:Ju,type:"new"},{label:e("vscodeWorkbench.menu.newChat",{defaultValue:"New Chat"}),icon:Un,action:o},{label:e("navigation.settings"),icon:Ht,action:s}]},{label:"Edit",commands:[{label:e("vscodeWorkbench.menu.newChat",{defaultValue:"New Chat"}),icon:Ut,action:o}]},{label:"Selection",commands:[{label:e("vscodeWorkbench.menu.openProjects",{defaultValue:"Open Projects"}),icon:qr,action:()=>r("projects","chat")}]},{label:"View",commands:[{label:e("vscodeWorkbench.activity.explorer"),icon:qr,action:()=>r("explorer","files")},{label:e("vscodeWorkbench.activity.projects"),icon:Dr,action:()=>r("projects","chat")},{label:e("vscodeWorkbench.activity.sourceControl"),icon:Kr,action:()=>r("sourceControl","git")},{label:e("vscodeWorkbench.activity.hermes",{defaultValue:"Hermes Agent"}),icon:pr,action:()=>r("hermes","files")}]},{label:"Go",commands:[{label:e("tabs.controlRoom"),icon:$n,action:()=>n("controlRoom")},{label:e("tabs.remote"),icon:ca,action:()=>n("remote")}]},{label:"Run",commands:[{label:e("vscodeWorkbench.hermes.title",{defaultValue:"Hermes Agent"}),icon:pr,action:a}]},{label:"Terminal",commands:[{label:e("vscodeWorkbench.panels.cli"),icon:Ui,action:()=>r("terminal","shell")}]},{label:"Help",commands:[{label:e("navigation.settings"),icon:Ht,action:s}]}],[r,o,a,s,n,e]),u=p=>{if(c(null),p.type){t(p.type);return}p.action?.()};return i.jsx("div",{className:"flex h-8 shrink-0 items-center border-b border-border bg-muted/20 px-2 text-xs text-muted-foreground",children:i.jsx("div",{className:"flex h-full items-center gap-0.5",children:d.map(p=>i.jsxs("div",{className:"relative h-full",children:[i.jsxs("button",{type:"button",className:xe("flex h-full items-center gap-1 rounded px-2 transition-colors hover:bg-muted hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/40",l===p.label&&"bg-muted text-foreground"),onClick:()=>c(f=>f===p.label?null:p.label),children:[p.label,i.jsx(Mn,{className:"h-3 w-3"})]}),l===p.label&&i.jsx("div",{className:"absolute left-0 top-full z-50 mt-1 min-w-52 overflow-hidden rounded-md border border-border bg-popover py-1 text-popover-foreground shadow-xl shadow-black/10",children:p.commands.map(f=>{const h=f.icon;return i.jsxs("button",{type:"button",className:"flex w-full items-center gap-2 px-3 py-2 text-left text-xs transition-colors hover:bg-muted focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/40",onClick:()=>u(f),children:[h&&i.jsx(h,{className:"h-3.5 w-3.5 text-muted-foreground"}),i.jsx("span",{className:"truncate",children:f.label})]},f.label)})})]},p.label))})})}function qie({tabs:e,projects:t,selectedProject:r,onSelect:n,onClose:a,onCloseOthers:s,onCloseAll:o,onRename:l,onToggleStar:c,contextMenu:d,onContextMenuChange:u,onAdd:p,isCliPanelCollapsed:f,onToggleCliPanel:h,t:g}){const b=r?ds(r):null,[x,y]=m.useState(null),[v,w]=m.useState(""),k=m.useRef(null),S=m.useMemo(()=>e.map(_=>({tab:_,project:t.find(j=>j.name===_.projectName||ds(j)===_.id)})).filter(_=>!!_.project),[t,e]),N=_=>{u(null),y(_.id),w(_.label)},E=()=>{x&&(l(x,v),y(null),w(""))},I=(_,j)=>{_.preventDefault(),n(j),u({tabId:j.id,x:_.clientX,y:_.clientY})},A=_=>{k.current?.scrollBy({left:_==="left"?-220:220,behavior:"smooth"})},T=d?S.find(_=>_.tab.id===d.tabId)??null:null;return i.jsxs("div",{className:"relative flex h-9 shrink-0 items-center border-b border-border bg-background text-xs",children:[i.jsx("button",{type:"button",className:"flex h-full w-8 shrink-0 items-center justify-center border-r border-border text-muted-foreground hover:bg-muted hover:text-foreground",onClick:()=>A("left"),"aria-label":g("vscodeWorkbench.workspace.scrollLeft",{defaultValue:"Scroll workspaces left"}),title:g("vscodeWorkbench.workspace.scrollLeft",{defaultValue:"Scroll workspaces left"}),children:i.jsx(Go,{className:"h-3.5 w-3.5"})}),i.jsxs("div",{ref:k,className:"flex h-full min-w-0 flex-1 items-center overflow-x-auto [scrollbar-width:none] [&::-webkit-scrollbar]:hidden",children:[S.length===0?i.jsxs("button",{type:"button",onClick:p,className:"flex h-8 min-w-0 items-center gap-2 border-r border-border px-3 text-muted-foreground hover:bg-muted/40 hover:text-foreground",children:[i.jsx(Bn,{className:"h-3.5 w-3.5 shrink-0"}),i.jsx("span",{className:"truncate",children:g("vscodeWorkbench.workspace.openFirst",{defaultValue:"Open a workspace"})})]}):S.map(({tab:_,project:j})=>{const R=_.id===b;return i.jsxs("div",{onContextMenu:C=>I(C,_),className:xe("group relative flex h-8 w-52 shrink-0 items-center border-r border-border px-2 transition-colors",R?"bg-background text-foreground shadow-[inset_0_-2px_0_hsl(var(--primary))]":"text-muted-foreground hover:bg-muted/30 hover:text-foreground"),title:`${_.label} - ${Bu(j)}`,children:[i.jsx("button",{type:"button",onClick:()=>c(_.id),className:xe("mr-1 rounded p-0.5 transition hover:bg-muted",_.starred?"text-amber-500":"text-muted-foreground/60 opacity-0 group-hover:opacity-100"),"aria-label":g("vscodeWorkbench.workspace.toggleStar",{name:_.label,defaultValue:"Star {{name}}"}),title:g("vscodeWorkbench.workspace.toggleStar",{name:_.label,defaultValue:"Star {{name}}"}),children:i.jsx(Ei,{className:"h-3.5 w-3.5"})}),x===_.id?i.jsx("input",{value:v,autoFocus:!0,onChange:C=>w(C.target.value),onBlur:E,onKeyDown:C=>{C.key==="Enter"&&E(),C.key==="Escape"&&(y(null),w(""))},className:"min-w-0 flex-1 rounded border border-primary/40 bg-background px-1 py-0.5 text-xs text-foreground outline-none"}):i.jsxs("button",{type:"button",onClick:()=>n(_),onDoubleClick:()=>N(_),className:"min-w-0 flex-1 text-left",children:[i.jsx("div",{className:"truncate font-medium",children:_.label}),i.jsx("div",{className:"truncate text-[10px] text-muted-foreground",children:Bu(j)})]}),i.jsx("div",{className:"ml-1 flex shrink-0 items-center gap-0.5 opacity-70 group-hover:opacity-100",children:i.jsx("button",{type:"button",onClick:()=>a(_.id),className:"rounded p-0.5 hover:bg-muted hover:text-foreground","aria-label":g("vscodeWorkbench.workspace.close",{name:_.label,defaultValue:"Close {{name}}"}),title:g("vscodeWorkbench.workspace.close",{name:_.label,defaultValue:"Close {{name}}"}),children:i.jsx(Ct,{className:"h-3.5 w-3.5"})})})]},_.id)}),i.jsx("button",{type:"button",onClick:p,className:"flex h-8 w-10 shrink-0 items-center justify-center border-r border-border bg-muted/10 text-muted-foreground transition-colors hover:bg-muted/50 hover:text-foreground","aria-label":g("vscodeWorkbench.workspace.add",{defaultValue:"Add workspace"}),title:g("vscodeWorkbench.workspace.add",{defaultValue:"Add workspace"}),children:i.jsx(Ut,{className:"h-3.5 w-3.5"})})]}),i.jsx("button",{type:"button",className:"flex h-full w-8 shrink-0 items-center justify-center border-l border-border text-muted-foreground hover:bg-muted hover:text-foreground",onClick:()=>A("right"),"aria-label":g("vscodeWorkbench.workspace.scrollRight",{defaultValue:"Scroll workspaces right"}),title:g("vscodeWorkbench.workspace.scrollRight",{defaultValue:"Scroll workspaces right"}),children:i.jsx(Fn,{className:"h-3.5 w-3.5"})}),i.jsx("button",{type:"button",className:xe("flex h-full w-10 shrink-0 items-center justify-center border-l border-border text-muted-foreground transition hover:bg-muted hover:text-foreground",f&&"bg-muted/40 text-foreground"),onClick:h,"aria-label":f?g("vscodeWorkbench.cli.showPanel",{defaultValue:"Show CLI panel"}):g("vscodeWorkbench.cli.hidePanel",{defaultValue:"Hide CLI panel"}),title:f?g("vscodeWorkbench.cli.showPanel",{defaultValue:"Show CLI panel"}):g("vscodeWorkbench.cli.hidePanel",{defaultValue:"Hide CLI panel"}),children:f?i.jsx(Ku,{className:"h-3.5 w-3.5"}):i.jsx(Yu,{className:"h-3.5 w-3.5"})}),d&&T&&i.jsx(Kie,{context:d,tab:T.tab,onClose:()=>u(null),onRename:()=>N(T.tab),onToggleStar:()=>c(T.tab.id),onCloseTab:()=>a(T.tab.id),onCloseOthers:()=>s(T.tab.id),onCloseAll:o,t:g})]})}function Kie({context:e,tab:t,onClose:r,onRename:n,onToggleStar:a,onCloseTab:s,onCloseOthers:o,onCloseAll:l,t:c}){m.useEffect(()=>{const u=()=>r(),p=f=>{f.key==="Escape"&&r()};return window.addEventListener("mousedown",u),window.addEventListener("keydown",p),()=>{window.removeEventListener("mousedown",u),window.removeEventListener("keydown",p)}},[r]);const d=u=>p=>{p.stopPropagation(),u(),r()};return i.jsxs("div",{className:"fixed z-50 w-48 overflow-hidden rounded-md border border-border bg-popover py-1 text-xs text-popover-foreground shadow-xl shadow-black/10",style:{left:e.x,top:e.y},onMouseDown:u=>u.stopPropagation(),children:[i.jsxs("button",{type:"button",onClick:d(n),className:"flex w-full items-center gap-2 px-3 py-2 text-left hover:bg-muted",children:[i.jsx(F4,{className:"h-3.5 w-3.5"}),c("vscodeWorkbench.workspace.rename",{defaultValue:"Rename"})]}),i.jsxs("button",{type:"button",onClick:d(a),className:"flex w-full items-center gap-2 px-3 py-2 text-left hover:bg-muted",children:[i.jsx(Ei,{className:"h-3.5 w-3.5"}),t.starred?c("vscodeWorkbench.workspace.unstar",{defaultValue:"Unstar"}):c("vscodeWorkbench.workspace.star",{defaultValue:"Star"})]}),i.jsx("div",{className:"my-1 border-t border-border"}),i.jsxs("button",{type:"button",onClick:d(s),className:"flex w-full items-center gap-2 px-3 py-2 text-left hover:bg-muted",children:[i.jsx(Ct,{className:"h-3.5 w-3.5"}),c("vscodeWorkbench.workspace.closeAction",{defaultValue:"Close workspace"})]}),i.jsxs("button",{type:"button",onClick:d(o),className:"flex w-full items-center gap-2 px-3 py-2 text-left hover:bg-muted",children:[i.jsx(Ku,{className:"h-3.5 w-3.5"}),c("vscodeWorkbench.workspace.closeOthers",{defaultValue:"Close others"})]}),i.jsxs("button",{type:"button",onClick:d(l),className:"flex w-full items-center gap-2 px-3 py-2 text-left text-red-600 hover:bg-muted dark:text-red-300",children:[i.jsx(Ct,{className:"h-3.5 w-3.5"}),c("vscodeWorkbench.workspace.closeAll",{defaultValue:"Close all"})]})]})}function Yie({context:e,file:t,onClose:r,onCloseTab:n,onCloseAll:a,onCopyPath:s,onSplitRight:o,onSplitMoveRight:l,t:c}){if(m.useEffect(()=>{const u=()=>r(),p=f=>{f.key==="Escape"&&r()};return window.addEventListener("click",u),window.addEventListener("keydown",p),()=>{window.removeEventListener("click",u),window.removeEventListener("keydown",p)}},[r]),!t)return null;const d=[{id:"close",label:c("vscodeWorkbench.editor.context.close",{defaultValue:"Close"}),icon:Ct,action:()=>n(t.path)},{id:"closeAllTabs",label:c("vscodeWorkbench.editor.context.closeAll",{defaultValue:"Close All"}),icon:Ct,action:a},{id:"copyPath",label:c("vscodeWorkbench.editor.context.copyPath",{defaultValue:"Copy Path"}),icon:Eo,action:()=>s(t.path)},{id:"splitRight",label:c("vscodeWorkbench.editor.context.splitRight",{defaultValue:"Split Right"}),icon:Qu,action:()=>o(t.path)},{id:"splitMoveRight",label:c("vscodeWorkbench.editor.context.splitMoveRight",{defaultValue:"Split and Move Right"}),icon:Yu,action:()=>l(t.path)}];return i.jsxs("div",{className:"fixed z-[80] w-56 overflow-hidden rounded-md border border-border bg-popover py-1 text-xs text-popover-foreground shadow-xl shadow-black/15",style:{left:e.x,top:e.y},onClick:u=>u.stopPropagation(),children:[i.jsxs("div",{className:"border-b border-border px-3 py-2 text-[11px] text-muted-foreground",children:[i.jsx("div",{className:"truncate font-medium text-foreground",children:t.name}),i.jsx("div",{className:"truncate font-mono",children:t.path})]}),d.map(u=>{const p=u.icon;return i.jsxs("button",{type:"button",onClick:u.action,className:"flex w-full items-center gap-2 px-3 py-2 text-left hover:bg-muted",children:[i.jsx(p,{className:"h-3.5 w-3.5 text-muted-foreground"}),u.label]},u.id)})]})}function Zie({project:e,mode:t,hermesInstallStatus:r,hermesInstallJob:n,runId:a,forceNewSession:s,command:o,commandTitle:l,height:c,viewMode:d,isActive:u,onResizeStart:p,onShowFull:f,onShowHalf:h,onStartHermes:g,onOpenHistory:b,onInstallHermes:x,onClose:y,t:v}){const w=t==="hermes"||t==="hermes-install",k=r?.installed===!0,S=t==="hermes-install"?v("vscodeWorkbench.hermes.installTitle",{defaultValue:"Install Hermes Agent"}):t==="hermes"?l||v("vscodeWorkbench.hermes.title",{defaultValue:"Hermes Agent"}):v("vscodeWorkbench.terminal.title",{defaultValue:"Terminal"}),N=o||"hermes",E=d==="full";return i.jsxs("section",{className:xe("relative overflow-hidden bg-gray-950 text-gray-100",E?"absolute inset-0 z-30":"shrink-0"),style:{height:E?"100%":c},children:[!E&&i.jsx("button",{type:"button",className:"absolute inset-x-0 top-0 z-10 h-1 cursor-ns-resize bg-transparent hover:bg-blue-500/40",onPointerDown:p,"aria-label":v("vscodeWorkbench.terminal.resize",{defaultValue:"Resize terminal"}),title:v("vscodeWorkbench.terminal.resize",{defaultValue:"Resize terminal"})}),i.jsxs("div",{className:"flex h-8 items-center justify-between border-b border-gray-800 bg-gray-900 px-3",children:[i.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[w?i.jsx(wc,{className:"h-4 w-4"}):i.jsx(Rr,{className:"h-3.5 w-3.5 text-blue-300"}),i.jsx("span",{className:"truncate text-[11px] font-semibold uppercase tracking-wide text-gray-300",children:S}),i.jsx("span",{className:"truncate font-mono text-[10px] text-gray-500",children:e?Fr(e):v("vscodeWorkbench.noProject")}),w&&k&&i.jsx("span",{className:"rounded bg-emerald-500/15 px-1.5 py-0.5 text-[10px] font-medium text-emerald-200",children:v("vscodeWorkbench.hermes.mcpLive",{defaultValue:"Pixcode MCP Live"})})]}),i.jsxs("div",{className:"flex shrink-0 items-center gap-1",children:[w&&i.jsxs(i.Fragment,{children:[!k&&i.jsx("button",{type:"button",className:"rounded p-1 text-gray-400 hover:bg-gray-800 hover:text-gray-100",onClick:x,"aria-label":v("vscodeWorkbench.hermes.install",{defaultValue:"Install"}),title:v("vscodeWorkbench.hermes.install",{defaultValue:"Install"}),children:i.jsx(zn,{className:"h-3.5 w-3.5"})}),i.jsx("button",{type:"button",className:"rounded p-1 text-gray-400 hover:bg-gray-800 hover:text-gray-100",onClick:b,"aria-label":v("vscodeWorkbench.hermes.history",{defaultValue:"Hermes history"}),title:v("vscodeWorkbench.hermes.history",{defaultValue:"Hermes history"}),children:i.jsx(Ii,{className:"h-3.5 w-3.5"})}),i.jsx("button",{type:"button",className:"rounded p-1 text-gray-400 hover:bg-gray-800 hover:text-gray-100",onClick:g,"aria-label":v("vscodeWorkbench.hermes.newSession",{defaultValue:"New Hermes session"}),title:v("vscodeWorkbench.hermes.newSession",{defaultValue:"New Hermes session"}),children:i.jsx(Ut,{className:"h-3.5 w-3.5"})})]}),E?i.jsx("button",{type:"button",className:"rounded p-1 text-gray-400 hover:bg-gray-800 hover:text-gray-100",onClick:h,"aria-label":v("vscodeWorkbench.terminal.halfScreen",{defaultValue:"Half screen terminal"}),title:v("vscodeWorkbench.terminal.halfScreen",{defaultValue:"Half screen terminal"}),children:i.jsx(Qu,{className:"h-3.5 w-3.5"})}):i.jsx("button",{type:"button",className:"rounded p-1 text-gray-400 hover:bg-gray-800 hover:text-gray-100",onClick:f,"aria-label":v("vscodeWorkbench.terminal.fullScreen",{defaultValue:"Full screen terminal"}),title:v("vscodeWorkbench.terminal.fullScreen",{defaultValue:"Full screen terminal"}),children:i.jsx(Zu,{className:"h-3.5 w-3.5"})}),i.jsx("button",{type:"button",className:"rounded p-1 text-gray-400 hover:bg-gray-800 hover:text-gray-100",onClick:y,"aria-label":v("vscodeWorkbench.terminal.close",{defaultValue:"Close terminal"}),title:v("vscodeWorkbench.terminal.close",{defaultValue:"Close terminal"}),children:i.jsx(Ct,{className:"h-3.5 w-3.5"})})]})]}),i.jsx("div",{className:"h-[calc(100%-2rem)] min-h-0",children:t==="hermes-install"?i.jsx(Xie,{installJob:n,onRetry:x,onStart:g,t:v}):t==="hermes"?i.jsx(Ao,{project:e,session:null,command:N,isPlainShell:!0,forceNewSession:s,showHeader:!1,autoConnect:!!e,isActive:u,title:S},`hermes-terminal-${e?Fr(e):"none"}-${a}`):i.jsx(Ao,{project:e,session:null,isPlainShell:!0,forceNewSession:s,showHeader:!1,autoConnect:!!e,isActive:u,title:S},`bottom-terminal-${t}-${e?Fr(e):"none"}-${a}`)})]})}function Xie({installJob:e,onRetry:t,onStart:r,t:n}){const a=e.state==="running",s=e.state==="done",o=e.state==="error",l=m.useRef(null);return m.useEffect(()=>{l.current&&(l.current.scrollTop=l.current.scrollHeight)},[e.error,e.log,e.state]),i.jsxs("div",{className:"flex h-full min-h-0 flex-col bg-gray-950",children:[i.jsxs("div",{className:"flex h-9 shrink-0 items-center justify-between border-b border-gray-800 px-3",children:[i.jsxs("div",{className:"flex min-w-0 items-center gap-2 text-[11px] text-gray-300",children:[a?i.jsx(_t,{className:"h-3.5 w-3.5 animate-spin text-emerald-300"}):i.jsx(pr,{className:"h-3.5 w-3.5 text-emerald-300"}),i.jsx("span",{className:"truncate",children:a?n("vscodeWorkbench.hermes.installRunning",{defaultValue:"Installing Hermes through Pixcode API..."}):s?n("vscodeWorkbench.hermes.installDone",{defaultValue:"Hermes installed and Pixcode MCP configured."}):o?n("vscodeWorkbench.hermes.installError",{defaultValue:"Hermes install failed."}):n("vscodeWorkbench.hermes.installReady",{defaultValue:"Ready to install Hermes."})})]}),i.jsxs("div",{className:"flex shrink-0 items-center gap-1",children:[s&&i.jsx("button",{type:"button",className:"rounded bg-emerald-600 px-2 py-1 text-[11px] font-medium text-white hover:bg-emerald-500",onClick:r,children:n("vscodeWorkbench.hermes.start",{defaultValue:"Start Hermes"})}),o&&i.jsx("button",{type:"button",className:"rounded bg-gray-800 px-2 py-1 text-[11px] font-medium text-gray-100 hover:bg-gray-700",onClick:t,children:n("vscodeWorkbench.hermes.retryInstall",{defaultValue:"Retry install"})})]})]}),e.error&&i.jsx("div",{className:"border-b border-red-900/60 bg-red-950/40 px-3 py-2 text-[11px] text-red-100",children:e.error}),i.jsx("pre",{ref:l,className:"min-h-0 flex-1 overflow-auto whitespace-pre-wrap break-words p-3 font-mono text-[11px] leading-5 text-gray-200",children:e.log||n("vscodeWorkbench.hermes.installWaiting",{defaultValue:"Waiting for Hermes install logs..."})})]})}function Jie({project:e,installStatus:t,controlPlane:r,loading:n,repairing:a,error:s,onRefresh:o,onRepair:l,onStartHermes:c,onNewSession:d,onHistory:u,onInstall:p,onModel:f,onCron:h,onStatus:g,t:b}){const x=r?.profiles??[],y=r?.managedProfile??x.find(D=>D.name==="pixcode")??x.find(D=>D.isActive)??x[0]??null,v=r?.activeProfileSummary??x.find(D=>D.isActive)??y,w=t?.installed===!0||r?.install?.installed===!0,k=!!r?.gateway?.running,S=y?.tools?.pixcodeMcpToolCount??v?.tools?.pixcodeMcpToolCount??0,N=y?.tools?.missingPixcodeMcpTools?.length??v?.tools?.missingPixcodeMcpTools?.length??0,E=x.reduce((D,B)=>D+Number(B.sessions?.total||0),0),I=x.reduce((D,B)=>D+Number(B.cron?.total||0),0),A=x.reduce((D,B)=>D+Number(B.cron?.active||0),0),T=r?.capabilities??[],_=r?.recommendations??[],j=y?.sessions?.recent??v?.sessions?.recent??[],R=y?.cron?.recent??v?.cron?.recent??[],C=[v?.model?.provider,v?.model?.default].filter(Boolean).join(" / ");return i.jsxs("div",{className:"flex h-full min-h-0 flex-col bg-background",children:[i.jsxs("div",{className:"shrink-0 border-b border-border p-3",children:[i.jsxs("div",{className:"flex items-start gap-2",children:[i.jsx("span",{className:"flex h-9 w-9 shrink-0 items-center justify-center rounded-md border border-emerald-500/30 bg-emerald-500/10",children:i.jsx(wc,{className:"h-6 w-6"})}),i.jsxs("div",{className:"min-w-0 flex-1",children:[i.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[i.jsx("span",{className:"truncate text-sm font-semibold text-foreground",children:b("vscodeWorkbench.hermes.title",{defaultValue:"Hermes Agent"})}),i.jsx("span",{className:xe("shrink-0 rounded px-1.5 py-0.5 text-[10px] font-medium",r?.ok?"bg-emerald-500/15 text-emerald-700 dark:text-emerald-200":"bg-amber-500/15 text-amber-700 dark:text-amber-200"),children:r?.ok?b("vscodeWorkbench.hermes.controlReady",{defaultValue:"Control ready"}):b("vscodeWorkbench.hermes.needsRepair",{defaultValue:"Needs repair"})})]}),i.jsx("div",{className:"mt-1 truncate font-mono text-[11px] text-muted-foreground",title:e?Fr(e):void 0,children:e?Fr(e):b("vscodeWorkbench.noProject")})]}),i.jsx("button",{type:"button",className:"rounded p-1 text-muted-foreground hover:bg-muted hover:text-foreground",onClick:o,"aria-label":b("vscodeWorkbench.hermes.refreshControl",{defaultValue:"Refresh Hermes control plane"}),title:b("vscodeWorkbench.hermes.refreshControl",{defaultValue:"Refresh Hermes control plane"}),disabled:n,children:i.jsx(at,{className:xe("h-4 w-4",n&&"animate-spin")})})]}),s&&i.jsx("div",{className:"mt-3 rounded border border-amber-500/30 bg-amber-500/10 px-2.5 py-2 text-[11px] leading-5 text-amber-700 dark:text-amber-200",children:s})]}),i.jsxs("div",{className:"min-h-0 flex-1 overflow-y-auto p-3",children:[i.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[i.jsx(Fd,{icon:zn,label:b("vscodeWorkbench.hermes.installState",{defaultValue:"Install"}),value:w?b("vscodeWorkbench.hermes.ready",{defaultValue:"Ready"}):b("vscodeWorkbench.cli.notInstalled",{defaultValue:"Not installed"}),ok:w}),i.jsx(Fd,{icon:ca,label:b("vscodeWorkbench.hermes.restGateway",{defaultValue:"REST"}),value:k?b("common.enabled",{defaultValue:"Enabled"}):b("common.disabled",{defaultValue:"Disabled"}),ok:k}),i.jsx(Fd,{icon:pr,label:b("vscodeWorkbench.hermes.mcpTools",{defaultValue:"MCP tools"}),value:`${S}`,detail:b("vscodeWorkbench.hermes.mcpMissing",{count:N,defaultValue:"{{count}} missing"}),ok:S>0&&N===0}),i.jsx(Fd,{icon:Ii,label:b("vscodeWorkbench.hermes.sessions",{defaultValue:"Sessions"}),value:E.toLocaleString(),detail:b("vscodeWorkbench.hermes.cronSummary",{count:A,total:I,defaultValue:"{{count}}/{{total}} cron active"}),ok:E>0||I>0})]}),i.jsxs("div",{className:"mt-3 rounded-md border border-border bg-card/60 p-3",children:[i.jsxs("div",{className:"flex items-start justify-between gap-2",children:[i.jsxs("div",{className:"min-w-0",children:[i.jsx("div",{className:"text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:b("vscodeWorkbench.hermes.profile",{defaultValue:"Profile"})}),i.jsx("div",{className:"mt-1 truncate text-sm font-semibold text-foreground",children:v?.name||r?.activeProfile||b("vscodeWorkbench.hermes.unknown",{defaultValue:"Unknown"})}),i.jsx("div",{className:"mt-1 truncate font-mono text-[10px] text-muted-foreground",title:v?.path,children:v?.path||"-"})]}),i.jsx("span",{className:xe("shrink-0 rounded px-1.5 py-0.5 text-[10px] font-medium",v?.auth?.configured?"bg-emerald-500/15 text-emerald-700 dark:text-emerald-200":"bg-amber-500/15 text-amber-700 dark:text-amber-200"),children:v?.auth?.configured?b("vscodeWorkbench.hermes.authReady",{defaultValue:"Auth ready"}):b("vscodeWorkbench.hermes.authMissing",{defaultValue:"Auth missing"})})]}),i.jsx("div",{className:"mt-2 truncate text-[11px] text-muted-foreground",children:C||b("vscodeWorkbench.hermes.modelNotSelected",{defaultValue:"No model selected"})})]}),i.jsxs("div",{className:"mt-3 grid gap-2",children:[i.jsxs("button",{type:"button",className:"flex h-8 items-center justify-center gap-1.5 rounded bg-emerald-600 px-2 text-xs font-semibold text-white hover:bg-emerald-500 disabled:cursor-not-allowed disabled:bg-muted disabled:text-muted-foreground",onClick:w?c:p,disabled:a,children:[a?i.jsx(_t,{className:"h-3.5 w-3.5 animate-spin"}):i.jsx(wc,{className:"h-3.5 w-3.5"}),w?b("vscodeWorkbench.hermes.start",{defaultValue:"Start Hermes"}):b("vscodeWorkbench.hermes.install",{defaultValue:"Install"})]}),i.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[i.jsx(Xs,{icon:Ut,label:b("vscodeWorkbench.hermes.newSession",{defaultValue:"New Hermes session"}),onClick:d,disabled:!w}),i.jsx(Xs,{icon:Ii,label:b("vscodeWorkbench.hermes.history",{defaultValue:"Hermes history"}),onClick:u,disabled:!w}),i.jsx(Xs,{icon:Ht,label:b("vscodeWorkbench.hermes.modelSettings",{defaultValue:"Hermes model"}),onClick:f,disabled:!w}),i.jsx(Xs,{icon:pr,label:b("vscodeWorkbench.hermes.cronJobs",{defaultValue:"Hermes cron"}),onClick:h,disabled:!w}),i.jsx(Xs,{icon:ca,label:b("vscodeWorkbench.hermes.deepStatus",{defaultValue:"Hermes status"}),onClick:g,disabled:!w}),i.jsx(Xs,{icon:at,label:b("vscodeWorkbench.hermes.repairControl",{defaultValue:"Repair control"}),onClick:l,disabled:!w||a,loading:a})]})]}),T.length>0&&i.jsxs("div",{className:"mt-4 space-y-1.5",children:[i.jsx("div",{className:"text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:b("vscodeWorkbench.hermes.capabilities",{defaultValue:"Capabilities"})}),T.map(D=>i.jsxs("div",{className:"flex items-start gap-2 rounded border border-border bg-card/50 px-2.5 py-2",children:[D.ready?i.jsx(Gt,{className:"mt-0.5 h-3.5 w-3.5 shrink-0 text-emerald-500"}):i.jsx(tn,{className:"mt-0.5 h-3.5 w-3.5 shrink-0 text-amber-500"}),i.jsxs("div",{className:"min-w-0",children:[i.jsx("div",{className:"truncate text-xs font-medium text-foreground",children:D.label}),D.detail&&i.jsx("div",{className:"mt-0.5 line-clamp-2 text-[11px] leading-4 text-muted-foreground",children:D.detail})]})]},D.id||D.label))]}),j.length>0&&i.jsxs("div",{className:"mt-4 space-y-1.5",children:[i.jsx("div",{className:"text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:b("vscodeWorkbench.hermes.recentSessions",{defaultValue:"Recent sessions"})}),j.slice(0,3).map(D=>i.jsxs("div",{className:"rounded border border-border bg-card/50 px-2.5 py-2",children:[i.jsx("div",{className:"truncate text-xs font-medium text-foreground",children:D.title||D.id||b("mainContent.untitledSession",{defaultValue:"Untitled Session"})}),i.jsxs("div",{className:"mt-0.5 truncate text-[10px] text-muted-foreground",children:[D.model||D.source||"-"," - ",D.messageCount??0," msg"]})]},D.id||D.startedAt))]}),R.length>0&&i.jsxs("div",{className:"mt-4 space-y-1.5",children:[i.jsx("div",{className:"text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:b("vscodeWorkbench.hermes.cronJobs",{defaultValue:"Hermes cron"})}),R.slice(0,3).map(D=>i.jsxs("div",{className:"rounded border border-border bg-card/50 px-2.5 py-2",children:[i.jsxs("div",{className:"flex items-center justify-between gap-2",children:[i.jsx("span",{className:"truncate text-xs font-medium text-foreground",children:D.name||D.id}),i.jsx("span",{className:xe("shrink-0 rounded px-1.5 py-0.5 text-[10px]",D.state==="active"?"bg-emerald-500/15 text-emerald-700 dark:text-emerald-200":"bg-muted text-muted-foreground"),children:D.state||(D.enabled?"active":"paused")})]}),i.jsx("div",{className:"mt-0.5 truncate font-mono text-[10px] text-muted-foreground",children:D.schedule||"-"})]},D.id||D.name))]}),_.length>0&&i.jsxs("div",{className:"mt-4 space-y-1.5",children:[i.jsx("div",{className:"text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:b("vscodeWorkbench.hermes.recommendations",{defaultValue:"Recommendations"})}),_.slice(0,3).map(D=>i.jsx("div",{className:"rounded border border-amber-500/30 bg-amber-500/10 px-2.5 py-2 text-[11px] leading-5 text-amber-700 dark:text-amber-200",children:D},D))]})]})]})}function Fd({icon:e,label:t,value:r,detail:n,ok:a}){return i.jsxs("div",{className:"rounded-md border border-border bg-card/60 p-2",children:[i.jsxs("div",{className:"flex items-center gap-1.5 text-[10px] font-semibold uppercase tracking-wide text-muted-foreground",children:[i.jsx(e,{className:"h-3.5 w-3.5"}),i.jsx("span",{className:"truncate",children:t})]}),i.jsx("div",{className:xe("mt-1 truncate text-sm font-semibold",a?"text-emerald-600 dark:text-emerald-300":"text-amber-600 dark:text-amber-300"),children:r}),n&&i.jsx("div",{className:"mt-0.5 truncate text-[10px] text-muted-foreground",children:n})]})}function Xs({icon:e,label:t,onClick:r,disabled:n=!1,loading:a=!1}){return i.jsxs("button",{type:"button",className:"flex h-8 min-w-0 items-center justify-center gap-1.5 rounded border border-border px-2 text-[11px] font-medium text-foreground hover:bg-muted disabled:cursor-not-allowed disabled:text-muted-foreground disabled:hover:bg-transparent",onClick:r,disabled:n,title:t,children:[a?i.jsx(_t,{className:"h-3.5 w-3.5 animate-spin"}):i.jsx(e,{className:"h-3.5 w-3.5 shrink-0"}),i.jsx("span",{className:"truncate",children:t})]})}function Qie({selectedProject:e,onFileOpen:t,t:r}){return i.jsx("div",{className:"h-full min-h-0 overflow-hidden",children:i.jsx(Ng,{selectedProject:e,onFileOpen:t})})}function ese({projects:e,onProjectSelect:t,onNewSession:r,onOpenProject:n,onCloneProject:a,onQuickStartSession:s,onOpenHermesAgent:o,onShowSettings:l,t:c}){const d=e.slice(0,6);return i.jsx("div",{className:"h-full overflow-auto bg-background",children:i.jsx("div",{className:"mx-auto flex max-w-6xl flex-col gap-6 p-4 sm:p-6",children:i.jsxs("section",{className:"min-w-0",children:[i.jsxs("div",{className:"mb-6",children:[i.jsx("div",{className:"text-xs font-semibold uppercase tracking-wide text-primary",children:"Pixcode"}),i.jsx("h2",{className:"mt-2 text-2xl font-semibold text-foreground",children:c("vscodeWorkbench.welcome.title",{defaultValue:"Hoş geldin"})}),i.jsx("p",{className:"mt-2 max-w-2xl text-sm leading-6 text-muted-foreground",children:c("vscodeWorkbench.welcome.description",{defaultValue:"Bir proje aç, GitHub’dan klonla veya Hermes’i alt terminalde başlat."})})]}),i.jsxs("div",{className:"grid gap-2",style:{gridTemplateColumns:"repeat(auto-fit, minmax(min(100%, 13rem), 1fr))"},children:[i.jsxs("button",{type:"button",onClick:n,className:"group flex min-h-24 flex-col items-start justify-between rounded-md border border-border bg-card p-4 text-left transition hover:border-primary/50 hover:bg-muted/30",children:[i.jsx(Bn,{className:"h-5 w-5 text-blue-400"}),i.jsx("span",{className:"mt-4 text-sm font-semibold text-foreground",children:c("vscodeWorkbench.welcome.openProject",{defaultValue:"Proje Aç"})}),i.jsx("span",{className:"mt-1 text-xs leading-5 text-muted-foreground",children:c("vscodeWorkbench.welcome.openProjectDescription",{defaultValue:"Yerel klasörü workspace olarak bağla."})})]}),i.jsxs("button",{type:"button",onClick:a,className:"group flex min-h-24 flex-col items-start justify-between rounded-md border border-border bg-card p-4 text-left transition hover:border-primary/50 hover:bg-muted/30",children:[i.jsx(Ju,{className:"h-5 w-5 text-foreground"}),i.jsx("span",{className:"mt-4 text-sm font-semibold text-foreground",children:c("vscodeWorkbench.welcome.cloneProject",{defaultValue:"Klonla"})}),i.jsx("span",{className:"mt-1 text-xs leading-5 text-muted-foreground",children:c("vscodeWorkbench.welcome.cloneProjectDescription",{defaultValue:"GitHub reposunu seçtiğin klasöre çek."})})]}),i.jsxs("button",{type:"button",onClick:o,className:"group flex min-h-24 flex-col items-start justify-between rounded-md border border-emerald-700/70 bg-emerald-950/20 p-4 text-left transition hover:border-emerald-400/70 hover:bg-emerald-950/30",children:[i.jsx(wc,{className:"h-5 w-5"}),i.jsx("span",{className:"mt-4 text-sm font-semibold text-foreground",children:c("vscodeWorkbench.welcome.startHermes",{defaultValue:"Hermes’i Başlat"})}),i.jsx("span",{className:"mt-1 text-xs leading-5 text-muted-foreground",children:c("vscodeWorkbench.welcome.startHermesDescription",{defaultValue:"Aktif projede agent terminalini aç."})})]})]}),i.jsx("div",{className:"mt-4 rounded-md border border-border bg-card/70 p-3 sm:p-4",children:i.jsxs("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between",children:[i.jsxs("div",{className:"min-w-0",children:[i.jsx("div",{className:"text-sm font-semibold text-foreground",children:c("vscodeWorkbench.welcome.appearanceTitle",{defaultValue:"Görünüm"})}),i.jsx("p",{className:"mt-1 text-xs leading-5 text-muted-foreground",children:c("vscodeWorkbench.welcome.appearanceDescription",{defaultValue:"Pixcode koyu modla başlar; gerekirse açık moda geçebilirsin."})})]}),i.jsxs("div",{className:"flex shrink-0 flex-wrap items-center gap-2",children:[i.jsxs("div",{className:"flex items-center gap-2 rounded border border-border bg-background px-3 py-2",children:[i.jsx("span",{className:"text-xs font-medium text-foreground",children:c("vscodeWorkbench.welcome.darkMode",{defaultValue:"Koyu mod"})}),i.jsx(uu,{ariaLabel:c("vscodeWorkbench.welcome.themeToggle",{defaultValue:"Tema modunu değiştir"})})]}),i.jsxs("button",{type:"button",onClick:l,className:"inline-flex items-center justify-center gap-2 rounded border border-border px-3 py-2 text-xs font-medium text-foreground hover:bg-muted",children:[i.jsx(Ht,{className:"h-3.5 w-3.5"}),c("vscodeWorkbench.welcome.themeSettings",{defaultValue:"Tema ayarları"})]})]})]})}),i.jsxs("div",{className:"mt-7",children:[i.jsxs("div",{className:"mb-2 flex items-center justify-between gap-3",children:[i.jsx("h3",{className:"text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:c("vscodeWorkbench.welcome.recentProjects",{defaultValue:"Son projeler"})}),s&&i.jsxs("button",{type:"button",onClick:()=>{s()},className:"inline-flex items-center gap-1.5 rounded border border-border px-2.5 py-1.5 text-xs text-muted-foreground hover:bg-muted hover:text-foreground",children:[i.jsx(Un,{className:"h-3.5 w-3.5"}),c("vscodeWorkbench.welcome.newChat",{defaultValue:"Yeni sohbet"})]})]}),d.length>0?i.jsx("div",{className:"grid gap-2 xl:grid-cols-2",children:d.map(f=>i.jsxs("div",{role:"button",tabIndex:0,className:"cursor-pointer rounded-md border border-border bg-card/60 p-3 text-left transition hover:border-primary/40 hover:bg-muted/30 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/40",onClick:()=>t(f),onKeyDown:h=>{(h.key==="Enter"||h.key===" ")&&(h.preventDefault(),t(f))},title:Fr(f),children:[i.jsxs("div",{className:"flex items-start justify-between gap-3",children:[i.jsxs("div",{className:"min-w-0",children:[i.jsx("div",{className:"truncate text-sm font-semibold text-foreground",children:f.displayName||f.name}),i.jsx("div",{className:"mt-1 truncate font-mono text-[11px] text-muted-foreground",children:Bu(f)})]}),i.jsx("span",{className:"shrink-0 rounded bg-muted px-1.5 py-0.5 text-[10px] text-muted-foreground",children:E6(f.fileCount,c)})]}),i.jsxs("div",{className:"mt-3 flex flex-wrap gap-2",children:[i.jsx("span",{className:"rounded bg-primary/10 px-2 py-1 text-[11px] font-medium text-primary",children:c("vscodeWorkbench.projects.workHere",{defaultValue:"Work in this folder"})}),i.jsx("span",{role:"button",tabIndex:0,className:"rounded border border-border px-2 py-1 text-[11px] text-foreground",onClick:h=>{h.stopPropagation(),t(f),r(f)},onKeyDown:h=>{(h.key==="Enter"||h.key===" ")&&(h.preventDefault(),h.stopPropagation(),t(f),r(f))},children:c("vscodeWorkbench.projects.startChat",{defaultValue:"Chat"})})]})]},f.name))}):i.jsxs("div",{className:"rounded-md border border-dashed border-border p-8 text-center",children:[i.jsx(qr,{className:"mx-auto mb-3 h-8 w-8 text-muted-foreground"}),i.jsx("div",{className:"text-sm font-medium text-foreground",children:c("vscodeWorkbench.projects.emptyTitle",{defaultValue:"No project directories yet"})}),i.jsx("p",{className:"mt-2 text-xs text-muted-foreground",children:c("vscodeWorkbench.projects.emptyDescription",{defaultValue:"Open a local folder or clone a repository to start."})})]})]})]})})})}const zd=Aw.map(e=>({id:e,label:dn[e]??e}));function Js(e,t,r){return(e??[]).map(n=>({...n,__provider:n.__provider??t,__projectName:n.__projectName??r}))}function tse(e){return e?[...Js(e.sessions,"claude",e.name),...Js(e.codexSessions,"codex",e.name),...Js(e.cursorSessions,"cursor",e.name),...Js(e.geminiSessions,"gemini",e.name),...Js(e.qwenSessions,"qwen",e.name),...Js(e.opencodeSessions,"opencode",e.name)]:[]}function rse({project:e,session:t,hermesCliLaunch:r,onSessionSelect:n,onHeaderContentChange:a,t:s}){const[o,l]=m.useState(()=>{if(typeof window>"u")return"claude";const W=window.localStorage.getItem("selected-provider");return zd.some(pe=>pe.id===W)?W:"claude"}),[c,d]=m.useState(!1),[u,p]=m.useState(!1),[f,h]=m.useState(null),[g,b]=m.useState(!1),[x,y]=m.useState(!1),[v,w]=m.useState("provider"),[k,S]=m.useState(null),[N,E]=m.useState(null),[I,A]=m.useState(null),[T]=m.useState({runId:0,forceNewSession:!1}),[_,j]=m.useState([]),[R,C]=m.useState(null),[D,B]=m.useState({provider:null,state:"idle",log:"",error:null}),F=m.useRef(null),V=m.useRef(null),{providerAuthStatus:K,refreshProviderAuthStatuses:L}=qu({initialLoading:!1}),G=m.useMemo(()=>tse(e),[e]),H=K[o],z=f?.__provider===o?f:null,te=_.find(W=>W.id===R)||_[0]||null;m.useEffect(()=>{te&&w(te.type)},[te]);const se=f?.id??t?.id??null,me=!!(e&&H?.installed!==!1&&D.state!=="running"),de=!!(e&&(g||_.length>0)&&(te?.type==="plain"||v==="provider"&&me)),ce=m.useMemo(()=>io(e),[e]),ye=m.useRef(null),he=m.useRef(0),ke=m.useCallback((W,pe,Ae=_)=>{if(W==="plain")return`Terminal #${Ae.filter(Ke=>Ke.type==="plain").length+1}`;const Le=pe&&dn[pe]?dn[pe]:pe??"CLI",Ge=Ae.filter(rt=>rt.type==="provider"&&rt.provider===pe).length+1;return`${Le} #${Ge}`},[_]),ve=m.useCallback(W=>{const pe=`cli-${Date.now()}-${Math.random().toString(36).slice(2,8)}`,Ae=`tab_${crypto.randomUUID()}`;return j(Le=>{const Ge={...W,id:pe,tabId:Ae,title:W.title||ke(W.type,W.provider,Le)};return[...Le,Ge]}),C(pe),b(!0),w(W.type==="plain"?"plain":"provider"),pe},[ke]),je=m.useCallback(()=>{ve({type:"plain",provider:void 0,session:null,runId:Date.now(),forceNewSession:!0,startupInput:null,hermesLaunchId:null,permissionOverride:null})},[ve]),M=m.useCallback(W=>{const pe=_.find(Le=>Le.id===W);if(!pe)return;const Ae=window.prompt("CLI tab name",pe.title)?.trim();Ae&&j(Le=>Le.map(Ge=>Ge.id===W?{...Ge,title:Ae}:Ge))},[_]),ae=m.useCallback(W=>{j(pe=>{const Ae=pe.filter(Le=>Le.id!==W);return R===W&&C(Ae[Ae.length-1]?.id||null),Ae.length===0&&b(!1),Ae})},[R]),ue=m.useCallback(()=>{d(!1),p(!0)},[]),Y=m.useCallback(W=>{V.current?.scrollBy({left:W==="left"?-180:180,behavior:"smooth"})},[]),U=m.useMemo(()=>i.jsxs("div",{className:"flex min-w-0 items-center gap-1",children:[_.length===0&&i.jsxs("div",{className:"flex min-w-0 items-center gap-1 pr-1",children:[i.jsx(Ui,{className:"h-4 w-4 shrink-0 text-muted-foreground"}),i.jsx("span",{className:"truncate text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:s("vscodeWorkbench.panels.cli")})]}),_.length>0&&i.jsxs(i.Fragment,{children:[i.jsx("button",{type:"button",className:"flex h-7 w-7 shrink-0 items-center justify-center rounded border border-border text-muted-foreground hover:bg-muted hover:text-foreground",onClick:()=>Y("left"),"aria-label":"Scroll CLI tabs left",title:"Scroll CLI tabs left",children:i.jsx(Go,{className:"h-3.5 w-3.5"})}),i.jsx("div",{ref:V,className:"flex min-w-0 flex-1 items-center gap-1 overflow-x-auto pr-1 [scrollbar-width:none] [&::-webkit-scrollbar]:hidden",children:_.map(W=>{const pe=W.id===(te?.id||R);return i.jsxs("div",{className:xe("group flex h-7 min-w-[112px] max-w-[200px] shrink-0 items-center gap-1.5 rounded border px-2 text-[11px]",pe?"border-primary/50 bg-primary/10 text-foreground":"border-border/70 bg-muted/20 text-muted-foreground hover:bg-muted/40 hover:text-foreground"),children:[i.jsxs("button",{type:"button",className:"flex min-w-0 flex-1 items-center gap-1.5 text-left",onClick:()=>C(W.id),onDoubleClick:()=>M(W.id),title:"Double-click to rename",children:[W.type==="plain"?i.jsx(Rr,{className:"h-3.5 w-3.5 shrink-0 text-muted-foreground"}):i.jsx(er,{provider:W.provider??"claude",className:"h-3.5 w-3.5 shrink-0"}),i.jsx("span",{className:"truncate",children:W.title})]}),i.jsx("button",{type:"button",className:"rounded p-0.5 opacity-60 hover:bg-muted hover:opacity-100",onClick:Ae=>{Ae.stopPropagation(),ae(W.id)},"aria-label":"Close CLI tab",children:i.jsx(Ct,{className:"h-3 w-3"})})]},W.id)})}),i.jsx("button",{type:"button",className:"flex h-7 w-7 shrink-0 items-center justify-center rounded border border-border text-muted-foreground hover:bg-muted hover:text-foreground",onClick:()=>Y("right"),"aria-label":"Scroll CLI tabs right",title:"Scroll CLI tabs right",children:i.jsx(Fn,{className:"h-3.5 w-3.5"})})]}),i.jsx("button",{type:"button",className:"flex h-7 w-7 shrink-0 items-center justify-center rounded border border-border text-muted-foreground hover:bg-muted hover:text-foreground disabled:opacity-50",disabled:!e,onClick:je,title:"New terminal tab",children:i.jsx(Rr,{className:"h-3.5 w-3.5"})}),i.jsx("button",{type:"button",className:"flex h-7 w-7 shrink-0 items-center justify-center rounded border border-border text-muted-foreground hover:bg-muted hover:text-foreground disabled:opacity-50",disabled:!e||D.state==="running",onClick:ue,title:"New CLI tab",children:i.jsx(Ut,{className:"h-3.5 w-3.5"})})]}),[te?.id,R,_,ae,D.state,je,ue,e,M,Y,s]);m.useEffect(()=>(a(U),()=>a(null)),[U,a]),m.useEffect(()=>{const W=zd.map(pe=>pe.id);L(W)},[L]),m.useEffect(()=>{if(ye.current===ce)return;ye.current=ce,d(!1),y(!1),w("provider"),A(null),j([]),C(null);const W=zie(ce);if(!W){b(!1),h(null);return}l(W.provider),window.localStorage.setItem("selected-provider",W.provider);const pe=W.sessionId?G.find(Ae=>Ae.id===W.sessionId&&Ae.__provider===W.provider)??null:null;h(pe),b(W.isTerminalOpen),W.isTerminalOpen&&ve({type:"provider",provider:W.provider,session:pe,runId:Date.now(),forceNewSession:!1,startupInput:null,hermesLaunchId:null,permissionOverride:null})},[ve,ce,G]),m.useEffect(()=>()=>{try{F.current?.close()}catch{}},[]);const Q=m.useCallback(W=>{Bie(ce,{...W,updatedAt:Date.now()})},[ce]),J=m.useCallback(W=>{K[W]?.installed!==!1&&(w("provider"),A(null),l(W),window.localStorage.setItem("selected-provider",W),Q({provider:W,isTerminalOpen:g,sessionId:f?.id??null}))},[g,Q,K,f?.id]),re=m.useCallback(async W=>{B({provider:W,state:"running",log:"",error:null});try{F.current?.close()}catch{}F.current=null;try{const pe=await Ce(`/api/providers/${W}/install`,{method:"POST",body:"{}"}),Ae=await pe.json().catch(()=>({}));if(!pe.ok||!Ae?.success)throw new Error(Ae?.error||`HTTP ${pe.status}`);if(Ae.data?.manual)throw new Error(Ae.data?.message||s("vscodeWorkbench.cli.manualInstall",{defaultValue:"This CLI needs manual installation."}));const Le=Ae.data?.jobId;if(!Le)throw new Error(s("vscodeWorkbench.cli.installNoJob",{defaultValue:"Install did not return a job id."}));const Ge=window.localStorage.getItem("auth-token")||"",rt=`/api/providers/${W}/install/${Le}/stream${Ge?`?token=${encodeURIComponent(Ge)}`:""}`,Ke=new EventSource(rt);F.current=Ke,Ke.addEventListener("log",ct=>{try{const st=JSON.parse(ct.data);typeof st.chunk=="string"&&B(nt=>({...nt,log:`${nt.log}${st.chunk}`}))}catch{}}),Ke.addEventListener("done",ct=>{try{const st=JSON.parse(ct.data);if(!st.success)throw new Error(st.error||s("vscodeWorkbench.cli.installFailed",{defaultValue:"Install failed."}));B(nt=>({...nt,state:"done",error:null})),L([W],{force:!0}),l(W),window.localStorage.setItem("selected-provider",W)}catch(st){B(nt=>({...nt,state:"error",error:st instanceof Error?st.message:s("vscodeWorkbench.cli.installFailed",{defaultValue:"Install failed."})}))}finally{try{Ke.close()}catch{}F.current=null}}),Ke.onerror=()=>{B(ct=>ct.state==="running"?{...ct,state:"error",error:s("vscodeWorkbench.cli.installStreamLost",{defaultValue:"Install stream closed early. The install may still be running."})}:ct)}}catch(pe){B({provider:W,state:"error",log:"",error:pe instanceof Error?pe.message:s("vscodeWorkbench.cli.installFailed",{defaultValue:"Install failed."})})}},[L,s]),le=m.useCallback((W,{forceNewSession:pe=!1}={})=>{!e||K[W]?.installed===!1||D.state==="running"||(w("provider"),S(null),E(null),A(null),h(null),d(!1),p(!1),y(!1),l(W),window.localStorage.setItem("selected-provider",W),b(!0),ve({type:"provider",provider:W,session:null,runId:Date.now(),forceNewSession:pe,startupInput:null,hermesLaunchId:null,permissionOverride:null}),Q({provider:W,isTerminalOpen:!0,sessionId:null}))},[D.state,ve,Q,e,K]),Ee=m.useCallback(({forceNewSession:W=!1}={})=>{le(o,{forceNewSession:W})},[o,le]),fe=m.useCallback(()=>{Ee({forceNewSession:x})},[x,Ee]);m.useEffect(()=>{if(!r||he.current===r.id)return;he.current=r.id;const W=r.provider;if(!Aw.includes(W))return;const pe=r.bypassPermissions===!0||r.skipPermissions===!0,Ae=typeof r.permissionMode=="string"&&r.permissionMode.trim()?r.permissionMode.trim():pe?"bypassPermissions":null;w("provider"),l(W),S(r.startupInput||null),E(r.id),A(Ae||pe?{permissionMode:Ae,skipPermissions:pe}:null),window.localStorage.setItem("selected-provider",W),h(null),d(!1),y(!1),b(!0),ve({type:"provider",provider:W,session:null,runId:Date.now(),forceNewSession:r.forceNewSession===!0,startupInput:r.startupInput||null,hermesLaunchId:r.id,permissionOverride:Ae||pe?{permissionMode:Ae,skipPermissions:pe}:null}),Q({provider:W,isTerminalOpen:!0,sessionId:null})},[r,ve,Q]);const ne=m.useCallback(()=>{if(R){ae(R);return}w("provider"),S(null),E(null),A(null),d(!1),b(!1),y(!1),Q({provider:o,isTerminalOpen:!1,sessionId:f?.id??null})},[R,ae,Q,o,f?.id]),Z=m.useCallback(W=>{const pe=W.__provider??"claude";w("provider"),S(null),E(null),A(null),l(pe),window.localStorage.setItem("selected-provider",pe),h(W),n(W),d(!1),y(!1),b(!0),ve({type:"provider",provider:pe,session:W,runId:Date.now(),forceNewSession:!1,startupInput:null,hermesLaunchId:null,permissionOverride:null,title:Uu(W).slice(0,32)}),Q({provider:pe,isTerminalOpen:!0,sessionId:W.id})},[n,ve,Q]);return g||_.length>0?i.jsxs("div",{className:"relative flex h-full min-h-0 flex-col bg-gray-950 text-gray-100",children:[i.jsx(nse,{project:e,mode:te?.type==="plain"?"plain":"provider",provider:te?.provider||o,session:te?.session||z,historyCount:G.length,historyOpen:c,canStart:me,onToggleHistory:()=>d(W=>!W),onNewSession:ue,onNewPlainShell:je,onCloseTerminal:ne,t:s}),c&&i.jsx("div",{className:"absolute inset-x-2 top-10 z-30 max-h-[48%] overflow-hidden rounded-md border border-gray-800 bg-gray-950 shadow-2xl shadow-black/40",children:i.jsx(FN,{sessions:G,activeSessionId:se,onSessionSelect:Z,t:s})}),u&&i.jsxs("div",{className:"absolute inset-x-2 top-10 z-30 max-h-[58%] overflow-hidden rounded-md border border-gray-800 bg-gray-950 shadow-2xl shadow-black/40",children:[i.jsxs("div",{className:"flex items-center justify-between border-b border-gray-800 px-2.5 py-2",children:[i.jsx("div",{className:"text-[11px] font-semibold uppercase tracking-wide text-gray-400",children:"New CLI tab"}),i.jsx("button",{type:"button",className:"rounded p-1 text-gray-400 hover:bg-gray-800 hover:text-gray-100",onClick:()=>p(!1),children:i.jsx(Ct,{className:"h-3.5 w-3.5"})})]}),i.jsx("div",{className:"grid max-h-72 gap-1 overflow-y-auto p-2",children:zd.map(W=>{const Ae=K[W.id]?.installed===!1,Le=D.provider===W.id&&D.state==="running";return i.jsxs("button",{type:"button",className:xe("flex items-center gap-2 rounded border px-2 py-2 text-left transition-colors",Ae?"border-amber-800/70 bg-amber-950/30 text-amber-100":"border-gray-800 bg-gray-900 text-gray-200 hover:border-blue-500/60 hover:bg-blue-500/10"),onClick:()=>{if(Ae){re(W.id);return}le(W.id,{forceNewSession:!0})},children:[i.jsx(er,{provider:W.id,className:xe("h-4 w-4 shrink-0",Ae&&"opacity-70 grayscale")}),i.jsxs("span",{className:"min-w-0 flex-1",children:[i.jsx("span",{className:"block truncate text-[11px] font-semibold",children:W.label}),i.jsx("span",{className:"block truncate text-[10px] text-gray-500",children:Le?"Installing...":Ae?"Install first":"Open new tab"})]}),i.jsx(Ut,{className:"h-3.5 w-3.5 shrink-0 opacity-70"})]},W.id)})})]}),i.jsx("div",{className:"relative min-h-0 flex-1",children:_.length===0?i.jsx(Ao,{tabId:`fallback-${o}-${T.runId}`,project:e,session:z,provider:o,forceNewSession:T.forceNewSession,startupInput:k,hermesLaunchId:N,permissionOverride:I,showHeader:!0,autoConnect:de,isActive:!0,onClose:ne},`${o}-${z?.id||"new"}-${e?.name||"none"}-${T.runId}`):_.map(W=>i.jsx("div",{className:xe("absolute inset-0",W.id===te?.id?"block":"hidden"),children:i.jsx(Ao,{tabId:W.tabId,project:e,session:W.session,provider:W.provider,isPlainShell:W.type==="plain",forceNewSession:W.forceNewSession,startupInput:W.startupInput,hermesLaunchId:W.hermesLaunchId,permissionOverride:W.permissionOverride,showHeader:!0,autoConnect:de,isActive:W.id===te?.id,onClose:()=>ae(W.id)},`${W.id}-${W.runId}`)},W.id))})]}):i.jsx("div",{className:"flex h-full min-h-0 flex-col bg-gray-950 text-gray-100",children:i.jsxs("div",{className:"flex min-h-0 flex-1 flex-col border-b border-gray-800 bg-gray-900/95 p-2",children:[i.jsxs("div",{className:"mb-2 flex items-center justify-between gap-2",children:[i.jsxs("div",{className:"min-w-0",children:[i.jsx("div",{className:"truncate text-xs font-semibold text-gray-100",children:e?.displayName||e?.name||s("vscodeWorkbench.noProject")}),i.jsx("div",{className:"text-[11px] text-gray-400",children:s("vscodeWorkbench.cli.chooseDescription",{defaultValue:"Choose a CLI, then start a full-height terminal."})})]}),i.jsxs("div",{className:"flex shrink-0 items-center gap-1",children:[i.jsx("button",{type:"button",className:"rounded border border-gray-700 p-1.5 text-gray-200 hover:bg-gray-800 disabled:opacity-50",disabled:!me,onClick:fe,title:s("vscodeWorkbench.cli.newSession",{defaultValue:"New CLI session"}),"aria-label":s("vscodeWorkbench.cli.newSession",{defaultValue:"New CLI session"}),children:i.jsx(Ut,{className:"h-3.5 w-3.5"})}),i.jsx("button",{type:"button",className:xe("rounded border border-gray-700 p-1.5 text-gray-200 hover:bg-gray-800 disabled:opacity-50",c&&"bg-gray-800"),disabled:!e,onClick:()=>d(W=>!W),title:s("vscodeWorkbench.cli.history",{defaultValue:"History"}),"aria-label":s("vscodeWorkbench.cli.history",{defaultValue:"History"}),children:i.jsx(Ii,{className:"h-3.5 w-3.5"})})]})]}),i.jsxs("div",{className:"mb-2 flex items-center gap-2 rounded border border-gray-800 bg-gray-950 px-2.5 py-2",children:[i.jsx(Rr,{className:"h-4 w-4 shrink-0 text-blue-300"}),i.jsxs("div",{className:"min-w-0 flex-1",children:[i.jsx("div",{className:"truncate text-[11px] font-semibold text-gray-200",children:s("vscodeWorkbench.cli.chooseTitle",{defaultValue:"Start a CLI terminal"})}),i.jsx("div",{className:"truncate text-[10px] text-gray-500",children:s("vscodeWorkbench.cli.projectScoped",{defaultValue:"Project-scoped CLI terminal"})})]})]}),i.jsx("div",{className:"grid min-h-0 gap-1.5 overflow-y-auto pr-1",children:zd.map(W=>{const pe=K[W.id],Ae=o===W.id,Le=pe?.installed===!1,Ge=!!pe?.loading,rt=D.provider===W.id&&D.state==="running",Ke=!!(pe?.updateAvailable&&pe.latestVersion&&!Le),ct=rt?s("vscodeWorkbench.cli.installing",{defaultValue:"Installing..."}):Ge?s("vscodeWorkbench.cli.checking",{defaultValue:"Checking..."}):Le?s("vscodeWorkbench.cli.notInstalled",{defaultValue:"Not installed"}):Ke?s("vscodeWorkbench.cli.updateAvailable",{version:pe?.latestVersion,defaultValue:"Update {{version}}"}):pe?.installedVersion||s("vscodeWorkbench.cli.ready",{defaultValue:"Ready"});return i.jsxs("div",{className:xe("group flex min-w-0 items-center gap-2 rounded border px-2 py-2 transition-colors",Ae&&!Le?"border-blue-500 bg-blue-500/15 text-blue-100":"border-gray-800 bg-gray-900 text-gray-300 hover:border-gray-700 hover:bg-gray-800",Le&&"border-amber-800/70 bg-amber-950/30 text-amber-100"),children:[i.jsxs("button",{type:"button",className:"flex min-w-0 flex-1 items-center gap-2 text-left",onClick:()=>{if(Le){re(W.id);return}J(W.id)},title:dn[W.id]??W.label,children:[i.jsx(er,{provider:W.id,className:xe("h-4 w-4 shrink-0",Le&&"opacity-70 grayscale")}),i.jsxs("div",{className:"min-w-0",children:[i.jsx("div",{className:"truncate text-[11px] font-semibold",children:W.label}),i.jsx("div",{className:xe("truncate text-[10px]",Le?"text-amber-300":Ke?"text-amber-200":"text-gray-500"),children:ct})]}),Ae&&!Le&&i.jsx(Gt,{className:"ml-auto h-3.5 w-3.5 shrink-0 text-blue-200"})]}),(Le||Ke)&&i.jsx("button",{type:"button",disabled:rt,className:"flex h-7 w-7 shrink-0 items-center justify-center rounded bg-gray-800 text-amber-200 hover:bg-gray-700 disabled:opacity-50",onClick:()=>void re(W.id),"aria-label":Le?s("vscodeWorkbench.cli.installProvider",{provider:W.label,defaultValue:"Install {{provider}}"}):s("vscodeWorkbench.cli.updateProvider",{provider:W.label,defaultValue:"Update {{provider}}"}),title:Le?s("vscodeWorkbench.cli.installProvider",{provider:W.label,defaultValue:"Install {{provider}}"}):s("vscodeWorkbench.cli.updateProvider",{provider:W.label,defaultValue:"Update {{provider}}"}),children:rt?i.jsx(_t,{className:"h-3.5 w-3.5 animate-spin"}):Le?i.jsx(zn,{className:"h-3.5 w-3.5"}):i.jsx(at,{className:"h-3.5 w-3.5"})})]},W.id)})}),c&&i.jsx(FN,{sessions:G,activeSessionId:se,onSessionSelect:Z,t:s}),(D.state==="running"||D.state==="done"||D.state==="error")&&i.jsxs("div",{className:"mt-2 rounded border border-gray-800 bg-gray-950 p-2",children:[i.jsxs("div",{className:"flex items-center gap-2 text-[11px] text-gray-300",children:[D.state==="running"&&i.jsx(_t,{className:"h-3.5 w-3.5 animate-spin text-amber-300"}),D.state==="done"&&i.jsx(Gt,{className:"h-3.5 w-3.5 text-emerald-300"}),D.state==="error"&&i.jsx(tn,{className:"h-3.5 w-3.5 text-red-300"}),i.jsxs("span",{className:"truncate",children:[D.provider?dn[D.provider]:s("vscodeWorkbench.cli.provider",{defaultValue:"Provider"})," ",D.state==="running"?s("vscodeWorkbench.cli.installRunning",{defaultValue:"is installing"}):D.state==="done"?s("vscodeWorkbench.cli.installDone",{defaultValue:"is ready"}):s("vscodeWorkbench.cli.installError",{defaultValue:"needs attention"})]})]}),D.error&&i.jsx("div",{className:"mt-1 text-[11px] text-red-300",children:D.error}),D.log&&i.jsx("pre",{className:"mt-2 max-h-20 overflow-y-auto rounded bg-black/40 p-2 font-mono text-[10px] leading-relaxed text-gray-300",children:D.log})]}),i.jsxs("button",{type:"button",disabled:!me,onClick:fe,className:"mt-2 flex h-10 w-full items-center justify-center gap-2 rounded bg-blue-600 px-3 text-xs font-semibold text-white transition-colors hover:bg-blue-500 disabled:cursor-not-allowed disabled:bg-gray-800 disabled:text-gray-500",children:[i.jsx(Rr,{className:"h-4 w-4"}),s("vscodeWorkbench.cli.startSelected",{provider:dn[o]??o,defaultValue:"Start {{provider}}"})]})]})})}function nse({project:e,mode:t,provider:r,session:n,historyCount:a,historyOpen:s,canStart:o,onToggleHistory:l,onNewSession:c,onNewPlainShell:d,onCloseTerminal:u,t:p}){const f=t==="plain";return i.jsxs("div",{className:"flex h-10 shrink-0 items-center justify-between gap-2 border-b border-gray-800 bg-gray-900/95 px-2",children:[i.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[f?i.jsx(Rr,{className:"h-4 w-4 shrink-0 text-gray-400"}):i.jsx(er,{provider:r,className:"h-4 w-4 shrink-0"}),i.jsxs("div",{className:"min-w-0",children:[i.jsx("div",{className:"truncate text-[11px] font-semibold text-gray-100",children:f?p("vscodeWorkbench.cli.plainTerminal",{defaultValue:"Terminal"}):dn[r]??r}),i.jsx("div",{className:"truncate text-[10px] text-gray-500",children:n?Uu(n):e?.displayName||e?.name||p("vscodeWorkbench.cli.newSession",{defaultValue:"New CLI session"})})]})]}),i.jsxs("div",{className:"flex shrink-0 items-center gap-1",children:[!f&&i.jsxs("button",{type:"button",className:xe("relative rounded border border-gray-700 p-1.5 text-gray-200 hover:bg-gray-800 disabled:opacity-50",s&&"bg-gray-800"),disabled:!e,onClick:l,title:p("vscodeWorkbench.cli.history",{defaultValue:"History"}),"aria-label":p("vscodeWorkbench.cli.history",{defaultValue:"History"}),children:[i.jsx(Ii,{className:"h-3.5 w-3.5"}),a>0&&i.jsx("span",{className:"absolute -right-1 -top-1 flex h-3.5 min-w-3.5 items-center justify-center rounded-full bg-blue-600 px-0.5 text-[8px] font-semibold text-white",children:Math.min(a,9)})]}),i.jsx("button",{type:"button",className:"rounded border border-gray-700 p-1.5 text-gray-200 hover:bg-gray-800 disabled:opacity-50",disabled:!e,onClick:d,title:p("vscodeWorkbench.cli.newPlainTerminal",{defaultValue:"New terminal"}),"aria-label":p("vscodeWorkbench.cli.newPlainTerminal",{defaultValue:"New terminal"}),children:i.jsx(Rr,{className:"h-3.5 w-3.5"})}),!f&&i.jsx("button",{type:"button",className:"rounded border border-gray-700 p-1.5 text-gray-200 hover:bg-gray-800 disabled:opacity-50",disabled:!o,onClick:c,title:p("vscodeWorkbench.cli.newSession",{defaultValue:"New CLI session"}),"aria-label":p("vscodeWorkbench.cli.newSession",{defaultValue:"New CLI session"}),children:i.jsx(Ut,{className:"h-3.5 w-3.5"})}),i.jsx("button",{type:"button",className:"rounded border border-gray-700 p-1.5 text-gray-200 hover:bg-gray-800",onClick:u,title:p("vscodeWorkbench.cli.closeTerminal",{defaultValue:"Close CLI terminal"}),"aria-label":p("vscodeWorkbench.cli.closeTerminal",{defaultValue:"Close CLI terminal"}),children:i.jsx(Ct,{className:"h-3.5 w-3.5"})})]})]})}function FN({sessions:e,activeSessionId:t,onSessionSelect:r,t:n}){const a=m.useMemo(()=>[...e].sort((s,o)=>{const l=Og(s),c=Og(o);return new Date(c||0).getTime()-new Date(l||0).getTime()}),[e]);return i.jsxs("div",{className:"mt-2 overflow-hidden rounded-md border border-gray-800 bg-gray-950",children:[i.jsxs("div",{className:"flex items-center justify-between border-b border-gray-800 px-2.5 py-2",children:[i.jsx("div",{className:"text-[11px] font-semibold uppercase tracking-wide text-gray-400",children:n("vscodeWorkbench.cli.projectHistory",{defaultValue:"Project history"})}),i.jsx("span",{className:"rounded bg-gray-800 px-1.5 py-0.5 text-[10px] text-gray-400",children:e.length})]}),i.jsx("div",{className:"max-h-52 overflow-y-auto p-1.5",children:a.length===0?i.jsx("div",{className:"px-3 py-4 text-center text-[11px] leading-5 text-gray-500",children:n("vscodeWorkbench.cli.noHistory",{defaultValue:"No sessions for this project yet."})}):a.map(s=>{const o=t===s.id,l=s.__provider??"claude";return i.jsxs("button",{type:"button",className:xe("flex w-full min-w-0 items-center gap-2 rounded px-2.5 py-2 text-left transition-colors hover:bg-gray-900",o&&"bg-blue-500/15 text-blue-100"),onClick:()=>r(s),title:Uu(s),children:[i.jsx(er,{provider:l,className:"h-4 w-4 shrink-0"}),i.jsxs("div",{className:"min-w-0 flex-1",children:[i.jsx("div",{className:"truncate text-[11px] font-medium text-gray-200",children:Uu(s)}),i.jsxs("div",{className:"flex min-w-0 items-center gap-1.5 text-[10px] text-gray-500",children:[i.jsx("span",{className:"truncate",children:dn[l]??l}),MN(s)&&i.jsxs("span",{className:"shrink-0",children:["- ",MN(s)]})]})]})]},`${l}-${s.id}`)})})]})}function ase({projects:e,selectedProject:t,onProjectSelect:r,onNewSession:n,onOpenProject:a,onCloneProject:s,onRefresh:o,isRefreshing:l,t:c}){return i.jsxs("div",{className:"flex h-full min-h-0 flex-col",children:[i.jsx("div",{className:"border-b border-border p-1.5",children:i.jsxs("div",{className:"grid grid-cols-2 gap-1.5",children:[i.jsxs("button",{type:"button",onClick:a,className:"flex min-w-0 items-center justify-center gap-1 rounded border border-border px-2 py-1 text-[11px] font-medium text-foreground transition-colors hover:bg-muted",children:[i.jsx(Bn,{className:"h-3.5 w-3.5 shrink-0"}),i.jsx("span",{className:"truncate",children:c("vscodeWorkbench.projects.openProject",{defaultValue:"Open Project"})})]}),i.jsxs("button",{type:"button",onClick:s,className:"flex min-w-0 items-center justify-center gap-1 rounded border border-border px-2 py-1 text-[11px] font-medium text-foreground transition-colors hover:bg-muted",children:[i.jsx(Ju,{className:"h-3.5 w-3.5 shrink-0"}),i.jsx("span",{className:"truncate",children:c("vscodeWorkbench.projects.cloneFromGithub",{defaultValue:"Clone"})})]})]})}),i.jsxs("div",{className:"flex items-center justify-between border-b border-border px-2.5 py-1.5",children:[i.jsx("span",{className:"text-[11px] font-medium uppercase tracking-wide text-muted-foreground",children:c("vscodeWorkbench.projects.directoryList",{defaultValue:"Directories"})}),i.jsx("button",{type:"button",onClick:()=>{o()},disabled:l,className:"rounded p-1 text-muted-foreground transition-colors hover:bg-muted hover:text-foreground disabled:opacity-50",title:c("vscodeWorkbench.projects.refresh",{defaultValue:"Refresh projects"}),"aria-label":c("vscodeWorkbench.projects.refresh",{defaultValue:"Refresh projects"}),children:i.jsx(at,{className:xe("h-3.5 w-3.5",l&&"animate-spin")})})]}),i.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto p-1.5",children:e.length===0?i.jsx("div",{className:"flex h-full items-center justify-center px-4 text-center",children:i.jsxs("div",{children:[i.jsx(qr,{className:"mx-auto mb-3 h-7 w-7 text-muted-foreground/70"}),i.jsx("div",{className:"text-sm font-medium text-foreground",children:c("vscodeWorkbench.projects.emptyTitle",{defaultValue:"No project directories yet"})}),i.jsx("p",{className:"mt-1 text-xs leading-5 text-muted-foreground",children:c("vscodeWorkbench.projects.emptyDescription",{defaultValue:"Open a local folder or clone a repository to start."})})]})}):i.jsx("div",{className:"space-y-0.5",children:e.map(d=>{const u=t?.name===d.name;return i.jsxs("div",{role:"button",tabIndex:0,className:xe("group w-full cursor-pointer rounded border px-2 py-1.5 text-left transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/40",u?"border-primary/40 bg-primary/10":"border-transparent hover:border-border hover:bg-muted/40"),title:Fr(d),onClick:()=>r(d),onKeyDown:p=>{(p.key==="Enter"||p.key===" ")&&(p.preventDefault(),r(d))},children:[i.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[i.jsx("span",{className:xe("h-1.5 w-1.5 shrink-0 rounded-full",u?"bg-primary":"bg-muted-foreground/30 group-hover:bg-muted-foreground/60")}),i.jsx("span",{className:"truncate text-xs font-medium text-foreground",children:d.displayName||d.name})]}),i.jsxs("div",{className:"mt-0.5 flex min-w-0 items-center justify-between gap-2 pl-3.5 text-[10px] text-muted-foreground",children:[i.jsx("span",{className:"truncate font-mono",children:Bu(d)}),i.jsx("span",{className:"shrink-0",children:E6(d.fileCount,c)})]}),i.jsx("div",{className:"mt-1.5 flex justify-end opacity-0 transition-opacity group-hover:opacity-100 group-focus-visible:opacity-100",children:i.jsx("button",{type:"button",className:"inline-flex h-6 w-6 items-center justify-center rounded border border-border text-foreground",onClick:p=>{p.stopPropagation(),r(d),n(d)},title:c("vscodeWorkbench.projects.startChat",{defaultValue:"Chat"}),"aria-label":c("vscodeWorkbench.projects.startChat",{defaultValue:"Chat"}),children:i.jsx(Un,{className:"h-3 w-3"})})})]},d.name)})})})]})}function Rl({icon:e,label:t,active:r,badge:n=!1,onClick:a}){return i.jsxs("button",{type:"button",className:xe("relative flex h-10 w-10 items-center justify-center rounded-md text-muted-foreground transition-colors hover:bg-muted hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/40",r&&"bg-primary/10 text-primary"),"aria-label":t,title:t,onClick:a,children:[r&&i.jsx("span",{className:"absolute left-0 h-5 w-0.5 rounded-r bg-primary"}),i.jsx(e,{className:"h-5 w-5"}),n&&i.jsx("span",{className:"absolute right-1 top-1 h-2 w-2 rounded-full bg-amber-500 ring-2 ring-background"})]})}function ise({label:e,active:t,onClick:r}){return i.jsxs("button",{type:"button",className:xe("relative flex h-10 w-10 items-center justify-center rounded-md text-muted-foreground transition-colors hover:bg-muted hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/40",t&&"bg-emerald-500/10 text-emerald-500 dark:text-emerald-300"),"aria-label":e,title:e,onClick:r,children:[t&&i.jsx("span",{className:"absolute left-0 h-5 w-0.5 rounded-r bg-emerald-500"}),i.jsx(wc,{className:"h-5 w-5"})]})}function wc({className:e=""}){return i.jsx("img",{src:"/hermes-agent.png",alt:"","aria-hidden":"true",className:xe("rounded object-contain",e)})}function zN({label:e,active:t,onPointerDown:r}){return i.jsx("button",{type:"button",role:"separator","aria-orientation":"vertical","aria-label":e,title:e,className:xe("group relative z-10 flex h-full w-2 shrink-0 cursor-col-resize items-center justify-center bg-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/40",t&&"bg-primary/5"),onPointerDown:r,children:i.jsx("span",{className:xe("h-full w-px bg-border transition-colors group-hover:bg-primary/60",t&&"bg-primary")})})}const I6="pixcode.inAppNotifications.v1",sse="pixcode.notificationPreferences.v1",jw=25;function ose(){try{const e=JSON.parse(localStorage.getItem(I6)??"[]");return Array.isArray(e)?e.slice(0,jw):[]}catch{return[]}}function BN(e){try{localStorage.setItem(I6,JSON.stringify(e.slice(0,jw)))}catch{}}function UN(){try{return JSON.parse(localStorage.getItem(sse)??"null")?.channels?.inApp!==!1}catch{return!0}}function lse(e){if(!e||typeof e!="object")return null;const t=e;return typeof t.id!="string"||typeof t.title!="string"||typeof t.body!="string"?null:{id:t.id,title:t.title,body:t.body,eventType:t.eventType,category:t.category,preferenceKey:t.preferenceKey,kind:t.kind,code:t.code,severity:t.severity||"info",provider:t.provider??null,sessionId:t.sessionId??null,createdAt:t.createdAt||new Date().toISOString(),data:t.data}}function cse(e){return e==="error"?"border-red-500/50 bg-red-50 text-red-950 dark:bg-red-950/35 dark:text-red-50":e==="warning"?"border-amber-500/50 bg-amber-50 text-amber-950 dark:bg-amber-950/35 dark:text-amber-50":"border-border bg-card text-card-foreground"}function dse(e){if(!e)return"";try{return new Intl.DateTimeFormat(void 0,{hour:"2-digit",minute:"2-digit"}).format(new Date(e))}catch{return""}}function use({latestMessage:e}){const[t,r]=m.useState(()=>typeof window>"u"?[]:ose()),[n,a]=m.useState(!1),[s,o]=m.useState(()=>new Set),[l,c]=m.useState(()=>typeof window>"u"?!0:UN());m.useEffect(()=>{const f=()=>c(UN());return window.addEventListener("storage",f),window.addEventListener("pixcode:notification-preferences-changed",f),()=>{window.removeEventListener("storage",f),window.removeEventListener("pixcode:notification-preferences-changed",f)}},[]),m.useEffect(()=>{const f=e;if(!f||f.type!=="notification:event")return;const h=lse(f.notification);h&&(h4({key:h.id,title:h.title,body:h.body,event:h.eventType||h.kind||"updates",tag:typeof h.data?.tag=="string"?h.data.tag:h.id,data:h.data}),l&&(r(g=>{if(g.some(x=>x.id===h.id))return g;const b=[h,...g].slice(0,jw);return BN(b),b}),o(g=>{const b=new Set(g);return b.delete(h.id),b}),a(!0)))},[l,e]);const d=m.useMemo(()=>t.filter(f=>!s.has(f.id)).length,[t,s]),u=m.useCallback(()=>{o(new Set(t.map(f=>f.id)))},[t]),p=m.useCallback(f=>{r(h=>{const g=h.filter(b=>b.id!==f);return BN(g),g}),o(h=>{const g=new Set(h);return g.delete(f),g})},[]);return!l||t.length===0?null:i.jsxs("div",{className:"pointer-events-none fixed bottom-4 right-4 z-40 flex max-w-[calc(100vw-2rem)] flex-col items-end gap-3",children:[n&&i.jsxs("div",{className:"pointer-events-auto w-[min(24rem,calc(100vw-2rem))] overflow-hidden rounded-lg border border-border bg-popover shadow-xl shadow-black/10",children:[i.jsxs("div",{className:"flex items-center justify-between gap-3 border-b border-border px-3 py-2",children:[i.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[i.jsx(pf,{className:"h-4 w-4 flex-shrink-0 text-primary"}),i.jsx("span",{className:"truncate text-sm font-medium text-popover-foreground",children:"Notifications"}),d>0&&i.jsx("span",{className:"rounded-full bg-primary px-2 py-0.5 text-xs font-medium text-primary-foreground",children:d})]}),i.jsxs("div",{className:"flex items-center gap-1",children:[i.jsx("button",{type:"button",onClick:u,className:"rounded px-2 py-1 text-xs text-muted-foreground transition-colors hover:bg-muted hover:text-foreground",children:"Read"}),i.jsx("button",{type:"button",onClick:()=>a(!1),className:"rounded p-1 text-muted-foreground transition-colors hover:bg-muted hover:text-foreground","aria-label":"Close notifications",children:i.jsx(Ct,{className:"h-4 w-4"})})]})]}),i.jsx("div",{className:"max-h-[22rem] space-y-2 overflow-y-auto p-2",children:t.slice(0,6).map(f=>i.jsx("div",{className:`rounded-md border p-3 shadow-sm ${cse(f.severity)}`,children:i.jsxs("div",{className:"flex items-start justify-between gap-3",children:[i.jsxs("div",{className:"min-w-0",children:[i.jsxs("div",{className:"flex items-center gap-2",children:[!s.has(f.id)&&i.jsx("span",{className:"h-2 w-2 flex-shrink-0 rounded-full bg-primary"}),i.jsx("p",{className:"truncate text-sm font-medium",children:f.title})]}),i.jsx("p",{className:"mt-1 text-sm leading-5 opacity-85",children:f.body}),i.jsx("p",{className:"mt-2 text-xs opacity-60",children:dse(f.createdAt)})]}),i.jsx("button",{type:"button",onClick:()=>p(f.id),className:"rounded p-1 opacity-60 transition-opacity hover:opacity-100","aria-label":"Dismiss notification",children:i.jsx(Ct,{className:"h-4 w-4"})})]})},f.id))})]}),i.jsxs("button",{type:"button",onClick:()=>{a(f=>!f),n||u()},className:"pointer-events-auto relative inline-flex h-11 w-11 items-center justify-center rounded-full border border-border bg-card text-card-foreground shadow-lg shadow-black/10 transition-transform hover:scale-105","aria-label":"Open notifications",children:[i.jsx(Gg,{className:"h-5 w-5"}),d>0&&i.jsx("span",{className:"absolute -right-1 -top-1 min-w-5 rounded-full bg-primary px-1.5 py-0.5 text-xs font-semibold text-primary-foreground",children:d>9?"9+":d})]})]})}function pse(){const[e,t]=m.useState(new Set),[r,n]=m.useState(new Set),a=m.useCallback(d=>{d&&t(u=>new Set([...u,d]))},[]),s=m.useCallback(d=>{d&&t(u=>{const p=new Set(u);return p.delete(d),p})},[]),o=m.useCallback(d=>{d&&n(u=>new Set([...u,d]))},[]),l=m.useCallback(d=>{d&&n(u=>{const p=new Set(u);return p.delete(d),p})},[]),c=m.useCallback(d=>{d&&t(u=>{const p=new Set;for(const f of u)f.startsWith("new-session-")||p.add(f);return p.add(d),p})},[]);return{activeSessions:e,processingSessions:r,markSessionAsActive:a,markSessionAsInactive:s,markSessionAsProcessing:o,markSessionAsNotProcessing:l,replaceTemporarySession:c}}const Cr=e=>JSON.stringify(e??null),$N=(e,t,r)=>e.length!==t.length?!0:t.some((n,a)=>{const s=e[a];return!s||n.name!==s.name||n.displayName!==s.displayName||n.fullPath!==s.fullPath||n.fileCount!==s.fileCount||Cr(n.sessionMeta)!==Cr(s.sessionMeta)||Cr(n.sessions)!==Cr(s.sessions)?!0:Cr(n.cursorSessions)!==Cr(s.cursorSessions)||Cr(n.codexSessions)!==Cr(s.codexSessions)||Cr(n.geminiSessions)!==Cr(s.geminiSessions)||Cr(n.qwenSessions)!==Cr(s.qwenSessions)||Cr(n.opencodeSessions)!==Cr(s.opencodeSessions)}),Qs=(e,t)=>(e??[]).map(r=>({...r,__provider:r.__provider??t})),$u=e=>[...Qs(e.sessions,"claude"),...Qs(e.codexSessions,"codex"),...Qs(e.cursorSessions,"cursor"),...Qs(e.geminiSessions,"gemini"),...Qs(e.qwenSessions,"qwen"),...Qs(e.opencodeSessions,"opencode")],mse=(e,t,r,n)=>{if(!r||!n)return!0;const a=e.find(c=>c.name===r.name),s=t.find(c=>c.name===r.name);if(!a||!s)return!1;const o=$u(a).find(c=>c.id===n.id),l=$u(s).find(c=>c.id===n.id);return!o||!l?!1:o.id===l.id&&o.title===l.title&&o.created_at===l.created_at&&o.updated_at===l.updated_at},hse=new Set(["chat","orchestration","remote","controlRoom","files","shell","git","changes","liveView","preview"]),fse=new Set(["controlRoom"]),gse=e=>hse.has(e)||e.startsWith("plugin:"),R6=e=>fse.has(e)?"chat":e,bse=()=>{if(typeof window<"u"&&window.location.pathname.endsWith("/orchestration"))return"orchestration";try{const e=localStorage.getItem("activeTab");if(e&&gse(e))return R6(e)}catch{}return"chat"};function xse({sessionId:e,navigate:t,latestMessage:r,isMobile:n,activeSessions:a}){const[s,o]=m.useState([]),[l,c]=m.useState(null),[d,u]=m.useState(null),[p,f]=m.useState(bse);m.useEffect(()=>{try{localStorage.setItem("activeTab",R6(p))}catch{}},[p]);const[h,g]=m.useState(!1),[b,x]=m.useState(!0),[y,v]=m.useState(null),[w,k]=m.useState(!1),[S,N]=m.useState(!1),[E,I]=m.useState("agents"),[A,T]=m.useState(0),_=m.useRef(null),j=m.useCallback(async({showLoadingState:ce=!0}={})=>{try{ce&&x(!0);const he=await(await Lt.projects()).json();o(ke=>ke.length===0||$N(ke,he,!0)?he:ke)}catch(ye){console.error("Error fetching projects:",ye)}finally{ce&&x(!1)}},[]),R=m.useCallback(async()=>{await j({showLoadingState:!1})},[j]),C=m.useCallback((ce="tools")=>{I(ce),N(!0)},[]);m.useEffect(()=>{j()},[j]),m.useEffect(()=>{!b&&s.length===1&&!l&&!e&&c(s[0])},[b,s,l,e]),m.useEffect(()=>{if(!r)return;if(r.type==="loading_progress"){_.current&&(clearTimeout(_.current),_.current=null),v(r),r.phase==="complete"&&(_.current=setTimeout(()=>{v(null),_.current=null},500));return}if(r.type!=="projects_updated")return;const ce=r;if(ce.changedFile&&d&&l){const M=ce.changedFile.replace(/\\/g,"/").split("/");M.length>=2&&M[M.length-1].replace(".jsonl","")===d.id&&(a.has(d.id)||T(U=>U+1))}const ye=d&&a.has(d.id)||a.size>0&&Array.from(a).some(je=>je.startsWith("new-session-")),he=ce.projects;if(ye&&!mse(s,he,l,d)||(o(he),!l))return;const ke=he.find(je=>je.name===l.name);if(!ke||(Cr(ke)!==Cr(l)&&c(ke),!d))return;$u(ke).find(je=>je.id===d.id)||u(null)},[r,l,d,a,s]),m.useEffect(()=>()=>{_.current&&(clearTimeout(_.current),_.current=null)},[]),m.useEffect(()=>{if(!(!e||s.length===0)){for(const ce of s){const ye=ce.sessions?.find(ae=>ae.id===e);if(ye){const ae=l?.name!==ce.name,ue=d?.id!==e||d.__provider!=="claude";ae&&c(ce),ue&&u({...ye,__provider:"claude"});return}const he=ce.cursorSessions?.find(ae=>ae.id===e);if(he){const ae=l?.name!==ce.name,ue=d?.id!==e||d.__provider!=="cursor";ae&&c(ce),ue&&u({...he,__provider:"cursor"});return}const ke=ce.codexSessions?.find(ae=>ae.id===e);if(ke){const ae=l?.name!==ce.name,ue=d?.id!==e||d.__provider!=="codex";ae&&c(ce),ue&&u({...ke,__provider:"codex"});return}const ve=ce.geminiSessions?.find(ae=>ae.id===e);if(ve){const ae=typeof ve.id=="string"&&ve.id.startsWith("qwen_")||ve.provider==="qwen",Y=typeof ve.id=="string"&&ve.id.startsWith("opencode_")||ve.provider==="opencode"?"opencode":ae?"qwen":"gemini",U=l?.name!==ce.name,Q=d?.id!==e||d.__provider!==Y;U&&c(ce),Q&&u({...ve,__provider:Y});return}const je=ce.qwenSessions?.find(ae=>ae.id===e);if(je){const ae=l?.name!==ce.name,ue=d?.id!==e||d.__provider!=="qwen";ae&&c(ce),ue&&u({...je,__provider:"qwen"});return}const M=ce.opencodeSessions?.find(ae=>ae.id===e);if(M){const ae=l?.name!==ce.name,ue=d?.id!==e||d.__provider!=="opencode";ae&&c(ce),ue&&u({...M,__provider:"opencode"});return}}if(e&&d?.id!==e){const ce=e.startsWith("opencode_")?"opencode":e.startsWith("qwen_")?"qwen":e.startsWith("codex-")||e.startsWith("codex_")?"codex":e.startsWith("gemini_")?"gemini":null,ye=(typeof window<"u"?localStorage.getItem("selected-provider"):null)||"claude";u({id:e,__provider:ce||ye})}}},[e,s,l?.name,d?.id,d?.__provider]);const D=m.useCallback(ce=>{c(ce),u(null),t("/"),n&&g(!1)},[n,t]),B=m.useCallback(ce=>{u(ce),(p==="preview"||p==="liveView"||p==="orchestration")&&f("chat");const ye=ce.__provider||localStorage.getItem("selected-provider")||"claude";if(ce.__provider&&localStorage.setItem("selected-provider",ce.__provider),ye==="cursor"&&sessionStorage.setItem("cursorSessionId",ce.id),n){const he=ce.__projectName,ke=l?.name;he!==ke&&g(!1)}t(`/session/${ce.id}`)},[p,n,t,l?.name]),F=m.useCallback(ce=>{o(ye=>{const he=ye.findIndex(ve=>ve.name===ce.name);if(he===-1)return[ce,...ye];const ke=[...ye];return ke[he]={...ke[he],...ce},ke}),c(ce),u(null),f("chat"),t("/"),n&&g(!1)},[n,t]),V=m.useCallback(ce=>{F(ce)},[F]),K=m.useCallback(async ce=>{try{const ye=await Lt.quickStartProject(),he=await ye.json().catch(()=>({}));if(!ye.ok||!he?.project){console.error("[quick-start] failed:",he);return}const ke=he.project;if(ce==="chat"){F(ke);return}o(ve=>ve.some(je=>je.name===ke.name)?ve:[ke,...ve]),c(ke),u(null),f(ce),t("/"),n&&g(!1)}catch(ye){console.error("[quick-start] error:",ye)}},[n,t,F]),L=m.useCallback(async()=>{await K("chat")},[K]),G=m.useCallback(async()=>{await K("orchestration")},[K]),H=m.useCallback((ce,ye)=>{c(ce),u(null),f("orchestration"),ye&&localStorage.setItem("pixcode.orchestration.selectedRunId",ye),t("/"),n&&g(!1)},[n,t]),z=m.useCallback(()=>{u(null),f("controlRoom"),t("/"),n&&g(!1)},[n,t]),te=m.useCallback(ce=>{d?.id===ce&&(u(null),t("/")),o(ye=>ye.map(he=>({...he,sessions:he.sessions?.filter(ke=>ke.id!==ce)??[],sessionMeta:{...he.sessionMeta,total:Math.max(0,(he.sessionMeta?.total??0)-1)}})))},[t,d?.id]),se=m.useCallback(async()=>{try{const ye=await(await Lt.projects()).json();if(o(ve=>$N(ve,ye,!0)?ye:ve),!l)return;const he=ye.find(ve=>ve.name===l.name);if(!he||(Cr(he)!==Cr(l)&&c(he),!d))return;const ke=$u(he).find(ve=>ve.id===d.id);if(ke){const ve=ke.__provider||!d.__provider?ke:{...ke,__provider:d.__provider};Cr(ve)!==Cr(d)&&u(ve)}}catch(ce){console.error("Error refreshing sidebar:",ce)}},[l,d]),me=m.useCallback(ce=>{l?.name===ce&&(c(null),u(null),t("/")),o(ye=>ye.filter(he=>he.name!==ce))},[t,l?.name]),de=m.useMemo(()=>({projects:s,selectedProject:l,selectedSession:d,onProjectSelect:D,onSessionSelect:B,onNewSession:V,onProjectCreated:F,onQuickStartSession:L,onOpenControlRoom:z,onOpenOrchestration:H,onSessionDelete:te,onProjectDelete:me,isLoading:b,loadingProgress:y,onRefresh:se,onShowSettings:()=>N(!0),showSettings:S,settingsInitialTab:E,onCloseSettings:()=>N(!1),isMobile:n}),[V,z,H,F,L,me,D,te,B,se,b,n,y,s,E,l,d,S]);return{projects:s,selectedProject:l,selectedSession:d,activeTab:p,sidebarOpen:h,isLoadingProjects:b,loadingProgress:y,isInputFocused:w,showSettings:S,settingsInitialTab:E,externalMessageUpdate:A,setActiveTab:f,setSidebarOpen:g,setIsInputFocused:k,setShowSettings:N,openSettings:C,fetchProjects:j,refreshProjectsSilently:R,sidebarSharedProps:de,handleProjectSelect:D,handleSessionSelect:B,handleNewSession:V,handleOpenOrchestration:H,handleQuickStartOrchestration:G,handleSessionDelete:te,handleProjectDelete:me,handleSidebarRefresh:se}}function tf(){const e=rR(),{sessionId:t}=nR(),{t:r}=He("common"),{isMobile:n}=Zg({trackPWA:!1}),{ws:a,sendMessage:s,latestMessage:o,isConnected:l}=X4(),c=m.useRef(!1),{activeSessions:d,processingSessions:u,markSessionAsActive:p,markSessionAsInactive:f,markSessionAsProcessing:h,markSessionAsNotProcessing:g,replaceTemporarySession:b}=pse(),{selectedProject:x,selectedSession:y,activeTab:v,sidebarOpen:w,isLoadingProjects:k,externalMessageUpdate:S,setActiveTab:N,setSidebarOpen:E,setIsInputFocused:I,setShowSettings:A,openSettings:T,refreshProjectsSilently:_,sidebarSharedProps:j,handleQuickStartOrchestration:R}=xse({sessionId:t,navigate:e,latestMessage:o,isMobile:n,activeSessions:d});return m.useEffect(()=>(window.refreshProjects=_,()=>{window.refreshProjects===_&&delete window.refreshProjects}),[_]),m.useEffect(()=>(window.openSettings=T,()=>{window.openSettings===T&&delete window.openSettings}),[T]),m.useEffect(()=>{if(typeof navigator>"u"||!("serviceWorker"in navigator))return;const C=D=>{const B=D.data;if(!(!B||B.type!=="notification:navigate")){if(typeof B.provider=="string"&&B.provider.trim()&&localStorage.setItem("selected-provider",B.provider),N("chat"),E(!1),_(),typeof B.sessionId=="string"&&B.sessionId){e(`/session/${B.sessionId}`);return}e("/")}};return navigator.serviceWorker.addEventListener("message",C),()=>{navigator.serviceWorker.removeEventListener("message",C)}},[e,_,N,E]),m.useEffect(()=>{l&&!c.current?c.current=!0:l||(c.current=!1),l&&y?.id&&s({type:"get-pending-permissions",sessionId:y.id})},[l,y?.id,s]),m.useEffect(()=>{if(!o||o.type!=="projects_updated"&&o.type!=="project_files_updated")return;const C=o.type==="project_files_updated"?typeof o.projectName=="string"?o.projectName:null:x?.name??null;window.dispatchEvent(new CustomEvent("pixcode:file-tree-refresh",{detail:{projectName:C,changedFile:typeof o.changedFile=="string"?o.changedFile:null}}))},[o,x?.name]),m.useEffect(()=>{const C=window.visualViewport;if(!C)return;const D=()=>{const B=Math.max(0,window.innerHeight-C.height);document.documentElement.style.setProperty("--keyboard-height",`${B}px`)};return C.addEventListener("resize",D),()=>C.removeEventListener("resize",D)},[]),i.jsxs("div",{className:"fixed inset-0 flex bg-background",style:{bottom:"var(--keyboard-height, 0px)"},children:[n?i.jsxs("div",{className:`fixed inset-0 z-50 flex transition-all duration-150 ease-out ${w?"visible opacity-100":"invisible opacity-0"}`,children:[i.jsx("button",{className:"fixed inset-0 bg-background/60 backdrop-blur-sm transition-opacity duration-150 ease-out",onClick:C=>{C.stopPropagation(),E(!1)},onTouchStart:C=>{C.preventDefault(),C.stopPropagation(),E(!1)},"aria-label":r("versionUpdate.ariaLabels.closeSidebar")}),i.jsx("div",{className:`relative h-full w-[85vw] max-w-sm transform border-r border-border/40 bg-card transition-transform duration-150 ease-out sm:w-80 ${w?"translate-x-0":"-translate-x-full"}`,onClick:C=>C.stopPropagation(),onTouchStart:C=>C.stopPropagation(),children:i.jsx(gT,{...j})})]}):null,i.jsx("div",{className:"flex min-w-0 flex-1 flex-col",children:n?i.jsx(yie,{selectedProject:x,selectedSession:y,activeTab:v,setActiveTab:N,ws:a,sendMessage:s,latestMessage:o,isMobile:n,onMenuClick:()=>E(!0),isLoading:k,onInputFocusChange:I,onSessionActive:p,onSessionInactive:f,onSessionProcessing:h,onSessionNotProcessing:g,processingSessions:u,onReplaceTemporarySession:b,onNavigateToSession:C=>e(`/session/${C}`),onShowSettings:()=>A(!0),externalMessageUpdate:S,onQuickStartSession:j.onQuickStartSession,onQuickStartOrchestration:R}):i.jsx(Vie,{sidebarProps:j,selectedProject:x,selectedSession:y,activeTab:v,setActiveTab:N,ws:a,sendMessage:s,latestMessage:o,isMobile:n,onMenuClick:()=>E(!0),isLoading:k,onInputFocusChange:I,onSessionActive:p,onSessionInactive:f,onSessionProcessing:h,onSessionNotProcessing:g,processingSessions:u,onReplaceTemporarySession:b,onNavigateToSession:C=>e(`/session/${C}`),onShowSettings:()=>A(!0),externalMessageUpdate:S,onQuickStartSession:j.onQuickStartSession,onQuickStartOrchestration:R})}),i.jsx(use,{latestMessage:o})]})}const{slice:yse,forEach:vse}=[];function wse(e){return vse.call(yse.call(arguments,1),t=>{if(t)for(const r in t)e[r]===void 0&&(e[r]=t[r])}),e}function kse(e){return typeof e!="string"?!1:[/<\s*script.*?>/i,/<\s*\/\s*script\s*>/i,/<\s*img.*?on\w+\s*=/i,/<\s*\w+\s*on\w+\s*=.*?>/i,/javascript\s*:/i,/vbscript\s*:/i,/expression\s*\(/i,/eval\s*\(/i,/alert\s*\(/i,/document\.cookie/i,/document\.write\s*\(/i,/window\.location/i,/innerHTML/i].some(r=>r.test(e))}const HN=/^[\u0009\u0020-\u007e\u0080-\u00ff]+$/,Sse=function(e,t){const n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{path:"/"},a=encodeURIComponent(t);let s=`${e}=${a}`;if(n.maxAge>0){const o=n.maxAge-0;if(Number.isNaN(o))throw new Error("maxAge should be a Number");s+=`; Max-Age=${Math.floor(o)}`}if(n.domain){if(!HN.test(n.domain))throw new TypeError("option domain is invalid");s+=`; Domain=${n.domain}`}if(n.path){if(!HN.test(n.path))throw new TypeError("option path is invalid");s+=`; Path=${n.path}`}if(n.expires){if(typeof n.expires.toUTCString!="function")throw new TypeError("option expires is invalid");s+=`; Expires=${n.expires.toUTCString()}`}if(n.httpOnly&&(s+="; HttpOnly"),n.secure&&(s+="; Secure"),n.sameSite)switch(typeof n.sameSite=="string"?n.sameSite.toLowerCase():n.sameSite){case!0:s+="; SameSite=Strict";break;case"lax":s+="; SameSite=Lax";break;case"strict":s+="; SameSite=Strict";break;case"none":s+="; SameSite=None";break;default:throw new TypeError("option sameSite is invalid")}return n.partitioned&&(s+="; Partitioned"),s},GN={create(e,t,r,n){let a=arguments.length>4&&arguments[4]!==void 0?arguments[4]:{path:"/",sameSite:"strict"};r&&(a.expires=new Date,a.expires.setTime(a.expires.getTime()+r*60*1e3)),n&&(a.domain=n),document.cookie=Sse(e,t,a)},read(e){const t=`${e}=`,r=document.cookie.split(";");for(let n=0;n<r.length;n++){let a=r[n];for(;a.charAt(0)===" ";)a=a.substring(1,a.length);if(a.indexOf(t)===0)return a.substring(t.length,a.length)}return null},remove(e,t){this.create(e,"",-1,t)}};var Cse={name:"cookie",lookup(e){let{lookupCookie:t}=e;if(t&&typeof document<"u")return GN.read(t)||void 0},cacheUserLanguage(e,t){let{lookupCookie:r,cookieMinutes:n,cookieDomain:a,cookieOptions:s}=t;r&&typeof document<"u"&&GN.create(r,e,n,a,s)}},Nse={name:"querystring",lookup(e){let{lookupQuerystring:t}=e,r;if(typeof window<"u"){let{search:n}=window.location;!window.location.search&&window.location.hash?.indexOf("?")>-1&&(n=window.location.hash.substring(window.location.hash.indexOf("?")));const s=n.substring(1).split("&");for(let o=0;o<s.length;o++){const l=s[o].indexOf("=");l>0&&s[o].substring(0,l)===t&&(r=s[o].substring(l+1))}}return r}},Ese={name:"hash",lookup(e){let{lookupHash:t,lookupFromHashIndex:r}=e,n;if(typeof window<"u"){const{hash:a}=window.location;if(a&&a.length>2){const s=a.substring(1);if(t){const o=s.split("&");for(let l=0;l<o.length;l++){const c=o[l].indexOf("=");c>0&&o[l].substring(0,c)===t&&(n=o[l].substring(c+1))}}if(n)return n;if(!n&&r>-1){const o=a.match(/\/([a-zA-Z-]*)/g);return Array.isArray(o)?o[typeof r=="number"?r:0]?.replace("/",""):void 0}}}return n}};let eo=null;const VN=()=>{if(eo!==null)return eo;try{if(eo=typeof window<"u"&&window.localStorage!==null,!eo)return!1;const e="i18next.translate.boo";window.localStorage.setItem(e,"foo"),window.localStorage.removeItem(e)}catch{eo=!1}return eo};var Tse={name:"localStorage",lookup(e){let{lookupLocalStorage:t}=e;if(t&&VN())return window.localStorage.getItem(t)||void 0},cacheUserLanguage(e,t){let{lookupLocalStorage:r}=t;r&&VN()&&window.localStorage.setItem(r,e)}};let to=null;const WN=()=>{if(to!==null)return to;try{if(to=typeof window<"u"&&window.sessionStorage!==null,!to)return!1;const e="i18next.translate.boo";window.sessionStorage.setItem(e,"foo"),window.sessionStorage.removeItem(e)}catch{to=!1}return to};var Ase={name:"sessionStorage",lookup(e){let{lookupSessionStorage:t}=e;if(t&&WN())return window.sessionStorage.getItem(t)||void 0},cacheUserLanguage(e,t){let{lookupSessionStorage:r}=t;r&&WN()&&window.sessionStorage.setItem(r,e)}},jse={name:"navigator",lookup(e){const t=[];if(typeof navigator<"u"){const{languages:r,userLanguage:n,language:a}=navigator;if(r)for(let s=0;s<r.length;s++)t.push(r[s]);n&&t.push(n),a&&t.push(a)}return t.length>0?t:void 0}},Ise={name:"htmlTag",lookup(e){let{htmlTag:t}=e,r;const n=t||(typeof document<"u"?document.documentElement:null);return n&&typeof n.getAttribute=="function"&&(r=n.getAttribute("lang")),r}},Rse={name:"path",lookup(e){let{lookupFromPathIndex:t}=e;if(typeof window>"u")return;const r=window.location.pathname.match(/\/([a-zA-Z-]*)/g);return Array.isArray(r)?r[typeof t=="number"?t:0]?.replace("/",""):void 0}},_se={name:"subdomain",lookup(e){let{lookupFromSubdomainIndex:t}=e;const r=typeof t=="number"?t+1:1,n=typeof window<"u"&&window.location?.hostname?.match(/^(\w{2,5})\.(([a-z0-9-]{1,63}\.[a-z]{2,6})|localhost)/i);if(n)return n[r]}};let _6=!1;try{document.cookie,_6=!0}catch{}const P6=["querystring","cookie","localStorage","sessionStorage","navigator","htmlTag"];_6||P6.splice(1,1);const Pse=()=>({order:P6,lookupQuerystring:"lng",lookupCookie:"i18next",lookupLocalStorage:"i18nextLng",lookupSessionStorage:"i18nextLng",caches:["localStorage"],excludeCacheFor:["cimode"],convertDetectedLanguage:e=>e});class L6{constructor(t){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.type="languageDetector",this.detectors={},this.init(t,r)}init(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{languageUtils:{}},r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};this.services=t,this.options=wse(r,this.options||{},Pse()),typeof this.options.convertDetectedLanguage=="string"&&this.options.convertDetectedLanguage.indexOf("15897")>-1&&(this.options.convertDetectedLanguage=a=>a.replace("-","_")),this.options.lookupFromUrlIndex&&(this.options.lookupFromPathIndex=this.options.lookupFromUrlIndex),this.i18nOptions=n,this.addDetector(Cse),this.addDetector(Nse),this.addDetector(Tse),this.addDetector(Ase),this.addDetector(jse),this.addDetector(Ise),this.addDetector(Rse),this.addDetector(_se),this.addDetector(Ese)}addDetector(t){return this.detectors[t.name]=t,this}detect(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:this.options.order,r=[];return t.forEach(n=>{if(this.detectors[n]){let a=this.detectors[n].lookup(this.options);a&&typeof a=="string"&&(a=[a]),a&&(r=r.concat(a))}}),r=r.filter(n=>n!=null&&!kse(n)).map(n=>this.options.convertDetectedLanguage(n)),this.services&&this.services.languageUtils&&this.services.languageUtils.getBestMatchFromCodes?r:r.length>0?r[0]:null}cacheUserLanguage(t){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.options.caches;r&&(this.options.excludeCacheFor&&this.options.excludeCacheFor.indexOf(t)>-1||r.forEach(n=>{this.detectors[n]&&this.detectors[n].cacheUserLanguage(t,this.options)}))}}L6.type="languageDetector";const Lse={save:"Save",cancel:"Cancel",delete:"Delete",create:"Create",edit:"Edit",close:"Close",confirm:"Confirm",submit:"Submit",retry:"Retry",refresh:"Refresh",search:"Search",clear:"Clear",copy:"Copy",download:"Download",upload:"Upload",browse:"Browse"},Dse={chat:"Chat",shell:"Shell",files:"Files",git:"Source Control",changes:"Changes",liveView:"Live View",tasks:"Tasks",remote:"Remote",controlRoom:"Control",orchestration:"Orchestration"},Ose={loading:"Loading...",success:"Success",error:"Error",failed:"Failed",pending:"Pending",completed:"Completed",inProgress:"In Progress"},Mse={savedSuccessfully:"Saved successfully",deletedSuccessfully:"Deleted successfully",updatedSuccessfully:"Updated successfully",operationFailed:"Operation failed",networkError:"Network error. Please check your connection.",unauthorized:"Unauthorized. Please log in.",notFound:"Not found",invalidInput:"Invalid input",requiredField:"This field is required",unknownError:"An unknown error occurred"},Fse={settings:"Settings",home:"Home",back:"Back",next:"Next",previous:"Previous",logout:"Logout"},zse={language:"Language",theme:"Theme",darkMode:"Dark Mode",lightMode:"Light Mode",name:"Name",description:"Description",enabled:"Enabled",disabled:"Disabled",optional:"Optional",version:"Version",select:"Select",selectAll:"Select All",deselectAll:"Deselect All"},Bse={justNow:"Just now",minutesAgo:"{{count}} mins ago",hoursAgo:"{{count}} hours ago",daysAgo:"{{count}} days ago",yesterday:"Yesterday"},Use={newFile:"New File",newFolder:"New Folder",rename:"Rename",move:"Move",copyPath:"Copy Path",openInEditor:"Open in Editor"},$se={loading:"Loading Pixcode",settingUpWorkspace:"Setting up your workspace...",chooseProject:"Choose Your Project",selectProjectDescription:"Select a project from the sidebar to start coding with Claude. Each project contains your chat sessions and file history.",tip:"Tip",createProjectMobile:"Tap the menu button above to access projects",createProjectDesktop:"Create a new project by clicking the folder icon in the sidebar",newSession:"New Session",untitledSession:"Untitled Session",projectFiles:"Project Files",landing:{title:"Start a Pixcode workspace",description:"Choose a project, start a new chat, or launch Orchestration with one goal. Orchestration manages the CLI agents you select, shows every step, and surfaces errors directly.",startOrchestration:"Start Orchestration",startOrchestrationDescription:"Creates an automatic project and opens the Orchestration screen with agent control and run history.",startChat:"Start a new chat",startChatDescription:"Creates a folder automatically and opens the normal chat screen with one agent.",sidebarHint:"When you select an existing project from the sidebar, chat history, files, git status, tasks, and orchestration stay in the same main screen.",createProject:"Create New Project",createProjectDescription:"Add an existing workspace or create a folder, then open the provider picker for coding."}},Hse={title:"Orchestration",subtitle:"Give one goal inside {{project}}; choose the CLI workers, duplicate any CLI when needed, and assign work directly or let the coordinator split it.",refresh:"Refresh",goal:"Goal",goalPlaceholder:"Example: Fix the auth screen for single-port deployment, capture errors, and verify with lint and typecheck.",mode:"Run mode",systemPlan:"System plan",noMode:"No mode selected",loadingPlan:"Loading agent plan.",start:"Start team",starting:"Starting",stop:"Stop team",stopping:"Stopping",cancelFailed:"Workflow could not be stopped.",linkedTask:"Linked task",replayRun:"Replay",replaying:"Replaying",approveReplay:"Approve replay",replayApprovalRequired:"Replay needs approval before repeating a step with prior shell, network, or file-write activity.",replayFailed:"Workflow replay could not start.",needAgent:"Enable at least one CLI worker.",needRoles:"Assign at least one enabled agent to these role(s) for this mode: {{roles}}.",startFailed:"Workflow could not start.",quickPrompts:{label:"Quick prompt:",liveTrading:{label:"8024 live trading screen",prompt:"Hi, please create a small project and then run it on port 8024. I want a Binance FAPI-connected TradingView-style design with a TradingView chart and a star/favorites system on the left. Split the work logically and manage the process automatically."}},cliControl:"CLI team",enabledCount:"{{count}} enabled",enabled:"Enabled",disabled:"Disabled",history:"History",emptyHistory:"No runs yet. Write a goal and start the agents.",steps:"{{done}}/{{total}} steps",notSelected:"No run selected",notSelectedDescription:"Select a previous run or start a new goal. Agent messages, errors, change summaries, and preview outputs appear here.",loadFailed:"Run details could not be loaded.",loadingRun:"Loading run...",traceTimeline:"Trace timeline",traceFilters:"Filters",traceAll:"All",traceActor:"Actor",traceProvider:"Provider",traceType:"Type",traceSeverity:"Severity",traceDuration:"{{duration}} elapsed",traceEmpty:"No trace events match the current filters.",traceLoadFailed:"Trace timeline could not be loaded.",traceTypes:{run:"Run",node:"Step",provider:"Provider",message:"Message",artifact:"Artifact",file:"File edit",permission_policy:"Permission policy",error:"Error"},traceSeverityLevels:{info:"Info",warning:"Warning",error:"Error"},teamHistory:"Team history",permissionApprovalsPending:"{{count}} permission approval pending",agentSteps:"Agent steps",changeSummary:"Change summary",noChangeSummary:"The final summary is not ready yet. A readable Markdown summary appears here when the agents finish.",prepareTeamFromReport:"Prepare agent team from this report",prepareTeamTitle:"Prepare agent team prompt",prepareTeamDescription:"The debate output was turned into a new Agent Team prompt. Edit it, then move it into Agent Team mode.",usePreparedPrompt:"Use prompt",reportToPromptPrefix:"Prepare and execute an agent team from the following debate/decision report. Split the needs into tasks, propose sensible assignments for the available CLI agents, and start only after user confirmation.",generatedSummaryTitle:"Automatic run summary",summaryStatus:"Overall status",summarySteps:"Completed steps",summaryFailures:"Failed steps",summaryCanceled:"Canceled steps",summaryDiffs:"Diff/change outputs",summaryPreviews:"Preview outputs",summaryErrorPrefix:"Error",assignedWork:"Assigned work",autoAssigned:"Automatic / coordinator decides",noStepOutput:"No step output.",agentMessages:"Agent messages",noAgentMessages:"This agent has not produced a message yet. If the run failed, the real CLI error appears above.",outputs:"Outputs",noOutputs:"No change summary, preview, or command output yet.",open:"Open",artifact:{fileDiff:"Change summary",previewUrl:"Preview",commandOutput:"Command output",handoff:"Handoff artifact"},role:{user:"User",agent:"Agent"},status:{queued:"Queued",running:"Running",completed:"Completed",failed:"Failed",canceled:"Canceled",skipped:"Skipped"},nodes:{codex_review:"Codex review",gemini_review:"Gemini review",claude_review:"Claude review",claude_code_review:"Claude review",cursor_review:"Cursor review",aggregate:"Aggregate",architect:"Planning",implement:"Implementation",review:"Review",proposal:"Proposal",critique:"Critique",response:"Response",judge:"Decision",coordinator:"Coordinator",final_report:"Final report"},stages:{coordinator:"Coordinator",handoff:"Handoff",backend:"Backend",frontend:"Frontend",implementation:"Implementation",review:"Review",repair:"Repair",proposal:"Proposal",critique:"Critique",response:"Response",decision:"Decision",report:"Report",fallback:"Fallback",final_report:"Final report"},workflows:{multi_model_review:{name:"Multi-model review",description:"Enabled CLI agents review the same goal separately, then one enabled agent aggregates the result."},sequential_handoff:{name:"Sequential handoff",description:"Agents plan, implement, and review in order. Disabled CLI steps are skipped."},adversarial_debate:{name:"Decision debate",description:"Agents propose, critique, respond, and produce a final recommendation."},agent_team:{name:"Agent team",description:"A coordinator reads the goal and active CLI instances, assigns work, then collects the result."}},adapters:{"claude-code":{label:"Claude Code",role:"CLI worker"},cursor:{label:"Cursor",role:"CLI worker"},codex:{label:"Codex",role:"CLI worker"},gemini:{label:"Gemini",role:"CLI worker"},qwen:{label:"Qwen Code",role:"CLI worker"},opencode:{label:"OpenCode",role:"CLI worker"}},activeCount:"{{active}}/{{total}} active",teamHint:"Each row is one CLI worker. You can create multiple Claude, Codex, Cursor, Gemini, Qwen, or OpenCode workers and give each a different assignment.",parallelLimit:"Parallel limit",fallbackAgent:"Fallback CLI",noFallbackAgent:"No automatic fallback",fallbackAgentHint:"If a CLI step fails, Pixcode retries that step with this backup agent.",agentRole:"Stage",agentModel:"Model",agentRoles:{auto:"Auto",backend:"Backend",frontend:"Frontend",review:"Test / review",implementation:"Implementation",proposal:"Proposal",critique:"Critique",response:"Response",decision:"Decision / report",report:"Report",custom:"Custom"},customRolePlaceholder:"Example: Security, Mobile UX, DB architecture",roleHints:{default:"Leave empty and the coordinator assigns this agent from the goal.",agent_team:"Pick backend, frontend, or review stages, or leave agents on auto.",multi_model_review:"Enabled agents review; if a report role is selected, that agent aggregates the final summary.",sequential_handoff:"Agents run in your selected order; assignment text defines each step.",adversarial_debate:"Stage selection is optional in decision debate; if left empty, the system assigns selected agents to Proposal, Critique, and Response in order."},addAgent:"Add {{agent}}",soloAgent:"Run only with {{agent}}",soloAgentShort:"Solo",duplicateAgent:"Duplicate {{agent}}",removeAgent:"Remove {{agent}}",assignment:"Assignment",assignmentPlaceholder:"Optional: tell this worker exactly what to handle. Leave empty for coordinator assignment.",agentInstance:"{{name}} #{{number}}",taskTitle:"Task",taskTitlePlaceholder:"Implement feature",taskDescription:"Description",taskDescriptionPlaceholder:"Scope, constraints, expected output",addTask:"Add",runTask:"Run",cancelTask:"Cancel",dispatchTask:"Dispatch task",adapter:"Adapter",isolation:"Isolation",dispatch:"Dispatch",auto:"Auto",cliSettings:"CLI settings",waitingForStream:"Waiting for stream...",workflow:"Workflow",templates:"Templates",noTemplate:"No template",templateHint:"Pick a starter template to fill the workflow, agent roles, and acceptance criteria before launch.",input:"Input",taskStates:{todo:"To Do",in_progress:"In Progress",in_review:"In Review",done:"Done",failed:"Failed",canceled:"Canceled"},isolationKind:{worktree:"Worktree",host:"Host",docker:"Docker"},workspaceTarget:"Target workspace",workspaceTargets:{selectedProject:"Selected project",pixcodeApp:"Pixcode system",custom:"Custom path"},customWorkspacePlaceholder:"/path/to/project",workspaceTargetHint:"Agents will run in: {{path}}",autoDetect:"auto-detect",needWorkspacePath:"Enter a custom workspace path.",hermesTitle:"Hermes Agent",hermesSubtitle:"Hermes is running inside Pixcode for {{project}} and can coordinate local checks, tests, terminal work, and project operations.",hermesCliControl:"Hermes CLI control"},Gse={loading:"Loading files...",files:"Files",simpleView:"Simple view",compactView:"Compact view",detailedView:"Detailed view",searchPlaceholder:"Search files and folders...",clearSearch:"Clear search",name:"Name",size:"Size",modified:"Modified",permissions:"Permissions",noFilesFound:"No files found",checkProjectPath:"Check if the project path is accessible",noMatchesFound:"No matches found",tryDifferentSearch:"Try a different search term or clear the search",justNow:"just now",minAgo:"{{count}} min ago",hoursAgo:"{{count}} hours ago",daysAgo:"{{count}} days ago",newFile:"New File (Cmd+N)",newFolder:"New Folder (Cmd+Shift+N)",refresh:"Refresh",collapseAll:"Collapse All",context:{rename:"Rename",delete:"Delete",copyPath:"Copy Path",download:"Download",newFile:"New File",newFolder:"New Folder",refresh:"Refresh",menuLabel:"File context menu",loading:"Loading..."}},Vse={title:"Create New Project",steps:{type:"Type",configure:"Configure",confirm:"Confirm"},step1:{question:"Do you already have a workspace, or would you like to create a new one?",existing:{title:"Existing Workspace",description:"I already have a workspace on my server and just need to add it to the project list"},new:{title:"New Workspace",description:"Create a new workspace, optionally clone from a GitHub repository"},githubClone:{title:"Clone from GitHub",description:"Pick a target folder and clone a repository into it"},subfolder:{title:"Create Subfolder",description:"Pick a parent folder and create a fresh subfolder inside it"}},step2:{existingPath:"Workspace Path",newPath:"Workspace Path",subfolderParentPath:"Parent Folder",subfolderParentHelp:"Path to the folder where the new subfolder will be created",subfolderName:"Subfolder Name",subfolderNameHelp:"A new folder with this name will be created inside the parent above",existingPlaceholder:"/path/to/existing/workspace",newPlaceholder:"/path/to/new/workspace",existingHelp:"Full path to your existing workspace directory",newHelp:"Full path to your workspace directory",githubUrl:"GitHub URL (Optional)",githubPlaceholder:"https://github.com/username/repository",githubHelp:"Optional: provide a GitHub URL to clone a repository",githubAuth:"GitHub Authentication (Optional)",githubAuthHelp:"Only required for private repositories. Public repos can be cloned without authentication.",loadingTokens:"Loading stored tokens...",storedToken:"Stored Token",newToken:"New Token",nonePublic:"None (Public)",selectToken:"Select Token",selectTokenPlaceholder:"-- Select a token --",tokenPlaceholder:"ghp_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",tokenHelp:"This token will be used only for this operation",publicRepoInfo:"Public repositories don't require authentication. You can skip providing a token if cloning a public repo.",noTokensHelp:"No stored tokens available. You can add tokens in Settings → API Keys for easier reuse.",optionalTokenPublic:"GitHub Token (Optional for Public Repos)",tokenPublicPlaceholder:"ghp_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx (leave empty for public repos)"},step3:{reviewConfig:"Review Your Configuration",workspaceType:"Workspace Type:",existingWorkspace:"Existing Workspace",newWorkspace:"New Workspace",subfolderWorkspace:"New Subfolder",path:"Path:",parentPath:"Parent Path:",subfolderName:"Subfolder Name:",cloneFrom:"Clone From:",authentication:"Authentication:",usingStoredToken:"Using stored token:",usingProvidedToken:"Using provided token",noAuthentication:"No authentication",sshKey:"SSH Key",existingInfo:"The workspace will be added to your project list and will be available for Claude/Cursor sessions.",newWithClone:"The repository will be cloned from this folder.",newEmpty:"The workspace will be added to your project list and will be available for Claude/Cursor sessions.",subfolderInfo:"A new subfolder will be created inside the parent folder and added to your project list.",cloningRepository:"Cloning repository..."},buttons:{cancel:"Cancel",back:"Back",next:"Next",createProject:"Create Project",creating:"Creating...",cloning:"Cloning..."},errors:{selectType:"Please select whether you have an existing workspace or want to create a new one",providePath:"Please provide a workspace path",provideSubfolderName:"Please provide a name for the subfolder",subfolderNameInvalid:"Subfolder name cannot contain path separators or be . / ..",failedToCreate:"Failed to create workspace",failedToCreateFolder:"Failed to create folder"}},Wse={genericTool:"a tool",codes:{generic:{info:{title:"Notification"}},permission:{required:{title:"Action Required",body:"{{toolName}} is waiting for your decision."}},run:{stopped:{title:"Run Stopped",body:"Reason: {{reason}}"},failed:{title:"Run Failed"}},agent:{notification:{title:"Agent Notification"}}}},qse={title:"Update Available",newVersionReady:"A new version is ready",currentVersion:"Current Version",latestVersion:"Latest Version",latestRelease:"Latest Release",releaseNotesTitle:"Release Notes",releaseNotesSubtitle:"Latest Pixcode changes",whatsNew:"What's New:",viewFullRelease:"View full release",updateProgress:"Update Progress:",manualUpgrade:"Manual upgrade:",npmUpgradeCommand:"npm install -g @pixelbyte-software/pixcode@latest",pixcodeUpgradeCommand:"pixcode update --restart-daemon",manualUpgradeHint:'Or click "Update Now" to run the update automatically.',updateCompleted:"Update completed successfully!",restartServer:"Please restart the server to apply changes.",updateFailed:"Update failed",buttons:{close:"Close",later:"Later",copyCommand:"Copy Command",updateNow:"Update Now",updating:"Updating..."},ariaLabels:{closeModal:"Close version upgrade modal",showSidebar:"Show sidebar",settings:"Settings",updateAvailable:"Update available",closeSidebar:"Close sidebar"}},Kse={title:"Live View",subtitle:"Run this project locally and share it through the active secure tunnel when one is running.",start:"Start",restart:"Restart",stop:"Stop",runnerError:"Runner error",runnerUnavailable:"Runner unavailable",managedRuntimePreparing:"Pixcode will prepare the runtime",managedRuntimeDescription:"Press Start and Pixcode will prepare the required local runtime automatically.",preparingRuntime:"Preparing runtime…",preparingRuntimeDescription:"Pixcode is downloading and installing the runtime locally. This can take a moment on first use.",runnerErrorFallback:"The runner stopped before the preview became available.",detecting:"Detecting project runner…",noRunner:"No runner detected",staticHint:"Static HTML will be served directly when index.html exists.",customCommand:"Custom command",custom:"Custom",customPlaceholder:"npm run dev, python app.py, go run .",environment:"Environment",environmentLocalProcess:"Local process",environmentStatic:"Static files",environmentUnavailable:"Unavailable",statusLabel:"Status",framework:"Framework",command:"Command",upstream:"Upstream",publicTunnel:"Public tunnel",tunnelActive:"Tunnel active",tunnelLocalOnly:"Local only",diagnostics:"Diagnostics",viewport:"Viewport",viewportDesktop:"Desktop",viewportTablet:"Tablet",viewportMobile:"Mobile",viewportWidth:"Width",viewportHeight:"Height",controls:"Runner, viewport and logs",shareLink:"Share link",starting:"Starting",openExternal:"Open externally",externalActive:"Secure tunnel is active; this link can be shared outside your network.",localOnly:"External Access is off; this link is local to this Pixcode server.",frameTitle:"Project Live View",emptyTitle:"Start Live View",emptyDescription:"Pixcode will detect the project stack, start the local web server, and expose it here."},Yse={title:"Control room",subtitle:"Production, platform, admin, audit, and self-hosted access for {{target}}",thisServer:"this server",refresh:"Refresh",nav:{overview:"Overview",production:"Production",admin:"Admin",team:"Team",secrets:"Secrets",marketplace:"Marketplace",eval:"Evaluations",usage:"Usage",security:"Security",access:"Access"},overview:{title:"v1.46 launch surface",description:"Every box below is backed by a v1.44-v1.45 API and is now visible from the UI.",latestAuditEvents:"Latest audit events",remoteAccessOptions:"Remote access options"},metrics:{issueRuns:"Issue-to-PR runs",reviewItems:"Review items",subUsers:"Sub-users",collaborators:"Project collaborators",secrets:"Scoped secrets",marketplace:"Marketplace entries",evalRuns:"Evaluation runs",securityAudits:"Security audits"},sections:{production:{title:"Production loop",description:"Start issue-to-PR runs, parse CI failures, review changes, schedule background jobs, and create checkpoints."},admin:{title:"Admin system",description:"Create sub-users, disable accounts, and inspect activity for a single self-hosted Pixcode server."},team:{title:"Project collaborators",description:"Assign partners, workers, reviewers, and viewers per project without making everyone a global admin."},secrets:{title:"Secret vault",description:"Store scoped env secrets and preview what each provider, project, workflow, Telegram, or API run receives."},marketplace:{title:"MCP/plugin marketplace",description:"Register MCP servers, workflow templates, provider adapters, and notification channels with permission review and health."},eval:{title:"Evaluation harness",description:"Create regression suites and compare provider/model runs with pass rate and latency."},usage:{title:"Cost, token, and latency dashboard",description:"Monitor provider/model/workflow usage for demos and operations."},security:{title:"Security audit mode",description:"Run dependency audit, secret scan, permission audit, and agent output leak detection workflows."},access:{title:"Self-hosted access",description:"Use Tailscale when there is no fixed domain, or configure Cloudflare Tunnel/custom domain for a stable public URL."}},panels:{issueToPr:"Issue-to-PR run",ciRepair:"CI repair parser",reviewQueue:"Review queue",schedulerCheckpoints:"Scheduler and checkpoints",createSubUser:"Create sub-user",rolePermissions:"Role permissions",addCollaborator:"Add collaborator",createSecret:"Create secret",scopedEnvPreview:"Scoped env preview",addMarketplaceEntry:"Add marketplace entry",createSuite:"Create suite",recordRun:"Record run",recordUsageEvent:"Record usage event",createAuditRun:"Create audit run",auditLog:"Audit log",remoteAccessSetup:"Remote access setup"},lists:{recentJobs:"Recent jobs",recentCheckpoints:"Recent checkpoints",subUsers:"Sub-users",collaborators:"Collaborators",includedEnvNames:"Included env names",vaultEntries:"Vault entries",marketplaceEntries:"Marketplace entries",suites:"Suites",runs:"Runs",auditRuns:"Audit runs",configuredAccessPaths:"Configured access paths"},buttons:{queueRun:"Queue run",parseFailure:"Parse failure",createReviewItem:"Create review item",scheduleJob:"Schedule job",createCheckpoint:"Create checkpoint",createUser:"Create user",disable:"Disable",enable:"Enable",addCollaborator:"Add collaborator",storeSecret:"Store secret",previewEnv:"Preview env",saveEntry:"Save entry",markHealthy:"Mark healthy",createSuite:"Create suite",recordRun:"Record run",recordUsage:"Record usage",createAudit:"Create audit",exportJson:"Export JSON",exportCsv:"Export CSV",saveAccessPath:"Save access path",checkUrl:"Check URL",checkTailscale:"Check Tailscale"},placeholders:{githubIssueUrl:"GitHub issue URL",manualTitle:"Manual title fallback",model:"Model",baseBranch:"Base branch",ciLog:"Paste failing CI, lint, typecheck, or build output",reviewTitle:"Review title",notes:"Notes",changedFiles:"Changed files, one per line",jobName:"Job name",cronExpression:"Cron or watch expression",checkpointReason:"Checkpoint reason",backgroundPrompt:"Background agent prompt",checkpointFiles:"Checkpoint changed files, one per line",usernameEmail:"Username or email",temporaryPassword:"Temporary password",userEmailUsername:"User email or username",secretName:"Secret name",envName:"ENV_NAME",secretTarget:"Target project/provider/workflow",secretValue:"Secret value",workflowId:"Workflow id",name:"Name",pluginSource:"Source package or repository",installCommand:"Install command",permissionScopes:"Permission scopes, one per line",suiteName:"Suite name",description:"Description",firstTaskTitle:"First task title",acceptanceCriteria:"Acceptance criteria, one per line",suiteId:"Suite id",latencyMs:"Latency ms",passedCount:"Passed count",failedCount:"Failed count",workflow:"Workflow",inputTokens:"Input tokens",outputTokens:"Output tokens",costUsd:"Cost USD",optionalFindingTitle:"Optional finding title",auditFilter:"Filter audit log by user, project, event, or file",label:"Label",url:"URL",targetPort:"Target port"},labels:{project:"project",path:"path",providerModel:"provider/model",branch:"branch",failedCommands:"Failed commands",files:"Files",lastActive:"Last active",role:"role",tasks:"tasks",pass:"pass",health:"Health",reachable:"reachable",installed:"installed",loggedIn:"logged in"},columns:{provider:"Provider",model:"Model",workflow:"Workflow",runs:"Runs",tokens:"Tokens",cost:"Cost",latency:"Latency",errorRate:"Error rate"},fallback:{selectedProject:"selected project",projectPath:"project path",noneDetected:"none detected",noUrl:"No URL",global:"global",noSource:"No source",regressionSuite:"Regression suite",demoTask:"Demo task",provider:"provider",reviewRequired:"Review required.",notAvailable:"not available"},capabilities:{partner:"can approve actions, manage secrets, and use shell",projectScoped:"project-scoped access only"},teamAccess:{title:"How collaborators get access",stepUsers:"Create a sub-user",stepUsersDescription:"Create the person in Admin system with a global role such as member, viewer, project_worker, or project_partner.",stepRole:"Assign project role",stepRoleDescription:"Add the same user as a project collaborator so they only see and operate on the projects you choose.",stepLink:"Share an access path",stepLinkDescription:"Give them the Tailscale, Cloudflare Tunnel, custom domain, or LAN URL configured in Self-hosted access.",paths:"Available access links"},badges:{public:"public",private:"private"},empty:{noAuditEvents:"No audit events yet.",noRemoteAccessConfigs:"No remote access configs yet.",noReviewItems:"No review items yet.",noRecentJobs:"No recent jobs yet.",noRecentCheckpoints:"No recent checkpoints yet.",noSubUsers:"No sub-users yet.",noCollaborators:"No project collaborators yet.",noAccessPaths:"No access paths configured yet.",noIncludedEnvNames:"No included env names yet.",noSecrets:"No secrets yet.",noMarketplaceEntries:"No marketplace entries yet.",noSuites:"No suites yet.",noRuns:"No runs yet.",usageSummary:"Usage appears here after provider or workflow events are recorded.",noSecurityAudits:"No security audits yet.",noAuditMatches:"No audit entries match the current filter."}},Zse={title:"VS Code Workbench",noProject:"No project selected",activity:{explorer:"Explorer",projects:"Projects",sourceControl:"Source Control",terminal:"Terminal",hermes:"Hermes Agent",showPanel:"Show left panel",hidePanel:"Hide left panel"},panels:{explorer:"Explorer",projects:"Projects",sourceControl:"Source Control",terminal:"Terminal",hermes:"Hermes Agent",editor:"Editor",cli:"CLI",rightTerminal:"Terminal"},editor:{emptyTitle:"Open a file from Explorer",closeTab:"Close {{file}}",scrollLeft:"Scroll tabs left",scrollRight:"Scroll tabs right",moreActions:"More tab actions",closeSplit:"Close split editor",context:{close:"Close",closeAll:"Close All",copyPath:"Copy Path",splitRight:"Split Right",splitMoveRight:"Split and Move Right"}},resize:{left:"Resize left panel",right:"Resize CLI panel"},menu:{openProject:"Open Project...",cloneFromGithub:"Clone Repository...",newChat:"New Chat",openProjects:"Open Projects"},projects:{openProject:"Open Project",cloneFromGithub:"Clone",directoryList:"Directories",refresh:"Refresh projects",emptyTitle:"No project directories yet",emptyDescription:"Open a local folder or clone a repository to start.",selected:"Selected",startChat:"Chat",fileCount:"{{formattedCount}} files",fileCountPending:"Files pending",startTitle:"Start a Pixcode workspace",startDescription:"Pick a folder and Pixcode will bind the explorer, terminal, and chat history to that workspace.",workHere:"Work in this folder"},workspace:{empty:"Open a project to create Workspace 1.",openFirst:"Open a workspace",add:"Add workspace",scrollLeft:"Scroll workspaces left",scrollRight:"Scroll workspaces right",close:"Close {{name}}",closeAction:"Close workspace",closeOthers:"Close others",closeAll:"Close all",rename:"Rename",star:"Star",unstar:"Unstar",toggleStar:"Star {{name}}",moreActions:"Workspace actions"},cli:{projectScoped:"Project-scoped CLI terminal",chooseTitle:"Start a CLI terminal",chooseDescription:"Choose a CLI, then start a full-height terminal.",startSelected:"Start {{provider}}",newSession:"New CLI session",plainTerminal:"Terminal",newPlainTerminal:"New terminal",history:"History",noHistory:"No sessions for this project yet.",projectHistory:"Project history",checking:"Checking...",ready:"Ready",notInstalled:"Not installed",installing:"Installing...",updateAvailable:"Update {{version}}",installProvider:"Install {{provider}}",updateProvider:"Update {{provider}}",manualInstall:"This CLI needs manual installation.",installNoJob:"Install did not return a job id.",installFailed:"Install failed.",installStreamLost:"Install stream closed early. The install may still be running.",provider:"Provider",installRunning:"is installing",installDone:"is ready",installError:"needs attention",showPanel:"Show CLI panel",hidePanel:"Hide CLI panel",close:"Close terminal"},terminal:{title:"Terminal",close:"Close terminal"},hermes:{title:"Hermes Agent",installTitle:"Install Hermes Agent",description:"Project-scoped agent terminal. Installs Hermes when missing, then opens it in this workspace.",start:"Start Hermes",install:"Install",newSession:"New Hermes session",history:"Hermes history",connect:"Connect Hermes Agent",ready:"Ready",installRunning:"Installing Hermes through Pixcode API...",installDone:"Hermes installed and Pixcode MCP configured.",installError:"Hermes install failed.",installReady:"Ready to install Hermes.",installWaiting:"Waiting for Hermes install logs...",retryInstall:"Retry install",installFailed:"Hermes install failed.",installStreamLost:"Hermes install stream closed early. The install may still be running.",controlPlaneFailed:"Unable to read Hermes control plane.",controlPlaneRepairFailed:"Unable to repair Hermes control plane.",controlReady:"Control ready",needsRepair:"Needs repair",unknown:"Unknown",refreshControl:"Refresh Hermes control plane",installState:"Install",restGateway:"REST",mcpTools:"MCP tools",mcpMissing:"{{count}} missing",sessions:"Sessions",cronSummary:"{{count}}/{{total}} cron active",profile:"Profile",authReady:"Auth ready",authMissing:"Auth missing",modelNotSelected:"No model selected",modelSettings:"Hermes model",cronJobs:"Hermes cron",deepStatus:"Hermes status",repairControl:"Repair control",capabilities:"Capabilities",recentSessions:"Recent sessions",recommendations:"Recommendations"}},Xse={buttons:Lse,tabs:Dse,status:Ose,messages:Mse,navigation:Fse,common:zse,time:Bse,fileOperations:Use,mainContent:$se,orchestration:Hse,fileTree:Gse,projectWizard:Vse,notifications:Wse,versionUpdate:qse,liveView:Kse,controlRoom:Yse,vscodeWorkbench:Zse},Jse="Settings",Qse={account:"Account",permissions:"Permissions",mcpServers:"MCP Servers",pluginsMcp:"Plugins / MCP",configuration:"Configuration",appearance:"Appearance"},eoe={title:"Account",language:"Language",languageLabel:"Display Language",languageDescription:"Choose your preferred language for the interface",username:"Username",email:"Email",profile:"Profile",changePassword:"Change Password"},toe={title:"MCP Servers",addServer:"Add Server",editServer:"Edit Server",deleteServer:"Delete Server",serverName:"Server Name",serverType:"Server Type",config:"Configuration",testConnection:"Test Connection",status:"Status",connected:"Connected",disconnected:"Disconnected",scope:{label:"Scope",user:"User",project:"Project"}},roe={title:"Appearance",theme:"Theme",codeEditor:"Code Editor",editorTheme:"Editor Theme",wordWrap:"Word Wrap",showMinimap:"Show Minimap",lineNumbers:"Line Numbers",fontSize:"Font Size"},noe={saveChanges:"Save Changes",resetToDefaults:"Reset to Defaults",cancelChanges:"Cancel Changes"},aoe={title:"Quick Settings",sections:{appearance:"Appearance",toolDisplay:"Tool Display",viewOptions:"View Options",agentDiff:"Agent diff",inputSettings:"Input Settings",changeAwareness:"Command Center"},darkMode:"Dark Mode",autoExpandTools:"Auto-expand tools",showRawParameters:"Show raw parameters",showThinking:"Show thinking",autoScrollToBottom:"Auto-scroll to bottom",sendByCtrlEnter:"Send by Ctrl+Enter",sendByCtrlEnterDescription:"When enabled, pressing Ctrl+Enter will send the message instead of just Enter. This is useful for IME users to avoid accidental sends.",autoShowAgentDiff:"Show agent edits as diff",autoShowAgentDiffOff:"Off",autoShowAgentDiffOpenOnly:"Open files",autoShowAgentDiffAlways:"Always",changeAwareness:"Command Center",changedFiles:{title:"Changed files",description:"Tracks local file changes and opens the Files panel when a new change appears.",noProject:"Select a project to track local changes.",refresh:"Refresh changed files",empty:"No local changes detected",disabled:"Enable Command Center to watch local changes.",more:"+{{count}} more files",lastChecked:"Checked {{value}}",guideTitle:"Right panel guide",guideFiles:"Changed files glow green in Files.",guidePanel:"New changes appear beside the active chat.",status:{M:"M",A:"A",D:"D",U:"U"}},dragHandle:{dragging:"Dragging handle",closePanel:"Close settings panel",openPanel:"Open settings panel",draggingStatus:"Dragging...",toggleAndMove:"Click to toggle, drag to move"}},ioe={title:"Terminal Shortcuts",sectionKeys:"Keys",sectionNavigation:"Navigation",escape:"Escape",tab:"Tab",shiftTab:"Shift+Tab",arrowUp:"Arrow Up",arrowDown:"Arrow Down",scrollDown:"Scroll Down",handle:{closePanel:"Close shortcuts panel",openPanel:"Open shortcuts panel"}},soe={label:"Settings",agents:"Agents",hermes:"Hermes Agent",appearance:"Appearance",git:"Git",apiTokens:"API & Tokens",notifications:"Notifications",plugins:"Plugins",mobile:"Use from Mobile",telegram:"Telegram",diagnostics:"Diagnostics",about:"About",access:"Access"},ooe={title:"Use from Mobile",description:"Scan a QR code with your phone to open Pixcode on any device in the same network.",refresh:"Refresh",copy:"Copy",copied:"Copied!",loading:"Detecting network addresses…",noEndpoints:"No LAN addresses were detected. Make sure your device is connected to a network.",error:"Could not load network endpoints.",hostLabel:"Host",portLabel:"Port",steps:{sameNetwork:"Connect your phone to the same Wi-Fi network as this computer.",scan:"Open the camera app and scan one of the QR codes below.",login:"Sign in with your Pixcode credentials the first time."},external:{title:"External Access",description:"Expose Pixcode beyond your local network so you can reach it from the internet.",upnpTitle:"Router port mapping (UPnP)",upnpDescription:"One-click port forwarding via your router. Works on most home routers; fails silently on CGNAT or enterprise networks.",upnpEnable:"Enable UPnP",upnpDisable:"Disable UPnP",upnpEnabled:"UPnP mapping active",upnpUnsupported:"UPnP is not available on this network.",tunnelTitle:"Secure tunnel",tunnelDescription:"If UPnP is unavailable, install cloudflared or ngrok and start a tunnel — we'll auto-detect and show the QR here.",tunnelStart:"Start tunnel",tunnelStop:"Stop tunnel",tunnelRunning:"Tunnel running",tunnelUnavailable:"No tunnel binary found on this machine.",externalUrl:"External URL"}},loe={title:"Telegram",description:"Receive task completion notifications and chat with your agents from Telegram.",comingSoon:"Telegram integration is being prepared.",botToken:"Bot Token",botTokenPlaceholder:"123456:ABC-DEF…",botTokenHelp:"Create a bot with @BotFather and paste the token here.",saveToken:"Save & Start Bot",saving:"Saving…",botRunning:"Bot running as @{{username}}",botStopped:"Bot stopped",stopBot:"Stop Bot",removeToken:"Remove Token",pairing:{title:"Pair with your Telegram account",description:"Message your bot, then enter this 6-digit code inside the chat. The code refreshes every 10 minutes.",code:"Pairing Code",regenerate:"Generate new code",verified:"Paired with Telegram account",notPaired:"No Telegram account paired yet."},linkedAccount:{title:"Paired Account",username:"@{{username}}",language:"Replies in {{language}}",unpair:"Unpair"},notifications:{title:"Notifications",description:"Send agent completion and error events to your Telegram chat.",enabled:"Enabled",disabled:"Disabled"},bridge:{title:"Chat Bridge",description:"Messages you send to the bot become prompts for your most recent session. Replies come back to Telegram.",enabled:"Enabled",disabled:"Disabled"},control:{title:"Remote Control",description:"Use Telegram as a full Pixcode control surface for agents, orchestration, provider setup, and run status.",enabled:"Enable Telegram control",enabledDescription:"When enabled, paired Telegram messages can start agent and orchestration work on the selected project.",progressMode:"Progress mode",progressModeDescription:"Choose how much run output Telegram should send back.",progressModes:{final:"Final answer only",steps:"Important steps and final answer",all:"All visible step changes"},selectedProject:"Selected project",selectedProvider:"Selected provider",selectedModel:"Selected model",selectedWorkflow:"Selected workflow"},errors:{invalidToken:"Telegram rejected this bot token.",networkError:"Could not reach Telegram servers."}},coe={title:"Notifications",description:"Control which notification events you receive.",webPush:{title:"Web Push Notifications",enable:"Enable Push Notifications",disable:"Disable Push Notifications",enabled:"Push notifications are enabled",loading:"Updating...",unsupported:"Push notifications are not supported in this browser.",denied:"Push notifications are blocked. Please allow them in your browser settings."},events:{title:"Event Types",actionRequired:"Action required",stop:"Run stopped",error:"Run failed",updates:"App and CLI updates"}},doe={darkMode:{label:"Dark Mode",description:"Toggle between light and dark themes"},colorTheme:{title:"Color theme",palette:{label:"Accent palette",description:"Choose the product accent used by buttons, focus rings, navigation, and active states."},custom:{label:"Custom light/dark colors",description:"Pick separate accent colors for light and dark mode. Select Custom above to use them.",light:"Light",dark:"Dark"}},projectSorting:{label:"Project Sorting",description:"How projects are ordered in the sidebar",alphabetical:"Alphabetical",recentActivity:"Recent Activity"},codeEditor:{title:"Code Editor",theme:{label:"Editor Theme",description:"Default theme for the code editor"},wordWrap:{label:"Word Wrap",description:"Enable word wrapping by default in the editor"},showMinimap:{label:"Show Minimap",description:"Display a minimap for easier navigation in diff view"},lineNumbers:{label:"Show Line Numbers",description:"Display line numbers in the editor"},fontSize:{label:"Font Size",description:"Editor font size in pixels"}}},uoe={title:{add:"Add MCP Server",edit:"Edit MCP Server"},importMode:{form:"Form Input",json:"JSON Import"},scope:{label:"Scope",userGlobal:"User (Global)",projectLocal:"Project (Local)",userDescription:"User scope: Available across all projects on your machine",projectDescription:"Local scope: Only available in the selected project",cannotChange:"Scope cannot be changed when editing an existing server"},fields:{serverName:"Server Name",transportType:"Transport Type",command:"Command",arguments:"Arguments (one per line)",jsonConfig:"JSON Configuration",url:"URL",envVars:"Environment Variables (KEY=value, one per line)",headers:"Headers (KEY=value, one per line)",selectProject:"Select a project..."},placeholders:{serverName:"my-server"},validation:{missingType:"Missing required field: type",stdioRequiresCommand:"stdio type requires a command field",httpRequiresUrl:"{{type}} type requires a url field",invalidJson:"Invalid JSON format",jsonHelp:"Paste your MCP server configuration in JSON format. Example formats:",jsonExampleStdio:'• stdio: {"type":"stdio","command":"npx","args":["@upstash/context7-mcp"]}',jsonExampleHttp:'• http/sse: {"type":"http","url":"https://api.example.com/mcp"}'},configDetails:"Configuration Details (from {{configFile}})",projectPath:"Path: {{path}}",actions:{cancel:"Cancel",saving:"Saving...",addServer:"Add Server",updateServer:"Update Server"}},poe={success:"Settings saved successfully!",error:"Failed to save settings",saving:"Saving..."},moe={save:"Save Settings",cancel:"Cancel"},hoe={title:"Git Configuration",description:"Configure your git identity for commits. These settings will be applied globally via git config --global",name:{label:"Git Name",help:"Your name for git commits"},email:{label:"Git Email",help:"Your email for git commits"},actions:{save:"Save Configuration",saving:"Saving..."},status:{success:"Saved successfully"}},foe={title:"API Keys",description:"Generate API keys to access the external API from other applications.",newKey:{alertTitle:"⚠️ Save Your API Key",alertMessage:"This is the only time you'll see this key. Store it securely.",iveSavedIt:"I've saved it"},form:{placeholder:"API Key Name (e.g., Production Server)",createButton:"Create",cancelButton:"Cancel"},newButton:"New API Key",empty:"No API keys created yet.",list:{created:"Created:",lastUsed:"Last used:"},confirmDelete:"Are you sure you want to delete this API key?",status:{active:"Active",inactive:"Inactive"},github:{title:"GitHub Tokens",description:"Add GitHub Personal Access Tokens to clone private repositories via the external API.",descriptionAlt:"Add GitHub Personal Access Tokens to clone private repositories. You can also pass tokens directly in API requests without storing them.",addButton:"Add Token",form:{namePlaceholder:"Token Name (e.g., Personal Repos)",tokenPlaceholder:"GitHub Personal Access Token (ghp_...)",descriptionPlaceholder:"Description (optional)",addButton:"Add Token",cancelButton:"Cancel",howToCreate:"How to create a GitHub Personal Access Token →"},empty:"No GitHub tokens added yet.",added:"Added:",confirmDelete:"Are you sure you want to delete this GitHub token?"},apiDocsLink:"API Documentation",documentation:{title:"External API Documentation",description:"Learn how to use the external API to trigger Claude/Cursor sessions from your applications.",viewLink:"View API Documentation →"},loading:"Loading...",version:{updateAvailable:"Update available: v{{version}}"}},goe={status:{title:"CLI status",notChecked:"Not checked yet",lastChecked:"Last checked: {{value}}",updatesFound:"{{count}} update available",refresh:"Refresh CLI status"},config:{blurb:"View or edit the files the {{name}} CLI reads on startup. Saves write directly to your home directory.",refresh:"Refresh",save:"Save",revert:"Revert",saved:"Saved",loading:"Loading…",notCreated:"new",readonly:"read-only",noFiles:"No config files are registered for this agent yet."},cliVersion:{title:"CLI version",installed:"Installed: {{version}}",unknownInstalled:"Installed version unknown",latest:"Latest: {{version}}",checkedAt:"Checked: {{value}}",cached:"cached",updateAvailable:"Update available",refresh:"Refresh",skipped:{external_installer:"External installer",installed_version_unavailable:"Installed version unavailable",latest_version_unavailable:"Latest version unavailable",not_installed:"Not installed"}},authStatus:{checking:"Checking...",connected:"Connected",notConnected:"Not connected",disconnected:"Disconnected",checkingAuth:"Checking authentication status...",loggedInAs:"Logged in as {{email}}",authenticatedUser:"authenticated user"},account:{claude:{description:"Anthropic Claude AI assistant"},cursor:{description:"Cursor AI-powered code editor"},codex:{description:"OpenAI Codex AI assistant"},gemini:{description:"Google Gemini AI assistant"},qwen:{description:"Alibaba Qwen Code CLI (Gemini CLI fork)"},opencode:{description:"Multi-provider terminal coding agent — Claude, OpenAI, Gemini, or local models"}},connectionStatus:"Connection Status",login:{title:"Login",reAuthenticate:"Re-authenticate",description:"Sign in to your {{agent}} account to enable AI features",reAuthDescription:"Sign in with a different account or refresh credentials",button:"Login",reLoginButton:"Re-login"},error:"Error: {{error}}"},boe={title:"Permission Settings",skipPermissions:{label:"Skip permission prompts (use with caution)",claudeDescription:"Equivalent to --dangerously-skip-permissions flag",cursorDescription:"Equivalent to -f flag in Cursor CLI",opencodeDescription:"Equivalent to --dangerously-skip-permissions flag in OpenCode"},allowedTools:{title:"Allowed Tools",description:"Tools that are automatically allowed without prompting for permission",placeholder:'e.g., "Bash(git log:*)" or "Write"',quickAdd:"Quick add common tools:",empty:"No allowed tools configured"},blockedTools:{title:"Blocked Tools",description:"Tools that are automatically blocked without prompting for permission",placeholder:'e.g., "Bash(rm:*)"',empty:"No blocked tools configured"},allowedCommands:{title:"Allowed Shell Commands",description:"Shell commands that are automatically allowed without prompting",placeholder:'e.g., "Shell(ls)" or "Shell(git status)"',quickAdd:"Quick add common commands:",empty:"No allowed commands configured"},blockedCommands:{title:"Blocked Shell Commands",description:"Shell commands that are automatically blocked",placeholder:'e.g., "Shell(rm -rf)" or "Shell(sudo)"',empty:"No blocked commands configured"},toolExamples:{title:"Tool Pattern Examples:",bashGitLog:"- Allow all git log commands",bashGitDiff:"- Allow all git diff commands",write:"- Allow all Write tool usage",bashRm:"- Block all rm commands (dangerous)"},shellExamples:{title:"Shell Command Examples:",ls:"- Allow ls command",gitStatus:"- Allow git status",npmInstall:"- Allow npm install",rmRf:"- Block recursive delete"},opencodeAllowed:{title:"Allowed Bash Patterns",description:"Bash command patterns OpenCode auto-approves without prompting",placeholder:'e.g., "git *" or "npm test"',quickAdd:"Quick add common patterns:",empty:"No allowed patterns configured"},opencodeBlocked:{title:"Blocked Bash Patterns",description:"Bash command patterns OpenCode always denies",placeholder:'e.g., "rm -rf *" or "sudo *"',empty:"No blocked patterns configured"},opencodeExamples:{title:"Pattern Examples:",gitAll:"- Allow all git commands",gitPush:"- Block git push specifically",rmRf:"- Block recursive delete",npm:"- Allow all npm commands"},codex:{permissionMode:"Permission Mode",description:"Controls how Codex handles file modifications and command execution",modes:{default:{title:"Default",description:"Only trusted commands (ls, cat, grep, git status, etc.) run automatically. Other commands are skipped. Can write to workspace."},acceptEdits:{title:"Accept Edits",description:"All commands run automatically within the workspace. Full auto mode with sandboxed execution."},bypassPermissions:{title:"Bypass Permissions",description:"Full system access with no restrictions. All commands run automatically with full disk and network access. Use with caution."}},technicalDetails:"Technical details",technicalInfo:{default:"sandboxMode=workspace-write, approvalPolicy=untrusted. Trusted commands: cat, cd, grep, head, ls, pwd, tail, git status/log/diff/show, find (without -exec), etc.",acceptEdits:"sandboxMode=workspace-write, approvalPolicy=never. All commands auto-execute within project directory.",bypassPermissions:"sandboxMode=danger-full-access, approvalPolicy=never. Full system access, use only in trusted environments.",overrideNote:"You can override this per-session using the mode button in the chat interface."}},actions:{add:"Add"}},xoe={title:"MCP Servers",description:{claude:"Model Context Protocol servers provide additional tools and data sources to Claude",cursor:"Model Context Protocol servers provide additional tools and data sources to Cursor",codex:"Model Context Protocol servers provide additional tools and data sources to Codex"},addButton:"Add MCP Server",empty:"No MCP servers configured",serverType:"Type",scope:{local:"local",user:"user"},config:{command:"Command",url:"URL",args:"Args",environment:"Environment"},tools:{title:"Tools",count:"({{count}}):",more:"+{{count}} more"},actions:{edit:"Edit server",delete:"Delete server"},help:{title:"About Codex MCP",description:"Codex supports stdio-based MCP servers. You can add servers that extend Codex's capabilities with additional tools and resources."}},yoe={updateCheckFrequency:"Update check frequency",updateCheckFrequencyHint:"Pixcode caches GitHub release checks locally so shared IPs do not hit GitHub rate limits.",updateCheckFrequencyOptions:{"30m":"Every 30 minutes","6h":"Every 6 hours","12h":"Every 12 hours","24h":"Daily","7d":"Weekly",off:"Manual only"},checkForUpdate:"Check for updates",checkingForUpdate:"Checking...",updateFound:"Update found",upToDate:"Up to date",lastChecked:"Last checked {{when}}",notCheckedYet:"Update check has not completed yet",checkFailed:"check failed or delayed by rate limit"},voe={title:"Plugins",description:"Extend the interface with custom plugins. Install from git or drop a folder in ~/.pixcode/plugins/",installPlaceholder:"https://github.com/user/my-plugin",installButton:"Install",installing:"Installing…",securityWarning:"Only install plugins whose source code you have reviewed or from authors you trust.",scanningPlugins:"Scanning plugins…",noPluginsInstalled:"No plugins installed",pullLatest:"Pull latest from git",noGitRemote:"No git remote — update not available",uninstallPlugin:"Uninstall plugin",confirmUninstall:"Click again to confirm",confirmUninstallMessage:"Remove {{name}}? This cannot be undone.",cancel:"Cancel",remove:"Remove",updateFailed:"Update failed",installFailed:"Installation failed",uninstallFailed:"Uninstall failed",toggleFailed:"Toggle failed",starterPluginLabel:"Starter Plugin",starter:"Starter",docs:"Docs",starterPlugin:{name:"Project Stats",badge:"starter",description:"File counts, lines of code, file-type breakdown, and recent activity for your project.",install:"Install"},terminalPlugin:{name:"Terminal",badge:"official",description:"Integrated terminal with full shell access directly within the interface.",install:"Install"},morePlugins:"More",enable:"Enable",disable:"Disable",installAriaLabel:"Plugin git repository URL",tab:"tab",runningStatus:"running"},woe={title:"Access",description:"Choose how people reach this self-hosted Pixcode server. Start with the same network, then use a secure tunnel, Tailscale, or your own domain when you need remote access.",refresh:"Refresh",copy:"Copy",copied:"Copied",save:"Save access path",check:"Check URL",qrAlt:"QR for {{url}}",guide:{title:"Pick the connection path first",description:"You do not need to know networking terms. Choose the situation that matches the person connecting, copy the shown link, or scan the QR code from their phone."},options:{sameNetwork:{title:"Same Wi-Fi/LAN",description:"Use this when the device is on the same router or office network as the Pixcode server."},secureTunnel:{title:"Temporary public link",description:"Start a Cloudflare/ngrok tunnel and Pixcode shows a public URL plus QR automatically."},tailscale:{title:"Private team link",description:"Use Tailscale when you want private access without a public domain or router setup."},customDomain:{title:"Own domain",description:"Use this when you already have HTTPS, a reverse proxy, or a Cloudflare Tunnel hostname."}},status:{ready:"Ready",detecting:"Detecting",guided:"Guided",configured:"Configured",optional:"Optional"},links:{title:"Available links",description:"Copy the correct URL for the device or teammate that needs to connect.",local:"Local",tailscale:"Tailscale private link",empty:"No access links detected yet."},local:{title:"Same network access",description:"Best first test: connect from the same Wi-Fi or LAN. Scan a QR code on the phone, or copy the link for a teammate on the same network.",thisDevice:"This computer only",loading:"Detecting same-network links...",empty:"No LAN link detected. Make sure the server is connected to a network and refresh.",saveLabel:"Same network access",save:"Save this LAN link"},tunnel:{title:"Secure tunnel",description:"For remote access without a fixed domain, Pixcode can start cloudflared or ngrok and show the public URL here.",secureLink:"Public link and QR",help:"Click start. If cloudflared or ngrok is installed, Pixcode creates a temporary HTTPS address and QR code automatically.",running:"Tunnel running",start:"Start tunnel",stop:"Stop tunnel",save:"Save this tunnel URL",saveLabel:"Secure tunnel access",qrLabel:"secure tunnel",installTitle:"Tunnel setup needed",installNeeded:"Install cloudflared or ngrok first, then press Start tunnel again."},tailscale:{title:"Tailscale private access",description:"Tailscale is an optional private network app. Install it on the server and user devices, sign in to the same team, then Pixcode can detect a private URL.",save:"Save this Tailscale URL",saveLabel:"Tailscale private access",openInstall:"Open Tailscale install",steps:{installServer:"Install Tailscale on the computer or server running Pixcode.",installUserDevice:"Install Tailscale on the phone, laptop, or teammate device that will open Pixcode.",login:"Sign in to the same Tailscale account or team on both devices.",refresh:"Return here and press Refresh; Pixcode will show the private URL when it is ready."}},advanced:{title:"Advanced: stable domain",description:"Use this when you already have a LAN URL, Tailscale URL, Cloudflare Tunnel hostname, or custom HTTPS domain that should be saved for users.",badge:"Advanced"},setup:{title:"Stable access path",description:"Save the URL your users will use. This can be a LAN address, Tailscale URL, Cloudflare Tunnel URL, or custom domain."},modes:{lan:"LAN",tailscale:"Tailscale",cloudflare_tunnel:"Cloudflare Tunnel",custom_domain:"Custom domain"},fields:{label:"Label",url:"URL",port:"Target port"},health:{reachable:"Pixcode is reachable",unreachable:"Pixcode is not reachable"},configured:{title:"Configured access paths",description:"These paths are available to admins, project partners, and project workers according to their role.",empty:"No configured access paths yet.",noUrl:"No URL",public:"public",private:"private"},team:{title:"How users connect",description:"Create the user in the Admin system, assign their project role in Control Room, then share one of these Access URLs. They do not need to be global admins to reach their assigned project."}},koe={title:"Hermes Agent",description:"Manage Hermes Agent as a Pixcode-controlled project terminal with MCP access to projects, provider status, and visible CLI launches.",statusTitle:"Install status",statusFailed:"Unable to check Hermes Agent.",ready:"Ready",notInstalled:"Not installed",start:"Start Hermes",install:"Install",repair:"Repair command",refresh:"Refresh",controlPlaneTitle:"Hermes control plane",controlPlaneDescription:"A desktop-style control layer for Hermes profiles, REST gateway, Pixcode MCP tools, sessions, cron jobs, and visible CLI control.",controlPlaneFailed:"Unable to read Hermes control plane.",controlPlaneRepairFailed:"Unable to repair Hermes control plane.",controlPlaneRepair:"Repair wiring",controlPlaneProfiles:"Profiles",controlPlaneMcp:"MCP",controlPlaneMcpMissing:"{{count}} missing",controlPlaneSessions:"Sessions",controlPlaneSessionHint:"Hermes state.db history",controlPlaneCron:"Cron",controlPlaneCronActive:"{{count}} active",gatewayTitle:"REST API gateway",gatewayStatusFailed:"Unable to check Hermes REST gateway.",gatewayStartFailed:"Hermes REST gateway could not be started.",gatewayStopFailed:"Hermes REST gateway could not be stopped.",gatewayProbeFailed:"Hermes REST probe failed.",gatewayRunning:"REST gateway running",gatewayStopped:"REST gateway stopped",gatewayStart:"Start REST",gatewayProbe:"Test REST",gatewayStop:"Stop",gatewayProbeOk:"REST probe passed: health, capabilities, models, and a real prompt responded.",commandsTitle:"Hermes CLI settings",commandsDescription:"Open the real Hermes terminal wizards from Pixcode. Use Model and provider to connect Codex, OpenRouter, Anthropic, Gemini, and other providers.",commandsInstallFirst:"Install Hermes before opening CLI settings.",commands:{cron:{title:"Cron jobs",description:"Inspect the scheduler, list jobs, and confirm recurring project tasks can run through the Hermes gateway."},mcp:{title:"MCP servers",description:"Manage MCP servers and reload Pixcode MCP when tool configuration changes."},update:{title:"Update Hermes",description:"Pull the latest Hermes fixes and reinstall dependencies without interactive prompts."}},pixcodeControlTitle:"Pixcode control",pixcodeControlDescription:"Pixcode configures the Hermes MCP server before launch, so Hermes can inspect workspaces and open provider terminals inside the visible Pixcode UI when you ask it to.",diagnosticsTitle:"Integration diagnostics",diagnosticsDescription:"Checks Hermes model/auth, native toolsets, Pixcode MCP tools, REST gateway, and cron API wiring without exposing secrets.",diagnosticsFailed:"Unable to read Hermes diagnostics.",diagnosticsModel:"Model",diagnosticsTools:"Tools",diagnosticsCron:"Cron",diagnosticsIssues:"Issues",diagnosticsAuthReady:"Provider auth is present.",diagnosticsAuthMissing:"Provider auth needs attention.",diagnosticsMcpTools:"Pixcode MCP: {{count}} tools, {{missing}} missing",diagnosticsCronReady:"Hermes cron toolset is available.",diagnosticsCronMissing:"Hermes cron needs hermes-cli toolset.",diagnosticsCronApiReady:"Gateway /api/jobs responded.",diagnosticsCronApiFailed:"Gateway /api/jobs did not respond.",diagnosticsNoIssues:"No blocking issue detected.",diagnosticsIssueCount:"{{count}} issue(s) detected.",unknown:"Unknown"},Soe={title:Jse,tabs:Qse,account:eoe,mcp:toe,appearance:roe,actions:noe,quickSettings:aoe,terminalShortcuts:ioe,mainTabs:soe,mobile:ooe,telegram:loe,notifications:coe,appearanceSettings:doe,mcpForm:uoe,saveStatus:poe,footerActions:moe,git:hoe,apiKeys:foe,agents:goe,permissions:boe,mcpServers:xoe,about:yoe,pluginSettings:voe,access:woe,hermes:koe},Coe={title:"Welcome Back",description:"Sign in to your Pixcode self-hosted account",username:"Username",password:"Password",submit:"Sign In",loading:"Signing in...",errors:{invalidCredentials:"Invalid username or password",requiredFields:"Please fill in all fields",networkError:"Network error. Please try again."},placeholders:{username:"Enter your username",password:"Enter your password"}},Noe={title:"Create Account",username:"Username",password:"Password",confirmPassword:"Confirm Password",submit:"Create Account",loading:"Creating account...",errors:{passwordMismatch:"Passwords do not match",usernameTaken:"Username is already taken",weakPassword:"Password is too weak"}},Eoe={title:"Sign Out",confirm:"Are you sure you want to sign out?",button:"Sign Out"},Toe={login:Coe,register:Noe,logout:Eoe},Aoe={title:"Projects",newProject:"New Project",deleteProject:"Remove Project",renameProject:"Rename Project",noProjects:"No projects found",loadingProjects:"Loading projects...",searchPlaceholder:"Search projects...",projectNamePlaceholder:"Project name",starred:"Starred",all:"All",untitledSession:"Untitled Session",newSession:"New Session",codexSession:"Codex Session",fetchingProjects:"Fetching your Claude projects and sessions",projects:"projects",detectedFromHistory:"Detected from history",noMatchingProjects:"No matching projects",tryDifferentSearch:"Try adjusting your search term",runClaudeCli:"Run Claude CLI in a project directory to get started"},joe={title:"Pixcode",subtitle:"AI coding assistant interface"},Ioe={title:"Sessions",newSession:"New Session",deleteSession:"Delete Session",renameSession:"Rename Session",noSessions:"No sessions yet",loadingSessions:"Loading sessions...",unnamed:"Unnamed",loading:"Loading...",showMore:"Show more sessions",startToSee:"Start a new session to see it here."},Roe={section:"Orchestration",fallbackTitle:"Orchestration run"},_oe={flat:"Recent",grouped:"By project"},Poe={viewEnvironments:"View Environments",hideSidebar:"Hide sidebar",createProject:"Create new project",refresh:"Refresh projects and sessions (Ctrl+R)",renameProject:"Rename project (F2)",deleteProject:"Remove project from sidebar (Delete)",addToFavorites:"Add to favorites",removeFromFavorites:"Remove from favorites",editSessionName:"Manually edit session name",deleteSession:"Delete this session permanently",sessionActions:"Session actions",historyView:"History view",historyViewFlat:"Recent conversations",historyViewGrouped:"Grouped by project",save:"Save",cancel:"Cancel",clearSearch:"Clear search"},Loe={chat:"Chat",files:"Files",git:"Git",terminal:"Terminal",tasks:"Tasks"},Doe={refresh:"Refresh",settings:"Settings",collapseAll:"Collapse All",expandAll:"Expand All",cancel:"Cancel",save:"Save",delete:"Delete",rename:"Rename",starSession:"Star",unstarSession:"Remove star",joinCommunity:"Join Community",reportIssue:"Report Issue",starOnGithub:"Star on GitHub",controlRoom:"Control Room",controlRoomDescription:"Admin, access, runs"},Ooe={openSource:"Open Source"},Moe={active:"Active",inactive:"Inactive",thinking:"Thinking...",error:"Error",aborted:"Aborted",unknown:"Unknown"},Foe={justNow:"Just now",oneMinuteAgo:"1 min ago",minutesAgo:"{{count}} mins ago",oneHourAgo:"1 hour ago",hoursAgo:"{{count}} hours ago",oneDayAgo:"1 day ago",daysAgo:"{{count}} days ago",buckets:{today:"Today",yesterday:"Yesterday",thisWeek:"Previous 7 days",thisMonth:"Previous 30 days",older:"Older"}},zoe={deleteConfirm:"Are you sure you want to delete this?",renameSuccess:"Renamed successfully",deleteSuccess:"Deleted successfully",errorOccurred:"An error occurred",deleteSessionConfirm:"Are you sure you want to delete this session? This action cannot be undone.",deleteProjectConfirm:"Remove this project from the sidebar? Your project files, memories, and session data will not be deleted.",enterProjectPath:"Please enter a project path",deleteSessionFailed:"Failed to delete session. Please try again.",deleteSessionError:"Error deleting session. Please try again.",renameSessionFailed:"Failed to rename session. Please try again.",renameSessionError:"Error renaming session. Please try again.",deleteProjectFailed:"Failed to remove project. Please try again.",deleteProjectError:"Error removing project. Please try again.",createProjectFailed:"Failed to create project. Please try again.",createProjectError:"Error creating project. Please try again."},Boe={updateAvailable:"Update available"},Uoe={modeProjects:"Projects",modeConversations:"Conversations",conversationsPlaceholder:"Search in conversations...",searching:"Searching...",noResults:"No results found",tryDifferentQuery:"Try a different search query",matches_one:"{{count}} match",matches_other:"{{count}} matches",projectsScanned_one:"{{count}} project scanned",projectsScanned_other:"{{count}} projects scanned"},$oe={deleteProject:"Remove Project",deleteSession:"Delete Session",confirmDelete:"What would you like to do with",sessionCount_one:"This project contains {{count}} conversation.",sessionCount_other:"This project contains {{count}} conversations.",removeFromSidebar:"Remove from sidebar only",deleteAllData:"Delete all data permanently",allConversationsDeleted:"The project will be removed from the sidebar. Your files, memories, and session data will be preserved.",cannotUndo:"You can re-add the project later."},Hoe={projects:Aoe,app:joe,sessions:Ioe,orchestration:Roe,historyView:_oe,tooltips:Poe,navigation:Loe,actions:Doe,branding:Ooe,status:Moe,time:Foe,messages:zoe,version:Boe,search:Uoe,deleteConfirmation:$oe},Goe={copy:"Copy",copied:"Copied",copyCode:"Copy code"},Voe={copy:"Copy message",copied:"Message copied",selectFormat:"Select copy format",copyAsMarkdown:"Copy as markdown",copyAsText:"Copy as text"},Woe={user:"U",error:"Error",tool:"Tool",claude:"Claude",cursor:"Cursor",codex:"Codex",gemini:"Gemini",qwen:"Qwen Code"},qoe={settings:"Tool Settings",error:"Tool Error",result:"Tool Result",viewParams:"View input parameters",viewRawParams:"View raw parameters",viewDiff:"View edit diff for",creatingFile:"Creating new file:",updatingTodo:"Updating Todo List",read:"Read",readFile:"Read file",updateTodo:"Update todo list",readTodo:"Read todo list",searchResults:"results"},Koe={found:"Found {{count}} {{type}}",file:"file",files:"files",pattern:"pattern:",in:"in:"},Yoe={updated:"File updated successfully",created:"File created successfully",written:"File written successfully",diff:"Diff",newFile:"New File",viewContent:"View file content",viewFullOutput:"View full output ({{count}} chars)",contentDisplayed:"The file content is displayed in the diff view above"},Zoe={title:"Interactive Prompt",waiting:"Waiting for your response in the CLI",instruction:"Please select an option in your terminal where Claude is running.",selectedOption:"✓ Claude selected option {{number}}",instructionDetail:"In the CLI, you would select this option interactively using arrow keys or by typing the number."},Xoe={title:"Thinking...",emoji:"💭 Thinking..."},Joe={response:"JSON Response"},Qoe={grant:"Grant permission for {{tool}}",added:"Permission added",addTo:"Adds {{entry}} to Allowed Tools.",retry:"Permission saved. Retry the request to use the tool.",error:"Unable to update permissions. Please try again.",openSettings:"Open settings"},ele={updated:"Todo list has been updated successfully",current:"Current Todo List"},tle={viewPlan:"📋 View implementation plan",title:"Implementation Plan"},rle={resetAt:"Claude usage limit reached. Your limit will reset at **{{time}} {{timezone}}** - {{date}}"},nle={permissionMode:"Permission Mode",modes:{default:"Default Mode",acceptEdits:"Accept Edits",bypassPermissions:"Bypass Permissions",plan:"Plan Mode"},descriptions:{default:"Only trusted commands (ls, cat, grep, git status, etc.) run automatically. Other commands are skipped. Can write to workspace.",acceptEdits:"All commands run automatically within the workspace. Full auto mode with sandboxed execution.",bypassPermissions:"Full system access with no restrictions. All commands run automatically with full disk and network access. Use with caution.",plan:"Planning mode - no commands are executed"},technicalDetails:"Technical details"},ale={permissionMode:"Gemini Permission Mode",description:"Control how Gemini CLI handles operation approvals.",modes:{default:{title:"Standard (Ask for Approval)",description:"Gemini will prompt for approval before executing commands, writing files, and fetching web resources."},autoEdit:{title:"Auto Edit (Skip File Approvals)",description:"Gemini will automatically approve file edits and web fetches, but will still prompt for shell commands."},yolo:{title:"YOLO (Bypass All Permissions)",description:"Gemini will execute all operations without asking for approval. Exercise caution."}}},ile={permissionMode:"Qwen Permission Mode",description:"Control how Qwen Code handles operation approvals.",modes:{default:{title:"Standard (Ask for Approval)",description:"Qwen Code will prompt for approval before executing commands, writing files, and fetching web resources."},autoEdit:{title:"Auto Edit (Skip File Approvals)",description:"Qwen Code will automatically approve file edits and web fetches, but will still prompt for shell commands."},yolo:{title:"YOLO (Bypass All Permissions)",description:"Qwen Code will execute all operations without asking for approval. Exercise caution."}}},sle={placeholder:"Type / for commands, @ for files, or ask {{provider}} anything...",placeholderDefault:"Type your message...",disabled:"Input disabled",attachFiles:"Attach files",attachImages:"Attach images",send:"Send",stop:"Stop",clickToChangeMode:"Click to change permission mode (or press Tab in input)",showAllCommands:"Show all commands",clearInput:"Clear input",scrollToBottom:"Scroll to bottom"},ole={selector:{title:"Thinking Mode",description:"Extended thinking gives Claude more time to evaluate alternatives",active:"Active",tip:"Higher thinking modes take more time but provide more thorough analysis"},modes:{none:{name:"Standard",description:"Regular Claude response",prefix:""},think:{name:"Think",description:"Basic extended thinking",prefix:"think"},thinkHard:{name:"Think Hard",description:"More thorough evaluation",prefix:"think hard"},thinkHarder:{name:"Think Harder",description:"Deep analysis with alternatives",prefix:"think harder"},ultrathink:{name:"Ultrathink",description:"Maximum thinking budget",prefix:"ultrathink"}},buttonTitle:"Thinking mode: {{mode}}"},lle={title:"Choose Your AI Assistant",description:"Select a provider to start a new conversation",selectModel:"Select Model",statusUnavailable:"Status unavailable",statusRetryHint:"Could not check this CLI. Tap to retry.",retryStatus:"Retry status",providerInfo:{anthropic:"by Anthropic",openai:"by OpenAI",cursorEditor:"AI Code Editor",google:"by Google"},readyPrompt:{claude:"Ready to use Claude with {{model}}. Start typing your message below.",cursor:"Ready to use Cursor with {{model}}. Start typing your message below.",codex:"Ready to use Codex with {{model}}. Start typing your message below.",gemini:"Ready to use Gemini with {{model}}. Start typing your message below.",default:"Select a provider above to begin"}},cle={continue:{title:"Continue your conversation",description:"Ask questions about your code, request changes, or get help with development tasks"},loading:{olderMessages:"Loading older messages...",sessionMessages:"Loading session messages..."},messages:{showingOf:"Showing {{shown}} of {{total}} messages",scrollToLoad:"Scroll up to load more",showingLast:"Showing last {{count}} messages ({{total}} total)",loadEarlier:"Load earlier messages",loadAll:"Load all messages",loadingAll:"Loading all messages...",allLoaded:"All messages loaded",perfWarning:'All messages loaded — scrolling may be slower. Click "Scroll to bottom" to restore performance.'}},dle={selectProject:{title:"Select a Project",description:"Choose a project to open an interactive shell in that directory"},status:{newSession:"New Session",initializing:"Initializing...",restarting:"Restarting..."},actions:{disconnect:"Disconnect",disconnectTitle:"Disconnect from shell",restart:"Restart",restartTitle:"Restart Shell (disconnect first)",connect:"Continue in Shell",connectTitle:"Connect to shell"},loading:"Loading terminal...",connecting:"Connecting to shell...",startSession:"Start a new Claude session",startProviderSession:"Start a new {{provider}} session",resumeSession:"Resume session: {{displayName}}...",runCommand:"Run {{command}} in {{projectName}}",startCli:"Starting Claude CLI in {{projectName}}",startProviderCli:"Starting {{provider}} in {{projectName}}",defaultCommand:"command"},ule={actions:{thinking:"Thinking",processing:"Processing",analyzing:"Analyzing",working:"Working",computing:"Computing",reasoning:"Reasoning"},state:{live:"Live",paused:"Paused"},elapsed:{seconds:"{{count}}s",minutesSeconds:"{{minutes}}m {{seconds}}s",label:"{{time}} elapsed",startingNow:"Starting now"},controls:{stopGeneration:"Stop Generation",pressEscToStop:"Press Esc anytime to stop"},providers:{assistant:"Assistant"}},ple={startChatWithProvider:"Select a project to start chatting with {{provider}}"},mle={nextTaskPrompt:"Start the next task"},hle={codeBlock:Goe,copyMessage:Voe,messageTypes:Woe,tools:qoe,search:Koe,fileOperations:Yoe,interactive:Zoe,thinking:Xoe,json:Joe,permissions:Qoe,todo:ele,plan:tle,usageLimit:rle,codex:nle,gemini:ale,qwen:ile,input:sle,thinkingMode:ole,providerSelection:lle,session:cle,shell:dle,claudeStatus:ule,projectSelection:ple,tasks:mle},fle={changes:"changes",previousChange:"Previous change",nextChange:"Next change",hideDiff:"Hide diff highlighting",showDiff:"Show diff highlighting",settings:"Editor Settings",collapse:"Collapse editor",expand:"Expand editor to full width"},gle="Loading {{fileName}}...",ble={showingChanges:"Showing changes"},xle={download:"Download file",save:"Save",saving:"Saving...",saved:"Saved!",exitFullscreen:"Exit fullscreen",fullscreen:"Fullscreen",close:"Close",previewMarkdown:"Preview markdown",editMarkdown:"Edit markdown"},yle={lines:"Lines:",characters:"Characters:",shortcuts:"Press Ctrl+S to save • Esc to close"},vle={title:"Binary File",message:'The file "{{fileName}}" cannot be displayed in the text editor because it is a binary file.'},wle={toolbar:fle,loading:gle,header:ble,actions:xle,footer:yle,binaryFile:vle},kle={title:"TaskMaster AI is not configured",description:"TaskMaster helps break down complex projects into manageable tasks with AI-powered assistance",whatIsTitle:"🎯 What is TaskMaster?",features:{aiPowered:"AI-Powered Task Management: Break complex projects into manageable subtasks",prdTemplates:"PRD Templates: Generate tasks from Product Requirements Documents",dependencyTracking:"Dependency Tracking: Understand task relationships and execution order",progressVisualization:"Progress Visualization: Kanban boards and detailed task analytics",cliIntegration:"CLI Integration: Use taskmaster commands for advanced workflows"},initializeButton:"Initialize TaskMaster AI"},Sle={title:"Getting Started with TaskMaster",subtitle:"TaskMaster is initialized! Here's what to do next:",steps:{createPRD:{title:"Create a Product Requirements Document (PRD)",description:"Discuss your project idea and create a PRD that describes what you want to build.",addButton:"Add PRD",existingPRDs:"Existing PRDs:"},generateTasks:{title:"Generate Tasks from PRD",description:"Once you have a PRD, ask your AI assistant to parse it and TaskMaster will automatically break it down into manageable tasks with implementation details."},analyzeTasks:{title:"Analyze & Expand Tasks",description:"Ask your AI assistant to analyze task complexity and expand them into detailed subtasks for easier implementation."},startBuilding:{title:"Start Building",description:"Ask your AI assistant to begin working on tasks, update their status, and add new tasks as your project evolves."}},tip:"💡 Tip: Start with a PRD to get the most out of TaskMaster's AI-powered task generation"},Cle={title:"TaskMaster Setup",subtitle:"Interactive CLI for {{projectName}}",willStart:"TaskMaster initialization will start automatically",completed:"TaskMaster setup completed! You can now close this window.",closeButton:"Close",closeContinueButton:"Close & Continue"},Nle={title:"Getting Started with TaskMaster",subtitle:"Your guide to productive task management",examples:{parsePRD:`💬 Example:
798
+ `),n=Math.max(t.length,r.length);for(let a=0;a<n;a+=1)if(t[a]!==r[a])return a+1;return null}function $ae(e,t){const r=encodeURIComponent(e);return t&&t>0?`${r}#L${t}`:r}const Hae={M:"M",A:"A",D:"D",U:"U"},Gae={M:"border-amber-400/40 bg-amber-500/10 text-amber-700 dark:text-amber-200",A:"border-emerald-400/40 bg-emerald-500/10 text-emerald-700 dark:text-emerald-200",D:"border-red-400/40 bg-red-500/10 text-red-700 dark:text-red-200",U:"border-sky-400/40 bg-sky-500/10 text-sky-700 dark:text-sky-200"};function Vae(e){return e?new Intl.DateTimeFormat(void 0,{hour:"2-digit",minute:"2-digit",second:"2-digit"}).format(e):null}function Wae({changedFiles:e,isLoading:t,error:r,latestChangedFilePath:n,lastCheckedAt:a,trackingMode:s,onTrackingModeChange:o,onRefresh:l,onOpenFile:c,variant:d="rail"}){const u=Vae(a),p=d==="panel";return i.jsxs("aside",{className:xe("h-full min-h-0 flex-col overflow-hidden bg-card/45",p?"flex w-full rounded-none border-0":"hidden w-[260px] shrink-0 rounded-lg border border-border/60 shadow-sm xl:flex"),children:[i.jsxs("div",{className:"flex items-center justify-between gap-2 border-b border-border/60 px-3 py-2",children:[i.jsxs("div",{className:"min-w-0",children:[i.jsxs("div",{className:"flex items-center gap-2 text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:[i.jsx("span",{className:"h-2 w-2 rounded-full bg-emerald-500 shadow-[0_0_10px_rgba(16,185,129,0.75)]"}),"Command Center"]}),i.jsx("p",{className:"mt-0.5 truncate text-[11px] text-muted-foreground",children:e.length>0?`${e.length} local change${e.length===1?"":"s"}`:"Watching agent writes"})]}),i.jsx("button",{type:"button",onClick:l,className:"inline-flex h-7 w-7 shrink-0 items-center justify-center rounded-md border border-border bg-background text-muted-foreground transition-colors hover:bg-accent hover:text-foreground","aria-label":"Refresh changed files",title:"Refresh changed files",children:t?i.jsx(_t,{className:"h-3.5 w-3.5 animate-spin"}):i.jsx(at,{className:"h-3.5 w-3.5"})})]}),i.jsx("div",{className:"border-b border-border/60 px-3 py-2",children:i.jsxs("div",{className:"grid grid-cols-2 rounded-md border border-border bg-background p-0.5 text-[11px] font-medium",children:[i.jsx("button",{type:"button",onClick:()=>o("local"),className:`rounded px-2 py-1 transition-colors ${s==="local"?"bg-foreground text-background shadow-sm":"text-muted-foreground hover:bg-muted hover:text-foreground"}`,title:"Local changes: agent writes and filesystem edits",children:"Local changes"}),i.jsx("button",{type:"button",onClick:()=>o("git"),className:`rounded px-2 py-1 transition-colors ${s==="git"?"bg-foreground text-background shadow-sm":"text-muted-foreground hover:bg-muted hover:text-foreground"}`,title:"Git changes: git status only",children:"Git changes"})]})}),r&&i.jsx("div",{className:"mx-3 mt-3 rounded-md border border-amber-500/25 bg-amber-500/10 px-2 py-1.5 text-[11px] leading-5 text-amber-700 dark:text-amber-200",children:r}),i.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto p-2",children:e.length===0?i.jsxs("div",{className:"flex h-full flex-col items-center justify-center px-3 text-center text-muted-foreground",children:[i.jsx(ia,{className:"mb-2 h-8 w-8 opacity-45"}),i.jsx("p",{className:"text-xs font-medium text-foreground",children:"No local changes detected"}),i.jsx("p",{className:"mt-1 text-[11px] leading-5",children:"When an agent writes or edits files, they will appear here."})]}):i.jsxs("div",{className:"space-y-1",children:[e.slice(0,12).map(f=>{const h=n===f.path,g=Uae(f.diffInfo),b=g?`L${g}`:null,x=$ae(f.path,g);return i.jsxs("button",{type:"button",onClick:()=>c(f),className:`group flex w-full items-center gap-2 rounded-md border px-2 py-1.5 text-left transition-all ${h?"changed-file-flash border-emerald-500/60 bg-emerald-500/15":"border-border/60 bg-background/70 hover:border-emerald-500/35 hover:bg-emerald-500/10"}`,title:x,children:[i.jsx("span",{className:`inline-flex h-5 min-w-5 items-center justify-center rounded border px-1 text-[10px] font-semibold ${Gae[f.status]}`,children:Hae[f.status]}),i.jsx("span",{className:"min-w-0 flex-1 truncate font-mono text-[11px] text-foreground",children:f.path}),b&&i.jsx("span",{className:"shrink-0 rounded border border-border bg-muted px-1.5 py-0.5 font-mono text-[10px] text-muted-foreground",children:b})]},`${f.status}:${f.path}`)}),e.length>12&&i.jsxs("p",{className:"px-1 pt-1 text-[11px] text-muted-foreground",children:["+",e.length-12," more files"]})]})}),u&&i.jsxs("div",{className:"border-t border-border/60 px-3 py-2 text-[10px] text-muted-foreground",children:["Last check ",u]})]})}function qae(e){return e instanceof Error?`${e.name}: ${e.message}`:String(e)}function Kae({error:e,resetErrorBoundary:t,showDetails:r,componentStack:n}){return i.jsx("div",{className:"flex flex-col items-center justify-center p-8 text-center",children:i.jsxs("div",{className:"max-w-md rounded-lg border border-red-200 bg-red-50 p-6",children:[i.jsxs("div",{className:"mb-4 flex items-center",children:[i.jsx("div",{className:"flex-shrink-0",children:i.jsx("svg",{className:"h-5 w-5 text-red-400",viewBox:"0 0 20 20",fill:"currentColor",children:i.jsx("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zM8.707 7.293a1 1 0 00-1.414 1.414L8.586 10l-1.293 1.293a1 1 0 101.414 1.414L10 11.414l1.293 1.293a1 1 0 001.414-1.414L11.414 10l1.293-1.293a1 1 0 00-1.414-1.414L10 8.586 8.707 7.293z",clipRule:"evenodd"})})}),i.jsx("h3",{className:"ml-3 text-sm font-medium text-red-800",children:"Something went wrong"})]}),i.jsxs("div",{className:"text-sm text-red-700",children:[i.jsx("p",{className:"mb-2",children:"An error occurred while loading the chat interface."}),r&&i.jsxs("details",{className:"mt-4",children:[i.jsx("summary",{className:"cursor-pointer font-mono text-xs",children:"Error Details"}),i.jsxs("pre",{className:"mt-2 max-h-40 overflow-auto rounded bg-red-100 p-2 text-xs",children:[qae(e),n]})]})]}),i.jsx("div",{className:"mt-4",children:i.jsx("button",{onClick:t,className:"rounded bg-red-600 px-4 py-2 text-sm text-white hover:bg-red-700 focus:outline-none focus:ring-2 focus:ring-red-500",children:"Try Again"})})]})})}function Yae({children:e,showDetails:t=!1,onRetry:r=void 0,resetKeys:n=void 0}){const[a,s]=m.useState(null),o=m.useCallback((d,u)=>{console.error("ErrorBoundary caught an error:",d,u),s(u?.componentStack??null)},[]),l=m.useCallback(()=>{s(null),r?.()},[r]),c=m.useCallback(({error:d,resetErrorBoundary:u})=>i.jsx(Kae,{error:d,resetErrorBoundary:u,showDetails:t,componentStack:a}),[t,a]);return i.jsx(x6,{fallbackRender:c,onError:o,onReset:l,resetKeys:n,children:e})}const Zae=new Set(["files","shell","git","changes","liveView"]),Xae=40,Jae=50,Qae=46,PN="command-center-tracking-mode";function Od(e){return Zae.has(e)}function eie(e){return Math.min(Jae,Math.max(Xae,e))}function LN(){return typeof window<"u"&&window.matchMedia?.("(prefers-reduced-motion: reduce)").matches}function tie({selectedProject:e,selectedSession:t,activeTab:r,setActiveTab:n,ws:a,sendMessage:s,latestMessage:o,isMobile:l,onMenuClick:c,isLoading:d,onInputFocusChange:u,onSessionActive:p,onSessionInactive:f,onSessionProcessing:h,onSessionNotProcessing:g,processingSessions:b,onReplaceTemporarySession:x,onNavigateToSession:y,onShowSettings:v,externalMessageUpdate:w,onQuickStartSession:k,onQuickStartOrchestration:S}){const{preferences:N}=tp(),{autoExpandTools:E,showRawParameters:I,showThinking:A,autoScrollToBottom:T,sendByCtrlEnter:_}=N,[j,R]=m.useState("split"),[C,D]=m.useState(Qae),[B,F]=m.useState(!1),[V,K]=m.useState(!1),[L,G]=m.useState(()=>typeof window>"u"?"local":window.localStorage.getItem(PN)==="git"?"git":"local"),[H,z]=m.useState(()=>Od(r)?"chat":r),[te,se]=m.useState(()=>typeof window<"u"&&window.innerWidth>=1024),me=Od(r)?r:null,de=!!(me&&!l&&te&&j==="split"),ce=m.useRef(null),ye=m.useRef(null),he=m.useRef(null),ke=m.useRef(null),ve=m.useRef(null);Q3(ce,r);const{editingFile:je,editorWidth:M,editorExpanded:ae,hasManualWidth:ue,resizeHandleRef:Y,handleFileOpen:U,handleCloseEditor:Q,handleToggleEditorExpand:J,handleResizeStart:re}=gne({selectedProject:e,isMobile:l}),le=H==="orchestration"?"orchestration":"chat",Ee=me?le:r,fe=!!de,ne=!!(me==="files"&&je&&!l),Z=Ee==="chat"&&(!me||fe),W=Ee==="orchestration"&&fe,{changedFiles:pe,isLoading:Ae,error:Le,lastCheckedAt:Ge,latestDetectedFile:rt,refresh:Ke}=fne(e,!!e,o,L),{latestDetectedFile:ct}=XI(e,o,N.autoShowAgentDiff);JI(e,N.autoShowAgentDiff,je?[je.path]:[],U);const[st,nt]=m.useState(null),bt=m.useRef(0),Nt=m.useRef(0),Pt=m.useMemo(()=>pe.map(Re=>Re.path),[pe]),Bt=m.useCallback(async Re=>{if(Re.diffInfo)return Re.diffInfo;if(!e)return null;try{const Me=await Ce(`/api/git/file-with-diff?project=${encodeURIComponent(e.name)}&file=${encodeURIComponent(Re.path)}`,{cache:"no-store"}),Ze=await Me.json();if(Me.ok&&!Ze.error&&typeof Ze.currentContent=="string"&&typeof Ze.oldContent=="string")return{old_string:Ze.oldContent,new_string:Ze.currentContent}}catch{}if(Re.status==="A"||Re.status==="U")try{const Me=await Lt.readFile(e.name,Re.path);if(!Me.ok)return null;const Ze=await Me.json();if(typeof Ze.content=="string")return{old_string:"",new_string:Ze.content}}catch{return null}return null},[e]),Ar=m.useCallback(Re=>{nt(Re.path),U(Re.path,Re.diffInfo??null),!l&&te&&R("split"),n("files"),Re.diffInfo||Bt(Re).then(Me=>{Me&&U(Re.path,Me)})},[te,U,Bt,l,n]),Vt=m.useCallback(()=>{R("split"),n(le)},[n,le]),br=Re=>Re==="files"?ne?i.jsxs("div",{className:"flex h-full min-w-0 overflow-hidden",children:[!ae&&i.jsx("div",{className:"h-full min-w-[220px] max-w-[50%] flex-[0_0_46%] overflow-hidden border-r border-border/60",children:i.jsx(Ng,{selectedProject:e,onFileOpen:U,changedFilePaths:Pt,focusedFilePath:st})}),i.jsx(RN,{editingFile:je,isMobile:l,editorExpanded:ae,editorWidth:M,hasManualWidth:ue,resizeHandleRef:Y,onResizeStart:re,onCloseEditor:Q,onToggleEditorExpand:J,projectPath:e?.path,fillSpace:!0})]}):i.jsx(Ng,{selectedProject:e,onFileOpen:U,changedFilePaths:Pt,focusedFilePath:st}):Re==="shell"?i.jsx(Ao,{project:e,session:t,showHeader:!1,isActive:r==="shell"}):Re==="changes"?i.jsx(Wae,{changedFiles:pe,isLoading:Ae,error:Le,latestChangedFilePath:rt?.path??st,lastCheckedAt:Ge,trackingMode:L,onTrackingModeChange:G,onRefresh:()=>{Ke("manual")},onOpenFile:Ar,variant:"panel"}):Re==="liveView"?e?i.jsx(jre,{selectedProject:e,onAvailabilityChange:K}):null:i.jsx(_I,{selectedProject:e,isMobile:l,onFileOpen:U});m.useEffect(()=>{if(!e){K(!1);return}let Re=!1;return Ce(`/api/live-view/${encodeURIComponent(e.name)}/status`,{cache:"no-store"}).then(Me=>Me.ok?Me.json():null).then(Me=>{Re||K(!!(Me?.target?.available||Me?.session))}).catch(()=>{Re||K(!1)}),()=>{Re=!0}},[e]),m.useEffect(()=>{if(typeof window>"u")return;const Re=()=>{se(window.innerWidth>=1024)};return Re(),window.addEventListener("resize",Re),()=>{window.removeEventListener("resize",Re)}},[]),m.useEffect(()=>{typeof window>"u"||window.localStorage.setItem(PN,L)},[L]),m.useEffect(()=>{Od(r)||z(r)},[r]);const tr=m.useCallback(Re=>{const Me=typeof Re=="function"?Re(r):Re;!l&&te&&Od(Me)?r===Me?(ve.current=ke.current?.getBoundingClientRect()??null,R(Ze=>Ze==="split"?"full":"split")):R("split"):(R("split"),z(Me)),n(Me)},[r,te,l,n]),Fe=m.useCallback(Re=>{if(!ye.current||!fe)return;Re.preventDefault(),Re.currentTarget.setPointerCapture?.(Re.pointerId),F(!0);const Me=yt=>{const zt=ye.current?.getBoundingClientRect();if(!zt||zt.width<=0)return;const Ue=(zt.right-yt)/zt.width*100;D(eie(Ue))};Me(Re.clientX);const Ze=yt=>{Me(yt.clientX)},xt=()=>{F(!1),window.removeEventListener("pointermove",Ze),window.removeEventListener("pointerup",xt),window.removeEventListener("pointercancel",xt)};window.addEventListener("pointermove",Ze),window.addEventListener("pointerup",xt,{once:!0}),window.addEventListener("pointercancel",xt,{once:!0})},[fe]);return m.useLayoutEffect(()=>{const Re=ve.current,Me=ke.current;if(!Re||!Me||LN()){ve.current=null;return}const Ze=Me.getBoundingClientRect();if(Ze.width<=0||Ze.height<=0){ve.current=null;return}const xt=Re.left-Ze.left,yt=Re.width/Ze.width;Ln.fromTo(Me,{x:xt,scaleX:yt,opacity:.94,transformOrigin:"right center"},{x:0,scaleX:1,opacity:1,duration:yr.duration.enter,ease:yr.ease.soft,clearProps:"transform,opacity,transformOrigin"}),ve.current=null},[j,de]),m.useEffect(()=>{de||F(!1)},[de]),m.useEffect(()=>{if(!fe||LN())return;const Re=he.current,Me=ke.current;if(!Re||!Me)return;const Ze=Ln.context(()=>{Ln.fromTo(Re,{opacity:.92,x:-14},{opacity:1,x:0,duration:yr.duration.base,ease:yr.ease.out,clearProps:"transform,opacity"}),Ln.fromTo(Me,{opacity:0,x:28,scaleX:.96,transformOrigin:"right center"},{opacity:1,x:0,scaleX:1,duration:yr.duration.enter,ease:yr.ease.soft,clearProps:"transform,opacity,transformOrigin"})},ye);return()=>Ze.revert()},[me,fe]),m.useEffect(()=>{rt&&rt.detectedAt!==bt.current&&(bt.current=rt.detectedAt,nt(rt.path))},[rt]),m.useEffect(()=>{if(!ct||ct.detectedAt===Nt.current||(Nt.current=ct.detectedAt,N.autoShowAgentDiff==="off"))return;const{path:Re,diffInfo:Me}=ct,Ze=je?.path?.replace(/\\/g,"/"),xt=Re.replace(/\\/g,"/");if(Ze===xt){U(Re,Me);return}N.autoShowAgentDiff==="always"&&(U(Re,Me),!l&&te&&R("split"),n("files"))},[ct,N.autoShowAgentDiff,je?.path,U,l,te,n]),m.useEffect(()=>{if(!st)return;const Re=window.setTimeout(()=>nt(null),7e3);return()=>window.clearTimeout(Re)},[st]),d?i.jsx(Pg,{mode:"loading",isMobile:l,onMenuClick:c}):!e&&r==="controlRoom"?i.jsxs("div",{className:"flex h-full flex-col",children:[i.jsx(_N,{activeTab:r,setActiveTab:tr,selectedProject:null,selectedSession:null,liveViewAvailable:!1,activeSidePanelTab:null,sidePanelMode:j,canUseSidePanelSplit:te,isMobile:l,onMenuClick:c}),i.jsx("div",{className:"flex min-h-0 flex-1 overflow-hidden",children:i.jsx("div",{className:"flex min-h-0 min-w-0 flex-1 flex-col overflow-hidden",children:i.jsx(Ig,{selectedProject:null})})})]}):e?i.jsxs("div",{className:"flex h-full flex-col",children:[i.jsx(_N,{activeTab:r,setActiveTab:tr,selectedProject:e,selectedSession:t,liveViewAvailable:V,activeSidePanelTab:me,sidePanelMode:j,canUseSidePanelSplit:te,isMobile:l,onCloseSidePanel:me?Vt:void 0,onMenuClick:c}),i.jsxs("div",{className:"flex min-h-0 flex-1 overflow-hidden",children:[i.jsxs("div",{ref:ce,className:xe("flex min-h-0 min-w-[200px] flex-1 flex-col overflow-hidden",ae&&"hidden",!je&&!me&&!de&&"mx-auto w-full max-w-[1100px] px-4 md:px-8",!je&&me&&!fe&&"w-full px-3 md:px-4",!je&&fe&&"w-full px-3 md:px-4",!je&&r==="orchestration"&&"max-w-none px-0 md:px-0",!je&&r==="remote"&&"max-w-none px-0 md:px-0",!je&&r==="controlRoom"&&"max-w-none px-0 md:px-0"),children:[(Z||W||me)&&i.jsxs("div",{ref:ye,className:xe("h-full min-h-0",fe&&"flex overflow-hidden",B&&"select-none"),children:[Z&&i.jsx("div",{ref:he,className:xe("min-h-0 overflow-hidden",fe&&"min-w-[320px] flex-none transition-[width,opacity,transform] duration-300 ease-out",B&&"transition-none",!fe&&"h-full"),style:fe?{width:`${100-C}%`}:void 0,children:i.jsx("div",{className:"flex h-full min-h-0 min-w-0 flex-1",children:i.jsx("div",{className:"min-h-0 min-w-0 flex-1 overflow-hidden",children:i.jsx(Yae,{showDetails:!0,children:i.jsx($ee,{selectedProject:e,selectedSession:t,ws:a,sendMessage:s,latestMessage:o,onFileOpen:U,onInputFocusChange:u,onSessionActive:p,onSessionInactive:f,onSessionProcessing:h,onSessionNotProcessing:g,processingSessions:b,onReplaceTemporarySession:x,onNavigateToSession:y,onShowSettings:v,autoExpandTools:E,showRawParameters:I,showThinking:A,autoScrollToBottom:T,sendByCtrlEnter:_,externalMessageUpdate:w})})})})}),W&&i.jsx("div",{ref:he,className:xe("min-h-0 overflow-hidden",fe&&"min-w-[320px] flex-none transition-[width,opacity,transform] duration-300 ease-out",B&&"transition-none"),style:fe?{width:`${100-C}%`}:void 0,children:i.jsx("div",{className:"flex h-full min-h-0 min-w-0 flex-1",children:i.jsx("div",{className:"min-h-0 min-w-0 flex-1 overflow-hidden",children:i.jsx(tN,{selectedProject:e})})})}),fe&&i.jsxs("button",{type:"button",className:"group relative z-20 mx-1 flex w-3 shrink-0 cursor-col-resize touch-none items-center justify-center rounded-full focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/40",onPointerDown:Fe,"aria-label":"Resize side panel",title:"Drag to resize",children:[i.jsx("span",{className:"absolute inset-y-3 -left-2 -right-2 rounded-full"}),i.jsx("span",{className:xe("h-16 w-1 rounded-full bg-border transition-all duration-200 group-hover:h-24 group-hover:bg-foreground/40",B&&"h-28 bg-foreground/55 shadow-[0_0_18px_rgba(120,120,120,0.22)]")})]}),me&&i.jsx("div",{ref:ke,className:xe("min-h-0 overflow-hidden rounded-lg border border-border/60 bg-card/40",fe&&"min-w-[360px] flex-none shadow-sm transition-[width,opacity,transform] duration-300 ease-out",B&&"transition-none",!fe&&"h-full w-full"),style:fe?{width:`${C}%`}:void 0,children:br(me)})]}),!me&&r==="orchestration"&&i.jsx("div",{className:"flex h-full min-h-0 min-w-0 overflow-hidden",children:i.jsx("div",{className:"min-h-0 min-w-0 flex-1 overflow-hidden",children:i.jsx(tN,{selectedProject:e})})}),!me&&r==="remote"&&i.jsx("div",{className:"flex h-full min-h-0 min-w-0 overflow-hidden",children:i.jsx("div",{className:"min-h-0 min-w-0 flex-1 overflow-hidden",children:i.jsx($I,{})})}),!me&&r==="controlRoom"&&i.jsx("div",{className:"flex h-full min-h-0 min-w-0 overflow-hidden",children:i.jsx("div",{className:"min-h-0 min-w-0 flex-1 overflow-hidden",children:i.jsx(Ig,{selectedProject:e})})}),i.jsx("div",{className:`h-full overflow-hidden ${r==="preview"?"block":"hidden"}`}),r.startsWith("plugin:")&&i.jsx("div",{className:"h-full overflow-hidden",children:i.jsx(qI,{pluginName:r.replace("plugin:",""),selectedProject:e,selectedSession:t})})]}),!ne&&i.jsx(RN,{editingFile:je,isMobile:l,editorExpanded:ae,editorWidth:M,hasManualWidth:ue,resizeHandleRef:Y,onResizeStart:re,onCloseEditor:Q,onToggleEditorExpand:J,projectPath:e.path,fillSpace:r==="files"})]})]}):i.jsx(Pg,{mode:"empty",isMobile:l,onMenuClick:c,onQuickStartSession:k,onQuickStartOrchestration:S,onOpenControlRoom:()=>n("controlRoom")})}const rie=cn.memo(tie),xi="hermes --yolo",nie="hermes sessions browse",aie="hermes model",iie="hermes cron list",sie="hermes status --deep",oie=260,lie=520,cie=340,die=320,uie=680,pie=420,mie=150,hie=560,fie=256,v6="pixcode.workbench.workspaceTabs.v1",w6="pixcode.workbench.cliState.v1",k6="pixcode.workbench.editorState.v1",S6="pixcode.workbench.hermesState.v1",Tw=10,Aw=["claude","codex","cursor","gemini","qwen","opencode"],C6=30;function ef(e,t,r){return Math.min(r,Math.max(t,e))}function jl(e){return e==="remote"||e==="controlRoom"||e.startsWith("plugin:")}function gie(e){return e==="git"||e==="changes"?"sourceControl":"explorer"}function Fr(e){return e.fullPath||e.path||e.displayName||e.name}function Bu(e){const t=Fr(e),n=t.replace(/\\/g,"/").split("/").filter(Boolean);return n.length===0?t||e.name:`/${n[n.length-1]}`}function N6(e,t){return typeof e!="number"||!Number.isFinite(e)?t("vscodeWorkbench.projects.fileCountPending",{defaultValue:"Files pending"}):t("vscodeWorkbench.projects.fileCount",{count:e,formattedCount:e.toLocaleString(),defaultValue:"{{formattedCount}} files"})}function ds(e){return(e.fullPath||e.path||e.name).replace(/\\/g,"/")}function io(e){return e?Fr(e).replace(/\\/g,"/"):null}function bie(e){return e?Fr(e).replace(/\\/g,"/"):null}function xie(e){return typeof e=="string"&&Aw.includes(e)}function yie(e){if(!e||typeof e!="object"||Array.isArray(e))return!1;const t=e;return typeof t.name=="string"&&typeof t.path=="string"}function vie(){if(typeof window>"u")return[];try{const e=JSON.parse(window.localStorage.getItem(v6)??"[]");return Array.isArray(e)?e.filter(t=>typeof t.id=="string"&&typeof t.projectName=="string").slice(0,Tw):[]}catch{return[]}}function wie(e){if(!(typeof window>"u"))try{window.localStorage.setItem(v6,JSON.stringify(e.slice(0,Tw)))}catch{}}function E6(){if(typeof window>"u")return{};try{const e=JSON.parse(window.localStorage.getItem(w6)??"{}");return!e||typeof e!="object"||Array.isArray(e)?{}:e}catch{return{}}}function kie(e){if(!e)return null;const t=E6()[e];return!t||!xie(t.provider)?null:{provider:t.provider,isTerminalOpen:!!t.isTerminalOpen,sessionId:typeof t.sessionId=="string"?t.sessionId:null,updatedAt:typeof t.updatedAt=="number"?t.updatedAt:Date.now()}}function Sie(e,t){if(!(!e||typeof window>"u"))try{const r=E6();window.localStorage.setItem(w6,JSON.stringify({...r,[e]:t}))}catch{}}function T6(){if(typeof window>"u")return{};try{const e=JSON.parse(window.localStorage.getItem(k6)??"{}");return!e||typeof e!="object"||Array.isArray(e)?{}:e}catch{return{}}}function Cie(e){if(!e)return null;const t=T6()[e];if(!t||!Array.isArray(t.tabs))return null;const r=t.tabs.filter(yie).slice(0,C6),n=typeof t.activePath=="string"&&r.some(s=>s.path===t.activePath)?t.activePath:r[0]?.path??null,a=typeof t.splitPath=="string"&&r.some(s=>s.path===t.splitPath)?t.splitPath:null;return{tabs:r,activePath:n,splitPath:a,updatedAt:typeof t.updatedAt=="number"?t.updatedAt:Date.now()}}function Nie(e,t){if(!(!e||typeof window>"u"))try{const r=T6();window.localStorage.setItem(k6,JSON.stringify({...r,[e]:{...t,tabs:t.tabs.slice(0,C6)}}))}catch{}}function A6(){if(typeof window>"u")return{};try{const e=JSON.parse(window.localStorage.getItem(S6)??"{}");return!e||typeof e!="object"||Array.isArray(e)?{}:e}catch{return{}}}function Eie(e){if(!e)return null;const t=A6()[e];return!t||typeof t!="object"?null:{isOpen:!!t.isOpen,viewMode:t.viewMode==="full"?"full":"half",command:typeof t.command=="string"&&t.command.trim()?t.command:xi,title:typeof t.title=="string"&&t.title.trim()?t.title:null,updatedAt:typeof t.updatedAt=="number"?t.updatedAt:Date.now()}}function Md(e,t){if(!(!e||typeof window>"u"))try{const r=A6();window.localStorage.setItem(S6,JSON.stringify({...r,[e]:t}))}catch{}}function Tie(e,t){return{id:ds(e),projectName:e.name,path:Fr(e),label:t,starred:!1}}function Uu(e){return typeof e.summary=="string"&&e.summary||typeof e.title=="string"&&e.title||typeof e.name=="string"&&e.name||e.id}function Lg(e){return typeof e.updated_at=="string"&&e.updated_at||typeof e.lastActivity=="string"&&e.lastActivity||typeof e.created_at=="string"&&e.created_at||typeof e.createdAt=="string"&&e.createdAt||null}function DN(e){const t=Lg(e);if(!t)return"";const r=new Date(t);return Number.isNaN(r.getTime())?"":new Intl.DateTimeFormat(void 0,{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"}).format(r)}function Aie({sidebarProps:e,selectedProject:t,selectedSession:r,activeTab:n,setActiveTab:a,latestMessage:s,onMenuClick:o,isLoading:l,onShowSettings:c,onQuickStartSession:d}){const{t:u}=He("common"),p=m.useRef(null),[f,h]=m.useState(cie),[g,b]=m.useState(pie),[x,y]=m.useState(!1),[v,w]=m.useState(!1),[k,S]=m.useState(null),[N,E]=m.useState(!1),[I,A]=m.useState("shell"),[T,_]=m.useState(0),[j,R]=m.useState(!1),[C,D]=m.useState(null),[B,F]=m.useState(null),[V,K]=m.useState(null),[L,G]=m.useState(fie),[H,z]=m.useState("half"),[te,se]=m.useState(null),[me,de]=m.useState(null),[ce,ye]=m.useState({state:"idle",log:"",error:null,jobId:null,startAfterInstall:!1}),[he,ke]=m.useState(null),[ve,je]=m.useState(!1),[M,ae]=m.useState(!1),[ue,Y]=m.useState(null),[U,Q]=m.useState(!1),J=Qg("alicomert","pixcode"),{preferences:re}=tp(),{latestDetectedFile:le}=XI(t,s,re.autoShowAgentDiff),[Ee,fe]=m.useState("projects"),[ne,Z]=m.useState(null),[W,pe]=m.useState([]),[Ae,Le]=m.useState(null),[Ge,rt]=m.useState(null),[Ke,ct]=m.useState(null),[st,nt]=m.useState(vie),[bt,Nt]=m.useState(null),[Pt,Bt]=m.useState(null),Ar=m.useRef(null),Vt=m.useRef(null),br=m.useRef(!1),tr=m.useRef(0),Fe=m.useMemo(()=>bie(t),[t]),Re=m.useMemo(()=>io(t),[t]),Me=m.useRef(!1),Ze=m.useRef(null),xt=m.useRef(null);m.useEffect(()=>{jl(n)||n==="chat"&&Ee==="projects"||Ee!=="hermes"&&fe(gie(n))},[n,Ee]),m.useEffect(()=>{if(Ze.current===Fe)return;Ze.current=Fe,Me.current=!0,rt(null),ct(null);const we=Cie(Fe),De=we?.tabs??[];pe(De),Le(we?.activePath??De[0]?.path??null),rt(we?.splitPath?De.find(Ie=>Ie.path===we.splitPath)??null:null)},[Fe]),m.useEffect(()=>{if(Me.current){Me.current=!1;return}if(!Fe)return;const we=Ae&&W.some(Ie=>Ie.path===Ae)?Ae:W[0]?.path??null,De=Ge&&W.some(Ie=>Ie.path===Ge.path)?Ge.path:null;Nie(Fe,{tabs:W,activePath:we,splitPath:De,updatedAt:Date.now()})},[Ae,Fe,W,Ge]),m.useEffect(()=>{t&&nt(we=>{const De=ds(t),Ie=we.find(gt=>gt.id===De);if(Ie)return we.map(gt=>gt.id===De?{...Ie,projectName:t.name,path:Fr(t)}:gt);const Ye=`Workspace ${we.length+1}`;return[...we,Tie(t,Ye)].slice(-Tw)})},[t]),m.useEffect(()=>{wie(st)},[st]);const yt=m.useCallback((we,De=null)=>{const gt={name:we.replace(/\\/g,"/").split("/").pop()||we,path:we,projectName:t?.name,diffInfo:De};pe(Mt=>{const hr=Mt.findIndex(Cn=>Cn.path===we);if(hr===-1)return[...Mt,gt];const Wn=[...Mt];return Wn[hr]=gt,Wn}),Le(we),a("files")},[t?.name,a]),zt=m.useCallback((we,De)=>{const Ie=we.replace(/\\/g,"/");pe(Ye=>{const gt=Ye.findIndex(hr=>hr.path===Ie);if(gt===-1)return Ye;const Mt=[...Ye];return Mt[gt]={...Mt[gt],diffInfo:De},Mt})},[]),Ue=m.useCallback((we,De)=>{W.some(Ye=>Ye.path===we)?zt(we,De):yt(we,De)},[W,zt,yt]);JI(t,re.autoShowAgentDiff,W.map(we=>we.path),Ue);const Xe=m.useCallback(we=>{const De=we.replace(/\\/g,"/");pe(Ie=>{const Ye=Ie.findIndex(hr=>hr.path===De);if(Ye===-1)return Ie;const gt=Ie[Ye];if(!gt.diffInfo)return Ie;const Mt=[...Ie];return Mt[Ye]={...gt,diffInfo:null},Mt})},[]);m.useEffect(()=>{if(!le||re.autoShowAgentDiff==="off")return;const{path:we,diffInfo:De}=le;if(W.some(Ye=>Ye.path===we)){zt(we,De);return}re.autoShowAgentDiff==="always"&&yt(we,De)},[le,re.autoShowAgentDiff,W,zt,yt]),m.useEffect(()=>{if(typeof window>"u")return;const we=De=>{const Ie=De.detail;typeof Ie?.path=="string"&&Ie.path&&Xe(Ie.path)};return window.addEventListener("pixcode:file-saved",we),()=>{window.removeEventListener("pixcode:file-saved",we)}},[Xe]);const ht=m.useCallback(we=>{pe(De=>{const Ie=De.filter(Ye=>Ye.path!==we);return Le(Ye=>Ye!==we?Ye:Ie[Ie.length-1]?.path??null),Ie})},[]),lt=m.useCallback(()=>{pe([]),Le(null),rt(null),ct(null)},[]),kt=m.useCallback(we=>{navigator.clipboard?.writeText(we),ct(null)},[]),Wt=m.useCallback((we,De=!1)=>{const Ie=W.find(Ye=>Ye.path===we);Ie&&(rt(Ie),De&&pe(Ye=>{const gt=Ye.filter(Mt=>Mt.path!==we);return Le(Mt=>Mt!==we?Mt:gt[gt.length-1]?.path??null),gt}),ct(null))},[W]),ee=m.useCallback((we,De)=>{we.preventDefault(),ct({filePath:De,x:we.clientX,y:we.clientY})},[]),Te=m.useCallback(we=>{Ar.current?.scrollBy({left:we==="left"?-180:180,behavior:"smooth"})},[]),be=m.useCallback((we,De={})=>{const Ie=De.project??t??null,Ye=we==="hermes"?De.command||xi:null,gt=we==="hermes"&&De.title||null;A(we),R(!!De.forceNewSession),D(Ye),F(gt),K(Ie),E(!0),z("half"),_(Mt=>Mt+1),we==="hermes"&&Md(io(Ie),{isOpen:!0,viewMode:"half",command:Ye,title:gt,updatedAt:Date.now()})},[t]),_e=m.useCallback(async()=>{try{const De=await(await Ce("/api/orchestration/hermes/install-status")).json();de({installed:!!De?.installed,command:typeof De?.command=="string"?De.command:null,version:typeof De?.version=="string"?De.version:null,error:typeof De?.error=="string"?De.error:null})}catch{de({installed:!1,command:null,version:null,error:null})}},[]),Ve=m.useCallback(async()=>{je(!0),Y(null);try{const we=new URLSearchParams;t&&we.set("projectPath",Fr(t));const De=we.toString(),Ie=await Ce(`/api/orchestration/hermes/control-plane${De?`?${De}`:""}`),Ye=await Ie.json().catch(()=>null);if(!Ye||!Ie.ok&&!Ye.profiles&&!Ye.capabilities)throw new Error(Ye?.error?.message||Ye?.error||`HTTP ${Ie.status}`);ke(Ye)}catch(we){Y(we instanceof Error?we.message:u("vscodeWorkbench.hermes.controlPlaneFailed",{defaultValue:"Unable to read Hermes control plane."}))}finally{je(!1)}},[t,u]),ot=m.useCallback(async({force:we=!1,startAfterInstall:De=!1}={})=>{try{Vt.current?.close()}catch{}Vt.current=null,be("hermes-install"),ye({state:"running",log:"",error:null,jobId:null,startAfterInstall:De});try{const Ie=await Ce("/api/orchestration/hermes/install",{method:"POST",body:JSON.stringify({force:we,skipBrowser:!0})}),Ye=await Ie.json().catch(()=>({}));if(!Ie.ok||!Ye?.jobId)throw new Error(Ye?.error?.message||Ye?.error||`HTTP ${Ie.status}`);const gt=String(Ye.jobId);ye(Cn=>({...Cn,jobId:gt}));const Mt=window.localStorage.getItem("auth-token")||"",hr=`/api/orchestration/hermes/install/${encodeURIComponent(gt)}/stream${Mt?`?token=${encodeURIComponent(Mt)}`:""}`,Wn=new EventSource(hr);Vt.current=Wn,Wn.addEventListener("log",Cn=>{try{const si=JSON.parse(Cn.data);typeof si.chunk=="string"&&ye(Ls=>({...Ls,log:`${Ls.log}${si.chunk}`}))}catch{}}),Wn.addEventListener("done",Cn=>{try{const si=JSON.parse(Cn.data);if(!si.success)throw new Error(si.error||u("vscodeWorkbench.hermes.installFailed",{defaultValue:"Hermes install failed."}));ye(Ls=>({...Ls,state:"done",error:null})),_e().then(()=>{De&&be("hermes")})}catch(si){ye(Ls=>({...Ls,state:"error",error:si instanceof Error?si.message:u("vscodeWorkbench.hermes.installFailed",{defaultValue:"Hermes install failed."})}))}finally{try{Wn.close()}catch{}Vt.current=null}}),Wn.onerror=()=>{ye(Cn=>Cn.state==="running"?{...Cn,state:"error",error:u("vscodeWorkbench.hermes.installStreamLost",{defaultValue:"Hermes install stream closed early. The install may still be running."})}:Cn)}}catch(Ie){ye({state:"error",log:"",error:Ie instanceof Error?Ie.message:u("vscodeWorkbench.hermes.installFailed",{defaultValue:"Hermes install failed."}),jobId:null,startAfterInstall:De})}},[be,_e,u]);m.useEffect(()=>()=>{try{Vt.current?.close()}catch{}},[]),m.useEffect(()=>{_e()},[_e]),m.useEffect(()=>{Ve()},[Ve,me?.installed]),m.useEffect(()=>{if(xt.current===Re)return;xt.current=Re;const we=Eie(Re);if(!we?.isOpen){I==="hermes"&&(E(!1),K(t??null));return}A("hermes"),R(!1),D(we.command||xi),F(we.title),K(t??null),E(!0),z(we.viewMode),_(De=>De+1)},[I,t,Re]),m.useEffect(()=>{!Pt||!t||Fr(t)===Pt.projectPath&&(Bt(null),be("hermes",{command:Pt.command,title:Pt.title,forceNewSession:Pt.forceNewSession}))},[be,Pt,t]);const tt=m.useMemo(()=>W.find(we=>we.path===Ae)??W[0]??null,[Ae,W]),kr=V??t;m.useEffect(()=>{let we=!1;const De=async()=>{try{const Ye=await Ce("/api/system/update-state",{cache:"no-store"});if(!Ye.ok)return;const gt=await Ye.json();we||Q(!!gt?.state?.pendingRestart)}catch{}};De(),window.addEventListener("focus",De);const Ie=window.setInterval(De,6e4);return()=>{we=!0,window.removeEventListener("focus",De),window.clearInterval(Ie)}},[]);const $t=m.useCallback(()=>{window.dispatchEvent(new CustomEvent(lu,{detail:{updateAvailable:J.updateAvailable,latestVersion:J.latestVersion,currentVersion:J.currentVersion,releaseInfo:J.releaseInfo,installMode:J.installMode}}))},[J]),kn=m.useMemo(()=>[{id:"explorer",icon:qr,label:u("vscodeWorkbench.activity.explorer"),tab:"files"},{id:"projects",icon:Dr,label:u("vscodeWorkbench.activity.projects"),tab:"chat"},{id:"sourceControl",icon:Kr,label:u("vscodeWorkbench.activity.sourceControl"),tab:"git"},{id:"terminal",icon:Rr,label:u("vscodeWorkbench.activity.terminal"),tab:"shell"}],[u]),Jr=m.useMemo(()=>[{id:"controlRoom",icon:$n,label:u("tabs.controlRoom"),tab:"controlRoom"},{id:"remote",icon:ca,label:u("tabs.remote"),tab:"remote"}],[u]),ra=m.useCallback((we,De)=>{De.preventDefault(),De.currentTarget.setPointerCapture?.(De.pointerId),Z(we)},[]);m.useEffect(()=>{if(!ne)return;const we=Ie=>{const Ye=p.current?.getBoundingClientRect();if(Ye){if(ne==="left"){h(ef(Ie.clientX-Ye.left,oie,lie));return}if(ne==="bottom"){G(ef(Ye.bottom-Ie.clientY,mie,hie));return}b(ef(Ye.right-Ie.clientX,die,uie))}},De=()=>Z(null);return window.addEventListener("pointermove",we),window.addEventListener("pointerup",De,{once:!0}),window.addEventListener("pointercancel",De,{once:!0}),document.body.style.cursor=ne==="bottom"?"ns-resize":"col-resize",document.body.style.userSelect="none",()=>{window.removeEventListener("pointermove",we),window.removeEventListener("pointerup",De),window.removeEventListener("pointercancel",De),document.body.style.cursor="",document.body.style.userSelect=""}},[ne]);const mr=m.useCallback((we,De)=>{if(we==="terminal"){if(!t){fe("projects"),a("chat");return}N&&I==="shell"&&H==="full"?z("half"):N&&I==="shell"?E(!1):be("shell"),n==="shell"&&a("files");return}if(we==="hermes"){fe("hermes"),y(!1),jl(n)&&a("files"),Ve();return}if(fe(we),y(!1),we==="projects"){a("chat");return}(De!=="chat"||!jl(n))&&a(De)},[n,I,H,N,be,Ve,t,a]),ar=m.useCallback((we={})=>{if(!t){const De=e.projects[0];if(De){Bt({projectPath:Fr(De),command:we.command,title:we.title,forceNewSession:we.forceNewSession}),e.onProjectSelect(De),fe("explorer"),a("files");return}fe("projects"),a("chat");return}if(me?.installed!==!0){ot({startAfterInstall:!0});return}be("hermes",we)},[me?.installed,be,t,a,e,ot]),_a=m.useCallback(()=>{if(me?.installed!==!0){ot({startAfterInstall:!0});return}be("hermes",{command:xi,forceNewSession:!0,project:V??t})},[V,me?.installed,be,t,ot]),Ot=m.useCallback(()=>{if(me?.installed!==!0){ot({startAfterInstall:!0});return}be("hermes",{command:nie,title:u("vscodeWorkbench.hermes.history",{defaultValue:"Hermes history"}),forceNewSession:!0,project:V??t})},[V,me?.installed,be,t,ot,u]),ir=m.useCallback(()=>{ot({force:!0})},[ot]),na=m.useCallback(async()=>{if(me?.installed!==!0){ot({startAfterInstall:!0});return}ae(!0),Y(null);try{const we=await Ce("/api/orchestration/hermes/control-plane/repair",{method:"POST",body:JSON.stringify({projectPath:t?Fr(t):void 0,forceRestart:!0})}),De=await we.json().catch(()=>null),Ie=De?.controlPlane??De;if(!Ie||!we.ok&&!Ie.profiles&&!Ie.capabilities)throw new Error(De?.error?.message||De?.error||`HTTP ${we.status}`);ke(Ie)}catch(we){Y(we instanceof Error?we.message:u("vscodeWorkbench.hermes.controlPlaneRepairFailed",{defaultValue:"Unable to repair Hermes control plane."}))}finally{ae(!1),_e()}},[me?.installed,_e,t,ot,u]),Sn=m.useCallback(()=>{ar({command:aie,title:u("vscodeWorkbench.hermes.modelSettings",{defaultValue:"Hermes model"}),forceNewSession:!0,project:t})},[ar,t,u]),Pa=m.useCallback(()=>{ar({command:iie,title:u("vscodeWorkbench.hermes.cronJobs",{defaultValue:"Hermes cron"}),forceNewSession:!0,project:t})},[ar,t,u]),dl=m.useCallback(()=>{ar({command:sie,title:u("vscodeWorkbench.hermes.deepStatus",{defaultValue:"Hermes status"}),forceNewSession:!0,project:t})},[ar,t,u]),Op=m.useCallback(()=>{I==="hermes"&&Md(io(V),{isOpen:!1,viewMode:"half",command:C||xi,title:B,updatedAt:Date.now()}),E(!1),K(null)},[C,I,V,B]),Mp=m.useCallback(()=>{z("full"),I==="hermes"&&Md(io(V),{isOpen:!0,viewMode:"full",command:C||xi,title:B,updatedAt:Date.now()})},[C,I,V,B]),Fp=m.useCallback(()=>{z("half"),I==="hermes"&&Md(io(V),{isOpen:!0,viewMode:"half",command:C||xi,title:B,updatedAt:Date.now()})},[C,I,V,B]);m.useEffect(()=>{const we=De=>{const Ie=De.detail;if(Ie?.mode==="install"){ir();return}if(Ie?.mode==="command"&&Ie.command){ar({command:Ie.command,title:Ie.title||Ie.command,forceNewSession:!0});return}ar({command:xi})};return window.addEventListener("pixcode:hermes-terminal",we),()=>window.removeEventListener("pixcode:hermes-terminal",we)},[ir,ar]);const Wc=m.useCallback(we=>{a(we)},[a]),ii=m.useCallback(we=>{window.dispatchEvent(new CustomEvent("pixcode:create-project",{detail:{workspaceType:we}}))},[]),da=m.useCallback(we=>{e.onProjectSelect(we),fe("explorer"),a("files")},[a,e]),ul=m.useCallback(we=>{const De=e.projects.find(Ie=>Ie.name===we.projectName||ds(Ie)===we.id);De&&da(De)},[da,e.projects]),pl=m.useCallback(we=>{nt(De=>{const Ie=De.filter(gt=>gt.id!==we);if(t&&ds(t)===we){const gt=Ie[Ie.length-1],Mt=gt?e.projects.find(hr=>hr.name===gt.projectName||ds(hr)===gt.id):null;Mt&&window.setTimeout(()=>da(Mt),0)}return Ie})},[da,t,e.projects]),qc=m.useCallback(we=>{nt(De=>De.filter(Ie=>Ie.id===we))},[]),zp=m.useCallback(()=>{nt([])},[]),Bp=m.useCallback((we,De)=>{const Ie=De.trim();Ie&&nt(Ye=>Ye.map(gt=>gt.id===we?{...gt,label:Ie}:gt))},[]),Up=m.useCallback(we=>{nt(De=>De.map(Ie=>Ie.id===we?{...Ie,starred:!Ie.starred}:Ie))},[]);m.useEffect(()=>{const we=window.localStorage.getItem("auth-token")||"",De=`/api/orchestration/hermes/terminal-launches/stream?after=${tr.current}${we?`&token=${encodeURIComponent(we)}`:""}`,Ie=new EventSource(De),Ye=Mt=>{try{const hr=JSON.parse(Mt.data);if(!hr||typeof hr.id!="number"||hr.id<=tr.current||(tr.current=Math.max(tr.current,hr.id),!br.current))return;const Wn=hr.projectPath?e.projects.find(Cn=>Fr(Cn).replace(/\\/g,"/")===hr.projectPath?.replace(/\\/g,"/")):t;Wn&&Wn!==t&&da(Wn),w(!1),se(hr)}catch{}},gt=Mt=>{try{const hr=JSON.parse(Mt.data);typeof hr.latestId=="number"&&(tr.current=Math.max(tr.current,hr.latestId))}catch{}finally{br.current=!0}};return Ie.addEventListener("terminal-launch",Ye),Ie.addEventListener("ready",gt),()=>{Ie.removeEventListener("terminal-launch",Ye),Ie.removeEventListener("ready",gt),Ie.close()}},[da,t,e.projects]);const $p=()=>Ee==="projects"?i.jsx(Uie,{projects:e.projects,selectedProject:t,onProjectSelect:da,onNewSession:e.onNewSession,onOpenProject:()=>ii("existing"),onCloneProject:()=>ii("new"),onRefresh:e.onRefresh,isRefreshing:e.isLoading,t:u}):Ee==="sourceControl"?i.jsx(_I,{selectedProject:t,isMobile:!1,compact:!0,onFileOpen:yt}):Ee==="hermes"?i.jsx(Die,{project:t,installStatus:me,controlPlane:he,loading:ve,repairing:M,error:ue,onRefresh:()=>void Ve(),onRepair:()=>void na(),onStartHermes:()=>ar(),onNewSession:_a,onHistory:Ot,onInstall:ir,onModel:Sn,onCron:Pa,onStatus:dl,t:u}):i.jsx(Oie,{selectedProject:t,onFileOpen:yt,t:u}),Hp=()=>l?i.jsx(Pg,{mode:"loading",isMobile:!1,onMenuClick:o}):n==="remote"?i.jsx($I,{}):n==="controlRoom"?i.jsx(Ig,{selectedProject:t}):n.startsWith("plugin:")?i.jsx(qI,{pluginName:n.replace("plugin:",""),selectedProject:t,selectedSession:r}):t?tt?i.jsxs("div",{className:"flex h-full min-h-0 flex-col bg-background",children:[i.jsxs("div",{className:"flex h-9 shrink-0 items-center border-b border-border bg-muted/20",children:[i.jsx("button",{type:"button",className:"flex h-full w-8 shrink-0 items-center justify-center border-r border-border text-muted-foreground hover:bg-muted hover:text-foreground",onClick:()=>Te("left"),"aria-label":u("vscodeWorkbench.editor.scrollLeft",{defaultValue:"Scroll tabs left"}),title:u("vscodeWorkbench.editor.scrollLeft",{defaultValue:"Scroll tabs left"}),children:i.jsx(Go,{className:"h-3.5 w-3.5"})}),i.jsx("div",{ref:Ar,className:"flex min-w-0 flex-1 overflow-x-auto [scrollbar-width:none] [&::-webkit-scrollbar]:hidden",children:W.map(we=>{const De=we.path===tt.path;return i.jsxs("button",{type:"button",className:xe("group flex h-9 w-44 shrink-0 items-center gap-2 border-r border-border px-2.5 text-xs transition-colors",De?"bg-background text-foreground":"text-muted-foreground hover:bg-muted/50 hover:text-foreground"),onClick:()=>Le(we.path),onContextMenu:Ie=>ee(Ie,we.path),title:we.path,children:[i.jsx(Dr,{className:"h-3.5 w-3.5 shrink-0"}),i.jsx("span",{className:"min-w-0 flex-1 truncate text-left",children:we.name}),i.jsx("span",{role:"button",tabIndex:0,className:"rounded p-0.5 text-muted-foreground opacity-70 transition hover:bg-muted hover:text-foreground group-hover:opacity-100",onClick:Ie=>{Ie.stopPropagation(),ht(we.path)},onKeyDown:Ie=>{(Ie.key==="Enter"||Ie.key===" ")&&(Ie.preventDefault(),Ie.stopPropagation(),ht(we.path))},"aria-label":u("vscodeWorkbench.editor.closeTab",{file:we.name,defaultValue:"Close {{file}}"}),title:u("vscodeWorkbench.editor.closeTab",{file:we.name,defaultValue:"Close {{file}}"}),children:i.jsx(Ct,{className:"h-3 w-3"})})]},we.path)})}),i.jsx("button",{type:"button",className:"flex h-full w-8 shrink-0 items-center justify-center border-l border-border text-muted-foreground hover:bg-muted hover:text-foreground",onClick:()=>Te("right"),"aria-label":u("vscodeWorkbench.editor.scrollRight",{defaultValue:"Scroll tabs right"}),title:u("vscodeWorkbench.editor.scrollRight",{defaultValue:"Scroll tabs right"}),children:i.jsx(Fn,{className:"h-3.5 w-3.5"})}),i.jsx("button",{type:"button",className:"flex h-full w-8 shrink-0 items-center justify-center border-l border-border text-muted-foreground hover:bg-muted hover:text-foreground",onClick:()=>ct({filePath:tt.path,x:window.innerWidth-220,y:84}),"aria-label":u("vscodeWorkbench.editor.moreActions",{defaultValue:"More tab actions"}),title:u("vscodeWorkbench.editor.moreActions",{defaultValue:"More tab actions"}),children:i.jsx(B4,{className:"h-4 w-4"})})]}),i.jsx("div",{className:"min-h-0 flex-1 overflow-hidden",children:Ge?i.jsxs("div",{className:"flex h-full min-w-0",children:[tt&&i.jsx("div",{className:"min-w-0 flex-1 border-r border-border",children:i.jsx(tc,{file:tt,onClose:()=>ht(tt.path),projectPath:t.path||t.fullPath,isSidebar:!0})}),i.jsxs("div",{className:"min-w-0 flex-1",children:[i.jsxs("div",{className:"flex h-8 items-center justify-between border-b border-border bg-muted/20 px-2",children:[i.jsxs("div",{className:"flex min-w-0 items-center gap-2 text-xs text-muted-foreground",children:[i.jsx(Dr,{className:"h-3.5 w-3.5 shrink-0"}),i.jsx("span",{className:"truncate",children:Ge.name})]}),i.jsx("button",{type:"button",className:"rounded p-1 text-muted-foreground hover:bg-muted hover:text-foreground",onClick:()=>rt(null),"aria-label":u("vscodeWorkbench.editor.closeSplit",{defaultValue:"Close split editor"}),title:u("vscodeWorkbench.editor.closeSplit",{defaultValue:"Close split editor"}),children:i.jsx(Ct,{className:"h-3.5 w-3.5"})})]}),i.jsx("div",{className:"h-[calc(100%-2rem)] min-h-0 overflow-hidden",children:i.jsx(tc,{file:Ge,onClose:()=>rt(null),projectPath:t.path||t.fullPath,isSidebar:!0})})]})]}):i.jsx(tc,{file:tt,onClose:()=>ht(tt.path),projectPath:t.path||t.fullPath,isSidebar:!0})}),Ke&&i.jsx(_ie,{context:Ke,file:W.find(we=>we.path===Ke.filePath)??null,onClose:()=>ct(null),onCloseTab:ht,onCloseAll:lt,onCopyPath:kt,onSplitRight:we=>Wt(we),onSplitMoveRight:we=>Wt(we,!0),t:u})]}):i.jsx("div",{className:"flex h-full items-center justify-center bg-background",children:i.jsxs("div",{className:"max-w-md px-6 text-center",children:[i.jsx(us,{className:"mx-auto mb-4 h-10 w-10 text-muted-foreground/60"}),i.jsx("div",{className:"text-sm font-medium text-foreground",children:u("vscodeWorkbench.editor.emptyTitle")}),i.jsx("p",{className:"mt-2 text-xs leading-5 text-muted-foreground",children:t.displayName||t.name})]})}):i.jsx(Mie,{projects:e.projects,onProjectSelect:da,onNewSession:e.onNewSession,onOpenProject:()=>ii("existing"),onCloneProject:()=>ii("new"),onQuickStartSession:d,onOpenHermesAgent:ar,onShowSettings:c,t:u}),Gp=()=>i.jsx(zie,{project:t,session:r,hermesCliLaunch:te,onSessionSelect:e.onSessionSelect,onHeaderContentChange:S,t:u});return i.jsxs("div",{className:"flex h-full min-w-0 flex-1 flex-col overflow-hidden bg-background text-foreground",children:[i.jsx(gT,{...e,isMobile:!1,modalsOnly:!0}),i.jsx(jie,{t:u,onOpenProject:ii,onActivityPanel:mr,onSystemTab:Wc,onOpenHermesAgent:ar,onShowSettings:c,onQuickStartSession:d}),i.jsx(Iie,{tabs:st,projects:e.projects,selectedProject:t,onSelect:ul,onClose:pl,onCloseOthers:qc,onCloseAll:zp,onRename:Bp,onToggleStar:Up,contextMenu:bt,onContextMenuChange:Nt,onAdd:()=>ii("existing"),isCliPanelCollapsed:v,onToggleCliPanel:()=>w(we=>!we),t:u}),i.jsxs("div",{ref:p,className:xe("flex min-h-0 min-w-0 flex-1 overflow-hidden",ne&&"select-none"),children:[i.jsxs("aside",{className:"flex h-full w-12 shrink-0 flex-col border-r border-border bg-muted/30",children:[i.jsx("div",{className:"flex h-11 items-center justify-center border-b border-border",children:i.jsx(Qu,{className:"h-5 w-5 text-primary"})}),i.jsxs("div",{className:"flex flex-1 flex-col items-center gap-1 py-2",children:[kn.map(we=>i.jsx(Il,{label:we.label,icon:we.icon,active:we.id==="terminal"?N:!x&&Ee===we.id&&!jl(n),onClick:()=>mr(we.id,we.tab)},we.id)),i.jsx($ie,{label:u("vscodeWorkbench.activity.hermes",{defaultValue:"Hermes Agent"}),active:!x&&Ee==="hermes",onClick:()=>mr("hermes","files")}),i.jsx(Il,{label:U?u("vscodeWorkbench.activity.updateReady",{defaultValue:"Update ready"}):u("vscodeWorkbench.activity.update",{defaultValue:"Update"}),icon:at,active:!1,badge:J.updateAvailable||U,onClick:$t})]}),i.jsxs("div",{className:"flex flex-col items-center gap-1 border-t border-border py-2",children:[Jr.map(we=>i.jsx(Il,{label:we.label,icon:we.icon,active:n===we.tab,onClick:()=>Wc(we.tab)},we.id)),i.jsx(Il,{label:u(x?"vscodeWorkbench.activity.showPanel":"vscodeWorkbench.activity.hidePanel"),icon:x?Yu:Ku,active:!1,onClick:()=>y(we=>!we)}),i.jsx(Il,{label:u("navigation.settings"),icon:Ht,active:!1,onClick:c})]})]}),!x&&i.jsxs(i.Fragment,{children:[i.jsxs("section",{className:"h-full shrink-0 overflow-hidden border-r border-border bg-background",style:{width:f},children:[i.jsx("div",{className:"flex h-10 items-center justify-between border-b border-border px-3",children:i.jsx("div",{className:"truncate text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:u(`vscodeWorkbench.panels.${Ee}`)})}),i.jsx("div",{className:"h-[calc(100%-2.5rem)] min-h-0 overflow-hidden",children:$p()})]}),i.jsx(MN,{label:u("vscodeWorkbench.resize.left"),active:ne==="left",onPointerDown:we=>ra("left",we)})]}),i.jsxs("main",{className:"min-w-0 flex-1 overflow-hidden border-r border-border bg-background",children:[i.jsxs("div",{className:"flex h-10 items-center justify-between border-b border-border px-3",children:[i.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[i.jsx(Xu,{className:"h-4 w-4 text-muted-foreground"}),i.jsx("span",{className:"truncate text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:jl(n)?u(`tabs.${n==="controlRoom"?"controlRoom":n}`):u("vscodeWorkbench.panels.editor")})]}),i.jsx("span",{className:"truncate text-xs text-muted-foreground",children:t?.displayName||t?.name||u("vscodeWorkbench.noProject")})]}),i.jsxs("div",{className:"relative flex h-[calc(100%-2.5rem)] min-h-0 flex-col overflow-hidden",children:[i.jsx("div",{className:xe("min-h-0 flex-1 overflow-hidden",N&&H==="half"&&"border-b border-border"),children:Hp()}),N&&i.jsx(Pie,{project:kr,mode:I,hermesInstallStatus:me,hermesInstallJob:ce,runId:T,forceNewSession:j,command:C,commandTitle:B,height:L,viewMode:H,isActive:!0,onResizeStart:we=>ra("bottom",we),onShowFull:Mp,onShowHalf:Fp,onStartHermes:_a,onOpenHistory:Ot,onInstallHermes:ir,onClose:Op,t:u})]})]}),!v&&i.jsxs(i.Fragment,{children:[i.jsx(MN,{label:u("vscodeWorkbench.resize.right"),active:ne==="right",onPointerDown:we=>ra("right",we)}),i.jsxs("aside",{className:"h-full shrink-0 overflow-hidden bg-background",style:{width:g},children:[i.jsx("div",{className:"flex h-10 items-center justify-between border-b border-border px-3",children:i.jsx("div",{className:"min-w-0 flex-1 overflow-hidden",children:k||i.jsxs("div",{className:"flex min-w-0 items-center gap-1",children:[i.jsx(Ui,{className:"h-4 w-4 text-muted-foreground"}),i.jsx("span",{className:"truncate text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:u("vscodeWorkbench.panels.cli")})]})})}),i.jsx("div",{className:"h-[calc(100%-2.5rem)] min-h-0 overflow-hidden",children:Gp()})]})]})]})]})}function jie({t:e,onOpenProject:t,onActivityPanel:r,onSystemTab:n,onOpenHermesAgent:a,onShowSettings:s,onQuickStartSession:o}){const[l,c]=m.useState(null),d=m.useMemo(()=>[{label:"File",commands:[{label:e("vscodeWorkbench.menu.openProject",{defaultValue:"Open Project..."}),icon:Bn,type:"existing"},{label:e("vscodeWorkbench.menu.cloneFromGithub",{defaultValue:"Clone Repository..."}),icon:Ju,type:"new"},{label:e("vscodeWorkbench.menu.newChat",{defaultValue:"New Chat"}),icon:Un,action:o},{label:e("navigation.settings"),icon:Ht,action:s}]},{label:"Edit",commands:[{label:e("vscodeWorkbench.menu.newChat",{defaultValue:"New Chat"}),icon:Ut,action:o}]},{label:"Selection",commands:[{label:e("vscodeWorkbench.menu.openProjects",{defaultValue:"Open Projects"}),icon:qr,action:()=>r("projects","chat")}]},{label:"View",commands:[{label:e("vscodeWorkbench.activity.explorer"),icon:qr,action:()=>r("explorer","files")},{label:e("vscodeWorkbench.activity.projects"),icon:Dr,action:()=>r("projects","chat")},{label:e("vscodeWorkbench.activity.sourceControl"),icon:Kr,action:()=>r("sourceControl","git")},{label:e("vscodeWorkbench.activity.hermes",{defaultValue:"Hermes Agent"}),icon:pr,action:()=>r("hermes","files")}]},{label:"Go",commands:[{label:e("tabs.controlRoom"),icon:$n,action:()=>n("controlRoom")},{label:e("tabs.remote"),icon:ca,action:()=>n("remote")}]},{label:"Run",commands:[{label:e("vscodeWorkbench.hermes.title",{defaultValue:"Hermes Agent"}),icon:pr,action:a}]},{label:"Terminal",commands:[{label:e("vscodeWorkbench.panels.cli"),icon:Ui,action:()=>r("terminal","shell")}]},{label:"Help",commands:[{label:e("navigation.settings"),icon:Ht,action:s}]}],[r,o,a,s,n,e]),u=p=>{if(c(null),p.type){t(p.type);return}p.action?.()};return i.jsx("div",{className:"flex h-8 shrink-0 items-center border-b border-border bg-muted/20 px-2 text-xs text-muted-foreground",children:i.jsx("div",{className:"flex h-full items-center gap-0.5",children:d.map(p=>i.jsxs("div",{className:"relative h-full",children:[i.jsxs("button",{type:"button",className:xe("flex h-full items-center gap-1 rounded px-2 transition-colors hover:bg-muted hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/40",l===p.label&&"bg-muted text-foreground"),onClick:()=>c(f=>f===p.label?null:p.label),children:[p.label,i.jsx(Mn,{className:"h-3 w-3"})]}),l===p.label&&i.jsx("div",{className:"absolute left-0 top-full z-50 mt-1 min-w-52 overflow-hidden rounded-md border border-border bg-popover py-1 text-popover-foreground shadow-xl shadow-black/10",children:p.commands.map(f=>{const h=f.icon;return i.jsxs("button",{type:"button",className:"flex w-full items-center gap-2 px-3 py-2 text-left text-xs transition-colors hover:bg-muted focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/40",onClick:()=>u(f),children:[h&&i.jsx(h,{className:"h-3.5 w-3.5 text-muted-foreground"}),i.jsx("span",{className:"truncate",children:f.label})]},f.label)})})]},p.label))})})}function Iie({tabs:e,projects:t,selectedProject:r,onSelect:n,onClose:a,onCloseOthers:s,onCloseAll:o,onRename:l,onToggleStar:c,contextMenu:d,onContextMenuChange:u,onAdd:p,isCliPanelCollapsed:f,onToggleCliPanel:h,t:g}){const b=r?ds(r):null,[x,y]=m.useState(null),[v,w]=m.useState(""),k=m.useRef(null),S=m.useMemo(()=>e.map(_=>({tab:_,project:t.find(j=>j.name===_.projectName||ds(j)===_.id)})).filter(_=>!!_.project),[t,e]),N=_=>{u(null),y(_.id),w(_.label)},E=()=>{x&&(l(x,v),y(null),w(""))},I=(_,j)=>{_.preventDefault(),n(j),u({tabId:j.id,x:_.clientX,y:_.clientY})},A=_=>{k.current?.scrollBy({left:_==="left"?-220:220,behavior:"smooth"})},T=d?S.find(_=>_.tab.id===d.tabId)??null:null;return i.jsxs("div",{className:"relative flex h-9 shrink-0 items-center border-b border-border bg-background text-xs",children:[i.jsx("button",{type:"button",className:"flex h-full w-8 shrink-0 items-center justify-center border-r border-border text-muted-foreground hover:bg-muted hover:text-foreground",onClick:()=>A("left"),"aria-label":g("vscodeWorkbench.workspace.scrollLeft",{defaultValue:"Scroll workspaces left"}),title:g("vscodeWorkbench.workspace.scrollLeft",{defaultValue:"Scroll workspaces left"}),children:i.jsx(Go,{className:"h-3.5 w-3.5"})}),i.jsxs("div",{ref:k,className:"flex h-full min-w-0 flex-1 items-center overflow-x-auto [scrollbar-width:none] [&::-webkit-scrollbar]:hidden",children:[S.length===0?i.jsxs("button",{type:"button",onClick:p,className:"flex h-8 min-w-0 items-center gap-2 border-r border-border px-3 text-muted-foreground hover:bg-muted/40 hover:text-foreground",children:[i.jsx(Bn,{className:"h-3.5 w-3.5 shrink-0"}),i.jsx("span",{className:"truncate",children:g("vscodeWorkbench.workspace.openFirst",{defaultValue:"Open a workspace"})})]}):S.map(({tab:_,project:j})=>{const R=_.id===b;return i.jsxs("div",{onContextMenu:C=>I(C,_),className:xe("group relative flex h-8 w-52 shrink-0 items-center border-r border-border px-2 transition-colors",R?"bg-background text-foreground shadow-[inset_0_-2px_0_hsl(var(--primary))]":"text-muted-foreground hover:bg-muted/30 hover:text-foreground"),title:`${_.label} - ${Bu(j)}`,children:[i.jsx("button",{type:"button",onClick:()=>c(_.id),className:xe("mr-1 rounded p-0.5 transition hover:bg-muted",_.starred?"text-amber-500":"text-muted-foreground/60 opacity-0 group-hover:opacity-100"),"aria-label":g("vscodeWorkbench.workspace.toggleStar",{name:_.label,defaultValue:"Star {{name}}"}),title:g("vscodeWorkbench.workspace.toggleStar",{name:_.label,defaultValue:"Star {{name}}"}),children:i.jsx(Ei,{className:"h-3.5 w-3.5"})}),x===_.id?i.jsx("input",{value:v,autoFocus:!0,onChange:C=>w(C.target.value),onBlur:E,onKeyDown:C=>{C.key==="Enter"&&E(),C.key==="Escape"&&(y(null),w(""))},className:"min-w-0 flex-1 rounded border border-primary/40 bg-background px-1 py-0.5 text-xs text-foreground outline-none"}):i.jsxs("button",{type:"button",onClick:()=>n(_),onDoubleClick:()=>N(_),className:"min-w-0 flex-1 text-left",children:[i.jsx("div",{className:"truncate font-medium",children:_.label}),i.jsx("div",{className:"truncate text-[10px] text-muted-foreground",children:Bu(j)})]}),i.jsx("div",{className:"ml-1 flex shrink-0 items-center gap-0.5 opacity-70 group-hover:opacity-100",children:i.jsx("button",{type:"button",onClick:()=>a(_.id),className:"rounded p-0.5 hover:bg-muted hover:text-foreground","aria-label":g("vscodeWorkbench.workspace.close",{name:_.label,defaultValue:"Close {{name}}"}),title:g("vscodeWorkbench.workspace.close",{name:_.label,defaultValue:"Close {{name}}"}),children:i.jsx(Ct,{className:"h-3.5 w-3.5"})})})]},_.id)}),i.jsx("button",{type:"button",onClick:p,className:"flex h-8 w-10 shrink-0 items-center justify-center border-r border-border bg-muted/10 text-muted-foreground transition-colors hover:bg-muted/50 hover:text-foreground","aria-label":g("vscodeWorkbench.workspace.add",{defaultValue:"Add workspace"}),title:g("vscodeWorkbench.workspace.add",{defaultValue:"Add workspace"}),children:i.jsx(Ut,{className:"h-3.5 w-3.5"})})]}),i.jsx("button",{type:"button",className:"flex h-full w-8 shrink-0 items-center justify-center border-l border-border text-muted-foreground hover:bg-muted hover:text-foreground",onClick:()=>A("right"),"aria-label":g("vscodeWorkbench.workspace.scrollRight",{defaultValue:"Scroll workspaces right"}),title:g("vscodeWorkbench.workspace.scrollRight",{defaultValue:"Scroll workspaces right"}),children:i.jsx(Fn,{className:"h-3.5 w-3.5"})}),i.jsx("button",{type:"button",className:xe("flex h-full w-10 shrink-0 items-center justify-center border-l border-border text-muted-foreground transition hover:bg-muted hover:text-foreground",f&&"bg-muted/40 text-foreground"),onClick:h,"aria-label":f?g("vscodeWorkbench.cli.showPanel",{defaultValue:"Show CLI panel"}):g("vscodeWorkbench.cli.hidePanel",{defaultValue:"Hide CLI panel"}),title:f?g("vscodeWorkbench.cli.showPanel",{defaultValue:"Show CLI panel"}):g("vscodeWorkbench.cli.hidePanel",{defaultValue:"Hide CLI panel"}),children:f?i.jsx(Ku,{className:"h-3.5 w-3.5"}):i.jsx(Yu,{className:"h-3.5 w-3.5"})}),d&&T&&i.jsx(Rie,{context:d,tab:T.tab,onClose:()=>u(null),onRename:()=>N(T.tab),onToggleStar:()=>c(T.tab.id),onCloseTab:()=>a(T.tab.id),onCloseOthers:()=>s(T.tab.id),onCloseAll:o,t:g})]})}function Rie({context:e,tab:t,onClose:r,onRename:n,onToggleStar:a,onCloseTab:s,onCloseOthers:o,onCloseAll:l,t:c}){m.useEffect(()=>{const u=()=>r(),p=f=>{f.key==="Escape"&&r()};return window.addEventListener("mousedown",u),window.addEventListener("keydown",p),()=>{window.removeEventListener("mousedown",u),window.removeEventListener("keydown",p)}},[r]);const d=u=>p=>{p.stopPropagation(),u(),r()};return i.jsxs("div",{className:"fixed z-50 w-48 overflow-hidden rounded-md border border-border bg-popover py-1 text-xs text-popover-foreground shadow-xl shadow-black/10",style:{left:e.x,top:e.y},onMouseDown:u=>u.stopPropagation(),children:[i.jsxs("button",{type:"button",onClick:d(n),className:"flex w-full items-center gap-2 px-3 py-2 text-left hover:bg-muted",children:[i.jsx(F4,{className:"h-3.5 w-3.5"}),c("vscodeWorkbench.workspace.rename",{defaultValue:"Rename"})]}),i.jsxs("button",{type:"button",onClick:d(a),className:"flex w-full items-center gap-2 px-3 py-2 text-left hover:bg-muted",children:[i.jsx(Ei,{className:"h-3.5 w-3.5"}),t.starred?c("vscodeWorkbench.workspace.unstar",{defaultValue:"Unstar"}):c("vscodeWorkbench.workspace.star",{defaultValue:"Star"})]}),i.jsx("div",{className:"my-1 border-t border-border"}),i.jsxs("button",{type:"button",onClick:d(s),className:"flex w-full items-center gap-2 px-3 py-2 text-left hover:bg-muted",children:[i.jsx(Ct,{className:"h-3.5 w-3.5"}),c("vscodeWorkbench.workspace.closeAction",{defaultValue:"Close workspace"})]}),i.jsxs("button",{type:"button",onClick:d(o),className:"flex w-full items-center gap-2 px-3 py-2 text-left hover:bg-muted",children:[i.jsx(Ku,{className:"h-3.5 w-3.5"}),c("vscodeWorkbench.workspace.closeOthers",{defaultValue:"Close others"})]}),i.jsxs("button",{type:"button",onClick:d(l),className:"flex w-full items-center gap-2 px-3 py-2 text-left text-red-600 hover:bg-muted dark:text-red-300",children:[i.jsx(Ct,{className:"h-3.5 w-3.5"}),c("vscodeWorkbench.workspace.closeAll",{defaultValue:"Close all"})]})]})}function _ie({context:e,file:t,onClose:r,onCloseTab:n,onCloseAll:a,onCopyPath:s,onSplitRight:o,onSplitMoveRight:l,t:c}){if(m.useEffect(()=>{const u=()=>r(),p=f=>{f.key==="Escape"&&r()};return window.addEventListener("click",u),window.addEventListener("keydown",p),()=>{window.removeEventListener("click",u),window.removeEventListener("keydown",p)}},[r]),!t)return null;const d=[{id:"close",label:c("vscodeWorkbench.editor.context.close",{defaultValue:"Close"}),icon:Ct,action:()=>n(t.path)},{id:"closeAllTabs",label:c("vscodeWorkbench.editor.context.closeAll",{defaultValue:"Close All"}),icon:Ct,action:a},{id:"copyPath",label:c("vscodeWorkbench.editor.context.copyPath",{defaultValue:"Copy Path"}),icon:Eo,action:()=>s(t.path)},{id:"splitRight",label:c("vscodeWorkbench.editor.context.splitRight",{defaultValue:"Split Right"}),icon:Qu,action:()=>o(t.path)},{id:"splitMoveRight",label:c("vscodeWorkbench.editor.context.splitMoveRight",{defaultValue:"Split and Move Right"}),icon:Yu,action:()=>l(t.path)}];return i.jsxs("div",{className:"fixed z-[80] w-56 overflow-hidden rounded-md border border-border bg-popover py-1 text-xs text-popover-foreground shadow-xl shadow-black/15",style:{left:e.x,top:e.y},onClick:u=>u.stopPropagation(),children:[i.jsxs("div",{className:"border-b border-border px-3 py-2 text-[11px] text-muted-foreground",children:[i.jsx("div",{className:"truncate font-medium text-foreground",children:t.name}),i.jsx("div",{className:"truncate font-mono",children:t.path})]}),d.map(u=>{const p=u.icon;return i.jsxs("button",{type:"button",onClick:u.action,className:"flex w-full items-center gap-2 px-3 py-2 text-left hover:bg-muted",children:[i.jsx(p,{className:"h-3.5 w-3.5 text-muted-foreground"}),u.label]},u.id)})]})}function Pie({project:e,mode:t,hermesInstallStatus:r,hermesInstallJob:n,runId:a,forceNewSession:s,command:o,commandTitle:l,height:c,viewMode:d,isActive:u,onResizeStart:p,onShowFull:f,onShowHalf:h,onStartHermes:g,onOpenHistory:b,onInstallHermes:x,onClose:y,t:v}){const w=t==="hermes"||t==="hermes-install",k=r?.installed===!0,S=t==="hermes-install"?v("vscodeWorkbench.hermes.installTitle",{defaultValue:"Install Hermes Agent"}):t==="hermes"?l||v("vscodeWorkbench.hermes.title",{defaultValue:"Hermes Agent"}):v("vscodeWorkbench.terminal.title",{defaultValue:"Terminal"}),N=o||"hermes",E=d==="full";return i.jsxs("section",{className:xe("relative overflow-hidden bg-gray-950 text-gray-100",E?"absolute inset-0 z-30":"shrink-0"),style:{height:E?"100%":c},children:[!E&&i.jsx("button",{type:"button",className:"absolute inset-x-0 top-0 z-10 h-1 cursor-ns-resize bg-transparent hover:bg-blue-500/40",onPointerDown:p,"aria-label":v("vscodeWorkbench.terminal.resize",{defaultValue:"Resize terminal"}),title:v("vscodeWorkbench.terminal.resize",{defaultValue:"Resize terminal"})}),i.jsxs("div",{className:"flex h-8 items-center justify-between border-b border-gray-800 bg-gray-900 px-3",children:[i.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[w?i.jsx(wc,{className:"h-4 w-4"}):i.jsx(Rr,{className:"h-3.5 w-3.5 text-blue-300"}),i.jsx("span",{className:"truncate text-[11px] font-semibold uppercase tracking-wide text-gray-300",children:S}),i.jsx("span",{className:"truncate font-mono text-[10px] text-gray-500",children:e?Fr(e):v("vscodeWorkbench.noProject")}),w&&k&&i.jsx("span",{className:"rounded bg-emerald-500/15 px-1.5 py-0.5 text-[10px] font-medium text-emerald-200",children:v("vscodeWorkbench.hermes.mcpLive",{defaultValue:"Pixcode MCP Live"})})]}),i.jsxs("div",{className:"flex shrink-0 items-center gap-1",children:[w&&i.jsxs(i.Fragment,{children:[!k&&i.jsx("button",{type:"button",className:"rounded p-1 text-gray-400 hover:bg-gray-800 hover:text-gray-100",onClick:x,"aria-label":v("vscodeWorkbench.hermes.install",{defaultValue:"Install"}),title:v("vscodeWorkbench.hermes.install",{defaultValue:"Install"}),children:i.jsx(zn,{className:"h-3.5 w-3.5"})}),i.jsx("button",{type:"button",className:"rounded p-1 text-gray-400 hover:bg-gray-800 hover:text-gray-100",onClick:b,"aria-label":v("vscodeWorkbench.hermes.history",{defaultValue:"Hermes history"}),title:v("vscodeWorkbench.hermes.history",{defaultValue:"Hermes history"}),children:i.jsx(Ii,{className:"h-3.5 w-3.5"})}),i.jsx("button",{type:"button",className:"rounded p-1 text-gray-400 hover:bg-gray-800 hover:text-gray-100",onClick:g,"aria-label":v("vscodeWorkbench.hermes.newSession",{defaultValue:"New Hermes session"}),title:v("vscodeWorkbench.hermes.newSession",{defaultValue:"New Hermes session"}),children:i.jsx(Ut,{className:"h-3.5 w-3.5"})})]}),E?i.jsx("button",{type:"button",className:"rounded p-1 text-gray-400 hover:bg-gray-800 hover:text-gray-100",onClick:h,"aria-label":v("vscodeWorkbench.terminal.halfScreen",{defaultValue:"Half screen terminal"}),title:v("vscodeWorkbench.terminal.halfScreen",{defaultValue:"Half screen terminal"}),children:i.jsx(Qu,{className:"h-3.5 w-3.5"})}):i.jsx("button",{type:"button",className:"rounded p-1 text-gray-400 hover:bg-gray-800 hover:text-gray-100",onClick:f,"aria-label":v("vscodeWorkbench.terminal.fullScreen",{defaultValue:"Full screen terminal"}),title:v("vscodeWorkbench.terminal.fullScreen",{defaultValue:"Full screen terminal"}),children:i.jsx(Zu,{className:"h-3.5 w-3.5"})}),i.jsx("button",{type:"button",className:"rounded p-1 text-gray-400 hover:bg-gray-800 hover:text-gray-100",onClick:y,"aria-label":v("vscodeWorkbench.terminal.close",{defaultValue:"Close terminal"}),title:v("vscodeWorkbench.terminal.close",{defaultValue:"Close terminal"}),children:i.jsx(Ct,{className:"h-3.5 w-3.5"})})]})]}),i.jsx("div",{className:"h-[calc(100%-2rem)] min-h-0",children:t==="hermes-install"?i.jsx(Lie,{installJob:n,onRetry:x,onStart:g,t:v}):t==="hermes"?i.jsx(Ao,{project:e,session:null,command:N,isPlainShell:!0,forceNewSession:s,showHeader:!1,autoConnect:!!e,isActive:u,title:S},`hermes-terminal-${e?Fr(e):"none"}-${a}`):i.jsx(Ao,{project:e,session:null,isPlainShell:!0,forceNewSession:s,showHeader:!1,autoConnect:!!e,isActive:u,title:S},`bottom-terminal-${t}-${e?Fr(e):"none"}-${a}`)})]})}function Lie({installJob:e,onRetry:t,onStart:r,t:n}){const a=e.state==="running",s=e.state==="done",o=e.state==="error",l=m.useRef(null);return m.useEffect(()=>{l.current&&(l.current.scrollTop=l.current.scrollHeight)},[e.error,e.log,e.state]),i.jsxs("div",{className:"flex h-full min-h-0 flex-col bg-gray-950",children:[i.jsxs("div",{className:"flex h-9 shrink-0 items-center justify-between border-b border-gray-800 px-3",children:[i.jsxs("div",{className:"flex min-w-0 items-center gap-2 text-[11px] text-gray-300",children:[a?i.jsx(_t,{className:"h-3.5 w-3.5 animate-spin text-emerald-300"}):i.jsx(pr,{className:"h-3.5 w-3.5 text-emerald-300"}),i.jsx("span",{className:"truncate",children:a?n("vscodeWorkbench.hermes.installRunning",{defaultValue:"Installing Hermes through Pixcode API..."}):s?n("vscodeWorkbench.hermes.installDone",{defaultValue:"Hermes installed and Pixcode MCP configured."}):o?n("vscodeWorkbench.hermes.installError",{defaultValue:"Hermes install failed."}):n("vscodeWorkbench.hermes.installReady",{defaultValue:"Ready to install Hermes."})})]}),i.jsxs("div",{className:"flex shrink-0 items-center gap-1",children:[s&&i.jsx("button",{type:"button",className:"rounded bg-emerald-600 px-2 py-1 text-[11px] font-medium text-white hover:bg-emerald-500",onClick:r,children:n("vscodeWorkbench.hermes.start",{defaultValue:"Start Hermes"})}),o&&i.jsx("button",{type:"button",className:"rounded bg-gray-800 px-2 py-1 text-[11px] font-medium text-gray-100 hover:bg-gray-700",onClick:t,children:n("vscodeWorkbench.hermes.retryInstall",{defaultValue:"Retry install"})})]})]}),e.error&&i.jsx("div",{className:"border-b border-red-900/60 bg-red-950/40 px-3 py-2 text-[11px] text-red-100",children:e.error}),i.jsx("pre",{ref:l,className:"min-h-0 flex-1 overflow-auto whitespace-pre-wrap break-words p-3 font-mono text-[11px] leading-5 text-gray-200",children:e.log||n("vscodeWorkbench.hermes.installWaiting",{defaultValue:"Waiting for Hermes install logs..."})})]})}function Die({project:e,installStatus:t,controlPlane:r,loading:n,repairing:a,error:s,onRefresh:o,onRepair:l,onStartHermes:c,onNewSession:d,onHistory:u,onInstall:p,onModel:f,onCron:h,onStatus:g,t:b}){const x=r?.profiles??[],y=r?.managedProfile??x.find(D=>D.name==="pixcode")??x.find(D=>D.isActive)??x[0]??null,v=r?.activeProfileSummary??x.find(D=>D.isActive)??y,w=t?.installed===!0||r?.install?.installed===!0,k=!!r?.gateway?.running,S=y?.tools?.pixcodeMcpToolCount??v?.tools?.pixcodeMcpToolCount??0,N=y?.tools?.missingPixcodeMcpTools?.length??v?.tools?.missingPixcodeMcpTools?.length??0,E=x.reduce((D,B)=>D+Number(B.sessions?.total||0),0),I=x.reduce((D,B)=>D+Number(B.cron?.total||0),0),A=x.reduce((D,B)=>D+Number(B.cron?.active||0),0),T=r?.capabilities??[],_=r?.recommendations??[],j=y?.sessions?.recent??v?.sessions?.recent??[],R=y?.cron?.recent??v?.cron?.recent??[],C=[v?.model?.provider,v?.model?.default].filter(Boolean).join(" / ");return i.jsxs("div",{className:"flex h-full min-h-0 flex-col bg-background",children:[i.jsxs("div",{className:"shrink-0 border-b border-border p-3",children:[i.jsxs("div",{className:"flex items-start gap-2",children:[i.jsx("span",{className:"flex h-9 w-9 shrink-0 items-center justify-center rounded-md border border-emerald-500/30 bg-emerald-500/10",children:i.jsx(wc,{className:"h-6 w-6"})}),i.jsxs("div",{className:"min-w-0 flex-1",children:[i.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[i.jsx("span",{className:"truncate text-sm font-semibold text-foreground",children:b("vscodeWorkbench.hermes.title",{defaultValue:"Hermes Agent"})}),i.jsx("span",{className:xe("shrink-0 rounded px-1.5 py-0.5 text-[10px] font-medium",r?.ok?"bg-emerald-500/15 text-emerald-700 dark:text-emerald-200":"bg-amber-500/15 text-amber-700 dark:text-amber-200"),children:r?.ok?b("vscodeWorkbench.hermes.controlReady",{defaultValue:"Control ready"}):b("vscodeWorkbench.hermes.needsRepair",{defaultValue:"Needs repair"})})]}),i.jsx("div",{className:"mt-1 truncate font-mono text-[11px] text-muted-foreground",title:e?Fr(e):void 0,children:e?Fr(e):b("vscodeWorkbench.noProject")})]}),i.jsx("button",{type:"button",className:"rounded p-1 text-muted-foreground hover:bg-muted hover:text-foreground",onClick:o,"aria-label":b("vscodeWorkbench.hermes.refreshControl",{defaultValue:"Refresh Hermes control plane"}),title:b("vscodeWorkbench.hermes.refreshControl",{defaultValue:"Refresh Hermes control plane"}),disabled:n,children:i.jsx(at,{className:xe("h-4 w-4",n&&"animate-spin")})})]}),s&&i.jsx("div",{className:"mt-3 rounded border border-amber-500/30 bg-amber-500/10 px-2.5 py-2 text-[11px] leading-5 text-amber-700 dark:text-amber-200",children:s})]}),i.jsxs("div",{className:"min-h-0 flex-1 overflow-y-auto p-3",children:[i.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[i.jsx(Fd,{icon:zn,label:b("vscodeWorkbench.hermes.installState",{defaultValue:"Install"}),value:w?b("vscodeWorkbench.hermes.ready",{defaultValue:"Ready"}):b("vscodeWorkbench.cli.notInstalled",{defaultValue:"Not installed"}),ok:w}),i.jsx(Fd,{icon:ca,label:b("vscodeWorkbench.hermes.restGateway",{defaultValue:"REST"}),value:k?b("common.enabled",{defaultValue:"Enabled"}):b("common.disabled",{defaultValue:"Disabled"}),ok:k}),i.jsx(Fd,{icon:pr,label:b("vscodeWorkbench.hermes.mcpTools",{defaultValue:"MCP tools"}),value:`${S}`,detail:b("vscodeWorkbench.hermes.mcpMissing",{count:N,defaultValue:"{{count}} missing"}),ok:S>0&&N===0}),i.jsx(Fd,{icon:Ii,label:b("vscodeWorkbench.hermes.sessions",{defaultValue:"Sessions"}),value:E.toLocaleString(),detail:b("vscodeWorkbench.hermes.cronSummary",{count:A,total:I,defaultValue:"{{count}}/{{total}} cron active"}),ok:E>0||I>0})]}),i.jsxs("div",{className:"mt-3 rounded-md border border-border bg-card/60 p-3",children:[i.jsxs("div",{className:"flex items-start justify-between gap-2",children:[i.jsxs("div",{className:"min-w-0",children:[i.jsx("div",{className:"text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:b("vscodeWorkbench.hermes.profile",{defaultValue:"Profile"})}),i.jsx("div",{className:"mt-1 truncate text-sm font-semibold text-foreground",children:v?.name||r?.activeProfile||b("vscodeWorkbench.hermes.unknown",{defaultValue:"Unknown"})}),i.jsx("div",{className:"mt-1 truncate font-mono text-[10px] text-muted-foreground",title:v?.path,children:v?.path||"-"})]}),i.jsx("span",{className:xe("shrink-0 rounded px-1.5 py-0.5 text-[10px] font-medium",v?.auth?.configured?"bg-emerald-500/15 text-emerald-700 dark:text-emerald-200":"bg-amber-500/15 text-amber-700 dark:text-amber-200"),children:v?.auth?.configured?b("vscodeWorkbench.hermes.authReady",{defaultValue:"Auth ready"}):b("vscodeWorkbench.hermes.authMissing",{defaultValue:"Auth missing"})})]}),i.jsx("div",{className:"mt-2 truncate text-[11px] text-muted-foreground",children:C||b("vscodeWorkbench.hermes.modelNotSelected",{defaultValue:"No model selected"})})]}),i.jsxs("div",{className:"mt-3 grid gap-2",children:[i.jsxs("button",{type:"button",className:"flex h-8 items-center justify-center gap-1.5 rounded bg-emerald-600 px-2 text-xs font-semibold text-white hover:bg-emerald-500 disabled:cursor-not-allowed disabled:bg-muted disabled:text-muted-foreground",onClick:w?c:p,disabled:a,children:[a?i.jsx(_t,{className:"h-3.5 w-3.5 animate-spin"}):i.jsx(wc,{className:"h-3.5 w-3.5"}),w?b("vscodeWorkbench.hermes.start",{defaultValue:"Start Hermes"}):b("vscodeWorkbench.hermes.install",{defaultValue:"Install"})]}),i.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[i.jsx(Xs,{icon:Ut,label:b("vscodeWorkbench.hermes.newSession",{defaultValue:"New Hermes session"}),onClick:d,disabled:!w}),i.jsx(Xs,{icon:Ii,label:b("vscodeWorkbench.hermes.history",{defaultValue:"Hermes history"}),onClick:u,disabled:!w}),i.jsx(Xs,{icon:Ht,label:b("vscodeWorkbench.hermes.modelSettings",{defaultValue:"Hermes model"}),onClick:f,disabled:!w}),i.jsx(Xs,{icon:pr,label:b("vscodeWorkbench.hermes.cronJobs",{defaultValue:"Hermes cron"}),onClick:h,disabled:!w}),i.jsx(Xs,{icon:ca,label:b("vscodeWorkbench.hermes.deepStatus",{defaultValue:"Hermes status"}),onClick:g,disabled:!w}),i.jsx(Xs,{icon:at,label:b("vscodeWorkbench.hermes.repairControl",{defaultValue:"Repair control"}),onClick:l,disabled:!w||a,loading:a})]})]}),T.length>0&&i.jsxs("div",{className:"mt-4 space-y-1.5",children:[i.jsx("div",{className:"text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:b("vscodeWorkbench.hermes.capabilities",{defaultValue:"Capabilities"})}),T.map(D=>i.jsxs("div",{className:"flex items-start gap-2 rounded border border-border bg-card/50 px-2.5 py-2",children:[D.ready?i.jsx(Gt,{className:"mt-0.5 h-3.5 w-3.5 shrink-0 text-emerald-500"}):i.jsx(tn,{className:"mt-0.5 h-3.5 w-3.5 shrink-0 text-amber-500"}),i.jsxs("div",{className:"min-w-0",children:[i.jsx("div",{className:"truncate text-xs font-medium text-foreground",children:D.label}),D.detail&&i.jsx("div",{className:"mt-0.5 line-clamp-2 text-[11px] leading-4 text-muted-foreground",children:D.detail})]})]},D.id||D.label))]}),j.length>0&&i.jsxs("div",{className:"mt-4 space-y-1.5",children:[i.jsx("div",{className:"text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:b("vscodeWorkbench.hermes.recentSessions",{defaultValue:"Recent sessions"})}),j.slice(0,3).map(D=>i.jsxs("div",{className:"rounded border border-border bg-card/50 px-2.5 py-2",children:[i.jsx("div",{className:"truncate text-xs font-medium text-foreground",children:D.title||D.id||b("mainContent.untitledSession",{defaultValue:"Untitled Session"})}),i.jsxs("div",{className:"mt-0.5 truncate text-[10px] text-muted-foreground",children:[D.model||D.source||"-"," - ",D.messageCount??0," msg"]})]},D.id||D.startedAt))]}),R.length>0&&i.jsxs("div",{className:"mt-4 space-y-1.5",children:[i.jsx("div",{className:"text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:b("vscodeWorkbench.hermes.cronJobs",{defaultValue:"Hermes cron"})}),R.slice(0,3).map(D=>i.jsxs("div",{className:"rounded border border-border bg-card/50 px-2.5 py-2",children:[i.jsxs("div",{className:"flex items-center justify-between gap-2",children:[i.jsx("span",{className:"truncate text-xs font-medium text-foreground",children:D.name||D.id}),i.jsx("span",{className:xe("shrink-0 rounded px-1.5 py-0.5 text-[10px]",D.state==="active"?"bg-emerald-500/15 text-emerald-700 dark:text-emerald-200":"bg-muted text-muted-foreground"),children:D.state||(D.enabled?"active":"paused")})]}),i.jsx("div",{className:"mt-0.5 truncate font-mono text-[10px] text-muted-foreground",children:D.schedule||"-"})]},D.id||D.name))]}),_.length>0&&i.jsxs("div",{className:"mt-4 space-y-1.5",children:[i.jsx("div",{className:"text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:b("vscodeWorkbench.hermes.recommendations",{defaultValue:"Recommendations"})}),_.slice(0,3).map(D=>i.jsx("div",{className:"rounded border border-amber-500/30 bg-amber-500/10 px-2.5 py-2 text-[11px] leading-5 text-amber-700 dark:text-amber-200",children:D},D))]})]})]})}function Fd({icon:e,label:t,value:r,detail:n,ok:a}){return i.jsxs("div",{className:"rounded-md border border-border bg-card/60 p-2",children:[i.jsxs("div",{className:"flex items-center gap-1.5 text-[10px] font-semibold uppercase tracking-wide text-muted-foreground",children:[i.jsx(e,{className:"h-3.5 w-3.5"}),i.jsx("span",{className:"truncate",children:t})]}),i.jsx("div",{className:xe("mt-1 truncate text-sm font-semibold",a?"text-emerald-600 dark:text-emerald-300":"text-amber-600 dark:text-amber-300"),children:r}),n&&i.jsx("div",{className:"mt-0.5 truncate text-[10px] text-muted-foreground",children:n})]})}function Xs({icon:e,label:t,onClick:r,disabled:n=!1,loading:a=!1}){return i.jsxs("button",{type:"button",className:"flex h-8 min-w-0 items-center justify-center gap-1.5 rounded border border-border px-2 text-[11px] font-medium text-foreground hover:bg-muted disabled:cursor-not-allowed disabled:text-muted-foreground disabled:hover:bg-transparent",onClick:r,disabled:n,title:t,children:[a?i.jsx(_t,{className:"h-3.5 w-3.5 animate-spin"}):i.jsx(e,{className:"h-3.5 w-3.5 shrink-0"}),i.jsx("span",{className:"truncate",children:t})]})}function Oie({selectedProject:e,onFileOpen:t,t:r}){return i.jsx("div",{className:"h-full min-h-0 overflow-hidden",children:i.jsx(Ng,{selectedProject:e,onFileOpen:t})})}function Mie({projects:e,onProjectSelect:t,onNewSession:r,onOpenProject:n,onCloneProject:a,onQuickStartSession:s,onOpenHermesAgent:o,onShowSettings:l,t:c}){const d=e.slice(0,6);return i.jsx("div",{className:"h-full overflow-auto bg-background",children:i.jsx("div",{className:"mx-auto flex max-w-6xl flex-col gap-6 p-4 sm:p-6",children:i.jsxs("section",{className:"min-w-0",children:[i.jsxs("div",{className:"mb-6",children:[i.jsx("div",{className:"text-xs font-semibold uppercase tracking-wide text-primary",children:"Pixcode"}),i.jsx("h2",{className:"mt-2 text-2xl font-semibold text-foreground",children:c("vscodeWorkbench.welcome.title",{defaultValue:"Hoş geldin"})}),i.jsx("p",{className:"mt-2 max-w-2xl text-sm leading-6 text-muted-foreground",children:c("vscodeWorkbench.welcome.description",{defaultValue:"Bir proje aç, GitHub’dan klonla veya Hermes’i alt terminalde başlat."})})]}),i.jsxs("div",{className:"grid gap-2",style:{gridTemplateColumns:"repeat(auto-fit, minmax(min(100%, 13rem), 1fr))"},children:[i.jsxs("button",{type:"button",onClick:n,className:"group flex min-h-24 flex-col items-start justify-between rounded-md border border-border bg-card p-4 text-left transition hover:border-primary/50 hover:bg-muted/30",children:[i.jsx(Bn,{className:"h-5 w-5 text-blue-400"}),i.jsx("span",{className:"mt-4 text-sm font-semibold text-foreground",children:c("vscodeWorkbench.welcome.openProject",{defaultValue:"Proje Aç"})}),i.jsx("span",{className:"mt-1 text-xs leading-5 text-muted-foreground",children:c("vscodeWorkbench.welcome.openProjectDescription",{defaultValue:"Yerel klasörü workspace olarak bağla."})})]}),i.jsxs("button",{type:"button",onClick:a,className:"group flex min-h-24 flex-col items-start justify-between rounded-md border border-border bg-card p-4 text-left transition hover:border-primary/50 hover:bg-muted/30",children:[i.jsx(Ju,{className:"h-5 w-5 text-foreground"}),i.jsx("span",{className:"mt-4 text-sm font-semibold text-foreground",children:c("vscodeWorkbench.welcome.cloneProject",{defaultValue:"Klonla"})}),i.jsx("span",{className:"mt-1 text-xs leading-5 text-muted-foreground",children:c("vscodeWorkbench.welcome.cloneProjectDescription",{defaultValue:"GitHub reposunu seçtiğin klasöre çek."})})]}),i.jsxs("button",{type:"button",onClick:o,className:"group flex min-h-24 flex-col items-start justify-between rounded-md border border-emerald-700/70 bg-emerald-950/20 p-4 text-left transition hover:border-emerald-400/70 hover:bg-emerald-950/30",children:[i.jsx(wc,{className:"h-5 w-5"}),i.jsx("span",{className:"mt-4 text-sm font-semibold text-foreground",children:c("vscodeWorkbench.welcome.startHermes",{defaultValue:"Hermes’i Başlat"})}),i.jsx("span",{className:"mt-1 text-xs leading-5 text-muted-foreground",children:c("vscodeWorkbench.welcome.startHermesDescription",{defaultValue:"Aktif projede agent terminalini aç."})})]})]}),i.jsx("div",{className:"mt-4 rounded-md border border-border bg-card/70 p-3 sm:p-4",children:i.jsxs("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between",children:[i.jsxs("div",{className:"min-w-0",children:[i.jsx("div",{className:"text-sm font-semibold text-foreground",children:c("vscodeWorkbench.welcome.appearanceTitle",{defaultValue:"Görünüm"})}),i.jsx("p",{className:"mt-1 text-xs leading-5 text-muted-foreground",children:c("vscodeWorkbench.welcome.appearanceDescription",{defaultValue:"Pixcode koyu modla başlar; gerekirse açık moda geçebilirsin."})})]}),i.jsxs("div",{className:"flex shrink-0 flex-wrap items-center gap-2",children:[i.jsxs("div",{className:"flex items-center gap-2 rounded border border-border bg-background px-3 py-2",children:[i.jsx("span",{className:"text-xs font-medium text-foreground",children:c("vscodeWorkbench.welcome.darkMode",{defaultValue:"Koyu mod"})}),i.jsx(uu,{ariaLabel:c("vscodeWorkbench.welcome.themeToggle",{defaultValue:"Tema modunu değiştir"})})]}),i.jsxs("button",{type:"button",onClick:l,className:"inline-flex items-center justify-center gap-2 rounded border border-border px-3 py-2 text-xs font-medium text-foreground hover:bg-muted",children:[i.jsx(Ht,{className:"h-3.5 w-3.5"}),c("vscodeWorkbench.welcome.themeSettings",{defaultValue:"Tema ayarları"})]})]})]})}),i.jsxs("div",{className:"mt-7",children:[i.jsxs("div",{className:"mb-2 flex items-center justify-between gap-3",children:[i.jsx("h3",{className:"text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:c("vscodeWorkbench.welcome.recentProjects",{defaultValue:"Son projeler"})}),s&&i.jsxs("button",{type:"button",onClick:()=>{s()},className:"inline-flex items-center gap-1.5 rounded border border-border px-2.5 py-1.5 text-xs text-muted-foreground hover:bg-muted hover:text-foreground",children:[i.jsx(Un,{className:"h-3.5 w-3.5"}),c("vscodeWorkbench.welcome.newChat",{defaultValue:"Yeni sohbet"})]})]}),d.length>0?i.jsx("div",{className:"grid gap-2 xl:grid-cols-2",children:d.map(f=>i.jsxs("div",{role:"button",tabIndex:0,className:"cursor-pointer rounded-md border border-border bg-card/60 p-3 text-left transition hover:border-primary/40 hover:bg-muted/30 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/40",onClick:()=>t(f),onKeyDown:h=>{(h.key==="Enter"||h.key===" ")&&(h.preventDefault(),t(f))},title:Fr(f),children:[i.jsxs("div",{className:"flex items-start justify-between gap-3",children:[i.jsxs("div",{className:"min-w-0",children:[i.jsx("div",{className:"truncate text-sm font-semibold text-foreground",children:f.displayName||f.name}),i.jsx("div",{className:"mt-1 truncate font-mono text-[11px] text-muted-foreground",children:Bu(f)})]}),i.jsx("span",{className:"shrink-0 rounded bg-muted px-1.5 py-0.5 text-[10px] text-muted-foreground",children:N6(f.fileCount,c)})]}),i.jsxs("div",{className:"mt-3 flex flex-wrap gap-2",children:[i.jsx("span",{className:"rounded bg-primary/10 px-2 py-1 text-[11px] font-medium text-primary",children:c("vscodeWorkbench.projects.workHere",{defaultValue:"Work in this folder"})}),i.jsx("span",{role:"button",tabIndex:0,className:"rounded border border-border px-2 py-1 text-[11px] text-foreground",onClick:h=>{h.stopPropagation(),t(f),r(f)},onKeyDown:h=>{(h.key==="Enter"||h.key===" ")&&(h.preventDefault(),h.stopPropagation(),t(f),r(f))},children:c("vscodeWorkbench.projects.startChat",{defaultValue:"Chat"})})]})]},f.name))}):i.jsxs("div",{className:"rounded-md border border-dashed border-border p-8 text-center",children:[i.jsx(qr,{className:"mx-auto mb-3 h-8 w-8 text-muted-foreground"}),i.jsx("div",{className:"text-sm font-medium text-foreground",children:c("vscodeWorkbench.projects.emptyTitle",{defaultValue:"No project directories yet"})}),i.jsx("p",{className:"mt-2 text-xs text-muted-foreground",children:c("vscodeWorkbench.projects.emptyDescription",{defaultValue:"Open a local folder or clone a repository to start."})})]})]})]})})})}const zd=Aw.map(e=>({id:e,label:dn[e]??e}));function Js(e,t,r){return(e??[]).map(n=>({...n,__provider:n.__provider??t,__projectName:n.__projectName??r}))}function Fie(e){return e?[...Js(e.sessions,"claude",e.name),...Js(e.codexSessions,"codex",e.name),...Js(e.cursorSessions,"cursor",e.name),...Js(e.geminiSessions,"gemini",e.name),...Js(e.qwenSessions,"qwen",e.name),...Js(e.opencodeSessions,"opencode",e.name)]:[]}function zie({project:e,session:t,hermesCliLaunch:r,onSessionSelect:n,onHeaderContentChange:a,t:s}){const[o,l]=m.useState(()=>{if(typeof window>"u")return"claude";const W=window.localStorage.getItem("selected-provider");return zd.some(pe=>pe.id===W)?W:"claude"}),[c,d]=m.useState(!1),[u,p]=m.useState(!1),[f,h]=m.useState(null),[g,b]=m.useState(!1),[x,y]=m.useState(!1),[v,w]=m.useState("provider"),[k,S]=m.useState(null),[N,E]=m.useState(null),[I,A]=m.useState(null),[T]=m.useState({runId:0,forceNewSession:!1}),[_,j]=m.useState([]),[R,C]=m.useState(null),[D,B]=m.useState({provider:null,state:"idle",log:"",error:null}),F=m.useRef(null),V=m.useRef(null),{providerAuthStatus:K,refreshProviderAuthStatuses:L}=qu({initialLoading:!1}),G=m.useMemo(()=>Fie(e),[e]),H=K[o],z=f?.__provider===o?f:null,te=_.find(W=>W.id===R)||_[0]||null;m.useEffect(()=>{te&&w(te.type)},[te]);const se=f?.id??t?.id??null,me=!!(e&&H?.installed!==!1&&D.state!=="running"),de=!!(e&&(g||_.length>0)&&(te?.type==="plain"||v==="provider"&&me)),ce=m.useMemo(()=>io(e),[e]),ye=m.useRef(null),he=m.useRef(0),ke=m.useCallback((W,pe,Ae=_)=>{if(W==="plain")return`Terminal #${Ae.filter(Ke=>Ke.type==="plain").length+1}`;const Le=pe&&dn[pe]?dn[pe]:pe??"CLI",Ge=Ae.filter(rt=>rt.type==="provider"&&rt.provider===pe).length+1;return`${Le} #${Ge}`},[_]),ve=m.useCallback(W=>{const pe=`cli-${Date.now()}-${Math.random().toString(36).slice(2,8)}`,Ae=`tab_${crypto.randomUUID()}`;return j(Le=>{const Ge={...W,id:pe,tabId:Ae,title:W.title||ke(W.type,W.provider,Le)};return[...Le,Ge]}),C(pe),b(!0),w(W.type==="plain"?"plain":"provider"),pe},[ke]),je=m.useCallback(()=>{ve({type:"plain",provider:void 0,session:null,runId:Date.now(),forceNewSession:!0,startupInput:null,hermesLaunchId:null,permissionOverride:null})},[ve]),M=m.useCallback(W=>{const pe=_.find(Le=>Le.id===W);if(!pe)return;const Ae=window.prompt("CLI tab name",pe.title)?.trim();Ae&&j(Le=>Le.map(Ge=>Ge.id===W?{...Ge,title:Ae}:Ge))},[_]),ae=m.useCallback(W=>{j(pe=>{const Ae=pe.filter(Le=>Le.id!==W);return R===W&&C(Ae[Ae.length-1]?.id||null),Ae.length===0&&b(!1),Ae})},[R]),ue=m.useCallback(()=>{d(!1),p(!0)},[]),Y=m.useCallback(W=>{V.current?.scrollBy({left:W==="left"?-180:180,behavior:"smooth"})},[]),U=m.useMemo(()=>i.jsxs("div",{className:"flex min-w-0 items-center gap-1",children:[_.length===0&&i.jsxs("div",{className:"flex min-w-0 items-center gap-1 pr-1",children:[i.jsx(Ui,{className:"h-4 w-4 shrink-0 text-muted-foreground"}),i.jsx("span",{className:"truncate text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:s("vscodeWorkbench.panels.cli")})]}),_.length>0&&i.jsxs(i.Fragment,{children:[i.jsx("button",{type:"button",className:"flex h-7 w-7 shrink-0 items-center justify-center rounded border border-border text-muted-foreground hover:bg-muted hover:text-foreground",onClick:()=>Y("left"),"aria-label":"Scroll CLI tabs left",title:"Scroll CLI tabs left",children:i.jsx(Go,{className:"h-3.5 w-3.5"})}),i.jsx("div",{ref:V,className:"flex min-w-0 flex-1 items-center gap-1 overflow-x-auto pr-1 [scrollbar-width:none] [&::-webkit-scrollbar]:hidden",children:_.map(W=>{const pe=W.id===(te?.id||R);return i.jsxs("div",{className:xe("group flex h-7 min-w-[112px] max-w-[200px] shrink-0 items-center gap-1.5 rounded border px-2 text-[11px]",pe?"border-primary/50 bg-primary/10 text-foreground":"border-border/70 bg-muted/20 text-muted-foreground hover:bg-muted/40 hover:text-foreground"),children:[i.jsxs("button",{type:"button",className:"flex min-w-0 flex-1 items-center gap-1.5 text-left",onClick:()=>C(W.id),onDoubleClick:()=>M(W.id),title:"Double-click to rename",children:[W.type==="plain"?i.jsx(Rr,{className:"h-3.5 w-3.5 shrink-0 text-muted-foreground"}):i.jsx(er,{provider:W.provider??"claude",className:"h-3.5 w-3.5 shrink-0"}),i.jsx("span",{className:"truncate",children:W.title})]}),i.jsx("button",{type:"button",className:"rounded p-0.5 opacity-60 hover:bg-muted hover:opacity-100",onClick:Ae=>{Ae.stopPropagation(),ae(W.id)},"aria-label":"Close CLI tab",children:i.jsx(Ct,{className:"h-3 w-3"})})]},W.id)})}),i.jsx("button",{type:"button",className:"flex h-7 w-7 shrink-0 items-center justify-center rounded border border-border text-muted-foreground hover:bg-muted hover:text-foreground",onClick:()=>Y("right"),"aria-label":"Scroll CLI tabs right",title:"Scroll CLI tabs right",children:i.jsx(Fn,{className:"h-3.5 w-3.5"})})]}),i.jsx("button",{type:"button",className:"flex h-7 w-7 shrink-0 items-center justify-center rounded border border-border text-muted-foreground hover:bg-muted hover:text-foreground disabled:opacity-50",disabled:!e,onClick:je,title:"New terminal tab",children:i.jsx(Rr,{className:"h-3.5 w-3.5"})}),i.jsx("button",{type:"button",className:"flex h-7 w-7 shrink-0 items-center justify-center rounded border border-border text-muted-foreground hover:bg-muted hover:text-foreground disabled:opacity-50",disabled:!e||D.state==="running",onClick:ue,title:"New CLI tab",children:i.jsx(Ut,{className:"h-3.5 w-3.5"})})]}),[te?.id,R,_,ae,D.state,je,ue,e,M,Y,s]);m.useEffect(()=>(a(U),()=>a(null)),[U,a]),m.useEffect(()=>{const W=zd.map(pe=>pe.id);L(W)},[L]),m.useEffect(()=>{if(ye.current===ce)return;ye.current=ce,d(!1),y(!1),w("provider"),A(null),j([]),C(null);const W=kie(ce);if(!W){b(!1),h(null);return}l(W.provider),window.localStorage.setItem("selected-provider",W.provider);const pe=W.sessionId?G.find(Ae=>Ae.id===W.sessionId&&Ae.__provider===W.provider)??null:null;h(pe),b(W.isTerminalOpen),W.isTerminalOpen&&ve({type:"provider",provider:W.provider,session:pe,runId:Date.now(),forceNewSession:!1,startupInput:null,hermesLaunchId:null,permissionOverride:null})},[ve,ce,G]),m.useEffect(()=>()=>{try{F.current?.close()}catch{}},[]);const Q=m.useCallback(W=>{Sie(ce,{...W,updatedAt:Date.now()})},[ce]),J=m.useCallback(W=>{K[W]?.installed!==!1&&(w("provider"),A(null),l(W),window.localStorage.setItem("selected-provider",W),Q({provider:W,isTerminalOpen:g,sessionId:f?.id??null}))},[g,Q,K,f?.id]),re=m.useCallback(async W=>{B({provider:W,state:"running",log:"",error:null});try{F.current?.close()}catch{}F.current=null;try{const pe=await Ce(`/api/providers/${W}/install`,{method:"POST",body:"{}"}),Ae=await pe.json().catch(()=>({}));if(!pe.ok||!Ae?.success)throw new Error(Ae?.error||`HTTP ${pe.status}`);if(Ae.data?.manual)throw new Error(Ae.data?.message||s("vscodeWorkbench.cli.manualInstall",{defaultValue:"This CLI needs manual installation."}));const Le=Ae.data?.jobId;if(!Le)throw new Error(s("vscodeWorkbench.cli.installNoJob",{defaultValue:"Install did not return a job id."}));const Ge=window.localStorage.getItem("auth-token")||"",rt=`/api/providers/${W}/install/${Le}/stream${Ge?`?token=${encodeURIComponent(Ge)}`:""}`,Ke=new EventSource(rt);F.current=Ke,Ke.addEventListener("log",ct=>{try{const st=JSON.parse(ct.data);typeof st.chunk=="string"&&B(nt=>({...nt,log:`${nt.log}${st.chunk}`}))}catch{}}),Ke.addEventListener("done",ct=>{try{const st=JSON.parse(ct.data);if(!st.success)throw new Error(st.error||s("vscodeWorkbench.cli.installFailed",{defaultValue:"Install failed."}));B(nt=>({...nt,state:"done",error:null})),L([W],{force:!0}),l(W),window.localStorage.setItem("selected-provider",W)}catch(st){B(nt=>({...nt,state:"error",error:st instanceof Error?st.message:s("vscodeWorkbench.cli.installFailed",{defaultValue:"Install failed."})}))}finally{try{Ke.close()}catch{}F.current=null}}),Ke.onerror=()=>{B(ct=>ct.state==="running"?{...ct,state:"error",error:s("vscodeWorkbench.cli.installStreamLost",{defaultValue:"Install stream closed early. The install may still be running."})}:ct)}}catch(pe){B({provider:W,state:"error",log:"",error:pe instanceof Error?pe.message:s("vscodeWorkbench.cli.installFailed",{defaultValue:"Install failed."})})}},[L,s]),le=m.useCallback((W,{forceNewSession:pe=!1}={})=>{!e||K[W]?.installed===!1||D.state==="running"||(w("provider"),S(null),E(null),A(null),h(null),d(!1),p(!1),y(!1),l(W),window.localStorage.setItem("selected-provider",W),b(!0),ve({type:"provider",provider:W,session:null,runId:Date.now(),forceNewSession:pe,startupInput:null,hermesLaunchId:null,permissionOverride:null}),Q({provider:W,isTerminalOpen:!0,sessionId:null}))},[D.state,ve,Q,e,K]),Ee=m.useCallback(({forceNewSession:W=!1}={})=>{le(o,{forceNewSession:W})},[o,le]),fe=m.useCallback(()=>{Ee({forceNewSession:x})},[x,Ee]);m.useEffect(()=>{if(!r||he.current===r.id)return;he.current=r.id;const W=r.provider;if(!Aw.includes(W))return;const pe=r.bypassPermissions===!0||r.skipPermissions===!0,Ae=typeof r.permissionMode=="string"&&r.permissionMode.trim()?r.permissionMode.trim():pe?"bypassPermissions":null;w("provider"),l(W),S(r.startupInput||null),E(r.id),A(Ae||pe?{permissionMode:Ae,skipPermissions:pe}:null),window.localStorage.setItem("selected-provider",W),h(null),d(!1),y(!1),b(!0),ve({type:"provider",provider:W,session:null,runId:Date.now(),forceNewSession:r.forceNewSession===!0,startupInput:r.startupInput||null,hermesLaunchId:r.id,permissionOverride:Ae||pe?{permissionMode:Ae,skipPermissions:pe}:null}),Q({provider:W,isTerminalOpen:!0,sessionId:null})},[r,ve,Q]);const ne=m.useCallback(()=>{if(R){ae(R);return}w("provider"),S(null),E(null),A(null),d(!1),b(!1),y(!1),Q({provider:o,isTerminalOpen:!1,sessionId:f?.id??null})},[R,ae,Q,o,f?.id]),Z=m.useCallback(W=>{const pe=W.__provider??"claude";w("provider"),S(null),E(null),A(null),l(pe),window.localStorage.setItem("selected-provider",pe),h(W),n(W),d(!1),y(!1),b(!0),ve({type:"provider",provider:pe,session:W,runId:Date.now(),forceNewSession:!1,startupInput:null,hermesLaunchId:null,permissionOverride:null,title:Uu(W).slice(0,32)}),Q({provider:pe,isTerminalOpen:!0,sessionId:W.id})},[n,ve,Q]);return g||_.length>0?i.jsxs("div",{className:"relative flex h-full min-h-0 flex-col bg-gray-950 text-gray-100",children:[i.jsx(Bie,{project:e,mode:te?.type==="plain"?"plain":"provider",provider:te?.provider||o,session:te?.session||z,historyCount:G.length,historyOpen:c,canStart:me,onToggleHistory:()=>d(W=>!W),onNewSession:ue,onNewPlainShell:je,onCloseTerminal:ne,t:s}),c&&i.jsx("div",{className:"absolute inset-x-2 top-10 z-30 max-h-[48%] overflow-hidden rounded-md border border-gray-800 bg-gray-950 shadow-2xl shadow-black/40",children:i.jsx(ON,{sessions:G,activeSessionId:se,onSessionSelect:Z,t:s})}),u&&i.jsxs("div",{className:"absolute inset-x-2 top-10 z-30 max-h-[58%] overflow-hidden rounded-md border border-gray-800 bg-gray-950 shadow-2xl shadow-black/40",children:[i.jsxs("div",{className:"flex items-center justify-between border-b border-gray-800 px-2.5 py-2",children:[i.jsx("div",{className:"text-[11px] font-semibold uppercase tracking-wide text-gray-400",children:"New CLI tab"}),i.jsx("button",{type:"button",className:"rounded p-1 text-gray-400 hover:bg-gray-800 hover:text-gray-100",onClick:()=>p(!1),children:i.jsx(Ct,{className:"h-3.5 w-3.5"})})]}),i.jsx("div",{className:"grid max-h-72 gap-1 overflow-y-auto p-2",children:zd.map(W=>{const Ae=K[W.id]?.installed===!1,Le=D.provider===W.id&&D.state==="running";return i.jsxs("button",{type:"button",className:xe("flex items-center gap-2 rounded border px-2 py-2 text-left transition-colors",Ae?"border-amber-800/70 bg-amber-950/30 text-amber-100":"border-gray-800 bg-gray-900 text-gray-200 hover:border-blue-500/60 hover:bg-blue-500/10"),onClick:()=>{if(Ae){re(W.id);return}le(W.id,{forceNewSession:!0})},children:[i.jsx(er,{provider:W.id,className:xe("h-4 w-4 shrink-0",Ae&&"opacity-70 grayscale")}),i.jsxs("span",{className:"min-w-0 flex-1",children:[i.jsx("span",{className:"block truncate text-[11px] font-semibold",children:W.label}),i.jsx("span",{className:"block truncate text-[10px] text-gray-500",children:Le?"Installing...":Ae?"Install first":"Open new tab"})]}),i.jsx(Ut,{className:"h-3.5 w-3.5 shrink-0 opacity-70"})]},W.id)})})]}),i.jsx("div",{className:"relative min-h-0 flex-1",children:_.length===0?i.jsx(Ao,{tabId:`fallback-${o}-${T.runId}`,project:e,session:z,provider:o,forceNewSession:T.forceNewSession,startupInput:k,hermesLaunchId:N,permissionOverride:I,showHeader:!0,autoConnect:de,isActive:!0,onClose:ne},`${o}-${z?.id||"new"}-${e?.name||"none"}-${T.runId}`):_.map(W=>i.jsx("div",{className:xe("absolute inset-0",W.id===te?.id?"block":"hidden"),children:i.jsx(Ao,{tabId:W.tabId,project:e,session:W.session,provider:W.provider,isPlainShell:W.type==="plain",forceNewSession:W.forceNewSession,startupInput:W.startupInput,hermesLaunchId:W.hermesLaunchId,permissionOverride:W.permissionOverride,showHeader:!0,autoConnect:de,isActive:W.id===te?.id,onClose:()=>ae(W.id)},`${W.id}-${W.runId}`)},W.id))})]}):i.jsx("div",{className:"flex h-full min-h-0 flex-col bg-gray-950 text-gray-100",children:i.jsxs("div",{className:"flex min-h-0 flex-1 flex-col border-b border-gray-800 bg-gray-900/95 p-2",children:[i.jsxs("div",{className:"mb-2 flex items-center justify-between gap-2",children:[i.jsxs("div",{className:"min-w-0",children:[i.jsx("div",{className:"truncate text-xs font-semibold text-gray-100",children:e?.displayName||e?.name||s("vscodeWorkbench.noProject")}),i.jsx("div",{className:"text-[11px] text-gray-400",children:s("vscodeWorkbench.cli.chooseDescription",{defaultValue:"Choose a CLI, then start a full-height terminal."})})]}),i.jsxs("div",{className:"flex shrink-0 items-center gap-1",children:[i.jsx("button",{type:"button",className:"rounded border border-gray-700 p-1.5 text-gray-200 hover:bg-gray-800 disabled:opacity-50",disabled:!me,onClick:fe,title:s("vscodeWorkbench.cli.newSession",{defaultValue:"New CLI session"}),"aria-label":s("vscodeWorkbench.cli.newSession",{defaultValue:"New CLI session"}),children:i.jsx(Ut,{className:"h-3.5 w-3.5"})}),i.jsx("button",{type:"button",className:xe("rounded border border-gray-700 p-1.5 text-gray-200 hover:bg-gray-800 disabled:opacity-50",c&&"bg-gray-800"),disabled:!e,onClick:()=>d(W=>!W),title:s("vscodeWorkbench.cli.history",{defaultValue:"History"}),"aria-label":s("vscodeWorkbench.cli.history",{defaultValue:"History"}),children:i.jsx(Ii,{className:"h-3.5 w-3.5"})})]})]}),i.jsxs("div",{className:"mb-2 flex items-center gap-2 rounded border border-gray-800 bg-gray-950 px-2.5 py-2",children:[i.jsx(Rr,{className:"h-4 w-4 shrink-0 text-blue-300"}),i.jsxs("div",{className:"min-w-0 flex-1",children:[i.jsx("div",{className:"truncate text-[11px] font-semibold text-gray-200",children:s("vscodeWorkbench.cli.chooseTitle",{defaultValue:"Start a CLI terminal"})}),i.jsx("div",{className:"truncate text-[10px] text-gray-500",children:s("vscodeWorkbench.cli.projectScoped",{defaultValue:"Project-scoped CLI terminal"})})]})]}),i.jsx("div",{className:"grid min-h-0 gap-1.5 overflow-y-auto pr-1",children:zd.map(W=>{const pe=K[W.id],Ae=o===W.id,Le=pe?.installed===!1,Ge=!!pe?.loading,rt=D.provider===W.id&&D.state==="running",Ke=!!(pe?.updateAvailable&&pe.latestVersion&&!Le),ct=rt?s("vscodeWorkbench.cli.installing",{defaultValue:"Installing..."}):Ge?s("vscodeWorkbench.cli.checking",{defaultValue:"Checking..."}):Le?s("vscodeWorkbench.cli.notInstalled",{defaultValue:"Not installed"}):Ke?s("vscodeWorkbench.cli.updateAvailable",{version:pe?.latestVersion,defaultValue:"Update {{version}}"}):pe?.installedVersion||s("vscodeWorkbench.cli.ready",{defaultValue:"Ready"});return i.jsxs("div",{className:xe("group flex min-w-0 items-center gap-2 rounded border px-2 py-2 transition-colors",Ae&&!Le?"border-blue-500 bg-blue-500/15 text-blue-100":"border-gray-800 bg-gray-900 text-gray-300 hover:border-gray-700 hover:bg-gray-800",Le&&"border-amber-800/70 bg-amber-950/30 text-amber-100"),children:[i.jsxs("button",{type:"button",className:"flex min-w-0 flex-1 items-center gap-2 text-left",onClick:()=>{if(Le){re(W.id);return}J(W.id)},title:dn[W.id]??W.label,children:[i.jsx(er,{provider:W.id,className:xe("h-4 w-4 shrink-0",Le&&"opacity-70 grayscale")}),i.jsxs("div",{className:"min-w-0",children:[i.jsx("div",{className:"truncate text-[11px] font-semibold",children:W.label}),i.jsx("div",{className:xe("truncate text-[10px]",Le?"text-amber-300":Ke?"text-amber-200":"text-gray-500"),children:ct})]}),Ae&&!Le&&i.jsx(Gt,{className:"ml-auto h-3.5 w-3.5 shrink-0 text-blue-200"})]}),(Le||Ke)&&i.jsx("button",{type:"button",disabled:rt,className:"flex h-7 w-7 shrink-0 items-center justify-center rounded bg-gray-800 text-amber-200 hover:bg-gray-700 disabled:opacity-50",onClick:()=>void re(W.id),"aria-label":Le?s("vscodeWorkbench.cli.installProvider",{provider:W.label,defaultValue:"Install {{provider}}"}):s("vscodeWorkbench.cli.updateProvider",{provider:W.label,defaultValue:"Update {{provider}}"}),title:Le?s("vscodeWorkbench.cli.installProvider",{provider:W.label,defaultValue:"Install {{provider}}"}):s("vscodeWorkbench.cli.updateProvider",{provider:W.label,defaultValue:"Update {{provider}}"}),children:rt?i.jsx(_t,{className:"h-3.5 w-3.5 animate-spin"}):Le?i.jsx(zn,{className:"h-3.5 w-3.5"}):i.jsx(at,{className:"h-3.5 w-3.5"})})]},W.id)})}),c&&i.jsx(ON,{sessions:G,activeSessionId:se,onSessionSelect:Z,t:s}),(D.state==="running"||D.state==="done"||D.state==="error")&&i.jsxs("div",{className:"mt-2 rounded border border-gray-800 bg-gray-950 p-2",children:[i.jsxs("div",{className:"flex items-center gap-2 text-[11px] text-gray-300",children:[D.state==="running"&&i.jsx(_t,{className:"h-3.5 w-3.5 animate-spin text-amber-300"}),D.state==="done"&&i.jsx(Gt,{className:"h-3.5 w-3.5 text-emerald-300"}),D.state==="error"&&i.jsx(tn,{className:"h-3.5 w-3.5 text-red-300"}),i.jsxs("span",{className:"truncate",children:[D.provider?dn[D.provider]:s("vscodeWorkbench.cli.provider",{defaultValue:"Provider"})," ",D.state==="running"?s("vscodeWorkbench.cli.installRunning",{defaultValue:"is installing"}):D.state==="done"?s("vscodeWorkbench.cli.installDone",{defaultValue:"is ready"}):s("vscodeWorkbench.cli.installError",{defaultValue:"needs attention"})]})]}),D.error&&i.jsx("div",{className:"mt-1 text-[11px] text-red-300",children:D.error}),D.log&&i.jsx("pre",{className:"mt-2 max-h-20 overflow-y-auto rounded bg-black/40 p-2 font-mono text-[10px] leading-relaxed text-gray-300",children:D.log})]}),i.jsxs("button",{type:"button",disabled:!me,onClick:fe,className:"mt-2 flex h-10 w-full items-center justify-center gap-2 rounded bg-blue-600 px-3 text-xs font-semibold text-white transition-colors hover:bg-blue-500 disabled:cursor-not-allowed disabled:bg-gray-800 disabled:text-gray-500",children:[i.jsx(Rr,{className:"h-4 w-4"}),s("vscodeWorkbench.cli.startSelected",{provider:dn[o]??o,defaultValue:"Start {{provider}}"})]})]})})}function Bie({project:e,mode:t,provider:r,session:n,historyCount:a,historyOpen:s,canStart:o,onToggleHistory:l,onNewSession:c,onNewPlainShell:d,onCloseTerminal:u,t:p}){const f=t==="plain";return i.jsxs("div",{className:"flex h-10 shrink-0 items-center justify-between gap-2 border-b border-gray-800 bg-gray-900/95 px-2",children:[i.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[f?i.jsx(Rr,{className:"h-4 w-4 shrink-0 text-gray-400"}):i.jsx(er,{provider:r,className:"h-4 w-4 shrink-0"}),i.jsxs("div",{className:"min-w-0",children:[i.jsx("div",{className:"truncate text-[11px] font-semibold text-gray-100",children:f?p("vscodeWorkbench.cli.plainTerminal",{defaultValue:"Terminal"}):dn[r]??r}),i.jsx("div",{className:"truncate text-[10px] text-gray-500",children:n?Uu(n):e?.displayName||e?.name||p("vscodeWorkbench.cli.newSession",{defaultValue:"New CLI session"})})]})]}),i.jsxs("div",{className:"flex shrink-0 items-center gap-1",children:[!f&&i.jsxs("button",{type:"button",className:xe("relative rounded border border-gray-700 p-1.5 text-gray-200 hover:bg-gray-800 disabled:opacity-50",s&&"bg-gray-800"),disabled:!e,onClick:l,title:p("vscodeWorkbench.cli.history",{defaultValue:"History"}),"aria-label":p("vscodeWorkbench.cli.history",{defaultValue:"History"}),children:[i.jsx(Ii,{className:"h-3.5 w-3.5"}),a>0&&i.jsx("span",{className:"absolute -right-1 -top-1 flex h-3.5 min-w-3.5 items-center justify-center rounded-full bg-blue-600 px-0.5 text-[8px] font-semibold text-white",children:Math.min(a,9)})]}),i.jsx("button",{type:"button",className:"rounded border border-gray-700 p-1.5 text-gray-200 hover:bg-gray-800 disabled:opacity-50",disabled:!e,onClick:d,title:p("vscodeWorkbench.cli.newPlainTerminal",{defaultValue:"New terminal"}),"aria-label":p("vscodeWorkbench.cli.newPlainTerminal",{defaultValue:"New terminal"}),children:i.jsx(Rr,{className:"h-3.5 w-3.5"})}),!f&&i.jsx("button",{type:"button",className:"rounded border border-gray-700 p-1.5 text-gray-200 hover:bg-gray-800 disabled:opacity-50",disabled:!o,onClick:c,title:p("vscodeWorkbench.cli.newSession",{defaultValue:"New CLI session"}),"aria-label":p("vscodeWorkbench.cli.newSession",{defaultValue:"New CLI session"}),children:i.jsx(Ut,{className:"h-3.5 w-3.5"})}),i.jsx("button",{type:"button",className:"rounded border border-gray-700 p-1.5 text-gray-200 hover:bg-gray-800",onClick:u,title:p("vscodeWorkbench.cli.closeTerminal",{defaultValue:"Close CLI terminal"}),"aria-label":p("vscodeWorkbench.cli.closeTerminal",{defaultValue:"Close CLI terminal"}),children:i.jsx(Ct,{className:"h-3.5 w-3.5"})})]})]})}function ON({sessions:e,activeSessionId:t,onSessionSelect:r,t:n}){const a=m.useMemo(()=>[...e].sort((s,o)=>{const l=Lg(s),c=Lg(o);return new Date(c||0).getTime()-new Date(l||0).getTime()}),[e]);return i.jsxs("div",{className:"mt-2 overflow-hidden rounded-md border border-gray-800 bg-gray-950",children:[i.jsxs("div",{className:"flex items-center justify-between border-b border-gray-800 px-2.5 py-2",children:[i.jsx("div",{className:"text-[11px] font-semibold uppercase tracking-wide text-gray-400",children:n("vscodeWorkbench.cli.projectHistory",{defaultValue:"Project history"})}),i.jsx("span",{className:"rounded bg-gray-800 px-1.5 py-0.5 text-[10px] text-gray-400",children:e.length})]}),i.jsx("div",{className:"max-h-52 overflow-y-auto p-1.5",children:a.length===0?i.jsx("div",{className:"px-3 py-4 text-center text-[11px] leading-5 text-gray-500",children:n("vscodeWorkbench.cli.noHistory",{defaultValue:"No sessions for this project yet."})}):a.map(s=>{const o=t===s.id,l=s.__provider??"claude";return i.jsxs("button",{type:"button",className:xe("flex w-full min-w-0 items-center gap-2 rounded px-2.5 py-2 text-left transition-colors hover:bg-gray-900",o&&"bg-blue-500/15 text-blue-100"),onClick:()=>r(s),title:Uu(s),children:[i.jsx(er,{provider:l,className:"h-4 w-4 shrink-0"}),i.jsxs("div",{className:"min-w-0 flex-1",children:[i.jsx("div",{className:"truncate text-[11px] font-medium text-gray-200",children:Uu(s)}),i.jsxs("div",{className:"flex min-w-0 items-center gap-1.5 text-[10px] text-gray-500",children:[i.jsx("span",{className:"truncate",children:dn[l]??l}),DN(s)&&i.jsxs("span",{className:"shrink-0",children:["- ",DN(s)]})]})]})]},`${l}-${s.id}`)})})]})}function Uie({projects:e,selectedProject:t,onProjectSelect:r,onNewSession:n,onOpenProject:a,onCloneProject:s,onRefresh:o,isRefreshing:l,t:c}){return i.jsxs("div",{className:"flex h-full min-h-0 flex-col",children:[i.jsx("div",{className:"border-b border-border p-1.5",children:i.jsxs("div",{className:"grid grid-cols-2 gap-1.5",children:[i.jsxs("button",{type:"button",onClick:a,className:"flex min-w-0 items-center justify-center gap-1 rounded border border-border px-2 py-1 text-[11px] font-medium text-foreground transition-colors hover:bg-muted",children:[i.jsx(Bn,{className:"h-3.5 w-3.5 shrink-0"}),i.jsx("span",{className:"truncate",children:c("vscodeWorkbench.projects.openProject",{defaultValue:"Open Project"})})]}),i.jsxs("button",{type:"button",onClick:s,className:"flex min-w-0 items-center justify-center gap-1 rounded border border-border px-2 py-1 text-[11px] font-medium text-foreground transition-colors hover:bg-muted",children:[i.jsx(Ju,{className:"h-3.5 w-3.5 shrink-0"}),i.jsx("span",{className:"truncate",children:c("vscodeWorkbench.projects.cloneFromGithub",{defaultValue:"Clone"})})]})]})}),i.jsxs("div",{className:"flex items-center justify-between border-b border-border px-2.5 py-1.5",children:[i.jsx("span",{className:"text-[11px] font-medium uppercase tracking-wide text-muted-foreground",children:c("vscodeWorkbench.projects.directoryList",{defaultValue:"Directories"})}),i.jsx("button",{type:"button",onClick:()=>{o()},disabled:l,className:"rounded p-1 text-muted-foreground transition-colors hover:bg-muted hover:text-foreground disabled:opacity-50",title:c("vscodeWorkbench.projects.refresh",{defaultValue:"Refresh projects"}),"aria-label":c("vscodeWorkbench.projects.refresh",{defaultValue:"Refresh projects"}),children:i.jsx(at,{className:xe("h-3.5 w-3.5",l&&"animate-spin")})})]}),i.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto p-1.5",children:e.length===0?i.jsx("div",{className:"flex h-full items-center justify-center px-4 text-center",children:i.jsxs("div",{children:[i.jsx(qr,{className:"mx-auto mb-3 h-7 w-7 text-muted-foreground/70"}),i.jsx("div",{className:"text-sm font-medium text-foreground",children:c("vscodeWorkbench.projects.emptyTitle",{defaultValue:"No project directories yet"})}),i.jsx("p",{className:"mt-1 text-xs leading-5 text-muted-foreground",children:c("vscodeWorkbench.projects.emptyDescription",{defaultValue:"Open a local folder or clone a repository to start."})})]})}):i.jsx("div",{className:"space-y-0.5",children:e.map(d=>{const u=t?.name===d.name;return i.jsxs("div",{role:"button",tabIndex:0,className:xe("group w-full cursor-pointer rounded border px-2 py-1.5 text-left transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/40",u?"border-primary/40 bg-primary/10":"border-transparent hover:border-border hover:bg-muted/40"),title:Fr(d),onClick:()=>r(d),onKeyDown:p=>{(p.key==="Enter"||p.key===" ")&&(p.preventDefault(),r(d))},children:[i.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[i.jsx("span",{className:xe("h-1.5 w-1.5 shrink-0 rounded-full",u?"bg-primary":"bg-muted-foreground/30 group-hover:bg-muted-foreground/60")}),i.jsx("span",{className:"truncate text-xs font-medium text-foreground",children:d.displayName||d.name})]}),i.jsxs("div",{className:"mt-0.5 flex min-w-0 items-center justify-between gap-2 pl-3.5 text-[10px] text-muted-foreground",children:[i.jsx("span",{className:"truncate font-mono",children:Bu(d)}),i.jsx("span",{className:"shrink-0",children:N6(d.fileCount,c)})]}),i.jsx("div",{className:"mt-1.5 flex justify-end opacity-0 transition-opacity group-hover:opacity-100 group-focus-visible:opacity-100",children:i.jsx("button",{type:"button",className:"inline-flex h-6 w-6 items-center justify-center rounded border border-border text-foreground",onClick:p=>{p.stopPropagation(),r(d),n(d)},title:c("vscodeWorkbench.projects.startChat",{defaultValue:"Chat"}),"aria-label":c("vscodeWorkbench.projects.startChat",{defaultValue:"Chat"}),children:i.jsx(Un,{className:"h-3 w-3"})})})]},d.name)})})})]})}function Il({icon:e,label:t,active:r,badge:n=!1,onClick:a}){return i.jsxs("button",{type:"button",className:xe("relative flex h-10 w-10 items-center justify-center rounded-md text-muted-foreground transition-colors hover:bg-muted hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/40",r&&"bg-primary/10 text-primary"),"aria-label":t,title:t,onClick:a,children:[r&&i.jsx("span",{className:"absolute left-0 h-5 w-0.5 rounded-r bg-primary"}),i.jsx(e,{className:"h-5 w-5"}),n&&i.jsx("span",{className:"absolute right-1 top-1 h-2 w-2 rounded-full bg-amber-500 ring-2 ring-background"})]})}function $ie({label:e,active:t,onClick:r}){return i.jsxs("button",{type:"button",className:xe("relative flex h-10 w-10 items-center justify-center rounded-md text-muted-foreground transition-colors hover:bg-muted hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/40",t&&"bg-emerald-500/10 text-emerald-500 dark:text-emerald-300"),"aria-label":e,title:e,onClick:r,children:[t&&i.jsx("span",{className:"absolute left-0 h-5 w-0.5 rounded-r bg-emerald-500"}),i.jsx(wc,{className:"h-5 w-5"})]})}function wc({className:e=""}){return i.jsx("img",{src:"/hermes-agent.png",alt:"","aria-hidden":"true",className:xe("rounded object-contain",e)})}function MN({label:e,active:t,onPointerDown:r}){return i.jsx("button",{type:"button",role:"separator","aria-orientation":"vertical","aria-label":e,title:e,className:xe("group relative z-10 flex h-full w-2 shrink-0 cursor-col-resize items-center justify-center bg-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/40",t&&"bg-primary/5"),onPointerDown:r,children:i.jsx("span",{className:xe("h-full w-px bg-border transition-colors group-hover:bg-primary/60",t&&"bg-primary")})})}const Dg="quickSettingsHandlePosition",Gl=50,Hie=10,Gie=90,Vie=5,Og="flex items-center justify-between p-3 rounded-lg bg-gray-50 dark:bg-gray-800 hover:bg-gray-100 dark:hover:bg-gray-700 transition-colors border border-transparent hover:border-gray-300 dark:hover:border-gray-600",Wie=`${Og} cursor-pointer`,qie="h-4 w-4 rounded border-gray-300 dark:border-gray-600 text-blue-600 dark:text-blue-500 focus:ring-blue-500 focus:ring-2 dark:focus:ring-blue-400 bg-gray-100 dark:bg-gray-800 checked:bg-blue-600 dark:checked:bg-blue-600",Kie=[{key:"autoExpandTools",labelKey:"quickSettings.autoExpandTools",icon:Zu},{key:"showRawParameters",labelKey:"quickSettings.showRawParameters",icon:Ec},{key:"showThinking",labelKey:"quickSettings.showThinking",icon:Yg}],Yie=[{key:"autoScrollToBottom",labelKey:"quickSettings.autoScrollToBottom",icon:L4}],Zie=[{key:"sendByCtrlEnter",labelKey:"quickSettings.sendByCtrlEnter",icon:U4}],j6=e=>Math.max(Hie,Math.min(Gie,e)),Xie=()=>{if(typeof window>"u")return Gl;const e=localStorage.getItem(Dg);if(!e)return Gl;try{const t=JSON.parse(e);if(typeof t.y=="number"&&Number.isFinite(t.y))return j6(t.y)}catch{return localStorage.removeItem(Dg),Gl}return Gl},FN=e=>e.type.includes("touch"),zN=e=>"touches"in e?e.touches[0]?.clientY??null:"clientY"in e&&typeof e.clientY=="number"?e.clientY:null;function Jie({isMobile:e}){const[t,r]=m.useState(Xie),[n,a]=m.useState(!1),[s,o]=m.useState(!1),l=m.useRef(null),c=m.useRef(Gl),d=m.useRef(!1),u=m.useRef(!1),p=m.useRef(!1),f=m.useCallback(()=>{p.current&&(document.body.style.cursor="",document.body.style.userSelect="",document.body.style.overflow="",document.body.style.position="",document.body.style.width="",p.current=!1)},[]),h=m.useCallback(w=>{p.current||(document.body.style.cursor="grabbing",document.body.style.userSelect="none",w&&(document.body.style.overflow="hidden",document.body.style.position="fixed",document.body.style.width="100%"),p.current=!0)},[]),g=m.useCallback(()=>{!n&&l.current===null||(u.current=d.current,d.current=!1,l.current=null,a(!1),o(!1),f())},[f,n]),b=m.useCallback(w=>{if(!n||l.current===null)return;const k=zN(w);if(k===null)return;const S=k-l.current,N=Math.abs(S)>Vie;if(!d.current&&N&&(d.current=!0,o(!0),h(FN(w))),!d.current)return;FN(w)&&w.preventDefault();const E=Math.max(window.innerHeight,1),I=S/E*100,A=e?-I:I;r(j6(c.current+A))},[h,e,n]),x=m.useCallback(w=>{w.stopPropagation();const k=zN(w);k!==null&&(l.current=k,c.current=t,d.current=!1,o(!1),a(!0))},[t]);m.useEffect(()=>{localStorage.setItem(Dg,JSON.stringify({y:t}))},[t]),m.useEffect(()=>{if(!n)return;const w=E=>{b(E)},k=()=>{g()},S=E=>{b(E)},N=()=>{g()};return document.addEventListener("mousemove",w),document.addEventListener("mouseup",k),document.addEventListener("touchmove",S,{passive:!1}),document.addEventListener("touchend",N),()=>{document.removeEventListener("mousemove",w),document.removeEventListener("mouseup",k),document.removeEventListener("touchmove",S),document.removeEventListener("touchend",N)}},[g,b,n]),m.useEffect(()=>()=>{f()},[f]);const y=m.useCallback(()=>u.current?(u.current=!1,!0):!1,[]),v=m.useMemo(()=>!e||typeof window>"u"?{top:`${t}%`,transform:"translateY(-50%)"}:{bottom:`${window.innerHeight*t/100}px`},[t,e]);return{isDragging:s,handleStyle:v,startDrag:x,endDrag:g,consumeSuppressedClick:y}}function Rl({title:e,children:t,className:r=""}){return i.jsxs("div",{className:`space-y-2 ${r}`,children:[i.jsx("h4",{className:"mb-2 text-xs font-semibold uppercase tracking-wider text-gray-500 dark:text-gray-400",children:e}),t]})}function Qie({label:e,icon:t,checked:r,onCheckedChange:n}){return i.jsxs("label",{className:Wie,children:[i.jsxs("span",{className:"flex items-center gap-2 text-sm text-gray-900 dark:text-white",children:[i.jsx(t,{className:"h-4 w-4 text-gray-600 dark:text-gray-400"}),e]}),i.jsx("input",{type:"checkbox",checked:r,onChange:a=>n(a.target.checked),className:qie})]})}const ese=m.memo(Qie),tse=[{value:"off",labelKey:"quickSettings.autoShowAgentDiffOff"},{value:"openOnly",labelKey:"quickSettings.autoShowAgentDiffOpenOnly"},{value:"always",labelKey:"quickSettings.autoShowAgentDiffAlways"}];function rse({isDarkMode:e,preferences:t,onPreferenceChange:r,onSelectChange:n}){const{t:a}=He("settings"),s=o=>o.map(({key:l,labelKey:c,icon:d})=>i.jsx(ese,{label:a(c),icon:d,checked:t[l],onCheckedChange:u=>r(l,u)},l));return i.jsxs("div",{className:"flex-1 space-y-6 overflow-y-auto overflow-x-hidden bg-background p-4",children:[i.jsxs(Rl,{title:a("quickSettings.sections.appearance"),children:[i.jsxs("div",{className:Og,children:[i.jsxs("span",{className:"flex items-center gap-2 text-sm text-gray-900 dark:text-white",children:[e?i.jsx($4,{className:"h-4 w-4 text-gray-600 dark:text-gray-400"}):i.jsx(V4,{className:"h-4 w-4 text-gray-600 dark:text-gray-400"}),a("quickSettings.darkMode")]}),i.jsx(uu,{})]}),i.jsx(cT,{compact:!0})]}),i.jsx(Rl,{title:a("quickSettings.sections.toolDisplay"),children:s(Kie)}),i.jsx(Rl,{title:a("quickSettings.sections.viewOptions"),children:s(Yie)}),i.jsx(Rl,{title:a("quickSettings.sections.agentDiff","Agent diff"),children:i.jsxs("div",{className:Og,children:[i.jsx("span",{className:"text-sm text-gray-900 dark:text-white",children:a("quickSettings.autoShowAgentDiff","Show agent edits as diff")}),i.jsx(rp,{children:tse.map(({value:o,labelKey:l})=>i.jsx(np,{isActive:t.autoShowAgentDiff===o,onClick:()=>n("autoShowAgentDiff",o),children:a(l)},o))})]})}),i.jsxs(Rl,{title:a("quickSettings.sections.inputSettings"),children:[s(Zie),i.jsx("p",{className:"ml-3 text-xs text-gray-500 dark:text-gray-400",children:a("quickSettings.sendByCtrlEnterDescription")})]})]})}function nse({isOpen:e,isDragging:t,style:r,onClick:n,onMouseDown:a,onTouchStart:s}){const{t:o}=He("settings"),l=e?"right-64":"right-0",c=t?"border-blue-500 dark:border-blue-400":"border-gray-200 dark:border-gray-700",d=t?"":"transition-all duration-150 ease-out",u=t?"cursor-grabbing":"cursor-pointer",p=o(t?"quickSettings.dragHandle.dragging":e?"quickSettings.dragHandle.closePanel":"quickSettings.dragHandle.openPanel"),f=o(t?"quickSettings.dragHandle.draggingStatus":"quickSettings.dragHandle.toggleAndMove");return i.jsx("button",{type:"button",onClick:n,onMouseDown:a,onTouchStart:s,className:`fixed ${l} z-50 ${d} border bg-white dark:bg-gray-800 ${c} rounded-l-md p-2 shadow-lg transition-colors hover:bg-gray-100 dark:hover:bg-gray-700 ${u} touch-none`,style:{...r,touchAction:"none",WebkitTouchCallout:"none",WebkitUserSelect:"none"},"aria-label":p,title:f,children:t?i.jsx(YD,{className:"h-5 w-5 text-blue-500 dark:text-blue-400"}):e?i.jsx(Fn,{className:"h-5 w-5 text-gray-600 dark:text-gray-400"}):i.jsx(Go,{className:"h-5 w-5 text-gray-600 dark:text-gray-400"})})}function ase(){const{t:e}=He("settings");return i.jsx("div",{className:"border-b border-gray-200 bg-gray-50 p-4 dark:border-gray-700 dark:bg-gray-900",children:i.jsxs("h3",{className:"flex items-center gap-2 text-lg font-semibold text-gray-900 dark:text-white",children:[i.jsx(G4,{className:"h-5 w-5 text-gray-600 dark:text-gray-400"}),e("quickSettings.title")]})})}function ise(){const[e,t]=m.useState(!1),{isMobile:r}=Zg({trackPWA:!1}),{isDarkMode:n}=ri(),{preferences:a,setPreference:s}=tp(),{isDragging:o,handleStyle:l,startDrag:c,consumeSuppressedClick:d}=Jie({isMobile:r}),u=m.useMemo(()=>({autoExpandTools:a.autoExpandTools,showRawParameters:a.showRawParameters,showThinking:a.showThinking,autoScrollToBottom:a.autoScrollToBottom,sendByCtrlEnter:a.sendByCtrlEnter,autoShowAgentDiff:a.autoShowAgentDiff}),[a.autoExpandTools,a.autoScrollToBottom,a.sendByCtrlEnter,a.showRawParameters,a.showThinking,a.autoShowAgentDiff]),p=m.useCallback((g,b)=>{s(g,b)},[s]),f=m.useCallback((g,b)=>{s(g,b)},[s]),h=m.useCallback(g=>{if(d()){g.preventDefault();return}t(b=>!b)},[d]);return i.jsxs(i.Fragment,{children:[i.jsx(nse,{isOpen:e,isDragging:o,style:l,onClick:h,onMouseDown:c,onTouchStart:c}),i.jsx("div",{className:`fixed right-0 top-0 z-40 h-full w-64 transform border-l border-border bg-background shadow-xl transition-transform duration-150 ease-out ${e?"translate-x-0":"translate-x-full"} ${r?"h-screen":""}`,children:i.jsxs("div",{className:"flex h-full flex-col",children:[i.jsx(ase,{}),i.jsx(rse,{isDarkMode:n,preferences:u,onPreferenceChange:p,onSelectChange:f})]})}),e&&i.jsx("div",{className:"fixed inset-0 z-30 bg-background/80 backdrop-blur-sm transition-opacity duration-150 ease-out",onClick:()=>t(!1)})]})}const I6="pixcode.inAppNotifications.v1",sse="pixcode.notificationPreferences.v1",jw=25;function ose(){try{const e=JSON.parse(localStorage.getItem(I6)??"[]");return Array.isArray(e)?e.slice(0,jw):[]}catch{return[]}}function BN(e){try{localStorage.setItem(I6,JSON.stringify(e.slice(0,jw)))}catch{}}function UN(){try{return JSON.parse(localStorage.getItem(sse)??"null")?.channels?.inApp!==!1}catch{return!0}}function lse(e){if(!e||typeof e!="object")return null;const t=e;return typeof t.id!="string"||typeof t.title!="string"||typeof t.body!="string"?null:{id:t.id,title:t.title,body:t.body,eventType:t.eventType,category:t.category,preferenceKey:t.preferenceKey,kind:t.kind,code:t.code,severity:t.severity||"info",provider:t.provider??null,sessionId:t.sessionId??null,createdAt:t.createdAt||new Date().toISOString(),data:t.data}}function cse(e){return e==="error"?"border-red-500/50 bg-red-50 text-red-950 dark:bg-red-950/35 dark:text-red-50":e==="warning"?"border-amber-500/50 bg-amber-50 text-amber-950 dark:bg-amber-950/35 dark:text-amber-50":"border-border bg-card text-card-foreground"}function dse(e){if(!e)return"";try{return new Intl.DateTimeFormat(void 0,{hour:"2-digit",minute:"2-digit"}).format(new Date(e))}catch{return""}}function use({latestMessage:e}){const[t,r]=m.useState(()=>typeof window>"u"?[]:ose()),[n,a]=m.useState(!1),[s,o]=m.useState(()=>new Set),[l,c]=m.useState(()=>typeof window>"u"?!0:UN());m.useEffect(()=>{const f=()=>c(UN());return window.addEventListener("storage",f),window.addEventListener("pixcode:notification-preferences-changed",f),()=>{window.removeEventListener("storage",f),window.removeEventListener("pixcode:notification-preferences-changed",f)}},[]),m.useEffect(()=>{const f=e;if(!f||f.type!=="notification:event")return;const h=lse(f.notification);h&&(h4({key:h.id,title:h.title,body:h.body,event:h.eventType||h.kind||"updates",tag:typeof h.data?.tag=="string"?h.data.tag:h.id,data:h.data}),l&&(r(g=>{if(g.some(x=>x.id===h.id))return g;const b=[h,...g].slice(0,jw);return BN(b),b}),o(g=>{const b=new Set(g);return b.delete(h.id),b}),a(!0)))},[l,e]);const d=m.useMemo(()=>t.filter(f=>!s.has(f.id)).length,[t,s]),u=m.useCallback(()=>{o(new Set(t.map(f=>f.id)))},[t]),p=m.useCallback(f=>{r(h=>{const g=h.filter(b=>b.id!==f);return BN(g),g}),o(h=>{const g=new Set(h);return g.delete(f),g})},[]);return!l||t.length===0?null:i.jsxs("div",{className:"pointer-events-none fixed bottom-4 right-4 z-40 flex max-w-[calc(100vw-2rem)] flex-col items-end gap-3",children:[n&&i.jsxs("div",{className:"pointer-events-auto w-[min(24rem,calc(100vw-2rem))] overflow-hidden rounded-lg border border-border bg-popover shadow-xl shadow-black/10",children:[i.jsxs("div",{className:"flex items-center justify-between gap-3 border-b border-border px-3 py-2",children:[i.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[i.jsx(pf,{className:"h-4 w-4 flex-shrink-0 text-primary"}),i.jsx("span",{className:"truncate text-sm font-medium text-popover-foreground",children:"Notifications"}),d>0&&i.jsx("span",{className:"rounded-full bg-primary px-2 py-0.5 text-xs font-medium text-primary-foreground",children:d})]}),i.jsxs("div",{className:"flex items-center gap-1",children:[i.jsx("button",{type:"button",onClick:u,className:"rounded px-2 py-1 text-xs text-muted-foreground transition-colors hover:bg-muted hover:text-foreground",children:"Read"}),i.jsx("button",{type:"button",onClick:()=>a(!1),className:"rounded p-1 text-muted-foreground transition-colors hover:bg-muted hover:text-foreground","aria-label":"Close notifications",children:i.jsx(Ct,{className:"h-4 w-4"})})]})]}),i.jsx("div",{className:"max-h-[22rem] space-y-2 overflow-y-auto p-2",children:t.slice(0,6).map(f=>i.jsx("div",{className:`rounded-md border p-3 shadow-sm ${cse(f.severity)}`,children:i.jsxs("div",{className:"flex items-start justify-between gap-3",children:[i.jsxs("div",{className:"min-w-0",children:[i.jsxs("div",{className:"flex items-center gap-2",children:[!s.has(f.id)&&i.jsx("span",{className:"h-2 w-2 flex-shrink-0 rounded-full bg-primary"}),i.jsx("p",{className:"truncate text-sm font-medium",children:f.title})]}),i.jsx("p",{className:"mt-1 text-sm leading-5 opacity-85",children:f.body}),i.jsx("p",{className:"mt-2 text-xs opacity-60",children:dse(f.createdAt)})]}),i.jsx("button",{type:"button",onClick:()=>p(f.id),className:"rounded p-1 opacity-60 transition-opacity hover:opacity-100","aria-label":"Dismiss notification",children:i.jsx(Ct,{className:"h-4 w-4"})})]})},f.id))})]}),i.jsxs("button",{type:"button",onClick:()=>{a(f=>!f),n||u()},className:"pointer-events-auto relative inline-flex h-11 w-11 items-center justify-center rounded-full border border-border bg-card text-card-foreground shadow-lg shadow-black/10 transition-transform hover:scale-105","aria-label":"Open notifications",children:[i.jsx(Gg,{className:"h-5 w-5"}),d>0&&i.jsx("span",{className:"absolute -right-1 -top-1 min-w-5 rounded-full bg-primary px-1.5 py-0.5 text-xs font-semibold text-primary-foreground",children:d>9?"9+":d})]})]})}function pse(){const[e,t]=m.useState(new Set),[r,n]=m.useState(new Set),a=m.useCallback(d=>{d&&t(u=>new Set([...u,d]))},[]),s=m.useCallback(d=>{d&&t(u=>{const p=new Set(u);return p.delete(d),p})},[]),o=m.useCallback(d=>{d&&n(u=>new Set([...u,d]))},[]),l=m.useCallback(d=>{d&&n(u=>{const p=new Set(u);return p.delete(d),p})},[]),c=m.useCallback(d=>{d&&t(u=>{const p=new Set;for(const f of u)f.startsWith("new-session-")||p.add(f);return p.add(d),p})},[]);return{activeSessions:e,processingSessions:r,markSessionAsActive:a,markSessionAsInactive:s,markSessionAsProcessing:o,markSessionAsNotProcessing:l,replaceTemporarySession:c}}const Cr=e=>JSON.stringify(e??null),$N=(e,t,r)=>e.length!==t.length?!0:t.some((n,a)=>{const s=e[a];return!s||n.name!==s.name||n.displayName!==s.displayName||n.fullPath!==s.fullPath||n.fileCount!==s.fileCount||Cr(n.sessionMeta)!==Cr(s.sessionMeta)||Cr(n.sessions)!==Cr(s.sessions)?!0:Cr(n.cursorSessions)!==Cr(s.cursorSessions)||Cr(n.codexSessions)!==Cr(s.codexSessions)||Cr(n.geminiSessions)!==Cr(s.geminiSessions)||Cr(n.qwenSessions)!==Cr(s.qwenSessions)||Cr(n.opencodeSessions)!==Cr(s.opencodeSessions)}),Qs=(e,t)=>(e??[]).map(r=>({...r,__provider:r.__provider??t})),$u=e=>[...Qs(e.sessions,"claude"),...Qs(e.codexSessions,"codex"),...Qs(e.cursorSessions,"cursor"),...Qs(e.geminiSessions,"gemini"),...Qs(e.qwenSessions,"qwen"),...Qs(e.opencodeSessions,"opencode")],mse=(e,t,r,n)=>{if(!r||!n)return!0;const a=e.find(c=>c.name===r.name),s=t.find(c=>c.name===r.name);if(!a||!s)return!1;const o=$u(a).find(c=>c.id===n.id),l=$u(s).find(c=>c.id===n.id);return!o||!l?!1:o.id===l.id&&o.title===l.title&&o.created_at===l.created_at&&o.updated_at===l.updated_at},hse=new Set(["chat","orchestration","remote","controlRoom","files","shell","git","changes","liveView","preview"]),fse=new Set(["controlRoom"]),gse=e=>hse.has(e)||e.startsWith("plugin:"),R6=e=>fse.has(e)?"chat":e,bse=()=>{if(typeof window<"u"&&window.location.pathname.endsWith("/orchestration"))return"orchestration";try{const e=localStorage.getItem("activeTab");if(e&&gse(e))return R6(e)}catch{}return"chat"};function xse({sessionId:e,navigate:t,latestMessage:r,isMobile:n,activeSessions:a}){const[s,o]=m.useState([]),[l,c]=m.useState(null),[d,u]=m.useState(null),[p,f]=m.useState(bse);m.useEffect(()=>{try{localStorage.setItem("activeTab",R6(p))}catch{}},[p]);const[h,g]=m.useState(!1),[b,x]=m.useState(!0),[y,v]=m.useState(null),[w,k]=m.useState(!1),[S,N]=m.useState(!1),[E,I]=m.useState("agents"),[A,T]=m.useState(0),_=m.useRef(null),j=m.useCallback(async({showLoadingState:ce=!0}={})=>{try{ce&&x(!0);const he=await(await Lt.projects()).json();o(ke=>ke.length===0||$N(ke,he,!0)?he:ke)}catch(ye){console.error("Error fetching projects:",ye)}finally{ce&&x(!1)}},[]),R=m.useCallback(async()=>{await j({showLoadingState:!1})},[j]),C=m.useCallback((ce="tools")=>{I(ce),N(!0)},[]);m.useEffect(()=>{j()},[j]),m.useEffect(()=>{!b&&s.length===1&&!l&&!e&&c(s[0])},[b,s,l,e]),m.useEffect(()=>{if(!r)return;if(r.type==="loading_progress"){_.current&&(clearTimeout(_.current),_.current=null),v(r),r.phase==="complete"&&(_.current=setTimeout(()=>{v(null),_.current=null},500));return}if(r.type!=="projects_updated")return;const ce=r;if(ce.changedFile&&d&&l){const M=ce.changedFile.replace(/\\/g,"/").split("/");M.length>=2&&M[M.length-1].replace(".jsonl","")===d.id&&(a.has(d.id)||T(U=>U+1))}const ye=d&&a.has(d.id)||a.size>0&&Array.from(a).some(je=>je.startsWith("new-session-")),he=ce.projects;if(ye&&!mse(s,he,l,d)||(o(he),!l))return;const ke=he.find(je=>je.name===l.name);if(!ke||(Cr(ke)!==Cr(l)&&c(ke),!d))return;$u(ke).find(je=>je.id===d.id)||u(null)},[r,l,d,a,s]),m.useEffect(()=>()=>{_.current&&(clearTimeout(_.current),_.current=null)},[]),m.useEffect(()=>{if(!(!e||s.length===0)){for(const ce of s){const ye=ce.sessions?.find(ae=>ae.id===e);if(ye){const ae=l?.name!==ce.name,ue=d?.id!==e||d.__provider!=="claude";ae&&c(ce),ue&&u({...ye,__provider:"claude"});return}const he=ce.cursorSessions?.find(ae=>ae.id===e);if(he){const ae=l?.name!==ce.name,ue=d?.id!==e||d.__provider!=="cursor";ae&&c(ce),ue&&u({...he,__provider:"cursor"});return}const ke=ce.codexSessions?.find(ae=>ae.id===e);if(ke){const ae=l?.name!==ce.name,ue=d?.id!==e||d.__provider!=="codex";ae&&c(ce),ue&&u({...ke,__provider:"codex"});return}const ve=ce.geminiSessions?.find(ae=>ae.id===e);if(ve){const ae=typeof ve.id=="string"&&ve.id.startsWith("qwen_")||ve.provider==="qwen",Y=typeof ve.id=="string"&&ve.id.startsWith("opencode_")||ve.provider==="opencode"?"opencode":ae?"qwen":"gemini",U=l?.name!==ce.name,Q=d?.id!==e||d.__provider!==Y;U&&c(ce),Q&&u({...ve,__provider:Y});return}const je=ce.qwenSessions?.find(ae=>ae.id===e);if(je){const ae=l?.name!==ce.name,ue=d?.id!==e||d.__provider!=="qwen";ae&&c(ce),ue&&u({...je,__provider:"qwen"});return}const M=ce.opencodeSessions?.find(ae=>ae.id===e);if(M){const ae=l?.name!==ce.name,ue=d?.id!==e||d.__provider!=="opencode";ae&&c(ce),ue&&u({...M,__provider:"opencode"});return}}if(e&&d?.id!==e){const ce=e.startsWith("opencode_")?"opencode":e.startsWith("qwen_")?"qwen":e.startsWith("codex-")||e.startsWith("codex_")?"codex":e.startsWith("gemini_")?"gemini":null,ye=(typeof window<"u"?localStorage.getItem("selected-provider"):null)||"claude";u({id:e,__provider:ce||ye})}}},[e,s,l?.name,d?.id,d?.__provider]);const D=m.useCallback(ce=>{c(ce),u(null),t("/"),n&&g(!1)},[n,t]),B=m.useCallback(ce=>{u(ce),(p==="preview"||p==="liveView"||p==="orchestration")&&f("chat");const ye=ce.__provider||localStorage.getItem("selected-provider")||"claude";if(ce.__provider&&localStorage.setItem("selected-provider",ce.__provider),ye==="cursor"&&sessionStorage.setItem("cursorSessionId",ce.id),n){const he=ce.__projectName,ke=l?.name;he!==ke&&g(!1)}t(`/session/${ce.id}`)},[p,n,t,l?.name]),F=m.useCallback(ce=>{o(ye=>{const he=ye.findIndex(ve=>ve.name===ce.name);if(he===-1)return[ce,...ye];const ke=[...ye];return ke[he]={...ke[he],...ce},ke}),c(ce),u(null),f("chat"),t("/"),n&&g(!1)},[n,t]),V=m.useCallback(ce=>{F(ce)},[F]),K=m.useCallback(async ce=>{try{const ye=await Lt.quickStartProject(),he=await ye.json().catch(()=>({}));if(!ye.ok||!he?.project){console.error("[quick-start] failed:",he);return}const ke=he.project;if(ce==="chat"){F(ke);return}o(ve=>ve.some(je=>je.name===ke.name)?ve:[ke,...ve]),c(ke),u(null),f(ce),t("/"),n&&g(!1)}catch(ye){console.error("[quick-start] error:",ye)}},[n,t,F]),L=m.useCallback(async()=>{await K("chat")},[K]),G=m.useCallback(async()=>{await K("orchestration")},[K]),H=m.useCallback((ce,ye)=>{c(ce),u(null),f("orchestration"),ye&&localStorage.setItem("pixcode.orchestration.selectedRunId",ye),t("/"),n&&g(!1)},[n,t]),z=m.useCallback(()=>{u(null),f("controlRoom"),t("/"),n&&g(!1)},[n,t]),te=m.useCallback(ce=>{d?.id===ce&&(u(null),t("/")),o(ye=>ye.map(he=>({...he,sessions:he.sessions?.filter(ke=>ke.id!==ce)??[],sessionMeta:{...he.sessionMeta,total:Math.max(0,(he.sessionMeta?.total??0)-1)}})))},[t,d?.id]),se=m.useCallback(async()=>{try{const ye=await(await Lt.projects()).json();if(o(ve=>$N(ve,ye,!0)?ye:ve),!l)return;const he=ye.find(ve=>ve.name===l.name);if(!he||(Cr(he)!==Cr(l)&&c(he),!d))return;const ke=$u(he).find(ve=>ve.id===d.id);if(ke){const ve=ke.__provider||!d.__provider?ke:{...ke,__provider:d.__provider};Cr(ve)!==Cr(d)&&u(ve)}}catch(ce){console.error("Error refreshing sidebar:",ce)}},[l,d]),me=m.useCallback(ce=>{l?.name===ce&&(c(null),u(null),t("/")),o(ye=>ye.filter(he=>he.name!==ce))},[t,l?.name]),de=m.useMemo(()=>({projects:s,selectedProject:l,selectedSession:d,onProjectSelect:D,onSessionSelect:B,onNewSession:V,onProjectCreated:F,onQuickStartSession:L,onOpenControlRoom:z,onOpenOrchestration:H,onSessionDelete:te,onProjectDelete:me,isLoading:b,loadingProgress:y,onRefresh:se,onShowSettings:()=>N(!0),showSettings:S,settingsInitialTab:E,onCloseSettings:()=>N(!1),isMobile:n}),[V,z,H,F,L,me,D,te,B,se,b,n,y,s,E,l,d,S]);return{projects:s,selectedProject:l,selectedSession:d,activeTab:p,sidebarOpen:h,isLoadingProjects:b,loadingProgress:y,isInputFocused:w,showSettings:S,settingsInitialTab:E,externalMessageUpdate:A,setActiveTab:f,setSidebarOpen:g,setIsInputFocused:k,setShowSettings:N,openSettings:C,fetchProjects:j,refreshProjectsSilently:R,sidebarSharedProps:de,handleProjectSelect:D,handleSessionSelect:B,handleNewSession:V,handleOpenOrchestration:H,handleQuickStartOrchestration:G,handleSessionDelete:te,handleProjectDelete:me,handleSidebarRefresh:se}}function tf(){const e=rR(),{sessionId:t}=nR(),{t:r}=He("common"),{isMobile:n}=Zg({trackPWA:!1}),{ws:a,sendMessage:s,latestMessage:o,isConnected:l}=X4(),c=m.useRef(!1),{activeSessions:d,processingSessions:u,markSessionAsActive:p,markSessionAsInactive:f,markSessionAsProcessing:h,markSessionAsNotProcessing:g,replaceTemporarySession:b}=pse(),{selectedProject:x,selectedSession:y,activeTab:v,sidebarOpen:w,isLoadingProjects:k,externalMessageUpdate:S,setActiveTab:N,setSidebarOpen:E,setIsInputFocused:I,setShowSettings:A,openSettings:T,refreshProjectsSilently:_,sidebarSharedProps:j,handleQuickStartOrchestration:R}=xse({sessionId:t,navigate:e,latestMessage:o,isMobile:n,activeSessions:d});return m.useEffect(()=>(window.refreshProjects=_,()=>{window.refreshProjects===_&&delete window.refreshProjects}),[_]),m.useEffect(()=>(window.openSettings=T,()=>{window.openSettings===T&&delete window.openSettings}),[T]),m.useEffect(()=>{if(typeof navigator>"u"||!("serviceWorker"in navigator))return;const C=D=>{const B=D.data;if(!(!B||B.type!=="notification:navigate")){if(typeof B.provider=="string"&&B.provider.trim()&&localStorage.setItem("selected-provider",B.provider),N("chat"),E(!1),_(),typeof B.sessionId=="string"&&B.sessionId){e(`/session/${B.sessionId}`);return}e("/")}};return navigator.serviceWorker.addEventListener("message",C),()=>{navigator.serviceWorker.removeEventListener("message",C)}},[e,_,N,E]),m.useEffect(()=>{l&&!c.current?c.current=!0:l||(c.current=!1),l&&y?.id&&s({type:"get-pending-permissions",sessionId:y.id})},[l,y?.id,s]),m.useEffect(()=>{if(!o||o.type!=="projects_updated"&&o.type!=="project_files_updated")return;const C=o.type==="project_files_updated"?typeof o.projectName=="string"?o.projectName:null:x?.name??null;window.dispatchEvent(new CustomEvent("pixcode:file-tree-refresh",{detail:{projectName:C,changedFile:typeof o.changedFile=="string"?o.changedFile:null}}))},[o,x?.name]),m.useEffect(()=>{const C=window.visualViewport;if(!C)return;const D=()=>{const B=Math.max(0,window.innerHeight-C.height);document.documentElement.style.setProperty("--keyboard-height",`${B}px`)};return C.addEventListener("resize",D),()=>C.removeEventListener("resize",D)},[]),i.jsxs("div",{className:"fixed inset-0 flex bg-background",style:{bottom:"var(--keyboard-height, 0px)"},children:[n?i.jsxs("div",{className:`fixed inset-0 z-50 flex transition-all duration-150 ease-out ${w?"visible opacity-100":"invisible opacity-0"}`,children:[i.jsx("button",{className:"fixed inset-0 bg-background/60 backdrop-blur-sm transition-opacity duration-150 ease-out",onClick:C=>{C.stopPropagation(),E(!1)},onTouchStart:C=>{C.preventDefault(),C.stopPropagation(),E(!1)},"aria-label":r("versionUpdate.ariaLabels.closeSidebar")}),i.jsx("div",{className:`relative h-full w-[85vw] max-w-sm transform border-r border-border/40 bg-card transition-transform duration-150 ease-out sm:w-80 ${w?"translate-x-0":"-translate-x-full"}`,onClick:C=>C.stopPropagation(),onTouchStart:C=>C.stopPropagation(),children:i.jsx(gT,{...j})})]}):null,i.jsx("div",{className:"flex min-w-0 flex-1 flex-col",children:n?i.jsx(rie,{selectedProject:x,selectedSession:y,activeTab:v,setActiveTab:N,ws:a,sendMessage:s,latestMessage:o,isMobile:n,onMenuClick:()=>E(!0),isLoading:k,onInputFocusChange:I,onSessionActive:p,onSessionInactive:f,onSessionProcessing:h,onSessionNotProcessing:g,processingSessions:u,onReplaceTemporarySession:b,onNavigateToSession:C=>e(`/session/${C}`),onShowSettings:()=>A(!0),externalMessageUpdate:S,onQuickStartSession:j.onQuickStartSession,onQuickStartOrchestration:R}):i.jsx(Aie,{sidebarProps:j,selectedProject:x,selectedSession:y,activeTab:v,setActiveTab:N,ws:a,sendMessage:s,latestMessage:o,isMobile:n,onMenuClick:()=>E(!0),isLoading:k,onInputFocusChange:I,onSessionActive:p,onSessionInactive:f,onSessionProcessing:h,onSessionNotProcessing:g,processingSessions:u,onReplaceTemporarySession:b,onNavigateToSession:C=>e(`/session/${C}`),onShowSettings:()=>A(!0),externalMessageUpdate:S,onQuickStartSession:j.onQuickStartSession,onQuickStartOrchestration:R})}),i.jsx(ise,{}),i.jsx(use,{latestMessage:o})]})}const{slice:yse,forEach:vse}=[];function wse(e){return vse.call(yse.call(arguments,1),t=>{if(t)for(const r in t)e[r]===void 0&&(e[r]=t[r])}),e}function kse(e){return typeof e!="string"?!1:[/<\s*script.*?>/i,/<\s*\/\s*script\s*>/i,/<\s*img.*?on\w+\s*=/i,/<\s*\w+\s*on\w+\s*=.*?>/i,/javascript\s*:/i,/vbscript\s*:/i,/expression\s*\(/i,/eval\s*\(/i,/alert\s*\(/i,/document\.cookie/i,/document\.write\s*\(/i,/window\.location/i,/innerHTML/i].some(r=>r.test(e))}const HN=/^[\u0009\u0020-\u007e\u0080-\u00ff]+$/,Sse=function(e,t){const n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{path:"/"},a=encodeURIComponent(t);let s=`${e}=${a}`;if(n.maxAge>0){const o=n.maxAge-0;if(Number.isNaN(o))throw new Error("maxAge should be a Number");s+=`; Max-Age=${Math.floor(o)}`}if(n.domain){if(!HN.test(n.domain))throw new TypeError("option domain is invalid");s+=`; Domain=${n.domain}`}if(n.path){if(!HN.test(n.path))throw new TypeError("option path is invalid");s+=`; Path=${n.path}`}if(n.expires){if(typeof n.expires.toUTCString!="function")throw new TypeError("option expires is invalid");s+=`; Expires=${n.expires.toUTCString()}`}if(n.httpOnly&&(s+="; HttpOnly"),n.secure&&(s+="; Secure"),n.sameSite)switch(typeof n.sameSite=="string"?n.sameSite.toLowerCase():n.sameSite){case!0:s+="; SameSite=Strict";break;case"lax":s+="; SameSite=Lax";break;case"strict":s+="; SameSite=Strict";break;case"none":s+="; SameSite=None";break;default:throw new TypeError("option sameSite is invalid")}return n.partitioned&&(s+="; Partitioned"),s},GN={create(e,t,r,n){let a=arguments.length>4&&arguments[4]!==void 0?arguments[4]:{path:"/",sameSite:"strict"};r&&(a.expires=new Date,a.expires.setTime(a.expires.getTime()+r*60*1e3)),n&&(a.domain=n),document.cookie=Sse(e,t,a)},read(e){const t=`${e}=`,r=document.cookie.split(";");for(let n=0;n<r.length;n++){let a=r[n];for(;a.charAt(0)===" ";)a=a.substring(1,a.length);if(a.indexOf(t)===0)return a.substring(t.length,a.length)}return null},remove(e,t){this.create(e,"",-1,t)}};var Cse={name:"cookie",lookup(e){let{lookupCookie:t}=e;if(t&&typeof document<"u")return GN.read(t)||void 0},cacheUserLanguage(e,t){let{lookupCookie:r,cookieMinutes:n,cookieDomain:a,cookieOptions:s}=t;r&&typeof document<"u"&&GN.create(r,e,n,a,s)}},Nse={name:"querystring",lookup(e){let{lookupQuerystring:t}=e,r;if(typeof window<"u"){let{search:n}=window.location;!window.location.search&&window.location.hash?.indexOf("?")>-1&&(n=window.location.hash.substring(window.location.hash.indexOf("?")));const s=n.substring(1).split("&");for(let o=0;o<s.length;o++){const l=s[o].indexOf("=");l>0&&s[o].substring(0,l)===t&&(r=s[o].substring(l+1))}}return r}},Ese={name:"hash",lookup(e){let{lookupHash:t,lookupFromHashIndex:r}=e,n;if(typeof window<"u"){const{hash:a}=window.location;if(a&&a.length>2){const s=a.substring(1);if(t){const o=s.split("&");for(let l=0;l<o.length;l++){const c=o[l].indexOf("=");c>0&&o[l].substring(0,c)===t&&(n=o[l].substring(c+1))}}if(n)return n;if(!n&&r>-1){const o=a.match(/\/([a-zA-Z-]*)/g);return Array.isArray(o)?o[typeof r=="number"?r:0]?.replace("/",""):void 0}}}return n}};let eo=null;const VN=()=>{if(eo!==null)return eo;try{if(eo=typeof window<"u"&&window.localStorage!==null,!eo)return!1;const e="i18next.translate.boo";window.localStorage.setItem(e,"foo"),window.localStorage.removeItem(e)}catch{eo=!1}return eo};var Tse={name:"localStorage",lookup(e){let{lookupLocalStorage:t}=e;if(t&&VN())return window.localStorage.getItem(t)||void 0},cacheUserLanguage(e,t){let{lookupLocalStorage:r}=t;r&&VN()&&window.localStorage.setItem(r,e)}};let to=null;const WN=()=>{if(to!==null)return to;try{if(to=typeof window<"u"&&window.sessionStorage!==null,!to)return!1;const e="i18next.translate.boo";window.sessionStorage.setItem(e,"foo"),window.sessionStorage.removeItem(e)}catch{to=!1}return to};var Ase={name:"sessionStorage",lookup(e){let{lookupSessionStorage:t}=e;if(t&&WN())return window.sessionStorage.getItem(t)||void 0},cacheUserLanguage(e,t){let{lookupSessionStorage:r}=t;r&&WN()&&window.sessionStorage.setItem(r,e)}},jse={name:"navigator",lookup(e){const t=[];if(typeof navigator<"u"){const{languages:r,userLanguage:n,language:a}=navigator;if(r)for(let s=0;s<r.length;s++)t.push(r[s]);n&&t.push(n),a&&t.push(a)}return t.length>0?t:void 0}},Ise={name:"htmlTag",lookup(e){let{htmlTag:t}=e,r;const n=t||(typeof document<"u"?document.documentElement:null);return n&&typeof n.getAttribute=="function"&&(r=n.getAttribute("lang")),r}},Rse={name:"path",lookup(e){let{lookupFromPathIndex:t}=e;if(typeof window>"u")return;const r=window.location.pathname.match(/\/([a-zA-Z-]*)/g);return Array.isArray(r)?r[typeof t=="number"?t:0]?.replace("/",""):void 0}},_se={name:"subdomain",lookup(e){let{lookupFromSubdomainIndex:t}=e;const r=typeof t=="number"?t+1:1,n=typeof window<"u"&&window.location?.hostname?.match(/^(\w{2,5})\.(([a-z0-9-]{1,63}\.[a-z]{2,6})|localhost)/i);if(n)return n[r]}};let _6=!1;try{document.cookie,_6=!0}catch{}const P6=["querystring","cookie","localStorage","sessionStorage","navigator","htmlTag"];_6||P6.splice(1,1);const Pse=()=>({order:P6,lookupQuerystring:"lng",lookupCookie:"i18next",lookupLocalStorage:"i18nextLng",lookupSessionStorage:"i18nextLng",caches:["localStorage"],excludeCacheFor:["cimode"],convertDetectedLanguage:e=>e});class L6{constructor(t){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.type="languageDetector",this.detectors={},this.init(t,r)}init(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{languageUtils:{}},r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};this.services=t,this.options=wse(r,this.options||{},Pse()),typeof this.options.convertDetectedLanguage=="string"&&this.options.convertDetectedLanguage.indexOf("15897")>-1&&(this.options.convertDetectedLanguage=a=>a.replace("-","_")),this.options.lookupFromUrlIndex&&(this.options.lookupFromPathIndex=this.options.lookupFromUrlIndex),this.i18nOptions=n,this.addDetector(Cse),this.addDetector(Nse),this.addDetector(Tse),this.addDetector(Ase),this.addDetector(jse),this.addDetector(Ise),this.addDetector(Rse),this.addDetector(_se),this.addDetector(Ese)}addDetector(t){return this.detectors[t.name]=t,this}detect(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:this.options.order,r=[];return t.forEach(n=>{if(this.detectors[n]){let a=this.detectors[n].lookup(this.options);a&&typeof a=="string"&&(a=[a]),a&&(r=r.concat(a))}}),r=r.filter(n=>n!=null&&!kse(n)).map(n=>this.options.convertDetectedLanguage(n)),this.services&&this.services.languageUtils&&this.services.languageUtils.getBestMatchFromCodes?r:r.length>0?r[0]:null}cacheUserLanguage(t){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.options.caches;r&&(this.options.excludeCacheFor&&this.options.excludeCacheFor.indexOf(t)>-1||r.forEach(n=>{this.detectors[n]&&this.detectors[n].cacheUserLanguage(t,this.options)}))}}L6.type="languageDetector";const Lse={save:"Save",cancel:"Cancel",delete:"Delete",create:"Create",edit:"Edit",close:"Close",confirm:"Confirm",submit:"Submit",retry:"Retry",refresh:"Refresh",search:"Search",clear:"Clear",copy:"Copy",download:"Download",upload:"Upload",browse:"Browse"},Dse={chat:"Chat",shell:"Shell",files:"Files",git:"Source Control",changes:"Changes",liveView:"Live View",tasks:"Tasks",remote:"Remote",controlRoom:"Control",orchestration:"Orchestration"},Ose={loading:"Loading...",success:"Success",error:"Error",failed:"Failed",pending:"Pending",completed:"Completed",inProgress:"In Progress"},Mse={savedSuccessfully:"Saved successfully",deletedSuccessfully:"Deleted successfully",updatedSuccessfully:"Updated successfully",operationFailed:"Operation failed",networkError:"Network error. Please check your connection.",unauthorized:"Unauthorized. Please log in.",notFound:"Not found",invalidInput:"Invalid input",requiredField:"This field is required",unknownError:"An unknown error occurred"},Fse={settings:"Settings",home:"Home",back:"Back",next:"Next",previous:"Previous",logout:"Logout"},zse={language:"Language",theme:"Theme",darkMode:"Dark Mode",lightMode:"Light Mode",name:"Name",description:"Description",enabled:"Enabled",disabled:"Disabled",optional:"Optional",version:"Version",select:"Select",selectAll:"Select All",deselectAll:"Deselect All"},Bse={justNow:"Just now",minutesAgo:"{{count}} mins ago",hoursAgo:"{{count}} hours ago",daysAgo:"{{count}} days ago",yesterday:"Yesterday"},Use={newFile:"New File",newFolder:"New Folder",rename:"Rename",move:"Move",copyPath:"Copy Path",openInEditor:"Open in Editor"},$se={loading:"Loading Pixcode",settingUpWorkspace:"Setting up your workspace...",chooseProject:"Choose Your Project",selectProjectDescription:"Select a project from the sidebar to start coding with Claude. Each project contains your chat sessions and file history.",tip:"Tip",createProjectMobile:"Tap the menu button above to access projects",createProjectDesktop:"Create a new project by clicking the folder icon in the sidebar",newSession:"New Session",untitledSession:"Untitled Session",projectFiles:"Project Files",landing:{title:"Start a Pixcode workspace",description:"Choose a project, start a new chat, or launch Orchestration with one goal. Orchestration manages the CLI agents you select, shows every step, and surfaces errors directly.",startOrchestration:"Start Orchestration",startOrchestrationDescription:"Creates an automatic project and opens the Orchestration screen with agent control and run history.",startChat:"Start a new chat",startChatDescription:"Creates a folder automatically and opens the normal chat screen with one agent.",sidebarHint:"When you select an existing project from the sidebar, chat history, files, git status, tasks, and orchestration stay in the same main screen.",createProject:"Create New Project",createProjectDescription:"Add an existing workspace or create a folder, then open the provider picker for coding."}},Hse={title:"Orchestration",subtitle:"Give one goal inside {{project}}; choose the CLI workers, duplicate any CLI when needed, and assign work directly or let the coordinator split it.",refresh:"Refresh",goal:"Goal",goalPlaceholder:"Example: Fix the auth screen for single-port deployment, capture errors, and verify with lint and typecheck.",mode:"Run mode",systemPlan:"System plan",noMode:"No mode selected",loadingPlan:"Loading agent plan.",start:"Start team",starting:"Starting",stop:"Stop team",stopping:"Stopping",cancelFailed:"Workflow could not be stopped.",linkedTask:"Linked task",replayRun:"Replay",replaying:"Replaying",approveReplay:"Approve replay",replayApprovalRequired:"Replay needs approval before repeating a step with prior shell, network, or file-write activity.",replayFailed:"Workflow replay could not start.",needAgent:"Enable at least one CLI worker.",needRoles:"Assign at least one enabled agent to these role(s) for this mode: {{roles}}.",startFailed:"Workflow could not start.",quickPrompts:{label:"Quick prompt:",liveTrading:{label:"8024 live trading screen",prompt:"Hi, please create a small project and then run it on port 8024. I want a Binance FAPI-connected TradingView-style design with a TradingView chart and a star/favorites system on the left. Split the work logically and manage the process automatically."}},cliControl:"CLI team",enabledCount:"{{count}} enabled",enabled:"Enabled",disabled:"Disabled",history:"History",emptyHistory:"No runs yet. Write a goal and start the agents.",steps:"{{done}}/{{total}} steps",notSelected:"No run selected",notSelectedDescription:"Select a previous run or start a new goal. Agent messages, errors, change summaries, and preview outputs appear here.",loadFailed:"Run details could not be loaded.",loadingRun:"Loading run...",traceTimeline:"Trace timeline",traceFilters:"Filters",traceAll:"All",traceActor:"Actor",traceProvider:"Provider",traceType:"Type",traceSeverity:"Severity",traceDuration:"{{duration}} elapsed",traceEmpty:"No trace events match the current filters.",traceLoadFailed:"Trace timeline could not be loaded.",traceTypes:{run:"Run",node:"Step",provider:"Provider",message:"Message",artifact:"Artifact",file:"File edit",permission_policy:"Permission policy",error:"Error"},traceSeverityLevels:{info:"Info",warning:"Warning",error:"Error"},teamHistory:"Team history",permissionApprovalsPending:"{{count}} permission approval pending",agentSteps:"Agent steps",changeSummary:"Change summary",noChangeSummary:"The final summary is not ready yet. A readable Markdown summary appears here when the agents finish.",prepareTeamFromReport:"Prepare agent team from this report",prepareTeamTitle:"Prepare agent team prompt",prepareTeamDescription:"The debate output was turned into a new Agent Team prompt. Edit it, then move it into Agent Team mode.",usePreparedPrompt:"Use prompt",reportToPromptPrefix:"Prepare and execute an agent team from the following debate/decision report. Split the needs into tasks, propose sensible assignments for the available CLI agents, and start only after user confirmation.",generatedSummaryTitle:"Automatic run summary",summaryStatus:"Overall status",summarySteps:"Completed steps",summaryFailures:"Failed steps",summaryCanceled:"Canceled steps",summaryDiffs:"Diff/change outputs",summaryPreviews:"Preview outputs",summaryErrorPrefix:"Error",assignedWork:"Assigned work",autoAssigned:"Automatic / coordinator decides",noStepOutput:"No step output.",agentMessages:"Agent messages",noAgentMessages:"This agent has not produced a message yet. If the run failed, the real CLI error appears above.",outputs:"Outputs",noOutputs:"No change summary, preview, or command output yet.",open:"Open",artifact:{fileDiff:"Change summary",previewUrl:"Preview",commandOutput:"Command output",handoff:"Handoff artifact"},role:{user:"User",agent:"Agent"},status:{queued:"Queued",running:"Running",completed:"Completed",failed:"Failed",canceled:"Canceled",skipped:"Skipped"},nodes:{codex_review:"Codex review",gemini_review:"Gemini review",claude_review:"Claude review",claude_code_review:"Claude review",cursor_review:"Cursor review",aggregate:"Aggregate",architect:"Planning",implement:"Implementation",review:"Review",proposal:"Proposal",critique:"Critique",response:"Response",judge:"Decision",coordinator:"Coordinator",final_report:"Final report"},stages:{coordinator:"Coordinator",handoff:"Handoff",backend:"Backend",frontend:"Frontend",implementation:"Implementation",review:"Review",repair:"Repair",proposal:"Proposal",critique:"Critique",response:"Response",decision:"Decision",report:"Report",fallback:"Fallback",final_report:"Final report"},workflows:{multi_model_review:{name:"Multi-model review",description:"Enabled CLI agents review the same goal separately, then one enabled agent aggregates the result."},sequential_handoff:{name:"Sequential handoff",description:"Agents plan, implement, and review in order. Disabled CLI steps are skipped."},adversarial_debate:{name:"Decision debate",description:"Agents propose, critique, respond, and produce a final recommendation."},agent_team:{name:"Agent team",description:"A coordinator reads the goal and active CLI instances, assigns work, then collects the result."}},adapters:{"claude-code":{label:"Claude Code",role:"CLI worker"},cursor:{label:"Cursor",role:"CLI worker"},codex:{label:"Codex",role:"CLI worker"},gemini:{label:"Gemini",role:"CLI worker"},qwen:{label:"Qwen Code",role:"CLI worker"},opencode:{label:"OpenCode",role:"CLI worker"}},activeCount:"{{active}}/{{total}} active",teamHint:"Each row is one CLI worker. You can create multiple Claude, Codex, Cursor, Gemini, Qwen, or OpenCode workers and give each a different assignment.",parallelLimit:"Parallel limit",fallbackAgent:"Fallback CLI",noFallbackAgent:"No automatic fallback",fallbackAgentHint:"If a CLI step fails, Pixcode retries that step with this backup agent.",agentRole:"Stage",agentModel:"Model",agentRoles:{auto:"Auto",backend:"Backend",frontend:"Frontend",review:"Test / review",implementation:"Implementation",proposal:"Proposal",critique:"Critique",response:"Response",decision:"Decision / report",report:"Report",custom:"Custom"},customRolePlaceholder:"Example: Security, Mobile UX, DB architecture",roleHints:{default:"Leave empty and the coordinator assigns this agent from the goal.",agent_team:"Pick backend, frontend, or review stages, or leave agents on auto.",multi_model_review:"Enabled agents review; if a report role is selected, that agent aggregates the final summary.",sequential_handoff:"Agents run in your selected order; assignment text defines each step.",adversarial_debate:"Stage selection is optional in decision debate; if left empty, the system assigns selected agents to Proposal, Critique, and Response in order."},addAgent:"Add {{agent}}",soloAgent:"Run only with {{agent}}",soloAgentShort:"Solo",duplicateAgent:"Duplicate {{agent}}",removeAgent:"Remove {{agent}}",assignment:"Assignment",assignmentPlaceholder:"Optional: tell this worker exactly what to handle. Leave empty for coordinator assignment.",agentInstance:"{{name}} #{{number}}",taskTitle:"Task",taskTitlePlaceholder:"Implement feature",taskDescription:"Description",taskDescriptionPlaceholder:"Scope, constraints, expected output",addTask:"Add",runTask:"Run",cancelTask:"Cancel",dispatchTask:"Dispatch task",adapter:"Adapter",isolation:"Isolation",dispatch:"Dispatch",auto:"Auto",cliSettings:"CLI settings",waitingForStream:"Waiting for stream...",workflow:"Workflow",templates:"Templates",noTemplate:"No template",templateHint:"Pick a starter template to fill the workflow, agent roles, and acceptance criteria before launch.",input:"Input",taskStates:{todo:"To Do",in_progress:"In Progress",in_review:"In Review",done:"Done",failed:"Failed",canceled:"Canceled"},isolationKind:{worktree:"Worktree",host:"Host",docker:"Docker"},workspaceTarget:"Target workspace",workspaceTargets:{selectedProject:"Selected project",pixcodeApp:"Pixcode system",custom:"Custom path"},customWorkspacePlaceholder:"/path/to/project",workspaceTargetHint:"Agents will run in: {{path}}",autoDetect:"auto-detect",needWorkspacePath:"Enter a custom workspace path.",hermesTitle:"Hermes Agent",hermesSubtitle:"Hermes is running inside Pixcode for {{project}} and can coordinate local checks, tests, terminal work, and project operations.",hermesCliControl:"Hermes CLI control"},Gse={loading:"Loading files...",files:"Files",simpleView:"Simple view",compactView:"Compact view",detailedView:"Detailed view",searchPlaceholder:"Search files and folders...",clearSearch:"Clear search",name:"Name",size:"Size",modified:"Modified",permissions:"Permissions",noFilesFound:"No files found",checkProjectPath:"Check if the project path is accessible",noMatchesFound:"No matches found",tryDifferentSearch:"Try a different search term or clear the search",justNow:"just now",minAgo:"{{count}} min ago",hoursAgo:"{{count}} hours ago",daysAgo:"{{count}} days ago",newFile:"New File (Cmd+N)",newFolder:"New Folder (Cmd+Shift+N)",refresh:"Refresh",collapseAll:"Collapse All",context:{rename:"Rename",delete:"Delete",copyPath:"Copy Path",download:"Download",newFile:"New File",newFolder:"New Folder",refresh:"Refresh",menuLabel:"File context menu",loading:"Loading..."}},Vse={title:"Create New Project",steps:{type:"Type",configure:"Configure",confirm:"Confirm"},step1:{question:"Do you already have a workspace, or would you like to create a new one?",existing:{title:"Existing Workspace",description:"I already have a workspace on my server and just need to add it to the project list"},new:{title:"New Workspace",description:"Create a new workspace, optionally clone from a GitHub repository"},githubClone:{title:"Clone from GitHub",description:"Pick a target folder and clone a repository into it"},subfolder:{title:"Create Subfolder",description:"Pick a parent folder and create a fresh subfolder inside it"}},step2:{existingPath:"Workspace Path",newPath:"Workspace Path",subfolderParentPath:"Parent Folder",subfolderParentHelp:"Path to the folder where the new subfolder will be created",subfolderName:"Subfolder Name",subfolderNameHelp:"A new folder with this name will be created inside the parent above",existingPlaceholder:"/path/to/existing/workspace",newPlaceholder:"/path/to/new/workspace",existingHelp:"Full path to your existing workspace directory",newHelp:"Full path to your workspace directory",githubUrl:"GitHub URL (Optional)",githubPlaceholder:"https://github.com/username/repository",githubHelp:"Optional: provide a GitHub URL to clone a repository",githubAuth:"GitHub Authentication (Optional)",githubAuthHelp:"Only required for private repositories. Public repos can be cloned without authentication.",loadingTokens:"Loading stored tokens...",storedToken:"Stored Token",newToken:"New Token",nonePublic:"None (Public)",selectToken:"Select Token",selectTokenPlaceholder:"-- Select a token --",tokenPlaceholder:"ghp_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",tokenHelp:"This token will be used only for this operation",publicRepoInfo:"Public repositories don't require authentication. You can skip providing a token if cloning a public repo.",noTokensHelp:"No stored tokens available. You can add tokens in Settings → API Keys for easier reuse.",optionalTokenPublic:"GitHub Token (Optional for Public Repos)",tokenPublicPlaceholder:"ghp_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx (leave empty for public repos)"},step3:{reviewConfig:"Review Your Configuration",workspaceType:"Workspace Type:",existingWorkspace:"Existing Workspace",newWorkspace:"New Workspace",subfolderWorkspace:"New Subfolder",path:"Path:",parentPath:"Parent Path:",subfolderName:"Subfolder Name:",cloneFrom:"Clone From:",authentication:"Authentication:",usingStoredToken:"Using stored token:",usingProvidedToken:"Using provided token",noAuthentication:"No authentication",sshKey:"SSH Key",existingInfo:"The workspace will be added to your project list and will be available for Claude/Cursor sessions.",newWithClone:"The repository will be cloned from this folder.",newEmpty:"The workspace will be added to your project list and will be available for Claude/Cursor sessions.",subfolderInfo:"A new subfolder will be created inside the parent folder and added to your project list.",cloningRepository:"Cloning repository..."},buttons:{cancel:"Cancel",back:"Back",next:"Next",createProject:"Create Project",creating:"Creating...",cloning:"Cloning..."},errors:{selectType:"Please select whether you have an existing workspace or want to create a new one",providePath:"Please provide a workspace path",provideSubfolderName:"Please provide a name for the subfolder",subfolderNameInvalid:"Subfolder name cannot contain path separators or be . / ..",failedToCreate:"Failed to create workspace",failedToCreateFolder:"Failed to create folder"}},Wse={genericTool:"a tool",codes:{generic:{info:{title:"Notification"}},permission:{required:{title:"Action Required",body:"{{toolName}} is waiting for your decision."}},run:{stopped:{title:"Run Stopped",body:"Reason: {{reason}}"},failed:{title:"Run Failed"}},agent:{notification:{title:"Agent Notification"}}}},qse={title:"Update Available",newVersionReady:"A new version is ready",currentVersion:"Current Version",latestVersion:"Latest Version",latestRelease:"Latest Release",releaseNotesTitle:"Release Notes",releaseNotesSubtitle:"Latest Pixcode changes",whatsNew:"What's New:",viewFullRelease:"View full release",updateProgress:"Update Progress:",manualUpgrade:"Manual upgrade:",npmUpgradeCommand:"npm install -g @pixelbyte-software/pixcode@latest",pixcodeUpgradeCommand:"pixcode update --restart-daemon",manualUpgradeHint:'Or click "Update Now" to run the update automatically.',updateCompleted:"Update completed successfully!",restartServer:"Please restart the server to apply changes.",updateFailed:"Update failed",buttons:{close:"Close",later:"Later",copyCommand:"Copy Command",updateNow:"Update Now",updating:"Updating..."},ariaLabels:{closeModal:"Close version upgrade modal",showSidebar:"Show sidebar",settings:"Settings",updateAvailable:"Update available",closeSidebar:"Close sidebar"}},Kse={title:"Live View",subtitle:"Run this project locally and share it through the active secure tunnel when one is running.",start:"Start",restart:"Restart",stop:"Stop",runnerError:"Runner error",runnerUnavailable:"Runner unavailable",managedRuntimePreparing:"Pixcode will prepare the runtime",managedRuntimeDescription:"Press Start and Pixcode will prepare the required local runtime automatically.",preparingRuntime:"Preparing runtime…",preparingRuntimeDescription:"Pixcode is downloading and installing the runtime locally. This can take a moment on first use.",runnerErrorFallback:"The runner stopped before the preview became available.",detecting:"Detecting project runner…",noRunner:"No runner detected",staticHint:"Static HTML will be served directly when index.html exists.",customCommand:"Custom command",custom:"Custom",customPlaceholder:"npm run dev, python app.py, go run .",environment:"Environment",environmentLocalProcess:"Local process",environmentStatic:"Static files",environmentUnavailable:"Unavailable",statusLabel:"Status",framework:"Framework",command:"Command",upstream:"Upstream",publicTunnel:"Public tunnel",tunnelActive:"Tunnel active",tunnelLocalOnly:"Local only",diagnostics:"Diagnostics",viewport:"Viewport",viewportDesktop:"Desktop",viewportTablet:"Tablet",viewportMobile:"Mobile",viewportWidth:"Width",viewportHeight:"Height",controls:"Runner, viewport and logs",shareLink:"Share link",starting:"Starting",openExternal:"Open externally",externalActive:"Secure tunnel is active; this link can be shared outside your network.",localOnly:"External Access is off; this link is local to this Pixcode server.",frameTitle:"Project Live View",emptyTitle:"Start Live View",emptyDescription:"Pixcode will detect the project stack, start the local web server, and expose it here."},Yse={title:"Control room",subtitle:"Production, platform, admin, audit, and self-hosted access for {{target}}",thisServer:"this server",refresh:"Refresh",nav:{overview:"Overview",production:"Production",admin:"Admin",team:"Team",secrets:"Secrets",marketplace:"Marketplace",eval:"Evaluations",usage:"Usage",security:"Security",access:"Access"},overview:{title:"v1.46 launch surface",description:"Every box below is backed by a v1.44-v1.45 API and is now visible from the UI.",latestAuditEvents:"Latest audit events",remoteAccessOptions:"Remote access options"},metrics:{issueRuns:"Issue-to-PR runs",reviewItems:"Review items",subUsers:"Sub-users",collaborators:"Project collaborators",secrets:"Scoped secrets",marketplace:"Marketplace entries",evalRuns:"Evaluation runs",securityAudits:"Security audits"},sections:{production:{title:"Production loop",description:"Start issue-to-PR runs, parse CI failures, review changes, schedule background jobs, and create checkpoints."},admin:{title:"Admin system",description:"Create sub-users, disable accounts, and inspect activity for a single self-hosted Pixcode server."},team:{title:"Project collaborators",description:"Assign partners, workers, reviewers, and viewers per project without making everyone a global admin."},secrets:{title:"Secret vault",description:"Store scoped env secrets and preview what each provider, project, workflow, Telegram, or API run receives."},marketplace:{title:"MCP/plugin marketplace",description:"Register MCP servers, workflow templates, provider adapters, and notification channels with permission review and health."},eval:{title:"Evaluation harness",description:"Create regression suites and compare provider/model runs with pass rate and latency."},usage:{title:"Cost, token, and latency dashboard",description:"Monitor provider/model/workflow usage for demos and operations."},security:{title:"Security audit mode",description:"Run dependency audit, secret scan, permission audit, and agent output leak detection workflows."},access:{title:"Self-hosted access",description:"Use Tailscale when there is no fixed domain, or configure Cloudflare Tunnel/custom domain for a stable public URL."}},panels:{issueToPr:"Issue-to-PR run",ciRepair:"CI repair parser",reviewQueue:"Review queue",schedulerCheckpoints:"Scheduler and checkpoints",createSubUser:"Create sub-user",rolePermissions:"Role permissions",addCollaborator:"Add collaborator",createSecret:"Create secret",scopedEnvPreview:"Scoped env preview",addMarketplaceEntry:"Add marketplace entry",createSuite:"Create suite",recordRun:"Record run",recordUsageEvent:"Record usage event",createAuditRun:"Create audit run",auditLog:"Audit log",remoteAccessSetup:"Remote access setup"},lists:{recentJobs:"Recent jobs",recentCheckpoints:"Recent checkpoints",subUsers:"Sub-users",collaborators:"Collaborators",includedEnvNames:"Included env names",vaultEntries:"Vault entries",marketplaceEntries:"Marketplace entries",suites:"Suites",runs:"Runs",auditRuns:"Audit runs",configuredAccessPaths:"Configured access paths"},buttons:{queueRun:"Queue run",parseFailure:"Parse failure",createReviewItem:"Create review item",scheduleJob:"Schedule job",createCheckpoint:"Create checkpoint",createUser:"Create user",disable:"Disable",enable:"Enable",addCollaborator:"Add collaborator",storeSecret:"Store secret",previewEnv:"Preview env",saveEntry:"Save entry",markHealthy:"Mark healthy",createSuite:"Create suite",recordRun:"Record run",recordUsage:"Record usage",createAudit:"Create audit",exportJson:"Export JSON",exportCsv:"Export CSV",saveAccessPath:"Save access path",checkUrl:"Check URL",checkTailscale:"Check Tailscale"},placeholders:{githubIssueUrl:"GitHub issue URL",manualTitle:"Manual title fallback",model:"Model",baseBranch:"Base branch",ciLog:"Paste failing CI, lint, typecheck, or build output",reviewTitle:"Review title",notes:"Notes",changedFiles:"Changed files, one per line",jobName:"Job name",cronExpression:"Cron or watch expression",checkpointReason:"Checkpoint reason",backgroundPrompt:"Background agent prompt",checkpointFiles:"Checkpoint changed files, one per line",usernameEmail:"Username or email",temporaryPassword:"Temporary password",userEmailUsername:"User email or username",secretName:"Secret name",envName:"ENV_NAME",secretTarget:"Target project/provider/workflow",secretValue:"Secret value",workflowId:"Workflow id",name:"Name",pluginSource:"Source package or repository",installCommand:"Install command",permissionScopes:"Permission scopes, one per line",suiteName:"Suite name",description:"Description",firstTaskTitle:"First task title",acceptanceCriteria:"Acceptance criteria, one per line",suiteId:"Suite id",latencyMs:"Latency ms",passedCount:"Passed count",failedCount:"Failed count",workflow:"Workflow",inputTokens:"Input tokens",outputTokens:"Output tokens",costUsd:"Cost USD",optionalFindingTitle:"Optional finding title",auditFilter:"Filter audit log by user, project, event, or file",label:"Label",url:"URL",targetPort:"Target port"},labels:{project:"project",path:"path",providerModel:"provider/model",branch:"branch",failedCommands:"Failed commands",files:"Files",lastActive:"Last active",role:"role",tasks:"tasks",pass:"pass",health:"Health",reachable:"reachable",installed:"installed",loggedIn:"logged in"},columns:{provider:"Provider",model:"Model",workflow:"Workflow",runs:"Runs",tokens:"Tokens",cost:"Cost",latency:"Latency",errorRate:"Error rate"},fallback:{selectedProject:"selected project",projectPath:"project path",noneDetected:"none detected",noUrl:"No URL",global:"global",noSource:"No source",regressionSuite:"Regression suite",demoTask:"Demo task",provider:"provider",reviewRequired:"Review required.",notAvailable:"not available"},capabilities:{partner:"can approve actions, manage secrets, and use shell",projectScoped:"project-scoped access only"},teamAccess:{title:"How collaborators get access",stepUsers:"Create a sub-user",stepUsersDescription:"Create the person in Admin system with a global role such as member, viewer, project_worker, or project_partner.",stepRole:"Assign project role",stepRoleDescription:"Add the same user as a project collaborator so they only see and operate on the projects you choose.",stepLink:"Share an access path",stepLinkDescription:"Give them the Tailscale, Cloudflare Tunnel, custom domain, or LAN URL configured in Self-hosted access.",paths:"Available access links"},badges:{public:"public",private:"private"},empty:{noAuditEvents:"No audit events yet.",noRemoteAccessConfigs:"No remote access configs yet.",noReviewItems:"No review items yet.",noRecentJobs:"No recent jobs yet.",noRecentCheckpoints:"No recent checkpoints yet.",noSubUsers:"No sub-users yet.",noCollaborators:"No project collaborators yet.",noAccessPaths:"No access paths configured yet.",noIncludedEnvNames:"No included env names yet.",noSecrets:"No secrets yet.",noMarketplaceEntries:"No marketplace entries yet.",noSuites:"No suites yet.",noRuns:"No runs yet.",usageSummary:"Usage appears here after provider or workflow events are recorded.",noSecurityAudits:"No security audits yet.",noAuditMatches:"No audit entries match the current filter."}},Zse={title:"VS Code Workbench",noProject:"No project selected",activity:{explorer:"Explorer",projects:"Projects",sourceControl:"Source Control",terminal:"Terminal",hermes:"Hermes Agent",showPanel:"Show left panel",hidePanel:"Hide left panel"},panels:{explorer:"Explorer",projects:"Projects",sourceControl:"Source Control",terminal:"Terminal",hermes:"Hermes Agent",editor:"Editor",cli:"CLI",rightTerminal:"Terminal"},editor:{emptyTitle:"Open a file from Explorer",closeTab:"Close {{file}}",scrollLeft:"Scroll tabs left",scrollRight:"Scroll tabs right",moreActions:"More tab actions",closeSplit:"Close split editor",context:{close:"Close",closeAll:"Close All",copyPath:"Copy Path",splitRight:"Split Right",splitMoveRight:"Split and Move Right"}},resize:{left:"Resize left panel",right:"Resize CLI panel"},menu:{openProject:"Open Project...",cloneFromGithub:"Clone Repository...",newChat:"New Chat",openProjects:"Open Projects"},projects:{openProject:"Open Project",cloneFromGithub:"Clone",directoryList:"Directories",refresh:"Refresh projects",emptyTitle:"No project directories yet",emptyDescription:"Open a local folder or clone a repository to start.",selected:"Selected",startChat:"Chat",fileCount:"{{formattedCount}} files",fileCountPending:"Files pending",startTitle:"Start a Pixcode workspace",startDescription:"Pick a folder and Pixcode will bind the explorer, terminal, and chat history to that workspace.",workHere:"Work in this folder"},workspace:{empty:"Open a project to create Workspace 1.",openFirst:"Open a workspace",add:"Add workspace",scrollLeft:"Scroll workspaces left",scrollRight:"Scroll workspaces right",close:"Close {{name}}",closeAction:"Close workspace",closeOthers:"Close others",closeAll:"Close all",rename:"Rename",star:"Star",unstar:"Unstar",toggleStar:"Star {{name}}",moreActions:"Workspace actions"},cli:{projectScoped:"Project-scoped CLI terminal",chooseTitle:"Start a CLI terminal",chooseDescription:"Choose a CLI, then start a full-height terminal.",startSelected:"Start {{provider}}",newSession:"New CLI session",plainTerminal:"Terminal",newPlainTerminal:"New terminal",history:"History",noHistory:"No sessions for this project yet.",projectHistory:"Project history",checking:"Checking...",ready:"Ready",notInstalled:"Not installed",installing:"Installing...",updateAvailable:"Update {{version}}",installProvider:"Install {{provider}}",updateProvider:"Update {{provider}}",manualInstall:"This CLI needs manual installation.",installNoJob:"Install did not return a job id.",installFailed:"Install failed.",installStreamLost:"Install stream closed early. The install may still be running.",provider:"Provider",installRunning:"is installing",installDone:"is ready",installError:"needs attention",showPanel:"Show CLI panel",hidePanel:"Hide CLI panel",close:"Close terminal"},terminal:{title:"Terminal",close:"Close terminal"},hermes:{title:"Hermes Agent",installTitle:"Install Hermes Agent",description:"Project-scoped agent terminal. Installs Hermes when missing, then opens it in this workspace.",start:"Start Hermes",install:"Install",newSession:"New Hermes session",history:"Hermes history",connect:"Connect Hermes Agent",ready:"Ready",installRunning:"Installing Hermes through Pixcode API...",installDone:"Hermes installed and Pixcode MCP configured.",installError:"Hermes install failed.",installReady:"Ready to install Hermes.",installWaiting:"Waiting for Hermes install logs...",retryInstall:"Retry install",installFailed:"Hermes install failed.",installStreamLost:"Hermes install stream closed early. The install may still be running.",controlPlaneFailed:"Unable to read Hermes control plane.",controlPlaneRepairFailed:"Unable to repair Hermes control plane.",controlReady:"Control ready",needsRepair:"Needs repair",unknown:"Unknown",refreshControl:"Refresh Hermes control plane",installState:"Install",restGateway:"REST",mcpTools:"MCP tools",mcpMissing:"{{count}} missing",sessions:"Sessions",cronSummary:"{{count}}/{{total}} cron active",profile:"Profile",authReady:"Auth ready",authMissing:"Auth missing",modelNotSelected:"No model selected",modelSettings:"Hermes model",cronJobs:"Hermes cron",deepStatus:"Hermes status",repairControl:"Repair control",capabilities:"Capabilities",recentSessions:"Recent sessions",recommendations:"Recommendations"}},Xse={buttons:Lse,tabs:Dse,status:Ose,messages:Mse,navigation:Fse,common:zse,time:Bse,fileOperations:Use,mainContent:$se,orchestration:Hse,fileTree:Gse,projectWizard:Vse,notifications:Wse,versionUpdate:qse,liveView:Kse,controlRoom:Yse,vscodeWorkbench:Zse},Jse="Settings",Qse={account:"Account",permissions:"Permissions",mcpServers:"MCP Servers",pluginsMcp:"Plugins / MCP",configuration:"Configuration",appearance:"Appearance"},eoe={title:"Account",language:"Language",languageLabel:"Display Language",languageDescription:"Choose your preferred language for the interface",username:"Username",email:"Email",profile:"Profile",changePassword:"Change Password"},toe={title:"MCP Servers",addServer:"Add Server",editServer:"Edit Server",deleteServer:"Delete Server",serverName:"Server Name",serverType:"Server Type",config:"Configuration",testConnection:"Test Connection",status:"Status",connected:"Connected",disconnected:"Disconnected",scope:{label:"Scope",user:"User",project:"Project"}},roe={title:"Appearance",theme:"Theme",codeEditor:"Code Editor",editorTheme:"Editor Theme",wordWrap:"Word Wrap",showMinimap:"Show Minimap",lineNumbers:"Line Numbers",fontSize:"Font Size"},noe={saveChanges:"Save Changes",resetToDefaults:"Reset to Defaults",cancelChanges:"Cancel Changes"},aoe={title:"Quick Settings",sections:{appearance:"Appearance",toolDisplay:"Tool Display",viewOptions:"View Options",agentDiff:"Agent diff",inputSettings:"Input Settings",changeAwareness:"Command Center"},darkMode:"Dark Mode",autoExpandTools:"Auto-expand tools",showRawParameters:"Show raw parameters",showThinking:"Show thinking",autoScrollToBottom:"Auto-scroll to bottom",sendByCtrlEnter:"Send by Ctrl+Enter",sendByCtrlEnterDescription:"When enabled, pressing Ctrl+Enter will send the message instead of just Enter. This is useful for IME users to avoid accidental sends.",autoShowAgentDiff:"Show agent edits as diff",autoShowAgentDiffOff:"Off",autoShowAgentDiffOpenOnly:"Open files",autoShowAgentDiffAlways:"Always",changeAwareness:"Command Center",changedFiles:{title:"Changed files",description:"Tracks local file changes and opens the Files panel when a new change appears.",noProject:"Select a project to track local changes.",refresh:"Refresh changed files",empty:"No local changes detected",disabled:"Enable Command Center to watch local changes.",more:"+{{count}} more files",lastChecked:"Checked {{value}}",guideTitle:"Right panel guide",guideFiles:"Changed files glow green in Files.",guidePanel:"New changes appear beside the active chat.",status:{M:"M",A:"A",D:"D",U:"U"}},dragHandle:{dragging:"Dragging handle",closePanel:"Close settings panel",openPanel:"Open settings panel",draggingStatus:"Dragging...",toggleAndMove:"Click to toggle, drag to move"}},ioe={title:"Terminal Shortcuts",sectionKeys:"Keys",sectionNavigation:"Navigation",escape:"Escape",tab:"Tab",shiftTab:"Shift+Tab",arrowUp:"Arrow Up",arrowDown:"Arrow Down",scrollDown:"Scroll Down",handle:{closePanel:"Close shortcuts panel",openPanel:"Open shortcuts panel"}},soe={label:"Settings",agents:"Agents",hermes:"Hermes Agent",appearance:"Appearance",git:"Git",apiTokens:"API & Tokens",notifications:"Notifications",plugins:"Plugins",mobile:"Use from Mobile",telegram:"Telegram",diagnostics:"Diagnostics",about:"About",access:"Access"},ooe={title:"Use from Mobile",description:"Scan a QR code with your phone to open Pixcode on any device in the same network.",refresh:"Refresh",copy:"Copy",copied:"Copied!",loading:"Detecting network addresses…",noEndpoints:"No LAN addresses were detected. Make sure your device is connected to a network.",error:"Could not load network endpoints.",hostLabel:"Host",portLabel:"Port",steps:{sameNetwork:"Connect your phone to the same Wi-Fi network as this computer.",scan:"Open the camera app and scan one of the QR codes below.",login:"Sign in with your Pixcode credentials the first time."},external:{title:"External Access",description:"Expose Pixcode beyond your local network so you can reach it from the internet.",upnpTitle:"Router port mapping (UPnP)",upnpDescription:"One-click port forwarding via your router. Works on most home routers; fails silently on CGNAT or enterprise networks.",upnpEnable:"Enable UPnP",upnpDisable:"Disable UPnP",upnpEnabled:"UPnP mapping active",upnpUnsupported:"UPnP is not available on this network.",tunnelTitle:"Secure tunnel",tunnelDescription:"If UPnP is unavailable, install cloudflared or ngrok and start a tunnel — we'll auto-detect and show the QR here.",tunnelStart:"Start tunnel",tunnelStop:"Stop tunnel",tunnelRunning:"Tunnel running",tunnelUnavailable:"No tunnel binary found on this machine.",externalUrl:"External URL"}},loe={title:"Telegram",description:"Receive task completion notifications and chat with your agents from Telegram.",comingSoon:"Telegram integration is being prepared.",botToken:"Bot Token",botTokenPlaceholder:"123456:ABC-DEF…",botTokenHelp:"Create a bot with @BotFather and paste the token here.",saveToken:"Save & Start Bot",saving:"Saving…",botRunning:"Bot running as @{{username}}",botStopped:"Bot stopped",stopBot:"Stop Bot",removeToken:"Remove Token",pairing:{title:"Pair with your Telegram account",description:"Message your bot, then enter this 6-digit code inside the chat. The code refreshes every 10 minutes.",code:"Pairing Code",regenerate:"Generate new code",verified:"Paired with Telegram account",notPaired:"No Telegram account paired yet."},linkedAccount:{title:"Paired Account",username:"@{{username}}",language:"Replies in {{language}}",unpair:"Unpair"},notifications:{title:"Notifications",description:"Send agent completion and error events to your Telegram chat.",enabled:"Enabled",disabled:"Disabled"},bridge:{title:"Chat Bridge",description:"Messages you send to the bot become prompts for your most recent session. Replies come back to Telegram.",enabled:"Enabled",disabled:"Disabled"},control:{title:"Remote Control",description:"Use Telegram as a full Pixcode control surface for agents, orchestration, provider setup, and run status.",enabled:"Enable Telegram control",enabledDescription:"When enabled, paired Telegram messages can start agent and orchestration work on the selected project.",progressMode:"Progress mode",progressModeDescription:"Choose how much run output Telegram should send back.",progressModes:{final:"Final answer only",steps:"Important steps and final answer",all:"All visible step changes"},selectedProject:"Selected project",selectedProvider:"Selected provider",selectedModel:"Selected model",selectedWorkflow:"Selected workflow"},errors:{invalidToken:"Telegram rejected this bot token.",networkError:"Could not reach Telegram servers."}},coe={title:"Notifications",description:"Control which notification events you receive.",webPush:{title:"Web Push Notifications",enable:"Enable Push Notifications",disable:"Disable Push Notifications",enabled:"Push notifications are enabled",loading:"Updating...",unsupported:"Push notifications are not supported in this browser.",denied:"Push notifications are blocked. Please allow them in your browser settings."},events:{title:"Event Types",actionRequired:"Action required",stop:"Run stopped",error:"Run failed",updates:"App and CLI updates"}},doe={darkMode:{label:"Dark Mode",description:"Toggle between light and dark themes"},colorTheme:{title:"Color theme",palette:{label:"Accent palette",description:"Choose the product accent used by buttons, focus rings, navigation, and active states."},custom:{label:"Custom light/dark colors",description:"Pick separate accent colors for light and dark mode. Select Custom above to use them.",light:"Light",dark:"Dark"}},projectSorting:{label:"Project Sorting",description:"How projects are ordered in the sidebar",alphabetical:"Alphabetical",recentActivity:"Recent Activity"},codeEditor:{title:"Code Editor",theme:{label:"Editor Theme",description:"Default theme for the code editor"},wordWrap:{label:"Word Wrap",description:"Enable word wrapping by default in the editor"},showMinimap:{label:"Show Minimap",description:"Display a minimap for easier navigation in diff view"},lineNumbers:{label:"Show Line Numbers",description:"Display line numbers in the editor"},fontSize:{label:"Font Size",description:"Editor font size in pixels"}}},uoe={title:{add:"Add MCP Server",edit:"Edit MCP Server"},importMode:{form:"Form Input",json:"JSON Import"},scope:{label:"Scope",userGlobal:"User (Global)",projectLocal:"Project (Local)",userDescription:"User scope: Available across all projects on your machine",projectDescription:"Local scope: Only available in the selected project",cannotChange:"Scope cannot be changed when editing an existing server"},fields:{serverName:"Server Name",transportType:"Transport Type",command:"Command",arguments:"Arguments (one per line)",jsonConfig:"JSON Configuration",url:"URL",envVars:"Environment Variables (KEY=value, one per line)",headers:"Headers (KEY=value, one per line)",selectProject:"Select a project..."},placeholders:{serverName:"my-server"},validation:{missingType:"Missing required field: type",stdioRequiresCommand:"stdio type requires a command field",httpRequiresUrl:"{{type}} type requires a url field",invalidJson:"Invalid JSON format",jsonHelp:"Paste your MCP server configuration in JSON format. Example formats:",jsonExampleStdio:'• stdio: {"type":"stdio","command":"npx","args":["@upstash/context7-mcp"]}',jsonExampleHttp:'• http/sse: {"type":"http","url":"https://api.example.com/mcp"}'},configDetails:"Configuration Details (from {{configFile}})",projectPath:"Path: {{path}}",actions:{cancel:"Cancel",saving:"Saving...",addServer:"Add Server",updateServer:"Update Server"}},poe={success:"Settings saved successfully!",error:"Failed to save settings",saving:"Saving..."},moe={save:"Save Settings",cancel:"Cancel"},hoe={title:"Git Configuration",description:"Configure your git identity for commits. These settings will be applied globally via git config --global",name:{label:"Git Name",help:"Your name for git commits"},email:{label:"Git Email",help:"Your email for git commits"},actions:{save:"Save Configuration",saving:"Saving..."},status:{success:"Saved successfully"}},foe={title:"API Keys",description:"Generate API keys to access the external API from other applications.",newKey:{alertTitle:"⚠️ Save Your API Key",alertMessage:"This is the only time you'll see this key. Store it securely.",iveSavedIt:"I've saved it"},form:{placeholder:"API Key Name (e.g., Production Server)",createButton:"Create",cancelButton:"Cancel"},newButton:"New API Key",empty:"No API keys created yet.",list:{created:"Created:",lastUsed:"Last used:"},confirmDelete:"Are you sure you want to delete this API key?",status:{active:"Active",inactive:"Inactive"},github:{title:"GitHub Tokens",description:"Add GitHub Personal Access Tokens to clone private repositories via the external API.",descriptionAlt:"Add GitHub Personal Access Tokens to clone private repositories. You can also pass tokens directly in API requests without storing them.",addButton:"Add Token",form:{namePlaceholder:"Token Name (e.g., Personal Repos)",tokenPlaceholder:"GitHub Personal Access Token (ghp_...)",descriptionPlaceholder:"Description (optional)",addButton:"Add Token",cancelButton:"Cancel",howToCreate:"How to create a GitHub Personal Access Token →"},empty:"No GitHub tokens added yet.",added:"Added:",confirmDelete:"Are you sure you want to delete this GitHub token?"},apiDocsLink:"API Documentation",documentation:{title:"External API Documentation",description:"Learn how to use the external API to trigger Claude/Cursor sessions from your applications.",viewLink:"View API Documentation →"},loading:"Loading...",version:{updateAvailable:"Update available: v{{version}}"}},goe={status:{title:"CLI status",notChecked:"Not checked yet",lastChecked:"Last checked: {{value}}",updatesFound:"{{count}} update available",refresh:"Refresh CLI status"},config:{blurb:"View or edit the files the {{name}} CLI reads on startup. Saves write directly to your home directory.",refresh:"Refresh",save:"Save",revert:"Revert",saved:"Saved",loading:"Loading…",notCreated:"new",readonly:"read-only",noFiles:"No config files are registered for this agent yet."},cliVersion:{title:"CLI version",installed:"Installed: {{version}}",unknownInstalled:"Installed version unknown",latest:"Latest: {{version}}",checkedAt:"Checked: {{value}}",cached:"cached",updateAvailable:"Update available",refresh:"Refresh",skipped:{external_installer:"External installer",installed_version_unavailable:"Installed version unavailable",latest_version_unavailable:"Latest version unavailable",not_installed:"Not installed"}},authStatus:{checking:"Checking...",connected:"Connected",notConnected:"Not connected",disconnected:"Disconnected",checkingAuth:"Checking authentication status...",loggedInAs:"Logged in as {{email}}",authenticatedUser:"authenticated user"},account:{claude:{description:"Anthropic Claude AI assistant"},cursor:{description:"Cursor AI-powered code editor"},codex:{description:"OpenAI Codex AI assistant"},gemini:{description:"Google Gemini AI assistant"},qwen:{description:"Alibaba Qwen Code CLI (Gemini CLI fork)"},opencode:{description:"Multi-provider terminal coding agent — Claude, OpenAI, Gemini, or local models"}},connectionStatus:"Connection Status",login:{title:"Login",reAuthenticate:"Re-authenticate",description:"Sign in to your {{agent}} account to enable AI features",reAuthDescription:"Sign in with a different account or refresh credentials",button:"Login",reLoginButton:"Re-login"},error:"Error: {{error}}"},boe={title:"Permission Settings",skipPermissions:{label:"Skip permission prompts (use with caution)",claudeDescription:"Equivalent to --dangerously-skip-permissions flag",cursorDescription:"Equivalent to -f flag in Cursor CLI",opencodeDescription:"Equivalent to --dangerously-skip-permissions flag in OpenCode"},allowedTools:{title:"Allowed Tools",description:"Tools that are automatically allowed without prompting for permission",placeholder:'e.g., "Bash(git log:*)" or "Write"',quickAdd:"Quick add common tools:",empty:"No allowed tools configured"},blockedTools:{title:"Blocked Tools",description:"Tools that are automatically blocked without prompting for permission",placeholder:'e.g., "Bash(rm:*)"',empty:"No blocked tools configured"},allowedCommands:{title:"Allowed Shell Commands",description:"Shell commands that are automatically allowed without prompting",placeholder:'e.g., "Shell(ls)" or "Shell(git status)"',quickAdd:"Quick add common commands:",empty:"No allowed commands configured"},blockedCommands:{title:"Blocked Shell Commands",description:"Shell commands that are automatically blocked",placeholder:'e.g., "Shell(rm -rf)" or "Shell(sudo)"',empty:"No blocked commands configured"},toolExamples:{title:"Tool Pattern Examples:",bashGitLog:"- Allow all git log commands",bashGitDiff:"- Allow all git diff commands",write:"- Allow all Write tool usage",bashRm:"- Block all rm commands (dangerous)"},shellExamples:{title:"Shell Command Examples:",ls:"- Allow ls command",gitStatus:"- Allow git status",npmInstall:"- Allow npm install",rmRf:"- Block recursive delete"},opencodeAllowed:{title:"Allowed Bash Patterns",description:"Bash command patterns OpenCode auto-approves without prompting",placeholder:'e.g., "git *" or "npm test"',quickAdd:"Quick add common patterns:",empty:"No allowed patterns configured"},opencodeBlocked:{title:"Blocked Bash Patterns",description:"Bash command patterns OpenCode always denies",placeholder:'e.g., "rm -rf *" or "sudo *"',empty:"No blocked patterns configured"},opencodeExamples:{title:"Pattern Examples:",gitAll:"- Allow all git commands",gitPush:"- Block git push specifically",rmRf:"- Block recursive delete",npm:"- Allow all npm commands"},codex:{permissionMode:"Permission Mode",description:"Controls how Codex handles file modifications and command execution",modes:{default:{title:"Default",description:"Only trusted commands (ls, cat, grep, git status, etc.) run automatically. Other commands are skipped. Can write to workspace."},acceptEdits:{title:"Accept Edits",description:"All commands run automatically within the workspace. Full auto mode with sandboxed execution."},bypassPermissions:{title:"Bypass Permissions",description:"Full system access with no restrictions. All commands run automatically with full disk and network access. Use with caution."}},technicalDetails:"Technical details",technicalInfo:{default:"sandboxMode=workspace-write, approvalPolicy=untrusted. Trusted commands: cat, cd, grep, head, ls, pwd, tail, git status/log/diff/show, find (without -exec), etc.",acceptEdits:"sandboxMode=workspace-write, approvalPolicy=never. All commands auto-execute within project directory.",bypassPermissions:"sandboxMode=danger-full-access, approvalPolicy=never. Full system access, use only in trusted environments.",overrideNote:"You can override this per-session using the mode button in the chat interface."}},actions:{add:"Add"}},xoe={title:"MCP Servers",description:{claude:"Model Context Protocol servers provide additional tools and data sources to Claude",cursor:"Model Context Protocol servers provide additional tools and data sources to Cursor",codex:"Model Context Protocol servers provide additional tools and data sources to Codex"},addButton:"Add MCP Server",empty:"No MCP servers configured",serverType:"Type",scope:{local:"local",user:"user"},config:{command:"Command",url:"URL",args:"Args",environment:"Environment"},tools:{title:"Tools",count:"({{count}}):",more:"+{{count}} more"},actions:{edit:"Edit server",delete:"Delete server"},help:{title:"About Codex MCP",description:"Codex supports stdio-based MCP servers. You can add servers that extend Codex's capabilities with additional tools and resources."}},yoe={updateCheckFrequency:"Update check frequency",updateCheckFrequencyHint:"Pixcode caches GitHub release checks locally so shared IPs do not hit GitHub rate limits.",updateCheckFrequencyOptions:{"30m":"Every 30 minutes","6h":"Every 6 hours","12h":"Every 12 hours","24h":"Daily","7d":"Weekly",off:"Manual only"},checkForUpdate:"Check for updates",checkingForUpdate:"Checking...",updateFound:"Update found",upToDate:"Up to date",lastChecked:"Last checked {{when}}",notCheckedYet:"Update check has not completed yet",checkFailed:"check failed or delayed by rate limit"},voe={title:"Plugins",description:"Extend the interface with custom plugins. Install from git or drop a folder in ~/.pixcode/plugins/",installPlaceholder:"https://github.com/user/my-plugin",installButton:"Install",installing:"Installing…",securityWarning:"Only install plugins whose source code you have reviewed or from authors you trust.",scanningPlugins:"Scanning plugins…",noPluginsInstalled:"No plugins installed",pullLatest:"Pull latest from git",noGitRemote:"No git remote — update not available",uninstallPlugin:"Uninstall plugin",confirmUninstall:"Click again to confirm",confirmUninstallMessage:"Remove {{name}}? This cannot be undone.",cancel:"Cancel",remove:"Remove",updateFailed:"Update failed",installFailed:"Installation failed",uninstallFailed:"Uninstall failed",toggleFailed:"Toggle failed",starterPluginLabel:"Starter Plugin",starter:"Starter",docs:"Docs",starterPlugin:{name:"Project Stats",badge:"starter",description:"File counts, lines of code, file-type breakdown, and recent activity for your project.",install:"Install"},terminalPlugin:{name:"Terminal",badge:"official",description:"Integrated terminal with full shell access directly within the interface.",install:"Install"},morePlugins:"More",enable:"Enable",disable:"Disable",installAriaLabel:"Plugin git repository URL",tab:"tab",runningStatus:"running"},woe={title:"Access",description:"Choose how people reach this self-hosted Pixcode server. Start with the same network, then use a secure tunnel, Tailscale, or your own domain when you need remote access.",refresh:"Refresh",copy:"Copy",copied:"Copied",save:"Save access path",check:"Check URL",qrAlt:"QR for {{url}}",guide:{title:"Pick the connection path first",description:"You do not need to know networking terms. Choose the situation that matches the person connecting, copy the shown link, or scan the QR code from their phone."},options:{sameNetwork:{title:"Same Wi-Fi/LAN",description:"Use this when the device is on the same router or office network as the Pixcode server."},secureTunnel:{title:"Temporary public link",description:"Start a Cloudflare/ngrok tunnel and Pixcode shows a public URL plus QR automatically."},tailscale:{title:"Private team link",description:"Use Tailscale when you want private access without a public domain or router setup."},customDomain:{title:"Own domain",description:"Use this when you already have HTTPS, a reverse proxy, or a Cloudflare Tunnel hostname."}},status:{ready:"Ready",detecting:"Detecting",guided:"Guided",configured:"Configured",optional:"Optional"},links:{title:"Available links",description:"Copy the correct URL for the device or teammate that needs to connect.",local:"Local",tailscale:"Tailscale private link",empty:"No access links detected yet."},local:{title:"Same network access",description:"Best first test: connect from the same Wi-Fi or LAN. Scan a QR code on the phone, or copy the link for a teammate on the same network.",thisDevice:"This computer only",loading:"Detecting same-network links...",empty:"No LAN link detected. Make sure the server is connected to a network and refresh.",saveLabel:"Same network access",save:"Save this LAN link"},tunnel:{title:"Secure tunnel",description:"For remote access without a fixed domain, Pixcode can start cloudflared or ngrok and show the public URL here.",secureLink:"Public link and QR",help:"Click start. If cloudflared or ngrok is installed, Pixcode creates a temporary HTTPS address and QR code automatically.",running:"Tunnel running",start:"Start tunnel",stop:"Stop tunnel",save:"Save this tunnel URL",saveLabel:"Secure tunnel access",qrLabel:"secure tunnel",installTitle:"Tunnel setup needed",installNeeded:"Install cloudflared or ngrok first, then press Start tunnel again."},tailscale:{title:"Tailscale private access",description:"Tailscale is an optional private network app. Install it on the server and user devices, sign in to the same team, then Pixcode can detect a private URL.",save:"Save this Tailscale URL",saveLabel:"Tailscale private access",openInstall:"Open Tailscale install",steps:{installServer:"Install Tailscale on the computer or server running Pixcode.",installUserDevice:"Install Tailscale on the phone, laptop, or teammate device that will open Pixcode.",login:"Sign in to the same Tailscale account or team on both devices.",refresh:"Return here and press Refresh; Pixcode will show the private URL when it is ready."}},advanced:{title:"Advanced: stable domain",description:"Use this when you already have a LAN URL, Tailscale URL, Cloudflare Tunnel hostname, or custom HTTPS domain that should be saved for users.",badge:"Advanced"},setup:{title:"Stable access path",description:"Save the URL your users will use. This can be a LAN address, Tailscale URL, Cloudflare Tunnel URL, or custom domain."},modes:{lan:"LAN",tailscale:"Tailscale",cloudflare_tunnel:"Cloudflare Tunnel",custom_domain:"Custom domain"},fields:{label:"Label",url:"URL",port:"Target port"},health:{reachable:"Pixcode is reachable",unreachable:"Pixcode is not reachable"},configured:{title:"Configured access paths",description:"These paths are available to admins, project partners, and project workers according to their role.",empty:"No configured access paths yet.",noUrl:"No URL",public:"public",private:"private"},team:{title:"How users connect",description:"Create the user in the Admin system, assign their project role in Control Room, then share one of these Access URLs. They do not need to be global admins to reach their assigned project."}},koe={title:"Hermes Agent",description:"Manage Hermes Agent as a Pixcode-controlled project terminal with MCP access to projects, provider status, and visible CLI launches.",statusTitle:"Install status",statusFailed:"Unable to check Hermes Agent.",ready:"Ready",notInstalled:"Not installed",start:"Start Hermes",install:"Install",repair:"Repair command",refresh:"Refresh",controlPlaneTitle:"Hermes control plane",controlPlaneDescription:"A desktop-style control layer for Hermes profiles, REST gateway, Pixcode MCP tools, sessions, cron jobs, and visible CLI control.",controlPlaneFailed:"Unable to read Hermes control plane.",controlPlaneRepairFailed:"Unable to repair Hermes control plane.",controlPlaneRepair:"Repair wiring",controlPlaneProfiles:"Profiles",controlPlaneMcp:"MCP",controlPlaneMcpMissing:"{{count}} missing",controlPlaneSessions:"Sessions",controlPlaneSessionHint:"Hermes state.db history",controlPlaneCron:"Cron",controlPlaneCronActive:"{{count}} active",gatewayTitle:"REST API gateway",gatewayStatusFailed:"Unable to check Hermes REST gateway.",gatewayStartFailed:"Hermes REST gateway could not be started.",gatewayStopFailed:"Hermes REST gateway could not be stopped.",gatewayProbeFailed:"Hermes REST probe failed.",gatewayRunning:"REST gateway running",gatewayStopped:"REST gateway stopped",gatewayStart:"Start REST",gatewayProbe:"Test REST",gatewayStop:"Stop",gatewayProbeOk:"REST probe passed: health, capabilities, models, and a real prompt responded.",commandsTitle:"Hermes CLI settings",commandsDescription:"Open the real Hermes terminal wizards from Pixcode. Use Model and provider to connect Codex, OpenRouter, Anthropic, Gemini, and other providers.",commandsInstallFirst:"Install Hermes before opening CLI settings.",commands:{cron:{title:"Cron jobs",description:"Inspect the scheduler, list jobs, and confirm recurring project tasks can run through the Hermes gateway."},mcp:{title:"MCP servers",description:"Manage MCP servers and reload Pixcode MCP when tool configuration changes."},update:{title:"Update Hermes",description:"Pull the latest Hermes fixes and reinstall dependencies without interactive prompts."}},pixcodeControlTitle:"Pixcode control",pixcodeControlDescription:"Pixcode configures the Hermes MCP server before launch, so Hermes can inspect workspaces and open provider terminals inside the visible Pixcode UI when you ask it to.",diagnosticsTitle:"Integration diagnostics",diagnosticsDescription:"Checks Hermes model/auth, native toolsets, Pixcode MCP tools, REST gateway, and cron API wiring without exposing secrets.",diagnosticsFailed:"Unable to read Hermes diagnostics.",diagnosticsModel:"Model",diagnosticsTools:"Tools",diagnosticsCron:"Cron",diagnosticsIssues:"Issues",diagnosticsAuthReady:"Provider auth is present.",diagnosticsAuthMissing:"Provider auth needs attention.",diagnosticsMcpTools:"Pixcode MCP: {{count}} tools, {{missing}} missing",diagnosticsCronReady:"Hermes cron toolset is available.",diagnosticsCronMissing:"Hermes cron needs hermes-cli toolset.",diagnosticsCronApiReady:"Gateway /api/jobs responded.",diagnosticsCronApiFailed:"Gateway /api/jobs did not respond.",diagnosticsNoIssues:"No blocking issue detected.",diagnosticsIssueCount:"{{count}} issue(s) detected.",unknown:"Unknown"},Soe={title:Jse,tabs:Qse,account:eoe,mcp:toe,appearance:roe,actions:noe,quickSettings:aoe,terminalShortcuts:ioe,mainTabs:soe,mobile:ooe,telegram:loe,notifications:coe,appearanceSettings:doe,mcpForm:uoe,saveStatus:poe,footerActions:moe,git:hoe,apiKeys:foe,agents:goe,permissions:boe,mcpServers:xoe,about:yoe,pluginSettings:voe,access:woe,hermes:koe},Coe={title:"Welcome Back",description:"Sign in to your Pixcode self-hosted account",username:"Username",password:"Password",submit:"Sign In",loading:"Signing in...",errors:{invalidCredentials:"Invalid username or password",requiredFields:"Please fill in all fields",networkError:"Network error. Please try again."},placeholders:{username:"Enter your username",password:"Enter your password"}},Noe={title:"Create Account",username:"Username",password:"Password",confirmPassword:"Confirm Password",submit:"Create Account",loading:"Creating account...",errors:{passwordMismatch:"Passwords do not match",usernameTaken:"Username is already taken",weakPassword:"Password is too weak"}},Eoe={title:"Sign Out",confirm:"Are you sure you want to sign out?",button:"Sign Out"},Toe={login:Coe,register:Noe,logout:Eoe},Aoe={title:"Projects",newProject:"New Project",deleteProject:"Remove Project",renameProject:"Rename Project",noProjects:"No projects found",loadingProjects:"Loading projects...",searchPlaceholder:"Search projects...",projectNamePlaceholder:"Project name",starred:"Starred",all:"All",untitledSession:"Untitled Session",newSession:"New Session",codexSession:"Codex Session",fetchingProjects:"Fetching your Claude projects and sessions",projects:"projects",detectedFromHistory:"Detected from history",noMatchingProjects:"No matching projects",tryDifferentSearch:"Try adjusting your search term",runClaudeCli:"Run Claude CLI in a project directory to get started"},joe={title:"Pixcode",subtitle:"AI coding assistant interface"},Ioe={title:"Sessions",newSession:"New Session",deleteSession:"Delete Session",renameSession:"Rename Session",noSessions:"No sessions yet",loadingSessions:"Loading sessions...",unnamed:"Unnamed",loading:"Loading...",showMore:"Show more sessions",startToSee:"Start a new session to see it here."},Roe={section:"Orchestration",fallbackTitle:"Orchestration run"},_oe={flat:"Recent",grouped:"By project"},Poe={viewEnvironments:"View Environments",hideSidebar:"Hide sidebar",createProject:"Create new project",refresh:"Refresh projects and sessions (Ctrl+R)",renameProject:"Rename project (F2)",deleteProject:"Remove project from sidebar (Delete)",addToFavorites:"Add to favorites",removeFromFavorites:"Remove from favorites",editSessionName:"Manually edit session name",deleteSession:"Delete this session permanently",sessionActions:"Session actions",historyView:"History view",historyViewFlat:"Recent conversations",historyViewGrouped:"Grouped by project",save:"Save",cancel:"Cancel",clearSearch:"Clear search"},Loe={chat:"Chat",files:"Files",git:"Git",terminal:"Terminal",tasks:"Tasks"},Doe={refresh:"Refresh",settings:"Settings",collapseAll:"Collapse All",expandAll:"Expand All",cancel:"Cancel",save:"Save",delete:"Delete",rename:"Rename",starSession:"Star",unstarSession:"Remove star",joinCommunity:"Join Community",reportIssue:"Report Issue",starOnGithub:"Star on GitHub",controlRoom:"Control Room",controlRoomDescription:"Admin, access, runs"},Ooe={openSource:"Open Source"},Moe={active:"Active",inactive:"Inactive",thinking:"Thinking...",error:"Error",aborted:"Aborted",unknown:"Unknown"},Foe={justNow:"Just now",oneMinuteAgo:"1 min ago",minutesAgo:"{{count}} mins ago",oneHourAgo:"1 hour ago",hoursAgo:"{{count}} hours ago",oneDayAgo:"1 day ago",daysAgo:"{{count}} days ago",buckets:{today:"Today",yesterday:"Yesterday",thisWeek:"Previous 7 days",thisMonth:"Previous 30 days",older:"Older"}},zoe={deleteConfirm:"Are you sure you want to delete this?",renameSuccess:"Renamed successfully",deleteSuccess:"Deleted successfully",errorOccurred:"An error occurred",deleteSessionConfirm:"Are you sure you want to delete this session? This action cannot be undone.",deleteProjectConfirm:"Remove this project from the sidebar? Your project files, memories, and session data will not be deleted.",enterProjectPath:"Please enter a project path",deleteSessionFailed:"Failed to delete session. Please try again.",deleteSessionError:"Error deleting session. Please try again.",renameSessionFailed:"Failed to rename session. Please try again.",renameSessionError:"Error renaming session. Please try again.",deleteProjectFailed:"Failed to remove project. Please try again.",deleteProjectError:"Error removing project. Please try again.",createProjectFailed:"Failed to create project. Please try again.",createProjectError:"Error creating project. Please try again."},Boe={updateAvailable:"Update available"},Uoe={modeProjects:"Projects",modeConversations:"Conversations",conversationsPlaceholder:"Search in conversations...",searching:"Searching...",noResults:"No results found",tryDifferentQuery:"Try a different search query",matches_one:"{{count}} match",matches_other:"{{count}} matches",projectsScanned_one:"{{count}} project scanned",projectsScanned_other:"{{count}} projects scanned"},$oe={deleteProject:"Remove Project",deleteSession:"Delete Session",confirmDelete:"What would you like to do with",sessionCount_one:"This project contains {{count}} conversation.",sessionCount_other:"This project contains {{count}} conversations.",removeFromSidebar:"Remove from sidebar only",deleteAllData:"Delete all data permanently",allConversationsDeleted:"The project will be removed from the sidebar. Your files, memories, and session data will be preserved.",cannotUndo:"You can re-add the project later."},Hoe={projects:Aoe,app:joe,sessions:Ioe,orchestration:Roe,historyView:_oe,tooltips:Poe,navigation:Loe,actions:Doe,branding:Ooe,status:Moe,time:Foe,messages:zoe,version:Boe,search:Uoe,deleteConfirmation:$oe},Goe={copy:"Copy",copied:"Copied",copyCode:"Copy code"},Voe={copy:"Copy message",copied:"Message copied",selectFormat:"Select copy format",copyAsMarkdown:"Copy as markdown",copyAsText:"Copy as text"},Woe={user:"U",error:"Error",tool:"Tool",claude:"Claude",cursor:"Cursor",codex:"Codex",gemini:"Gemini",qwen:"Qwen Code"},qoe={settings:"Tool Settings",error:"Tool Error",result:"Tool Result",viewParams:"View input parameters",viewRawParams:"View raw parameters",viewDiff:"View edit diff for",creatingFile:"Creating new file:",updatingTodo:"Updating Todo List",read:"Read",readFile:"Read file",updateTodo:"Update todo list",readTodo:"Read todo list",searchResults:"results"},Koe={found:"Found {{count}} {{type}}",file:"file",files:"files",pattern:"pattern:",in:"in:"},Yoe={updated:"File updated successfully",created:"File created successfully",written:"File written successfully",diff:"Diff",newFile:"New File",viewContent:"View file content",viewFullOutput:"View full output ({{count}} chars)",contentDisplayed:"The file content is displayed in the diff view above"},Zoe={title:"Interactive Prompt",waiting:"Waiting for your response in the CLI",instruction:"Please select an option in your terminal where Claude is running.",selectedOption:"✓ Claude selected option {{number}}",instructionDetail:"In the CLI, you would select this option interactively using arrow keys or by typing the number."},Xoe={title:"Thinking...",emoji:"💭 Thinking..."},Joe={response:"JSON Response"},Qoe={grant:"Grant permission for {{tool}}",added:"Permission added",addTo:"Adds {{entry}} to Allowed Tools.",retry:"Permission saved. Retry the request to use the tool.",error:"Unable to update permissions. Please try again.",openSettings:"Open settings"},ele={updated:"Todo list has been updated successfully",current:"Current Todo List"},tle={viewPlan:"📋 View implementation plan",title:"Implementation Plan"},rle={resetAt:"Claude usage limit reached. Your limit will reset at **{{time}} {{timezone}}** - {{date}}"},nle={permissionMode:"Permission Mode",modes:{default:"Default Mode",acceptEdits:"Accept Edits",bypassPermissions:"Bypass Permissions",plan:"Plan Mode"},descriptions:{default:"Only trusted commands (ls, cat, grep, git status, etc.) run automatically. Other commands are skipped. Can write to workspace.",acceptEdits:"All commands run automatically within the workspace. Full auto mode with sandboxed execution.",bypassPermissions:"Full system access with no restrictions. All commands run automatically with full disk and network access. Use with caution.",plan:"Planning mode - no commands are executed"},technicalDetails:"Technical details"},ale={permissionMode:"Gemini Permission Mode",description:"Control how Gemini CLI handles operation approvals.",modes:{default:{title:"Standard (Ask for Approval)",description:"Gemini will prompt for approval before executing commands, writing files, and fetching web resources."},autoEdit:{title:"Auto Edit (Skip File Approvals)",description:"Gemini will automatically approve file edits and web fetches, but will still prompt for shell commands."},yolo:{title:"YOLO (Bypass All Permissions)",description:"Gemini will execute all operations without asking for approval. Exercise caution."}}},ile={permissionMode:"Qwen Permission Mode",description:"Control how Qwen Code handles operation approvals.",modes:{default:{title:"Standard (Ask for Approval)",description:"Qwen Code will prompt for approval before executing commands, writing files, and fetching web resources."},autoEdit:{title:"Auto Edit (Skip File Approvals)",description:"Qwen Code will automatically approve file edits and web fetches, but will still prompt for shell commands."},yolo:{title:"YOLO (Bypass All Permissions)",description:"Qwen Code will execute all operations without asking for approval. Exercise caution."}}},sle={placeholder:"Type / for commands, @ for files, or ask {{provider}} anything...",placeholderDefault:"Type your message...",disabled:"Input disabled",attachFiles:"Attach files",attachImages:"Attach images",send:"Send",stop:"Stop",clickToChangeMode:"Click to change permission mode (or press Tab in input)",showAllCommands:"Show all commands",clearInput:"Clear input",scrollToBottom:"Scroll to bottom"},ole={selector:{title:"Thinking Mode",description:"Extended thinking gives Claude more time to evaluate alternatives",active:"Active",tip:"Higher thinking modes take more time but provide more thorough analysis"},modes:{none:{name:"Standard",description:"Regular Claude response",prefix:""},think:{name:"Think",description:"Basic extended thinking",prefix:"think"},thinkHard:{name:"Think Hard",description:"More thorough evaluation",prefix:"think hard"},thinkHarder:{name:"Think Harder",description:"Deep analysis with alternatives",prefix:"think harder"},ultrathink:{name:"Ultrathink",description:"Maximum thinking budget",prefix:"ultrathink"}},buttonTitle:"Thinking mode: {{mode}}"},lle={title:"Choose Your AI Assistant",description:"Select a provider to start a new conversation",selectModel:"Select Model",statusUnavailable:"Status unavailable",statusRetryHint:"Could not check this CLI. Tap to retry.",retryStatus:"Retry status",providerInfo:{anthropic:"by Anthropic",openai:"by OpenAI",cursorEditor:"AI Code Editor",google:"by Google"},readyPrompt:{claude:"Ready to use Claude with {{model}}. Start typing your message below.",cursor:"Ready to use Cursor with {{model}}. Start typing your message below.",codex:"Ready to use Codex with {{model}}. Start typing your message below.",gemini:"Ready to use Gemini with {{model}}. Start typing your message below.",default:"Select a provider above to begin"}},cle={continue:{title:"Continue your conversation",description:"Ask questions about your code, request changes, or get help with development tasks"},loading:{olderMessages:"Loading older messages...",sessionMessages:"Loading session messages..."},messages:{showingOf:"Showing {{shown}} of {{total}} messages",scrollToLoad:"Scroll up to load more",showingLast:"Showing last {{count}} messages ({{total}} total)",loadEarlier:"Load earlier messages",loadAll:"Load all messages",loadingAll:"Loading all messages...",allLoaded:"All messages loaded",perfWarning:'All messages loaded — scrolling may be slower. Click "Scroll to bottom" to restore performance.'}},dle={selectProject:{title:"Select a Project",description:"Choose a project to open an interactive shell in that directory"},status:{newSession:"New Session",initializing:"Initializing...",restarting:"Restarting..."},actions:{disconnect:"Disconnect",disconnectTitle:"Disconnect from shell",restart:"Restart",restartTitle:"Restart Shell (disconnect first)",connect:"Continue in Shell",connectTitle:"Connect to shell"},loading:"Loading terminal...",connecting:"Connecting to shell...",startSession:"Start a new Claude session",startProviderSession:"Start a new {{provider}} session",resumeSession:"Resume session: {{displayName}}...",runCommand:"Run {{command}} in {{projectName}}",startCli:"Starting Claude CLI in {{projectName}}",startProviderCli:"Starting {{provider}} in {{projectName}}",defaultCommand:"command"},ule={actions:{thinking:"Thinking",processing:"Processing",analyzing:"Analyzing",working:"Working",computing:"Computing",reasoning:"Reasoning"},state:{live:"Live",paused:"Paused"},elapsed:{seconds:"{{count}}s",minutesSeconds:"{{minutes}}m {{seconds}}s",label:"{{time}} elapsed",startingNow:"Starting now"},controls:{stopGeneration:"Stop Generation",pressEscToStop:"Press Esc anytime to stop"},providers:{assistant:"Assistant"}},ple={startChatWithProvider:"Select a project to start chatting with {{provider}}"},mle={nextTaskPrompt:"Start the next task"},hle={codeBlock:Goe,copyMessage:Voe,messageTypes:Woe,tools:qoe,search:Koe,fileOperations:Yoe,interactive:Zoe,thinking:Xoe,json:Joe,permissions:Qoe,todo:ele,plan:tle,usageLimit:rle,codex:nle,gemini:ale,qwen:ile,input:sle,thinkingMode:ole,providerSelection:lle,session:cle,shell:dle,claudeStatus:ule,projectSelection:ple,tasks:mle},fle={changes:"changes",previousChange:"Previous change",nextChange:"Next change",hideDiff:"Hide diff highlighting",showDiff:"Show diff highlighting",settings:"Editor Settings",collapse:"Collapse editor",expand:"Expand editor to full width"},gle="Loading {{fileName}}...",ble={showingChanges:"Showing changes"},xle={download:"Download file",save:"Save",saving:"Saving...",saved:"Saved!",exitFullscreen:"Exit fullscreen",fullscreen:"Fullscreen",close:"Close",previewMarkdown:"Preview markdown",editMarkdown:"Edit markdown"},yle={lines:"Lines:",characters:"Characters:",shortcuts:"Press Ctrl+S to save • Esc to close"},vle={title:"Binary File",message:'The file "{{fileName}}" cannot be displayed in the text editor because it is a binary file.'},wle={toolbar:fle,loading:gle,header:ble,actions:xle,footer:yle,binaryFile:vle},kle={title:"TaskMaster AI is not configured",description:"TaskMaster helps break down complex projects into manageable tasks with AI-powered assistance",whatIsTitle:"🎯 What is TaskMaster?",features:{aiPowered:"AI-Powered Task Management: Break complex projects into manageable subtasks",prdTemplates:"PRD Templates: Generate tasks from Product Requirements Documents",dependencyTracking:"Dependency Tracking: Understand task relationships and execution order",progressVisualization:"Progress Visualization: Kanban boards and detailed task analytics",cliIntegration:"CLI Integration: Use taskmaster commands for advanced workflows"},initializeButton:"Initialize TaskMaster AI"},Sle={title:"Getting Started with TaskMaster",subtitle:"TaskMaster is initialized! Here's what to do next:",steps:{createPRD:{title:"Create a Product Requirements Document (PRD)",description:"Discuss your project idea and create a PRD that describes what you want to build.",addButton:"Add PRD",existingPRDs:"Existing PRDs:"},generateTasks:{title:"Generate Tasks from PRD",description:"Once you have a PRD, ask your AI assistant to parse it and TaskMaster will automatically break it down into manageable tasks with implementation details."},analyzeTasks:{title:"Analyze & Expand Tasks",description:"Ask your AI assistant to analyze task complexity and expand them into detailed subtasks for easier implementation."},startBuilding:{title:"Start Building",description:"Ask your AI assistant to begin working on tasks, update their status, and add new tasks as your project evolves."}},tip:"💡 Tip: Start with a PRD to get the most out of TaskMaster's AI-powered task generation"},Cle={title:"TaskMaster Setup",subtitle:"Interactive CLI for {{projectName}}",willStart:"TaskMaster initialization will start automatically",completed:"TaskMaster setup completed! You can now close this window.",closeButton:"Close",closeContinueButton:"Close & Continue"},Nle={title:"Getting Started with TaskMaster",subtitle:"Your guide to productive task management",examples:{parsePRD:`💬 Example:
799
799
  "I've just initialized a new project with Claude Task Master. I have a PRD at .taskmaster/docs/prd.txt. Can you help me parse it and set up the initial tasks?"`,expandTask:`💬 Example:
800
800
  "Task 5 seems complex. Can you break it down into subtasks?"`,addTask:`💬 Example:
801
801
  "Please add a new task to implement user profile image uploads using Cloudinary, research the best approach."`},moreExamples:"View more examples and usage patterns →",proTips:{title:"💡 Pro Tips",search:"Use the search bar to quickly find specific tasks",views:"Switch between Kanban, List, and Grid views using the view toggles",filters:"Use filters to focus on specific task statuses or priorities",details:"Click on any task to view detailed information and manage subtasks"},learnMore:{title:"📚 Learn More",description:"TaskMaster AI is an advanced task management system built for developers. Get documentation, examples, and contribute to the project.",githubButton:"View on GitHub"}},Ele={placeholder:"Search tasks..."},Tle={button:"Filters",status:"Status",priority:"Priority",sortBy:"Sort By",allStatuses:"All Statuses",allPriorities:"All Priorities",showing:"Showing {{filtered}} of {{total}} tasks",clearFilters:"Clear Filters"},Ale={id:"ID",status:"Status",priority:"Priority",idAsc:"ID (Ascending)",idDesc:"ID (Descending)",titleAsc:"Title (A-Z)",titleDesc:"Title (Z-A)",statusAsc:"Status (Pending First)",statusDesc:"Status (Done First)",priorityAsc:"Priority (High First)",priorityDesc:"Priority (Low First)"},jle={kanban:"Kanban view",list:"List view",grid:"Grid view"},Ile={pending:"📋 To Do",inProgress:"🚀 In Progress",done:"✅ Done",blocked:"🚫 Blocked",deferred:"⏳ Deferred",cancelled:"❌ Cancelled",noTasksYet:"No tasks yet",tasksWillAppear:"Tasks will appear here",moveTasksHere:"Move tasks here when started",completedTasksHere:"Completed tasks appear here",statusTasksHere:"Tasks with this status will appear here"},Rle={help:"TaskMaster Getting Started Guide",prds:"PRDs",addPRD:"Add PRD",addTask:"Add Task",createNewPRD:"Create New PRD",prdsAvailable:"{{count}} PRD(s) available"},_le={modified:"Modified: {{date}}"},Ple={pending:"Pending","in-progress":"In Progress",done:"Done",blocked:"Blocked",deferred:"Deferred",cancelled:"Cancelled"},Lle={high:"High",medium:"Medium",low:"Low"},Dle={title:"No tasks match your filters",description:"Try adjusting your search or filter criteria."},Ole={notConfigured:kle,gettingStarted:Sle,setupModal:Cle,helpGuide:Nle,search:Ele,filters:Tle,sort:Ale,views:jle,kanban:Ile,buttons:Rle,prd:_le,statuses:Ple,priorities:Lle,noMatchingTasks:Dle},Mle={save:"저장",cancel:"취소",delete:"삭제",create:"생성",edit:"편집",close:"닫기",confirm:"확인",submit:"제출",retry:"재시도",refresh:"새로고침",search:"검색",clear:"지우기",copy:"복사",download:"다운로드",upload:"업로드",browse:"찾아보기"},Fle={chat:"채팅",shell:"Shell",files:"파일",git:"소스 관리",changes:"변경 사항",liveView:"라이브 보기",tasks:"작업",remote:"원격",controlRoom:"제어",orchestration:"오케스트레이션"},zle={loading:"로딩 중...",success:"성공",error:"오류",failed:"실패",pending:"대기 중",completed:"완료",inProgress:"진행 중"},Ble={savedSuccessfully:"저장되었습니다",deletedSuccessfully:"삭제되었습니다",updatedSuccessfully:"업데이트되었습니다",operationFailed:"작업 실패",networkError:"네트워크 오류. 연결을 확인해주세요.",unauthorized:"인증되지 않았습니다. 로그인해주세요.",notFound:"찾을 수 없음",invalidInput:"잘못된 입력",requiredField:"필수 항목입니다",unknownError:"알 수 없는 오류가 발생했습니다"},Ule={settings:"설정",home:"홈",back:"뒤로",next:"다음",previous:"이전",logout:"로그아웃"},$le={language:"언어",theme:"테마",darkMode:"다크 모드",lightMode:"라이트 모드",name:"이름",description:"설명",enabled:"활성화",disabled:"비활성화",optional:"선택사항",version:"버전",select:"선택",selectAll:"전체 선택",deselectAll:"전체 해제"},Hle={justNow:"방금 전",minutesAgo:"{{count}}분 전",hoursAgo:"{{count}}시간 전",daysAgo:"{{count}}일 전",yesterday:"어제"},Gle={newFile:"새 파일",newFolder:"새 폴더",rename:"이름 변경",move:"이동",copyPath:"경로 복사",openInEditor:"에디터에서 열기"},Vle={loading:"Pixcode 로딩 중",settingUpWorkspace:"워크스페이스 설정 중...",chooseProject:"프로젝트 선택",selectProjectDescription:"사이드바에서 프로젝트를 선택하여 Claude와 코딩을 시작하세요. 각 프로젝트에는 채팅 세션과 파일 히스토리가 포함됩니다.",tip:"팁",createProjectMobile:"위의 메뉴 버튼을 눌러 프로젝트에 접근하세요",createProjectDesktop:"사이드바의 폴더 아이콘을 클릭하여 새 프로젝트를 생성하세요",newSession:"새 세션",untitledSession:"제목 없는 세션",projectFiles:"프로젝트 파일",landing:{title:"Pixcode 워크스페이스 시작",description:"프로젝트를 선택하거나 새 채팅을 시작하거나 하나의 목표로 오케스트레이션을 실행할 수 있습니다. 오케스트레이션은 선택한 CLI 에이전트를 관리하고 모든 단계와 오류를 보여줍니다.",startOrchestration:"오케스트레이션 시작",startOrchestrationDescription:"프로젝트를 자동 생성하고 에이전트 제어와 실행 기록이 있는 오케스트레이션 화면을 엽니다.",startChat:"새 채팅 시작",startChatDescription:"폴더를 자동 생성하고 단일 에이전트로 일반 채팅 화면을 엽니다.",sidebarHint:"사이드바에서 기존 프로젝트를 선택하면 채팅 기록, 파일, git 상태, 작업, 오케스트레이션이 같은 메인 화면에 유지됩니다."}},Wle={loading:"파일 로딩 중...",files:"파일",simpleView:"간단히 보기",compactView:"컴팩트 보기",detailedView:"상세히 보기",searchPlaceholder:"파일 및 폴더 검색...",clearSearch:"검색 지우기",name:"이름",size:"크기",modified:"수정일",permissions:"권한",noFilesFound:"파일을 찾을 수 없음",checkProjectPath:"프로젝트 경로가 접근 가능한지 확인하세요",noMatchesFound:"일치하는 항목 없음",tryDifferentSearch:"다른 검색어를 시도하거나 검색을 지우세요",justNow:"방금 전",minAgo:"{{count}}분 전",hoursAgo:"{{count}}시간 전",daysAgo:"{{count}}일 전",newFile:"새 파일 (Cmd+N)",newFolder:"새 폴더 (Cmd+Shift+N)",refresh:"새로고침",collapseAll:"모두 접기",context:{rename:"이름 변경",delete:"삭제",copyPath:"경로 복사",download:"다운로드",newFile:"새 파일",newFolder:"새 폴더",refresh:"새로 고침",menuLabel:"파일 컨텍스트 메뉴",loading:"로딩 중..."}},qle={title:"새 프로젝트 생성",steps:{type:"유형",configure:"설정",confirm:"확인"},step1:{question:"이미 워크스페이스가 있으신가요, 아니면 새로 생성하시겠습니까?",existing:{title:"기존 워크스페이스",description:"서버에 이미 워크스페이스가 있고 프로젝트 목록에 추가만 하면 됩니다"},new:{title:"새 워크스페이스",description:"새 워크스페이스를 생성하고, 선택적으로 GitHub 저장소에서 clone합니다"},githubClone:{title:"GitHub에서 클론",description:"대상 폴더를 선택하고 저장소를 그 안에 클론"},subfolder:{title:"하위 폴더 만들기",description:"상위 폴더를 선택하고 그 안에 새 하위 폴더 생성"}},step2:{existingPath:"워크스페이스 경로",newPath:"워크스페이스 경로",subfolderParentPath:"상위 폴더",subfolderParentHelp:"새 하위 폴더가 생성될 폴더 경로",subfolderName:"하위 폴더 이름",subfolderNameHelp:"이 이름으로 상위 폴더 안에 새 폴더가 생성됩니다",existingPlaceholder:"/path/to/existing/workspace",newPlaceholder:"/path/to/new/workspace",existingHelp:"기존 워크스페이스 디렉토리의 전체 경로",newHelp:"워크스페이스 디렉토리의 전체 경로",githubUrl:"GitHub URL (선택사항)",githubPlaceholder:"https://github.com/username/repository",githubHelp:"선택사항: 저장소를 clone하려면 GitHub URL을 입력하세요",githubAuth:"GitHub 인증 (선택사항)",githubAuthHelp:"비공개 저장소에만 필요합니다. 공개 저장소는 인증 없이 clone할 수 있습니다.",loadingTokens:"저장된 토큰 로딩 중...",storedToken:"저장된 토큰",newToken:"새 토큰",nonePublic:"없음 (공개)",selectToken:"토큰 선택",selectTokenPlaceholder:"-- 토큰 선택 --",tokenPlaceholder:"ghp_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",tokenHelp:"이 토큰은 이 작업에만 사용됩니다",publicRepoInfo:"공개 저장소는 인증이 필요하지 않습니다. 공개 저장소를 clone하는 경우 토큰을 생략할 수 있습니다.",noTokensHelp:"저장된 토큰이 없습니다. 설정 → API Keys에서 토큰을 추가하면 재사용이 편리합니다.",optionalTokenPublic:"GitHub 토큰 (공개 저장소는 선택사항)",tokenPublicPlaceholder:"ghp_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx (공개 저장소는 비워두세요)"},step3:{reviewConfig:"설정 검토",workspaceType:"워크스페이스 유형:",existingWorkspace:"기존 워크스페이스",newWorkspace:"새 워크스페이스",subfolderWorkspace:"새 하위 폴더",path:"경로:",parentPath:"상위 경로:",subfolderName:"하위 폴더 이름:",cloneFrom:"Clone 소스:",authentication:"인증:",usingStoredToken:"저장된 토큰 사용:",usingProvidedToken:"제공된 토큰 사용",noAuthentication:"인증 없음",sshKey:"SSH 키",existingInfo:"워크스페이스가 프로젝트 목록에 추가되며 Claude/Cursor 세션에서 사용할 수 있습니다.",newWithClone:"이 폴더에 저장소가 clone됩니다.",newEmpty:"워크스페이스가 프로젝트 목록에 추가되며 Claude/Cursor 세션에서 사용할 수 있습니다.",subfolderInfo:"상위 폴더 안에 새 하위 폴더가 생성되어 프로젝트 목록에 추가됩니다.",cloningRepository:"저장소 clone 중..."},buttons:{cancel:"취소",back:"뒤로",next:"다음",createProject:"프로젝트 생성",creating:"생성 중...",cloning:"Clone 중..."},errors:{selectType:"기존 워크스페이스를 사용할지 새로 생성할지 선택해주세요",providePath:"워크스페이스 경로를 입력해주세요",provideSubfolderName:"하위 폴더 이름을 입력해주세요",subfolderNameInvalid:"하위 폴더 이름에 경로 구분자를 포함할 수 없으며 . / .. 도 허용되지 않습니다",failedToCreate:"워크스페이스 생성 실패",failedToCreateFolder:"폴더 생성 실패"}},Kle={genericTool:"도구",codes:{generic:{info:{title:"알림"}},permission:{required:{title:"작업 필요",body:"{{toolName}} 에 대한 결정을 기다리고 있습니다."}},run:{stopped:{title:"실행이 중지되었습니다",body:"사유: {{reason}}"},failed:{title:"실행 실패"}},agent:{notification:{title:"에이전트 알림"}}}},Yle={title:"업데이트 가능",newVersionReady:"새 버전이 준비되었습니다",currentVersion:"현재 버전",latestVersion:"최신 버전",whatsNew:"새로운 기능:",viewFullRelease:"전체 릴리스 보기",updateProgress:"업데이트 진행 상황:",manualUpgrade:"수동 업그레이드:",npmUpgradeCommand:"npm install -g @pixelbyte-software/pixcode@latest",pixcodeUpgradeCommand:"pixcode update --restart-daemon",manualUpgradeHint:'또는 "지금 업데이트"를 클릭하여 자동으로 업데이트합니다.',updateCompleted:"업데이트가 완료되었습니다!",restartServer:"변경사항을 적용하려면 서버를 재시작하세요.",updateFailed:"업데이트 실패",buttons:{close:"닫기",later:"나중에",copyCommand:"명령어 복사",updateNow:"지금 업데이트",updating:"업데이트 중..."},ariaLabels:{closeModal:"버전 업그레이드 모달 닫기",showSidebar:"사이드바 표시",settings:"설정",updateAvailable:"업데이트 가능",closeSidebar:"사이드바 닫기"}},Zle={title:"오케스트레이션",subtitle:"{{project}} 안에서 하나의 목표를 입력하고 CLI 워커를 선택하세요. 필요하면 같은 CLI를 여러 개 만들고 직접 배정하거나 코디네이터가 나누게 할 수 있습니다.",refresh:"새로고침",goal:"목표",goalPlaceholder:"예: 인증 화면을 단일 포트 배포에 맞게 수정하고 오류를 수집한 뒤 lint와 typecheck로 검증합니다.",mode:"실행 모드",systemPlan:"시스템 계획",noMode:"선택된 모드 없음",loadingPlan:"에이전트 계획을 불러오는 중입니다.",start:"팀 시작",starting:"시작 중",needAgent:"CLI 워커를 하나 이상 활성화하세요.",startFailed:"워크플로를 시작할 수 없습니다.",cliControl:"CLI 팀",enabledCount:"{{count}}개 활성",enabled:"활성",disabled:"비활성",history:"기록",emptyHistory:"아직 실행 기록이 없습니다. 목표를 작성하고 에이전트를 시작하세요.",steps:"{{done}}/{{total}} 단계",notSelected:"선택된 실행 없음",notSelectedDescription:"이전 실행을 선택하거나 새 목표를 시작하세요. 에이전트 메시지, 오류, 변경 요약, 미리보기 출력이 여기에 표시됩니다.",loadFailed:"실행 상세를 불러올 수 없습니다.",loadingRun:"실행을 불러오는 중...",agentSteps:"에이전트 단계",noStepOutput:"단계 출력이 없습니다.",agentMessages:"에이전트 메시지",noAgentMessages:"이 에이전트는 아직 메시지를 생성하지 않았습니다. 실행이 실패했다면 실제 CLI 오류가 위에 표시됩니다.",outputs:"출력",noOutputs:"변경 요약, 미리보기 또는 명령 출력이 아직 없습니다.",open:"열기",artifact:{fileDiff:"변경 요약",previewUrl:"미리보기",commandOutput:"명령 출력"},role:{user:"사용자",agent:"에이전트"},status:{queued:"대기 중",running:"실행 중",completed:"완료",failed:"오류",canceled:"취소됨",skipped:"건너뜀"},nodes:{codex_review:"Codex 검토",gemini_review:"Gemini 검토",claude_review:"Claude 검토",claude_code_review:"Claude 검토",cursor_review:"Cursor 검토",aggregate:"집계",architect:"계획",implement:"구현",review:"검토",proposal:"제안",critique:"비판",response:"응답",judge:"결정",coordinator:"코디네이터",final_report:"최종 보고서"},workflows:{multi_model_review:{name:"멀티 모델 검토",description:"활성화된 CLI 에이전트가 같은 목표를 개별 검토한 뒤 활성 에이전트가 결과를 집계합니다."},sequential_handoff:{name:"순차 핸드오프",description:"에이전트가 순서대로 계획, 구현, 검토합니다. 비활성 CLI 단계는 건너뜁니다."},adversarial_debate:{name:"의사결정 토론",description:"에이전트가 제안, 비판, 응답하고 최종 권고를 생성합니다."},agent_team:{name:"에이전트 팀",description:"코디네이터가 목표와 활성 CLI 인스턴스를 읽고 작업을 배정한 뒤 결과를 모읍니다."}},adapters:{"claude-code":{label:"Claude Code",role:"CLI 워커"},cursor:{label:"Cursor",role:"CLI 워커"},codex:{label:"Codex",role:"CLI 워커"},gemini:{label:"Gemini",role:"CLI 워커"},qwen:{label:"Qwen Code",role:"CLI 워커"},opencode:{label:"OpenCode",role:"CLI 워커"}},activeCount:"{{active}}/{{total}} 활성",teamHint:"각 행은 하나의 CLI 워커입니다. Claude, Codex, Cursor, Gemini, Qwen, OpenCode 워커를 여러 개 만들고 각각 다른 작업을 줄 수 있습니다.",parallelLimit:"병렬 제한",addAgent:"{{agent}} 추가",duplicateAgent:"{{agent}} 복제",removeAgent:"{{agent}} 제거",assignment:"배정",assignmentPlaceholder:"선택 사항: 이 워커가 맡을 일을 정확히 적으세요. 비워 두면 코디네이터가 목표에 따라 배정합니다.",agentInstance:"{{name}} #{{number}}",taskTitle:"작업",taskTitlePlaceholder:"기능 구현",taskDescription:"설명",taskDescriptionPlaceholder:"범위, 제약, 기대 출력",addTask:"추가",runTask:"실행",cancelTask:"취소",dispatchTask:"작업 배정",adapter:"어댑터",isolation:"격리",dispatch:"배정",auto:"자동",waitingForStream:"스트림 대기 중...",workflow:"워크플로",input:"입력",taskStates:{todo:"할 일",in_progress:"진행 중",in_review:"검토 중",done:"완료",failed:"실패",canceled:"취소됨"},isolationKind:{worktree:"Worktree",host:"Host",docker:"Docker"},stop:"팀 중지",stopping:"중지 중",cancelFailed:"워크플로를 중지할 수 없습니다.",needRoles:"이 모드에서는 다음 역할에 최소 한 명의 활성 에이전트를 할당해야 합니다: {{roles}}.",quickPrompts:{label:"빠른 프롬프트:",liveTrading:{label:"8024 라이브 트레이딩 화면",prompt:"안녕하세요. 작은 프로젝트를 만들고 이후 8024 포트에서 실행해 주세요. Binance FAPI와 연결된 TradingView 스타일 디자인, TradingView 차트, 왼쪽 별표/즐겨찾기 시스템을 원합니다. 작업을 논리적으로 나누고 프로세스를 자동으로 관리해 주세요."}},teamHistory:"팀 기록",changeSummary:"변경 요약",noChangeSummary:"최종 요약이 아직 준비되지 않았습니다. 에이전트가 완료되면 읽기 쉬운 Markdown 요약이 여기에 표시됩니다.",prepareTeamFromReport:"이 보고서로 에이전트 팀 준비",prepareTeamTitle:"에이전트 팀 프롬프트 준비",prepareTeamDescription:"토론 결과가 새 Agent Team 프롬프트로 변환되었습니다. 수정한 뒤 Agent Team 모드로 이동할 수 있습니다.",usePreparedPrompt:"프롬프트 사용",reportToPromptPrefix:"아래 토론/결정 보고서를 바탕으로 에이전트 팀을 준비하고 실행하세요. 요구사항을 작업으로 나누고 사용 가능한 CLI 에이전트에 적절한 할당을 제안한 뒤, 사용자 확인 후 시작하세요.",generatedSummaryTitle:"자동 실행 요약",summaryStatus:"전체 상태",summarySteps:"완료된 단계",summaryFailures:"실패한 단계",summaryCanceled:"취소된 단계",summaryDiffs:"Diff/변경 출력",summaryPreviews:"미리보기 출력",summaryErrorPrefix:"오류",assignedWork:"할당된 작업",autoAssigned:"자동 / 코디네이터 결정",stages:{coordinator:"코디네이터",handoff:"인계",backend:"백엔드",frontend:"프론트엔드",implementation:"구현",review:"리뷰",repair:"수정",proposal:"제안",critique:"비판",response:"응답",decision:"결정",report:"보고서",final_report:"최종 보고서"},agentRole:"단계",agentRoles:{auto:"자동",backend:"백엔드",frontend:"프론트엔드",review:"테스트 / 리뷰",implementation:"구현",proposal:"제안",critique:"비판",response:"응답",decision:"결정 / 보고서",report:"보고서",custom:"사용자 지정"},customRolePlaceholder:"예: 보안, 모바일 UX, DB 아키텍처",roleHints:{default:"비워두면 코디네이터가 목표에 따라 이 에이전트에 할당합니다.",agent_team:"백엔드, 프론트엔드, 리뷰 단계를 선택하거나 자동으로 둘 수 있습니다.",multi_model_review:"활성 에이전트가 리뷰합니다. 보고서 역할을 선택하면 해당 에이전트가 최종 요약을 모읍니다.",sequential_handoff:"에이전트는 선택한 순서대로 실행됩니다. 작업 문구가 각 단계의 범위를 정의합니다.",adversarial_debate:"결정 토론에서는 단계 선택이 선택사항입니다. 비워두면 시스템이 선택된 에이전트를 순서대로 제안, 비판, 응답에 배정합니다."},soloAgent:"{{agent}}만 실행",soloAgentShort:"단독",cliSettings:"CLI 설정",workspaceTarget:"대상 작업 영역",workspaceTargets:{selectedProject:"선택한 프로젝트",pixcodeApp:"Pixcode 시스템",custom:"사용자 지정 경로"},customWorkspacePlaceholder:"/path/to/project",workspaceTargetHint:"에이전트 실행 위치: {{path}}",autoDetect:"자동 감지",needWorkspacePath:"사용자 지정 작업 영역 경로를 입력하세요.",hermesTitle:"Hermes Agent",hermesSubtitle:"Hermes is running inside Pixcode for {{project}} and can coordinate local checks, tests, terminal work, and project operations.",hermesCliControl:"Hermes CLI control"},Xle={title:"컨트롤 룸",subtitle:"{{target}}의 프로덕션, 플랫폼, 관리, 감사, 셀프 호스티드 접근",thisServer:"이 서버",refresh:"새로고침",nav:{overview:"개요",production:"프로덕션",admin:"관리",team:"팀",secrets:"시크릿",marketplace:"마켓플레이스",eval:"평가",usage:"사용량",security:"보안",access:"접근"},overview:{title:"v1.46 launch surface",description:"Every box below is backed by a v1.44-v1.45 API and is now visible from the UI.",latestAuditEvents:"Latest audit events",remoteAccessOptions:"Remote access options"},metrics:{issueRuns:"Issue-to-PR runs",reviewItems:"Review items",subUsers:"Sub-users",collaborators:"Project collaborators",secrets:"Scoped secrets",marketplace:"Marketplace entries",evalRuns:"Evaluation runs",securityAudits:"Security audits"},sections:{production:{title:"Production loop",description:"Start issue-to-PR runs, parse CI failures, review changes, schedule background jobs, and create checkpoints."},admin:{title:"관리 시스템",description:"셀프 호스티드 Pixcode 서버에서 하위 사용자를 만들고 계정을 비활성화하며 활동을 확인합니다."},team:{title:"프로젝트 협업자",description:"모두를 전역 관리자로 만들지 않고 프로젝트별 partner, worker, reviewer, viewer를 지정합니다."},secrets:{title:"Secret vault",description:"Store scoped env secrets and preview what each provider, project, workflow, Telegram, or API run receives."},marketplace:{title:"MCP/plugin marketplace",description:"Register MCP servers, workflow templates, provider adapters, and notification channels with permission review and health."},eval:{title:"Evaluation harness",description:"Create regression suites and compare provider/model runs with pass rate and latency."},usage:{title:"Cost, token, and latency dashboard",description:"Monitor provider/model/workflow usage for demos and operations."},security:{title:"Security audit mode",description:"Run dependency audit, secret scan, permission audit, and agent output leak detection workflows."},access:{title:"셀프 호스티드 접근",description:"고정 도메인이 없으면 Tailscale을 사용하고, 안정적인 공개 URL에는 Cloudflare Tunnel/custom domain을 설정합니다."}},panels:{issueToPr:"Issue-to-PR run",ciRepair:"CI repair parser",reviewQueue:"Review queue",schedulerCheckpoints:"Scheduler and checkpoints",createSubUser:"Create sub-user",rolePermissions:"Role permissions",addCollaborator:"Add collaborator",createSecret:"Create secret",scopedEnvPreview:"Scoped env preview",addMarketplaceEntry:"Add marketplace entry",createSuite:"Create suite",recordRun:"Record run",recordUsageEvent:"Record usage event",createAuditRun:"Create audit run",auditLog:"Audit log",remoteAccessSetup:"Remote access setup"},lists:{recentJobs:"Recent jobs",recentCheckpoints:"Recent checkpoints",subUsers:"Sub-users",collaborators:"Collaborators",includedEnvNames:"Included env names",vaultEntries:"Vault entries",marketplaceEntries:"Marketplace entries",suites:"Suites",runs:"Runs",auditRuns:"Audit runs",configuredAccessPaths:"Configured access paths"},buttons:{queueRun:"Queue run",parseFailure:"Parse failure",createReviewItem:"Create review item",scheduleJob:"Schedule job",createCheckpoint:"Create checkpoint",createUser:"Create user",disable:"Disable",enable:"Enable",addCollaborator:"Add collaborator",storeSecret:"Store secret",previewEnv:"Preview env",saveEntry:"Save entry",markHealthy:"Mark healthy",createSuite:"Create suite",recordRun:"Record run",recordUsage:"Record usage",createAudit:"Create audit",exportJson:"Export JSON",exportCsv:"Export CSV",saveAccessPath:"Save access path",checkUrl:"Check URL",checkTailscale:"Check Tailscale"},placeholders:{githubIssueUrl:"GitHub issue URL",manualTitle:"Manual title fallback",model:"Model",baseBranch:"Base branch",ciLog:"Paste failing CI, lint, typecheck, or build output",reviewTitle:"Review title",notes:"Notes",changedFiles:"Changed files, one per line",jobName:"Job name",cronExpression:"Cron or watch expression",checkpointReason:"Checkpoint reason",backgroundPrompt:"Background agent prompt",checkpointFiles:"Checkpoint changed files, one per line",usernameEmail:"Username or email",temporaryPassword:"Temporary password",userEmailUsername:"User email or username",secretName:"Secret name",envName:"ENV_NAME",secretTarget:"Target project/provider/workflow",secretValue:"Secret value",workflowId:"Workflow id",name:"Name",pluginSource:"Source package or repository",installCommand:"Install command",permissionScopes:"Permission scopes, one per line",suiteName:"Suite name",description:"Description",firstTaskTitle:"First task title",acceptanceCriteria:"Acceptance criteria, one per line",suiteId:"Suite id",latencyMs:"Latency ms",passedCount:"Passed count",failedCount:"Failed count",workflow:"Workflow",inputTokens:"Input tokens",outputTokens:"Output tokens",costUsd:"Cost USD",optionalFindingTitle:"Optional finding title",auditFilter:"Filter audit log by user, project, event, or file",label:"Label",url:"URL",targetPort:"Target port"},labels:{project:"project",path:"path",providerModel:"provider/model",branch:"branch",failedCommands:"Failed commands",files:"Files",lastActive:"Last active",role:"role",tasks:"tasks",pass:"pass",health:"Health",reachable:"reachable",installed:"installed",loggedIn:"logged in"},columns:{provider:"Provider",model:"Model",workflow:"Workflow",runs:"Runs",tokens:"Tokens",cost:"Cost",latency:"Latency",errorRate:"Error rate"},fallback:{selectedProject:"selected project",projectPath:"project path",noneDetected:"none detected",noUrl:"No URL",global:"global",noSource:"No source",regressionSuite:"Regression suite",demoTask:"Demo task",provider:"provider",reviewRequired:"Review required.",notAvailable:"not available"},capabilities:{partner:"can approve actions, manage secrets, and use shell",projectScoped:"project-scoped access only"},teamAccess:{title:"협업자가 접근하는 방법",stepUsers:"하위 사용자 만들기",stepUsersDescription:"Admin system에서 member, viewer, project_worker, project_partner 같은 전역 역할로 사용자를 만듭니다.",stepRole:"프로젝트 역할 지정",stepRoleDescription:"같은 사용자를 프로젝트 협업자로 추가해 선택한 프로젝트만 보고 실행하게 합니다.",stepLink:"접근 경로 공유",stepLinkDescription:"Self-hosted access에 설정된 Tailscale, Cloudflare Tunnel, custom domain 또는 LAN URL을 공유합니다.",paths:"사용 가능한 접근 링크"},badges:{public:"public",private:"private"},empty:{noAuditEvents:"No audit events yet.",noRemoteAccessConfigs:"No remote access configs yet.",noReviewItems:"No review items yet.",noRecentJobs:"No recent jobs yet.",noRecentCheckpoints:"No recent checkpoints yet.",noSubUsers:"No sub-users yet.",noCollaborators:"No project collaborators yet.",noAccessPaths:"No access paths configured yet.",noIncludedEnvNames:"No included env names yet.",noSecrets:"No secrets yet.",noMarketplaceEntries:"No marketplace entries yet.",noSuites:"No suites yet.",noRuns:"No runs yet.",usageSummary:"Usage appears here after provider or workflow events are recorded.",noSecurityAudits:"No security audits yet.",noAuditMatches:"No audit entries match the current filter."}},Jle={title:"VS Code 워크벤치",noProject:"선택된 프로젝트 없음",activity:{explorer:"탐색기",projects:"프로젝트",sourceControl:"소스 제어",terminal:"터미널",showPanel:"왼쪽 패널 표시",hidePanel:"왼쪽 패널 숨기기"},panels:{explorer:"탐색기",projects:"프로젝트",sourceControl:"소스 제어",terminal:"터미널",editor:"편집기",cli:"CLI",rightTerminal:"터미널"},editor:{emptyTitle:"탐색기에서 파일 열기",closeTab:"{{file}} 닫기",scrollLeft:"탭을 왼쪽으로 스크롤",scrollRight:"탭을 오른쪽으로 스크롤",moreActions:"추가 탭 작업",closeSplit:"분할 편집기 닫기",context:{close:"닫기",closeAll:"모두 닫기",copyPath:"경로 복사",splitRight:"오른쪽으로 분할",splitMoveRight:"오른쪽으로 분할 및 이동"}},resize:{left:"왼쪽 패널 크기 조정",right:"CLI 패널 크기 조정"},menu:{openProject:"프로젝트 열기...",cloneFromGithub:"저장소 클론...",newChat:"새 채팅",openProjects:"프로젝트 열기"},projects:{openProject:"프로젝트 열기",cloneFromGithub:"클론",directoryList:"디렉터리",refresh:"프로젝트 새로고침",emptyTitle:"아직 프로젝트 디렉터리가 없습니다",emptyDescription:"로컬 폴더를 열거나 저장소를 클론해서 시작하세요.",selected:"선택됨",startChat:"채팅",fileCount:"{{formattedCount}}개 파일",fileCountPending:"파일 준비 중",startTitle:"Start a Pixcode workspace",startDescription:"Pick a folder and Pixcode will bind the explorer, terminal, and chat history to that workspace.",workHere:"Work in this folder"},workspace:{empty:"Workspace 1을 만들려면 프로젝트를 여세요.",openFirst:"워크스페이스 열기",add:"워크스페이스 추가",scrollLeft:"워크스페이스를 왼쪽으로 스크롤",scrollRight:"워크스페이스를 오른쪽으로 스크롤",close:"{{name}} 닫기",closeAction:"워크스페이스 닫기",closeOthers:"다른 항목 닫기",closeAll:"모두 닫기",rename:"이름 바꾸기",star:"별표",unstar:"별표 해제",toggleStar:"{{name}} 별표",moreActions:"워크스페이스 작업"},cli:{projectScoped:"프로젝트 범위 CLI 터미널",chooseTitle:"CLI 터미널 시작",chooseDescription:"CLI를 선택한 뒤 전체 높이 터미널을 시작합니다.",startSelected:"{{provider}} 시작",newSession:"새 CLI 세션",history:"기록",noHistory:"이 프로젝트에는 아직 세션이 없습니다.",projectHistory:"프로젝트 기록",checking:"확인 중...",ready:"준비됨",notInstalled:"설치되지 않음",installing:"설치 중...",updateAvailable:"{{version}} 업데이트",installProvider:"{{provider}} 설치",updateProvider:"{{provider}} 업데이트",manualInstall:"이 CLI는 수동 설치가 필요합니다.",installNoJob:"설치 작업 ID가 반환되지 않았습니다.",installFailed:"설치 실패.",installStreamLost:"설치 스트림이 일찍 닫혔습니다. 설치가 아직 실행 중일 수 있습니다.",provider:"Provider",installRunning:"설치 중",installDone:"준비됨",installError:"확인이 필요함",showPanel:"CLI 패널 표시",hidePanel:"CLI 패널 숨기기",close:"터미널 닫기"},terminal:{title:"터미널",close:"터미널 닫기"},hermes:{title:"Hermes Agent",installTitle:"Hermes Agent 설치",description:"프로젝트 범위 에이전트 터미널입니다. Hermes가 없으면 설치한 뒤 이 워크스페이스에서 엽니다.",start:"Hermes 시작",install:"설치",newSession:"새 Hermes 세션",history:"Hermes 기록",connect:"Hermes Agent 연결",ready:"준비됨",installRunning:"Pixcode API로 Hermes를 설치하는 중...",installDone:"Hermes가 설치되었고 Pixcode MCP가 구성되었습니다.",installError:"Hermes 설치에 실패했습니다.",installReady:"Hermes 설치 준비 완료.",installWaiting:"Hermes 설치 로그를 기다리는 중...",retryInstall:"설치 다시 시도",installFailed:"Hermes 설치에 실패했습니다.",installStreamLost:"Hermes 설치 스트림이 일찍 닫혔습니다. 설치가 아직 실행 중일 수 있습니다."}},Qle={buttons:Mle,tabs:Fle,status:zle,messages:Ble,navigation:Ule,common:$le,time:Hle,fileOperations:Gle,mainContent:Vle,fileTree:Wle,projectWizard:qle,notifications:Kle,versionUpdate:Yle,orchestration:Zle,controlRoom:Xle,vscodeWorkbench:Jle},ece="설정",tce={account:"계정",permissions:"권한",mcpServers:"MCP 서버",appearance:"외관"},rce={title:"계정",language:"언어",languageLabel:"표시 언어",languageDescription:"인터페이스에 사용할 언어를 선택하세요",username:"사용자명",email:"이메일",profile:"프로필",changePassword:"비밀번호 변경"},nce={title:"MCP 서버",addServer:"서버 추가",editServer:"서버 편집",deleteServer:"서버 삭제",serverName:"서버 이름",serverType:"서버 유형",config:"설정",testConnection:"연결 테스트",status:"상태",connected:"연결됨",disconnected:"연결 끊김",scope:{label:"범위",user:"사용자",project:"프로젝트"}},ace={title:"외관",theme:"테마",codeEditor:"코드 에디터",editorTheme:"에디터 테마",wordWrap:"자동 줄바꿈",showMinimap:"미니맵 표시",lineNumbers:"줄 번호",fontSize:"글꼴 크기"},ice={saveChanges:"변경사항 저장",resetToDefaults:"기본값으로 초기화",cancelChanges:"변경 취소"},sce={title:"빠른 설정",sections:{appearance:"외관",toolDisplay:"도구 표시",viewOptions:"보기 옵션",inputSettings:"입력 설정",changeAwareness:"제어 센터"},darkMode:"다크 모드",autoExpandTools:"도구 자동 펼치기",showRawParameters:"Raw 파라미터 표시",showThinking:"생각 과정 표시",autoScrollToBottom:"자동 스크롤",sendByCtrlEnter:"Ctrl+Enter로 전송",sendByCtrlEnterDescription:"활성화하면 Enter 대신 Ctrl+Enter로 메시지를 전송합니다. IME 사용자가 실수로 전송하는 것을 방지하는 데 유용합니다.",changeAwareness:"제어 센터",changedFiles:{title:"변경된 파일",description:"로컬 파일 변경을 추적하고 새 변경이 생기면 파일 패널을 엽니다.",noProject:"로컬 변경을 추적할 프로젝트를 선택하세요.",refresh:"변경된 파일 새로고침",empty:"로컬 변경이 없습니다",disabled:"로컬 변경을 보려면 제어 센터를 켜세요.",more:"+{{count}}개 파일 더",lastChecked:"{{value}} 확인",guideTitle:"오른쪽 패널 가이드",guideFiles:"변경된 파일은 파일 패널에서 초록색으로 빛납니다.",guidePanel:"새 변경은 분할 패널을 자동으로 엽니다.",status:{M:"M",A:"A",D:"D",U:"U"}},dragHandle:{dragging:"드래그 핸들",closePanel:"설정 패널 닫기",openPanel:"설정 패널 열기",draggingStatus:"드래그 중...",toggleAndMove:"클릭하여 토글, 드래그하여 이동"}},oce={title:"터미널 단축키",sectionKeys:"키",sectionNavigation:"탐색",escape:"Escape",tab:"Tab",shiftTab:"Shift+Tab",arrowUp:"위쪽 화살표",arrowDown:"아래쪽 화살표",scrollDown:"아래로 스크롤",handle:{closePanel:"단축키 패널 닫기",openPanel:"단축키 패널 열기"}},lce={label:"설정",agents:"에이전트",hermes:"Hermes Agent",appearance:"외관",git:"Git",apiTokens:"API & 토큰",notifications:"알림",plugins:"플러그인",mobile:"모바일에서 사용",telegram:"Telegram",about:"정보",access:"접근"},cce={title:"알림",description:"수신할 알림 이벤트를 설정합니다.",webPush:{title:"웹 푸시 알림",enable:"푸시 알림 활성화",disable:"푸시 알림 비활성화",enabled:"푸시 알림이 활성화되었습니다",loading:"업데이트 중...",unsupported:"이 브라우저에서는 푸시 알림이 지원되지 않습니다.",denied:"푸시 알림이 차단되었습니다. 브라우저 설정에서 허용해 주세요."},events:{title:"이벤트 유형",actionRequired:"작업 필요",stop:"실행 중지",error:"실행 실패"}},dce={darkMode:{label:"다크 모드",description:"라이트/다크 테마 전환"},projectSorting:{label:"프로젝트 정렬",description:"사이드바에서 프로젝트 정렬 방식",alphabetical:"알파벳순",recentActivity:"최근 활동순"},codeEditor:{title:"코드 에디터",theme:{label:"에디터 테마",description:"코드 에디터의 기본 테마"},wordWrap:{label:"자동 줄바꿈",description:"에디터에서 기본적으로 자동 줄바꿈 활성화"},showMinimap:{label:"미니맵 표시",description:"Diff 보기에서 쉬운 탐색을 위한 미니맵 표시"},lineNumbers:{label:"줄 번호 표시",description:"에디터에 줄 번호 표시"},fontSize:{label:"글꼴 크기",description:"에디터 글꼴 크기 (픽셀)"}}},uce={title:{add:"MCP 서버 추가",edit:"MCP 서버 편집"},importMode:{form:"폼 입력",json:"JSON 가져오기"},scope:{label:"범위",userGlobal:"사용자 (전역)",projectLocal:"프로젝트 (로컬)",userDescription:"사용자 범위: 모든 프로젝트에서 사용 가능",projectDescription:"로컬 범위: 선택한 프로젝트에서만 사용 가능",cannotChange:"기존 서버를 편집할 때는 범위를 변경할 수 없습니다"},fields:{serverName:"서버 이름",transportType:"전송 유형",command:"명령어",arguments:"인수 (한 줄에 하나씩)",jsonConfig:"JSON 설정",url:"URL",envVars:"환경 변수 (KEY=value, 한 줄에 하나씩)",headers:"헤더 (KEY=value, 한 줄에 하나씩)",selectProject:"프로젝트 선택..."},placeholders:{serverName:"my-server"},validation:{missingType:"필수 항목 누락: type",stdioRequiresCommand:"stdio 유형은 command 필드가 필요합니다",httpRequiresUrl:"{{type}} 유형은 url 필드가 필요합니다",invalidJson:"잘못된 JSON 형식",jsonHelp:"MCP 서버 설정을 JSON 형식으로 붙여넣으세요. 예시:",jsonExampleStdio:'• stdio: {"type":"stdio","command":"npx","args":["@upstash/context7-mcp"]}',jsonExampleHttp:'• http/sse: {"type":"http","url":"https://api.example.com/mcp"}'},configDetails:"설정 상세 ({{configFile}}에서)",projectPath:"경로: {{path}}",actions:{cancel:"취소",saving:"저장 중...",addServer:"서버 추가",updateServer:"서버 업데이트"}},pce={success:"설정이 저장되었습니다!",error:"설정 저장 실패",saving:"저장 중..."},mce={save:"설정 저장",cancel:"취소"},hce={title:"Git 설정",description:"커밋을 위한 Git 정보를 설정합니다. 이 설정은 git config --global로 전역 적용됩니다",name:{label:"Git 이름",help:"Git 커밋에 사용될 이름"},email:{label:"Git 이메일",help:"Git 커밋에 사용될 이메일"},actions:{save:"설정 저장",saving:"저장 중..."},status:{success:"저장 완료"}},fce={title:"API 키",description:"다른 애플리케이션에서 외부 API에 접근하기 위한 API 키를 생성합니다.",newKey:{alertTitle:"⚠️ API 키를 저장하세요",alertMessage:"이 키는 지금만 볼 수 있습니다. 안전하게 보관하세요.",iveSavedIt:"저장했습니다"},form:{placeholder:"API 키 이름 (예: Production Server)",createButton:"생성",cancelButton:"취소"},newButton:"새 API 키",empty:"생성된 API 키가 없습니다.",list:{created:"생성일:",lastUsed:"마지막 사용:"},confirmDelete:"이 API 키를 삭제하시겠습니까?",status:{active:"활성",inactive:"비활성"},github:{title:"GitHub 토큰",description:"외부 API를 통해 비공개 저장소를 clone하기 위한 GitHub Personal Access Token을 추가합니다.",descriptionAlt:"비공개 저장소를 clone하기 위한 GitHub Personal Access Token을 추가합니다. 저장하지 않고 API 요청에 직접 토큰을 전달할 수도 있습니다.",addButton:"토큰 추가",form:{namePlaceholder:"토큰 이름 (예: Personal Repos)",tokenPlaceholder:"GitHub Personal Access Token (ghp_...)",descriptionPlaceholder:"설명 (선택사항)",addButton:"토큰 추가",cancelButton:"취소",howToCreate:"GitHub Personal Access Token 생성 방법 →"},empty:"추가된 GitHub 토큰이 없습니다.",added:"추가일:",confirmDelete:"이 GitHub 토큰을 삭제하시겠습니까?"},apiDocsLink:"API 문서",documentation:{title:"외부 API 문서",description:"외부 API를 사용하여 애플리케이션에서 Claude/Cursor 세션을 트리거하는 방법을 알아보세요.",viewLink:"API 문서 보기 →"},loading:"로딩 중...",version:{updateAvailable:"업데이트 가능: v{{version}}"}},gce={authStatus:{checking:"확인 중...",connected:"연결됨",notConnected:"연결되지 않음",disconnected:"연결 끊김",checkingAuth:"인증 상태 확인 중...",loggedInAs:"{{email}}(으)로 로그인됨",authenticatedUser:"인증된 사용자"},account:{claude:{description:"Anthropic Claude AI 어시스턴트"},cursor:{description:"Cursor AI 기반 코드 에디터"},codex:{description:"OpenAI Codex AI 어시스턴트"},gemini:{description:"Google Gemini AI 어시스턴트"},qwen:{description:"Alibaba Qwen Code CLI (Gemini CLI 포크)"}},connectionStatus:"연결 상태",login:{title:"로그인",reAuthenticate:"재인증",description:"AI 기능을 활성화하려면 {{agent}} 계정에 로그인하세요",reAuthDescription:"다른 계정으로 로그인하거나 자격 증명을 새로고침하세요",button:"로그인",reLoginButton:"재로그인"},error:"오류: {{error}}"},bce={title:"권한 설정",skipPermissions:{label:"권한 확인 건너뛰기 (주의해서 사용)",claudeDescription:"--dangerously-skip-permissions 플래그와 동일",cursorDescription:"Cursor CLI의 -f 플래그와 동일",opencodeDescription:"OpenCode의 --dangerously-skip-permissions 플래그와 동일"},allowedTools:{title:"허용된 도구",description:"권한 확인 없이 자동으로 허용되는 도구",placeholder:'예: "Bash(git log:*)" 또는 "Write"',quickAdd:"자주 쓰는 도구 빠른 추가:",empty:"설정된 허용 도구 없음"},blockedTools:{title:"차단된 도구",description:"권한 확인 없이 자동으로 차단되는 도구",placeholder:'예: "Bash(rm:*)"',empty:"설정된 차단 도구 없음"},allowedCommands:{title:"허용된 Shell 명령어",description:"권한 확인 없이 자동으로 허용되는 Shell 명령어",placeholder:'예: "Shell(ls)" 또는 "Shell(git status)"',quickAdd:"자주 쓰는 명령어 빠른 추가:",empty:"설정된 허용 명령어 없음"},blockedCommands:{title:"차단된 Shell 명령어",description:"자동으로 차단되는 Shell 명령어",placeholder:'예: "Shell(rm -rf)" 또는 "Shell(sudo)"',empty:"설정된 차단 명령어 없음"},toolExamples:{title:"도구 패턴 예시:",bashGitLog:"- 모든 git log 명령어 허용",bashGitDiff:"- 모든 git diff 명령어 허용",write:"- 모든 Write 도구 사용 허용",bashRm:"- 모든 rm 명령어 차단 (위험)"},shellExamples:{title:"Shell 명령어 예시:",ls:"- ls 명령어 허용",gitStatus:"- git status 허용",npmInstall:"- npm install 허용",rmRf:"- 재귀 삭제 차단"},opencodeAllowed:{title:"허용된 Bash 패턴",description:"OpenCode가 확인 없이 자동 승인하는 Bash 명령 패턴",placeholder:'예: "git *" 또는 "npm test"',quickAdd:"자주 쓰는 패턴 빠른 추가:",empty:"허용 패턴이 없습니다"},opencodeBlocked:{title:"차단된 Bash 패턴",description:"OpenCode가 항상 거부하는 Bash 명령 패턴",placeholder:'예: "rm -rf *" 또는 "sudo *"',empty:"차단 패턴이 없습니다"},opencodeExamples:{title:"패턴 예시:",gitAll:"- 모든 git 명령 허용",gitPush:"- git push만 차단",rmRf:"- 재귀 삭제 차단",npm:"- 모든 npm 명령 허용"},codex:{permissionMode:"권한 모드",description:"Codex가 파일 수정 및 명령어 실행을 처리하는 방식을 제어합니다",modes:{default:{title:"기본",description:"신뢰할 수 있는 명령어(ls, cat, grep, git status 등)만 자동 실행됩니다. 다른 명령어는 건너뜁니다. 워크스페이스에 쓰기 가능."},acceptEdits:{title:"편집 허용",description:"워크스페이스 내에서 모든 명령어가 자동 실행됩니다. 샌드박스 내 완전 자동 모드."},bypassPermissions:{title:"권한 우회",description:"제한 없는 전체 시스템 접근. 모든 명령어가 전체 디스크 및 네트워크 접근 권한으로 자동 실행됩니다. 주의해서 사용하세요."}},technicalDetails:"기술 상세",technicalInfo:{default:"sandboxMode=workspace-write, approvalPolicy=untrusted. 신뢰할 수 있는 명령어: cat, cd, grep, head, ls, pwd, tail, git status/log/diff/show, find(-exec 제외) 등.",acceptEdits:"sandboxMode=workspace-write, approvalPolicy=never. 프로젝트 디렉토리 내에서 모든 명령어 자동 실행.",bypassPermissions:"sandboxMode=danger-full-access, approvalPolicy=never. 전체 시스템 접근, 신뢰할 수 있는 환경에서만 사용하세요.",overrideNote:"채팅 인터페이스의 모드 버튼을 사용하여 세션별로 재정의할 수 있습니다."}},actions:{add:"추가"}},xce={title:"MCP 서버",description:{claude:"Model Context Protocol 서버는 Claude에 추가 도구와 데이터 소스를 제공합니다",cursor:"Model Context Protocol 서버는 Cursor에 추가 도구와 데이터 소스를 제공합니다",codex:"Model Context Protocol 서버는 Codex에 추가 도구와 데이터 소스를 제공합니다"},addButton:"MCP 서버 추가",empty:"설정된 MCP 서버 없음",serverType:"유형",scope:{local:"로컬",user:"사용자"},config:{command:"명령어",url:"URL",args:"인수",environment:"환경"},tools:{title:"도구",count:"({{count}}):",more:"+{{count}}개 더"},actions:{edit:"서버 편집",delete:"서버 삭제"},help:{title:"Codex MCP 정보",description:"Codex는 stdio 기반 MCP 서버를 지원합니다. 추가 도구와 리소스로 Codex의 기능을 확장하는 서버를 추가할 수 있습니다."}},yce={title:"플러그인",description:"커스텀 플러그인으로 인터페이스를 확장하세요. git에서 설치하거나 ~/.pixcode/plugins/ 폴더에 직접 추가할 수 있습니다.",installPlaceholder:"https://github.com/user/my-plugin",installButton:"설치",installing:"설치 중…",securityWarning:"소스 코드를 검토했거나 신뢰할 수 있는 작성자의 플러그인만 설치하세요.",scanningPlugins:"플러그인 스캔 중…",noPluginsInstalled:"설치된 플러그인이 없습니다",pullLatest:"git에서 최신 버전 가져오기",noGitRemote:"git 리모트가 없음 — 업데이트 불가",uninstallPlugin:"플러그인 삭제",confirmUninstall:"다시 클릭하여 확인",confirmUninstallMessage:"{{name}} 플러그인을 삭제하시겠습니까? 이 작업은 되돌릴 수 없습니다.",cancel:"취소",remove:"삭제",updateFailed:"업데이트 실패",installFailed:"설치 실패",uninstallFailed:"삭제 실패",toggleFailed:"토글 실패",buildYourOwn:"나만의 플러그인 만들기",starter:"스타터",docs:"문서",starterPlugin:{name:"프로젝트 통계",badge:"스타터",description:"프로젝트의 파일 수, 코드 라인 수, 파일 유형별 분석 및 최근 활동을 확인합니다.",install:"설치"},morePlugins:"더 보기",enable:"활성화",disable:"비활성화",installAriaLabel:"플러그인 git 저장소 URL",tab:"탭",runningStatus:"실행 중"},vce={title:"접속",description:"이 셀프 호스팅 Pixcode 서버에 접속하는 방법을 선택합니다. 먼저 같은 네트워크에서 확인하고, 원격 접속은 보안 터널, Tailscale 또는 자체 도메인을 사용합니다.",refresh:"새로고침",copy:"복사",copied:"복사됨",save:"접속 경로 저장",check:"URL 확인",qrAlt:"{{url}} QR",guide:{title:"먼저 접속 방식을 선택",description:"네트워크 용어를 몰라도 됩니다. 상황에 맞는 항목을 고르고 링크를 복사하거나 휴대폰으로 QR을 스캔하세요."},options:{sameNetwork:{title:"같은 Wi-Fi/LAN",description:"기기가 Pixcode 서버와 같은 공유기 또는 사무실 네트워크에 있을 때 사용합니다."},secureTunnel:{title:"임시 공개 링크",description:"Cloudflare/ngrok 터널을 시작하면 Pixcode가 공개 URL과 QR을 보여줍니다."},tailscale:{title:"비공개 팀 링크",description:"공개 도메인이나 라우터 설정 없이 비공개 접속이 필요할 때 사용합니다."},customDomain:{title:"자체 도메인",description:"HTTPS, 리버스 프록시 또는 Cloudflare Tunnel 호스트명이 이미 있을 때 사용합니다."}},status:{ready:"준비됨",detecting:"감지 중",guided:"가이드",configured:"설정됨",optional:"선택 사항"},links:{title:"사용 가능한 링크",description:"접속할 기기 또는 팀원에게 맞는 URL을 복사합니다.",local:"로컬",tailscale:"Tailscale 비공개 링크",empty:"아직 감지된 접속 링크가 없습니다."},local:{title:"같은 네트워크 접속",description:"첫 테스트에 가장 좋습니다. 같은 Wi-Fi 또는 LAN에서 QR을 스캔하거나 링크를 복사합니다.",thisDevice:"이 컴퓨터에서만",loading:"같은 네트워크 링크 감지 중...",empty:"LAN 링크를 찾지 못했습니다. 네트워크 연결을 확인하고 새로고침하세요.",saveLabel:"같은 네트워크 접속",save:"이 LAN 링크 저장"},tunnel:{title:"보안 터널",description:"고정 도메인이 없어도 Pixcode가 cloudflared 또는 ngrok을 실행하고 공개 URL을 표시할 수 있습니다.",secureLink:"공개 링크와 QR",help:"시작을 누르세요. cloudflared 또는 ngrok이 설치되어 있으면 Pixcode가 임시 HTTPS 주소와 QR을 만듭니다.",running:"터널 실행 중",start:"터널 시작",stop:"터널 중지",save:"이 터널 URL 저장",saveLabel:"보안 터널 접속",qrLabel:"보안 터널",installTitle:"터널 설정 필요",installNeeded:"먼저 cloudflared 또는 ngrok을 설치한 뒤 다시 터널을 시작하세요."},tailscale:{title:"Tailscale 비공개 접속",description:"Tailscale은 선택형 비공개 네트워크 앱입니다. 서버와 사용자 기기에 설치하고 같은 팀으로 로그인하면 Pixcode가 비공개 URL을 감지합니다.",save:"이 Tailscale URL 저장",saveLabel:"Tailscale 비공개 접속",openInstall:"Tailscale 설치 열기",steps:{installServer:"Pixcode가 실행되는 컴퓨터 또는 서버에 Tailscale을 설치합니다.",installUserDevice:"Pixcode를 열 휴대폰, 노트북 또는 팀원 기기에 Tailscale을 설치합니다.",login:"두 기기에서 같은 Tailscale 계정 또는 팀으로 로그인합니다.",refresh:"여기로 돌아와 새로고침을 누르면 Pixcode가 비공개 URL을 보여줍니다."}},advanced:{title:"고급: 고정 도메인",description:"LAN URL, Tailscale URL, Cloudflare Tunnel 호스트명 또는 HTTPS 도메인이 이미 있을 때 저장합니다.",badge:"고급"},setup:{title:"고정 접속 경로",description:"사용자가 사용할 URL을 저장합니다. LAN, Tailscale, Cloudflare Tunnel 또는 자체 도메인이 될 수 있습니다."},modes:{lan:"LAN",tailscale:"Tailscale",cloudflare_tunnel:"Cloudflare Tunnel",custom_domain:"자체 도메인"},fields:{label:"라벨",url:"URL",port:"대상 포트"},health:{reachable:"Pixcode에 접속할 수 있습니다",unreachable:"Pixcode에 접속할 수 없습니다"},configured:{title:"저장된 접속 경로",description:"이 경로는 역할에 따라 관리자, 프로젝트 파트너, 프로젝트 작업자에게 제공됩니다.",empty:"저장된 접속 경로가 없습니다.",noUrl:"URL 없음",public:"공개",private:"비공개"},team:{title:"사용자 접속 방법",description:"Admin system에서 사용자를 만들고 Control Room에서 프로젝트 역할을 지정한 뒤 Access URL을 공유하세요. 지정된 프로젝트에는 전체 관리자 권한이 필요하지 않습니다."}},wce={title:"Hermes Agent",description:"Hermes Agent를 Pixcode가 제어하는 프로젝트 터미널로 관리하고, MCP로 프로젝트, 제공자 상태, 표시되는 CLI 실행에 접근합니다.",statusTitle:"설치 상태",statusFailed:"Hermes Agent를 확인할 수 없습니다.",ready:"준비됨",notInstalled:"설치되지 않음",start:"Hermes 시작",install:"설치",repair:"명령 복구",refresh:"새로 고침",gatewayTitle:"REST API 게이트웨이",gatewayStatusFailed:"Hermes REST 게이트웨이를 확인할 수 없습니다.",gatewayStartFailed:"Hermes REST 게이트웨이를 시작할 수 없습니다.",gatewayStopFailed:"Hermes REST 게이트웨이를 중지할 수 없습니다.",gatewayProbeFailed:"Hermes REST 프로브에 실패했습니다.",gatewayRunning:"REST 게이트웨이 실행 중",gatewayStopped:"REST 게이트웨이 중지됨",gatewayStart:"REST 시작",gatewayProbe:"REST 테스트",gatewayStop:"중지",gatewayProbeOk:"REST probe passed: health, capabilities, models, and a real prompt responded.",commandsTitle:"Hermes CLI 설정",commandsDescription:"Pixcode에서 실제 Hermes 터미널 마법사를 엽니다. 모델 및 제공자로 Codex, OpenRouter, Anthropic, Gemini 등 제공자를 연결합니다.",commandsInstallFirst:"CLI 설정을 열기 전에 Hermes를 설치하세요.",commands:{cron:{title:"Cron jobs",description:"Inspect the scheduler, list jobs, and confirm recurring project tasks can run through the Hermes gateway."},mcp:{title:"MCP servers",description:"Manage MCP servers and reload Pixcode MCP when tool configuration changes."},update:{title:"Update Hermes",description:"Pull the latest Hermes fixes and reinstall dependencies without interactive prompts."}},pixcodeControlTitle:"Pixcode 제어",pixcodeControlDescription:"Pixcode는 실행 전에 Hermes MCP 서버를 구성하므로 Hermes가 워크스페이스를 검사하고 필요할 때 Pixcode UI 안에서 제공자 터미널을 열 수 있습니다.",diagnosticsTitle:"Integration diagnostics",diagnosticsDescription:"Checks Hermes model/auth, native toolsets, Pixcode MCP tools, REST gateway, and cron API wiring without exposing secrets.",diagnosticsFailed:"Unable to read Hermes diagnostics.",diagnosticsModel:"Model",diagnosticsTools:"Tools",diagnosticsCron:"Cron",diagnosticsIssues:"Issues",diagnosticsAuthReady:"Provider auth is present.",diagnosticsAuthMissing:"Provider auth needs attention.",diagnosticsMcpTools:"Pixcode MCP: {{count}} tools, {{missing}} missing",diagnosticsCronReady:"Hermes cron toolset is available.",diagnosticsCronMissing:"Hermes cron needs hermes-cli toolset.",diagnosticsCronApiReady:"Gateway /api/jobs responded.",diagnosticsCronApiFailed:"Gateway /api/jobs did not respond.",diagnosticsNoIssues:"No blocking issue detected.",diagnosticsIssueCount:"{{count}} issue(s) detected.",unknown:"Unknown"},kce={title:ece,tabs:tce,account:rce,mcp:nce,appearance:ace,actions:ice,quickSettings:sce,terminalShortcuts:oce,mainTabs:lce,notifications:cce,appearanceSettings:dce,mcpForm:uce,saveStatus:pce,footerActions:mce,git:hce,apiKeys:fce,agents:gce,permissions:bce,mcpServers:xce,pluginSettings:yce,access:vce,hermes:wce},Sce={title:"다시 오신 것을 환영합니다",description:"Pixcode 계정에 로그인하세요",username:"사용자명",password:"비밀번호",submit:"로그인",loading:"로그인 중...",errors:{invalidCredentials:"사용자명 또는 비밀번호가 잘못되었습니다",requiredFields:"모든 항목을 입력해주세요",networkError:"네트워크 오류. 다시 시도해주세요."},placeholders:{username:"사용자명을 입력하세요",password:"비밀번호를 입력하세요"}},Cce={title:"계정 생성",username:"사용자명",password:"비밀번호",confirmPassword:"비밀번호 확인",submit:"계정 생성",loading:"계정 생성 중...",errors:{passwordMismatch:"비밀번호가 일치하지 않습니다",usernameTaken:"이미 사용 중인 사용자명입니다",weakPassword:"비밀번호가 너무 약합니다"}},Nce={title:"로그아웃",confirm:"정말 로그아웃하시겠습니까?",button:"로그아웃"},Ece={login:Sce,register:Cce,logout:Nce},Tce={title:"프로젝트",newProject:"새 프로젝트",deleteProject:"프로젝트 제거",renameProject:"프로젝트 이름 변경",noProjects:"프로젝트가 없습니다",loadingProjects:"프로젝트 로딩 중...",searchPlaceholder:"프로젝트 검색...",projectNamePlaceholder:"프로젝트 이름",starred:"즐겨찾기",all:"전체",untitledSession:"제목 없는 세션",newSession:"새 세션",codexSession:"Codex 세션",fetchingProjects:"Claude 프로젝트와 세션을 가져오는 중",projects:"프로젝트",detectedFromHistory:"기록에서 감지됨",noMatchingProjects:"일치하는 프로젝트 없음",tryDifferentSearch:"검색어를 변경해보세요",runClaudeCli:"프로젝트 디렉토리에서 Claude CLI를 실행하여 시작하세요"},Ace={title:"Pixcode",subtitle:"AI 코딩 어시스턴트 UI"},jce={title:"세션",newSession:"새 세션",deleteSession:"세션 삭제",renameSession:"세션 이름 변경",noSessions:"세션이 없습니다",loadingSessions:"세션 로딩 중...",unnamed:"이름 없음",loading:"로딩 중...",showMore:"더 많은 세션 보기"},Ice={viewEnvironments:"환경 보기",hideSidebar:"사이드바 숨기기",createProject:"새 프로젝트 생성",refresh:"프로젝트 및 세션 새로고침 (Ctrl+R)",renameProject:"프로젝트 이름 변경 (F2)",deleteProject:"사이드바에서 프로젝트 제거 (Delete)",addToFavorites:"즐겨찾기에 추가",removeFromFavorites:"즐겨찾기에서 제거",editSessionName:"세션 이름 직접 편집",deleteSession:"이 세션 영구 삭제",save:"저장",cancel:"취소"},Rce={chat:"채팅",files:"파일",git:"Git",terminal:"터미널",tasks:"작업"},_ce={refresh:"새로고침",settings:"설정",collapseAll:"모두 접기",expandAll:"모두 펼치기",cancel:"취소",save:"저장",delete:"삭제",rename:"이름 변경",joinCommunity:"커뮤니티 참여",reportIssue:"문제 신고",starOnGithub:"GitHub에서 스타",controlRoom:"컨트롤 룸",controlRoomDescription:"관리, 접근, 실행"},Pce={openSource:"오픈 소스"},Lce={active:"활성",inactive:"비활성",thinking:"생각 중...",error:"오류",aborted:"중단됨",unknown:"알 수 없음"},Dce={justNow:"방금 전",oneMinuteAgo:"1분 전",minutesAgo:"{{count}}분 전",oneHourAgo:"1시간 전",hoursAgo:"{{count}}시간 전",oneDayAgo:"1일 전",daysAgo:"{{count}}일 전"},Oce={deleteConfirm:"정말 삭제하시겠습니까?",renameSuccess:"이름이 변경되었습니다",deleteSuccess:"삭제되었습니다",errorOccurred:"오류가 발생했습니다",deleteSessionConfirm:"이 세션을 삭제하시겠습니까? 이 작업은 취소할 수 없습니다.",deleteProjectConfirm:"사이드바에서 이 프로젝트를 제거하시겠습니까? 프로젝트 파일, 메모리 및 세션 데이터는 삭제되지 않습니다.",enterProjectPath:"프로젝트 경로를 입력해주세요",deleteSessionFailed:"세션 삭제 실패. 다시 시도해주세요.",deleteSessionError:"세션 삭제 오류. 다시 시도해주세요.",renameSessionFailed:"세션 이름 변경 실패. 다시 시도해주세요.",renameSessionError:"세션 이름 변경 오류. 다시 시도해주세요.",deleteProjectFailed:"프로젝트 제거 실패. 다시 시도해주세요.",deleteProjectError:"프로젝트 제거 오류. 다시 시도해주세요.",createProjectFailed:"프로젝트 생성 실패. 다시 시도해주세요.",createProjectError:"프로젝트 생성 오류. 다시 시도해주세요."},Mce={updateAvailable:"업데이트 가능"},Fce={deleteProject:"프로젝트 제거",deleteSession:"세션 삭제",confirmDelete:"이 프로젝트를 어떻게 하시겠습니까:",sessionCount_one:"이 프로젝트에는 {{count}}개의 대화가 있습니다.",sessionCount_other:"이 프로젝트에는 {{count}}개의 대화가 있습니다.",removeFromSidebar:"사이드바에서만 제거",deleteAllData:"모든 데이터 영구 삭제",allConversationsDeleted:"프로젝트가 사이드바에서 제거됩니다. 파일, 메모리 및 세션 데이터는 보존됩니다.",cannotUndo:"나중에 프로젝트를 다시 추가할 수 있습니다."},zce={section:"오케스트레이션",fallbackTitle:"오케스트레이션 실행"},Bce={projects:Tce,app:Ace,sessions:jce,tooltips:Ice,navigation:Rce,actions:_ce,branding:Pce,status:Lce,time:Dce,messages:Oce,version:Mce,deleteConfirmation:Fce,orchestration:zce},Uce={copy:"복사",copied:"복사됨",copyCode:"코드 복사"},$ce={copy:"메시지 복사",copied:"메시지 복사됨",selectFormat:"복사 형식 선택",copyAsMarkdown:"마크다운으로 복사",copyAsText:"텍스트로 복사"},Hce={user:"U",error:"오류",tool:"도구",claude:"Claude",cursor:"Cursor",codex:"Codex",gemini:"Gemini",qwen:"Qwen Code"},Gce={settings:"도구 설정",error:"도구 오류",result:"도구 결과",viewParams:"입력 파라미터 보기",viewRawParams:"Raw 파라미터 보기",viewDiff:"편집 Diff 보기:",creatingFile:"새 파일 생성:",updatingTodo:"Todo 리스트 업데이트",read:"읽기",readFile:"파일 읽기",updateTodo:"Todo 리스트 업데이트",readTodo:"Todo 리스트 읽기",searchResults:"결과"},Vce={found:"{{count}}개의 {{type}} 발견",file:"파일",files:"파일",pattern:"패턴:",in:"위치:"},Wce={updated:"파일이 업데이트되었습니다",created:"파일이 생성되었습니다",written:"파일이 작성되었습니다",diff:"Diff",newFile:"새 파일",viewContent:"파일 내용 보기",viewFullOutput:"전체 출력 보기 ({{count}}자)",contentDisplayed:"파일 내용이 위의 Diff 보기에 표시됩니다"},qce={title:"대화형 프롬프트",waiting:"CLI에서 응답을 기다리는 중",instruction:"Claude가 실행 중인 터미널에서 옵션을 선택해주세요.",selectedOption:"✓ Claude가 옵션 {{number}}을(를) 선택했습니다",instructionDetail:"CLI에서 화살표 키 또는 숫자를 입력하여 이 옵션을 대화형으로 선택합니다."},Kce={title:"생각 중...",emoji:"💭 생각 중..."},Yce={response:"JSON 응답"},Zce={grant:"{{tool}}에 대한 권한 부여",added:"권한이 추가되었습니다",addTo:"{{entry}}을(를) 허용된 도구에 추가합니다.",retry:"권한이 저장되었습니다. 도구를 사용하려면 요청을 재시도하세요.",error:"권한을 업데이트할 수 없습니다. 다시 시도해주세요.",openSettings:"설정 열기"},Xce={updated:"Todo 리스트가 업데이트되었습니다",current:"현재 Todo 리스트"},Jce={viewPlan:"📋 구현 계획 보기",title:"구현 계획"},Qce={resetAt:"Claude 사용량 한도에 도달했습니다. 한도는 **{{time}} {{timezone}}** - {{date}}에 초기화됩니다"},ede={permissionMode:"권한 모드",modes:{default:"기본 모드",acceptEdits:"편집 허용",bypassPermissions:"권한 우회",plan:"Plan 모드"},descriptions:{default:"신뢰할 수 있는 명령어(ls, cat, grep, git status 등)만 자동 실행됩니다. 다른 명령어는 건너뜁니다. 워크스페이스에 쓰기 가능.",acceptEdits:"워크스페이스 내에서 모든 명령어가 자동 실행됩니다. 샌드박스 내 완전 자동 모드.",bypassPermissions:"제한 없는 전체 시스템 접근. 모든 명령어가 전체 디스크 및 네트워크 접근 권한으로 자동 실행됩니다. 주의해서 사용하세요.",plan:"계획 모드 - 명령어가 실행되지 않습니다"},technicalDetails:"기술 상세"},tde={placeholder:"/를 입력하여 명령어, @를 입력하여 파일, 또는 {{provider}}에게 무엇이든 물어보세요...",placeholderDefault:"메시지를 입력하세요...",disabled:"입력 비활성화",attachFiles:"파일 첨부",attachImages:"이미지 첨부",send:"전송",stop:"중지",clickToChangeMode:"클릭하여 권한 모드 변경 (또는 입력창에서 Tab)",showAllCommands:"모든 명령어 보기",clearInput:"입력 지우기",scrollToBottom:"맨 아래로 스크롤"},rde={selector:{title:"Thinking 모드",description:"확장된 thinking은 Claude에게 대안을 평가할 시간을 더 줍니다",active:"활성",tip:"높은 thinking 모드는 시간이 더 걸리지만 더 철저한 분석을 제공합니다"},modes:{none:{name:"Standard",description:"일반 Claude 응답",prefix:""},think:{name:"Think",description:"기본 확장 thinking",prefix:"think"},thinkHard:{name:"Think Hard",description:"더 철저한 평가",prefix:"think hard"},thinkHarder:{name:"Think Harder",description:"대안을 포함한 심층 분석",prefix:"think harder"},ultrathink:{name:"Ultrathink",description:"최대 thinking 예산",prefix:"ultrathink"}},buttonTitle:"Thinking 모드: {{mode}}"},nde={title:"AI 어시스턴트 선택",description:"새 대화를 시작할 프로바이더를 선택하세요",selectModel:"모델 선택",statusUnavailable:"상태를 확인할 수 없음",statusRetryHint:"이 CLI를 확인하지 못했습니다. 다시 시도하려면 누르세요.",retryStatus:"상태 다시 확인",providerInfo:{anthropic:"Anthropic 제공",openai:"OpenAI 제공",cursorEditor:"AI 코드 에디터",google:"Google 제공"},readyPrompt:{claude:"{{model}} 모델로 Claude를 사용할 준비가 되었습니다. 아래에 메시지를 입력하세요.",cursor:"{{model}} 모델로 Cursor를 사용할 준비가 되었습니다. 아래에 메시지를 입력하세요.",codex:"{{model}} 모델로 Codex를 사용할 준비가 되었습니다. 아래에 메시지를 입력하세요.",gemini:"{{model}} 모델로 Gemini를 사용할 준비가 되었습니다. 아래에 메시지를 입력하세요.",default:"시작하려면 위에서 제공자를 선택하세요"}},ade={continue:{title:"대화 계속하기",description:"코드에 대해 질문하거나, 변경을 요청하거나, 개발 작업에 도움을 받으세요"},loading:{olderMessages:"이전 메시지 로딩 중...",sessionMessages:"세션 메시지 로딩 중..."},messages:{showingOf:"{{total}}개 중 {{shown}}개 표시",scrollToLoad:"위로 스크롤하여 더 로드",showingLast:"마지막 {{count}}개 메시지 표시 (총 {{total}}개)",loadEarlier:"이전 메시지 로드",loadAll:"모든 메시지 로드",loadingAll:"모든 메시지 로딩 중...",allLoaded:"모든 메시지 로드 완료",perfWarning:'모든 메시지가 로드됨 - 스크롤이 느려질 수 있습니다. "맨 아래로 스크롤"을 클릭하면 성능이 복구됩니다.'}},ide={selectProject:{title:"프로젝트 선택",description:"해당 디렉토리에서 대화형 Shell을 열 프로젝트를 선택하세요"},status:{newSession:"새 세션",initializing:"초기화 중...",restarting:"재시작 중..."},actions:{disconnect:"연결 끊기",disconnectTitle:"Shell 연결 끊기",restart:"재시작",restartTitle:"Shell 재시작 (먼저 연결 끊기)",connect:"Shell에서 계속",connectTitle:"Shell에 연결"},loading:"터미널 로딩 중...",connecting:"Shell에 연결 중...",startSession:"새 Claude 세션 시작",startProviderSession:"새 {{provider}} 세션 시작",resumeSession:"세션 재개: {{displayName}}...",runCommand:"{{projectName}}에서 {{command}} 실행",startCli:"{{projectName}}에서 Claude CLI 시작",startProviderCli:"{{projectName}}에서 {{provider}} 시작",defaultCommand:"명령어"},sde={actions:{thinking:"Thinking",processing:"Processing",analyzing:"Analyzing",working:"Working",computing:"Computing",reasoning:"Reasoning"},state:{live:"Live",paused:"Paused"},elapsed:{seconds:"{{count}}s",minutesSeconds:"{{minutes}}m {{seconds}}s",label:"{{time}} elapsed",startingNow:"Starting now"},controls:{stopGeneration:"Stop Generation",pressEscToStop:"Press Esc anytime to stop"},providers:{assistant:"Assistant"}},ode={startChatWithProvider:"{{provider}}와 채팅을 시작하려면 프로젝트를 선택하세요"},lde={nextTaskPrompt:"다음 작업 시작"},cde={codeBlock:Uce,copyMessage:$ce,messageTypes:Hce,tools:Gce,search:Vce,fileOperations:Wce,interactive:qce,thinking:Kce,json:Yce,permissions:Zce,todo:Xce,plan:Jce,usageLimit:Qce,codex:ede,input:tde,thinkingMode:rde,providerSelection:nde,session:ade,shell:ide,claudeStatus:sde,projectSelection:ode,tasks:lde},dde={changes:"변경사항",previousChange:"이전 변경",nextChange:"다음 변경",hideDiff:"Diff 하이라이트 숨기기",showDiff:"Diff 하이라이트 표시",settings:"에디터 설정",collapse:"에디터 접기",expand:"에디터 전체 너비로 펼치기"},ude="{{fileName}} 로딩 중...",pde={showingChanges:"변경사항 표시"},mde={download:"파일 다운로드",save:"저장",saving:"저장 중...",saved:"저장됨!",exitFullscreen:"전체화면 종료",fullscreen:"전체화면",close:"닫기"},hde={lines:"줄:",characters:"문자:",shortcuts:"Ctrl+S로 저장 • Esc로 닫기"},fde={title:"바이너리 파일",message:'파일 "{{fileName}}"은(는) 바이너리 파일이므로 텍스트 편집기에서 표시할 수 없습니다.'},gde={toolbar:dde,loading:ude,header:pde,actions:mde,footer:hde,binaryFile:fde},bde={save:"保存",cancel:"取消",delete:"删除",create:"创建",edit:"编辑",close:"关闭",confirm:"确认",submit:"提交",retry:"重试",refresh:"刷新",search:"搜索",clear:"清除",copy:"复制",download:"下载",upload:"上传",browse:"浏览"},xde={chat:"聊天",shell:"终端",files:"文件",git:"源代码管理",changes:"更改",liveView:"实时预览",tasks:"任务",remote:"远程",controlRoom:"控制",orchestration:"编排"},yde={loading:"加载中...",success:"成功",error:"错误",failed:"失败",pending:"待处理",completed:"已完成",inProgress:"进行中"},vde={savedSuccessfully:"保存成功",deletedSuccessfully:"删除成功",updatedSuccessfully:"更新成功",operationFailed:"操作失败",networkError:"网络错误,请检查您的连接。",unauthorized:"未授权,请登录。",notFound:"未找到",invalidInput:"输入无效",requiredField:"此字段为必填项",unknownError:"发生未知错误"},wde={settings:"设置",home:"首页",back:"返回",next:"下一步",previous:"上一步",logout:"退出登录"},kde={language:"语言",theme:"主题",darkMode:"深色模式",lightMode:"浅色模式",name:"名称",description:"描述",enabled:"已启用",disabled:"已禁用",optional:"可选",version:"版本",select:"选择",selectAll:"全选",deselectAll:"取消全选"},Sde={justNow:"刚刚",minutesAgo:"{{count}} 分钟前",hoursAgo:"{{count}} 小时前",daysAgo:"{{count}} 天前",yesterday:"昨天"},Cde={newFile:"新建文件",newFolder:"新建文件夹",rename:"重命名",move:"移动",copyPath:"复制路径",openInEditor:"在编辑器中打开"},Nde={loading:"正在加载 Pixcode",settingUpWorkspace:"正在设置您的工作空间...",chooseProject:"选择您的项目",selectProjectDescription:"从侧边栏选择一个项目以开始使用 Claude 进行编程。每个项目包含您的聊天会话和文件历史。",tip:"提示",createProjectMobile:"点击上方的菜单按钮以访问项目",createProjectDesktop:"点击侧边栏中的文件夹图标以创建新项目",newSession:"新会话",untitledSession:"未命名会话",projectFiles:"项目文件",landing:{title:"启动 Pixcode 工作区",description:"选择一个项目、开始新聊天,或用一个目标启动编排。编排会管理你选择的 CLI Agent,显示每一步,并直接展示错误。",startOrchestration:"启动编排",startOrchestrationDescription:"自动创建项目,并打开带有 Agent 控制和运行历史的编排界面。",startChat:"开始新聊天",startChatDescription:"自动创建文件夹,并用单个 Agent 打开普通聊天界面。",sidebarHint:"从侧边栏选择现有项目时,聊天历史、文件、git 状态、任务和编排会保留在同一个主界面中。"}},Ede={loading:"正在加载文件...",files:"文件",simpleView:"简单视图",compactView:"紧凑视图",detailedView:"详细视图",searchPlaceholder:"搜索文件和文件夹...",clearSearch:"清除搜索",name:"名称",size:"大小",modified:"修改时间",permissions:"权限",noFilesFound:"未找到文件",checkProjectPath:"检查项目路径是否可访问",noMatchesFound:"未找到匹配项",tryDifferentSearch:"尝试不同的搜索词或清除搜索",justNow:"刚刚",minAgo:"{{count}} 分钟前",hoursAgo:"{{count}} 小时前",daysAgo:"{{count}} 天前",newFile:"新建文件 (Cmd+N)",newFolder:"新建文件夹 (Cmd+Shift+N)",refresh:"刷新",collapseAll:"全部折叠",context:{rename:"重命名",delete:"删除",copyPath:"复制路径",download:"下载",newFile:"新建文件",newFolder:"新建文件夹",refresh:"刷新",menuLabel:"文件上下文菜单",loading:"加载中..."}},Tde={title:"创建新项目",steps:{type:"类型",configure:"配置",confirm:"确认"},step1:{question:"您已经有工作区,还是想创建一个新的工作区?",existing:{title:"现有工作区",description:"我的服务器上已经有工作区,只需要将其添加到项目列表中"},new:{title:"新建工作区",description:"创建一个新工作区,可选择从 GitHub 仓库克隆"},githubClone:{title:"从 GitHub 克隆",description:"选择目标文件夹并将仓库克隆到其中"},subfolder:{title:"创建子文件夹",description:"选择父文件夹并在其中创建新的子文件夹"}},step2:{existingPath:"工作区路径",newPath:"工作区路径",subfolderParentPath:"父文件夹",subfolderParentHelp:"将创建新子文件夹的父文件夹路径",subfolderName:"子文件夹名称",subfolderNameHelp:"将以此名称在父文件夹内创建新文件夹",existingPlaceholder:"/path/to/existing/workspace",newPlaceholder:"/path/to/new/workspace",existingHelp:"您现有工作区目录的完整路径",newHelp:"工作区目录的完整路径",githubUrl:"GitHub URL(可选)",githubPlaceholder:"https://github.com/username/repository",githubHelp:"可选:提供 GitHub URL 以克隆仓库",githubAuth:"GitHub 身份验证(可选)",githubAuthHelp:"仅私有仓库需要。公共仓库无需身份验证即可克隆。",loadingTokens:"正在加载已保存的令牌...",storedToken:"已保存的令牌",newToken:"新令牌",nonePublic:"无(公共)",selectToken:"选择令牌",selectTokenPlaceholder:"-- 选择令牌 --",tokenPlaceholder:"ghp_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",tokenHelp:"此令牌仅用于此操作",publicRepoInfo:"公共仓库不需要身份验证。如果克隆公共仓库,可以跳过提供令牌。",noTokensHelp:"没有可用的已保存令牌。您可以在 设置 → API 密钥 中添加令牌以便重复使用。",optionalTokenPublic:"GitHub 令牌(公共仓库可选)",tokenPublicPlaceholder:"ghp_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx(公共仓库可留空)"},step3:{reviewConfig:"查看您的配置",workspaceType:"工作区类型:",existingWorkspace:"现有工作区",newWorkspace:"新建工作区",subfolderWorkspace:"新子文件夹",path:"路径:",parentPath:"父路径:",subfolderName:"子文件夹名称:",cloneFrom:"克隆自:",authentication:"身份验证:",usingStoredToken:"使用已保存的令牌:",usingProvidedToken:"使用提供的令牌",noAuthentication:"无身份验证",sshKey:"SSH 密钥",existingInfo:"工作区将被添加到您的项目列表中,并可用于 Claude/Cursor 会话。",newWithClone:"仓库将从此文件夹克隆。",newEmpty:"工作区将被添加到您的项目列表中,并可用于 Claude/Cursor 会话。",subfolderInfo:"将在父文件夹内创建新子文件夹并添加到您的项目列表。",cloningRepository:"正在克隆仓库..."},buttons:{cancel:"取消",back:"返回",next:"下一步",createProject:"创建项目",creating:"创建中...",cloning:"正在克隆..."},errors:{selectType:"请选择您已有现有工作区还是想创建新工作区",providePath:"请提供工作区路径",provideSubfolderName:"请为子文件夹提供一个名称",subfolderNameInvalid:"子文件夹名称不能包含路径分隔符或为 . / ..",failedToCreate:"创建工作区失败",failedToCreateFolder:"创建文件夹失败"}},Ade={genericTool:"工具",codes:{generic:{info:{title:"通知"}},permission:{required:{title:"需要处理",body:"{{toolName}} 正在等待你的决策。"}},run:{stopped:{title:"运行已停止",body:"原因:{{reason}}"},failed:{title:"运行失败"}},agent:{notification:{title:"Agent 通知"}}}},jde={title:"有可用更新",newVersionReady:"新版本已准备就绪",currentVersion:"当前版本",latestVersion:"最新版本",whatsNew:"新内容:",viewFullRelease:"查看完整发布",updateProgress:"更新进度:",manualUpgrade:"手动升级:",npmUpgradeCommand:"npm install -g @pixelbyte-software/pixcode@latest",pixcodeUpgradeCommand:"pixcode update --restart-daemon",manualUpgradeHint:"或点击'立即更新'以自动运行更新。",updateCompleted:"更新成功完成!",restartServer:"请重启服务器以应用更改。",updateFailed:"更新失败",buttons:{close:"关闭",later:"稍后",copyCommand:"复制命令",updateNow:"立即更新",updating:"更新中..."},ariaLabels:{closeModal:"关闭版本升级模态框",showSidebar:"显示侧边栏",settings:"设置",updateAvailable:"有可用更新",closeSidebar:"关闭侧边栏"}},Ide={title:"编排",subtitle:"在 {{project}} 中输入一个目标;选择 CLI 工作单元,需要时复制同一种 CLI,并直接分配任务或交给协调器拆分。",refresh:"刷新",goal:"目标",goalPlaceholder:"示例:修复认证界面以适配单端口部署,捕获错误,并用 lint 和 typecheck 验证。",mode:"运行模式",systemPlan:"系统计划",noMode:"未选择模式",loadingPlan:"正在加载 Agent 计划。",start:"启动团队",starting:"正在启动",needAgent:"至少启用一个 CLI 工作单元。",startFailed:"无法启动 workflow。",cliControl:"CLI 团队",enabledCount:"已启用 {{count}} 个",enabled:"启用",disabled:"禁用",history:"历史",emptyHistory:"还没有运行记录。输入目标并启动 Agent。",steps:"{{done}}/{{total}} 步",notSelected:"未选择运行",notSelectedDescription:"选择以前的运行或启动新目标。Agent 消息、错误、变更摘要和预览输出会显示在这里。",loadFailed:"无法加载运行详情。",loadingRun:"正在加载运行...",agentSteps:"Agent 步骤",noStepOutput:"没有步骤输出。",agentMessages:"Agent 消息",noAgentMessages:"此 Agent 尚未生成消息。如果运行失败,真实 CLI 错误会显示在上方。",outputs:"输出",noOutputs:"还没有变更摘要、预览或命令输出。",open:"打开",artifact:{fileDiff:"变更摘要",previewUrl:"预览",commandOutput:"命令输出"},role:{user:"用户",agent:"Agent"},status:{queued:"排队中",running:"运行中",completed:"已完成",failed:"错误",canceled:"已取消",skipped:"已跳过"},nodes:{codex_review:"Codex 审查",gemini_review:"Gemini 审查",claude_review:"Claude 审查",claude_code_review:"Claude 审查",cursor_review:"Cursor 审查",aggregate:"汇总",architect:"规划",implement:"实现",review:"审查",proposal:"方案",critique:"批评",response:"回应",judge:"决策",coordinator:"协调器",final_report:"最终报告"},workflows:{multi_model_review:{name:"多模型审查",description:"启用的 CLI Agent 会分别审查同一个目标,然后由一个启用的 Agent 汇总结果。"},sequential_handoff:{name:"顺序交接",description:"Agent 按顺序规划、实现并审查。禁用的 CLI 步骤会被跳过。"},adversarial_debate:{name:"决策辩论",description:"Agent 提出方案、批评、回应,并生成最终建议。"},agent_team:{name:"智能体团队",description:"协调器读取目标和已启用的 CLI 实例,分配工作,然后汇总结果。"}},adapters:{"claude-code":{label:"Claude Code",role:"CLI 工作单元"},cursor:{label:"Cursor",role:"CLI 工作单元"},codex:{label:"Codex",role:"CLI 工作单元"},gemini:{label:"Gemini",role:"CLI 工作单元"},qwen:{label:"Qwen Code",role:"CLI 工作单元"},opencode:{label:"OpenCode",role:"CLI 工作单元"}},activeCount:"{{active}}/{{total}} 已启用",teamHint:"每一行都是一个 CLI 工作单元。你可以创建多个 Claude、Codex、Cursor、Gemini、Qwen 或 OpenCode,并为每个单元写不同任务。",parallelLimit:"并行上限",addAgent:"添加 {{agent}}",duplicateAgent:"复制 {{agent}}",removeAgent:"移除 {{agent}}",assignment:"任务分配",assignmentPlaceholder:"可选:明确写下这个工作单元要处理什么。留空则由协调器按目标分配。",agentInstance:"{{name}} #{{number}}",taskTitle:"任务",taskTitlePlaceholder:"实现功能",taskDescription:"描述",taskDescriptionPlaceholder:"范围、约束、预期输出",addTask:"添加",runTask:"运行",cancelTask:"取消",dispatchTask:"分配任务",adapter:"适配器",isolation:"隔离",dispatch:"分配",auto:"自动",waitingForStream:"等待流输出...",workflow:"工作流",input:"输入",taskStates:{todo:"待办",in_progress:"进行中",in_review:"审核中",done:"完成",failed:"失败",canceled:"已取消"},isolationKind:{worktree:"Worktree",host:"Host",docker:"Docker"},stop:"停止团队",stopping:"正在停止",cancelFailed:"无法停止工作流。",needRoles:"此模式需要至少为以下角色分配一个已启用的 Agent:{{roles}}。",quickPrompts:{label:"快速提示:",liveTrading:{label:"8024 实时交易界面",prompt:"你好,请创建一个小项目,然后在 8024 端口运行。我需要一个连接 Binance FAPI 的 TradingView 风格设计,包含 TradingView 图表以及左侧星标/收藏系统。请合理拆分工作并自动管理流程。"}},teamHistory:"团队历史",changeSummary:"变更摘要",noChangeSummary:"最终摘要尚未生成。Agent 完成后,这里会显示可读的 Markdown 摘要。",prepareTeamFromReport:"用此报告准备 Agent 团队",prepareTeamTitle:"准备 Agent 团队提示词",prepareTeamDescription:"讨论输出已转换为新的 Agent Team 提示词。你可以编辑它,然后切换到 Agent Team 模式。",usePreparedPrompt:"使用提示词",reportToPromptPrefix:"根据以下讨论/决策报告准备并执行一个 Agent 团队。将需求拆分为任务,为可用 CLI Agent 提出合理分配,并在用户确认后启动。",generatedSummaryTitle:"自动运行摘要",summaryStatus:"整体状态",summarySteps:"已完成步骤",summaryFailures:"失败步骤",summaryCanceled:"已取消步骤",summaryDiffs:"Diff/变更输出",summaryPreviews:"预览输出",summaryErrorPrefix:"错误",assignedWork:"已分配工作",autoAssigned:"自动 / 由协调器决定",stages:{coordinator:"协调器",handoff:"交接",backend:"后端",frontend:"前端",implementation:"实现",review:"审查",repair:"修复",proposal:"提案",critique:"批评",response:"回应",decision:"决策",report:"报告",final_report:"最终报告"},agentRole:"阶段",agentRoles:{auto:"自动",backend:"后端",frontend:"前端",review:"测试 / 审查",implementation:"实现",proposal:"提案",critique:"批评",response:"回应",decision:"决策 / 报告",report:"报告",custom:"自定义"},customRolePlaceholder:"例如:安全、移动端 UX、数据库架构",roleHints:{default:"留空时,协调器会根据目标为此 Agent 分配任务。",agent_team:"可选择后端、前端或审查阶段,也可保持自动。",multi_model_review:"已启用的 Agent 会进行审查;如果选择报告角色,该 Agent 会汇总最终摘要。",sequential_handoff:"Agent 按你选择的顺序运行;任务文本定义每一步的范围。",adversarial_debate:"决策讨论中阶段选择是可选的;留空时系统会按顺序将所选 Agent 分配为提案、批评和回应。"},soloAgent:"仅使用 {{agent}} 运行",soloAgentShort:"单独",cliSettings:"CLI 设置",workspaceTarget:"目标工作区",workspaceTargets:{selectedProject:"已选项目",pixcodeApp:"Pixcode 系统",custom:"自定义路径"},customWorkspacePlaceholder:"/path/to/project",workspaceTargetHint:"智能体将在此目录运行:{{path}}",autoDetect:"自动检测",needWorkspacePath:"请输入自定义工作区路径。",hermesTitle:"Hermes Agent",hermesSubtitle:"Hermes is running inside Pixcode for {{project}} and can coordinate local checks, tests, terminal work, and project operations.",hermesCliControl:"Hermes CLI control"},Rde={title:"控制室",subtitle:"{{target}} 的生产、平台、管理、审计和自托管访问",thisServer:"此服务器",refresh:"刷新",nav:{overview:"概览",production:"生产",admin:"管理",team:"团队",secrets:"密钥",marketplace:"市场",eval:"评估",usage:"用量",security:"安全",access:"访问"},overview:{title:"v1.46 launch surface",description:"Every box below is backed by a v1.44-v1.45 API and is now visible from the UI.",latestAuditEvents:"Latest audit events",remoteAccessOptions:"Remote access options"},metrics:{issueRuns:"Issue-to-PR runs",reviewItems:"Review items",subUsers:"Sub-users",collaborators:"Project collaborators",secrets:"Scoped secrets",marketplace:"Marketplace entries",evalRuns:"Evaluation runs",securityAudits:"Security audits"},sections:{production:{title:"Production loop",description:"Start issue-to-PR runs, parse CI failures, review changes, schedule background jobs, and create checkpoints."},admin:{title:"管理系统",description:"在单个自托管 Pixcode 服务器中创建子用户、禁用账号并查看活动。"},team:{title:"项目协作者",description:"按项目分配 partner、worker、reviewer 和 viewer,而不是让所有人成为全局管理员。"},secrets:{title:"Secret vault",description:"Store scoped env secrets and preview what each provider, project, workflow, Telegram, or API run receives."},marketplace:{title:"MCP/plugin marketplace",description:"Register MCP servers, workflow templates, provider adapters, and notification channels with permission review and health."},eval:{title:"Evaluation harness",description:"Create regression suites and compare provider/model runs with pass rate and latency."},usage:{title:"Cost, token, and latency dashboard",description:"Monitor provider/model/workflow usage for demos and operations."},security:{title:"Security audit mode",description:"Run dependency audit, secret scan, permission audit, and agent output leak detection workflows."},access:{title:"自托管访问",description:"没有固定域名时使用 Tailscale,或配置 Cloudflare Tunnel/custom domain 获得稳定公开 URL。"}},panels:{issueToPr:"Issue-to-PR run",ciRepair:"CI repair parser",reviewQueue:"Review queue",schedulerCheckpoints:"Scheduler and checkpoints",createSubUser:"Create sub-user",rolePermissions:"Role permissions",addCollaborator:"Add collaborator",createSecret:"Create secret",scopedEnvPreview:"Scoped env preview",addMarketplaceEntry:"Add marketplace entry",createSuite:"Create suite",recordRun:"Record run",recordUsageEvent:"Record usage event",createAuditRun:"Create audit run",auditLog:"Audit log",remoteAccessSetup:"Remote access setup"},lists:{recentJobs:"Recent jobs",recentCheckpoints:"Recent checkpoints",subUsers:"Sub-users",collaborators:"Collaborators",includedEnvNames:"Included env names",vaultEntries:"Vault entries",marketplaceEntries:"Marketplace entries",suites:"Suites",runs:"Runs",auditRuns:"Audit runs",configuredAccessPaths:"Configured access paths"},buttons:{queueRun:"Queue run",parseFailure:"Parse failure",createReviewItem:"Create review item",scheduleJob:"Schedule job",createCheckpoint:"Create checkpoint",createUser:"Create user",disable:"Disable",enable:"Enable",addCollaborator:"Add collaborator",storeSecret:"Store secret",previewEnv:"Preview env",saveEntry:"Save entry",markHealthy:"Mark healthy",createSuite:"Create suite",recordRun:"Record run",recordUsage:"Record usage",createAudit:"Create audit",exportJson:"Export JSON",exportCsv:"Export CSV",saveAccessPath:"Save access path",checkUrl:"Check URL",checkTailscale:"Check Tailscale"},placeholders:{githubIssueUrl:"GitHub issue URL",manualTitle:"Manual title fallback",model:"Model",baseBranch:"Base branch",ciLog:"Paste failing CI, lint, typecheck, or build output",reviewTitle:"Review title",notes:"Notes",changedFiles:"Changed files, one per line",jobName:"Job name",cronExpression:"Cron or watch expression",checkpointReason:"Checkpoint reason",backgroundPrompt:"Background agent prompt",checkpointFiles:"Checkpoint changed files, one per line",usernameEmail:"Username or email",temporaryPassword:"Temporary password",userEmailUsername:"User email or username",secretName:"Secret name",envName:"ENV_NAME",secretTarget:"Target project/provider/workflow",secretValue:"Secret value",workflowId:"Workflow id",name:"Name",pluginSource:"Source package or repository",installCommand:"Install command",permissionScopes:"Permission scopes, one per line",suiteName:"Suite name",description:"Description",firstTaskTitle:"First task title",acceptanceCriteria:"Acceptance criteria, one per line",suiteId:"Suite id",latencyMs:"Latency ms",passedCount:"Passed count",failedCount:"Failed count",workflow:"Workflow",inputTokens:"Input tokens",outputTokens:"Output tokens",costUsd:"Cost USD",optionalFindingTitle:"Optional finding title",auditFilter:"Filter audit log by user, project, event, or file",label:"Label",url:"URL",targetPort:"Target port"},labels:{project:"project",path:"path",providerModel:"provider/model",branch:"branch",failedCommands:"Failed commands",files:"Files",lastActive:"Last active",role:"role",tasks:"tasks",pass:"pass",health:"Health",reachable:"reachable",installed:"installed",loggedIn:"logged in"},columns:{provider:"Provider",model:"Model",workflow:"Workflow",runs:"Runs",tokens:"Tokens",cost:"Cost",latency:"Latency",errorRate:"Error rate"},fallback:{selectedProject:"selected project",projectPath:"project path",noneDetected:"none detected",noUrl:"No URL",global:"global",noSource:"No source",regressionSuite:"Regression suite",demoTask:"Demo task",provider:"provider",reviewRequired:"Review required.",notAvailable:"not available"},capabilities:{partner:"can approve actions, manage secrets, and use shell",projectScoped:"project-scoped access only"},teamAccess:{title:"协作者如何访问",stepUsers:"创建子用户",stepUsersDescription:"在 Admin system 中用 member、viewer、project_worker 或 project_partner 等全局角色创建此人。",stepRole:"分配项目角色",stepRoleDescription:"将同一用户加入项目协作者,让他们只看到并操作你选择的项目。",stepLink:"共享访问路径",stepLinkDescription:"共享 Self-hosted access 中配置的 Tailscale、Cloudflare Tunnel、custom domain 或 LAN URL。",paths:"可用访问链接"},badges:{public:"public",private:"private"},empty:{noAuditEvents:"No audit events yet.",noRemoteAccessConfigs:"No remote access configs yet.",noReviewItems:"No review items yet.",noRecentJobs:"No recent jobs yet.",noRecentCheckpoints:"No recent checkpoints yet.",noSubUsers:"No sub-users yet.",noCollaborators:"No project collaborators yet.",noAccessPaths:"No access paths configured yet.",noIncludedEnvNames:"No included env names yet.",noSecrets:"No secrets yet.",noMarketplaceEntries:"No marketplace entries yet.",noSuites:"No suites yet.",noRuns:"No runs yet.",usageSummary:"Usage appears here after provider or workflow events are recorded.",noSecurityAudits:"No security audits yet.",noAuditMatches:"No audit entries match the current filter."}},_de={title:"VS Code 工作区",noProject:"未选择项目",activity:{explorer:"资源管理器",projects:"项目",sourceControl:"源代码管理",terminal:"终端",showPanel:"显示左侧面板",hidePanel:"隐藏左侧面板"},panels:{explorer:"资源管理器",projects:"项目",sourceControl:"源代码管理",terminal:"终端",editor:"编辑器",cli:"CLI",rightTerminal:"终端"},editor:{emptyTitle:"从资源管理器打开文件",closeTab:"关闭 {{file}}",scrollLeft:"向左滚动标签",scrollRight:"向右滚动标签",moreActions:"更多标签操作",closeSplit:"关闭拆分编辑器",context:{close:"关闭",closeAll:"全部关闭",copyPath:"复制路径",splitRight:"向右拆分",splitMoveRight:"向右拆分并移动"}},resize:{left:"调整左侧面板",right:"调整 CLI 面板"},menu:{openProject:"打开项目...",cloneFromGithub:"克隆仓库...",newChat:"新建聊天",openProjects:"打开项目"},projects:{openProject:"打开项目",cloneFromGithub:"克隆",directoryList:"目录",refresh:"刷新项目",emptyTitle:"还没有项目目录",emptyDescription:"打开本地文件夹或克隆仓库即可开始。",selected:"已选择",startChat:"聊天",fileCount:"{{formattedCount}} 个文件",fileCountPending:"正在准备文件",startTitle:"Start a Pixcode workspace",startDescription:"Pick a folder and Pixcode will bind the explorer, terminal, and chat history to that workspace.",workHere:"Work in this folder"},workspace:{empty:"打开项目以创建 Workspace 1。",openFirst:"打开工作区",add:"添加工作区",scrollLeft:"向左滚动工作区",scrollRight:"向右滚动工作区",close:"关闭 {{name}}",closeAction:"关闭工作区",closeOthers:"关闭其他",closeAll:"全部关闭",rename:"重命名",star:"标星",unstar:"取消标星",toggleStar:"标星 {{name}}",moreActions:"工作区操作"},cli:{projectScoped:"项目范围 CLI 终端",chooseTitle:"启动 CLI 终端",chooseDescription:"选择 CLI,然后启动全高终端。",startSelected:"启动 {{provider}}",newSession:"新建 CLI 会话",history:"历史",noHistory:"此项目还没有会话。",projectHistory:"项目历史",checking:"检查中...",ready:"就绪",notInstalled:"未安装",installing:"安装中...",updateAvailable:"更新到 {{version}}",installProvider:"安装 {{provider}}",updateProvider:"更新 {{provider}}",manualInstall:"此 CLI 需要手动安装。",installNoJob:"安装未返回 job id。",installFailed:"安装失败。",installStreamLost:"安装流过早关闭。安装可能仍在运行。",provider:"提供方",installRunning:"正在安装",installDone:"已就绪",installError:"需要处理",showPanel:"显示 CLI 面板",hidePanel:"隐藏 CLI 面板",close:"关闭终端"},terminal:{title:"终端",close:"关闭终端"},hermes:{title:"Hermes Agent",installTitle:"安装 Hermes Agent",description:"项目范围的代理终端。缺少 Hermes 时会先安装,然后在此工作区中打开。",start:"启动 Hermes",install:"安装",newSession:"新建 Hermes 会话",history:"Hermes 历史记录",connect:"连接 Hermes Agent",ready:"就绪",installRunning:"正在通过 Pixcode API 安装 Hermes...",installDone:"Hermes 已安装,Pixcode MCP 已配置。",installError:"Hermes 安装失败。",installReady:"已准备好安装 Hermes。",installWaiting:"正在等待 Hermes 安装日志...",retryInstall:"重试安装",installFailed:"Hermes 安装失败。",installStreamLost:"Hermes 安装流提前关闭。安装可能仍在运行。"}},Pde={buttons:bde,tabs:xde,status:yde,messages:vde,navigation:wde,common:kde,time:Sde,fileOperations:Cde,mainContent:Nde,fileTree:Ede,projectWizard:Tde,notifications:Ade,versionUpdate:jde,orchestration:Ide,controlRoom:Rde,vscodeWorkbench:_de},Lde="设置",Dde={account:"账户",permissions:"权限",mcpServers:"MCP 服务器",appearance:"外观"},Ode={title:"账户",language:"语言",languageLabel:"显示语言",languageDescription:"选择您偏好的界面语言",username:"用户名",email:"邮箱",profile:"个人资料",changePassword:"修改密码"},Mde={title:"MCP 服务器",addServer:"添加服务器",editServer:"编辑服务器",deleteServer:"删除服务器",serverName:"服务器名称",serverType:"服务器类型",config:"配置",testConnection:"测试连接",status:"状态",connected:"已连接",disconnected:"未连接",scope:{label:"范围",user:"用户",project:"项目"}},Fde={title:"外观",theme:"主题",codeEditor:"代码编辑器",editorTheme:"编辑器主题",wordWrap:"自动换行",showMinimap:"显示缩略图",lineNumbers:"行号",fontSize:"字体大小"},zde={saveChanges:"保存更改",resetToDefaults:"重置为默认值",cancelChanges:"取消更改"},Bde={title:"快速设置",sections:{appearance:"外观",toolDisplay:"工具显示",viewOptions:"视图选项",inputSettings:"输入设置",changeAwareness:"掌控中心"},darkMode:"深色模式",autoExpandTools:"自动展开工具",showRawParameters:"显示原始参数",showThinking:"显示思考过程",autoScrollToBottom:"自动滚动到底部",sendByCtrlEnter:"使用 Ctrl+Enter 发送",sendByCtrlEnterDescription:"启用后,按 Ctrl+Enter 发送消息,而不是仅按 Enter。这对于使用输入法的用户可以避免意外发送。",changeAwareness:"掌控中心",changedFiles:{title:"已更改文件",description:"跟踪本地文件更改,并在出现新更改时打开文件面板。",noProject:"选择一个项目以跟踪本地更改。",refresh:"刷新已更改文件",empty:"未检测到本地更改",disabled:"启用掌控中心以监控本地更改。",more:"还有 {{count}} 个文件",lastChecked:"检查于 {{value}}",guideTitle:"右侧面板指南",guideFiles:"已更改文件会在文件面板中以绿色高亮。",guidePanel:"新更改会自动打开分屏面板。",status:{M:"M",A:"A",D:"D",U:"U"}},dragHandle:{dragging:"正在拖拽手柄",closePanel:"关闭设置面板",openPanel:"打开设置面板",draggingStatus:"正在拖拽...",toggleAndMove:"点击切换,拖拽移动"}},Ude={title:"终端快捷键",sectionKeys:"按键",sectionNavigation:"导航",escape:"Escape",tab:"Tab",shiftTab:"Shift+Tab",arrowUp:"上箭头",arrowDown:"下箭头",scrollDown:"滚动到底部",handle:{closePanel:"关闭快捷键面板",openPanel:"打开快捷键面板"}},$de={label:"设置",agents:"智能体",hermes:"Hermes Agent",appearance:"外观",git:"Git",apiTokens:"API 和令牌",notifications:"通知",plugins:"插件",mobile:"移动端使用",telegram:"Telegram",about:"关于",access:"访问"},Hde={title:"通知",description:"控制你希望接收的通知事件。",webPush:{title:"Web 推送通知",enable:"启用推送通知",disable:"关闭推送通知",enabled:"推送通知已启用",loading:"更新中...",unsupported:"此浏览器不支持推送通知。",denied:"推送通知已被阻止,请在浏览器设置中允许。"},events:{title:"事件类型",actionRequired:"需要处理",stop:"运行已停止",error:"运行失败"}},Gde={darkMode:{label:"深色模式",description:"切换浅色和深色主题"},projectSorting:{label:"项目排序",description:"项目在侧边栏中的排列方式",alphabetical:"按字母顺序",recentActivity:"最近活动"},codeEditor:{title:"代码编辑器",theme:{label:"编辑器主题",description:"代码编辑器的默认主题"},wordWrap:{label:"自动换行",description:"在编辑器中默认启用自动换行"},showMinimap:{label:"显示缩略图",description:"在差异视图中显示缩略图以便于导航"},lineNumbers:{label:"显示行号",description:"在编辑器中显示行号"},fontSize:{label:"字体大小",description:"编辑器字体大小(px)"}}},Vde={title:{add:"添加 MCP 服务器",edit:"编辑 MCP 服务器"},importMode:{form:"表单输入",json:"JSON 导入"},scope:{label:"范围",userGlobal:"用户(全局)",projectLocal:"项目(本地)",userDescription:"用户范围:在您机器上的所有项目中可用",projectDescription:"本地范围:仅在选定项目中可用",cannotChange:"编辑现有服务器时无法更改范围"},fields:{serverName:"服务器名称",transportType:"传输类型",command:"命令",arguments:"参数(每行一个)",jsonConfig:"JSON 配置",url:"URL",envVars:"环境变量(KEY=值,每行一个)",headers:"请求头(KEY=值,每行一个)",selectProject:"选择项目..."},placeholders:{serverName:"我的服务"},validation:{missingType:"缺少必填字段:type",stdioRequiresCommand:"stdio 类型需要 command 字段",httpRequiresUrl:"{{type}} 类型需要 url 字段",invalidJson:"无效的 JSON 格式",jsonHelp:"粘贴您的 MCP 服务器配置(JSON 格式)。示例格式:",jsonExampleStdio:'• stdio: {"type":"stdio","command":"npx","args":["@upstash/context7-mcp"]}',jsonExampleHttp:'• http/sse: {"type":"http","url":"https://api.example.com/mcp"}'},configDetails:"配置详细信息(来自 {{configFile}})",projectPath:"路径:{{path}}",actions:{cancel:"取消",saving:"保存中...",addServer:"添加服务器",updateServer:"更新服务器"}},Wde={success:"设置保存成功!",error:"保存设置失败",saving:"保存中..."},qde={save:"保存设置",cancel:"取消"},Kde={title:"Git 配置",description:"配置您的 git 提交身份。这些设置将通过 git config --global 全局应用",name:{label:"Git 名称",help:"您的 git 提交名称"},email:{label:"Git 邮箱",help:"您的 git 提交邮箱"},actions:{save:"保存配置",saving:"保存中..."},status:{success:"保存成功"}},Yde={title:"API 密钥",description:"生成 API 密钥以从其他应用访问外部 API。",newKey:{alertTitle:"⚠️ 保存您的 API 密钥",alertMessage:"这是您唯一一次看到此密钥。请妥善保存。",iveSavedIt:"我已保存"},form:{placeholder:"API 密钥名称(例如:生产服务器)",createButton:"创建",cancelButton:"取消"},newButton:"新建 API 密钥",empty:"尚未创建 API 密钥。",list:{created:"创建时间:",lastUsed:"最后使用:"},confirmDelete:"确定要删除此 API 密钥吗?",status:{active:"激活",inactive:"未激活"},github:{title:"GitHub 令牌",description:"添加 GitHub 个人访问令牌以通过外部 API 克隆私有仓库。",descriptionAlt:"添加 GitHub 个人访问令牌以克隆私有仓库。您也可以直接在 API 请求中传递令牌而无需存储。",addButton:"添加令牌",form:{namePlaceholder:"令牌名称(例如:个人仓库)",tokenPlaceholder:"GitHub 个人访问令牌(ghp_...)",descriptionPlaceholder:"描述(可选)",addButton:"添加令牌",cancelButton:"取消",howToCreate:"如何创建 GitHub 个人访问令牌 →"},empty:"尚未添加 GitHub 令牌。",added:"添加时间:",confirmDelete:"确定要删除此 GitHub 令牌吗?"},apiDocsLink:"API 文档",documentation:{title:"外部 API 文档",description:"了解如何使用外部 API 从您的应用程序触发 Claude/Cursor 会话。",viewLink:"查看 API 文档 →"},loading:"加载中...",version:{updateAvailable:"有可用更新:v{{version}}"}},Zde={authStatus:{checking:"检查中...",connected:"已连接",notConnected:"未连接",disconnected:"已断开",checkingAuth:"正在检查认证状态...",loggedInAs:"登录为 {{email}}",authenticatedUser:"已认证用户"},account:{claude:{description:"Anthropic Claude AI 助手"},cursor:{description:"Cursor AI 驱动的代码编辑器"},codex:{description:"OpenAI Codex AI 助手"},gemini:{description:"Google Gemini AI 助手"},qwen:{description:"阿里巴巴 Qwen Code CLI (Gemini CLI 分支)"}},connectionStatus:"连接状态",login:{title:"登录",reAuthenticate:"重新认证",description:"登录您的 {{agent}} 账户以启用 AI 功能",reAuthDescription:"使用其他账户登录或刷新凭据",button:"登录",reLoginButton:"重新登录"},error:"错误:{{error}}"},Xde={title:"权限设置",skipPermissions:{label:"跳过权限提示(请谨慎使用)",claudeDescription:"等同于 --dangerously-skip-permissions 标志",cursorDescription:"等同于 Cursor CLI 中的 -f 标志",opencodeDescription:"等同于 OpenCode 的 --dangerously-skip-permissions 标志"},allowedTools:{title:"允许的工具",description:"无需权限提示即可自动使用的工具",placeholder:'例如:"Bash(git log:*)" 或 "Write"',quickAdd:"快速添加常用工具:",empty:"未配置允许的工具"},blockedTools:{title:"禁用的工具",description:"无需权限提示即可自动禁用的工具",placeholder:'例如:"Bash(rm:*)"',empty:"未配置禁用的工具"},allowedCommands:{title:"允许的 Shell 命令",description:"无需权限提示即可自动执行的 Shell 命令",placeholder:'例如:"Shell(ls)" 或 "Shell(git status)"',quickAdd:"快速添加常用命令:",empty:"未配置允许的命令"},blockedCommands:{title:"阻止的 Shell 命令",description:"自动阻止的 Shell 命令",placeholder:'例如:"Shell(rm -rf)" 或 "Shell(sudo)"',empty:"未配置阻止的命令"},toolExamples:{title:"工具模式示例:",bashGitLog:"- 允许所有 git log 命令",bashGitDiff:"- 允许所有 git diff 命令",write:"- 允许所有 Write 工具使用",bashRm:"- 阻止所有 rm 命令(危险)"},shellExamples:{title:"Shell 命令示例:",ls:"- 允许 ls 命令",gitStatus:"- 允许 git status",npmInstall:"- 允许 npm install",rmRf:"- 阻止递归删除"},opencodeAllowed:{title:"允许的 Bash 模式",description:"OpenCode 自动批准、无需提示的 Bash 命令模式",placeholder:'如:"git *" 或 "npm test"',quickAdd:"快速添加常用模式:",empty:"尚未配置允许的模式"},opencodeBlocked:{title:"屏蔽的 Bash 模式",description:"OpenCode 始终拒绝的 Bash 命令模式",placeholder:'如:"rm -rf *" 或 "sudo *"',empty:"尚未配置屏蔽的模式"},opencodeExamples:{title:"模式示例:",gitAll:"- 允许所有 git 命令",gitPush:"- 单独屏蔽 git push",rmRf:"- 屏蔽递归删除",npm:"- 允许所有 npm 命令"},codex:{permissionMode:"权限模式",description:"控制 Codex 如何处理文件修改和命令执行",modes:{default:{title:"默认",description:"只有受信任的命令(ls、cat、grep、git status 等)会自动运行。其他命令将被跳过。可以写入工作区。"},acceptEdits:{title:"接受编辑",description:"所有命令在工作区内自动运行。具有沙箱执行的全自动模式。"},bypassPermissions:{title:"绕过权限",description:"完全系统访问,无任何限制。所有命令自动运行,具有完整的磁盘和网络访问权限。请谨慎使用。"}},technicalDetails:"技术详情",technicalInfo:{default:"sandboxMode=workspace-write, approvalPolicy=untrusted。受信任的命令:cat、cd、grep、head、ls、pwd、tail、git status/log/diff/show、find(不带 -exec)等。",acceptEdits:"sandboxMode=workspace-write, approvalPolicy=never。所有命令在项目目录内自动执行。",bypassPermissions:"sandboxMode=danger-full-access, approvalPolicy=never。完全系统访问权限,仅在可信环境中使用。",overrideNote:"您可以使用聊天界面中的模式按钮按会话覆盖此设置。"}},actions:{add:"添加"}},Jde={title:"MCP 服务器",description:{claude:"Model Context Protocol 服务器为 Claude 提供额外的工具和数据源",cursor:"Model Context Protocol 服务器为 Cursor 提供额外的工具和数据源",codex:"Model Context Protocol 服务器为 Codex 提供额外的工具和数据源"},addButton:"添加 MCP 服务器",empty:"未配置 MCP 服务器",serverType:"类型",scope:{local:"本地",user:"用户"},config:{command:"命令",url:"URL",args:"参数",environment:"环境变量"},tools:{title:"工具",count:"({{count}}):",more:"还有 {{count}} 个"},actions:{edit:"编辑服务器",delete:"删除服务器"},help:{title:"关于 Codex MCP",description:"Codex 支持基于 stdio 的 MCP 服务器。您可以添加服务器,通过额外的工具和资源来扩展 Codex 的功能。"}},Qde={title:"插件",description:"通过自定义插件扩展界面。从 git 安装或直接将文件夹放入 ~/.pixcode/plugins/",installPlaceholder:"https://github.com/user/my-plugin",installButton:"安装",installing:"安装中…",securityWarning:"仅安装您已审查过源代码或信任作者的插件。",scanningPlugins:"正在扫描插件…",noPluginsInstalled:"未安装插件",pullLatest:"从 git 拉取最新内容",noGitRemote:"无 git 远程仓库 — 无法更新",uninstallPlugin:"卸载插件",confirmUninstall:"再次点击确认",confirmUninstallMessage:"移除 {{name}}?此操作无法撤销。",cancel:"取消",remove:"移除",updateFailed:"更新失败",installFailed:"安装失败",uninstallFailed:"卸载失败",toggleFailed:"切换失败",buildYourOwn:"构建您自己的插件",starter:"入门模板",docs:"文档",starterPlugin:{name:"项目统计",badge:"入门",description:"查看项目的文件数、代码行数、文件类型分布以及最近活动。",install:"安装"},morePlugins:"更多",enable:"启用",disable:"禁用",installAriaLabel:"插件 git 仓库 URL",tab:"标签",runningStatus:"运行中"},eue={title:"访问",description:"选择用户如何访问这个自托管 Pixcode 服务器。先用同一网络验证;需要远程访问时,再使用安全隧道、Tailscale 或自己的域名。",refresh:"刷新",copy:"复制",copied:"已复制",save:"保存访问路径",check:"检查 URL",qrAlt:"{{url}} 的二维码",guide:{title:"先选择连接方式",description:"不需要懂网络术语。选择符合当前场景的方式,复制链接,或用手机扫描二维码。"},options:{sameNetwork:{title:"同一 Wi-Fi/LAN",description:"设备与 Pixcode 服务器在同一路由器、办公室网络或局域网时使用。"},secureTunnel:{title:"临时公开链接",description:"启动 Cloudflare/ngrok 隧道后,Pixcode 会自动显示公开 URL 和二维码。"},tailscale:{title:"团队私有链接",description:"无需公开域名或路由器设置,即可进行私有团队访问。"},customDomain:{title:"自己的域名",description:"已有 HTTPS、反向代理或 Cloudflare Tunnel 主机名时使用。"}},status:{ready:"就绪",detecting:"检测中",guided:"引导",configured:"已配置",optional:"可选"},links:{title:"可用链接",description:"为需要连接的设备或成员复制正确 URL。",local:"本地",tailscale:"Tailscale 私有链接",empty:"尚未检测到访问链接。"},local:{title:"同一网络访问",description:"最适合第一次测试:从同一 Wi-Fi 或 LAN 连接。手机扫码,或复制链接给同网成员。",thisDevice:"仅此电脑",loading:"正在检测同网链接...",empty:"未检测到 LAN 链接。请确认服务器已联网并刷新。",saveLabel:"同一网络访问",save:"保存此 LAN 链接"},tunnel:{title:"安全隧道",description:"没有固定域名时,Pixcode 可以启动 cloudflared 或 ngrok,并在这里显示公开 URL。",secureLink:"公开链接和二维码",help:"点击启动。如果已安装 cloudflared 或 ngrok,Pixcode 会自动创建临时 HTTPS 地址和二维码。",running:"隧道运行中",start:"启动隧道",stop:"停止隧道",save:"保存此隧道 URL",saveLabel:"安全隧道访问",qrLabel:"安全隧道",installTitle:"需要设置隧道",installNeeded:"请先安装 cloudflared 或 ngrok,然后再次启动隧道。"},tailscale:{title:"Tailscale 私有访问",description:"Tailscale 是可选的私有网络应用。安装到服务器和用户设备,并登录同一团队后,Pixcode 会检测私有 URL。",save:"保存此 Tailscale URL",saveLabel:"Tailscale 私有访问",openInstall:"打开 Tailscale 安装",steps:{installServer:"在运行 Pixcode 的电脑或服务器上安装 Tailscale。",installUserDevice:"在要打开 Pixcode 的手机、笔记本或成员设备上安装 Tailscale。",login:"两台设备登录同一个 Tailscale 账号或团队。",refresh:"回到这里点击刷新;准备好后 Pixcode 会显示私有 URL。"}},advanced:{title:"高级:固定域名",description:"已有 LAN URL、Tailscale URL、Cloudflare Tunnel 主机名或 HTTPS 域名时,在这里保存给用户使用。",badge:"高级"},setup:{title:"固定访问路径",description:"保存用户将使用的 URL。可以是 LAN、Tailscale、Cloudflare Tunnel 或自定义域名。"},modes:{lan:"LAN",tailscale:"Tailscale",cloudflare_tunnel:"Cloudflare Tunnel",custom_domain:"自定义域名"},fields:{label:"标签",url:"URL",port:"目标端口"},health:{reachable:"Pixcode 可访问",unreachable:"Pixcode 不可访问"},configured:{title:"已保存的访问路径",description:"这些路径会按角色提供给管理员、项目伙伴和项目工作人员。",empty:"还没有保存访问路径。",noUrl:"无 URL",public:"公开",private:"私有"},team:{title:"用户如何连接",description:"在 Admin system 创建用户,在 Control Room 分配项目角色,然后分享一个 Access URL。访问已分配项目不需要全局管理员权限。"}},tue={title:"Hermes Agent",description:"将 Hermes Agent 作为 Pixcode 控制的项目终端管理,并通过 MCP 访问项目、提供商状态和可见的 CLI 启动。",statusTitle:"安装状态",statusFailed:"无法检查 Hermes Agent。",ready:"就绪",notInstalled:"未安装",start:"启动 Hermes",install:"安装",repair:"修复命令",refresh:"刷新",gatewayTitle:"REST API 网关",gatewayStatusFailed:"无法检查 Hermes REST 网关。",gatewayStartFailed:"无法启动 Hermes REST 网关。",gatewayStopFailed:"无法停止 Hermes REST 网关。",gatewayProbeFailed:"Hermes REST 探测失败。",gatewayRunning:"REST 网关运行中",gatewayStopped:"REST 网关已停止",gatewayStart:"启动 REST",gatewayProbe:"测试 REST",gatewayStop:"停止",gatewayProbeOk:"REST probe passed: health, capabilities, models, and a real prompt responded.",commandsTitle:"Hermes CLI 设置",commandsDescription:"从 Pixcode 打开真正的 Hermes 终端向导。使用模型和提供商连接 Codex、OpenRouter、Anthropic、Gemini 等提供商。",commandsInstallFirst:"打开 CLI 设置前请先安装 Hermes。",commands:{cron:{title:"Cron jobs",description:"Inspect the scheduler, list jobs, and confirm recurring project tasks can run through the Hermes gateway."},mcp:{title:"MCP servers",description:"Manage MCP servers and reload Pixcode MCP when tool configuration changes."},update:{title:"Update Hermes",description:"Pull the latest Hermes fixes and reinstall dependencies without interactive prompts."}},pixcodeControlTitle:"Pixcode 控制",pixcodeControlDescription:"Pixcode 会在启动前配置 Hermes MCP 服务器,因此 Hermes 可以检查工作区,并在需要时在 Pixcode UI 中打开可见的提供商终端。",diagnosticsTitle:"Integration diagnostics",diagnosticsDescription:"Checks Hermes model/auth, native toolsets, Pixcode MCP tools, REST gateway, and cron API wiring without exposing secrets.",diagnosticsFailed:"Unable to read Hermes diagnostics.",diagnosticsModel:"Model",diagnosticsTools:"Tools",diagnosticsCron:"Cron",diagnosticsIssues:"Issues",diagnosticsAuthReady:"Provider auth is present.",diagnosticsAuthMissing:"Provider auth needs attention.",diagnosticsMcpTools:"Pixcode MCP: {{count}} tools, {{missing}} missing",diagnosticsCronReady:"Hermes cron toolset is available.",diagnosticsCronMissing:"Hermes cron needs hermes-cli toolset.",diagnosticsCronApiReady:"Gateway /api/jobs responded.",diagnosticsCronApiFailed:"Gateway /api/jobs did not respond.",diagnosticsNoIssues:"No blocking issue detected.",diagnosticsIssueCount:"{{count}} issue(s) detected.",unknown:"Unknown"},rue={title:Lde,tabs:Dde,account:Ode,mcp:Mde,appearance:Fde,actions:zde,quickSettings:Bde,terminalShortcuts:Ude,mainTabs:$de,notifications:Hde,appearanceSettings:Gde,mcpForm:Vde,saveStatus:Wde,footerActions:qde,git:Kde,apiKeys:Yde,agents:Zde,permissions:Xde,mcpServers:Jde,pluginSettings:Qde,access:eue,hermes:tue},nue={title:"欢迎回来",description:"登录您的 Pixcode 账户",username:"用户名",password:"密码",submit:"登录",loading:"登录中...",errors:{invalidCredentials:"用户名或密码无效",requiredFields:"请填写所有字段",networkError:"网络错误,请重试。"},placeholders:{username:"输入您的用户名",password:"输入您的密码"}},aue={title:"创建账户",username:"用户名",password:"密码",confirmPassword:"确认密码",submit:"创建账户",loading:"创建账户中...",errors:{passwordMismatch:"密码不匹配",usernameTaken:"用户名已被占用",weakPassword:"密码强度太弱"}},iue={title:"退出登录",confirm:"确定要退出登录吗?",button:"退出登录"},sue={login:nue,register:aue,logout:iue},oue={title:"项目",newProject:"新建项目",deleteProject:"移除项目",renameProject:"重命名项目",noProjects:"未找到项目",loadingProjects:"加载项目中...",searchPlaceholder:"搜索项目...",projectNamePlaceholder:"项目名称",starred:"星标",all:"全部",untitledSession:"未命名会话",newSession:"新会话",codexSession:"Codex 会话",fetchingProjects:"正在获取您的 Claude 项目和会话",projects:"项目",detectedFromHistory:"从历史记录检测",noMatchingProjects:"未找到匹配的项目",tryDifferentSearch:"尝试调整您的搜索词",runClaudeCli:"在项目目录中运行 Claude CLI 以开始使用"},lue={title:"Pixcode",subtitle:"AI 编程助手"},cue={title:"会话",newSession:"新建会话",deleteSession:"删除会话",renameSession:"重命名会话",noSessions:"暂无会话",loadingSessions:"加载会话中...",unnamed:"未命名",loading:"加载中...",showMore:"显示更多会话"},due={viewEnvironments:"查看环境",hideSidebar:"隐藏侧边栏",createProject:"创建新项目",refresh:"刷新项目和会话 (Ctrl+R)",renameProject:"重命名项目 (F2)",deleteProject:"从侧边栏移除项目 (Delete)",addToFavorites:"添加到收藏",removeFromFavorites:"从收藏移除",editSessionName:"手动编辑会话名称",deleteSession:"永久删除此会话",save:"保存",cancel:"取消",clearSearch:"清除搜索"},uue={chat:"聊天",files:"文件",git:"Git",terminal:"终端",tasks:"任务"},pue={refresh:"刷新",settings:"设置",collapseAll:"全部折叠",expandAll:"全部展开",cancel:"取消",save:"保存",delete:"删除",rename:"重命名",joinCommunity:"加入社区",reportIssue:"报告问题",starOnGithub:"在GitHub上加星",controlRoom:"控制室",controlRoomDescription:"管理、访问、运行"},mue={openSource:"开源"},hue={active:"活动",inactive:"非活动",thinking:"思考中...",error:"错误",aborted:"已中止",unknown:"未知"},fue={justNow:"刚刚",oneMinuteAgo:"1 分钟前",minutesAgo:"{{count}} 分钟前",oneHourAgo:"1 小时前",hoursAgo:"{{count}} 小时前",oneDayAgo:"1 天前",daysAgo:"{{count}} 天前"},gue={deleteConfirm:"确定要删除吗?",renameSuccess:"重命名成功",deleteSuccess:"删除成功",errorOccurred:"发生错误",deleteSessionConfirm:"确定要删除此会话吗?此操作无法撤销。",deleteProjectConfirm:"从侧边栏移除此项目?您的项目文件、记忆和会话数据不会被删除。",enterProjectPath:"请输入项目路径",deleteSessionFailed:"删除会话失败,请重试。",deleteSessionError:"删除会话时出错,请重试。",renameSessionFailed:"重命名会话失败,请重试。",renameSessionError:"重命名会话时出错,请重试。",deleteProjectFailed:"移除项目失败,请重试。",deleteProjectError:"移除项目时出错,请重试。",createProjectFailed:"创建项目失败,请重试。",createProjectError:"创建项目时出错,请重试。"},bue={updateAvailable:"有可用更新"},xue={modeProjects:"项目",modeConversations:"对话",conversationsPlaceholder:"搜索对话内容...",searching:"搜索中...",noResults:"未找到结果",tryDifferentQuery:"尝试不同的搜索词",matches_one:"{{count}} 个匹配",matches_other:"{{count}} 个匹配",projectsScanned_one:"{{count}} 个项目已扫描",projectsScanned_other:"{{count}} 个项目已扫描"},yue={deleteProject:"移除项目",deleteSession:"删除会话",confirmDelete:"您想如何处理",sessionCount_one:"此项目包含 {{count}} 个对话。",sessionCount_other:"此项目包含 {{count}} 个对话。",removeFromSidebar:"仅从侧边栏移除",deleteAllData:"永久删除所有数据",allConversationsDeleted:"项目将从侧边栏中移除。您的文件、记忆和会话数据将会保留。",cannotUndo:"您可以稍后重新添加此项目。"},vue={section:"编排",fallbackTitle:"编排运行"},wue={projects:oue,app:lue,sessions:cue,tooltips:due,navigation:uue,actions:pue,branding:mue,status:hue,time:fue,messages:gue,version:bue,search:xue,deleteConfirmation:yue,orchestration:vue},kue={copy:"复制",copied:"已复制",copyCode:"复制代码"},Sue={copy:"复制消息",copied:"消息已复制",selectFormat:"选择复制格式",copyAsMarkdown:"复制为 Markdown",copyAsText:"复制为纯文本"},Cue={user:"U",error:"错误",tool:"工具",claude:"Claude",cursor:"Cursor",codex:"Codex",gemini:"Gemini",qwen:"Qwen Code"},Nue={settings:"工具设置",error:"工具错误",result:"工具结果",viewParams:"查看输入参数",viewRawParams:"查看原始参数",viewDiff:"查看编辑差异",creatingFile:"创建新文件:",updatingTodo:"更新待办事项",read:"读取",readFile:"读取文件",updateTodo:"更新待办列表",readTodo:"读取待办列表",searchResults:"结果"},Eue={found:"找到 {{count}} 个{{type}}",file:"文件",files:"文件",pattern:"模式:",in:"在:"},Tue={updated:"文件更新成功",created:"文件创建成功",written:"文件写入成功",diff:"差异",newFile:"新文件",viewContent:"查看文件内容",viewFullOutput:"查看完整输出({{count}} 个字符)",contentDisplayed:"文件内容显示在上面的差异视图中"},Aue={title:"交互式提示",waiting:"等待您在 CLI 中响应",instruction:"请在 Claude 运行的终端中选择一个选项。",selectedOption:"✓ Claude 选择了选项 {{number}}",instructionDetail:"在 CLI 中,您可以使用方向键或输入数字来交互式地选择此选项。"},jue={title:"思考中...",emoji:"💭 思考中..."},Iue={response:"JSON 响应"},Rue={grant:"授予 {{tool}} 权限",added:"权限已添加",addTo:"将 {{entry}} 添加到允许的工具。",retry:"权限已保存。重试请求以使用该工具。",error:"无法更新权限。请重试。",openSettings:"打开设置"},_ue={updated:"待办列表已成功更新",current:"当前待办列表"},Pue={viewPlan:"📋 查看实施计划",title:"实施计划"},Lue={resetAt:"Claude 使用限制已达到。您的限制将在 **{{time}} {{timezone}}** - {{date}} 重置"},Due={permissionMode:"权限模式",modes:{default:"默认模式",acceptEdits:"编辑模式",bypassPermissions:"无限制模式",plan:"计划模式"},descriptions:{default:"只有受信任的命令(ls、cat、grep、git status 等)自动运行。其他命令将被跳过。可以写入工作区。",acceptEdits:"工作区内的所有命令自动运行。完全自动模式,具有沙盒执行功能。",bypassPermissions:"完全的系统访问,无限制。所有命令自动运行,具有完整的磁盘和网络访问权限。请谨慎使用。",plan:"计划模式 - 不执行任何命令"},technicalDetails:"技术细节"},Oue={placeholder:"输入 / 调用命令,@ 选择文件,或向 {{provider}} 提问...",placeholderDefault:"输入您的消息...",disabled:"输入已禁用",attachFiles:"附加文件",attachImages:"附加图片",send:"发送",stop:"停止",clickToChangeMode:"点击更改权限模式(或在输入框中按 Tab)",showAllCommands:"显示所有命令",clearInput:"清空输入",scrollToBottom:"滚动到底部"},Mue={selector:{title:"思考模式",description:"扩展思考给 Claude 更多时间来评估替代方案",active:"激活",tip:"更高的思考模式需要更多时间,但提供更彻底的分析"},modes:{none:{name:"标准",description:"常规 Claude 响应",prefix:""},think:{name:"思考",description:"基本扩展思考",prefix:"思考"},thinkHard:{name:"深入思考",description:"更彻底的评估",prefix:"深入思考"},thinkHarder:{name:"更深入思考",description:"考虑替代方案的深度分析",prefix:"更深入思考"},ultrathink:{name:"超级思考",description:"最大思考预算",prefix:"超级思考"}},buttonTitle:"思考模式:{{mode}}"},Fue={title:"选择您的 AI 助手",description:"选择一个供应商以开始新对话",selectModel:"选择模型",statusUnavailable:"状态不可用",statusRetryHint:"无法检查此 CLI。点击重试。",retryStatus:"重试状态",providerInfo:{anthropic:"由 Anthropic 提供",openai:"由 OpenAI 提供",cursorEditor:"AI 代码编辑器",google:"由 Google 提供"},readyPrompt:{claude:"准备好使用带有 {{model}} 的 Claude。请在下方开始输入您的消息。",cursor:"准备好使用带有 {{model}} 的 Cursor。请在下方开始输入您的消息。",codex:"准备好使用带有 {{model}} 的 Codex。请在下方开始输入您的消息。",gemini:"准备好使用带有 {{model}} 的 Gemini。请在下方开始输入您的消息。",default:"请在上方选择一个提供者以开始"}},zue={continue:{title:"继续您的对话",description:"询问有关代码的问题、请求更改或获取开发任务的帮助"},loading:{olderMessages:"正在加载更早的消息...",sessionMessages:"正在加载会话消息..."},messages:{showingOf:"显示 {{shown}} / {{total}} 条消息",scrollToLoad:"向上滚动以加载更多",showingLast:"显示最近 {{count}} 条消息(共 {{total}} 条)",loadEarlier:"加载更早的消息",loadAll:"加载全部消息",loadingAll:"正在加载全部消息...",allLoaded:"全部消息已加载",perfWarning:"已加载全部消息 - 滚动可能变慢。点击「滚动到底部」恢复性能。"}},Bue={selectProject:{title:"选择项目",description:"选择一个项目以在该目录中打开交互式 Shell"},status:{newSession:"新会话",initializing:"初始化中...",restarting:"重启中..."},actions:{disconnect:"断开连接",disconnectTitle:"断开 Shell 连接",restart:"重启",restartTitle:"重启 Shell(请先断开连接)",connect:"在 Shell 中继续",connectTitle:"连接到 Shell"},loading:"正在加载终端...",connecting:"正在连接到 Shell...",startSession:"启动新的 Claude 会话",startProviderSession:"启动新的 {{provider}} 会话",resumeSession:"恢复会话:{{displayName}}...",runCommand:"在 {{projectName}} 中运行 {{command}}",startCli:"在 {{projectName}} 中启动 Claude CLI",startProviderCli:"在 {{projectName}} 中启动 {{provider}}",defaultCommand:"命令"},Uue={actions:{thinking:"Thinking",processing:"Processing",analyzing:"Analyzing",working:"Working",computing:"Computing",reasoning:"Reasoning"},state:{live:"Live",paused:"Paused"},elapsed:{seconds:"{{count}}s",minutesSeconds:"{{minutes}}m {{seconds}}s",label:"{{time}} elapsed",startingNow:"Starting now"},controls:{stopGeneration:"Stop Generation",pressEscToStop:"Press Esc anytime to stop"},providers:{assistant:"Assistant"}},$ue={startChatWithProvider:"选择一个项目以开始与 {{provider}} 聊天"},Hue={nextTaskPrompt:"开始下一个任务"},Gue={codeBlock:kue,copyMessage:Sue,messageTypes:Cue,tools:Nue,search:Eue,fileOperations:Tue,interactive:Aue,thinking:jue,json:Iue,permissions:Rue,todo:_ue,plan:Pue,usageLimit:Lue,codex:Due,input:Oue,thinkingMode:Mue,providerSelection:Fue,session:zue,shell:Bue,claudeStatus:Uue,projectSelection:$ue,tasks:Hue},Vue={changes:"个更改",previousChange:"上一个更改",nextChange:"下一个更改",hideDiff:"隐藏差异高亮",showDiff:"显示差异高亮",settings:"编辑器设置",collapse:"折叠编辑器",expand:"展开编辑器到全宽"},Wue="正在加载 {{fileName}}...",que={showingChanges:"显示更改"},Kue={download:"下载文件",save:"保存",saving:"保存中...",saved:"已保存!",exitFullscreen:"退出全屏",fullscreen:"全屏",close:"关闭"},Yue={lines:"行数:",characters:"字符数:",shortcuts:"按 Ctrl+S 保存 • Esc 关闭"},Zue={title:"二进制文件",message:'文件 "{{fileName}}" 无法在文本编辑器中显示,因为它是二进制文件。'},Xue={toolbar:Vue,loading:Wue,header:que,actions:Kue,footer:Yue,binaryFile:Zue},Jue={save:"保存",cancel:"キャンセル",delete:"削除",create:"作成",edit:"編集",close:"閉じる",confirm:"確認",submit:"送信",retry:"再試行",refresh:"更新",search:"検索",clear:"クリア",copy:"コピー",download:"ダウンロード",upload:"アップロード",browse:"参照"},Que={chat:"チャット",shell:"シェル",files:"ファイル",git:"ソース管理",changes:"変更",liveView:"ライブビュー",tasks:"タスク",remote:"リモート",controlRoom:"コントロール",orchestration:"オーケストレーション"},epe={loading:"読み込み中...",success:"成功",error:"エラー",failed:"失敗",pending:"保留中",completed:"完了",inProgress:"進行中"},tpe={savedSuccessfully:"保存しました",deletedSuccessfully:"削除しました",updatedSuccessfully:"更新しました",operationFailed:"操作に失敗しました",networkError:"ネットワークエラー。接続を確認してください。",unauthorized:"認証されていません。ログインしてください。",notFound:"見つかりません",invalidInput:"入力が無効です",requiredField:"この項目は必須です",unknownError:"不明なエラーが発生しました"},rpe={settings:"設定",home:"ホーム",back:"戻る",next:"次へ",previous:"前へ",logout:"ログアウト"},npe={language:"言語",theme:"テーマ",darkMode:"ダークモード",lightMode:"ライトモード",name:"名前",description:"説明",enabled:"有効",disabled:"無効",optional:"任意",version:"バージョン",select:"選択",selectAll:"すべて選択",deselectAll:"すべて解除"},ape={justNow:"たった今",minutesAgo:"{{count}}分前",hoursAgo:"{{count}}時間前",daysAgo:"{{count}}日前",yesterday:"昨日"},ipe={newFile:"新規ファイル",newFolder:"新規フォルダ",rename:"名前の変更",move:"移動",copyPath:"パスをコピー",openInEditor:"エディタで開く"},spe={loading:"Pixcode を読み込んでいます",settingUpWorkspace:"ワークスペースを準備しています...",chooseProject:"プロジェクトを選択",selectProjectDescription:"サイドバーからプロジェクトを選択して、Claudeとコーディングを始めましょう。各プロジェクトにはチャットセッションとファイル履歴が含まれています。",tip:"ヒント",createProjectMobile:"上部のメニューボタンからプロジェクトにアクセスできます",createProjectDesktop:"サイドバーのフォルダアイコンをクリックして新しいプロジェクトを作成できます",newSession:"新しいセッション",untitledSession:"無題のセッション",projectFiles:"プロジェクトファイル",landing:{title:"Pixcode ワークスペースを開始",description:"プロジェクトを選ぶか、新しいチャットを始めるか、1つの目標でオーケストレーションを開始できます。オーケストレーションは選択したCLIエージェントを管理し、各ステップとエラーを表示します。",startOrchestration:"オーケストレーションを開始",startOrchestrationDescription:"自動でプロジェクトを作成し、エージェント制御と実行履歴を持つオーケストレーション画面を開きます。",startChat:"新しいチャットを開始",startChatDescription:"フォルダを自動作成し、通常のチャット画面を1つのエージェントで開きます。",sidebarHint:"サイドバーから既存プロジェクトを選ぶと、チャット履歴、ファイル、git状態、タスク、オーケストレーションが同じメイン画面に残ります。"}},ope={loading:"ファイルを読み込んでいます...",files:"ファイル",simpleView:"シンプル表示",compactView:"コンパクト表示",detailedView:"詳細表示",searchPlaceholder:"ファイルやフォルダを検索...",clearSearch:"検索をクリア",name:"名前",size:"サイズ",modified:"更新日時",permissions:"権限",noFilesFound:"ファイルが見つかりません",checkProjectPath:"プロジェクトのパスがアクセス可能か確認してください",noMatchesFound:"一致するものが見つかりません",tryDifferentSearch:"別の検索語を試すか、検索をクリアしてください",justNow:"たった今",minAgo:"{{count}}分前",hoursAgo:"{{count}}時間前",daysAgo:"{{count}}日前",newFile:"新規ファイル (Cmd+N)",newFolder:"新規フォルダ (Cmd+Shift+N)",refresh:"更新",collapseAll:"すべて折りたたむ",context:{rename:"名前を変更",delete:"削除",copyPath:"パスをコピー",download:"ダウンロード",newFile:"新しいファイル",newFolder:"新しいフォルダ",refresh:"更新",menuLabel:"ファイルのコンテキストメニュー",loading:"読み込み中..."}},lpe={title:"新規プロジェクトを作成",steps:{type:"種類",configure:"設定",confirm:"確認"},step1:{question:"既存のワークスペースがありますか?それとも新しく作成しますか?",existing:{title:"既存のワークスペース",description:"サーバー上に既存のワークスペースがあり、プロジェクト一覧に追加したい"},new:{title:"新しいワークスペース",description:"新しいワークスペースを作成し、必要に応じてGitHubリポジトリからクローンする"},githubClone:{title:"GitHub からクローン",description:"対象フォルダを選び、リポジトリをそこにクローン"},subfolder:{title:"サブフォルダを作成",description:"親フォルダを選び、その中に新しいサブフォルダを作成"}},step2:{existingPath:"ワークスペースのパス",newPath:"ワークスペースのパス",subfolderParentPath:"親フォルダ",subfolderParentHelp:"新しいサブフォルダを作成する親フォルダのパス",subfolderName:"サブフォルダ名",subfolderNameHelp:"この名前のフォルダが親フォルダ内に作成されます",existingPlaceholder:"/path/to/existing/workspace",newPlaceholder:"/path/to/new/workspace",existingHelp:"既存のワークスペースディレクトリのフルパス",newHelp:"ワークスペースディレクトリのフルパス",githubUrl:"GitHub URL(任意)",githubPlaceholder:"https://github.com/username/repository",githubHelp:"任意: リポジトリをクローンするためのGitHub URLを入力してください",githubAuth:"GitHub認証(任意)",githubAuthHelp:"プライベートリポジトリの場合のみ必要です。パブリックリポジトリは認証なしでクローンできます。",loadingTokens:"保存済みトークンを読み込んでいます...",storedToken:"保存済みトークン",newToken:"新しいトークン",nonePublic:"なし(パブリック)",selectToken:"トークンを選択",selectTokenPlaceholder:"-- トークンを選択 --",tokenPlaceholder:"ghp_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",tokenHelp:"このトークンはこの操作にのみ使用されます",publicRepoInfo:"パブリックリポジトリには認証は不要です。パブリックリポジトリをクローンする場合、トークンは省略できます。",noTokensHelp:"保存済みトークンがありません。設定 → APIキーでトークンを追加すると再利用が簡単になります。",optionalTokenPublic:"GitHubトークン(パブリックリポジトリの場合は任意)",tokenPublicPlaceholder:"ghp_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx(パブリックリポジトリの場合は空欄可)"},step3:{reviewConfig:"設定の確認",workspaceType:"ワークスペースの種類:",existingWorkspace:"既存のワークスペース",newWorkspace:"新しいワークスペース",subfolderWorkspace:"新しいサブフォルダ",path:"パス:",parentPath:"親パス:",subfolderName:"サブフォルダ名:",cloneFrom:"クローン元:",authentication:"認証:",usingStoredToken:"保存済みトークンを使用:",usingProvidedToken:"入力されたトークンを使用",noAuthentication:"認証なし",sshKey:"SSHキー",existingInfo:"ワークスペースがプロジェクト一覧に追加され、Claude/Cursorセッションで使用できるようになります。",newWithClone:"このフォルダからリポジトリがクローンされます。",newEmpty:"ワークスペースがプロジェクト一覧に追加され、Claude/Cursorセッションで使用できるようになります。",subfolderInfo:"親フォルダ内に新しいサブフォルダが作成され、プロジェクト一覧に追加されます。",cloningRepository:"リポジトリをクローンしています..."},buttons:{cancel:"キャンセル",back:"戻る",next:"次へ",createProject:"プロジェクトを作成",creating:"作成中...",cloning:"クローン中..."},errors:{selectType:"既存のワークスペースか新規作成かを選択してください",providePath:"ワークスペースのパスを入力してください",provideSubfolderName:"サブフォルダ名を入力してください",subfolderNameInvalid:"サブフォルダ名にパス区切りを含めることはできず、. / .. もできません",failedToCreate:"ワークスペースの作成に失敗しました",failedToCreateFolder:"フォルダの作成に失敗しました"}},cpe={genericTool:"ツール",codes:{generic:{info:{title:"通知"}},permission:{required:{title:"対応が必要です",body:"{{toolName}} があなたの判断を待っています。"}},run:{stopped:{title:"実行が停止しました",body:"理由: {{reason}}"},failed:{title:"実行に失敗しました"}},agent:{notification:{title:"エージェント通知"}}}},dpe={title:"アップデートのお知らせ",newVersionReady:"新しいバージョンが利用可能です",currentVersion:"現在のバージョン",latestVersion:"最新バージョン",whatsNew:"変更点:",viewFullRelease:"リリース全文を見る",updateProgress:"アップデートの進捗:",manualUpgrade:"手動アップグレード:",npmUpgradeCommand:"npm install -g @pixelbyte-software/pixcode@latest",pixcodeUpgradeCommand:"pixcode update --restart-daemon",manualUpgradeHint:"または「今すぐ更新」をクリックして自動的にアップデートを実行できます。",updateCompleted:"アップデートが完了しました!",restartServer:"変更を適用するにはサーバーを再起動してください。",updateFailed:"アップデートに失敗しました",buttons:{close:"閉じる",later:"後で",copyCommand:"コマンドをコピー",updateNow:"今すぐ更新",updating:"更新中..."},ariaLabels:{closeModal:"バージョンアップグレードモーダルを閉じる",showSidebar:"サイドバーを表示",settings:"設定",updateAvailable:"アップデートあり",closeSidebar:"サイドバーを閉じる"}},upe={title:"オーケストレーション",subtitle:"{{project}} で1つの目標を入力し、CLIワーカーを選択します。必要なら同じCLIを複製し、直接割り当てるかコーディネーターに分担させます。",refresh:"更新",goal:"目標",goalPlaceholder:"例: 認証画面を単一ポート配信に合わせて修正し、エラーを捕捉し、lint と typecheck で検証する。",mode:"実行モード",systemPlan:"システム計画",noMode:"モード未選択",loadingPlan:"エージェント計画を読み込み中。",start:"チームを開始",starting:"開始中",needAgent:"少なくとも1つのCLIワーカーを有効にしてください。",startFailed:"ワークフローを開始できませんでした。",cliControl:"CLIチーム",enabledCount:"{{count}} 有効",enabled:"有効",disabled:"無効",history:"履歴",emptyHistory:"実行はまだありません。目標を書いてエージェントを開始してください。",steps:"{{done}}/{{total}} ステップ",notSelected:"実行が選択されていません",notSelectedDescription:"過去の実行を選択するか新しい目標を開始してください。エージェントのメッセージ、エラー、変更概要、プレビュー出力がここに表示されます。",loadFailed:"実行詳細を読み込めませんでした。",loadingRun:"実行を読み込み中...",agentSteps:"エージェント手順",noStepOutput:"ステップ出力はありません。",agentMessages:"エージェントメッセージ",noAgentMessages:"このエージェントはまだメッセージを生成していません。失敗した場合、実際のCLIエラーが上に表示されます。",outputs:"出力",noOutputs:"変更概要、プレビュー、コマンド出力はまだありません。",open:"開く",artifact:{fileDiff:"変更概要",previewUrl:"プレビュー",commandOutput:"コマンド出力"},role:{user:"ユーザー",agent:"エージェント"},status:{queued:"待機中",running:"実行中",completed:"完了",failed:"エラー",canceled:"キャンセル",skipped:"スキップ"},nodes:{codex_review:"Codexレビュー",gemini_review:"Geminiレビュー",claude_review:"Claudeレビュー",claude_code_review:"Claudeレビュー",cursor_review:"Cursorレビュー",aggregate:"集約",architect:"計画",implement:"実装",review:"レビュー",proposal:"提案",critique:"批評",response:"応答",judge:"判断",coordinator:"コーディネーター",final_report:"最終レポート"},workflows:{multi_model_review:{name:"マルチモデルレビュー",description:"有効なCLIエージェントが同じ目標を個別にレビューし、その後有効なエージェントが結果を集約します。"},sequential_handoff:{name:"順次ハンドオフ",description:"エージェントが順番に計画、実装、レビューします。無効なCLIステップはスキップされます。"},adversarial_debate:{name:"意思決定ディベート",description:"エージェントが提案、批評、応答し、最終推奨を生成します。"},agent_team:{name:"エージェントチーム",description:"コーディネーターが目標と有効なCLIインスタンスを読み取り、作業を割り当てて結果を集約します。"}},adapters:{"claude-code":{label:"Claude Code",role:"CLIワーカー"},cursor:{label:"Cursor",role:"CLIワーカー"},codex:{label:"Codex",role:"CLIワーカー"},gemini:{label:"Gemini",role:"CLIワーカー"},qwen:{label:"Qwen Code",role:"CLIワーカー"},opencode:{label:"OpenCode",role:"CLIワーカー"}},activeCount:"{{active}}/{{total}} 有効",teamHint:"各行は1つのCLIワーカーです。Claude、Codex、Cursor、Gemini、Qwen、OpenCodeを複数作成し、それぞれに別の割り当てを書けます。",parallelLimit:"並列上限",addAgent:"{{agent}}を追加",duplicateAgent:"{{agent}}を複製",removeAgent:"{{agent}}を削除",assignment:"割り当て",assignmentPlaceholder:"任意: このワーカーが担当する内容を具体的に書きます。空欄ならコーディネーターが割り当てます。",agentInstance:"{{name}} #{{number}}",taskTitle:"タスク",taskTitlePlaceholder:"機能を実装",taskDescription:"説明",taskDescriptionPlaceholder:"範囲、制約、期待する出力",addTask:"追加",runTask:"実行",cancelTask:"キャンセル",dispatchTask:"タスクを割り当て",adapter:"アダプター",isolation:"分離",dispatch:"割り当て",auto:"自動",waitingForStream:"ストリーム待機中...",workflow:"ワークフロー",input:"入力",taskStates:{todo:"未着手",in_progress:"進行中",in_review:"レビュー中",done:"完了",failed:"失敗",canceled:"キャンセル済み"},isolationKind:{worktree:"Worktree",host:"Host",docker:"Docker"},stop:"チームを停止",stopping:"停止中",cancelFailed:"ワークフローを停止できませんでした。",needRoles:"このモードでは、次のロールに少なくとも1つの有効なエージェントを割り当ててください: {{roles}}。",quickPrompts:{label:"クイックプロンプト:",liveTrading:{label:"8024 ライブ取引画面",prompt:"こんにちは。小さなプロジェクトを作成し、その後ポート8024で起動してください。Binance FAPIに接続したTradingView風デザインで、TradingViewチャートと左側のスター/お気に入りシステムが必要です。作業を論理的に分割し、プロセスを自動管理してください。"}},teamHistory:"チーム履歴",changeSummary:"変更概要",noChangeSummary:"最終概要はまだ準備できていません。エージェント完了後、読みやすいMarkdown概要がここに表示されます。",prepareTeamFromReport:"このレポートからエージェントチームを準備",prepareTeamTitle:"エージェントチームのプロンプトを準備",prepareTeamDescription:"議論の出力を新しいAgent Teamプロンプトに変換しました。編集してAgent Teamモードへ移せます。",usePreparedPrompt:"プロンプトを使用",reportToPromptPrefix:"以下の議論/意思決定レポートからエージェントチームを準備して実行してください。必要事項をタスクに分け、利用可能なCLIエージェントへ適切な割り当てを提案し、ユーザー確認後に開始してください。",generatedSummaryTitle:"自動実行概要",summaryStatus:"全体ステータス",summarySteps:"完了ステップ",summaryFailures:"失敗ステップ",summaryCanceled:"キャンセルされたステップ",summaryDiffs:"差分/変更出力",summaryPreviews:"プレビュー出力",summaryErrorPrefix:"エラー",assignedWork:"割り当て作業",autoAssigned:"自動 / コーディネーターが決定",stages:{coordinator:"コーディネーター",handoff:"引き継ぎ",backend:"バックエンド",frontend:"フロントエンド",implementation:"実装",review:"レビュー",repair:"修正",proposal:"提案",critique:"批評",response:"応答",decision:"決定",report:"レポート",final_report:"最終レポート"},agentRole:"フェーズ",agentRoles:{auto:"自動",backend:"バックエンド",frontend:"フロントエンド",review:"テスト / レビュー",implementation:"実装",proposal:"提案",critique:"批評",response:"応答",decision:"決定 / レポート",report:"レポート",custom:"カスタム"},customRolePlaceholder:"例: セキュリティ、モバイルUX、DB設計",roleHints:{default:"空欄にすると、コーディネーターが目標に基づいてこのエージェントへ割り当てます。",agent_team:"バックエンド、フロントエンド、レビューなどのフェーズを選ぶか、自動のままにできます。",multi_model_review:"有効なエージェントがレビューします。レポートロールを選ぶと、そのエージェントが最終概要をまとめます。",sequential_handoff:"エージェントは選択順に実行されます。タスク文が各ステップの範囲を定義します。",adversarial_debate:"意思決定ディベートではフェーズ選択は任意です。未指定の場合、選択されたエージェントを順に提案、批評、必要に応じて応答へ割り当てます。"},soloAgent:"{{agent}} のみで実行",soloAgentShort:"単独",cliSettings:"CLI設定",workspaceTarget:"対象ワークスペース",workspaceTargets:{selectedProject:"選択中のプロジェクト",pixcodeApp:"Pixcode システム",custom:"カスタムパス"},customWorkspacePlaceholder:"/path/to/project",workspaceTargetHint:"エージェントは次で実行されます: {{path}}",autoDetect:"自動検出",needWorkspacePath:"カスタムワークスペースのパスを入力してください。",hermesTitle:"Hermes Agent",hermesSubtitle:"Hermes is running inside Pixcode for {{project}} and can coordinate local checks, tests, terminal work, and project operations.",hermesCliControl:"Hermes CLI control"},ppe={title:"コントロールルーム",subtitle:"{{target}} の本番、プラットフォーム、管理、監査、セルフホストアクセス",thisServer:"このサーバー",refresh:"更新",nav:{overview:"概要",production:"本番",admin:"管理",team:"チーム",secrets:"シークレット",marketplace:"マーケット",eval:"評価",usage:"使用状況",security:"セキュリティ",access:"アクセス"},overview:{title:"v1.46 launch surface",description:"Every box below is backed by a v1.44-v1.45 API and is now visible from the UI.",latestAuditEvents:"Latest audit events",remoteAccessOptions:"Remote access options"},metrics:{issueRuns:"Issue-to-PR runs",reviewItems:"Review items",subUsers:"Sub-users",collaborators:"Project collaborators",secrets:"Scoped secrets",marketplace:"Marketplace entries",evalRuns:"Evaluation runs",securityAudits:"Security audits"},sections:{production:{title:"Production loop",description:"Start issue-to-PR runs, parse CI failures, review changes, schedule background jobs, and create checkpoints."},admin:{title:"管理システム",description:"セルフホストの Pixcode サーバーでサブユーザーの作成、無効化、アクティビティ確認を行います。"},team:{title:"プロジェクト共同作業者",description:"全員をグローバル管理者にせず、プロジェクトごとに partner、worker、reviewer、viewer を割り当てます。"},secrets:{title:"Secret vault",description:"Store scoped env secrets and preview what each provider, project, workflow, Telegram, or API run receives."},marketplace:{title:"MCP/plugin marketplace",description:"Register MCP servers, workflow templates, provider adapters, and notification channels with permission review and health."},eval:{title:"Evaluation harness",description:"Create regression suites and compare provider/model runs with pass rate and latency."},usage:{title:"Cost, token, and latency dashboard",description:"Monitor provider/model/workflow usage for demos and operations."},security:{title:"Security audit mode",description:"Run dependency audit, secret scan, permission audit, and agent output leak detection workflows."},access:{title:"セルフホストアクセス",description:"固定ドメインがない場合は Tailscale を使い、安定した公開 URL には Cloudflare Tunnel や custom domain を設定します。"}},panels:{issueToPr:"Issue-to-PR run",ciRepair:"CI repair parser",reviewQueue:"Review queue",schedulerCheckpoints:"Scheduler and checkpoints",createSubUser:"Create sub-user",rolePermissions:"Role permissions",addCollaborator:"Add collaborator",createSecret:"Create secret",scopedEnvPreview:"Scoped env preview",addMarketplaceEntry:"Add marketplace entry",createSuite:"Create suite",recordRun:"Record run",recordUsageEvent:"Record usage event",createAuditRun:"Create audit run",auditLog:"Audit log",remoteAccessSetup:"Remote access setup"},lists:{recentJobs:"Recent jobs",recentCheckpoints:"Recent checkpoints",subUsers:"Sub-users",collaborators:"Collaborators",includedEnvNames:"Included env names",vaultEntries:"Vault entries",marketplaceEntries:"Marketplace entries",suites:"Suites",runs:"Runs",auditRuns:"Audit runs",configuredAccessPaths:"Configured access paths"},buttons:{queueRun:"Queue run",parseFailure:"Parse failure",createReviewItem:"Create review item",scheduleJob:"Schedule job",createCheckpoint:"Create checkpoint",createUser:"Create user",disable:"Disable",enable:"Enable",addCollaborator:"Add collaborator",storeSecret:"Store secret",previewEnv:"Preview env",saveEntry:"Save entry",markHealthy:"Mark healthy",createSuite:"Create suite",recordRun:"Record run",recordUsage:"Record usage",createAudit:"Create audit",exportJson:"Export JSON",exportCsv:"Export CSV",saveAccessPath:"Save access path",checkUrl:"Check URL",checkTailscale:"Check Tailscale"},placeholders:{githubIssueUrl:"GitHub issue URL",manualTitle:"Manual title fallback",model:"Model",baseBranch:"Base branch",ciLog:"Paste failing CI, lint, typecheck, or build output",reviewTitle:"Review title",notes:"Notes",changedFiles:"Changed files, one per line",jobName:"Job name",cronExpression:"Cron or watch expression",checkpointReason:"Checkpoint reason",backgroundPrompt:"Background agent prompt",checkpointFiles:"Checkpoint changed files, one per line",usernameEmail:"Username or email",temporaryPassword:"Temporary password",userEmailUsername:"User email or username",secretName:"Secret name",envName:"ENV_NAME",secretTarget:"Target project/provider/workflow",secretValue:"Secret value",workflowId:"Workflow id",name:"Name",pluginSource:"Source package or repository",installCommand:"Install command",permissionScopes:"Permission scopes, one per line",suiteName:"Suite name",description:"Description",firstTaskTitle:"First task title",acceptanceCriteria:"Acceptance criteria, one per line",suiteId:"Suite id",latencyMs:"Latency ms",passedCount:"Passed count",failedCount:"Failed count",workflow:"Workflow",inputTokens:"Input tokens",outputTokens:"Output tokens",costUsd:"Cost USD",optionalFindingTitle:"Optional finding title",auditFilter:"Filter audit log by user, project, event, or file",label:"Label",url:"URL",targetPort:"Target port"},labels:{project:"project",path:"path",providerModel:"provider/model",branch:"branch",failedCommands:"Failed commands",files:"Files",lastActive:"Last active",role:"role",tasks:"tasks",pass:"pass",health:"Health",reachable:"reachable",installed:"installed",loggedIn:"logged in"},columns:{provider:"Provider",model:"Model",workflow:"Workflow",runs:"Runs",tokens:"Tokens",cost:"Cost",latency:"Latency",errorRate:"Error rate"},fallback:{selectedProject:"selected project",projectPath:"project path",noneDetected:"none detected",noUrl:"No URL",global:"global",noSource:"No source",regressionSuite:"Regression suite",demoTask:"Demo task",provider:"provider",reviewRequired:"Review required.",notAvailable:"not available"},capabilities:{partner:"can approve actions, manage secrets, and use shell",projectScoped:"project-scoped access only"},teamAccess:{title:"共同作業者のアクセス方法",stepUsers:"サブユーザーを作成",stepUsersDescription:"Admin system で member、viewer、project_worker、project_partner などのロールを付けて作成します。",stepRole:"プロジェクトロールを割り当て",stepRoleDescription:"同じユーザーをプロジェクト共同作業者に追加し、選択したプロジェクトだけを表示・操作できるようにします。",stepLink:"アクセス経路を共有",stepLinkDescription:"Self-hosted access で設定した Tailscale、Cloudflare Tunnel、custom domain、LAN URL を共有します。",paths:"利用可能なアクセスリンク"},badges:{public:"public",private:"private"},empty:{noAuditEvents:"No audit events yet.",noRemoteAccessConfigs:"No remote access configs yet.",noReviewItems:"No review items yet.",noRecentJobs:"No recent jobs yet.",noRecentCheckpoints:"No recent checkpoints yet.",noSubUsers:"No sub-users yet.",noCollaborators:"No project collaborators yet.",noAccessPaths:"No access paths configured yet.",noIncludedEnvNames:"No included env names yet.",noSecrets:"No secrets yet.",noMarketplaceEntries:"No marketplace entries yet.",noSuites:"No suites yet.",noRuns:"No runs yet.",usageSummary:"Usage appears here after provider or workflow events are recorded.",noSecurityAudits:"No security audits yet.",noAuditMatches:"No audit entries match the current filter."}},mpe={title:"VS Code ワークベンチ",noProject:"プロジェクト未選択",activity:{explorer:"エクスプローラー",projects:"プロジェクト",sourceControl:"ソース管理",terminal:"ターミナル",showPanel:"左パネルを表示",hidePanel:"左パネルを非表示"},panels:{explorer:"エクスプローラー",projects:"プロジェクト",sourceControl:"ソース管理",terminal:"ターミナル",editor:"エディター",cli:"CLI",rightTerminal:"ターミナル"},editor:{emptyTitle:"エクスプローラーからファイルを開く",closeTab:"{{file}} を閉じる",scrollLeft:"タブを左へスクロール",scrollRight:"タブを右へスクロール",moreActions:"その他のタブ操作",closeSplit:"分割エディターを閉じる",context:{close:"閉じる",closeAll:"すべて閉じる",copyPath:"パスをコピー",splitRight:"右に分割",splitMoveRight:"右に分割して移動"}},resize:{left:"左パネルのサイズ変更",right:"CLI パネルのサイズ変更"},menu:{openProject:"プロジェクトを開く...",cloneFromGithub:"リポジトリをクローン...",newChat:"新しいチャット",openProjects:"プロジェクトを開く"},projects:{openProject:"プロジェクトを開く",cloneFromGithub:"クローン",directoryList:"ディレクトリ",refresh:"プロジェクトを更新",emptyTitle:"プロジェクトディレクトリはまだありません",emptyDescription:"ローカルフォルダーを開くか、リポジトリをクローンして開始します。",selected:"選択中",startChat:"チャット",fileCount:"{{formattedCount}} ファイル",fileCountPending:"ファイルを準備中",startTitle:"Start a Pixcode workspace",startDescription:"Pick a folder and Pixcode will bind the explorer, terminal, and chat history to that workspace.",workHere:"Work in this folder"},workspace:{empty:"Workspace 1 を作成するにはプロジェクトを開いてください。",openFirst:"ワークスペースを開く",add:"ワークスペースを追加",scrollLeft:"ワークスペースを左へスクロール",scrollRight:"ワークスペースを右へスクロール",close:"{{name}} を閉じる",closeAction:"ワークスペースを閉じる",closeOthers:"ほかを閉じる",closeAll:"すべて閉じる",rename:"名前を変更",star:"スターを付ける",unstar:"スターを外す",toggleStar:"{{name}} にスターを付ける",moreActions:"ワークスペース操作"},cli:{projectScoped:"プロジェクト単位の CLI ターミナル",chooseTitle:"CLI ターミナルを開始",chooseDescription:"CLI を選んでから、全高のターミナルを開始します。",startSelected:"{{provider}} を開始",newSession:"新しい CLI セッション",history:"履歴",noHistory:"このプロジェクトにはまだセッションがありません。",projectHistory:"プロジェクト履歴",checking:"確認中...",ready:"準備完了",notInstalled:"未インストール",installing:"インストール中...",updateAvailable:"{{version}} に更新",installProvider:"{{provider}} をインストール",updateProvider:"{{provider}} を更新",manualInstall:"この CLI は手動インストールが必要です。",installNoJob:"インストールの job id が返されませんでした。",installFailed:"インストールに失敗しました。",installStreamLost:"インストールストリームが早く閉じました。まだ実行中の可能性があります。",provider:"プロバイダー",installRunning:"インストール中",installDone:"準備完了",installError:"確認が必要",showPanel:"CLI パネルを表示",hidePanel:"CLI パネルを非表示",close:"ターミナルを閉じる"},terminal:{title:"ターミナル",close:"ターミナルを閉じる"},hermes:{title:"Hermes Agent",installTitle:"Hermes Agent をインストール",description:"プロジェクト単位のエージェントターミナルです。Hermes がない場合はインストールして、このワークスペースで開きます。",start:"Hermes を開始",install:"インストール",newSession:"新しい Hermes セッション",history:"Hermes 履歴",connect:"Hermes Agent に接続",ready:"準備完了",installRunning:"Pixcode API で Hermes をインストールしています...",installDone:"Hermes がインストールされ、Pixcode MCP が設定されました。",installError:"Hermes のインストールに失敗しました。",installReady:"Hermes をインストールできます。",installWaiting:"Hermes インストールログを待機中...",retryInstall:"インストールを再試行",installFailed:"Hermes のインストールに失敗しました。",installStreamLost:"Hermes インストールストリームが早期に閉じました。インストールはまだ実行中の可能性があります。"}},hpe={buttons:Jue,tabs:Que,status:epe,messages:tpe,navigation:rpe,common:npe,time:ape,fileOperations:ipe,mainContent:spe,fileTree:ope,projectWizard:lpe,notifications:cpe,versionUpdate:dpe,orchestration:upe,controlRoom:ppe,vscodeWorkbench:mpe},fpe="設定",gpe={account:"アカウント",permissions:"権限",mcpServers:"MCPサーバー",appearance:"外観"},bpe={title:"アカウント",language:"言語",languageLabel:"表示言語",languageDescription:"インターフェースの表示言語を選択してください",username:"ユーザー名",email:"メールアドレス",profile:"プロフィール",changePassword:"パスワードを変更"},xpe={title:"MCPサーバー",addServer:"サーバーを追加",editServer:"サーバーを編集",deleteServer:"サーバーを削除",serverName:"サーバー名",serverType:"サーバーの種類",config:"設定",testConnection:"接続テスト",status:"状態",connected:"接続済み",disconnected:"未接続",scope:{label:"スコープ",user:"ユーザー",project:"プロジェクト"}},ype={title:"外観",theme:"テーマ",codeEditor:"コードエディタ",editorTheme:"エディタのテーマ",wordWrap:"折り返し",showMinimap:"ミニマップを表示",lineNumbers:"行番号",fontSize:"フォントサイズ"},vpe={saveChanges:"変更を保存",resetToDefaults:"デフォルトに戻す",cancelChanges:"変更をキャンセル"},wpe={title:"クイック設定",sections:{appearance:"外観",toolDisplay:"ツール表示",viewOptions:"表示オプション",inputSettings:"入力設定",changeAwareness:"コントロール"},darkMode:"ダークモード",autoExpandTools:"ツールを自動展開",showRawParameters:"生パラメータを表示",showThinking:"思考を表示",autoScrollToBottom:"自動スクロール",sendByCtrlEnter:"Ctrl+Enterで送信",sendByCtrlEnterDescription:"有効にすると、Enterではなく Ctrl+Enter でメッセージを送信します。IMEユーザーの誤送信防止に便利です。",changeAwareness:"コントロール",changedFiles:{title:"変更されたファイル",description:"ローカル変更を追跡し、新しい変更が出たらファイルパネルを開きます。",noProject:"ローカル変更を追跡するプロジェクトを選択してください。",refresh:"変更ファイルを更新",empty:"ローカル変更はありません",disabled:"ローカル変更を監視するにはコントロールを有効にしてください。",more:"ほか {{count}} 件",lastChecked:"{{value}} に確認",guideTitle:"右パネルガイド",guideFiles:"変更されたファイルはファイル内で緑に光ります。",guidePanel:"新しい変更で分割パネルが自動的に開きます。",status:{M:"M",A:"A",D:"D",U:"U"}},dragHandle:{dragging:"ドラッグ中",closePanel:"設定パネルを閉じる",openPanel:"設定パネルを開く",draggingStatus:"ドラッグ中...",toggleAndMove:"クリックで切替、ドラッグで移動"}},kpe={title:"ターミナルショートカット",sectionKeys:"キー",sectionNavigation:"ナビゲーション",escape:"Escape",tab:"Tab",shiftTab:"Shift+Tab",arrowUp:"上矢印",arrowDown:"下矢印",scrollDown:"下にスクロール",handle:{closePanel:"ショートカットパネルを閉じる",openPanel:"ショートカットパネルを開く"}},Spe={label:"設定",agents:"エージェント",hermes:"Hermes Agent",appearance:"外観",git:"Git",apiTokens:"API & トークン",notifications:"通知",plugins:"プラグイン",mobile:"モバイルで使う",telegram:"Telegram",about:"概要",access:"アクセス"},Cpe={title:"通知",description:"受信する通知イベントを設定します。",webPush:{title:"Webプッシュ通知",enable:"プッシュ通知を有効にする",disable:"プッシュ通知を無効にする",enabled:"プッシュ通知は有効です",loading:"更新中...",unsupported:"このブラウザではプッシュ通知がサポートされていません。",denied:"プッシュ通知がブロックされています。ブラウザの設定で許可してください。"},events:{title:"イベント種別",actionRequired:"対応が必要",stop:"実行停止",error:"実行失敗"}},Npe={darkMode:{label:"ダークモード",description:"ライトテーマとダークテーマを切り替えます"},projectSorting:{label:"プロジェクトの並び順",description:"サイドバーでのプロジェクトの並び順を設定します",alphabetical:"アルファベット順",recentActivity:"最近のアクティビティ順"},codeEditor:{title:"コードエディタ",theme:{label:"エディタのテーマ",description:"コードエディタのデフォルトテーマ"},wordWrap:{label:"折り返し",description:"エディタでデフォルトで折り返しを有効にします"},showMinimap:{label:"ミニマップを表示",description:"差分ビューでナビゲーション用のミニマップを表示します"},lineNumbers:{label:"行番号を表示",description:"エディタに行番号を表示します"},fontSize:{label:"フォントサイズ",description:"エディタのフォントサイズ(ピクセル)"}}},Epe={title:{add:"MCPサーバーを追加",edit:"MCPサーバーを編集"},importMode:{form:"フォーム入力",json:"JSONインポート"},scope:{label:"スコープ",userGlobal:"ユーザー(グローバル)",projectLocal:"プロジェクト(ローカル)",userDescription:"ユーザースコープ: すべてのプロジェクトで利用可能",projectDescription:"ローカルスコープ: 選択したプロジェクトでのみ利用可能",cannotChange:"既存のサーバーを編集する場合、スコープは変更できません"},fields:{serverName:"サーバー名",transportType:"トランスポートの種類",command:"コマンド",arguments:"引数(1行に1つ)",jsonConfig:"JSON設定",url:"URL",envVars:"環境変数(KEY=value、1行に1つ)",headers:"ヘッダー(KEY=value、1行に1つ)",selectProject:"プロジェクトを選択..."},placeholders:{serverName:"my-server"},validation:{missingType:"必須フィールドがありません: type",stdioRequiresCommand:"stdioタイプにはcommandフィールドが必要です",httpRequiresUrl:"{{type}}タイプにはurlフィールドが必要です",invalidJson:"無効なJSON形式です",jsonHelp:"MCPサーバー設定をJSON形式で貼り付けてください。例:",jsonExampleStdio:'• stdio: {"type":"stdio","command":"npx","args":["@upstash/context7-mcp"]}',jsonExampleHttp:'• http/sse: {"type":"http","url":"https://api.example.com/mcp"}'},configDetails:"設定の詳細({{configFile}}より)",projectPath:"パス: {{path}}",actions:{cancel:"キャンセル",saving:"保存中...",addServer:"サーバーを追加",updateServer:"サーバーを更新"}},Tpe={success:"設定を保存しました!",error:"設定の保存に失敗しました",saving:"保存中..."},Ape={save:"設定を保存",cancel:"キャンセル"},jpe={title:"Git設定",description:"コミット用のGit IDを設定します。この設定は git config --global で適用されます",name:{label:"Git名前",help:"コミットに使用する名前"},email:{label:"Gitメールアドレス",help:"コミットに使用するメールアドレス"},actions:{save:"設定を保存",saving:"保存中..."},status:{success:"保存しました"}},Ipe={title:"APIキー",description:"外部APIにアクセスするためのAPIキーを生成します。",newKey:{alertTitle:"⚠️ APIキーを保存してください",alertMessage:"このキーが表示されるのは今回限りです。安全な場所に保管してください。",iveSavedIt:"保存しました"},form:{placeholder:"APIキーの名前(例: 本番サーバー)",createButton:"作成",cancelButton:"キャンセル"},newButton:"新しいAPIキー",empty:"APIキーはまだ作成されていません。",list:{created:"作成日:",lastUsed:"最終使用日:"},confirmDelete:"このAPIキーを削除してもよろしいですか?",status:{active:"有効",inactive:"無効"},github:{title:"GitHubトークン",description:"外部APIからプライベートリポジトリをクローンするためのGitHubパーソナルアクセストークンを追加します。",descriptionAlt:"プライベートリポジトリをクローンするためのGitHubパーソナルアクセストークンを追加します。保存せずにAPIリクエストで直接トークンを渡すこともできます。",addButton:"トークンを追加",form:{namePlaceholder:"トークンの名前(例: 個人リポジトリ)",tokenPlaceholder:"GitHubパーソナルアクセストークン(ghp_...)",descriptionPlaceholder:"説明(任意)",addButton:"トークンを追加",cancelButton:"キャンセル",howToCreate:"GitHubパーソナルアクセストークンの作成方法 →"},empty:"GitHubトークンはまだ追加されていません。",added:"追加日:",confirmDelete:"このGitHubトークンを削除してもよろしいですか?"},apiDocsLink:"APIドキュメント",documentation:{title:"外部APIドキュメント",description:"外部APIを使用してアプリケーションからClaude/Cursorセッションを起動する方法を学びます。",viewLink:"APIドキュメントを見る →"},loading:"読み込み中...",version:{updateAvailable:"アップデートあり: v{{version}}"}},Rpe={authStatus:{checking:"確認中...",connected:"接続済み",notConnected:"未接続",disconnected:"切断",checkingAuth:"認証状態を確認しています...",loggedInAs:"{{email}}でログイン中",authenticatedUser:"認証済みユーザー"},account:{claude:{description:"Anthropic Claude AIアシスタント"},cursor:{description:"Cursor AI搭載コードエディタ"},codex:{description:"OpenAI Codex AIアシスタント"},gemini:{description:"Google Gemini AIアシスタント"},qwen:{description:"Alibaba Qwen Code CLI (Gemini CLI フォーク)"}},connectionStatus:"接続状態",login:{title:"ログイン",reAuthenticate:"再認証",description:"{{agent}}アカウントにサインインしてAI機能を有効にします",reAuthDescription:"別のアカウントでサインインするか、認証情報を更新します",button:"ログイン",reLoginButton:"再ログイン"},error:"エラー: {{error}}"},_pe={title:"権限設定",skipPermissions:{label:"権限プロンプトをスキップ(注意して使用)",claudeDescription:"--dangerously-skip-permissions フラグに相当",cursorDescription:"Cursor CLIの -f フラグに相当",opencodeDescription:"OpenCode の --dangerously-skip-permissions フラグに相当"},allowedTools:{title:"許可されたツール",description:"権限の確認なしに自動的に許可されるツール",placeholder:'例: "Bash(git log:*)" または "Write"',quickAdd:"よく使うツールを追加:",empty:"許可されたツールはありません"},blockedTools:{title:"ブロックされたツール",description:"権限の確認なしに自動的にブロックされるツール",placeholder:'例: "Bash(rm:*)"',empty:"ブロックされたツールはありません"},allowedCommands:{title:"許可されたシェルコマンド",description:"権限の確認なしに自動的に許可されるシェルコマンド",placeholder:'例: "Shell(ls)" または "Shell(git status)"',quickAdd:"よく使うコマンドを追加:",empty:"許可されたコマンドはありません"},blockedCommands:{title:"ブロックされたシェルコマンド",description:"自動的にブロックされるシェルコマンド",placeholder:'例: "Shell(rm -rf)" または "Shell(sudo)"',empty:"ブロックされたコマンドはありません"},toolExamples:{title:"ツールパターンの例:",bashGitLog:"- すべてのgit logコマンドを許可",bashGitDiff:"- すべてのgit diffコマンドを許可",write:"- すべてのWriteツールの使用を許可",bashRm:"- すべてのrmコマンドをブロック(危険)"},shellExamples:{title:"シェルコマンドの例:",ls:"- lsコマンドを許可",gitStatus:"- git statusを許可",npmInstall:"- npm installを許可",rmRf:"- 再帰的削除をブロック"},opencodeAllowed:{title:"許可された Bash パターン",description:"OpenCode が確認せず自動承認する Bash コマンドパターン",placeholder:'例: "git *" または "npm test"',quickAdd:"よく使うパターンを追加:",empty:"許可パターンはありません"},opencodeBlocked:{title:"ブロックされた Bash パターン",description:"OpenCode が常に拒否する Bash コマンドパターン",placeholder:'例: "rm -rf *" または "sudo *"',empty:"ブロックパターンはありません"},opencodeExamples:{title:"パターン例:",gitAll:"- すべての git コマンドを許可",gitPush:"- git push のみをブロック",rmRf:"- 再帰削除をブロック",npm:"- すべての npm コマンドを許可"},codex:{permissionMode:"権限モード",description:"Codexがファイルの変更やコマンドの実行を処理する方法を制御します",modes:{default:{title:"デフォルト",description:"信頼されたコマンド(ls、cat、grep、git statusなど)のみ自動実行。その他のコマンドはスキップ。ワークスペースへの書き込みは可能。"},acceptEdits:{title:"編集を許可",description:"ワークスペース内ですべてのコマンドを自動実行。サンドボックス環境での完全自動モード。"},bypassPermissions:{title:"権限をバイパス",description:"制限なしの完全なシステムアクセス。すべてのコマンドがディスクとネットワークへの完全なアクセスで自動実行されます。注意して使用してください。"}},technicalDetails:"技術的な詳細",technicalInfo:{default:"sandboxMode=workspace-write, approvalPolicy=untrusted。信頼されたコマンド: cat, cd, grep, head, ls, pwd, tail, git status/log/diff/show, find(-execなし)など。",acceptEdits:"sandboxMode=workspace-write, approvalPolicy=never。すべてのコマンドがプロジェクトディレクトリ内で自動実行。",bypassPermissions:"sandboxMode=danger-full-access, approvalPolicy=never。完全なシステムアクセス。信頼された環境でのみ使用してください。",overrideNote:"チャットインターフェースのモードボタンを使用してセッションごとに上書きできます。"}},actions:{add:"追加"}},Ppe={title:"MCPサーバー",description:{claude:"Model Context Protocolサーバーは、Claudeに追加のツールやデータソースを提供します",cursor:"Model Context Protocolサーバーは、Cursorに追加のツールやデータソースを提供します",codex:"Model Context Protocolサーバーは、Codexに追加のツールやデータソースを提供します"},addButton:"MCPサーバーを追加",empty:"MCPサーバーは設定されていません",serverType:"種類",scope:{local:"ローカル",user:"ユーザー"},config:{command:"コマンド",url:"URL",args:"引数",environment:"環境変数"},tools:{title:"ツール",count:"({{count}}):",more:"他{{count}}件"},actions:{edit:"サーバーを編集",delete:"サーバーを削除"},help:{title:"Codex MCPについて",description:"Codexはstdioベースのツールサーバーをサポートしています。追加のツールやリソースでCodexの機能を拡張するサーバーを追加できます。"}},Lpe={title:"プラグイン",description:"カスタムプラグインでインターフェースを拡張します。gitからインストールするか、~/.pixcode/plugins/ にフォルダを配置してください。",installPlaceholder:"https://github.com/user/my-plugin",installButton:"インストール",installing:"インストール中…",securityWarning:"信頼できる作成者のプラグイン、またはソースコードを確認済みのプラグインのみをインストールしてください。",scanningPlugins:"プラグインをスキャン中…",noPluginsInstalled:"プラグインがインストールされていません",pullLatest:"gitから最新を取得",noGitRemote:"リモートgitリポジトリがありません — アップデート不可",uninstallPlugin:"プラグインを削除",confirmUninstall:"クリックして確定",confirmUninstallMessage:"{{name}} を削除しますか?この操作は取り消せません。",cancel:"キャンセル",remove:"削除",updateFailed:"アップデートに失敗しました",installFailed:"インストールに失敗しました",uninstallFailed:"削除に失敗しました",toggleFailed:"切り替えに失敗しました",buildYourOwn:"プラグインを自作する",starter:"スターター",docs:"ドキュメント",starterPlugin:{name:"プロジェクト統計",badge:"スターター",description:"プロジェクトのファイル数、コード行数、ファイルタイプの内訳、最近のアクティビティを表示します。",install:"インストール"},morePlugins:"詳細",enable:"有効にする",disable:"無効にする",installAriaLabel:"プラグインのgitリポジトリURL",tab:"タブ",runningStatus:"実行中"},Dpe={title:"アクセス",description:"このセルフホスト Pixcode サーバーへ接続する方法を選びます。まず同じネットワークで確認し、リモート接続には安全なトンネル、Tailscale、または独自ドメインを使います。",refresh:"更新",copy:"コピー",copied:"コピー済み",save:"アクセス経路を保存",check:"URL を確認",qrAlt:"{{url}} の QR",guide:{title:"先に接続方法を選ぶ",description:"ネットワーク用語を知らなくても使えます。状況に合う項目を選び、リンクをコピーするかスマホで QR を読み取ります。"},options:{sameNetwork:{title:"同じ Wi-Fi/LAN",description:"端末が Pixcode サーバーと同じルーターや社内ネットワークにある場合に使います。"},secureTunnel:{title:"一時公開リンク",description:"Cloudflare/ngrok トンネルを開始すると、Pixcode が公開 URL と QR を表示します。"},tailscale:{title:"チーム用プライベートリンク",description:"公開ドメインやルーター設定なしでプライベート接続したい場合に使います。"},customDomain:{title:"独自ドメイン",description:"HTTPS、リバースプロキシ、Cloudflare Tunnel ホスト名が既にある場合に使います。"}},status:{ready:"準備完了",detecting:"検出中",guided:"ガイド",configured:"設定済み",optional:"任意"},links:{title:"利用可能なリンク",description:"接続する端末またはメンバー用の正しい URL をコピーします。",local:"ローカル",tailscale:"Tailscale プライベートリンク",empty:"アクセスリンクはまだ検出されていません。"},local:{title:"同じネットワークから接続",description:"最初の確認に最適です。同じ Wi-Fi または LAN から QR を読み取るかリンクをコピーします。",thisDevice:"このコンピューターのみ",loading:"同じネットワークのリンクを検出中...",empty:"LAN リンクが見つかりません。ネットワーク接続を確認して更新してください。",saveLabel:"同じネットワーク接続",save:"この LAN リンクを保存"},tunnel:{title:"安全なトンネル",description:"固定ドメインがなくても、Pixcode が cloudflared または ngrok を起動して公開 URL を表示できます。",secureLink:"公開リンクと QR",help:"開始を押します。cloudflared または ngrok があれば、Pixcode が一時 HTTPS URL と QR を作成します。",running:"トンネル実行中",start:"トンネル開始",stop:"トンネル停止",save:"このトンネル URL を保存",saveLabel:"安全なトンネル接続",qrLabel:"安全なトンネル",installTitle:"トンネル設定が必要",installNeeded:"先に cloudflared または ngrok をインストールしてから、もう一度開始してください。"},tailscale:{title:"Tailscale プライベート接続",description:"Tailscale は任意のプライベートネットワークアプリです。サーバーと利用端末に入れて同じチームでログインすると、Pixcode がプライベート URL を検出します。",save:"この Tailscale URL を保存",saveLabel:"Tailscale プライベート接続",openInstall:"Tailscale インストールを開く",steps:{installServer:"Pixcode を実行しているコンピューターまたはサーバーに Tailscale をインストールします。",installUserDevice:"Pixcode を開くスマホ、ノート PC、またはメンバー端末に Tailscale をインストールします。",login:"両方の端末で同じ Tailscale アカウントまたはチームにログインします。",refresh:"ここに戻って更新を押すと、準備できた private URL が表示されます。"}},advanced:{title:"詳細: 固定ドメイン",description:"LAN URL、Tailscale URL、Cloudflare Tunnel ホスト名、または HTTPS ドメインが既にある場合に保存します。",badge:"詳細"},setup:{title:"固定アクセス経路",description:"ユーザーが使う URL を保存します。LAN、Tailscale、Cloudflare Tunnel、独自ドメインを指定できます。"},modes:{lan:"LAN",tailscale:"Tailscale",cloudflare_tunnel:"Cloudflare Tunnel",custom_domain:"独自ドメイン"},fields:{label:"ラベル",url:"URL",port:"対象ポート"},health:{reachable:"Pixcode に接続できます",unreachable:"Pixcode に接続できません"},configured:{title:"保存済みアクセス経路",description:"これらの経路はロールに応じて管理者、プロジェクトパートナー、プロジェクト作業者が利用できます。",empty:"保存済みのアクセス経路はありません。",noUrl:"URL なし",public:"公開",private:"非公開"},team:{title:"ユーザーの接続方法",description:"Admin system でユーザーを作成し、Control Room でプロジェクトロールを割り当て、この Access URL を共有します。割り当て済みプロジェクトにグローバル管理者権限は不要です。"}},Ope={title:"Hermes Agent",description:"Pixcode が制御するプロジェクト端末として Hermes Agent を管理し、プロジェクト、プロバイダー状態、表示される CLI 起動へ MCP でアクセスします。",statusTitle:"インストール状態",statusFailed:"Hermes Agent を確認できません。",ready:"準備完了",notInstalled:"未インストール",start:"Hermes を開始",install:"インストール",repair:"コマンドを修復",refresh:"更新",gatewayTitle:"REST API ゲートウェイ",gatewayStatusFailed:"Hermes REST ゲートウェイを確認できません。",gatewayStartFailed:"Hermes REST ゲートウェイを開始できません。",gatewayStopFailed:"Hermes REST ゲートウェイを停止できません。",gatewayProbeFailed:"Hermes REST プローブに失敗しました。",gatewayRunning:"REST ゲートウェイ稼働中",gatewayStopped:"REST ゲートウェイ停止中",gatewayStart:"REST 開始",gatewayProbe:"REST テスト",gatewayStop:"停止",gatewayProbeOk:"REST probe passed: health, capabilities, models, and a real prompt responded.",commandsTitle:"Hermes CLI 設定",commandsDescription:"Pixcode から実際の Hermes ターミナルウィザードを開きます。モデルとプロバイダーで Codex、OpenRouter、Anthropic、Gemini などを接続します。",commandsInstallFirst:"CLI 設定を開く前に Hermes をインストールしてください。",commands:{cron:{title:"Cron jobs",description:"Inspect the scheduler, list jobs, and confirm recurring project tasks can run through the Hermes gateway."},mcp:{title:"MCP servers",description:"Manage MCP servers and reload Pixcode MCP when tool configuration changes."},update:{title:"Update Hermes",description:"Pull the latest Hermes fixes and reinstall dependencies without interactive prompts."}},pixcodeControlTitle:"Pixcode 制御",pixcodeControlDescription:"Pixcode は起動前に Hermes MCP サーバーを設定するため、Hermes はワークスペースを確認し、必要に応じて Pixcode UI 内でプロバイダー端末を開けます。",diagnosticsTitle:"Integration diagnostics",diagnosticsDescription:"Checks Hermes model/auth, native toolsets, Pixcode MCP tools, REST gateway, and cron API wiring without exposing secrets.",diagnosticsFailed:"Unable to read Hermes diagnostics.",diagnosticsModel:"Model",diagnosticsTools:"Tools",diagnosticsCron:"Cron",diagnosticsIssues:"Issues",diagnosticsAuthReady:"Provider auth is present.",diagnosticsAuthMissing:"Provider auth needs attention.",diagnosticsMcpTools:"Pixcode MCP: {{count}} tools, {{missing}} missing",diagnosticsCronReady:"Hermes cron toolset is available.",diagnosticsCronMissing:"Hermes cron needs hermes-cli toolset.",diagnosticsCronApiReady:"Gateway /api/jobs responded.",diagnosticsCronApiFailed:"Gateway /api/jobs did not respond.",diagnosticsNoIssues:"No blocking issue detected.",diagnosticsIssueCount:"{{count}} issue(s) detected.",unknown:"Unknown"},Mpe={title:fpe,tabs:gpe,account:bpe,mcp:xpe,appearance:ype,actions:vpe,quickSettings:wpe,terminalShortcuts:kpe,mainTabs:Spe,notifications:Cpe,appearanceSettings:Npe,mcpForm:Epe,saveStatus:Tpe,footerActions:Ape,git:jpe,apiKeys:Ipe,agents:Rpe,permissions:_pe,mcpServers:Ppe,pluginSettings:Lpe,access:Dpe,hermes:Ope},Fpe={title:"おかえりなさい",description:"Pixcodeアカウントにサインイン",username:"ユーザー名",password:"パスワード",submit:"サインイン",loading:"サインイン中...",errors:{invalidCredentials:"ユーザー名またはパスワードが正しくありません",requiredFields:"すべての項目を入力してください",networkError:"ネットワークエラー。もう一度お試しください。"},placeholders:{username:"ユーザー名を入力",password:"パスワードを入力"}},zpe={title:"アカウント作成",username:"ユーザー名",password:"パスワード",confirmPassword:"パスワードの確認",submit:"アカウントを作成",loading:"アカウントを作成中...",errors:{passwordMismatch:"パスワードが一致しません",usernameTaken:"このユーザー名は既に使用されています",weakPassword:"パスワードが弱すぎます"}},Bpe={title:"サインアウト",confirm:"サインアウトしてもよろしいですか?",button:"サインアウト"},Upe={login:Fpe,register:zpe,logout:Bpe},$pe={title:"プロジェクト",newProject:"新規プロジェクト",deleteProject:"プロジェクトを除去",renameProject:"プロジェクト名を変更",noProjects:"プロジェクトが見つかりません",loadingProjects:"プロジェクトを読み込んでいます...",searchPlaceholder:"プロジェクトを検索...",projectNamePlaceholder:"プロジェクト名",starred:"お気に入り",all:"すべて",untitledSession:"無題のセッション",newSession:"新しいセッション",codexSession:"Codexセッション",fetchingProjects:"Claudeのプロジェクトとセッションを取得しています",projects:"プロジェクト",detectedFromHistory:"履歴から検出",noMatchingProjects:"一致するプロジェクトがありません",tryDifferentSearch:"検索語を変えてお試しください",runClaudeCli:"プロジェクトディレクトリでClaude CLIを実行して始めましょう"},Hpe={title:"Pixcode",subtitle:"AIコーディングアシスタント"},Gpe={title:"セッション",newSession:"新しいセッション",deleteSession:"セッションを削除",renameSession:"セッション名を変更",noSessions:"セッションはまだありません",loadingSessions:"セッションを読み込んでいます...",unnamed:"名称未設定",loading:"読み込み中...",showMore:"さらにセッションを表示"},Vpe={viewEnvironments:"環境を表示",hideSidebar:"サイドバーを隠す",createProject:"新しいプロジェクトを作成",refresh:"プロジェクトとセッションを更新 (Ctrl+R)",renameProject:"プロジェクト名を変更 (F2)",deleteProject:"サイドバーからプロジェクトを除去 (Delete)",addToFavorites:"お気に入りに追加",removeFromFavorites:"お気に入りから削除",editSessionName:"セッション名を手動で編集",deleteSession:"このセッションを完全に削除",save:"保存",cancel:"キャンセル"},Wpe={chat:"チャット",files:"ファイル",git:"Git",terminal:"ターミナル",tasks:"タスク"},qpe={refresh:"更新",settings:"設定",collapseAll:"すべて折りたたむ",expandAll:"すべて展開",cancel:"キャンセル",save:"保存",delete:"削除",rename:"名前の変更",joinCommunity:"コミュニティに参加",reportIssue:"問題を報告",starOnGithub:"GitHubでスター",controlRoom:"コントロールルーム",controlRoomDescription:"管理、アクセス、実行"},Kpe={openSource:"オープンソース"},Ype={active:"アクティブ",inactive:"非アクティブ",thinking:"思考中...",error:"エラー",aborted:"中断",unknown:"不明"},Zpe={justNow:"たった今",oneMinuteAgo:"1分前",minutesAgo:"{{count}}分前",oneHourAgo:"1時間前",hoursAgo:"{{count}}時間前",oneDayAgo:"1日前",daysAgo:"{{count}}日前"},Xpe={deleteConfirm:"本当に削除しますか?",renameSuccess:"名前を変更しました",deleteSuccess:"削除しました",errorOccurred:"エラーが発生しました",deleteSessionConfirm:"このセッションを削除してもよろしいですか?この操作は取り消せません。",deleteProjectConfirm:"サイドバーからこのプロジェクトを除去しますか?プロジェクトファイル、メモリ、セッションデータは削除されません。",enterProjectPath:"プロジェクトのパスを入力してください",deleteSessionFailed:"セッションの削除に失敗しました。もう一度お試しください。",deleteSessionError:"セッションの削除でエラーが発生しました。もう一度お試しください。",renameSessionFailed:"セッション名の変更に失敗しました。もう一度お試しください。",renameSessionError:"セッション名の変更でエラーが発生しました。もう一度お試しください。",deleteProjectFailed:"プロジェクトの除去に失敗しました。もう一度お試しください。",deleteProjectError:"プロジェクトの除去でエラーが発生しました。もう一度お試しください。",createProjectFailed:"プロジェクトの作成に失敗しました。もう一度お試しください。",createProjectError:"プロジェクトの作成でエラーが発生しました。もう一度お試しください。"},Jpe={updateAvailable:"アップデートあり"},Qpe={deleteProject:"プロジェクトを除去",deleteSession:"セッションを削除",confirmDelete:"このプロジェクトをどうしますか:",sessionCount:"このプロジェクトには{{count}}件の会話があります。",removeFromSidebar:"サイドバーからのみ除去",deleteAllData:"すべてのデータを完全に削除",allConversationsDeleted:"プロジェクトはサイドバーから除去されます。ファイル、メモリ、セッションデータは保持されます。",cannotUndo:"後からプロジェクトを再追加できます。"},eme={section:"オーケストレーション",fallbackTitle:"オーケストレーション実行"},tme={projects:$pe,app:Hpe,sessions:Gpe,tooltips:Vpe,navigation:Wpe,actions:qpe,branding:Kpe,status:Ype,time:Zpe,messages:Xpe,version:Jpe,deleteConfirmation:Qpe,orchestration:eme},rme={copy:"コピー",copied:"コピーしました",copyCode:"コードをコピー"},nme={copy:"メッセージをコピー",copied:"メッセージをコピーしました",selectFormat:"コピー形式を選択",copyAsMarkdown:"Markdownとしてコピー",copyAsText:"テキストとしてコピー"},ame={user:"U",error:"エラー",tool:"ツール",claude:"Claude",cursor:"Cursor",codex:"Codex"},ime={settings:"ツール設定",error:"ツールエラー",result:"ツール結果",viewParams:"入力パラメータを表示",viewRawParams:"生パラメータを表示",viewDiff:"編集差分を表示:",creatingFile:"新規ファイルを作成:",updatingTodo:"Todoリストを更新中",read:"読み取り",readFile:"ファイルを読み取り",updateTodo:"Todoリストを更新",readTodo:"Todoリストを読み取り",searchResults:"件の結果"},sme={found:"{{count}}件の{{type}}が見つかりました",file:"ファイル",files:"ファイル",pattern:"パターン:",in:"場所:"},ome={updated:"ファイルを更新しました",created:"ファイルを作成しました",written:"ファイルを書き込みました",diff:"差分",newFile:"新規ファイル",viewContent:"ファイルの内容を表示",viewFullOutput:"全出力を表示({{count}}文字)",contentDisplayed:"ファイルの内容は上の差分ビューに表示されています"},lme={title:"インタラクティブプロンプト",waiting:"CLIでの応答を待っています",instruction:"Claudeが実行されているターミナルでオプションを選択してください。",selectedOption:"✓ Claudeがオプション{{number}}を選択しました",instructionDetail:"CLIでは、矢印キーまたは番号を入力してオプションを選択します。"},cme={title:"思考中...",emoji:"💭 思考中..."},dme={response:"JSONレスポンス"},ume={grant:"{{tool}}に権限を付与",added:"権限を追加しました",addTo:"{{entry}}を許可されたツールに追加します。",retry:"権限を保存しました。ツールを使用するにはリクエストを再試行してください。",error:"権限を更新できませんでした。もう一度お試しください。",openSettings:"設定を開く"},pme={updated:"Todoリストを更新しました",current:"現在のTodoリスト"},mme={viewPlan:"📋 実装プランを表示",title:"実装プラン"},hme={resetAt:"Claudeの使用制限に達しました。制限は**{{time}} {{timezone}}** - {{date}}にリセットされます"},fme={permissionMode:"権限モード",modes:{default:"デフォルトモード",acceptEdits:"編集を許可",bypassPermissions:"権限をバイパス",plan:"プランモード"},descriptions:{default:"信頼されたコマンド(ls、cat、grep、git statusなど)のみ自動実行。その他のコマンドはスキップ。ワークスペースへの書き込みは可能。",acceptEdits:"ワークスペース内ですべてのコマンドを自動実行。サンドボックス環境での完全自動モード。",bypassPermissions:"制限なしの完全なシステムアクセス。すべてのコマンドがディスクとネットワークへの完全なアクセスで自動実行されます。注意して使用してください。",plan:"プランニングモード - コマンドは実行されません"},technicalDetails:"技術的な詳細"},gme={placeholder:"/ でコマンド、@ でファイル指定、または {{provider}} に何でも聞いてください...",placeholderDefault:"メッセージを入力...",disabled:"入力無効",attachFiles:"ファイルを添付",attachImages:"画像を添付",send:"送信",stop:"停止",clickToChangeMode:"クリックで権限モードを変更(または入力欄でTab)",showAllCommands:"すべてのコマンドを表示"},bme={selector:{title:"思考モード",description:"拡張思考によりClaudeがより多くの選択肢を検討できます",active:"有効",tip:"高い思考モードは時間がかかりますが、より深い分析が得られます"},modes:{none:{name:"標準",description:"通常のClaudeの応答",prefix:""},think:{name:"Think",description:"基本的な拡張思考",prefix:"think"},thinkHard:{name:"Think Hard",description:"より深い検討",prefix:"think hard"},thinkHarder:{name:"Think Harder",description:"代替案を含む深い分析",prefix:"think harder"},ultrathink:{name:"Ultrathink",description:"最大限の思考予算",prefix:"ultrathink"}},buttonTitle:"思考モード: {{mode}}"},xme={title:"AIアシスタントを選択",description:"新しい会話を始めるプロバイダーを選択してください",selectModel:"モデルを選択",statusUnavailable:"ステータスを取得できません",statusRetryHint:"このCLIを確認できませんでした。タップして再試行してください。",retryStatus:"ステータスを再試行",providerInfo:{anthropic:"by Anthropic",openai:"by OpenAI",cursorEditor:"AIコードエディタ"},readyPrompt:{claude:"{{model}}でClaudeを使用する準備ができました。下にメッセージを入力してください。",cursor:"{{model}}でCursorを使用する準備ができました。下にメッセージを入力してください。",codex:"{{model}}でCodexを使用する準備ができました。下にメッセージを入力してください。",default:"上からプロバイダーを選択して開始してください"}},yme={continue:{title:"会話を続ける",description:"コードについて質問したり、変更をリクエストしたり、開発タスクのサポートを受けられます"},loading:{olderMessages:"過去のメッセージを読み込んでいます...",sessionMessages:"セッションメッセージを読み込んでいます..."},messages:{showingOf:"{{total}}件中{{shown}}件を表示",scrollToLoad:"上にスクロールしてさらに読み込む",showingLast:"最新{{count}}件を表示(全{{total}}件)",loadEarlier:"過去のメッセージを読み込む"}},vme={selectProject:{title:"プロジェクトを選択",description:"プロジェクトを選択してそのディレクトリでシェルを開きます"},status:{newSession:"新しいセッション",initializing:"初期化中...",restarting:"再起動中..."},actions:{disconnect:"切断",disconnectTitle:"シェルから切断",restart:"再起動",restartTitle:"シェルを再起動(先に切断してください)",connect:"シェルで続行",connectTitle:"シェルに接続"},loading:"ターミナルを読み込んでいます...",connecting:"シェルに接続しています...",startSession:"新しいClaudeセッションを開始",startProviderSession:"新しい{{provider}}セッションを開始",resumeSession:"セッションを再開: {{displayName}}...",runCommand:"{{projectName}}で{{command}}を実行",startCli:"{{projectName}}でClaude CLIを起動しています",startProviderCli:"{{projectName}}で{{provider}}を起動しています",defaultCommand:"コマンド"},wme={actions:{thinking:"Thinking",processing:"Processing",analyzing:"Analyzing",working:"Working",computing:"Computing",reasoning:"Reasoning"},state:{live:"Live",paused:"Paused"},elapsed:{seconds:"{{count}}s",minutesSeconds:"{{minutes}}m {{seconds}}s",label:"{{time}} elapsed",startingNow:"Starting now"},controls:{stopGeneration:"Stop Generation",pressEscToStop:"Press Esc anytime to stop"},providers:{assistant:"Assistant"}},kme={codeBlock:rme,copyMessage:nme,messageTypes:ame,tools:ime,search:sme,fileOperations:ome,interactive:lme,thinking:cme,json:dme,permissions:ume,todo:pme,plan:mme,usageLimit:hme,codex:fme,input:gme,thinkingMode:bme,providerSelection:xme,session:yme,shell:vme,claudeStatus:wme},Sme={changes:"件の変更",previousChange:"前の変更",nextChange:"次の変更",hideDiff:"差分ハイライトを非表示",showDiff:"差分ハイライトを表示",settings:"エディタ設定",collapse:"エディタを折りたたむ",expand:"エディタを全幅に展開"},Cme="{{fileName}}を読み込んでいます...",Nme={showingChanges:"変更を表示中"},Eme={download:"ファイルをダウンロード",save:"保存",saving:"保存中...",saved:"保存しました!",exitFullscreen:"全画面を終了",fullscreen:"全画面",close:"閉じる"},Tme={lines:"行数:",characters:"文字数:",shortcuts:"Ctrl+Sで保存 • Escで閉じる"},Ame={title:"バイナリファイル",message:'ファイル "{{fileName}}" はバイナリファイルのため、テキストエディタで表示できません。'},jme={toolbar:Sme,loading:Cme,header:Nme,actions:Eme,footer:Tme,binaryFile:Ame},Ime={title:"TaskMaster AIが設定されていません",description:"TaskMasterは、AIを活用した支援により、複雑なプロジェクトを管理しやすいタスクに分解するのに役立ちます",whatIsTitle:"🎯 TaskMasterとは?",features:{aiPowered:"AIを活用したタスク管理:複雑なプロジェクトを管理しやすいサブタスクに分解",prdTemplates:"PRDテンプレート:Product Requirements Documentからタスクを生成",dependencyTracking:"依存関係の追跡:タスクの関係性と実行順序を理解",progressVisualization:"進捗の可視化:カンバンボードと詳細なタスク分析",cliIntegration:"CLI統合:高度なワークフローのためにtaskmasterコマンドを使用"},initializeButton:"TaskMaster AIを初期化"},Rme={title:"TaskMasterを始める",subtitle:"TaskMasterが初期化されました!次にすることは:",steps:{createPRD:{title:"Product Requirements Document (PRD) を作成",description:"プロジェクトのアイデアについて話し合い、構築したい内容を説明するPRDを作成します。",addButton:"PRDを追加",existingPRDs:"既存のPRD:"},generateTasks:{title:"PRDからタスクを生成",description:"PRDができたら、AIアシスタントに解析を依頼してください。TaskMasterが自動的に実装の詳細を含む管理しやすいタスクに分解します。"},analyzeTasks:{title:"タスクの分析と展開",description:"AIアシスタントにタスクの複雑さを分析してもらい、より簡単に実装できる詳細なサブタスクに展開します。"},startBuilding:{title:"開発を始める",description:"AIアシスタントにタスクの作業を開始してもらい、ステータスを更新し、プロジェクトの進行に応じて新しいタスクを追加します。"}},tip:"💡 ヒント:TaskMasterのAIを活用したタスク生成を最大限に活用するには、PRDから始めましょう"},_me={title:"TaskMasterのセットアップ",subtitle:"{{projectName}}のインタラクティブCLI",willStart:"TaskMasterの初期化が自動的に開始されます",completed:"TaskMasterのセットアップが完了しました!このウィンドウを閉じることができます。",closeButton:"閉じる",closeContinueButton:"閉じて続ける"},Pme={title:"TaskMasterを始める",subtitle:"生産的なタスク管理のガイド",examples:{parsePRD:`💬 例: