@cloudcli-ai/cloudcli 1.29.0 → 1.29.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.de.md CHANGED
@@ -100,7 +100,7 @@ Die **[Dokumentation →](https://cloudcli.ai/docs)** enthält weitere Konfigura
100
100
  Agents in isolierten Sandboxes mit Hypervisor-Isolation ausführen. Standardmäßig wird Claude Code gestartet. Erfordert die [`sbx` CLI](https://docs.docker.com/ai/sandboxes/get-started/).
101
101
 
102
102
  ```
103
- npx @cloudcli-ai/cloudcli sandbox ~/my-project
103
+ npx @cloudcli-ai/cloudcli@latest sandbox ~/my-project
104
104
  ```
105
105
 
106
106
  Unterstützt Claude Code, Codex und Gemini CLI. Weitere Details in der [Sandbox-Dokumentation](docker/).
package/README.ja.md CHANGED
@@ -96,7 +96,7 @@ cloudcli
96
96
  ハイパーバイザーレベルの分離でエージェントをサンドボックスで実行します。デフォルトでは Claude Code が起動します。[`sbx` CLI](https://docs.docker.com/ai/sandboxes/get-started/) が必要です。
97
97
 
98
98
  ```
99
- npx @cloudcli-ai/cloudcli sandbox ~/my-project
99
+ npx @cloudcli-ai/cloudcli@latest sandbox ~/my-project
100
100
  ```
101
101
 
102
102
  Claude Code、Codex、Gemini CLI に対応。詳細は[サンドボックスのドキュメント](docker/)をご覧ください。
package/README.ko.md CHANGED
@@ -96,7 +96,7 @@ cloudcli
96
96
  하이퍼바이저 수준 격리로 에이전트를 샌드박스에서 실행합니다. 기본 에이전트는 Claude Code입니다. [`sbx` CLI](https://docs.docker.com/ai/sandboxes/get-started/)가 필요합니다.
97
97
 
98
98
  ```
99
- npx @cloudcli-ai/cloudcli sandbox ~/my-project
99
+ npx @cloudcli-ai/cloudcli@latest sandbox ~/my-project
100
100
  ```
101
101
 
102
102
  Claude Code, Codex, Gemini CLI를 지원합니다. 자세한 내용은 [샌드박스 문서](docker/)를 참고하세요.
package/README.md CHANGED
@@ -100,7 +100,7 @@ Visit the **[documentation →](https://cloudcli.ai/docs)** for full configurati
100
100
  Run agents in isolated sandboxes with hypervisor-level isolation. Starts Claude Code by default. Requires the [`sbx` CLI](https://docs.docker.com/ai/sandboxes/get-started/).
101
101
 
102
102
  ```
103
- npx @cloudcli-ai/cloudcli sandbox ~/my-project
103
+ npx @cloudcli-ai/cloudcli@latest sandbox ~/my-project
104
104
  ```
105
105
 
106
106
  Supports Claude Code, Codex, and Gemini CLI. See the [sandbox docs](docker/) for setup and advanced options.
@@ -116,7 +116,7 @@ CloudCLI UI is the open source UI layer that powers CloudCLI Cloud. You can self
116
116
  |---|---|---|---|
117
117
  | **Best for** | Local agent sessions on your own machine | Isolated agents with web/mobile IDE | Teams who want agents in the cloud |
118
118
  | **How you access it** | Browser via `[yourip]:port` | Browser via `localhost:port` | Browser, any IDE, REST API, n8n |
119
- | **Setup** | `npx @cloudcli-ai/cloudcli` | `npx @cloudcli-ai/cloudcli sandbox ~/project` | No setup required |
119
+ | **Setup** | `npx @cloudcli-ai/cloudcli` | `npx @cloudcli-ai/cloudcli@latest sandbox ~/project` | No setup required |
120
120
  | **Isolation** | Runs on your host | Hypervisor-level sandbox (microVM) | Full cloud isolation |
121
121
  | **Machine needs to stay on** | Yes | Yes | No |
122
122
  | **Mobile access** | Any browser on your network | Any browser on your network | Any device, native app coming |
package/README.ru.md CHANGED
@@ -100,7 +100,7 @@ cloudcli
100
100
  Запускайте агентов в изолированных песочницах с гипервизорной изоляцией. По умолчанию запускается Claude Code. Требуется [`sbx` CLI](https://docs.docker.com/ai/sandboxes/get-started/).
101
101
 
102
102
  ```
103
- npx @cloudcli-ai/cloudcli sandbox ~/my-project
103
+ npx @cloudcli-ai/cloudcli@latest sandbox ~/my-project
104
104
  ```
105
105
 
106
106
  Поддерживаются Claude Code, Codex и Gemini CLI. Подробнее в [документации sandbox](docker/).
package/README.zh-CN.md CHANGED
@@ -96,7 +96,7 @@ cloudcli
96
96
  在隔离的沙箱中运行代理,具有虚拟机管理程序级别的隔离。默认启动 Claude Code。需要 [`sbx` CLI](https://docs.docker.com/ai/sandboxes/get-started/)。
97
97
 
98
98
  ```
99
- npx @cloudcli-ai/cloudcli sandbox ~/my-project
99
+ npx @cloudcli-ai/cloudcli@latest sandbox ~/my-project
100
100
  ```
101
101
 
102
102
  支持 Claude Code、Codex 和 Gemini CLI。详情请参阅 [沙箱文档](docker/)。
@@ -666,7 +666,7 @@ import{j as s,_ as XC,a as JC,m as _4,E as Ir,R as R4,o as j4,T as D4,P as M4,S
666
666
  .xterm-screen:focus {
667
667
  outline: none !important;
668
668
  }
669
- `;function XI(){if(typeof document>"u"||document.getElementById(Kg))return;const e=document.createElement("style");e.id=Kg,e.type="text/css",e.innerText=ZI,document.head.appendChild(e)}function JI({terminalContainerRef:e,terminalRef:t,fitAddonRef:r,wsRef:n,selectedProject:a,minimal:i,isRestarting:o,initialCommandRef:l,isPlainShellRef:c,authUrlRef:u,copyAuthUrlToClipboard:d,closeSocket:p}){const[h,m]=b.useState(!1),f=b.useRef(null),g=a?.fullPath||a?.path||"",v=!!a;b.useEffect(()=>{XI()},[]);const x=b.useCallback(()=>{t.current&&(t.current.clear(),t.current.write("\x1B[2J\x1B[H"))},[t]),y=b.useCallback(()=>{t.current&&(t.current.dispose(),t.current=null),r.current=null,m(!1)},[r,t]);return b.useEffect(()=>{if(!e.current||!v||o||t.current)return;const w=new VI.Terminal(LI);t.current=w;const S=new qI.FitAddon;r.current=S,w.loadAddon(S),i||w.loadAddon(new HI.WebLinksAddon);try{w.loadAddon(new WI.WebglAddon)}catch{console.warn("[Shell] WebGL renderer unavailable, using Canvas fallback")}w.open(e.current);const E=async()=>{const T=w.getSelection();return T?Jr(T):!1},k=T=>{if(!w.hasSelection())return;const I=w.getSelection();if(I){if(T.preventDefault(),T.clipboardData){T.clipboardData.setData("text/plain",I);return}Jr(I)}};e.current.addEventListener("copy",k),w.attachCustomKeyEventHandler(T=>{const I=cE(l.current)?oE:u.current;return T.type==="keydown"&&i&&c.current&&I&&!T.ctrlKey&&!T.metaKey&&!T.altKey&&T.key?.toLowerCase()==="c"?(T.preventDefault(),T.stopPropagation(),d(I),!1):T.type==="keydown"&&(T.ctrlKey||T.metaKey)&&T.key?.toLowerCase()==="c"&&w.hasSelection()?(T.preventDefault(),T.stopPropagation(),E(),!1):T.type==="keydown"&&(T.ctrlKey||T.metaKey)&&T.key?.toLowerCase()==="v"?(T.preventDefault(),T.stopPropagation(),typeof navigator<"u"&&navigator.clipboard?.readText&&navigator.clipboard.readText().then(M=>{Qn(n.current,{type:"input",data:M})}).catch(()=>{}),!1):!0}),window.setTimeout(()=>{const T=r.current,I=t.current;!T||!I||(T.fit(),Qn(n.current,{type:"resize",cols:I.cols,rows:I.rows}))},lE),m(!0);const C=w.onData(T=>{Qn(n.current,{type:"input",data:T})}),R=new ResizeObserver(()=>{f.current!==null&&window.clearTimeout(f.current),f.current=window.setTimeout(()=>{const T=r.current,I=t.current;!T||!I||(T.fit(),Qn(n.current,{type:"resize",cols:I.cols,rows:I.rows}))},_I)});return R.observe(e.current),()=>{e.current?.removeEventListener("copy",k),R.disconnect(),f.current!==null&&(window.clearTimeout(f.current),f.current=null),C.dispose(),p(),y()}},[u,p,d,y,r,l,c,o,i,v,g,e,t,n]),{isInitialized:h,clearTerminalScreen:x,disposeTerminal:y}}function QI({selectedProject:e,selectedSession:t,initialCommand:r,isPlainShell:n,minimal:a,autoConnect:i,isRestarting:o,onProcessComplete:l,onOutputRef:c}){const u=b.useRef(null),d=b.useRef(null),p=b.useRef(null),h=b.useRef(null),[m,f]=b.useState(""),[g,v]=b.useState(0),x=b.useRef(e),y=b.useRef(t),w=b.useRef(r),S=b.useRef(n),E=b.useRef(l),k=b.useRef(""),C=b.useRef(t?.id??null);b.useEffect(()=>{x.current=e,y.current=t,w.current=r,S.current=n,E.current=l},[e,t,r,n,l]);const R=b.useCallback(q=>{k.current=q,f(q),v(L=>L+1)},[]),T=b.useCallback(()=>{const q=h.current;q&&((q.readyState===WebSocket.OPEN||q.readyState===WebSocket.CONNECTING)&&q.close(),h.current=null)},[]),I=b.useCallback((q=k.current)=>{if(!q)return!1;const L=window.open(q,"_blank");if(L){try{L.opener=null}catch{}return!0}return!1},[]),M=b.useCallback(async(q=k.current)=>q?Jr(q):!1,[]),{isInitialized:_,clearTerminalScreen:P,disposeTerminal:N}=JI({terminalContainerRef:u,terminalRef:d,fitAddonRef:p,wsRef:h,selectedProject:e,minimal:a,isRestarting:o,initialCommandRef:w,isPlainShellRef:S,authUrlRef:k,copyAuthUrlToClipboard:M,closeSocket:T}),{isConnected:z,isConnecting:J,connectToShell:H,disconnectFromShell:K}=UI({wsRef:h,terminalRef:d,fitAddonRef:p,selectedProjectRef:x,selectedSessionRef:y,initialCommandRef:w,isPlainShellRef:S,onProcessCompleteRef:E,isInitialized:_,autoConnect:i,closeSocket:T,clearTerminalScreen:P,setAuthUrl:R,onOutputRef:c});return b.useEffect(()=>{o&&(K(),N())},[K,N,o]),b.useEffect(()=>{e||(K(),N())},[K,N,e]),b.useEffect(()=>{const q=t?.id??null;C.current!==q&&_&&K(),C.current=q},[K,_,t?.id]),{terminalContainerRef:u,terminalRef:d,wsRef:h,isConnected:z,isInitialized:_,isConnecting:J,authUrl:m,authUrlVersion:g,connectToShell:H,disconnectFromShell:K,openAuthUrlInBrowser:I,copyAuthUrlToClipboard:M}}function e_({mode:e,description:t,loadingLabel:r,connectLabel:n,connectTitle:a,connectingLabel:i,onConnect:o}){return e==="loading"?s.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-gray-900 bg-opacity-90",children:s.jsx("div",{className:"text-white",children:r})}):e==="connect"?s.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-gray-900 bg-opacity-90 p-4",children:s.jsxs("div",{className:"w-full max-w-sm text-center",children:[s.jsxs("button",{onClick:o,className:"flex w-full items-center justify-center space-x-2 rounded-lg bg-green-600 px-6 py-3 text-base font-medium text-white transition-colors hover:bg-green-700 sm:w-auto",title:a,children:[s.jsx("svg",{className:"h-5 w-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M13 10V3L4 14h7v7l9-11h-7z"})}),s.jsx("span",{children:n})]}),s.jsx("p",{className:"mt-3 px-2 text-sm text-gray-400",children:t})]})}):s.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-gray-900 bg-opacity-90 p-4",children:s.jsxs("div",{className:"w-full max-w-sm text-center",children:[s.jsxs("div",{className:"flex items-center justify-center space-x-3 text-yellow-400",children:[s.jsx("div",{className:"h-6 w-6 animate-spin rounded-full border-2 border-yellow-400 border-t-transparent"}),s.jsx("span",{className:"text-base font-medium",children:i})]}),s.jsx("p",{className:"mt-3 px-2 text-sm text-gray-400",children:t})]})})}function t_({title:e,description:t}){return s.jsx("div",{className:"flex h-full items-center justify-center",children:s.jsxs("div",{className:"text-center text-gray-500 dark:text-gray-400",children:[s.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:s.jsx("svg",{className:"h-8 w-8 text-gray-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:s.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 00-2 2v14a2 2 0 002 2z"})})}),s.jsx("h3",{className:"mb-2 text-lg font-semibold",children:e}),s.jsx("p",{children:t})]})})}function r_({isConnected:e,isInitialized:t,isRestarting:r,hasSession:n,sessionDisplayNameShort:a,onDisconnect:i,onRestart:o,statusNewSessionText:l,statusInitializingText:c,statusRestartingText:u,disconnectLabel:d,disconnectTitle:p,restartLabel:h,restartTitle:m,disableRestart:f}){return s.jsx("div",{className:"flex-shrink-0 border-b border-gray-700 bg-gray-800 px-4 py-2",children:s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("div",{className:"flex items-center space-x-2",children:[s.jsx("div",{className:`h-2 w-2 rounded-full ${e?"bg-green-500":"bg-red-500"}`}),n&&a&&s.jsxs("span",{className:"text-xs text-blue-300",children:["(",a,"...)"]}),!n&&s.jsx("span",{className:"text-xs text-gray-400",children:l}),!t&&s.jsx("span",{className:"text-xs text-yellow-400",children:c}),r&&s.jsx("span",{className:"text-xs text-blue-400",children:u})]}),s.jsxs("div",{className:"flex items-center space-x-3",children:[e&&s.jsxs("button",{onClick:i,className:"flex items-center space-x-1 rounded bg-red-600 px-3 py-1 text-xs text-white hover:bg-red-700",title:p,children:[s.jsx("svg",{className:"h-3 w-3",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})}),s.jsx("span",{children:d})]}),s.jsxs("button",{onClick:o,disabled:f,className:"flex items-center space-x-1 text-xs text-gray-400 hover:text-white disabled:cursor-not-allowed disabled:opacity-50",title:m,children:[s.jsx("svg",{className:"h-3 w-3",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"})}),s.jsx("span",{children:h})]})]})]})})}function n_({terminalContainerRef:e,authUrl:t,authUrlVersion:r,initialCommand:n,isConnected:a,openAuthUrlInBrowser:i,copyAuthUrlToClipboard:o}){const[l,c]=b.useState("idle"),[u,d]=b.useState(!1),p=b.useMemo(()=>KI(n,t),[t,n]);b.useEffect(()=>{c("idle"),d(!1)},[r,p,a]);const h=!!p,m=h&&!u,f=h&&u;return s.jsxs("div",{className:"relative h-full w-full bg-gray-900",children:[s.jsx("div",{ref:e,className:"h-full w-full focus:outline-none",style:{outline:"none"}}),m&&s.jsx("div",{className:"absolute inset-x-0 bottom-14 z-20 border-t border-gray-700/80 bg-gray-900/95 p-3 backdrop-blur-sm md:hidden",children:s.jsxs("div",{className:"flex flex-col gap-2",children:[s.jsxs("div",{className:"flex items-center justify-between gap-2",children:[s.jsx("p",{className:"text-xs text-gray-300",children:"Open or copy the login URL:"}),s.jsx("button",{type:"button",onClick:()=>d(!0),className:"rounded bg-gray-700 px-2 py-1 text-[10px] font-medium uppercase tracking-wide text-gray-100 hover:bg-gray-600",children:"Hide"})]}),s.jsx("input",{type:"text",value:p,readOnly:!0,onClick:g=>g.currentTarget.select(),className:"w-full rounded border border-gray-600 bg-gray-800 px-2 py-1 text-xs text-gray-100 focus:outline-none focus:ring-1 focus:ring-blue-500","aria-label":"Authentication URL"}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("button",{type:"button",onClick:()=>{i(p)},className:"flex-1 rounded bg-blue-600 px-3 py-2 text-xs font-medium text-white hover:bg-blue-700",children:"Open URL"}),s.jsx("button",{type:"button",onClick:async()=>{const g=await o(p);c(g?"copied":"failed")},className:"flex-1 rounded bg-gray-700 px-3 py-2 text-xs font-medium text-white hover:bg-gray-600",children:l==="copied"?"Copied":"Copy URL"})]})]})}),f&&s.jsx("div",{className:"absolute bottom-14 right-3 z-20 md:hidden",children:s.jsx("button",{type:"button",onClick:()=>d(!1),className:"rounded bg-gray-800/95 px-3 py-2 text-xs font-medium text-gray-100 shadow-lg backdrop-blur-sm hover:bg-gray-700",children:"Show login URL"})})]})}const a_=[{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"}],i_={up:K4,down:Xh,left:IA,right:Jh},ui=e=>e.preventDefault(),Yg="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",s_="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",rl="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 Zg({wsRef:e,terminalRef:t,isConnected:r,bottomOffset:n="bottom-0"}){const{t:a}=Le("settings"),[i,o]=b.useState(!1),[l,c]=b.useState(!1),u=b.useCallback(m=>{Qn(e.current,{type:"input",data:m})},[e]),d=b.useCallback(()=>{t.current?.scrollToBottom()},[t]),p=b.useCallback(async()=>{if(!(typeof navigator>"u"||!navigator.clipboard?.readText))try{const m=await navigator.clipboard.readText();m.length>0&&u(m)}catch{}},[u]),h=b.useCallback(m=>{let f=m;if(i&&m.length===1){const g=m.toLowerCase().charCodeAt(0);g>=97&&g<=122&&(f=String.fromCharCode(g-96)),o(!1)}l&&m.length===1&&(f="\x1B"+f,c(!1)),u(f)},[i,l,u]);return s.jsx("div",{className:`pointer-events-none fixed inset-x-0 ${n} z-20 px-2 md:hidden`,children:s.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:[s.jsx("button",{type:"button",onPointerDown:ui,onClick:()=>{p()},disabled:!r,className:rl,title:a("terminalShortcuts.paste",{defaultValue:"Paste"}),"aria-label":a("terminalShortcuts.paste",{defaultValue:"Paste"}),children:s.jsx(g6,{className:"h-4 w-4"})}),a_.map(m=>{if(m.type==="modifier"){const f=m.modifier==="ctrl"?i:l,g=m.modifier==="ctrl"?()=>o(v=>!v):()=>c(v=>!v);return s.jsx("button",{type:"button",onPointerDown:ui,onClick:g,disabled:!r,className:f?s_:Yg,children:m.label},m.id)}if(m.type==="arrow"){const f=i_[m.icon];return s.jsx("button",{type:"button",onPointerDown:ui,onClick:()=>u(m.sequence),disabled:!r,className:rl,children:s.jsx(f,{className:"h-4 w-4"})},m.id)}return s.jsx("button",{type:"button",onPointerDown:ui,onClick:()=>h(m.sequence),disabled:!r,className:Yg,children:m.label},m.id)}),s.jsx("button",{type:"button",onPointerDown:ui,onClick:d,disabled:!r,className:rl,title:a("terminalShortcuts.scrollDown"),"aria-label":a("terminalShortcuts.scrollDown"),children:s.jsx(CA,{className:"h-4 w-4"})})]})})}function uE({selectedProject:e=null,selectedSession:t=null,initialCommand:r=null,isPlainShell:n=!1,onProcessComplete:a=null,minimal:i=!1,autoConnect:o=!1,isActive:l=!0}){const{t:c}=Le("chat"),[u,d]=b.useState(!1),[p,h]=b.useState(null),m=b.useRef(null),f=b.useRef(null),{terminalContainerRef:g,terminalRef:v,wsRef:x,isConnected:y,isInitialized:w,isConnecting:S,authUrl:E,authUrlVersion:k,connectToShell:C,disconnectFromShell:R,openAuthUrlInBrowser:T,copyAuthUrlToClipboard:I}=QI({selectedProject:e,selectedSession:t,initialCommand:r,isPlainShell:n,minimal:i,autoConnect:o,isRestarting:u,onProcessComplete:a,onOutputRef:f}),M=b.useCallback(()=>{const B=v.current;if(!B)return;const O=B.buffer.active,ee=O.baseY+O.cursorY,te=Math.min(O.baseY+O.length-1,ee+10),ce=Math.max(0,ee-jI),ie=[];for(let Ie=ce;Ie<=te;Ie++){const Fe=O.getLine(Ie);Fe&&ie.push(Fe.translateToString().trimEnd())}let ge=-1;for(let Ie=ie.length-1;Ie>=0;Ie--)if(/esc to cancel/i.test(ie[Ie])||/enter to select/i.test(ie[Ie])){ge=Ie;break}if(ge===-1){h(null);return}const ye=new Map,Re=Math.max(0,ge-DI);for(let Ie=ge-1;Ie>=Re;Ie--){const Fe=ie[Ie].match(/^\s*[❯›>]?\s*(\d+)\.\s+(.+)/);if(Fe){const D=Fe[1],de=Fe[2].trim();parseInt(D,10)<=MI&&de.length>0&&!ye.has(D)&&ye.set(D,de)}}const Ee=[];for(let Ie=1;Ie<=ye.size&&ye.has(String(Ie));Ie++)Ee.push({number:String(Ie),label:ye.get(String(Ie))});h(Ee.length>=OI?Ee:null)},[v]),_=b.useCallback(()=>{m.current&&clearTimeout(m.current),m.current=setTimeout(M,RI)},[M]);b.useEffect(()=>{f.current=_},[_]),b.useEffect(()=>()=>{m.current&&clearTimeout(m.current)},[]),b.useEffect(()=>{y||(m.current&&(clearTimeout(m.current),m.current=null),h(null))},[y]),b.useEffect(()=>{if(!l||!w||!y)return;const B=()=>{v.current?.focus()},O=window.requestAnimationFrame(B),ee=window.setTimeout(B,0);return()=>{window.cancelAnimationFrame(O),window.clearTimeout(ee)}},[l,y,w,v]);const P=b.useCallback(B=>{Qn(x.current,{type:"input",data:B})},[x]),N=b.useMemo(()=>YI(t),[t]),z=b.useMemo(()=>N?N.slice(0,30):null,[N]),J=b.useMemo(()=>N?N.slice(0,50):null,[N]),H=b.useCallback(()=>{d(!0),window.setTimeout(()=>{d(!1)},II)},[]);if(!e)return s.jsx(t_,{title:c("shell.selectProject.title"),description:c("shell.selectProject.description")});if(i)return s.jsxs(s.Fragment,{children:[s.jsx(n_,{terminalContainerRef:g,authUrl:E,authUrlVersion:k,initialCommand:r,isConnected:y,openAuthUrlInBrowser:T,copyAuthUrlToClipboard:I}),s.jsx(Zg,{wsRef:x,terminalRef:v,isConnected:y,bottomOffset:"bottom-0"})]});const K=n?c("shell.runCommand",{command:r||c("shell.defaultCommand"),projectName:e.displayName}):t?c("shell.resumeSession",{displayName:J}):c("shell.startSession"),q=n?c("shell.runCommand",{command:r||c("shell.defaultCommand"),projectName:e.displayName}):c("shell.startCli",{projectName:e.displayName}),L=w?S?"connecting":y?null:"connect":"loading",W=L==="connecting"?q:K;return s.jsxs("div",{className:"flex h-full w-full flex-col bg-gray-900",children:[s.jsx(r_,{isConnected:y,isInitialized:w,isRestarting:u,hasSession:!!t,sessionDisplayNameShort:z,onDisconnect:R,onRestart:H,statusNewSessionText:c("shell.status.newSession"),statusInitializingText:c("shell.status.initializing"),statusRestartingText:c("shell.status.restarting"),disconnectLabel:c("shell.actions.disconnect"),disconnectTitle:c("shell.actions.disconnectTitle"),restartLabel:c("shell.actions.restart"),restartTitle:c("shell.actions.restartTitle"),disableRestart:u||y}),s.jsxs("div",{className:"relative flex-1 overflow-hidden p-2",children:[s.jsx("div",{ref:g,className:"h-full w-full focus:outline-none",style:{outline:"none"}}),L&&s.jsx(e_,{mode:L,description:W,loadingLabel:c("shell.loading"),connectLabel:c("shell.actions.connect"),connectTitle:c("shell.actions.connectTitle"),connectingLabel:c("shell.connecting"),onConnect:C}),p&&y&&s.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:B=>B.preventDefault(),children:s.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[p.map(B=>s.jsxs("button",{type:"button",onClick:()=>{P(B.number),h(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:`${B.number}. ${B.label}`,children:[B.number,". ",B.label]},B.number)),s.jsx("button",{type:"button",onClick:()=>{P("\x1B"),h(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"})]})})]}),s.jsx(Zg,{wsRef:x,terminalRef:v,isConnected:y})]})}function o_({className:e}){return s.jsx("div",{className:`flex h-full items-center justify-center ${e}`,children:s.jsxs("div",{className:"text-center text-gray-500 dark:text-gray-400",children:[s.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:s.jsx("svg",{className:"h-8 w-8 text-gray-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:s.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"})})}),s.jsx("h3",{className:"mb-2 text-lg font-semibold",children:"No Project Selected"}),s.jsx("p",{children:"A project is required to open a shell"})]})})}function l_({title:e,isCompleted:t,onClose:r=null}){return s.jsx("div",{className:"flex-shrink-0 border-b border-gray-700 bg-gray-800 px-4 py-2",children:s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("div",{className:"flex items-center space-x-2",children:[s.jsx("h3",{className:"text-sm font-medium text-gray-200",children:e}),t&&s.jsx("span",{className:"text-xs text-green-400",children:"(Completed)"})]}),r&&s.jsx("button",{onClick:r,className:"text-gray-400 hover:text-white",title:"Close",children:s.jsx("svg",{className:"h-4 w-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]})})}function dE({project:e=null,session:t=null,command:r=null,isPlainShell:n=null,isActive:a=!0,autoConnect:i=!0,onComplete:o=null,onClose:l=null,title:c=null,className:u="",showHeader:d=!0,compact:p=!1,minimal:h=!1}){const[m,f]=b.useState(!1),g=n!==null?n:r!==null,v=b.useCallback(x=>{f(!0),o?.(x)},[o]);return e?s.jsxs("div",{className:`flex h-full w-full flex-col ${u}`,children:[!h&&d&&c&&s.jsx(l_,{title:c,isCompleted:m,onClose:l}),s.jsx("div",{className:"min-h-0 w-full flex-1",children:s.jsx(uE,{selectedProject:e,selectedSession:t,initialCommand:r,isPlainShell:g,isActive:a,onProcessComplete:v,minimal:h,autoConnect:h?!0:i})})]}):s.jsx(o_,{className:u})}const c_=({provider:e,customCommand:t,isAuthenticated:r})=>t||(e==="claude"?"claude --dangerously-skip-permissions /login":e==="cursor"?"cursor-agent login":e==="codex"?"codex login":"gemini status"),u_=e=>e==="claude"?"Claude CLI Login":e==="cursor"?"Cursor CLI Login":e==="codex"?"Codex CLI Login":"Gemini CLI Configuration",d_=e=>{const t=e?.name||"default",r=e?.fullPath??e?.path??"";return{name:t,displayName:e?.displayName||t,fullPath:r,path:e?.path??r}};function pE({isOpen:e,onClose:t,provider:r="claude",project:n=null,onComplete:a,customCommand:i,isAuthenticated:o=!1}){if(!e)return null;const l=c_({provider:r,customCommand:i,isAuthenticated:o}),c=u_(r),u=d_(n),d=p=>{a?.(p)};return s.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:s.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:[s.jsxs("div",{className:"flex items-center justify-between border-b border-gray-200 p-4 dark:border-gray-700",children:[s.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white",children:c}),s.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:s.jsx(kt,{className:"h-6 w-6"})})]}),s.jsx("div",{className:"flex-1 overflow-hidden",children:r==="gemini"?s.jsxs("div",{className:"flex h-full flex-col items-center justify-center bg-gray-50 p-8 text-center dark:bg-gray-900/50",children:[s.jsx("div",{className:"mb-6 flex h-16 w-16 items-center justify-center rounded-full bg-blue-100 dark:bg-blue-900/30",children:s.jsx(p7,{className:"h-8 w-8 text-blue-600 dark:text-blue-400"})}),s.jsx("h4",{className:"mb-3 text-xl font-medium text-gray-900 dark:text-white",children:"Setup Gemini API Access"}),s.jsx("p",{className:"mb-8 max-w-md text-gray-600 dark:text-gray-400",children:"The Gemini CLI requires an API key to function. Configure it in your terminal first."}),s.jsx("div",{className:"w-full max-w-lg rounded-xl border border-gray-200 bg-white p-6 text-left shadow-sm dark:border-gray-700 dark:bg-gray-800",children:s.jsxs("ol",{className:"space-y-4",children:[s.jsxs("li",{className:"flex gap-4",children:[s.jsx("div",{className:"flex h-6 w-6 flex-shrink-0 items-center justify-center rounded-full bg-blue-100 text-sm font-medium text-blue-600 dark:bg-blue-900/50 dark:text-blue-400",children:"1"}),s.jsxs("div",{children:[s.jsx("p",{className:"mb-1 text-sm font-medium text-gray-900 dark:text-white",children:"Get your API key"}),s.jsxs("a",{href:"https://aistudio.google.com/app/apikey",target:"_blank",rel:"noreferrer",className:"flex inline-flex items-center gap-1 text-sm text-blue-600 hover:underline dark:text-blue-400",children:["Google AI Studio ",s.jsx(Vr,{className:"h-3 w-3"})]})]})]}),s.jsxs("li",{className:"flex gap-4",children:[s.jsx("div",{className:"flex h-6 w-6 flex-shrink-0 items-center justify-center rounded-full bg-blue-100 text-sm font-medium text-blue-600 dark:bg-blue-900/50 dark:text-blue-400",children:"2"}),s.jsxs("div",{children:[s.jsx("p",{className:"mb-1 text-sm font-medium text-gray-900 dark:text-white",children:"Run configuration"}),s.jsx("p",{className:"mb-2 text-sm text-gray-600 dark:text-gray-400",children:"Open your terminal and run:"}),s.jsx("code",{className:"block rounded bg-gray-100 px-3 py-2 font-mono text-sm text-pink-600 dark:bg-gray-900 dark:text-pink-400",children:"gemini config set api_key YOUR_KEY"})]})]})]})}),s.jsx("button",{onClick:t,className:"mt-8 rounded-lg bg-blue-600 px-6 py-2.5 font-medium text-white transition-colors hover:bg-blue-700",children:"Done"})]}):s.jsx(dE,{project:u,command:l,onComplete:d,minimal:!0})})]})})}const p_=({className:e="w-5 h-5"})=>s.jsx("img",{src:"/icons/claude-ai-icon.svg",alt:"Claude",className:e}),m_=({className:e="w-5 h-5"})=>{const{isDarkMode:t}=Ka();return s.jsx("img",{src:t?"/icons/codex-white.svg":"/icons/codex.svg",alt:"Codex",className:e})},h_=({className:e="w-5 h-5"})=>{const{isDarkMode:t}=Ka();return s.jsx("img",{src:t?"/icons/cursor-white.svg":"/icons/cursor.svg",alt:"Cursor",className:e})},f_=({className:e="w-5 h-5"})=>s.jsx("img",{src:"/icons/gemini-ai-icon.svg",alt:"Gemini",className:e});function Or({provider:e="claude",className:t="w-5 h-5"}){return e==="cursor"?s.jsx(h_,{className:t}):e==="codex"?s.jsx(m_,{className:t}):e==="gemini"?s.jsx(f_,{className:t}):s.jsx(p_,{className:t})}function g_({provider:e,title:t,status:r,connectedClassName:n,iconContainerClassName:a,loginButtonClassName:i,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 s.jsx("div",{className:`rounded-lg border p-4 transition-colors ${l}`,children:s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("div",{className:`flex h-10 w-10 items-center justify-center rounded-full ${a}`,children:s.jsx(Or,{provider:e,className:"h-5 w-5"})}),s.jsxs("div",{children:[s.jsxs("div",{className:"flex items-center gap-2 font-medium text-foreground",children:[t,r.authenticated&&s.jsx(Xt,{className:"h-4 w-4 text-green-500"})]}),s.jsx("div",{className:"text-xs text-muted-foreground",children:c})]})]}),!r.authenticated&&!r.loading&&s.jsx("button",{onClick:o,className:`${i} rounded-lg px-4 py-2 text-sm font-medium text-white transition-colors`,children:"Login"})]})})}const b_=[{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"}];function x_({providerStatuses:e,onOpenProviderLogin:t}){return s.jsxs("div",{className:"space-y-6",children:[s.jsxs("div",{className:"mb-6 text-center",children:[s.jsx("h2",{className:"mb-2 text-2xl font-bold text-foreground",children:"Connect Your AI Agents"}),s.jsx("p",{className:"text-muted-foreground",children:"Login to one or more AI coding assistants. All are optional."})]}),s.jsx("div",{className:"space-y-3",children:b_.map(r=>s.jsx(g_,{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))}),s.jsx("div",{className:"pt-2 text-center text-sm text-muted-foreground",children:s.jsx("p",{children:"You can configure these later in Settings."})})]})}function y_({gitName:e,gitEmail:t,isSubmitting:r,onGitNameChange:n,onGitEmailChange:a}){return s.jsxs("div",{className:"space-y-6",children:[s.jsxs("div",{className:"mb-8 text-center",children:[s.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:s.jsx(ir,{className:"h-8 w-8 text-blue-600 dark:text-blue-400"})}),s.jsx("h2",{className:"mb-2 text-2xl font-bold text-foreground",children:"Git Configuration"}),s.jsx("p",{className:"text-muted-foreground",children:"Configure your git identity to ensure proper attribution for commits."})]}),s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{children:[s.jsxs("label",{htmlFor:"gitName",className:"mb-2 flex items-center gap-2 text-sm font-medium text-foreground",children:[s.jsx(SI,{className:"h-4 w-4"}),"Git Name ",s.jsx("span",{className:"text-red-500",children:"*"})]}),s.jsx("input",{type:"text",id:"gitName",value:e,onChange:i=>n(i.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}),s.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:"Saved as `git config --global user.name`."})]}),s.jsxs("div",{children:[s.jsxs("label",{htmlFor:"gitEmail",className:"mb-2 flex items-center gap-2 text-sm font-medium text-foreground",children:[s.jsx(k7,{className:"h-4 w-4"}),"Git Email ",s.jsx("span",{className:"text-red-500",children:"*"})]}),s.jsx("input",{type:"email",id:"gitEmail",value:t,onChange:i=>a(i.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}),s.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:"Saved as `git config --global user.email`."})]})]})]})}const Xg=[{title:"Git Configuration",icon:ir,required:!0},{title:"Connect Agents",icon:tE,required:!1}];function v_({currentStep:e}){return s.jsx("div",{className:"mb-8",children:s.jsx("div",{className:"flex items-center justify-between",children:Xg.map((t,r)=>{const n=r<e,a=r===e,i=t.icon;return s.jsxs("div",{className:"contents",children:[s.jsxs("div",{className:"flex flex-1 flex-col items-center",children:[s.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?s.jsx(Xt,{className:"h-6 w-6"}):s.jsx(i,{className:"h-6 w-6"})}),s.jsxs("div",{className:"mt-2 text-center",children:[s.jsx("p",{className:`text-sm font-medium ${a?"text-foreground":"text-muted-foreground"}`,children:t.title}),t.required&&s.jsx("span",{className:"text-xs text-red-500",children:"Required"})]})]}),r<Xg.length-1&&s.jsx("div",{className:`mx-2 h-0.5 flex-1 transition-colors duration-200 ${n?"bg-green-500":"bg-border"}`})]},t.title)})})})}const w_=["claude","cursor","codex","gemini"],Jg=/^[^\s@]+@[^\s@]+\.[^\s@]+$/,k_={name:"default",displayName:"default",fullPath:"",path:""},S_=()=>({claude:{authenticated:!1,email:null,loading:!0,error:null},cursor:{authenticated:!1,email:null,loading:!0,error:null},codex:{authenticated:!1,email:null,loading:!0,error:null},gemini:{authenticated:!1,email:null,loading:!0,error:null}}),Qg=async(e,t)=>{try{return(await e.json()).error||t}catch{return t}};function E_({onComplete:e}){const[t,r]=b.useState(0),[n,a]=b.useState(""),[i,o]=b.useState(""),[l,c]=b.useState(!1),[u,d]=b.useState(""),[p,h]=b.useState(null),[m,f]=b.useState(S_),g=b.useRef(void 0),v=b.useCallback(async T=>{try{const I=await Ce(`/api/cli/${T}/status`);if(!I.ok){f(_=>({..._,[T]:{authenticated:!1,email:null,loading:!1,error:"Failed to check authentication status"}}));return}const M=await I.json();f(_=>({..._,[T]:{authenticated:!!M.authenticated,email:M.email??null,loading:!1,error:M.error??null}}))}catch(I){console.error(`Error checking ${T} auth status:`,I),f(M=>({...M,[T]:{authenticated:!1,email:null,loading:!1,error:I instanceof Error?I.message:"Unknown error"}}))}},[]),x=b.useCallback(async()=>{await Promise.all(w_.map(T=>v(T)))},[v]),y=b.useCallback(async()=>{try{const T=await Ce("/api/user/git-config");if(!T.ok)return;const I=await T.json();I.gitName&&a(I.gitName),I.gitEmail&&o(I.gitEmail)}catch(T){console.error("Error loading git config:",T)}},[]);b.useEffect(()=>{y(),x()},[y,x]),b.useEffect(()=>{const T=g.current;g.current=p,(T===void 0||T!==null&&p===null)&&x()},[p,x]);const w=T=>{h(T)},S=T=>{T===0&&p&&v(p)},E=async()=>{if(d(""),t!==0){r(T=>T+1);return}if(!n.trim()||!i.trim()){d("Both git name and email are required.");return}if(!Jg.test(i)){d("Please enter a valid email address.");return}c(!0);try{const T=await Ce("/api/user/git-config",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({gitName:n,gitEmail:i})});if(!T.ok){const I=await Qg(T,"Failed to save git configuration");throw new Error(I)}r(I=>I+1)}catch(T){d(T instanceof Error?T.message:"Failed to save git configuration")}finally{c(!1)}},k=()=>{d(""),r(T=>T-1)},C=async()=>{c(!0),d("");try{const T=await Ce("/api/user/complete-onboarding",{method:"POST"});if(!T.ok){const I=await Qg(T,"Failed to complete onboarding");throw new Error(I)}await e?.()}catch(T){d(T instanceof Error?T.message:"Failed to complete onboarding")}finally{c(!1)}},R=t===0?!!(n.trim()&&i.trim()&&Jg.test(i)):!0;return s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"flex min-h-screen items-center justify-center bg-background p-4",children:s.jsxs("div",{className:"w-full max-w-2xl",children:[s.jsx(v_,{currentStep:t}),s.jsxs("div",{className:"rounded-lg border border-border bg-card p-8 shadow-lg",children:[t===0?s.jsx(y_,{gitName:n,gitEmail:i,isSubmitting:l,onGitNameChange:a,onGitEmailChange:o}):s.jsx(x_,{providerStatuses:m,onOpenProviderLogin:w}),u&&s.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:s.jsx("p",{className:"text-sm text-red-700 dark:text-red-400",children:u})}),s.jsxs("div",{className:"mt-8 flex items-center justify-between border-t border-border pt-6",children:[s.jsxs("button",{onClick:k,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:[s.jsx(ef,{className:"h-4 w-4"}),"Previous"]}),s.jsx("div",{className:"flex items-center gap-3",children:t<1?s.jsx("button",{onClick:E,disabled:!R||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?s.jsxs(s.Fragment,{children:[s.jsx(Er,{className:"h-4 w-4 animate-spin"}),"Saving..."]}):s.jsxs(s.Fragment,{children:["Next",s.jsx(Fr,{className:"h-4 w-4"})]})}):s.jsx("button",{onClick:C,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?s.jsxs(s.Fragment,{children:[s.jsx(Er,{className:"h-4 w-4 animate-spin"}),"Completing..."]}):s.jsxs(s.Fragment,{children:[s.jsx(Xt,{className:"h-4 w-4"}),"Complete Setup"]})})})]})]})]})}),p&&s.jsx(pE,{isOpen:!!p,onClose:()=>h(null),provider:p,project:k_,onComplete:S})]})}const N_=["0s","0.1s","0.2s"];function C_(){return s.jsx("div",{className:"flex min-h-screen items-center justify-center bg-background p-4",children:s.jsxs("div",{className:"text-center",children:[s.jsx("div",{className:"mb-4 flex justify-center",children:s.jsx("div",{className:"flex h-16 w-16 items-center justify-center rounded-lg bg-primary shadow-sm",children:s.jsx(aa,{className:"h-8 w-8 text-primary-foreground"})})}),s.jsx("h1",{className:"mb-2 text-2xl font-bold text-foreground",children:"CloudCLI"}),s.jsx("div",{className:"flex items-center justify-center space-x-2",children:N_.map(e=>s.jsx("div",{className:"h-2 w-2 animate-bounce rounded-full bg-blue-500",style:{animationDelay:e}},e))}),s.jsx("p",{className:"mt-2 text-muted-foreground",children:"Loading..."})]})})}function mE({errorMessage:e}){return e?s.jsx("div",{className:"rounded-md border border-red-300 bg-red-100 p-3 dark:border-red-800 dark:bg-red-900/20",children:s.jsx("p",{className:"text-sm text-red-700 dark:text-red-400",children:e})}):null}function _i({id:e,label:t,value:r,onChange:n,placeholder:a,isDisabled:i,type:o="text",name:l,autoComplete:c}){return s.jsxs("div",{children:[s.jsx("label",{htmlFor:e,className:"mb-1 block text-sm font-medium text-foreground",children:t}),s.jsx("input",{id:e,type:o,name:l??e,autoComplete:c,value:r,onChange:u=>n(u.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:i})]})}function hE({title:e,description:t,children:r,footerText:n,logo:a}){return s.jsx("div",{className:"flex min-h-screen items-center justify-center bg-background p-4",children:s.jsx("div",{className:"w-full max-w-md",children:s.jsxs("div",{className:"space-y-6 rounded-lg border border-border bg-card p-8 shadow-lg",children:[s.jsxs("div",{className:"text-center",children:[s.jsx("div",{className:"mb-4 flex justify-center",children:a??s.jsx("div",{className:"flex h-16 w-16 items-center justify-center rounded-lg bg-primary shadow-sm",children:s.jsx(aa,{className:"h-8 w-8 text-primary-foreground"})})}),s.jsx("h1",{className:"text-2xl font-bold text-foreground",children:e}),s.jsx("p",{className:"mt-2 text-muted-foreground",children:t})]}),r,s.jsx("div",{className:"text-center",children:s.jsx("p",{className:"text-sm text-muted-foreground",children:n})}),s.jsxs("div",{className:"flex items-center justify-center gap-1.5 pt-2",children:[s.jsx("svg",{className:"h-3.5 w-3.5 text-muted-foreground/50",fill:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:s.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"})}),s.jsx("a",{href:"https://github.com/siteboon/claudecodeui",target:"_blank",rel:"noopener noreferrer",className:"text-xs text-muted-foreground/50 transition-colors hover:text-muted-foreground",children:"CloudCLI is open source"})]})]})})})}const T_={username:"",password:""};function A_(){const{t:e}=Le("auth"),{login:t}=Wi(),[r,n]=b.useState(T_),[a,i]=b.useState(""),[o,l]=b.useState(!1),c=b.useCallback((d,p)=>{n(h=>({...h,[d]:p}))},[]),u=b.useCallback(async d=>{if(d.preventDefault(),i(""),!r.username.trim()||!r.password){i(e("login.errors.requiredFields"));return}l(!0);const p=await t(r.username.trim(),r.password);p.success||i(p.error),l(!1)},[r.password,r.username,t,e]);return s.jsx(hE,{title:e("login.title"),description:e("login.description"),footerText:"Enter your credentials to access CloudCLI",children:s.jsxs("form",{onSubmit:u,className:"space-y-4",children:[s.jsx(_i,{id:"username",label:e("login.username"),value:r.username,onChange:d=>c("username",d),placeholder:e("login.placeholders.username"),isDisabled:o,autoComplete:"username"}),s.jsx(_i,{id:"password",label:e("login.password"),value:r.password,onChange:d=>c("password",d),placeholder:e("login.placeholders.password"),isDisabled:o,type:"password",autoComplete:"current-password"}),s.jsx(mE,{errorMessage:a}),s.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 I_={username:"",password:"",confirmPassword:""};function __(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.":null}function R_(){const{register:e}=Wi(),[t,r]=b.useState(I_),[n,a]=b.useState(""),[i,o]=b.useState(!1),l=b.useCallback((u,d)=>{r(p=>({...p,[u]:d}))},[]),c=b.useCallback(async u=>{u.preventDefault(),a("");const d=__(t);if(d){a(d);return}o(!0);const p=await e(t.username.trim(),t.password);p.success||a(p.error),o(!1)},[t,e]);return s.jsx(hE,{title:"Welcome to CloudCLI",description:"Set up your account to get started",footerText:"This is a single-user system. Only one account can be created.",logo:s.jsx("img",{src:"/logo.svg",alt:"CloudCLI",className:"h-16 w-16"}),children:s.jsxs("form",{onSubmit:c,className:"space-y-4",children:[s.jsx(_i,{id:"username",name:"username",label:"Username",value:t.username,onChange:u=>l("username",u),placeholder:"Enter your username",isDisabled:i,autoComplete:"username"}),s.jsx(_i,{id:"password",name:"password",label:"Password",value:t.password,onChange:u=>l("password",u),placeholder:"Enter your password",isDisabled:i,type:"password",autoComplete:"new-password"}),s.jsx(_i,{id:"confirmPassword",name:"confirmPassword",label:"Confirm Password",value:t.confirmPassword,onChange:u=>l("confirmPassword",u),placeholder:"Confirm your password",isDisabled:i,type:"password",autoComplete:"new-password"}),s.jsx(mE,{errorMessage:n}),s.jsx("button",{type:"submit",disabled:i,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:i?"Setting up...":"Create Account"})]})})}function j_({children:e}){const{user:t,isLoading:r,needsSetup:n,hasCompletedOnboarding:a,refreshOnboardingStatus:i}=Wi();return r?s.jsx(C_,{}):n?s.jsx(R_,{}):t?a?s.jsx(s.Fragment,{children:e}):s.jsx(E_,{onComplete:i}):s.jsx(A_,{})}const fE=b.createContext(null),gE=()=>{const e=b.useContext(fE);if(!e)throw new Error("useWebSocket must be used within a WebSocketProvider");return e},D_=e=>{const t=window.location.protocol==="https:"?"wss:":"ws:";return e?`${t}//${window.location.host}/ws?token=${encodeURIComponent(e)}`:null},M_=()=>{const e=b.useRef(null),t=b.useRef(!1),r=b.useRef(!1),[n,a]=b.useState(null),[i,o]=b.useState(!1),l=b.useRef(null),{token:c}=Wi();b.useEffect(()=>(u(),()=>{t.current=!0,l.current&&clearTimeout(l.current),e.current&&e.current.close()}),[c]);const u=b.useCallback(()=>{if(!t.current)try{const h=D_(c);if(!h)return console.warn("No authentication token found for WebSocket connection");const m=new WebSocket(h);m.onopen=()=>{o(!0),e.current=m,r.current&&a({type:"websocket-reconnected",timestamp:Date.now()}),r.current=!0},m.onmessage=f=>{try{const g=JSON.parse(f.data);a(g)}catch(g){console.error("Error parsing WebSocket message:",g)}},m.onclose=()=>{o(!1),e.current=null,l.current=setTimeout(()=>{t.current||u()},3e3)},m.onerror=f=>{console.error("WebSocket error:",f)}}catch(h){console.error("Error creating WebSocket connection:",h)}},[c]),d=b.useCallback(h=>{const m=e.current;m&&m.readyState===WebSocket.OPEN?m.send(JSON.stringify(h)):console.warn("WebSocket not connected")},[]);return b.useMemo(()=>({ws:e.current,sendMessage:d,latestMessage:n,isConnected:i}),[d,n,i])},O_=({children:e})=>{const t=M_();return s.jsx(fE.Provider,{value:t,children:e})},bE=b.createContext(null);function L_(e,t){return{message:t instanceof Error?t.message:`Failed to ${e}`,context:e,timestamp:new Date().toISOString()}}function eb(e){return{...e,taskMasterConfigured:e.taskmaster?.hasTaskmaster??!1,taskMasterStatus:e.taskmaster?.status??"not-configured",taskCount:Number(e.taskmaster?.metadata?.taskCount??0),completedCount:Number(e.taskmaster?.metadata?.completed??0)}}function P_(e){return e.find(t=>t.status==="pending"||t.status==="in-progress")??null}function F_(e){return e?.type?e.type.startsWith("taskmaster-"):!1}function Ya(){const e=b.useContext(bE);if(!e)throw new Error("useTaskMaster must be used within a TaskMasterProvider");return e}function B_({children:e}){const{latestMessage:t}=gE(),{user:r,token:n,isLoading:a}=Wi(),[i,o]=b.useState([]),[l,c]=b.useState(null),[u,d]=b.useState(null),[p,h]=b.useState(null),[m,f]=b.useState([]),[g,v]=b.useState(null),[x,y]=b.useState(!1),[w,S]=b.useState(!1),[E,k]=b.useState(!1),[C,R]=b.useState(null),T=b.useRef(null);b.useEffect(()=>{T.current=l?.name??null},[l?.name]);const I=b.useCallback(()=>{R(null)},[]),M=b.useCallback((H,K)=>{console.error(`TaskMaster ${H} error:`,K),R(L_(H,K))},[]),_=b.useCallback(H=>{const K=H?eb(H):null;c(K),d(K?.taskmaster??null),f([]),v(null)},[]),P=b.useCallback(async()=>{if(!r||!n){o([]),c(null),d(null),f([]),v(null);return}try{y(!0),I();const H=await ct.get("/projects");if(!H.ok)throw new Error(`Failed to fetch projects: ${H.status}`);const K=await H.json(),L=(Array.isArray(K)?K:[]).map(O=>eb(O));o(L);const W=T.current;if(!W)return;const B=L.find(O=>O.name===W)??null;c(B),d(B?.taskmaster??null)}catch(H){M("load projects",H)}finally{y(!1)}},[I,M,n,r]),N=b.useCallback(async()=>{const H=l?.name;if(!H||!r||!n){f([]),v(null);return}try{S(!0),I();const K=await ct.get(`/taskmaster/tasks/${encodeURIComponent(H)}`);if(!K.ok){const W=await K.json();throw new Error(W.message??"Failed to load tasks")}const q=await K.json(),L=Array.isArray(q.tasks)?q.tasks:[];f(L),v(P_(L))}catch(K){M("load tasks",K),f([]),v(null)}finally{S(!1)}},[I,l?.name,M,n,r]),z=b.useCallback(async()=>{if(!r||!n){h(null);return}try{k(!0),I();const H=await ct.get("/mcp-utils/taskmaster-server");if(!H.ok)throw new Error(`Failed to load MCP status: ${H.status}`);const K=await H.json();h(K)}catch(H){M("check MCP server status",H),h(null)}finally{k(!1)}},[I,M,n,r]);b.useEffect(()=>{!a&&r&&n&&(P(),z())},[a,z,P,n,r]),b.useEffect(()=>{l?.name&&r&&n&&N()},[l?.name,N,n,r]),b.useEffect(()=>{const H=t;if(F_(H)){if(H.type==="taskmaster-project-updated"&&H.projectName){P();return}if(H.type==="taskmaster-tasks-updated"&&H.projectName===l?.name){N();return}H.type==="taskmaster-mcp-status-changed"&&z()}},[l?.name,t,z,P,N]);const J=b.useMemo(()=>({projects:i,currentProject:l,projectTaskMaster:u,mcpServerStatus:p,tasks:m,nextTask:g,isLoading:x,isLoadingTasks:w,isLoadingMCP:E,error:C,refreshProjects:P,setCurrentProject:_,refreshTasks:N,refreshMCPStatus:z,clearError:I}),[I,l,C,x,E,w,p,g,u,i,z,P,N,_,m]);return s.jsx(bE.Provider,{value:J,children:e})}const xE=b.createContext({tasksEnabled:!0,setTasksEnabled:()=>{},toggleTasksEnabled:()=>{},isTaskMasterInstalled:null,isTaskMasterReady:null,installationStatus:null,isCheckingInstallation:!0}),Ao=()=>{const e=b.useContext(xE);if(!e)throw new Error("useTasksSettings must be used within a TasksSettingsProvider");return e},z_=({children:e})=>{const[t,r]=b.useState(()=>{const m=localStorage.getItem("tasks-enabled");return m!==null?JSON.parse(m):!0}),[n,a]=b.useState(null),[i,o]=b.useState(null),[l,c]=b.useState(null),[u,d]=b.useState(!0);b.useEffect(()=>{localStorage.setItem("tasks-enabled",JSON.stringify(t))},[t]),b.useEffect(()=>{setTimeout(async()=>{try{const f=await ct.get("/taskmaster/installation-status");if(f.ok){const g=await f.json();c(g),a(g.installation?.isInstalled||!1),o(g.isReady||!1);const v=localStorage.getItem("tasks-enabled");!g.installation?.isInstalled&&!v&&r(!1)}else console.error("Failed to check TaskMaster installation status"),a(!1),o(!1)}catch(f){console.error("Error checking TaskMaster installation:",f),a(!1),o(!1)}finally{d(!1)}},0)},[]);const h={tasksEnabled:t,setTasksEnabled:r,toggleTasksEnabled:()=>{r(m=>!m)},isTaskMasterInstalled:n,isTaskMasterReady:i,installationStatus:l,isCheckingInstallation:u};return s.jsx(xE.Provider,{value:h,children:e})},yE=b.createContext(null);function Io(){const e=b.useContext(yE);if(!e)throw new Error("usePlugins must be used within a PluginsProvider");return e}function $_({children:e}){const[t,r]=b.useState([]),[n,a]=b.useState(!0),[i,o]=b.useState(null),l=b.useCallback(async()=>{try{const h=await Ce("/api/plugins");if(h.ok){const m=await h.json();r(m.plugins||[]),o(null)}else{let m=`Failed to fetch plugins (${h.status})`;try{const f=await h.json();m=f.details||f.error||m}catch{m=h.statusText||m}o(m)}}catch(h){const m=h instanceof Error?h.message:"Failed to fetch plugins";o(m),console.error("[Plugins] Failed to fetch plugins:",h)}finally{a(!1)}},[]);b.useEffect(()=>{l()},[l]);const c=b.useCallback(async h=>{try{const m=await Ce("/api/plugins/install",{method:"POST",body:JSON.stringify({url:h})}),f=await m.json();return m.ok?(await l(),{success:!0}):{success:!1,error:f.details||f.error||"Install failed"}}catch(m){return{success:!1,error:m instanceof Error?m.message:"Install failed"}}},[l]),u=b.useCallback(async h=>{try{const m=await Ce(`/api/plugins/${encodeURIComponent(h)}`,{method:"DELETE"}),f=await m.json();return m.ok?(await l(),{success:!0}):{success:!1,error:f.details||f.error||"Uninstall failed"}}catch(m){return{success:!1,error:m instanceof Error?m.message:"Uninstall failed"}}},[l]),d=b.useCallback(async h=>{try{const m=await Ce(`/api/plugins/${encodeURIComponent(h)}/update`,{method:"POST"}),f=await m.json();return m.ok?(await l(),{success:!0}):{success:!1,error:f.details||f.error||"Update failed"}}catch(m){return{success:!1,error:m instanceof Error?m.message:"Update failed"}}},[l]),p=b.useCallback(async(h,m)=>{try{const f=await Ce(`/api/plugins/${encodeURIComponent(h)}/enable`,{method:"PUT",body:JSON.stringify({enabled:m})});if(!f.ok){let g=`Toggle failed (${f.status})`;try{const v=await f.json();g=v.details||v.error||g}catch{g=f.statusText||g}return{success:!1,error:g}}return await l(),{success:!0,error:null}}catch(f){return{success:!1,error:f instanceof Error?f.message:"Toggle failed"}}},[l]);return s.jsx(yE.Provider,{value:{plugins:t,loading:n,pluginsError:i,refreshPlugins:l,installPlugin:c,uninstallPlugin:u,updatePlugin:d,togglePlugin:p},children:e})}const tb=e=>typeof window>"u"?!1:window.innerWidth<e,rb=()=>{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 of(e={}){const{mobileBreakpoint:t=768,trackMobile:r=!0,trackPWA:n=!0}=e,[a,i]=b.useState(()=>r?tb(t):!1),[o,l]=b.useState(()=>n?rb():!1);return b.useEffect(()=>{if(!r||typeof window>"u")return;const c=()=>{i(tb(t))};return c(),window.addEventListener("resize",c),()=>{window.removeEventListener("resize",c)}},[t,r]),b.useEffect(()=>{if(!n||typeof window>"u")return;const c=window.matchMedia("(display-mode: standalone)"),u=()=>{l(rb())};return u(),typeof c.addEventListener=="function"?(c.addEventListener("change",u),()=>{c.removeEventListener("change",u)}):(c.addListener(u),()=>{c.removeListener(u)})},[n]),{isMobile:a,isPWA:o}}const nb="1.29.0",U_=(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 i=r[a]||0,o=n[a]||0;if(i!==o)return i-o}return 0},vE=(e,t)=>{const[r,n]=b.useState(!1),[a,i]=b.useState(null),[o,l]=b.useState(null),[c,u]=b.useState("git");return b.useEffect(()=>{(async()=>{try{const h=await(await fetch("/health")).json();(h.installMode==="npm"||h.installMode==="git")&&u(h.installMode)}catch{}})()},[]),b.useEffect(()=>{const d=async()=>{try{const m=await(await fetch(`https://api.github.com/repos/${e}/${t}/releases/latest`)).json();if(m.tag_name){const f=m.tag_name.replace(/^v/,"");i(f),n(U_(f,nb)>0),l({title:m.name||m.tag_name,body:m.body||"",htmlUrl:m.html_url||`https://github.com/${e}/${t}/releases/latest`,publishedAt:m.published_at})}else n(!1),i(null),l(null)}catch(h){console.error("Version check failed:",h),n(!1),i(null),l(null)}};d();const p=setInterval(d,300*1e3);return()=>clearInterval(p)},[e,t]),{updateAvailable:r,latestVersion:a,currentVersion:nb,releaseInfo:o,installMode:c}},Zn={autoExpandTools:!1,showRawParameters:!1,showThinking:!0,autoScrollToBottom:!0,sendByCtrlEnter:!1,sidebarVisible:!0},Qs=Object.keys(Zn),q_=new Set(Qs),nl="ui-preferences:sync",eo=(e,t)=>{if(typeof e=="boolean")return e;if(typeof e=="string"){if(e==="true")return!0;if(e==="false")return!1}return t},G_=(e,t)=>{try{const r=localStorage.getItem(e);if(r===null)return t;const n=JSON.parse(r);return eo(n,t)}catch{return t}},H_=e=>{if(typeof window>"u")return Zn;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 Qs.reduce((a,i)=>(a[i]=eo(n[i],Zn[i]),a),{...Zn})}}}catch{}return Qs.reduce((t,r)=>(t[r]=G_(r,Zn[r]),t),{...Zn})};function W_(e,t){switch(t.type){case"set":{const{key:r,value:n}=t;if(!q_.has(r))return e;const a=eo(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 i of Qs){if(!(i in r))continue;const o=r[i],l=eo(o,e[i]);a[i]!==l&&(a[i]=l,n=!0)}return n?a:e}case"reset":return{...Zn,...t.value||{}};default:return e}}function lf(e="uiPreferences"){const t=b.useRef(`ui-preferences-${Math.random().toString(36).slice(2)}`),[r,n]=b.useReducer(W_,e,H_);return b.useEffect(()=>{typeof window>"u"||(localStorage.setItem(e,JSON.stringify(r)),window.dispatchEvent(new CustomEvent(nl,{detail:{storageKey:e,sourceId:t.current,value:r}})))},[r,e]),b.useEffect(()=>{if(typeof window>"u")return;const l=d=>{!d||typeof d!="object"||Array.isArray(d)||n({type:"set_many",value:d})},c=d=>{if(!(d.key!==e||d.newValue===null))try{const p=JSON.parse(d.newValue);l(p)}catch{}},u=d=>{const h=d.detail;!h||h.storageKey!==e||h.sourceId===t.current||l(h.value)};return window.addEventListener("storage",c),window.addEventListener(nl,u),()=>{window.removeEventListener("storage",c),window.removeEventListener(nl,u)}},[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 V_=()=>{try{const e=localStorage.getItem("claude-settings");return e&&JSON.parse(e).projectSortOrder==="date"?"date":"name"}catch{return"name"}},K_=()=>{try{const e=localStorage.getItem("starredProjects");return e?new Set(JSON.parse(e)):new Set}catch{return new Set}},Y_=e=>{try{localStorage.setItem("starredProjects",JSON.stringify([...e]))}catch{}},to=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),Z_=(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.summary||e.name||t("projects.newSession"):e.summary||t("projects.newSession"),X_=e=>e.__provider==="cursor"?String(e.createdAt||""):e.__provider==="codex"?String(e.createdAt||e.lastActivity||""):String(e.lastActivity||e.createdAt||""),J_=(e,t,r)=>{const n=to(e),a=Math.floor((t.getTime()-n.getTime())/(1e3*60));return{isCursorSession:e.__provider==="cursor",isCodexSession:e.__provider==="codex",isGeminiSession:e.__provider==="gemini",isActive:a<10,sessionName:Z_(e,r),sessionTime:X_(e),messageCount:Number(e.messageCount||0)}},wE=(e,t)=>{const r=[...e.sessions||[],...t[e.name]||[]].map(o=>({...o,__provider:"claude"})),n=(e.cursorSessions||[]).map(o=>({...o,__provider:"cursor"})),a=(e.codexSessions||[]).map(o=>({...o,__provider:"codex"})),i=(e.geminiSessions||[]).map(o=>({...o,__provider:"gemini"}));return[...r,...n,...a,...i].sort((o,l)=>to(l).getTime()-to(o).getTime())},ab=(e,t)=>{const r=wE(e,t);return r.length===0?new Date(0):r.reduce((n,a)=>{const i=to(a);return i>n?i:n},new Date(0))},Q_=(e,t,r,n)=>{const a=[...e];return a.sort((i,o)=>{const l=r.has(i.name),c=r.has(o.name);return l&&!c?-1:!l&&c?1:t==="date"?ab(o,n).getTime()-ab(i,n).getTime():(i.displayName||i.name).localeCompare(o.displayName||o.name)}),a},e8=(e,t)=>{const r=t.trim().toLowerCase();return r?e.filter(n=>{const a=(n.displayName||n.name).toLowerCase(),i=n.name.toLowerCase();return a.includes(r)||i.includes(r)}):e},t8=(e,t)=>{const r=!!e.taskmaster?.hasTaskmaster,n=!!(t?.hasMCPServer&&t?.isConfigured);return r&&n?"fully-configured":r?"taskmaster-only":n?"mcp-only":"not-configured"},r8=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 n8({projects:e,selectedProject:t,selectedSession:r,isLoading:n,isMobile:a,t:i,onRefresh:o,onProjectSelect:l,onSessionSelect:c,onSessionDelete:u,onProjectDelete:d,setCurrentProject:p,setSidebarVisible:h,sidebarVisible:m}){const[f,g]=b.useState(new Set),[v,x]=b.useState(null),[y,w]=b.useState(!1),[S,E]=b.useState(""),[k,C]=b.useState({}),[R,T]=b.useState({}),[I,M]=b.useState(new Set),[_,P]=b.useState(new Date),[N,z]=b.useState("name"),[J,H]=b.useState(!1),[K,q]=b.useState({}),[L,W]=b.useState(null),[B,O]=b.useState(""),[ee,te]=b.useState(""),[ce,ie]=b.useState(new Set),[ge,ye]=b.useState(null),[Re,Ee]=b.useState(null),[Ie,Fe]=b.useState(!1),[D,de]=b.useState(()=>K_()),[le,G]=b.useState("projects"),[U,re]=b.useState(null),[pe,me]=b.useState(!1),[ne,be]=b.useState(null),Z=b.useRef(null),Y=b.useRef(0),V=b.useRef(null),oe=!a&&!m;b.useEffect(()=>{const je=setInterval(()=>{P(new Date)},6e4);return()=>clearInterval(je)},[]),b.useEffect(()=>{T({}),M(new Set),q({})},[e]),b.useEffect(()=>{t&&g(je=>{if(je.has(t.name))return je;const Ge=new Set(je);return Ge.add(t.name),Ge})},[r,t]),b.useEffect(()=>{if(e.length>0&&!n){const je=new Set;e.forEach(Ge=>{Ge.sessions&&Ge.sessions.length>=0&&je.add(Ge.name)}),M(je)}},[e,n]),b.useEffect(()=>{const je=()=>{z(V_())};je();const Ge=ke=>{ke.key==="claude-settings"&&je()};window.addEventListener("storage",Ge);const ve=setInterval(()=>{document.hasFocus()&&je()},1e3);return()=>{window.removeEventListener("storage",Ge),clearInterval(ve)}},[]),b.useEffect(()=>{Z.current&&clearTimeout(Z.current),V.current&&(V.current.close(),V.current=null);const je=ee.trim();if(le!=="conversations"||je.length<2){Y.current+=1,re(null),be(null),me(!1);return}me(!0);const Ge=++Y.current;return Z.current=setTimeout(()=>{if(Ge!==Y.current)return;const ve=ct.searchConversationsUrl(je),ke=new EventSource(ve);V.current=ke;const se=[];let xe=0;ke.addEventListener("result",De=>{if(Ge!==Y.current){ke.close();return}try{const Ve=JSON.parse(De.data);se.push(Ve.projectResult),xe=Ve.totalMatches,re({results:[...se],totalMatches:xe,query:je}),be({scannedProjects:Ve.scannedProjects,totalProjects:Ve.totalProjects})}catch{}}),ke.addEventListener("progress",De=>{if(Ge!==Y.current){ke.close();return}try{const Ve=JSON.parse(De.data);xe=Ve.totalMatches,be({scannedProjects:Ve.scannedProjects,totalProjects:Ve.totalProjects})}catch{}}),ke.addEventListener("done",()=>{if(Ge!==Y.current){ke.close();return}ke.close(),V.current=null,me(!1),be(null),se.length===0&&re({results:[],totalMatches:0,query:je})}),ke.addEventListener("error",()=>{if(Ge!==Y.current){ke.close();return}ke.close(),V.current=null,me(!1),be(null),se.length===0&&re({results:[],totalMatches:0,query:je})})},400),()=>{Z.current&&clearTimeout(Z.current),V.current&&(V.current.close(),V.current=null)}},[ee,le]),b.useCallback(je=>Ge=>{const ve=Ge.target;ve.closest(".overflow-y-auto")||ve.closest("[data-scroll-container]")||(Ge.preventDefault(),Ge.stopPropagation(),je())},[]);const he=b.useCallback(je=>{g(Ge=>{const ve=new Set;return Ge.has(je)||ve.add(je),ve})},[]),Ae=b.useCallback((je,Ge)=>{c({...je,__projectName:Ge})},[c]),$e=b.useCallback(je=>{de(Ge=>{const ve=new Set(Ge);return ve.has(je)?ve.delete(je):ve.add(je),Y_(ve),ve})},[]),it=b.useCallback(je=>D.has(je),[D]),et=b.useCallback(je=>wE(je,R),[R]),We=b.useMemo(()=>e.map(je=>{const Ge=K[je.name];return Ge===void 0?je:{...je,sessionMeta:{...je.sessionMeta,hasMore:Ge}}}),[K,e]),st=b.useMemo(()=>Q_(We,N,D,R),[R,N,We,D]),pt=b.useMemo(()=>e8(st,ee),[ee,st]),nt=b.useCallback(je=>{x(je.name),E(je.displayName)},[]),gt=b.useCallback(()=>{x(null),E("")},[]),mt=b.useCallback(async je=>{try{(await ct.renameProject(je,S)).ok?window.refreshProjects?await window.refreshProjects():window.location.reload():console.error("Failed to rename project")}catch(Ge){console.error("Error renaming project:",Ge)}finally{x(null),E("")}},[S]),yt=b.useCallback((je,Ge,ve,ke="claude")=>{Ee({projectName:je,sessionId:Ge,sessionTitle:ve,provider:ke})},[]),vt=b.useCallback(async()=>{if(!Re)return;const{projectName:je,sessionId:Ge,provider:ve}=Re;Ee(null);try{let ke;if(ve==="codex"?ke=await ct.deleteCodexSession(Ge):ve==="gemini"?ke=await ct.deleteGeminiSession(Ge):ke=await ct.deleteSession(je,Ge),ke.ok)u?.(Ge);else{const se=await ke.text();console.error("[Sidebar] Failed to delete session:",{status:ke.status,error:se}),alert(i("messages.deleteSessionFailed"))}}catch(ke){console.error("[Sidebar] Error deleting session:",ke),alert(i("messages.deleteSessionError"))}},[u,Re,i]),_e=b.useCallback(je=>{ye({project:je,sessionCount:et(je).length})},[et]),Ye=b.useCallback(async()=>{if(!ge)return;const{project:je,sessionCount:Ge}=ge,ve=Ge===0;ye(null),ie(ke=>new Set([...ke,je.name]));try{const ke=await ct.deleteProject(je.name,!ve);if(ke.ok)d?.(je.name);else{const se=await ke.json();alert(se.error||i("messages.deleteProjectFailed"))}}catch(ke){console.error("Error deleting project:",ke),alert(i("messages.deleteProjectError"))}finally{ie(ke=>{const se=new Set(ke);return se.delete(je.name),se})}},[ge,d,i]),Qe=b.useCallback(async je=>{const Ge=K[je.name];if(!(!(Ge!==void 0?Ge:je.sessionMeta?.hasMore===!0)||k[je.name])){C(ke=>({...ke,[je.name]:!0}));try{const ke=(je.sessions?.length||0)+(R[je.name]?.length||0),se=await ct.sessions(je.name,5,ke);if(!se.ok)return;const xe=await se.json();T(De=>({...De,[je.name]:[...De[je.name]||[],...xe.sessions||[]]})),xe.hasMore===!1&&q(De=>({...De,[je.name]:!1}))}catch(ke){console.error("Error loading more sessions:",ke)}finally{C(ke=>({...ke,[je.name]:!1}))}}},[R,k,K]),Ke=b.useCallback(je=>{l(je),p(je)},[l,p]),ft=b.useCallback(async()=>{H(!0);try{await o()}finally{H(!1)}},[o]),bt=b.useCallback(async(je,Ge,ve,ke)=>{const se=ve.trim();if(!se){W(null),O("");return}try{const xe=await ct.renameSession(Ge,se,ke);xe.ok?await o():(console.error("[Sidebar] Failed to rename session:",xe.status),alert(i("messages.renameSessionFailed")))}catch(xe){console.error("[Sidebar] Error renaming session:",xe),alert(i("messages.renameSessionError"))}finally{W(null),O("")}},[o,i]),or=b.useCallback(()=>{h(!1)},[h]),lr=b.useCallback(()=>{h(!0)},[h]);return{isSidebarCollapsed:oe,expandedProjects:f,editingProject:v,showNewProject:y,editingName:S,loadingSessions:k,additionalSessions:R,initialSessionsLoaded:I,currentTime:_,projectSortOrder:N,isRefreshing:J,editingSession:L,editingSessionName:B,searchFilter:ee,deletingProjects:ce,deleteConfirmation:ge,sessionDeleteConfirmation:Re,showVersionModal:Ie,starredProjects:D,filteredProjects:pt,toggleProject:he,handleSessionClick:Ae,toggleStarProject:$e,isProjectStarred:it,getProjectSessions:et,startEditing:nt,cancelEditing:gt,saveProjectName:mt,showDeleteSessionConfirmation:yt,confirmDeleteSession:vt,requestProjectDelete:_e,confirmDeleteProject:Ye,loadMoreSessions:Qe,handleProjectSelect:Ke,refreshProjects:ft,updateSessionSummary:bt,collapseSidebar:or,expandSidebar:lr,setShowNewProject:w,setEditingName:E,setEditingSession:W,setEditingSessionName:O,searchMode:le,setSearchMode:G,conversationResults:U,isSearching:pe,searchProgress:ne,clearConversationResults:b.useCallback(()=>{Y.current+=1,V.current&&(V.current.close(),V.current=null),me(!1),be(null),re(null)},[]),setSearchFilter:te,setDeleteConfirmation:ye,setSessionDeleteConfirmation:Ee,setShowVersionModal:Fe}}const a8="https://discord.gg/buxwujPNRE",i8="https://github.com/siteboon/claudecodeui/issues/new";function s8({className:e}){return s.jsx("svg",{className:e,fill:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:s.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 o8({onExpand:e,onShowSettings:t,updateAvailable:r,onShowVersionModal:n,t:a}){return s.jsxs("div",{className:"flex h-full w-12 flex-col items-center gap-1 bg-background/80 py-3 backdrop-blur-sm",children:[s.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":a("common:versionUpdate.ariaLabels.showSidebar"),title:a("common:versionUpdate.ariaLabels.showSidebar"),children:s.jsx(L7,{className:"h-4 w-4 text-muted-foreground transition-colors group-hover:text-foreground"})}),s.jsx("div",{className:"nav-divider my-1 w-6"}),s.jsx("button",{onClick:t,className:"group flex h-8 w-8 items-center justify-center rounded-lg transition-colors hover:bg-accent/80","aria-label":a("actions.settings"),title:a("actions.settings"),children:s.jsx(Et,{className:"h-4 w-4 text-muted-foreground transition-colors group-hover:text-foreground"})}),s.jsx("a",{href:i8,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":a("actions.reportIssue"),title:a("actions.reportIssue"),children:s.jsx(K0,{className:"h-4 w-4 text-muted-foreground transition-colors group-hover:text-foreground"})}),s.jsx("a",{href:a8,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":a("actions.joinCommunity"),title:a("actions.joinCommunity"),children:s.jsx(s8,{className:"h-4 w-4 text-muted-foreground transition-colors group-hover:text-foreground"})}),r&&s.jsxs("button",{onClick:n,className:"relative flex h-8 w-8 items-center justify-center rounded-lg transition-colors hover:bg-accent/80","aria-label":a("common:versionUpdate.ariaLabels.updateAvailable"),title:a("common:versionUpdate.ariaLabels.updateAvailable"),children:[s.jsx(ia,{className:"h-4 w-4 text-blue-500"}),s.jsx("span",{className:"absolute right-1.5 top-1.5 h-1.5 w-1.5 animate-pulse rounded-full bg-blue-500"})]})]})}function kE(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=kE(e[t]))&&(n&&(n+=" "),n+=r)}else for(r in e)e[r]&&(n&&(n+=" "),n+=r);return n}function SE(){for(var e,t,r=0,n="",a=arguments.length;r<a;r++)(e=arguments[r])&&(t=kE(e))&&(n&&(n+=" "),n+=t);return n}const ib=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,sb=SE,EE=(e,t)=>r=>{var n;if(t?.variants==null)return sb(e,r?.class,r?.className);const{variants:a,defaultVariants:i}=t,o=Object.keys(a).map(u=>{const d=r?.[u],p=i?.[u];if(d===null)return null;const h=ib(d)||ib(p);return a[u][h]}),l=r&&Object.entries(r).reduce((u,d)=>{let[p,h]=d;return h===void 0||(u[p]=h),u},{}),c=t==null||(n=t.compoundVariants)===null||n===void 0?void 0:n.reduce((u,d)=>{let{class:p,className:h,...m}=d;return Object.entries(m).every(f=>{let[g,v]=f;return Array.isArray(v)?v.includes({...i,...l}[g]):{...i,...l}[g]===v})?[...u,p,h]:u},[]);return sb(e,o,c,r?.class,r?.className)},cf="-",l8=e=>{const t=u8(e),{conflictingClassGroups:r,conflictingClassGroupModifiers:n}=e;return{getClassGroupId:o=>{const l=o.split(cf);return l[0]===""&&l.length!==1&&l.shift(),NE(l,t)||c8(o)},getConflictingClassGroupIds:(o,l)=>{const c=r[o]||[];return l&&n[o]?[...c,...n[o]]:c}}},NE=(e,t)=>{if(e.length===0)return t.classGroupId;const r=e[0],n=t.nextPart.get(r),a=n?NE(e.slice(1),n):void 0;if(a)return a;if(t.validators.length===0)return;const i=e.join(cf);return t.validators.find(({validator:o})=>o(i))?.classGroupId},ob=/^\[(.+)\]$/,c8=e=>{if(ob.test(e)){const t=ob.exec(e)[1],r=t?.substring(0,t.indexOf(":"));if(r)return"arbitrary.."+r}},u8=e=>{const{theme:t,classGroups:r}=e,n={nextPart:new Map,validators:[]};for(const a in r)eh(r[a],n,a,t);return n},eh=(e,t,r,n)=>{e.forEach(a=>{if(typeof a=="string"){const i=a===""?t:lb(t,a);i.classGroupId=r;return}if(typeof a=="function"){if(d8(a)){eh(a(n),t,r,n);return}t.validators.push({validator:a,classGroupId:r});return}Object.entries(a).forEach(([i,o])=>{eh(o,lb(t,i),r,n)})})},lb=(e,t)=>{let r=e;return t.split(cf).forEach(n=>{r.nextPart.has(n)||r.nextPart.set(n,{nextPart:new Map,validators:[]}),r=r.nextPart.get(n)}),r},d8=e=>e.isThemeGetter,p8=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,r=new Map,n=new Map;const a=(i,o)=>{r.set(i,o),t++,t>e&&(t=0,n=r,r=new Map)};return{get(i){let o=r.get(i);if(o!==void 0)return o;if((o=n.get(i))!==void 0)return a(i,o),o},set(i,o){r.has(i)?r.set(i,o):a(i,o)}}},th="!",rh=":",m8=rh.length,h8=e=>{const{prefix:t,experimentalParseClassName:r}=e;let n=a=>{const i=[];let o=0,l=0,c=0,u;for(let f=0;f<a.length;f++){let g=a[f];if(o===0&&l===0){if(g===rh){i.push(a.slice(c,f)),c=f+m8;continue}if(g==="/"){u=f;continue}}g==="["?o++:g==="]"?o--:g==="("?l++:g===")"&&l--}const d=i.length===0?a:a.substring(c),p=f8(d),h=p!==d,m=u&&u>c?u-c:void 0;return{modifiers:i,hasImportantModifier:h,baseClassName:p,maybePostfixModifierPosition:m}};if(t){const a=t+rh,i=n;n=o=>o.startsWith(a)?i(o.substring(a.length)):{isExternal:!0,modifiers:[],hasImportantModifier:!1,baseClassName:o,maybePostfixModifierPosition:void 0}}if(r){const a=n;n=i=>r({className:i,parseClassName:a})}return n},f8=e=>e.endsWith(th)?e.substring(0,e.length-1):e.startsWith(th)?e.substring(1):e,g8=e=>{const t=Object.fromEntries(e.orderSensitiveModifiers.map(n=>[n,!0]));return n=>{if(n.length<=1)return n;const a=[];let i=[];return n.forEach(o=>{o[0]==="["||t[o]?(a.push(...i.sort(),o),i=[]):i.push(o)}),a.push(...i.sort()),a}},b8=e=>({cache:p8(e.cacheSize),parseClassName:h8(e),sortModifiers:g8(e),...l8(e)}),x8=/\s+/,y8=(e,t)=>{const{parseClassName:r,getClassGroupId:n,getConflictingClassGroupIds:a,sortModifiers:i}=t,o=[],l=e.trim().split(x8);let c="";for(let u=l.length-1;u>=0;u-=1){const d=l[u],{isExternal:p,modifiers:h,hasImportantModifier:m,baseClassName:f,maybePostfixModifierPosition:g}=r(d);if(p){c=d+(c.length>0?" "+c:c);continue}let v=!!g,x=n(v?f.substring(0,g):f);if(!x){if(!v){c=d+(c.length>0?" "+c:c);continue}if(x=n(f),!x){c=d+(c.length>0?" "+c:c);continue}v=!1}const y=i(h).join(":"),w=m?y+th:y,S=w+x;if(o.includes(S))continue;o.push(S);const E=a(x,v);for(let k=0;k<E.length;++k){const C=E[k];o.push(w+C)}c=d+(c.length>0?" "+c:c)}return c};function v8(){let e=0,t,r,n="";for(;e<arguments.length;)(t=arguments[e++])&&(r=CE(t))&&(n&&(n+=" "),n+=r);return n}const CE=e=>{if(typeof e=="string")return e;let t,r="";for(let n=0;n<e.length;n++)e[n]&&(t=CE(e[n]))&&(r&&(r+=" "),r+=t);return r};function w8(e,...t){let r,n,a,i=o;function o(c){const u=t.reduce((d,p)=>p(d),e());return r=b8(u),n=r.cache.get,a=r.cache.set,i=l,l(c)}function l(c){const u=n(c);if(u)return u;const d=y8(c,r);return a(c,d),d}return function(){return i(v8.apply(null,arguments))}}const $t=e=>{const t=r=>r[e]||[];return t.isThemeGetter=!0,t},TE=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,AE=/^\((?:(\w[\w-]*):)?(.+)\)$/i,k8=/^\d+\/\d+$/,S8=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,E8=/\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$/,N8=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,C8=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,T8=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,ka=e=>k8.test(e),ut=e=>!!e&&!Number.isNaN(Number(e)),kn=e=>!!e&&Number.isInteger(Number(e)),al=e=>e.endsWith("%")&&ut(e.slice(0,-1)),an=e=>S8.test(e),A8=()=>!0,I8=e=>E8.test(e)&&!N8.test(e),IE=()=>!1,_8=e=>C8.test(e),R8=e=>T8.test(e),j8=e=>!Ue(e)&&!qe(e),D8=e=>Za(e,jE,IE),Ue=e=>TE.test(e),Hn=e=>Za(e,DE,I8),il=e=>Za(e,F8,ut),cb=e=>Za(e,_E,IE),M8=e=>Za(e,RE,R8),is=e=>Za(e,ME,_8),qe=e=>AE.test(e),di=e=>Xa(e,DE),O8=e=>Xa(e,B8),ub=e=>Xa(e,_E),L8=e=>Xa(e,jE),P8=e=>Xa(e,RE),ss=e=>Xa(e,ME,!0),Za=(e,t,r)=>{const n=TE.exec(e);return n?n[1]?t(n[1]):r(n[2]):!1},Xa=(e,t,r=!1)=>{const n=AE.exec(e);return n?n[1]?t(n[1]):r:!1},_E=e=>e==="position"||e==="percentage",RE=e=>e==="image"||e==="url",jE=e=>e==="length"||e==="size"||e==="bg-size",DE=e=>e==="length",F8=e=>e==="number",B8=e=>e==="family-name",ME=e=>e==="shadow",z8=()=>{const e=$t("color"),t=$t("font"),r=$t("text"),n=$t("font-weight"),a=$t("tracking"),i=$t("leading"),o=$t("breakpoint"),l=$t("container"),c=$t("spacing"),u=$t("radius"),d=$t("shadow"),p=$t("inset-shadow"),h=$t("text-shadow"),m=$t("drop-shadow"),f=$t("blur"),g=$t("perspective"),v=$t("aspect"),x=$t("ease"),y=$t("animate"),w=()=>["auto","avoid","all","avoid-page","page","left","right","column"],S=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],E=()=>[...S(),qe,Ue],k=()=>["auto","hidden","clip","visible","scroll"],C=()=>["auto","contain","none"],R=()=>[qe,Ue,c],T=()=>[ka,"full","auto",...R()],I=()=>[kn,"none","subgrid",qe,Ue],M=()=>["auto",{span:["full",kn,qe,Ue]},kn,qe,Ue],_=()=>[kn,"auto",qe,Ue],P=()=>["auto","min","max","fr",qe,Ue],N=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],z=()=>["start","end","center","stretch","center-safe","end-safe"],J=()=>["auto",...R()],H=()=>[ka,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...R()],K=()=>[e,qe,Ue],q=()=>[...S(),ub,cb,{position:[qe,Ue]}],L=()=>["no-repeat",{repeat:["","x","y","space","round"]}],W=()=>["auto","cover","contain",L8,D8,{size:[qe,Ue]}],B=()=>[al,di,Hn],O=()=>["","none","full",u,qe,Ue],ee=()=>["",ut,di,Hn],te=()=>["solid","dashed","dotted","double"],ce=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],ie=()=>[ut,al,ub,cb],ge=()=>["","none",f,qe,Ue],ye=()=>["none",ut,qe,Ue],Re=()=>["none",ut,qe,Ue],Ee=()=>[ut,qe,Ue],Ie=()=>[ka,"full",...R()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[an],breakpoint:[an],color:[A8],container:[an],"drop-shadow":[an],ease:["in","out","in-out"],font:[j8],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[an],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[an],shadow:[an],spacing:["px",ut],text:[an],"text-shadow":[an],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",ka,Ue,qe,v]}],container:["container"],columns:[{columns:[ut,Ue,qe,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:E()}],overflow:[{overflow:k()}],"overflow-x":[{"overflow-x":k()}],"overflow-y":[{"overflow-y":k()}],overscroll:[{overscroll:C()}],"overscroll-x":[{"overscroll-x":C()}],"overscroll-y":[{"overscroll-y":C()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:T()}],"inset-x":[{"inset-x":T()}],"inset-y":[{"inset-y":T()}],start:[{start:T()}],end:[{end:T()}],top:[{top:T()}],right:[{right:T()}],bottom:[{bottom:T()}],left:[{left:T()}],visibility:["visible","invisible","collapse"],z:[{z:[kn,"auto",qe,Ue]}],basis:[{basis:[ka,"full","auto",l,...R()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[ut,ka,"auto","initial","none",Ue]}],grow:[{grow:["",ut,qe,Ue]}],shrink:[{shrink:["",ut,qe,Ue]}],order:[{order:[kn,"first","last","none",qe,Ue]}],"grid-cols":[{"grid-cols":I()}],"col-start-end":[{col:M()}],"col-start":[{"col-start":_()}],"col-end":[{"col-end":_()}],"grid-rows":[{"grid-rows":I()}],"row-start-end":[{row:M()}],"row-start":[{"row-start":_()}],"row-end":[{"row-end":_()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":P()}],"auto-rows":[{"auto-rows":P()}],gap:[{gap:R()}],"gap-x":[{"gap-x":R()}],"gap-y":[{"gap-y":R()}],"justify-content":[{justify:[...N(),"normal"]}],"justify-items":[{"justify-items":[...z(),"normal"]}],"justify-self":[{"justify-self":["auto",...z()]}],"align-content":[{content:["normal",...N()]}],"align-items":[{items:[...z(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...z(),{baseline:["","last"]}]}],"place-content":[{"place-content":N()}],"place-items":[{"place-items":[...z(),"baseline"]}],"place-self":[{"place-self":["auto",...z()]}],p:[{p:R()}],px:[{px:R()}],py:[{py:R()}],ps:[{ps:R()}],pe:[{pe:R()}],pt:[{pt:R()}],pr:[{pr:R()}],pb:[{pb:R()}],pl:[{pl:R()}],m:[{m:J()}],mx:[{mx:J()}],my:[{my:J()}],ms:[{ms:J()}],me:[{me:J()}],mt:[{mt:J()}],mr:[{mr:J()}],mb:[{mb:J()}],ml:[{ml:J()}],"space-x":[{"space-x":R()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":R()}],"space-y-reverse":["space-y-reverse"],size:[{size:H()}],w:[{w:[l,"screen",...H()]}],"min-w":[{"min-w":[l,"screen","none",...H()]}],"max-w":[{"max-w":[l,"screen","none","prose",{screen:[o]},...H()]}],h:[{h:["screen","lh",...H()]}],"min-h":[{"min-h":["screen","lh","none",...H()]}],"max-h":[{"max-h":["screen","lh",...H()]}],"font-size":[{text:["base",r,di,Hn]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[n,qe,il]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",al,Ue]}],"font-family":[{font:[O8,Ue,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,qe,Ue]}],"line-clamp":[{"line-clamp":[ut,"none",qe,il]}],leading:[{leading:[i,...R()]}],"list-image":[{"list-image":["none",qe,Ue]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",qe,Ue]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:K()}],"text-color":[{text:K()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...te(),"wavy"]}],"text-decoration-thickness":[{decoration:[ut,"from-font","auto",qe,Hn]}],"text-decoration-color":[{decoration:K()}],"underline-offset":[{"underline-offset":[ut,"auto",qe,Ue]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:R()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",qe,Ue]}],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",qe,Ue]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:q()}],"bg-repeat":[{bg:L()}],"bg-size":[{bg:W()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},kn,qe,Ue],radial:["",qe,Ue],conic:[kn,qe,Ue]},P8,M8]}],"bg-color":[{bg:K()}],"gradient-from-pos":[{from:B()}],"gradient-via-pos":[{via:B()}],"gradient-to-pos":[{to:B()}],"gradient-from":[{from:K()}],"gradient-via":[{via:K()}],"gradient-to":[{to:K()}],rounded:[{rounded:O()}],"rounded-s":[{"rounded-s":O()}],"rounded-e":[{"rounded-e":O()}],"rounded-t":[{"rounded-t":O()}],"rounded-r":[{"rounded-r":O()}],"rounded-b":[{"rounded-b":O()}],"rounded-l":[{"rounded-l":O()}],"rounded-ss":[{"rounded-ss":O()}],"rounded-se":[{"rounded-se":O()}],"rounded-ee":[{"rounded-ee":O()}],"rounded-es":[{"rounded-es":O()}],"rounded-tl":[{"rounded-tl":O()}],"rounded-tr":[{"rounded-tr":O()}],"rounded-br":[{"rounded-br":O()}],"rounded-bl":[{"rounded-bl":O()}],"border-w":[{border:ee()}],"border-w-x":[{"border-x":ee()}],"border-w-y":[{"border-y":ee()}],"border-w-s":[{"border-s":ee()}],"border-w-e":[{"border-e":ee()}],"border-w-t":[{"border-t":ee()}],"border-w-r":[{"border-r":ee()}],"border-w-b":[{"border-b":ee()}],"border-w-l":[{"border-l":ee()}],"divide-x":[{"divide-x":ee()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":ee()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...te(),"hidden","none"]}],"divide-style":[{divide:[...te(),"hidden","none"]}],"border-color":[{border:K()}],"border-color-x":[{"border-x":K()}],"border-color-y":[{"border-y":K()}],"border-color-s":[{"border-s":K()}],"border-color-e":[{"border-e":K()}],"border-color-t":[{"border-t":K()}],"border-color-r":[{"border-r":K()}],"border-color-b":[{"border-b":K()}],"border-color-l":[{"border-l":K()}],"divide-color":[{divide:K()}],"outline-style":[{outline:[...te(),"none","hidden"]}],"outline-offset":[{"outline-offset":[ut,qe,Ue]}],"outline-w":[{outline:["",ut,di,Hn]}],"outline-color":[{outline:K()}],shadow:[{shadow:["","none",d,ss,is]}],"shadow-color":[{shadow:K()}],"inset-shadow":[{"inset-shadow":["none",p,ss,is]}],"inset-shadow-color":[{"inset-shadow":K()}],"ring-w":[{ring:ee()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:K()}],"ring-offset-w":[{"ring-offset":[ut,Hn]}],"ring-offset-color":[{"ring-offset":K()}],"inset-ring-w":[{"inset-ring":ee()}],"inset-ring-color":[{"inset-ring":K()}],"text-shadow":[{"text-shadow":["none",h,ss,is]}],"text-shadow-color":[{"text-shadow":K()}],opacity:[{opacity:[ut,qe,Ue]}],"mix-blend":[{"mix-blend":[...ce(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":ce()}],"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":[ut]}],"mask-image-linear-from-pos":[{"mask-linear-from":ie()}],"mask-image-linear-to-pos":[{"mask-linear-to":ie()}],"mask-image-linear-from-color":[{"mask-linear-from":K()}],"mask-image-linear-to-color":[{"mask-linear-to":K()}],"mask-image-t-from-pos":[{"mask-t-from":ie()}],"mask-image-t-to-pos":[{"mask-t-to":ie()}],"mask-image-t-from-color":[{"mask-t-from":K()}],"mask-image-t-to-color":[{"mask-t-to":K()}],"mask-image-r-from-pos":[{"mask-r-from":ie()}],"mask-image-r-to-pos":[{"mask-r-to":ie()}],"mask-image-r-from-color":[{"mask-r-from":K()}],"mask-image-r-to-color":[{"mask-r-to":K()}],"mask-image-b-from-pos":[{"mask-b-from":ie()}],"mask-image-b-to-pos":[{"mask-b-to":ie()}],"mask-image-b-from-color":[{"mask-b-from":K()}],"mask-image-b-to-color":[{"mask-b-to":K()}],"mask-image-l-from-pos":[{"mask-l-from":ie()}],"mask-image-l-to-pos":[{"mask-l-to":ie()}],"mask-image-l-from-color":[{"mask-l-from":K()}],"mask-image-l-to-color":[{"mask-l-to":K()}],"mask-image-x-from-pos":[{"mask-x-from":ie()}],"mask-image-x-to-pos":[{"mask-x-to":ie()}],"mask-image-x-from-color":[{"mask-x-from":K()}],"mask-image-x-to-color":[{"mask-x-to":K()}],"mask-image-y-from-pos":[{"mask-y-from":ie()}],"mask-image-y-to-pos":[{"mask-y-to":ie()}],"mask-image-y-from-color":[{"mask-y-from":K()}],"mask-image-y-to-color":[{"mask-y-to":K()}],"mask-image-radial":[{"mask-radial":[qe,Ue]}],"mask-image-radial-from-pos":[{"mask-radial-from":ie()}],"mask-image-radial-to-pos":[{"mask-radial-to":ie()}],"mask-image-radial-from-color":[{"mask-radial-from":K()}],"mask-image-radial-to-color":[{"mask-radial-to":K()}],"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":S()}],"mask-image-conic-pos":[{"mask-conic":[ut]}],"mask-image-conic-from-pos":[{"mask-conic-from":ie()}],"mask-image-conic-to-pos":[{"mask-conic-to":ie()}],"mask-image-conic-from-color":[{"mask-conic-from":K()}],"mask-image-conic-to-color":[{"mask-conic-to":K()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:q()}],"mask-repeat":[{mask:L()}],"mask-size":[{mask:W()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",qe,Ue]}],filter:[{filter:["","none",qe,Ue]}],blur:[{blur:ge()}],brightness:[{brightness:[ut,qe,Ue]}],contrast:[{contrast:[ut,qe,Ue]}],"drop-shadow":[{"drop-shadow":["","none",m,ss,is]}],"drop-shadow-color":[{"drop-shadow":K()}],grayscale:[{grayscale:["",ut,qe,Ue]}],"hue-rotate":[{"hue-rotate":[ut,qe,Ue]}],invert:[{invert:["",ut,qe,Ue]}],saturate:[{saturate:[ut,qe,Ue]}],sepia:[{sepia:["",ut,qe,Ue]}],"backdrop-filter":[{"backdrop-filter":["","none",qe,Ue]}],"backdrop-blur":[{"backdrop-blur":ge()}],"backdrop-brightness":[{"backdrop-brightness":[ut,qe,Ue]}],"backdrop-contrast":[{"backdrop-contrast":[ut,qe,Ue]}],"backdrop-grayscale":[{"backdrop-grayscale":["",ut,qe,Ue]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[ut,qe,Ue]}],"backdrop-invert":[{"backdrop-invert":["",ut,qe,Ue]}],"backdrop-opacity":[{"backdrop-opacity":[ut,qe,Ue]}],"backdrop-saturate":[{"backdrop-saturate":[ut,qe,Ue]}],"backdrop-sepia":[{"backdrop-sepia":["",ut,qe,Ue]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":R()}],"border-spacing-x":[{"border-spacing-x":R()}],"border-spacing-y":[{"border-spacing-y":R()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",qe,Ue]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[ut,"initial",qe,Ue]}],ease:[{ease:["linear","initial",x,qe,Ue]}],delay:[{delay:[ut,qe,Ue]}],animate:[{animate:["none",y,qe,Ue]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[g,qe,Ue]}],"perspective-origin":[{"perspective-origin":E()}],rotate:[{rotate:ye()}],"rotate-x":[{"rotate-x":ye()}],"rotate-y":[{"rotate-y":ye()}],"rotate-z":[{"rotate-z":ye()}],scale:[{scale:Re()}],"scale-x":[{"scale-x":Re()}],"scale-y":[{"scale-y":Re()}],"scale-z":[{"scale-z":Re()}],"scale-3d":["scale-3d"],skew:[{skew:Ee()}],"skew-x":[{"skew-x":Ee()}],"skew-y":[{"skew-y":Ee()}],transform:[{transform:[qe,Ue,"","none","gpu","cpu"]}],"transform-origin":[{origin:E()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:Ie()}],"translate-x":[{"translate-x":Ie()}],"translate-y":[{"translate-y":Ie()}],"translate-z":[{"translate-z":Ie()}],"translate-none":["translate-none"],accent:[{accent:K()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:K()}],"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",qe,Ue]}],"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":R()}],"scroll-mx":[{"scroll-mx":R()}],"scroll-my":[{"scroll-my":R()}],"scroll-ms":[{"scroll-ms":R()}],"scroll-me":[{"scroll-me":R()}],"scroll-mt":[{"scroll-mt":R()}],"scroll-mr":[{"scroll-mr":R()}],"scroll-mb":[{"scroll-mb":R()}],"scroll-ml":[{"scroll-ml":R()}],"scroll-p":[{"scroll-p":R()}],"scroll-px":[{"scroll-px":R()}],"scroll-py":[{"scroll-py":R()}],"scroll-ps":[{"scroll-ps":R()}],"scroll-pe":[{"scroll-pe":R()}],"scroll-pt":[{"scroll-pt":R()}],"scroll-pr":[{"scroll-pr":R()}],"scroll-pb":[{"scroll-pb":R()}],"scroll-pl":[{"scroll-pl":R()}],"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",qe,Ue]}],fill:[{fill:["none",...K()]}],"stroke-w":[{stroke:[ut,di,Hn,il]}],stroke:[{stroke:["none",...K()]}],"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"]}},$8=w8(z8);function Oe(...e){return $8(SE(e))}function U8(e){if(!e||typeof e!="string")return null;try{return JSON.parse(e)}catch{return null}}const q8=EE("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 Lr({className:e,variant:t,...r}){return s.jsx("div",{className:Oe(q8({variant:t}),e),...r})}const G8=EE("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium touch-manipulation 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"}}),Be=b.forwardRef(({className:e,variant:t,size:r,...n},a)=>s.jsx("button",{className:Oe(G8({variant:t,size:r,className:e})),ref:a,...n}));Be.displayName="Button";function nh({checked:e,onToggle:t,ariaLabel:r="Toggle dark mode"}){const{isDarkMode:n,toggleDarkMode:a}=Ka(),i=typeof e=="boolean"&&typeof t=="function",o=i?e:n,l=()=>{if(i&&t){t(!o);return}a()};return s.jsxs("button",{onClick:l,className:Oe("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:[s.jsx("span",{className:"sr-only",children:r}),s.jsx("span",{className:Oe("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?s.jsx(nf,{className:"h-3 w-3 text-primary"}):s.jsx(af,{className:"h-3 w-3 text-white dark:text-background"})})]})}const At=b.forwardRef(({className:e,type:t,...r},n)=>s.jsx("input",{type:t,className:Oe("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}));At.displayName="Input";const uf=b.forwardRef(({className:e,children:t,...r},n)=>s.jsx("div",{className:Oe(e,"relative overflow-hidden"),...r,children:s.jsx("div",{ref:n,className:"h-full w-full overflow-auto rounded-[inherit]",style:{WebkitOverflowScrolling:"touch",touchAction:"pan-y"},children:t})}));uf.displayName="ScrollArea";function H8(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 _n({children:e,content:t,position:r="top",className:n="",delay:a=350}){const[i,o]=b.useState(!1),l=b.useRef(null),c=b.useRef(!1),u=b.useRef(null),d=b.useRef(null),[p,h]=b.useState(null),m=b.useCallback(()=>{const w=u.current;if(!w)return;const S=w.getBoundingClientRect(),E=8,k={position:"fixed",zIndex:9999};switch(r){case"bottom":k.left=S.left+S.width/2,k.top=S.bottom+E,k.transform="translateX(-50%)";break;case"left":k.left=S.left-E,k.top=S.top+S.height/2,k.transform="translate(-100%, -50%)";break;case"right":k.left=S.right+E,k.top=S.top+S.height/2,k.transform="translateY(-50%)";break;case"top":default:k.left=S.left+S.width/2,k.top=S.top-E,k.transform="translate(-50%, -100%)";break}h(k)},[r]),f=()=>{l.current!==null&&(window.clearTimeout(l.current),l.current=null)},g=()=>{f(),l.current=window.setTimeout(()=>{o(!0)},a)},v=()=>{f(),o(!1)},x=()=>{f(),c.current=!1,l.current=window.setTimeout(()=>{c.current=!0,o(!0)},a)},y=()=>{f(),!c.current&&o(!1)};return b.useEffect(()=>()=>{f()},[]),b.useEffect(()=>{if(!i||typeof document>"u")return;const w=S=>{const E=S.target;E instanceof Node&&u.current?.contains(E)||(o(!1),c.current=!1)};return document.addEventListener("pointerdown",w,!0),()=>document.removeEventListener("pointerdown",w,!0)},[i]),b.useEffect(()=>{if(!i){h(null);return}const w=window.requestAnimationFrame(m),S=()=>m();return window.addEventListener("resize",S),window.addEventListener("scroll",S,!0),()=>{window.cancelAnimationFrame(w),window.removeEventListener("resize",S),window.removeEventListener("scroll",S,!0)}},[i,m]),t?s.jsxs("div",{ref:u,className:"relative inline-block",onMouseEnter:g,onMouseLeave:v,onTouchStart:x,onTouchEnd:y,onTouchCancel:y,children:[e,i&&typeof document<"u"&&P4.createPortal(s.jsxs("div",{ref:d,style:p||{position:"fixed",top:"-9999px",left:"-9999px",opacity:0},className:Oe("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,s.jsx("div",{className:Oe("absolute w-0 h-0 border-4 border-transparent",H8(r))})]}),document.body)]}):s.jsx(s.Fragment,{children:e})}function df({children:e,className:t}){return s.jsx("div",{className:Oe("inline-flex items-center gap-[2px] rounded-lg bg-muted/60 p-[3px]",t),children:e})}function pf({isActive:e,onClick:t,children:r,className:n}){return s.jsx("button",{onClick:t,className:Oe("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 db="https://github.com/siteboon/claudecodeui/issues/new",W8="https://github.com/siteboon/claudecodeui",pb="https://discord.gg/buxwujPNRE";function mb({className:e}){return s.jsx("svg",{className:e,fill:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:s.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 V8({updateAvailable:e,releaseInfo:t,latestVersion:r,currentVersion:n,onShowVersionModal:a,onShowSettings:i,t:o}){return s.jsxs("div",{className:"flex-shrink-0",style:{paddingBottom:"env(safe-area-inset-bottom, 0)"},children:[e&&s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"nav-divider"}),s.jsx("div",{className:"hidden px-2 py-1.5 md:block",children:s.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:[s.jsxs("div",{className:"relative flex-shrink-0",children:[s.jsx(Ug,{className:"h-4 w-4 text-blue-500 dark:text-blue-400"}),s.jsx("span",{className:"absolute -right-0.5 -top-0.5 h-1.5 w-1.5 animate-pulse rounded-full bg-blue-500"})]}),s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsx("span",{className:"block truncate text-sm font-medium text-blue-600 dark:text-blue-300",children:t?.title||`v${r}`}),s.jsx("span",{className:"text-[10px] text-blue-500/70 dark:text-blue-400/60",children:o("version.updateAvailable")})]})]})}),s.jsx("div",{className:"px-3 py-2 md:hidden",children:s.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:[s.jsxs("div",{className:"relative flex-shrink-0",children:[s.jsx(Ug,{className:"w-4.5 h-4.5 text-blue-500 dark:text-blue-400"}),s.jsx("span",{className:"absolute -right-0.5 -top-0.5 h-1.5 w-1.5 animate-pulse rounded-full bg-blue-500"})]}),s.jsxs("div",{className:"min-w-0 flex-1 text-left",children:[s.jsx("span",{className:"block truncate text-sm font-medium text-blue-600 dark:text-blue-300",children:t?.title||`v${r}`}),s.jsx("span",{className:"text-xs text-blue-500/70 dark:text-blue-400/60",children:o("version.updateAvailable")})]})]})})]}),s.jsx("div",{className:"nav-divider"}),s.jsx("div",{className:"hidden px-2 pt-1.5 md:block",children:s.jsxs("a",{href:db,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:[s.jsx(K0,{className:"h-3.5 w-3.5"}),s.jsx("span",{className:"text-sm",children:o("actions.reportIssue")})]})}),s.jsx("div",{className:"hidden px-2 md:block",children:s.jsxs("a",{href:pb,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:[s.jsx(mb,{className:"h-3.5 w-3.5"}),s.jsx("span",{className:"text-sm",children:o("actions.joinCommunity")})]})}),s.jsx("div",{className:"hidden px-2 py-1.5 md:block",children:s.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:i,children:[s.jsx(Et,{className:"h-3.5 w-3.5"}),s.jsx("span",{className:"text-sm",children:o("actions.settings")})]})}),s.jsx("div",{className:"hidden px-3 py-2 text-center md:block",children:s.jsxs("a",{href:W8,target:"_blank",rel:"noopener noreferrer",className:"text-[10px] text-muted-foreground/40 transition-colors hover:text-muted-foreground",children:["CloudCLI v",n," – ",o("branding.openSource")]})}),s.jsx("div",{className:"px-3 pt-3 md:hidden",children:s.jsxs("a",{href:db,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:[s.jsx("div",{className:"flex h-8 w-8 items-center justify-center rounded-xl bg-background/80",children:s.jsx(K0,{className:"w-4.5 h-4.5 text-muted-foreground"})}),s.jsx("span",{className:"text-base font-medium text-foreground",children:o("actions.reportIssue")})]})}),s.jsx("div",{className:"px-3 pt-2 md:hidden",children:s.jsxs("a",{href:pb,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:[s.jsx("div",{className:"flex h-8 w-8 items-center justify-center rounded-xl bg-background/80",children:s.jsx(mb,{className:"w-4.5 h-4.5 text-muted-foreground"})}),s.jsx("span",{className:"text-base font-medium text-foreground",children:o("actions.joinCommunity")})]})}),s.jsx("div",{className:"px-3 pb-3 pt-2 md:hidden",children:s.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:i,children:[s.jsx("div",{className:"flex h-8 w-8 items-center justify-center rounded-xl bg-background/80",children:s.jsx(Et,{className:"w-4.5 h-4.5 text-muted-foreground"})}),s.jsx("span",{className:"text-base font-medium text-foreground",children:o("actions.settings")})]})})]})}const hb="CLOUDCLI_GITHUB_STARS",fb="CLOUDCLI_HIDE_GITHUB_STAR",K8=3600*1e3,Y8=(e,t)=>{const[r,n]=b.useState(null),[a,i]=b.useState(()=>{try{return localStorage.getItem(fb)==="true"}catch{return!1}});b.useEffect(()=>{if(a)return;try{const u=localStorage.getItem(hb);if(u){const d=JSON.parse(u);if(Date.now()-d.timestamp<K8){n(d.count);return}}}catch{}(async()=>{try{const u=await fetch(`https://api.github.com/repos/${e}/${t}`);if(!u.ok)return;const p=(await u.json()).stargazers_count;if(typeof p=="number"){n(p);try{localStorage.setItem(hb,JSON.stringify({count:p,timestamp:Date.now()}))}catch{}}}catch{}})()},[e,t,a]);const o=b.useCallback(()=>{i(!0);try{localStorage.setItem(fb,"true")}catch{}},[]),l=r!==null?r>=1e3?`${(r/1e3).toFixed(1)}k`:`${r}`:null;return{starCount:r,formattedCount:l,isDismissed:a,dismiss:o}},Z8="https://github.com/siteboon/claudecodeui";function X8({className:e}){return s.jsx("svg",{className:e,fill:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:s.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 J8(){const{formattedCount:e,isDismissed:t,dismiss:r}=Y8("siteboon","claudecodeui");return t?null:s.jsxs("div",{className:"group/star relative hidden md:block",children:[s.jsxs("a",{href:Z8,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:[s.jsx(X8,{className:"h-3.5 w-3.5"}),s.jsx(Xs,{className:"h-3 w-3"}),s.jsx("span",{className:"font-medium",children:"Star"}),e&&s.jsx("span",{className:"border-l border-border/50 pl-1.5 tabular-nums",children:e})]}),s.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:s.jsx(kt,{className:"h-2.5 w-2.5"})})]})}function Q8({isPWA:e,isMobile:t,isLoading:r,projectsCount:n,searchFilter:a,onSearchFilterChange:i,onClearSearchFilter:o,searchMode:l,onSearchModeChange:c,onRefresh:u,isRefreshing:d,onCreateProject:p,onCollapseSidebar:h,t:m}){const f=()=>s.jsxs("div",{className:"flex min-w-0 items-center gap-2.5",children:[s.jsx("div",{className:"flex h-7 w-7 flex-shrink-0 items-center justify-center rounded-lg bg-primary/90 shadow-sm",children:s.jsx("svg",{className:"h-3.5 w-3.5 text-primary-foreground",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2.2,strokeLinecap:"round",strokeLinejoin:"round",children:s.jsx("path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"})})}),s.jsx("h1",{className:"truncate text-sm font-semibold tracking-tight text-foreground",children:m("app.title")})]});return s.jsxs("div",{className:"flex-shrink-0",children:[s.jsxs("div",{className:"hidden px-3 pb-2 pt-3 md:block",style:{},children:[s.jsxs("div",{className:"flex items-center justify-between gap-2",children:[s.jsx(f,{}),s.jsxs("div",{className:"flex flex-shrink-0 items-center gap-0.5",children:[s.jsx(Be,{variant:"ghost",size:"sm",className:"h-7 w-7 rounded-lg p-0 text-muted-foreground hover:bg-accent/80 hover:text-foreground",onClick:u,disabled:d,title:m("tooltips.refresh"),children:s.jsx(mr,{className:`h-3.5 w-3.5 ${d?"animate-spin":""}`})}),s.jsx(Be,{variant:"ghost",size:"sm",className:"h-7 w-7 rounded-lg p-0 text-muted-foreground hover:bg-accent/80 hover:text-foreground",onClick:p,title:m("tooltips.createProject"),children:s.jsx(qt,{className:"h-3.5 w-3.5"})}),s.jsx(Be,{variant:"ghost",size:"sm",className:"h-7 w-7 rounded-lg p-0 text-muted-foreground hover:bg-accent/80 hover:text-foreground",onClick:h,title:m("tooltips.hideSidebar"),children:s.jsx(M7,{className:"h-3.5 w-3.5"})})]})]}),s.jsx(J8,{}),n>0&&!r&&s.jsxs("div",{className:"mt-2.5 space-y-2",children:[s.jsxs("div",{className:"flex rounded-lg bg-muted/50 p-0.5",children:[s.jsxs("button",{onClick:()=>c("projects"),"aria-pressed":l==="projects",className:Oe("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:[s.jsx(Br,{className:"h-3 w-3"}),m("search.modeProjects")]}),s.jsxs("button",{onClick:()=>c("conversations"),"aria-pressed":l==="conversations",className:Oe("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:[s.jsx(aa,{className:"h-3 w-3"}),m("search.modeConversations")]})]}),s.jsxs("div",{className:"relative",children:[s.jsx(On,{className:"pointer-events-none absolute left-3 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-muted-foreground/50"}),s.jsx(At,{type:"text",placeholder:m(l==="conversations"?"search.conversationsPlaceholder":"projects.searchPlaceholder"),value:a,onChange:g=>i(g.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&&s.jsx("button",{onClick:o,"aria-label":m("tooltips.clearSearch"),className:"absolute right-2.5 top-1/2 -translate-y-1/2 rounded-md p-0.5 hover:bg-accent",children:s.jsx(kt,{className:"h-3 w-3 text-muted-foreground"})})]})]})]}),s.jsx("div",{className:"nav-divider hidden md:block"}),s.jsxs("div",{className:"p-3 pb-2 md:hidden",style:e&&t?{paddingTop:"16px"}:{},children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx(f,{}),s.jsxs("div",{className:"flex flex-shrink-0 gap-1.5",children:[s.jsx("button",{className:"flex h-8 w-8 items-center justify-center rounded-lg bg-muted/50 transition-all active:scale-95",onClick:u,disabled:d,children:s.jsx(mr,{className:`h-4 w-4 text-muted-foreground ${d?"animate-spin":""}`})}),s.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:s.jsx(na,{className:"h-4 w-4"})})]})]}),n>0&&!r&&s.jsxs("div",{className:"mt-2.5 space-y-2",children:[s.jsxs("div",{className:"flex rounded-lg bg-muted/50 p-0.5",children:[s.jsxs("button",{onClick:()=>c("projects"),"aria-pressed":l==="projects",className:Oe("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:[s.jsx(Br,{className:"h-3 w-3"}),m("search.modeProjects")]}),s.jsxs("button",{onClick:()=>c("conversations"),"aria-pressed":l==="conversations",className:Oe("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:[s.jsx(aa,{className:"h-3 w-3"}),m("search.modeConversations")]})]}),s.jsxs("div",{className:"relative",children:[s.jsx(On,{className:"pointer-events-none absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground/50"}),s.jsx(At,{type:"text",placeholder:m(l==="conversations"?"search.conversationsPlaceholder":"projects.searchPlaceholder"),value:a,onChange:g=>i(g.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&&s.jsx("button",{onClick:o,"aria-label":m("tooltips.clearSearch"),className:"absolute right-2.5 top-1/2 -translate-y-1/2 rounded-md p-1 hover:bg-accent",children:s.jsx(kt,{className:"h-3.5 w-3.5 text-muted-foreground"})})]})]})]}),s.jsx("div",{className:"nav-divider md:hidden"})]})}const gb={xs:"w-3 h-3",sm:"w-4 h-4",md:"w-5 h-5",lg:"w-6 h-6"},eR={xs:"p-0.5",sm:"p-1",md:"p-1.5",lg:"p-2"},tR=e=>e==="fully-configured"?{icon:No,colorClassName:"text-green-500 dark:text-green-400",backgroundClassName:"bg-green-50 dark:bg-green-950",label:"TaskMaster Ready",title:"TaskMaster fully configured with MCP server"}:e==="taskmaster-only"?{icon:Et,colorClassName:"text-blue-500 dark:text-blue-400",backgroundClassName:"bg-blue-50 dark:bg-blue-950",label:"TaskMaster Init",title:"TaskMaster initialized, MCP server needs setup"}:e==="mcp-only"?{icon:Vi,colorClassName:"text-amber-500 dark:text-amber-400",backgroundClassName:"bg-amber-50 dark:bg-amber-950",label:"MCP Ready",title:"MCP server configured, TaskMaster needs initialization"}:{icon:kt,colorClassName:"text-gray-400 dark:text-gray-500",backgroundClassName:"bg-gray-50 dark:bg-gray-900",label:"No TaskMaster",title:"TaskMaster not configured"};function rR({status:e="not-configured",size:t="sm",className:r="",showLabel:n=!1}){const a=tR(e),i=a.icon;return n?s.jsxs("div",{className:Oe("inline-flex items-center gap-1.5 text-xs rounded-md px-2 py-1 transition-colors",a.backgroundClassName,a.colorClassName,r),title:a.title,children:[s.jsx(i,{className:gb[t]}),s.jsx("span",{className:"font-medium",children:a.label})]}):s.jsx("div",{className:Oe("inline-flex items-center justify-center rounded-full transition-colors",a.backgroundClassName,eR[t],r),title:a.title,children:s.jsx(i,{className:Oe(gb[t],a.colorClassName)})})}const bb=(e,t,r)=>{const n=new Date(e),a=t;if(isNaN(n.getTime()))return r?r("status.unknown"):"Unknown";const i=a.getTime()-n.getTime(),o=Math.floor(i/1e3),l=Math.floor(i/(1e3*60)),c=Math.floor(i/(1e3*60*60)),u=Math.floor(i/(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`:u===1?r?r("time.oneDayAgo"):"1 day ago":u<7?r?r("time.daysAgo",{count:u}):`${u} days ago`:n.toLocaleDateString()};function nR({project:e,session:t,selectedSession:r,currentTime:n,editingSession:a,editingSessionName:i,onEditingSessionNameChange:o,onStartEditingSession:l,onCancelEditingSession:c,onSaveEditingSession:u,onProjectSelect:d,onSessionSelect:p,onDeleteSession:h,t:m}){const f=J_(t,n,m),g=r?.id===t.id,v=()=>{d(e),p(t,e.name)},x=()=>{u(e.name,t.id,i,t.__provider)},y=()=>{h(e.name,t.id,f.sessionName,t.__provider)};return s.jsxs("div",{className:"group relative",children:[f.isActive&&s.jsx("div",{className:"absolute left-0 top-1/2 -translate-x-1 -translate-y-1/2 transform",children:s.jsx("div",{className:"h-2 w-2 animate-pulse rounded-full bg-green-500"})}),s.jsx("div",{className:"md:hidden",children:s.jsx("div",{className:Oe("p-2 mx-3 my-0.5 rounded-md bg-card border active:scale-[0.98] transition-all duration-150 relative",g?"bg-primary/5 border-primary/20":"",!g&&f.isActive?"border-green-500/30 bg-green-50/5 dark:bg-green-900/5":"border-border/30"),onClick:v,children:s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("div",{className:Oe("w-5 h-5 rounded-md flex items-center justify-center flex-shrink-0",g?"bg-primary/10":"bg-muted/50"),children:s.jsx(Or,{provider:t.__provider,className:"h-3 w-3"})}),s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsx("div",{className:"truncate text-xs font-medium text-foreground",children:f.sessionName}),s.jsxs("div",{className:"mt-0.5 flex items-center gap-1",children:[s.jsx(Li,{className:"h-2.5 w-2.5 text-muted-foreground"}),s.jsx("span",{className:"text-xs text-muted-foreground",children:bb(f.sessionTime,n,m)}),f.messageCount>0&&s.jsx(Lr,{variant:"secondary",className:"ml-auto px-1 py-0 text-xs",children:f.messageCount}),s.jsx("span",{className:"ml-1 opacity-70",children:s.jsx(Or,{provider:t.__provider,className:"h-3 w-3"})})]})]}),!f.isCursorSession&&s.jsx("button",{className:"ml-1 flex h-5 w-5 items-center justify-center rounded-md bg-red-50 opacity-70 transition-transform active:scale-95 dark:bg-red-900/20",onClick:w=>{w.stopPropagation(),y()},children:s.jsx(Vt,{className:"h-2.5 w-2.5 text-red-600 dark:text-red-400"})})]})})}),s.jsxs("div",{className:"hidden md:block",children:[s.jsx(Be,{variant:"ghost",className:Oe("w-full justify-start p-2 h-auto font-normal text-left hover:bg-accent/50 transition-colors duration-200",g&&"bg-accent text-accent-foreground"),onClick:()=>p(t,e.name),children:s.jsxs("div",{className:"flex w-full min-w-0 items-start gap-2",children:[s.jsx(Or,{provider:t.__provider,className:"mt-0.5 h-3 w-3 flex-shrink-0"}),s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsx("div",{className:"truncate text-xs font-medium text-foreground",children:f.sessionName}),s.jsxs("div",{className:"mt-0.5 flex items-center gap-1",children:[s.jsx(Li,{className:"h-2.5 w-2.5 text-muted-foreground"}),s.jsx("span",{className:"text-xs text-muted-foreground",children:bb(f.sessionTime,n,m)}),f.messageCount>0&&s.jsx(Lr,{variant:"secondary",className:"ml-auto px-1 py-0 text-xs transition-opacity group-hover:opacity-0",children:f.messageCount}),s.jsx("span",{className:"ml-1 opacity-70 transition-opacity group-hover:opacity-0",children:s.jsx(Or,{provider:t.__provider,className:"h-3 w-3"})})]})]})]})}),s.jsx("div",{className:"absolute right-2 top-1/2 flex -translate-y-1/2 transform items-center gap-1 opacity-0 transition-all duration-200 group-hover:opacity-100",children:a===t.id?s.jsxs(s.Fragment,{children:[s.jsx("input",{type:"text",value:i,onChange:w=>o(w.target.value),onKeyDown:w=>{w.stopPropagation(),w.key==="Enter"?x():w.key==="Escape"&&c()},onClick:w=>w.stopPropagation(),className:"w-32 rounded border border-border bg-background px-2 py-1 text-xs focus:outline-none focus:ring-1 focus:ring-primary",autoFocus:!0}),s.jsx("button",{className:"flex h-6 w-6 items-center justify-center rounded bg-green-50 hover:bg-green-100 dark:bg-green-900/20 dark:hover:bg-green-900/40",onClick:w=>{w.stopPropagation(),x()},title:m("tooltips.save"),children:s.jsx(Xt,{className:"h-3 w-3 text-green-600 dark:text-green-400"})}),s.jsx("button",{className:"flex h-6 w-6 items-center justify-center rounded bg-gray-50 hover:bg-gray-100 dark:bg-gray-900/20 dark:hover:bg-gray-900/40",onClick:w=>{w.stopPropagation(),c()},title:m("tooltips.cancel"),children:s.jsx(kt,{className:"h-3 w-3 text-gray-600 dark:text-gray-400"})})]}):s.jsxs(s.Fragment,{children:[s.jsx("button",{className:"flex h-6 w-6 items-center justify-center rounded bg-gray-50 hover:bg-gray-100 dark:bg-gray-900/20 dark:hover:bg-gray-900/40",onClick:w=>{w.stopPropagation(),l(t.id,f.sessionName)},title:m("tooltips.editSessionName"),children:s.jsx(z7,{className:"h-3 w-3 text-gray-600 dark:text-gray-400"})}),!f.isCursorSession&&s.jsx("button",{className:"flex h-6 w-6 items-center justify-center rounded bg-red-50 hover:bg-red-100 dark:bg-red-900/20 dark:hover:bg-red-900/40",onClick:w=>{w.stopPropagation(),y()},title:m("tooltips.deleteSession"),children:s.jsx(Vt,{className:"h-3 w-3 text-red-600 dark:text-red-400"})})]})})]})]})}function aR(){return s.jsx(s.Fragment,{children:Array.from({length:3}).map((e,t)=>s.jsx("div",{className:"rounded-md p-2",children:s.jsxs("div",{className:"flex items-start gap-2",children:[s.jsx("div",{className:"mt-0.5 h-3 w-3 animate-pulse rounded-full bg-muted"}),s.jsxs("div",{className:"flex-1 space-y-1",children:[s.jsx("div",{className:"h-3 animate-pulse rounded bg-muted",style:{width:`${60+t*15}%`}}),s.jsx("div",{className:"h-2 w-1/2 animate-pulse rounded bg-muted"})]})]})},t))})}function iR({project:e,isExpanded:t,sessions:r,selectedSession:n,initialSessionsLoaded:a,isLoadingSessions:i,currentTime:o,editingSession:l,editingSessionName:c,onEditingSessionNameChange:u,onStartEditingSession:d,onCancelEditingSession:p,onSaveEditingSession:h,onProjectSelect:m,onSessionSelect:f,onDeleteSession:g,onLoadMoreSessions:v,onNewSession:x,t:y}){if(!t)return null;const w=r.length>0,S=e.sessionMeta?.hasMore===!0;return s.jsxs("div",{className:"ml-3 space-y-1 border-l border-border pl-3",children:[s.jsx("div",{className:"px-3 pb-1 pt-1 md:hidden",children:s.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:()=>{m(e),x(e)},children:[s.jsx(qt,{className:"h-3 w-3"}),y("sessions.newSession")]})}),s.jsxs(Be,{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:()=>x(e),children:[s.jsx(qt,{className:"h-3 w-3"}),y("sessions.newSession")]}),a?!w&&!i?s.jsx("div",{className:"px-3 py-2 text-left",children:s.jsx("p",{className:"text-xs text-muted-foreground",children:y("sessions.noSessions")})}):r.map(E=>s.jsx(nR,{project:e,session:E,selectedSession:n,currentTime:o,editingSession:l,editingSessionName:c,onEditingSessionNameChange:u,onStartEditingSession:d,onCancelEditingSession:p,onSaveEditingSession:h,onProjectSelect:m,onSessionSelect:f,onDeleteSession:g,t:y},E.id)):s.jsx(aR,{}),w&&S&&s.jsx(Be,{variant:"ghost",size:"sm",className:"mt-2 w-full justify-center gap-2 text-muted-foreground",onClick:()=>v(e),disabled:i,children:i?s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"h-3 w-3 animate-spin rounded-full border border-muted-foreground border-t-transparent"}),y("sessions.loading")]}):s.jsxs(s.Fragment,{children:[s.jsx(pr,{className:"h-3 w-3"}),y("sessions.showMore")]})})]})}const sR=(e,t)=>{const r=e.length;return t&&r>=5?`${r}+`:`${r}`};function oR({project:e,selectedProject:t,selectedSession:r,isExpanded:n,isDeleting:a,isStarred:i,editingProject:o,editingName:l,sessions:c,initialSessionsLoaded:u,isLoadingSessions:d,currentTime:p,editingSession:h,editingSessionName:m,tasksEnabled:f,mcpServerStatus:g,onEditingNameChange:v,onToggleProject:x,onProjectSelect:y,onToggleStarProject:w,onStartEditingProject:S,onCancelEditingProject:E,onSaveProjectName:k,onDeleteProject:C,onSessionSelect:R,onDeleteSession:T,onLoadMoreSessions:I,onNewSession:M,onEditingSessionNameChange:_,onStartEditingSession:P,onCancelEditingSession:N,onSaveEditingSession:z,t:J}){const H=t?.name===e.name,K=o===e.name,q=e.sessionMeta?.hasMore===!0,L=sR(c,q),W=`${L} session${c.length===1?"":"s"}`,B=t8(e,g),O=()=>x(e.name),ee=()=>w(e.name),te=()=>{k(e.name)},ce=()=>{t?.name!==e.name&&y(e),O()};return s.jsxs("div",{className:Oe("md:space-y-1",a&&"opacity-50 pointer-events-none"),children:[s.jsxs("div",{className:"md:group group",children:[s.jsx("div",{className:"md:hidden",children:s.jsx("div",{className:Oe("p-3 mx-3 my-1 rounded-lg bg-card border border-border/50 active:scale-[0.98] transition-all duration-150",H&&"bg-primary/5 border-primary/20",i&&!H&&"bg-yellow-50/50 dark:bg-yellow-900/5 border-yellow-200/30 dark:border-yellow-800/30"),onClick:O,children:s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("div",{className:"flex min-w-0 flex-1 items-center gap-3",children:[s.jsx("div",{className:Oe("w-8 h-8 rounded-lg flex items-center justify-center transition-colors",n?"bg-primary/10":"bg-muted"),children:n?s.jsx(Mn,{className:"h-4 w-4 text-primary"}):s.jsx(Br,{className:"h-4 w-4 text-muted-foreground"})}),s.jsx("div",{className:"min-w-0 flex-1",children:K?s.jsx("input",{type:"text",value:l,onChange:ie=>v(ie.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:J("projects.projectNamePlaceholder"),autoFocus:!0,autoComplete:"off",onClick:ie=>ie.stopPropagation(),onKeyDown:ie=>{ie.key==="Enter"&&te(),ie.key==="Escape"&&E()},style:{fontSize:"16px",WebkitAppearance:"none",borderRadius:"8px"}}):s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"flex min-w-0 flex-1 items-center justify-between",children:[s.jsx("h3",{className:"truncate text-sm font-medium text-foreground",children:e.displayName}),f&&s.jsx(rR,{status:B,size:"xs",className:"ml-2 hidden flex-shrink-0 md:inline-flex"})]}),s.jsx("p",{className:"text-xs text-muted-foreground",children:W})]})})]}),s.jsx("div",{className:"flex items-center gap-1",children:K?s.jsxs(s.Fragment,{children:[s.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:ie=>{ie.stopPropagation(),te()},children:s.jsx(Xt,{className:"h-4 w-4 text-white"})}),s.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:ie=>{ie.stopPropagation(),E()},children:s.jsx(kt,{className:"h-4 w-4 text-white"})})]}):s.jsxs(s.Fragment,{children:[s.jsx("button",{className:Oe("w-8 h-8 rounded-lg flex items-center justify-center active:scale-90 transition-all duration-150 border",i?"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:ie=>{ie.stopPropagation(),ee()},title:J(i?"tooltips.removeFromFavorites":"tooltips.addToFavorites"),children:s.jsx(Xs,{className:Oe("w-4 h-4 transition-colors",i?"text-yellow-600 dark:text-yellow-400 fill-current":"text-gray-600 dark:text-gray-400")})}),s.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:ie=>{ie.stopPropagation(),C(e)},children:s.jsx(Vt,{className:"h-4 w-4 text-red-600 dark:text-red-400"})}),s.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:ie=>{ie.stopPropagation(),S(e)},children:s.jsx(Pi,{className:"h-4 w-4 text-primary"})}),s.jsx("div",{className:"flex h-6 w-6 items-center justify-center rounded-md bg-muted/30",children:n?s.jsx(pr,{className:"h-3 w-3 text-muted-foreground"}):s.jsx(Fr,{className:"h-3 w-3 text-muted-foreground"})})]})})]})})}),s.jsxs(Be,{variant:"ghost",className:Oe("hidden md:flex w-full justify-between p-2 h-auto font-normal hover:bg-accent/50",H&&"bg-accent text-accent-foreground",i&&!H&&"bg-yellow-50/50 dark:bg-yellow-900/10 hover:bg-yellow-100/50 dark:hover:bg-yellow-900/20"),onClick:ce,children:[s.jsxs("div",{className:"flex min-w-0 flex-1 items-center gap-3",children:[n?s.jsx(Mn,{className:"h-4 w-4 flex-shrink-0 text-primary"}):s.jsx(Br,{className:"h-4 w-4 flex-shrink-0 text-muted-foreground"}),s.jsx("div",{className:"min-w-0 flex-1 text-left",children:K?s.jsxs("div",{className:"space-y-1",children:[s.jsx("input",{type:"text",value:l,onChange:ie=>v(ie.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:J("projects.projectNamePlaceholder"),autoFocus:!0,onKeyDown:ie=>{ie.key==="Enter"&&te(),ie.key==="Escape"&&E()}}),s.jsx("div",{className:"truncate text-xs text-muted-foreground",title:e.fullPath,children:e.fullPath})]}):s.jsxs("div",{children:[s.jsx("div",{className:"truncate text-sm font-semibold text-foreground",title:e.displayName,children:e.displayName}),s.jsxs("div",{className:"text-xs text-muted-foreground",children:[L,e.fullPath!==e.displayName&&s.jsxs("span",{className:"ml-1 opacity-60",title:e.fullPath,children:[" - ",e.fullPath.length>25?`...${e.fullPath.slice(-22)}`:e.fullPath]})]})]})})]}),s.jsx("div",{className:"flex flex-shrink-0 items-center gap-1",children:K?s.jsxs(s.Fragment,{children:[s.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:ie=>{ie.stopPropagation(),te()},children:s.jsx(Xt,{className:"h-3 w-3"})}),s.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:ie=>{ie.stopPropagation(),E()},children:s.jsx(kt,{className:"h-3 w-3"})})]}):s.jsxs(s.Fragment,{children:[s.jsx("div",{className:Oe("w-6 h-6 opacity-0 group-hover:opacity-100 transition-all duration-200 flex items-center justify-center rounded cursor-pointer touch:opacity-100",i?"hover:bg-yellow-50 dark:hover:bg-yellow-900/20 opacity-100":"hover:bg-accent"),onClick:ie=>{ie.stopPropagation(),ee()},title:J(i?"tooltips.removeFromFavorites":"tooltips.addToFavorites"),children:s.jsx(Xs,{className:Oe("w-3 h-3 transition-colors",i?"text-yellow-600 dark:text-yellow-400 fill-current":"text-muted-foreground")})}),s.jsx("div",{className:"touch:opacity-100 flex h-6 w-6 cursor-pointer items-center justify-center rounded opacity-0 transition-all duration-200 hover:bg-accent group-hover:opacity-100",onClick:ie=>{ie.stopPropagation(),S(e)},title:J("tooltips.renameProject"),children:s.jsx(Pi,{className:"h-3 w-3"})}),s.jsx("div",{className:"touch:opacity-100 flex h-6 w-6 cursor-pointer items-center justify-center rounded opacity-0 transition-all duration-200 hover:bg-red-50 group-hover:opacity-100 dark:hover:bg-red-900/20",onClick:ie=>{ie.stopPropagation(),C(e)},title:J("tooltips.deleteProject"),children:s.jsx(Vt,{className:"h-3 w-3 text-red-600 dark:text-red-400"})}),n?s.jsx(pr,{className:"h-4 w-4 text-muted-foreground transition-colors group-hover:text-foreground"}):s.jsx(Fr,{className:"h-4 w-4 text-muted-foreground transition-colors group-hover:text-foreground"})]})})]})]}),s.jsx(iR,{project:e,isExpanded:n,sessions:c,selectedSession:r,initialSessionsLoaded:u,isLoadingSessions:d,currentTime:p,editingSession:h,editingSessionName:m,onEditingSessionNameChange:_,onStartEditingSession:P,onCancelEditingSession:N,onSaveEditingSession:z,onProjectSelect:y,onSessionSelect:R,onDeleteSession:T,onLoadMoreSessions:I,onNewSession:M,t:J})]})}function lR({isLoading:e,loadingProgress:t,projectsCount:r,filteredProjectsCount:n,t:a}){return e?s.jsxs("div",{className:"px-4 py-12 text-center md:py-8",children:[s.jsx("div",{className:"mx-auto mb-4 flex h-12 w-12 items-center justify-center rounded-lg bg-muted md:mb-3",children:s.jsx("div",{className:"h-6 w-6 animate-spin rounded-full border-2 border-muted-foreground border-t-transparent"})}),s.jsx("h3",{className:"mb-2 text-base font-medium text-foreground md:mb-1",children:a("projects.loadingProjects")}),t&&t.total>0?s.jsxs("div",{className:"space-y-2",children:[s.jsx("div",{className:"h-2 w-full overflow-hidden rounded-full bg-muted",children:s.jsx("div",{className:"h-full bg-primary transition-all duration-300 ease-out",style:{width:`${t.current/t.total*100}%`}})}),s.jsxs("p",{className:"text-sm text-muted-foreground",children:[t.current,"/",t.total," ",a("projects.projects")]}),t.currentProject&&s.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("/")})]}):s.jsx("p",{className:"text-sm text-muted-foreground",children:a("projects.fetchingProjects")})]}):r===0?s.jsxs("div",{className:"px-4 py-12 text-center md:py-8",children:[s.jsx("div",{className:"mx-auto mb-4 flex h-12 w-12 items-center justify-center rounded-lg bg-muted md:mb-3",children:s.jsx(Br,{className:"h-6 w-6 text-muted-foreground"})}),s.jsx("h3",{className:"mb-2 text-base font-medium text-foreground md:mb-1",children:a("projects.noProjects")}),s.jsx("p",{className:"text-sm text-muted-foreground",children:a("projects.runClaudeCli")})]}):n===0?s.jsxs("div",{className:"px-4 py-12 text-center md:py-8",children:[s.jsx("div",{className:"mx-auto mb-4 flex h-12 w-12 items-center justify-center rounded-lg bg-muted md:mb-3",children:s.jsx(On,{className:"h-6 w-6 text-muted-foreground"})}),s.jsx("h3",{className:"mb-2 text-base font-medium text-foreground md:mb-1",children:a("projects.noMatchingProjects")}),s.jsx("p",{className:"text-sm text-muted-foreground",children:a("projects.tryDifferentSearch")})]}):null}function cR({projects:e,filteredProjects:t,selectedProject:r,selectedSession:n,isLoading:a,loadingProgress:i,expandedProjects:o,editingProject:l,editingName:c,loadingSessions:u,initialSessionsLoaded:d,currentTime:p,editingSession:h,editingSessionName:m,deletingProjects:f,tasksEnabled:g,mcpServerStatus:v,getProjectSessions:x,isProjectStarred:y,onEditingNameChange:w,onToggleProject:S,onProjectSelect:E,onToggleStarProject:k,onStartEditingProject:C,onCancelEditingProject:R,onSaveProjectName:T,onDeleteProject:I,onSessionSelect:M,onDeleteSession:_,onLoadMoreSessions:P,onNewSession:N,onEditingSessionNameChange:z,onStartEditingSession:J,onCancelEditingSession:H,onSaveEditingSession:K,t:q}){const L=s.jsx(lR,{isLoading:a,loadingProgress:i,projectsCount:e.length,filteredProjectsCount:t.length,t:q});b.useEffect(()=>{let B="CloudCLI UI";const O=r?.displayName?.trim();O&&(B=`${O} - ${B}`),document.title=B},[r]);const W=!a&&e.length>0&&t.length>0;return s.jsx("div",{className:"pb-safe-area-inset-bottom md:space-y-1",children:W?t.map(B=>s.jsx(oR,{project:B,selectedProject:r,selectedSession:n,isExpanded:o.has(B.name),isDeleting:f.has(B.name),isStarred:y(B.name),editingProject:l,editingName:c,sessions:x(B),initialSessionsLoaded:d.has(B.name),isLoadingSessions:!!u[B.name],currentTime:p,editingSession:h,editingSessionName:m,tasksEnabled:g,mcpServerStatus:v,onEditingNameChange:w,onToggleProject:S,onProjectSelect:E,onToggleStarProject:k,onStartEditingProject:C,onCancelEditingProject:R,onSaveProjectName:T,onDeleteProject:I,onSessionSelect:M,onDeleteSession:_,onLoadMoreSessions:P,onNewSession:N,onEditingSessionNameChange:z,onStartEditingSession:J,onCancelEditingSession:H,onSaveEditingSession:K,t:q},B.name)):L})}function uR({snippet:e,highlights:t}){const r=[];let n=0;for(const a of t)a.start>n&&r.push(e.slice(n,a.start)),r.push(s.jsx("mark",{className:"rounded-sm bg-yellow-200 px-0.5 text-foreground dark:bg-yellow-800",children:e.slice(a.start,a.end)},a.start)),n=a.end;return n<e.length&&r.push(e.slice(n)),s.jsx("span",{className:"text-xs leading-relaxed text-muted-foreground",children:r})}function dR({isPWA:e,isMobile:t,isLoading:r,projects:n,searchFilter:a,onSearchFilterChange:i,onClearSearchFilter:o,searchMode:l,onSearchModeChange:c,conversationResults:u,isSearching:d,searchProgress:p,onConversationResultClick:h,onRefresh:m,isRefreshing:f,onCreateProject:g,onCollapseSidebar:v,updateAvailable:x,releaseInfo:y,latestVersion:w,currentVersion:S,onShowVersionModal:E,onShowSettings:k,projectListProps:C,t:R}){const T=l==="conversations"&&a.trim().length>=2,I=u&&u.results.length>0;return s.jsxs("div",{className:"flex h-full flex-col bg-background/80 backdrop-blur-sm md:w-72 md:select-none",style:{},children:[s.jsx(Q8,{isPWA:e,isMobile:t,isLoading:r,projectsCount:n.length,searchFilter:a,onSearchFilterChange:i,onClearSearchFilter:o,searchMode:l,onSearchModeChange:c,onRefresh:m,isRefreshing:f,onCreateProject:g,onCollapseSidebar:v,t:R}),s.jsx(uf,{className:"flex-1 overflow-y-auto overscroll-contain md:px-1.5 md:py-2",children:T?d&&!I?s.jsxs("div",{className:"px-4 py-12 text-center md:py-8",children:[s.jsx("div",{className:"mx-auto mb-4 flex h-12 w-12 items-center justify-center rounded-lg bg-muted md:mb-3",children:s.jsx("div",{className:"h-6 w-6 animate-spin rounded-full border-2 border-muted-foreground border-t-transparent"})}),s.jsx("p",{className:"text-sm text-muted-foreground",children:R("search.searching")}),p&&s.jsxs("p",{className:"mt-1 text-xs text-muted-foreground/60",children:[R("search.projectsScanned",{count:p.scannedProjects}),"/",p.totalProjects]})]}):!d&&u&&u.results.length===0?s.jsxs("div",{className:"px-4 py-12 text-center md:py-8",children:[s.jsx("div",{className:"mx-auto mb-4 flex h-12 w-12 items-center justify-center rounded-lg bg-muted md:mb-3",children:s.jsx(On,{className:"h-6 w-6 text-muted-foreground"})}),s.jsx("h3",{className:"mb-2 text-base font-medium text-foreground md:mb-1",children:R("search.noResults")}),s.jsx("p",{className:"text-sm text-muted-foreground",children:R("search.tryDifferentQuery")})]}):I?s.jsxs("div",{className:"space-y-3 px-2",children:[s.jsxs("div",{className:"flex items-center justify-between px-1",children:[s.jsx("p",{className:"text-xs text-muted-foreground",children:R("search.matches",{count:u.totalMatches})}),d&&p&&s.jsxs("div",{className:"flex items-center gap-1.5",children:[s.jsx("div",{className:"h-3 w-3 animate-spin rounded-full border-[1.5px] border-muted-foreground/40 border-t-primary"}),s.jsxs("p",{className:"text-[10px] text-muted-foreground/60",children:[p.scannedProjects,"/",p.totalProjects]})]})]}),d&&p&&s.jsx("div",{className:"mx-1 h-0.5 overflow-hidden rounded-full bg-muted",children:s.jsx("div",{className:"h-full rounded-full bg-primary/60 transition-all duration-300",style:{width:`${Math.round(p.scannedProjects/p.totalProjects*100)}%`}})}),u.results.map(M=>s.jsxs("div",{className:"space-y-1",children:[s.jsxs("div",{className:"flex items-center gap-1.5 px-1 py-1",children:[s.jsx(Br,{className:"h-3 w-3 flex-shrink-0 text-muted-foreground"}),s.jsx("span",{className:"truncate text-xs font-medium text-foreground",children:M.projectDisplayName})]}),M.sessions.map(_=>s.jsxs("button",{className:"w-full rounded-md px-2 py-2 text-left transition-colors hover:bg-accent/50",onClick:()=>h(M.projectName,_.sessionId,_.provider||_.matches[0]?.provider||"claude",_.matches[0]?.timestamp,_.matches[0]?.snippet),children:[s.jsxs("div",{className:"mb-1 flex items-center gap-1.5",children:[s.jsx(aa,{className:"h-3 w-3 flex-shrink-0 text-primary"}),s.jsx("span",{className:"truncate text-xs font-medium text-foreground",children:_.sessionSummary}),_.provider&&_.provider!=="claude"&&s.jsx("span",{className:"flex-shrink-0 rounded bg-muted px-1 py-0.5 text-[9px] uppercase text-muted-foreground",children:_.provider})]}),s.jsx("div",{className:"space-y-1 pl-4",children:_.matches.map((P,N)=>s.jsxs("div",{className:"flex items-start gap-1",children:[s.jsx("span",{className:"mt-0.5 flex-shrink-0 text-[10px] font-medium uppercase text-muted-foreground/60",children:P.role==="user"?"U":"A"}),s.jsx(uR,{snippet:P.snippet,highlights:P.highlights})]},N))})]},`${M.projectName}-${_.sessionId}`))]},M.projectName))]}):null:s.jsx(cR,{...C})}),s.jsx(V8,{updateAvailable:x,releaseInfo:y,latestVersion:w,currentVersion:S,onShowVersionModal:E,onShowSettings:k,t:R})]})}const pR={fontSize:"14"},os={authenticated:!1,email:null,loading:!0,error:null},xb={name:"",type:"stdio",scope:"user",projectPath:"",config:{command:"",args:[],env:{},url:"",headers:{},timeout:3e4},importMode:"form",jsonInput:""},yb={name:"",type:"stdio",config:{command:"",args:[],env:{}}},mR={allowedCommands:[],disallowedCommands:[],skipPermissions:!1},hR={claude:"/api/cli/claude/status",cursor:"/api/cli/cursor/status",codex:"/api/cli/codex/status",gemini:"/api/cli/gemini/status"},OE=e=>e==="sse"||e==="http"?e:"stdio",fR=e=>e==="local"?"local":"user",gR=e=>e instanceof Error?e.message:"Unknown error",bR=e=>({name:e.name||"",type:OE(e.type),scope:fR(e.scope),projectPath:e.projectPath||"",config:{command:e.config?.command||"",args:e.config?.args||[],env:e.config?.env||{},url:e.config?.url||"",headers:e.config?.headers||{},timeout:e.config?.timeout||3e4},importMode:"form",jsonInput:"",raw:e.raw});function xR({isOpen:e,editingServer:t,projects:r,onClose:n,onSubmit:a}){const{t:i}=Le("settings"),[o,l]=b.useState(xb),[c,u]=b.useState(""),[d,p]=b.useState(!1),h=!!t;b.useEffect(()=>{if(e){if(u(""),t){l(bR(t));return}l(xb)}},[t,e]);const m=b.useMemo(()=>o.name.trim()?o.importMode==="json"?!!o.jsonInput.trim()&&!c:o.scope==="local"&&!o.projectPath.trim()?!1:o.type==="stdio"?!!o.config.command.trim():!!o.config.url.trim():!1,[o,c]);if(!e)return null;const f=(x,y)=>{l(w=>({...w,config:{...w.config,[x]:y}}))},g=x=>{if(!x.trim()){u("");return}try{const y=JSON.parse(x);y.type?y.type==="stdio"&&!y.command?u(i("mcpForm.validation.stdioRequiresCommand")):(y.type==="http"||y.type==="sse")&&!y.url?u(i("mcpForm.validation.httpRequiresUrl",{type:y.type})):u(""):u(i("mcpForm.validation.missingType"))}catch{u(i("mcpForm.validation.invalidJson"))}},v=async x=>{x.preventDefault(),p(!0);try{await a(o,t)}catch(y){alert(`Error: ${gR(y)}`)}finally{p(!1)}};return s.jsx("div",{className:"fixed inset-0 z-[110] flex items-center justify-center bg-black/50 p-4",children:s.jsxs("div",{className:"max-h-[90vh] w-full max-w-2xl overflow-y-auto rounded-lg border border-border bg-background",children:[s.jsxs("div",{className:"flex items-center justify-between border-b border-border p-4",children:[s.jsx("h3",{className:"text-lg font-medium text-foreground",children:i(h?"mcpForm.title.edit":"mcpForm.title.add")}),s.jsx(Be,{variant:"ghost",size:"sm",onClick:n,children:s.jsx(kt,{className:"h-4 w-4"})})]}),s.jsxs("form",{onSubmit:v,className:"space-y-4 p-4",children:[!h&&s.jsxs("div",{className:"mb-4 flex gap-2",children:[s.jsx("button",{type:"button",onClick:()=>l(x=>({...x,importMode:"form"})),className:`rounded-lg px-4 py-2 font-medium transition-colors ${o.importMode==="form"?"bg-blue-600 text-white":"bg-gray-100 text-gray-700 hover:bg-gray-200 dark:bg-gray-800 dark:text-gray-300 dark:hover:bg-gray-700"}`,children:i("mcpForm.importMode.form")}),s.jsx("button",{type:"button",onClick:()=>l(x=>({...x,importMode:"json"})),className:`rounded-lg px-4 py-2 font-medium transition-colors ${o.importMode==="json"?"bg-blue-600 text-white":"bg-gray-100 text-gray-700 hover:bg-gray-200 dark:bg-gray-800 dark:text-gray-300 dark:hover:bg-gray-700"}`,children:i("mcpForm.importMode.json")})]}),o.importMode==="form"&&h&&s.jsxs("div",{className:"rounded-lg border border-gray-200 bg-gray-50 p-3 dark:border-gray-700 dark:bg-gray-900/50",children:[s.jsx("label",{className:"mb-2 block text-sm font-medium text-foreground",children:i("mcpForm.scope.label")}),s.jsxs("div",{className:"flex items-center gap-2",children:[o.scope==="user"?s.jsx($a,{className:"h-4 w-4"}):s.jsx(Mn,{className:"h-4 w-4"}),s.jsx("span",{className:"text-sm",children:o.scope==="user"?i("mcpForm.scope.userGlobal"):i("mcpForm.scope.projectLocal")}),o.scope==="local"&&o.projectPath&&s.jsxs("span",{className:"text-xs text-muted-foreground",children:["- ",o.projectPath]})]}),s.jsx("p",{className:"mt-2 text-xs text-muted-foreground",children:i("mcpForm.scope.cannotChange")})]}),o.importMode==="form"&&!h&&s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{children:[s.jsxs("label",{className:"mb-2 block text-sm font-medium text-foreground",children:[i("mcpForm.scope.label")," *"]}),s.jsxs("div",{className:"flex gap-2",children:[s.jsx("button",{type:"button",onClick:()=>l(x=>({...x,scope:"user",projectPath:""})),className:`flex-1 rounded-lg px-4 py-2 font-medium transition-colors ${o.scope==="user"?"bg-blue-600 text-white":"bg-gray-100 text-gray-700 hover:bg-gray-200 dark:bg-gray-800 dark:text-gray-300 dark:hover:bg-gray-700"}`,children:s.jsxs("div",{className:"flex items-center justify-center gap-2",children:[s.jsx($a,{className:"h-4 w-4"}),s.jsx("span",{children:i("mcpForm.scope.userGlobal")})]})}),s.jsx("button",{type:"button",onClick:()=>l(x=>({...x,scope:"local"})),className:`flex-1 rounded-lg px-4 py-2 font-medium transition-colors ${o.scope==="local"?"bg-blue-600 text-white":"bg-gray-100 text-gray-700 hover:bg-gray-200 dark:bg-gray-800 dark:text-gray-300 dark:hover:bg-gray-700"}`,children:s.jsxs("div",{className:"flex items-center justify-center gap-2",children:[s.jsx(Mn,{className:"h-4 w-4"}),s.jsx("span",{children:i("mcpForm.scope.projectLocal")})]})})]}),s.jsx("p",{className:"mt-2 text-xs text-muted-foreground",children:o.scope==="user"?i("mcpForm.scope.userDescription"):i("mcpForm.scope.projectDescription")})]}),o.scope==="local"&&s.jsxs("div",{children:[s.jsxs("label",{className:"mb-2 block text-sm font-medium text-foreground",children:[i("mcpForm.fields.selectProject")," *"]}),s.jsxs("select",{value:o.projectPath,onChange:x=>{l(y=>({...y,projectPath:x.target.value}))},className:"w-full rounded-lg border border-gray-300 bg-gray-50 px-3 py-2 text-gray-900 focus:border-blue-500 focus:ring-blue-500 dark:border-gray-600 dark:bg-gray-800 dark:text-gray-100",required:!0,children:[s.jsxs("option",{value:"",children:[i("mcpForm.fields.selectProject"),"..."]}),r.map(x=>s.jsx("option",{value:x.path||x.fullPath,children:x.displayName||x.name},x.name))]}),o.projectPath&&s.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:i("mcpForm.projectPath",{path:o.projectPath})})]})]}),s.jsxs("div",{className:"grid grid-cols-1 gap-4 md:grid-cols-2",children:[s.jsxs("div",{className:o.importMode==="json"?"md:col-span-2":"",children:[s.jsxs("label",{className:"mb-2 block text-sm font-medium text-foreground",children:[i("mcpForm.fields.serverName")," *"]}),s.jsx(At,{value:o.name,onChange:x=>l(y=>({...y,name:x.target.value})),placeholder:i("mcpForm.placeholders.serverName"),required:!0})]}),o.importMode==="form"&&s.jsxs("div",{children:[s.jsxs("label",{className:"mb-2 block text-sm font-medium text-foreground",children:[i("mcpForm.fields.transportType")," *"]}),s.jsxs("select",{value:o.type,onChange:x=>{l(y=>({...y,type:OE(x.target.value)}))},className:"w-full rounded-lg border border-gray-300 bg-gray-50 px-3 py-2 text-gray-900 focus:border-blue-500 focus:ring-blue-500 dark:border-gray-600 dark:bg-gray-800 dark:text-gray-100",children:[s.jsx("option",{value:"stdio",children:"stdio"}),s.jsx("option",{value:"sse",children:"SSE"}),s.jsx("option",{value:"http",children:"HTTP"})]})]})]}),h&&!!o.raw&&o.importMode==="form"&&s.jsxs("div",{className:"rounded-lg border border-gray-200 bg-gray-50 p-4 dark:border-gray-700 dark:bg-gray-900/50",children:[s.jsx("h4",{className:"mb-2 text-sm font-medium text-foreground",children:i("mcpForm.configDetails",{configFile:t?.scope==="global"?"~/.claude.json":"project config"})}),s.jsx("pre",{className:"overflow-x-auto rounded bg-gray-100 p-3 text-xs dark:bg-gray-800",children:JSON.stringify(o.raw,null,2)})]}),o.importMode==="json"&&s.jsx("div",{className:"space-y-4",children:s.jsxs("div",{children:[s.jsxs("label",{className:"mb-2 block text-sm font-medium text-foreground",children:[i("mcpForm.fields.jsonConfig")," *"]}),s.jsx("textarea",{value:o.jsonInput,onChange:x=>{const y=x.target.value;l(w=>({...w,jsonInput:y})),g(y)},className:`w-full border px-3 py-2 ${c?"border-red-500":"border-gray-300 dark:border-gray-600"} rounded-lg bg-gray-50 font-mono text-sm text-gray-900 focus:border-blue-500 focus:ring-blue-500 dark:bg-gray-800 dark:text-gray-100`,rows:8,placeholder:`{
669
+ `;function XI(){if(typeof document>"u"||document.getElementById(Kg))return;const e=document.createElement("style");e.id=Kg,e.type="text/css",e.innerText=ZI,document.head.appendChild(e)}function JI({terminalContainerRef:e,terminalRef:t,fitAddonRef:r,wsRef:n,selectedProject:a,minimal:i,isRestarting:o,initialCommandRef:l,isPlainShellRef:c,authUrlRef:u,copyAuthUrlToClipboard:d,closeSocket:p}){const[h,m]=b.useState(!1),f=b.useRef(null),g=a?.fullPath||a?.path||"",v=!!a;b.useEffect(()=>{XI()},[]);const x=b.useCallback(()=>{t.current&&(t.current.clear(),t.current.write("\x1B[2J\x1B[H"))},[t]),y=b.useCallback(()=>{t.current&&(t.current.dispose(),t.current=null),r.current=null,m(!1)},[r,t]);return b.useEffect(()=>{if(!e.current||!v||o||t.current)return;const w=new VI.Terminal(LI);t.current=w;const S=new qI.FitAddon;r.current=S,w.loadAddon(S),i||w.loadAddon(new HI.WebLinksAddon);try{w.loadAddon(new WI.WebglAddon)}catch{console.warn("[Shell] WebGL renderer unavailable, using Canvas fallback")}w.open(e.current);const E=async()=>{const T=w.getSelection();return T?Jr(T):!1},k=T=>{if(!w.hasSelection())return;const I=w.getSelection();if(I){if(T.preventDefault(),T.clipboardData){T.clipboardData.setData("text/plain",I);return}Jr(I)}};e.current.addEventListener("copy",k),w.attachCustomKeyEventHandler(T=>{const I=cE(l.current)?oE:u.current;return T.type==="keydown"&&i&&c.current&&I&&!T.ctrlKey&&!T.metaKey&&!T.altKey&&T.key?.toLowerCase()==="c"?(T.preventDefault(),T.stopPropagation(),d(I),!1):T.type==="keydown"&&(T.ctrlKey||T.metaKey)&&T.key?.toLowerCase()==="c"&&w.hasSelection()?(T.preventDefault(),T.stopPropagation(),E(),!1):T.type==="keydown"&&(T.ctrlKey||T.metaKey)&&T.key?.toLowerCase()==="v"?(T.preventDefault(),T.stopPropagation(),typeof navigator<"u"&&navigator.clipboard?.readText&&navigator.clipboard.readText().then(M=>{Qn(n.current,{type:"input",data:M})}).catch(()=>{}),!1):!0}),window.setTimeout(()=>{const T=r.current,I=t.current;!T||!I||(T.fit(),Qn(n.current,{type:"resize",cols:I.cols,rows:I.rows}))},lE),m(!0);const C=w.onData(T=>{Qn(n.current,{type:"input",data:T})}),R=new ResizeObserver(()=>{f.current!==null&&window.clearTimeout(f.current),f.current=window.setTimeout(()=>{const T=r.current,I=t.current;!T||!I||(T.fit(),Qn(n.current,{type:"resize",cols:I.cols,rows:I.rows}))},_I)});return R.observe(e.current),()=>{e.current?.removeEventListener("copy",k),R.disconnect(),f.current!==null&&(window.clearTimeout(f.current),f.current=null),C.dispose(),p(),y()}},[u,p,d,y,r,l,c,o,i,v,g,e,t,n]),{isInitialized:h,clearTerminalScreen:x,disposeTerminal:y}}function QI({selectedProject:e,selectedSession:t,initialCommand:r,isPlainShell:n,minimal:a,autoConnect:i,isRestarting:o,onProcessComplete:l,onOutputRef:c}){const u=b.useRef(null),d=b.useRef(null),p=b.useRef(null),h=b.useRef(null),[m,f]=b.useState(""),[g,v]=b.useState(0),x=b.useRef(e),y=b.useRef(t),w=b.useRef(r),S=b.useRef(n),E=b.useRef(l),k=b.useRef(""),C=b.useRef(t?.id??null);b.useEffect(()=>{x.current=e,y.current=t,w.current=r,S.current=n,E.current=l},[e,t,r,n,l]);const R=b.useCallback(q=>{k.current=q,f(q),v(L=>L+1)},[]),T=b.useCallback(()=>{const q=h.current;q&&((q.readyState===WebSocket.OPEN||q.readyState===WebSocket.CONNECTING)&&q.close(),h.current=null)},[]),I=b.useCallback((q=k.current)=>{if(!q)return!1;const L=window.open(q,"_blank");if(L){try{L.opener=null}catch{}return!0}return!1},[]),M=b.useCallback(async(q=k.current)=>q?Jr(q):!1,[]),{isInitialized:_,clearTerminalScreen:P,disposeTerminal:N}=JI({terminalContainerRef:u,terminalRef:d,fitAddonRef:p,wsRef:h,selectedProject:e,minimal:a,isRestarting:o,initialCommandRef:w,isPlainShellRef:S,authUrlRef:k,copyAuthUrlToClipboard:M,closeSocket:T}),{isConnected:z,isConnecting:J,connectToShell:H,disconnectFromShell:K}=UI({wsRef:h,terminalRef:d,fitAddonRef:p,selectedProjectRef:x,selectedSessionRef:y,initialCommandRef:w,isPlainShellRef:S,onProcessCompleteRef:E,isInitialized:_,autoConnect:i,closeSocket:T,clearTerminalScreen:P,setAuthUrl:R,onOutputRef:c});return b.useEffect(()=>{o&&(K(),N())},[K,N,o]),b.useEffect(()=>{e||(K(),N())},[K,N,e]),b.useEffect(()=>{const q=t?.id??null;C.current!==q&&_&&K(),C.current=q},[K,_,t?.id]),{terminalContainerRef:u,terminalRef:d,wsRef:h,isConnected:z,isInitialized:_,isConnecting:J,authUrl:m,authUrlVersion:g,connectToShell:H,disconnectFromShell:K,openAuthUrlInBrowser:I,copyAuthUrlToClipboard:M}}function e_({mode:e,description:t,loadingLabel:r,connectLabel:n,connectTitle:a,connectingLabel:i,onConnect:o}){return e==="loading"?s.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-gray-900 bg-opacity-90",children:s.jsx("div",{className:"text-white",children:r})}):e==="connect"?s.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-gray-900 bg-opacity-90 p-4",children:s.jsxs("div",{className:"w-full max-w-sm text-center",children:[s.jsxs("button",{onClick:o,className:"flex w-full items-center justify-center space-x-2 rounded-lg bg-green-600 px-6 py-3 text-base font-medium text-white transition-colors hover:bg-green-700 sm:w-auto",title:a,children:[s.jsx("svg",{className:"h-5 w-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M13 10V3L4 14h7v7l9-11h-7z"})}),s.jsx("span",{children:n})]}),s.jsx("p",{className:"mt-3 px-2 text-sm text-gray-400",children:t})]})}):s.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-gray-900 bg-opacity-90 p-4",children:s.jsxs("div",{className:"w-full max-w-sm text-center",children:[s.jsxs("div",{className:"flex items-center justify-center space-x-3 text-yellow-400",children:[s.jsx("div",{className:"h-6 w-6 animate-spin rounded-full border-2 border-yellow-400 border-t-transparent"}),s.jsx("span",{className:"text-base font-medium",children:i})]}),s.jsx("p",{className:"mt-3 px-2 text-sm text-gray-400",children:t})]})})}function t_({title:e,description:t}){return s.jsx("div",{className:"flex h-full items-center justify-center",children:s.jsxs("div",{className:"text-center text-gray-500 dark:text-gray-400",children:[s.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:s.jsx("svg",{className:"h-8 w-8 text-gray-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:s.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 00-2 2v14a2 2 0 002 2z"})})}),s.jsx("h3",{className:"mb-2 text-lg font-semibold",children:e}),s.jsx("p",{children:t})]})})}function r_({isConnected:e,isInitialized:t,isRestarting:r,hasSession:n,sessionDisplayNameShort:a,onDisconnect:i,onRestart:o,statusNewSessionText:l,statusInitializingText:c,statusRestartingText:u,disconnectLabel:d,disconnectTitle:p,restartLabel:h,restartTitle:m,disableRestart:f}){return s.jsx("div",{className:"flex-shrink-0 border-b border-gray-700 bg-gray-800 px-4 py-2",children:s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("div",{className:"flex items-center space-x-2",children:[s.jsx("div",{className:`h-2 w-2 rounded-full ${e?"bg-green-500":"bg-red-500"}`}),n&&a&&s.jsxs("span",{className:"text-xs text-blue-300",children:["(",a,"...)"]}),!n&&s.jsx("span",{className:"text-xs text-gray-400",children:l}),!t&&s.jsx("span",{className:"text-xs text-yellow-400",children:c}),r&&s.jsx("span",{className:"text-xs text-blue-400",children:u})]}),s.jsxs("div",{className:"flex items-center space-x-3",children:[e&&s.jsxs("button",{onClick:i,className:"flex items-center space-x-1 rounded bg-red-600 px-3 py-1 text-xs text-white hover:bg-red-700",title:p,children:[s.jsx("svg",{className:"h-3 w-3",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})}),s.jsx("span",{children:d})]}),s.jsxs("button",{onClick:o,disabled:f,className:"flex items-center space-x-1 text-xs text-gray-400 hover:text-white disabled:cursor-not-allowed disabled:opacity-50",title:m,children:[s.jsx("svg",{className:"h-3 w-3",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"})}),s.jsx("span",{children:h})]})]})]})})}function n_({terminalContainerRef:e,authUrl:t,authUrlVersion:r,initialCommand:n,isConnected:a,openAuthUrlInBrowser:i,copyAuthUrlToClipboard:o}){const[l,c]=b.useState("idle"),[u,d]=b.useState(!1),p=b.useMemo(()=>KI(n,t),[t,n]);b.useEffect(()=>{c("idle"),d(!1)},[r,p,a]);const h=!!p,m=h&&!u,f=h&&u;return s.jsxs("div",{className:"relative h-full w-full bg-gray-900",children:[s.jsx("div",{ref:e,className:"h-full w-full focus:outline-none",style:{outline:"none"}}),m&&s.jsx("div",{className:"absolute inset-x-0 bottom-14 z-20 border-t border-gray-700/80 bg-gray-900/95 p-3 backdrop-blur-sm md:hidden",children:s.jsxs("div",{className:"flex flex-col gap-2",children:[s.jsxs("div",{className:"flex items-center justify-between gap-2",children:[s.jsx("p",{className:"text-xs text-gray-300",children:"Open or copy the login URL:"}),s.jsx("button",{type:"button",onClick:()=>d(!0),className:"rounded bg-gray-700 px-2 py-1 text-[10px] font-medium uppercase tracking-wide text-gray-100 hover:bg-gray-600",children:"Hide"})]}),s.jsx("input",{type:"text",value:p,readOnly:!0,onClick:g=>g.currentTarget.select(),className:"w-full rounded border border-gray-600 bg-gray-800 px-2 py-1 text-xs text-gray-100 focus:outline-none focus:ring-1 focus:ring-blue-500","aria-label":"Authentication URL"}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("button",{type:"button",onClick:()=>{i(p)},className:"flex-1 rounded bg-blue-600 px-3 py-2 text-xs font-medium text-white hover:bg-blue-700",children:"Open URL"}),s.jsx("button",{type:"button",onClick:async()=>{const g=await o(p);c(g?"copied":"failed")},className:"flex-1 rounded bg-gray-700 px-3 py-2 text-xs font-medium text-white hover:bg-gray-600",children:l==="copied"?"Copied":"Copy URL"})]})]})}),f&&s.jsx("div",{className:"absolute bottom-14 right-3 z-20 md:hidden",children:s.jsx("button",{type:"button",onClick:()=>d(!1),className:"rounded bg-gray-800/95 px-3 py-2 text-xs font-medium text-gray-100 shadow-lg backdrop-blur-sm hover:bg-gray-700",children:"Show login URL"})})]})}const a_=[{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"}],i_={up:K4,down:Xh,left:IA,right:Jh},ui=e=>e.preventDefault(),Yg="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",s_="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",rl="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 Zg({wsRef:e,terminalRef:t,isConnected:r,bottomOffset:n="bottom-0"}){const{t:a}=Le("settings"),[i,o]=b.useState(!1),[l,c]=b.useState(!1),u=b.useCallback(m=>{Qn(e.current,{type:"input",data:m})},[e]),d=b.useCallback(()=>{t.current?.scrollToBottom()},[t]),p=b.useCallback(async()=>{if(!(typeof navigator>"u"||!navigator.clipboard?.readText))try{const m=await navigator.clipboard.readText();m.length>0&&u(m)}catch{}},[u]),h=b.useCallback(m=>{let f=m;if(i&&m.length===1){const g=m.toLowerCase().charCodeAt(0);g>=97&&g<=122&&(f=String.fromCharCode(g-96)),o(!1)}l&&m.length===1&&(f="\x1B"+f,c(!1)),u(f)},[i,l,u]);return s.jsx("div",{className:`pointer-events-none fixed inset-x-0 ${n} z-20 px-2 md:hidden`,children:s.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:[s.jsx("button",{type:"button",onPointerDown:ui,onClick:()=>{p()},disabled:!r,className:rl,title:a("terminalShortcuts.paste",{defaultValue:"Paste"}),"aria-label":a("terminalShortcuts.paste",{defaultValue:"Paste"}),children:s.jsx(g6,{className:"h-4 w-4"})}),a_.map(m=>{if(m.type==="modifier"){const f=m.modifier==="ctrl"?i:l,g=m.modifier==="ctrl"?()=>o(v=>!v):()=>c(v=>!v);return s.jsx("button",{type:"button",onPointerDown:ui,onClick:g,disabled:!r,className:f?s_:Yg,children:m.label},m.id)}if(m.type==="arrow"){const f=i_[m.icon];return s.jsx("button",{type:"button",onPointerDown:ui,onClick:()=>u(m.sequence),disabled:!r,className:rl,children:s.jsx(f,{className:"h-4 w-4"})},m.id)}return s.jsx("button",{type:"button",onPointerDown:ui,onClick:()=>h(m.sequence),disabled:!r,className:Yg,children:m.label},m.id)}),s.jsx("button",{type:"button",onPointerDown:ui,onClick:d,disabled:!r,className:rl,title:a("terminalShortcuts.scrollDown"),"aria-label":a("terminalShortcuts.scrollDown"),children:s.jsx(CA,{className:"h-4 w-4"})})]})})}function uE({selectedProject:e=null,selectedSession:t=null,initialCommand:r=null,isPlainShell:n=!1,onProcessComplete:a=null,minimal:i=!1,autoConnect:o=!1,isActive:l=!0}){const{t:c}=Le("chat"),[u,d]=b.useState(!1),[p,h]=b.useState(null),m=b.useRef(null),f=b.useRef(null),{terminalContainerRef:g,terminalRef:v,wsRef:x,isConnected:y,isInitialized:w,isConnecting:S,authUrl:E,authUrlVersion:k,connectToShell:C,disconnectFromShell:R,openAuthUrlInBrowser:T,copyAuthUrlToClipboard:I}=QI({selectedProject:e,selectedSession:t,initialCommand:r,isPlainShell:n,minimal:i,autoConnect:o,isRestarting:u,onProcessComplete:a,onOutputRef:f}),M=b.useCallback(()=>{const B=v.current;if(!B)return;const O=B.buffer.active,ee=O.baseY+O.cursorY,te=Math.min(O.baseY+O.length-1,ee+10),ce=Math.max(0,ee-jI),ie=[];for(let Ie=ce;Ie<=te;Ie++){const Fe=O.getLine(Ie);Fe&&ie.push(Fe.translateToString().trimEnd())}let ge=-1;for(let Ie=ie.length-1;Ie>=0;Ie--)if(/esc to cancel/i.test(ie[Ie])||/enter to select/i.test(ie[Ie])){ge=Ie;break}if(ge===-1){h(null);return}const ye=new Map,Re=Math.max(0,ge-DI);for(let Ie=ge-1;Ie>=Re;Ie--){const Fe=ie[Ie].match(/^\s*[❯›>]?\s*(\d+)\.\s+(.+)/);if(Fe){const D=Fe[1],de=Fe[2].trim();parseInt(D,10)<=MI&&de.length>0&&!ye.has(D)&&ye.set(D,de)}}const Ee=[];for(let Ie=1;Ie<=ye.size&&ye.has(String(Ie));Ie++)Ee.push({number:String(Ie),label:ye.get(String(Ie))});h(Ee.length>=OI?Ee:null)},[v]),_=b.useCallback(()=>{m.current&&clearTimeout(m.current),m.current=setTimeout(M,RI)},[M]);b.useEffect(()=>{f.current=_},[_]),b.useEffect(()=>()=>{m.current&&clearTimeout(m.current)},[]),b.useEffect(()=>{y||(m.current&&(clearTimeout(m.current),m.current=null),h(null))},[y]),b.useEffect(()=>{if(!l||!w||!y)return;const B=()=>{v.current?.focus()},O=window.requestAnimationFrame(B),ee=window.setTimeout(B,0);return()=>{window.cancelAnimationFrame(O),window.clearTimeout(ee)}},[l,y,w,v]);const P=b.useCallback(B=>{Qn(x.current,{type:"input",data:B})},[x]),N=b.useMemo(()=>YI(t),[t]),z=b.useMemo(()=>N?N.slice(0,30):null,[N]),J=b.useMemo(()=>N?N.slice(0,50):null,[N]),H=b.useCallback(()=>{d(!0),window.setTimeout(()=>{d(!1)},II)},[]);if(!e)return s.jsx(t_,{title:c("shell.selectProject.title"),description:c("shell.selectProject.description")});if(i)return s.jsxs(s.Fragment,{children:[s.jsx(n_,{terminalContainerRef:g,authUrl:E,authUrlVersion:k,initialCommand:r,isConnected:y,openAuthUrlInBrowser:T,copyAuthUrlToClipboard:I}),s.jsx(Zg,{wsRef:x,terminalRef:v,isConnected:y,bottomOffset:"bottom-0"})]});const K=n?c("shell.runCommand",{command:r||c("shell.defaultCommand"),projectName:e.displayName}):t?c("shell.resumeSession",{displayName:J}):c("shell.startSession"),q=n?c("shell.runCommand",{command:r||c("shell.defaultCommand"),projectName:e.displayName}):c("shell.startCli",{projectName:e.displayName}),L=w?S?"connecting":y?null:"connect":"loading",W=L==="connecting"?q:K;return s.jsxs("div",{className:"flex h-full w-full flex-col bg-gray-900",children:[s.jsx(r_,{isConnected:y,isInitialized:w,isRestarting:u,hasSession:!!t,sessionDisplayNameShort:z,onDisconnect:R,onRestart:H,statusNewSessionText:c("shell.status.newSession"),statusInitializingText:c("shell.status.initializing"),statusRestartingText:c("shell.status.restarting"),disconnectLabel:c("shell.actions.disconnect"),disconnectTitle:c("shell.actions.disconnectTitle"),restartLabel:c("shell.actions.restart"),restartTitle:c("shell.actions.restartTitle"),disableRestart:u||y}),s.jsxs("div",{className:"relative flex-1 overflow-hidden p-2",children:[s.jsx("div",{ref:g,className:"h-full w-full focus:outline-none",style:{outline:"none"}}),L&&s.jsx(e_,{mode:L,description:W,loadingLabel:c("shell.loading"),connectLabel:c("shell.actions.connect"),connectTitle:c("shell.actions.connectTitle"),connectingLabel:c("shell.connecting"),onConnect:C}),p&&y&&s.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:B=>B.preventDefault(),children:s.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[p.map(B=>s.jsxs("button",{type:"button",onClick:()=>{P(B.number),h(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:`${B.number}. ${B.label}`,children:[B.number,". ",B.label]},B.number)),s.jsx("button",{type:"button",onClick:()=>{P("\x1B"),h(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"})]})})]}),s.jsx(Zg,{wsRef:x,terminalRef:v,isConnected:y})]})}function o_({className:e}){return s.jsx("div",{className:`flex h-full items-center justify-center ${e}`,children:s.jsxs("div",{className:"text-center text-gray-500 dark:text-gray-400",children:[s.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:s.jsx("svg",{className:"h-8 w-8 text-gray-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:s.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"})})}),s.jsx("h3",{className:"mb-2 text-lg font-semibold",children:"No Project Selected"}),s.jsx("p",{children:"A project is required to open a shell"})]})})}function l_({title:e,isCompleted:t,onClose:r=null}){return s.jsx("div",{className:"flex-shrink-0 border-b border-gray-700 bg-gray-800 px-4 py-2",children:s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("div",{className:"flex items-center space-x-2",children:[s.jsx("h3",{className:"text-sm font-medium text-gray-200",children:e}),t&&s.jsx("span",{className:"text-xs text-green-400",children:"(Completed)"})]}),r&&s.jsx("button",{onClick:r,className:"text-gray-400 hover:text-white",title:"Close",children:s.jsx("svg",{className:"h-4 w-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]})})}function dE({project:e=null,session:t=null,command:r=null,isPlainShell:n=null,isActive:a=!0,autoConnect:i=!0,onComplete:o=null,onClose:l=null,title:c=null,className:u="",showHeader:d=!0,compact:p=!1,minimal:h=!1}){const[m,f]=b.useState(!1),g=n!==null?n:r!==null,v=b.useCallback(x=>{f(!0),o?.(x)},[o]);return e?s.jsxs("div",{className:`flex h-full w-full flex-col ${u}`,children:[!h&&d&&c&&s.jsx(l_,{title:c,isCompleted:m,onClose:l}),s.jsx("div",{className:"min-h-0 w-full flex-1",children:s.jsx(uE,{selectedProject:e,selectedSession:t,initialCommand:r,isPlainShell:g,isActive:a,onProcessComplete:v,minimal:h,autoConnect:h?!0:i})})]}):s.jsx(o_,{className:u})}const c_=({provider:e,customCommand:t,isAuthenticated:r})=>t||(e==="claude"?"claude --dangerously-skip-permissions /login":e==="cursor"?"cursor-agent login":e==="codex"?"codex login":"gemini status"),u_=e=>e==="claude"?"Claude CLI Login":e==="cursor"?"Cursor CLI Login":e==="codex"?"Codex CLI Login":"Gemini CLI Configuration",d_=e=>{const t=e?.name||"default",r=e?.fullPath??e?.path??"";return{name:t,displayName:e?.displayName||t,fullPath:r,path:e?.path??r}};function pE({isOpen:e,onClose:t,provider:r="claude",project:n=null,onComplete:a,customCommand:i,isAuthenticated:o=!1}){if(!e)return null;const l=c_({provider:r,customCommand:i,isAuthenticated:o}),c=u_(r),u=d_(n),d=p=>{a?.(p)};return s.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:s.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:[s.jsxs("div",{className:"flex items-center justify-between border-b border-gray-200 p-4 dark:border-gray-700",children:[s.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white",children:c}),s.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:s.jsx(kt,{className:"h-6 w-6"})})]}),s.jsx("div",{className:"flex-1 overflow-hidden",children:r==="gemini"?s.jsxs("div",{className:"flex h-full flex-col items-center justify-center bg-gray-50 p-8 text-center dark:bg-gray-900/50",children:[s.jsx("div",{className:"mb-6 flex h-16 w-16 items-center justify-center rounded-full bg-blue-100 dark:bg-blue-900/30",children:s.jsx(p7,{className:"h-8 w-8 text-blue-600 dark:text-blue-400"})}),s.jsx("h4",{className:"mb-3 text-xl font-medium text-gray-900 dark:text-white",children:"Setup Gemini API Access"}),s.jsx("p",{className:"mb-8 max-w-md text-gray-600 dark:text-gray-400",children:"The Gemini CLI requires an API key to function. Configure it in your terminal first."}),s.jsx("div",{className:"w-full max-w-lg rounded-xl border border-gray-200 bg-white p-6 text-left shadow-sm dark:border-gray-700 dark:bg-gray-800",children:s.jsxs("ol",{className:"space-y-4",children:[s.jsxs("li",{className:"flex gap-4",children:[s.jsx("div",{className:"flex h-6 w-6 flex-shrink-0 items-center justify-center rounded-full bg-blue-100 text-sm font-medium text-blue-600 dark:bg-blue-900/50 dark:text-blue-400",children:"1"}),s.jsxs("div",{children:[s.jsx("p",{className:"mb-1 text-sm font-medium text-gray-900 dark:text-white",children:"Get your API key"}),s.jsxs("a",{href:"https://aistudio.google.com/app/apikey",target:"_blank",rel:"noreferrer",className:"flex inline-flex items-center gap-1 text-sm text-blue-600 hover:underline dark:text-blue-400",children:["Google AI Studio ",s.jsx(Vr,{className:"h-3 w-3"})]})]})]}),s.jsxs("li",{className:"flex gap-4",children:[s.jsx("div",{className:"flex h-6 w-6 flex-shrink-0 items-center justify-center rounded-full bg-blue-100 text-sm font-medium text-blue-600 dark:bg-blue-900/50 dark:text-blue-400",children:"2"}),s.jsxs("div",{children:[s.jsx("p",{className:"mb-1 text-sm font-medium text-gray-900 dark:text-white",children:"Run configuration"}),s.jsx("p",{className:"mb-2 text-sm text-gray-600 dark:text-gray-400",children:"Open your terminal and run:"}),s.jsx("code",{className:"block rounded bg-gray-100 px-3 py-2 font-mono text-sm text-pink-600 dark:bg-gray-900 dark:text-pink-400",children:"gemini config set api_key YOUR_KEY"})]})]})]})}),s.jsx("button",{onClick:t,className:"mt-8 rounded-lg bg-blue-600 px-6 py-2.5 font-medium text-white transition-colors hover:bg-blue-700",children:"Done"})]}):s.jsx(dE,{project:u,command:l,onComplete:d,minimal:!0})})]})})}const p_=({className:e="w-5 h-5"})=>s.jsx("img",{src:"/icons/claude-ai-icon.svg",alt:"Claude",className:e}),m_=({className:e="w-5 h-5"})=>{const{isDarkMode:t}=Ka();return s.jsx("img",{src:t?"/icons/codex-white.svg":"/icons/codex.svg",alt:"Codex",className:e})},h_=({className:e="w-5 h-5"})=>{const{isDarkMode:t}=Ka();return s.jsx("img",{src:t?"/icons/cursor-white.svg":"/icons/cursor.svg",alt:"Cursor",className:e})},f_=({className:e="w-5 h-5"})=>s.jsx("img",{src:"/icons/gemini-ai-icon.svg",alt:"Gemini",className:e});function Or({provider:e="claude",className:t="w-5 h-5"}){return e==="cursor"?s.jsx(h_,{className:t}):e==="codex"?s.jsx(m_,{className:t}):e==="gemini"?s.jsx(f_,{className:t}):s.jsx(p_,{className:t})}function g_({provider:e,title:t,status:r,connectedClassName:n,iconContainerClassName:a,loginButtonClassName:i,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 s.jsx("div",{className:`rounded-lg border p-4 transition-colors ${l}`,children:s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("div",{className:`flex h-10 w-10 items-center justify-center rounded-full ${a}`,children:s.jsx(Or,{provider:e,className:"h-5 w-5"})}),s.jsxs("div",{children:[s.jsxs("div",{className:"flex items-center gap-2 font-medium text-foreground",children:[t,r.authenticated&&s.jsx(Xt,{className:"h-4 w-4 text-green-500"})]}),s.jsx("div",{className:"text-xs text-muted-foreground",children:c})]})]}),!r.authenticated&&!r.loading&&s.jsx("button",{onClick:o,className:`${i} rounded-lg px-4 py-2 text-sm font-medium text-white transition-colors`,children:"Login"})]})})}const b_=[{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"}];function x_({providerStatuses:e,onOpenProviderLogin:t}){return s.jsxs("div",{className:"space-y-6",children:[s.jsxs("div",{className:"mb-6 text-center",children:[s.jsx("h2",{className:"mb-2 text-2xl font-bold text-foreground",children:"Connect Your AI Agents"}),s.jsx("p",{className:"text-muted-foreground",children:"Login to one or more AI coding assistants. All are optional."})]}),s.jsx("div",{className:"space-y-3",children:b_.map(r=>s.jsx(g_,{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))}),s.jsx("div",{className:"pt-2 text-center text-sm text-muted-foreground",children:s.jsx("p",{children:"You can configure these later in Settings."})})]})}function y_({gitName:e,gitEmail:t,isSubmitting:r,onGitNameChange:n,onGitEmailChange:a}){return s.jsxs("div",{className:"space-y-6",children:[s.jsxs("div",{className:"mb-8 text-center",children:[s.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:s.jsx(ir,{className:"h-8 w-8 text-blue-600 dark:text-blue-400"})}),s.jsx("h2",{className:"mb-2 text-2xl font-bold text-foreground",children:"Git Configuration"}),s.jsx("p",{className:"text-muted-foreground",children:"Configure your git identity to ensure proper attribution for commits."})]}),s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{children:[s.jsxs("label",{htmlFor:"gitName",className:"mb-2 flex items-center gap-2 text-sm font-medium text-foreground",children:[s.jsx(SI,{className:"h-4 w-4"}),"Git Name ",s.jsx("span",{className:"text-red-500",children:"*"})]}),s.jsx("input",{type:"text",id:"gitName",value:e,onChange:i=>n(i.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}),s.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:"Saved as `git config --global user.name`."})]}),s.jsxs("div",{children:[s.jsxs("label",{htmlFor:"gitEmail",className:"mb-2 flex items-center gap-2 text-sm font-medium text-foreground",children:[s.jsx(k7,{className:"h-4 w-4"}),"Git Email ",s.jsx("span",{className:"text-red-500",children:"*"})]}),s.jsx("input",{type:"email",id:"gitEmail",value:t,onChange:i=>a(i.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}),s.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:"Saved as `git config --global user.email`."})]})]})]})}const Xg=[{title:"Git Configuration",icon:ir,required:!0},{title:"Connect Agents",icon:tE,required:!1}];function v_({currentStep:e}){return s.jsx("div",{className:"mb-8",children:s.jsx("div",{className:"flex items-center justify-between",children:Xg.map((t,r)=>{const n=r<e,a=r===e,i=t.icon;return s.jsxs("div",{className:"contents",children:[s.jsxs("div",{className:"flex flex-1 flex-col items-center",children:[s.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?s.jsx(Xt,{className:"h-6 w-6"}):s.jsx(i,{className:"h-6 w-6"})}),s.jsxs("div",{className:"mt-2 text-center",children:[s.jsx("p",{className:`text-sm font-medium ${a?"text-foreground":"text-muted-foreground"}`,children:t.title}),t.required&&s.jsx("span",{className:"text-xs text-red-500",children:"Required"})]})]}),r<Xg.length-1&&s.jsx("div",{className:`mx-2 h-0.5 flex-1 transition-colors duration-200 ${n?"bg-green-500":"bg-border"}`})]},t.title)})})})}const w_=["claude","cursor","codex","gemini"],Jg=/^[^\s@]+@[^\s@]+\.[^\s@]+$/,k_={name:"default",displayName:"default",fullPath:"",path:""},S_=()=>({claude:{authenticated:!1,email:null,loading:!0,error:null},cursor:{authenticated:!1,email:null,loading:!0,error:null},codex:{authenticated:!1,email:null,loading:!0,error:null},gemini:{authenticated:!1,email:null,loading:!0,error:null}}),Qg=async(e,t)=>{try{return(await e.json()).error||t}catch{return t}};function E_({onComplete:e}){const[t,r]=b.useState(0),[n,a]=b.useState(""),[i,o]=b.useState(""),[l,c]=b.useState(!1),[u,d]=b.useState(""),[p,h]=b.useState(null),[m,f]=b.useState(S_),g=b.useRef(void 0),v=b.useCallback(async T=>{try{const I=await Ce(`/api/cli/${T}/status`);if(!I.ok){f(_=>({..._,[T]:{authenticated:!1,email:null,loading:!1,error:"Failed to check authentication status"}}));return}const M=await I.json();f(_=>({..._,[T]:{authenticated:!!M.authenticated,email:M.email??null,loading:!1,error:M.error??null}}))}catch(I){console.error(`Error checking ${T} auth status:`,I),f(M=>({...M,[T]:{authenticated:!1,email:null,loading:!1,error:I instanceof Error?I.message:"Unknown error"}}))}},[]),x=b.useCallback(async()=>{await Promise.all(w_.map(T=>v(T)))},[v]),y=b.useCallback(async()=>{try{const T=await Ce("/api/user/git-config");if(!T.ok)return;const I=await T.json();I.gitName&&a(I.gitName),I.gitEmail&&o(I.gitEmail)}catch(T){console.error("Error loading git config:",T)}},[]);b.useEffect(()=>{y(),x()},[y,x]),b.useEffect(()=>{const T=g.current;g.current=p,(T===void 0||T!==null&&p===null)&&x()},[p,x]);const w=T=>{h(T)},S=T=>{T===0&&p&&v(p)},E=async()=>{if(d(""),t!==0){r(T=>T+1);return}if(!n.trim()||!i.trim()){d("Both git name and email are required.");return}if(!Jg.test(i)){d("Please enter a valid email address.");return}c(!0);try{const T=await Ce("/api/user/git-config",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({gitName:n,gitEmail:i})});if(!T.ok){const I=await Qg(T,"Failed to save git configuration");throw new Error(I)}r(I=>I+1)}catch(T){d(T instanceof Error?T.message:"Failed to save git configuration")}finally{c(!1)}},k=()=>{d(""),r(T=>T-1)},C=async()=>{c(!0),d("");try{const T=await Ce("/api/user/complete-onboarding",{method:"POST"});if(!T.ok){const I=await Qg(T,"Failed to complete onboarding");throw new Error(I)}await e?.()}catch(T){d(T instanceof Error?T.message:"Failed to complete onboarding")}finally{c(!1)}},R=t===0?!!(n.trim()&&i.trim()&&Jg.test(i)):!0;return s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"flex min-h-screen items-center justify-center bg-background p-4",children:s.jsxs("div",{className:"w-full max-w-2xl",children:[s.jsx(v_,{currentStep:t}),s.jsxs("div",{className:"rounded-lg border border-border bg-card p-8 shadow-lg",children:[t===0?s.jsx(y_,{gitName:n,gitEmail:i,isSubmitting:l,onGitNameChange:a,onGitEmailChange:o}):s.jsx(x_,{providerStatuses:m,onOpenProviderLogin:w}),u&&s.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:s.jsx("p",{className:"text-sm text-red-700 dark:text-red-400",children:u})}),s.jsxs("div",{className:"mt-8 flex items-center justify-between border-t border-border pt-6",children:[s.jsxs("button",{onClick:k,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:[s.jsx(ef,{className:"h-4 w-4"}),"Previous"]}),s.jsx("div",{className:"flex items-center gap-3",children:t<1?s.jsx("button",{onClick:E,disabled:!R||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?s.jsxs(s.Fragment,{children:[s.jsx(Er,{className:"h-4 w-4 animate-spin"}),"Saving..."]}):s.jsxs(s.Fragment,{children:["Next",s.jsx(Fr,{className:"h-4 w-4"})]})}):s.jsx("button",{onClick:C,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?s.jsxs(s.Fragment,{children:[s.jsx(Er,{className:"h-4 w-4 animate-spin"}),"Completing..."]}):s.jsxs(s.Fragment,{children:[s.jsx(Xt,{className:"h-4 w-4"}),"Complete Setup"]})})})]})]})]})}),p&&s.jsx(pE,{isOpen:!!p,onClose:()=>h(null),provider:p,project:k_,onComplete:S})]})}const N_=["0s","0.1s","0.2s"];function C_(){return s.jsx("div",{className:"flex min-h-screen items-center justify-center bg-background p-4",children:s.jsxs("div",{className:"text-center",children:[s.jsx("div",{className:"mb-4 flex justify-center",children:s.jsx("div",{className:"flex h-16 w-16 items-center justify-center rounded-lg bg-primary shadow-sm",children:s.jsx(aa,{className:"h-8 w-8 text-primary-foreground"})})}),s.jsx("h1",{className:"mb-2 text-2xl font-bold text-foreground",children:"CloudCLI"}),s.jsx("div",{className:"flex items-center justify-center space-x-2",children:N_.map(e=>s.jsx("div",{className:"h-2 w-2 animate-bounce rounded-full bg-blue-500",style:{animationDelay:e}},e))}),s.jsx("p",{className:"mt-2 text-muted-foreground",children:"Loading..."})]})})}function mE({errorMessage:e}){return e?s.jsx("div",{className:"rounded-md border border-red-300 bg-red-100 p-3 dark:border-red-800 dark:bg-red-900/20",children:s.jsx("p",{className:"text-sm text-red-700 dark:text-red-400",children:e})}):null}function _i({id:e,label:t,value:r,onChange:n,placeholder:a,isDisabled:i,type:o="text",name:l,autoComplete:c}){return s.jsxs("div",{children:[s.jsx("label",{htmlFor:e,className:"mb-1 block text-sm font-medium text-foreground",children:t}),s.jsx("input",{id:e,type:o,name:l??e,autoComplete:c,value:r,onChange:u=>n(u.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:i})]})}function hE({title:e,description:t,children:r,footerText:n,logo:a}){return s.jsx("div",{className:"flex min-h-screen items-center justify-center bg-background p-4",children:s.jsx("div",{className:"w-full max-w-md",children:s.jsxs("div",{className:"space-y-6 rounded-lg border border-border bg-card p-8 shadow-lg",children:[s.jsxs("div",{className:"text-center",children:[s.jsx("div",{className:"mb-4 flex justify-center",children:a??s.jsx("div",{className:"flex h-16 w-16 items-center justify-center rounded-lg bg-primary shadow-sm",children:s.jsx(aa,{className:"h-8 w-8 text-primary-foreground"})})}),s.jsx("h1",{className:"text-2xl font-bold text-foreground",children:e}),s.jsx("p",{className:"mt-2 text-muted-foreground",children:t})]}),r,s.jsx("div",{className:"text-center",children:s.jsx("p",{className:"text-sm text-muted-foreground",children:n})}),s.jsxs("div",{className:"flex items-center justify-center gap-1.5 pt-2",children:[s.jsx("svg",{className:"h-3.5 w-3.5 text-muted-foreground/50",fill:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:s.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"})}),s.jsx("a",{href:"https://github.com/siteboon/claudecodeui",target:"_blank",rel:"noopener noreferrer",className:"text-xs text-muted-foreground/50 transition-colors hover:text-muted-foreground",children:"CloudCLI is open source"})]})]})})})}const T_={username:"",password:""};function A_(){const{t:e}=Le("auth"),{login:t}=Wi(),[r,n]=b.useState(T_),[a,i]=b.useState(""),[o,l]=b.useState(!1),c=b.useCallback((d,p)=>{n(h=>({...h,[d]:p}))},[]),u=b.useCallback(async d=>{if(d.preventDefault(),i(""),!r.username.trim()||!r.password){i(e("login.errors.requiredFields"));return}l(!0);const p=await t(r.username.trim(),r.password);p.success||i(p.error),l(!1)},[r.password,r.username,t,e]);return s.jsx(hE,{title:e("login.title"),description:e("login.description"),footerText:"Enter your credentials to access CloudCLI",children:s.jsxs("form",{onSubmit:u,className:"space-y-4",children:[s.jsx(_i,{id:"username",label:e("login.username"),value:r.username,onChange:d=>c("username",d),placeholder:e("login.placeholders.username"),isDisabled:o,autoComplete:"username"}),s.jsx(_i,{id:"password",label:e("login.password"),value:r.password,onChange:d=>c("password",d),placeholder:e("login.placeholders.password"),isDisabled:o,type:"password",autoComplete:"current-password"}),s.jsx(mE,{errorMessage:a}),s.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 I_={username:"",password:"",confirmPassword:""};function __(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.":null}function R_(){const{register:e}=Wi(),[t,r]=b.useState(I_),[n,a]=b.useState(""),[i,o]=b.useState(!1),l=b.useCallback((u,d)=>{r(p=>({...p,[u]:d}))},[]),c=b.useCallback(async u=>{u.preventDefault(),a("");const d=__(t);if(d){a(d);return}o(!0);const p=await e(t.username.trim(),t.password);p.success||a(p.error),o(!1)},[t,e]);return s.jsx(hE,{title:"Welcome to CloudCLI",description:"Set up your account to get started",footerText:"This is a single-user system. Only one account can be created.",logo:s.jsx("img",{src:"/logo.svg",alt:"CloudCLI",className:"h-16 w-16"}),children:s.jsxs("form",{onSubmit:c,className:"space-y-4",children:[s.jsx(_i,{id:"username",name:"username",label:"Username",value:t.username,onChange:u=>l("username",u),placeholder:"Enter your username",isDisabled:i,autoComplete:"username"}),s.jsx(_i,{id:"password",name:"password",label:"Password",value:t.password,onChange:u=>l("password",u),placeholder:"Enter your password",isDisabled:i,type:"password",autoComplete:"new-password"}),s.jsx(_i,{id:"confirmPassword",name:"confirmPassword",label:"Confirm Password",value:t.confirmPassword,onChange:u=>l("confirmPassword",u),placeholder:"Confirm your password",isDisabled:i,type:"password",autoComplete:"new-password"}),s.jsx(mE,{errorMessage:n}),s.jsx("button",{type:"submit",disabled:i,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:i?"Setting up...":"Create Account"})]})})}function j_({children:e}){const{user:t,isLoading:r,needsSetup:n,hasCompletedOnboarding:a,refreshOnboardingStatus:i}=Wi();return r?s.jsx(C_,{}):n?s.jsx(R_,{}):t?a?s.jsx(s.Fragment,{children:e}):s.jsx(E_,{onComplete:i}):s.jsx(A_,{})}const fE=b.createContext(null),gE=()=>{const e=b.useContext(fE);if(!e)throw new Error("useWebSocket must be used within a WebSocketProvider");return e},D_=e=>{const t=window.location.protocol==="https:"?"wss:":"ws:";return e?`${t}//${window.location.host}/ws?token=${encodeURIComponent(e)}`:null},M_=()=>{const e=b.useRef(null),t=b.useRef(!1),r=b.useRef(!1),[n,a]=b.useState(null),[i,o]=b.useState(!1),l=b.useRef(null),{token:c}=Wi();b.useEffect(()=>(u(),()=>{t.current=!0,l.current&&clearTimeout(l.current),e.current&&e.current.close()}),[c]);const u=b.useCallback(()=>{if(!t.current)try{const h=D_(c);if(!h)return console.warn("No authentication token found for WebSocket connection");const m=new WebSocket(h);m.onopen=()=>{o(!0),e.current=m,r.current&&a({type:"websocket-reconnected",timestamp:Date.now()}),r.current=!0},m.onmessage=f=>{try{const g=JSON.parse(f.data);a(g)}catch(g){console.error("Error parsing WebSocket message:",g)}},m.onclose=()=>{o(!1),e.current=null,l.current=setTimeout(()=>{t.current||u()},3e3)},m.onerror=f=>{console.error("WebSocket error:",f)}}catch(h){console.error("Error creating WebSocket connection:",h)}},[c]),d=b.useCallback(h=>{const m=e.current;m&&m.readyState===WebSocket.OPEN?m.send(JSON.stringify(h)):console.warn("WebSocket not connected")},[]);return b.useMemo(()=>({ws:e.current,sendMessage:d,latestMessage:n,isConnected:i}),[d,n,i])},O_=({children:e})=>{const t=M_();return s.jsx(fE.Provider,{value:t,children:e})},bE=b.createContext(null);function L_(e,t){return{message:t instanceof Error?t.message:`Failed to ${e}`,context:e,timestamp:new Date().toISOString()}}function eb(e){return{...e,taskMasterConfigured:e.taskmaster?.hasTaskmaster??!1,taskMasterStatus:e.taskmaster?.status??"not-configured",taskCount:Number(e.taskmaster?.metadata?.taskCount??0),completedCount:Number(e.taskmaster?.metadata?.completed??0)}}function P_(e){return e.find(t=>t.status==="pending"||t.status==="in-progress")??null}function F_(e){return e?.type?e.type.startsWith("taskmaster-"):!1}function Ya(){const e=b.useContext(bE);if(!e)throw new Error("useTaskMaster must be used within a TaskMasterProvider");return e}function B_({children:e}){const{latestMessage:t}=gE(),{user:r,token:n,isLoading:a}=Wi(),[i,o]=b.useState([]),[l,c]=b.useState(null),[u,d]=b.useState(null),[p,h]=b.useState(null),[m,f]=b.useState([]),[g,v]=b.useState(null),[x,y]=b.useState(!1),[w,S]=b.useState(!1),[E,k]=b.useState(!1),[C,R]=b.useState(null),T=b.useRef(null);b.useEffect(()=>{T.current=l?.name??null},[l?.name]);const I=b.useCallback(()=>{R(null)},[]),M=b.useCallback((H,K)=>{console.error(`TaskMaster ${H} error:`,K),R(L_(H,K))},[]),_=b.useCallback(H=>{const K=H?eb(H):null;c(K),d(K?.taskmaster??null),f([]),v(null)},[]),P=b.useCallback(async()=>{if(!r||!n){o([]),c(null),d(null),f([]),v(null);return}try{y(!0),I();const H=await ct.get("/projects");if(!H.ok)throw new Error(`Failed to fetch projects: ${H.status}`);const K=await H.json(),L=(Array.isArray(K)?K:[]).map(O=>eb(O));o(L);const W=T.current;if(!W)return;const B=L.find(O=>O.name===W)??null;c(B),d(B?.taskmaster??null)}catch(H){M("load projects",H)}finally{y(!1)}},[I,M,n,r]),N=b.useCallback(async()=>{const H=l?.name;if(!H||!r||!n){f([]),v(null);return}try{S(!0),I();const K=await ct.get(`/taskmaster/tasks/${encodeURIComponent(H)}`);if(!K.ok){const W=await K.json();throw new Error(W.message??"Failed to load tasks")}const q=await K.json(),L=Array.isArray(q.tasks)?q.tasks:[];f(L),v(P_(L))}catch(K){M("load tasks",K),f([]),v(null)}finally{S(!1)}},[I,l?.name,M,n,r]),z=b.useCallback(async()=>{if(!r||!n){h(null);return}try{k(!0),I();const H=await ct.get("/mcp-utils/taskmaster-server");if(!H.ok)throw new Error(`Failed to load MCP status: ${H.status}`);const K=await H.json();h(K)}catch(H){M("check MCP server status",H),h(null)}finally{k(!1)}},[I,M,n,r]);b.useEffect(()=>{!a&&r&&n&&(P(),z())},[a,z,P,n,r]),b.useEffect(()=>{l?.name&&r&&n&&N()},[l?.name,N,n,r]),b.useEffect(()=>{const H=t;if(F_(H)){if(H.type==="taskmaster-project-updated"&&H.projectName){P();return}if(H.type==="taskmaster-tasks-updated"&&H.projectName===l?.name){N();return}H.type==="taskmaster-mcp-status-changed"&&z()}},[l?.name,t,z,P,N]);const J=b.useMemo(()=>({projects:i,currentProject:l,projectTaskMaster:u,mcpServerStatus:p,tasks:m,nextTask:g,isLoading:x,isLoadingTasks:w,isLoadingMCP:E,error:C,refreshProjects:P,setCurrentProject:_,refreshTasks:N,refreshMCPStatus:z,clearError:I}),[I,l,C,x,E,w,p,g,u,i,z,P,N,_,m]);return s.jsx(bE.Provider,{value:J,children:e})}const xE=b.createContext({tasksEnabled:!0,setTasksEnabled:()=>{},toggleTasksEnabled:()=>{},isTaskMasterInstalled:null,isTaskMasterReady:null,installationStatus:null,isCheckingInstallation:!0}),Ao=()=>{const e=b.useContext(xE);if(!e)throw new Error("useTasksSettings must be used within a TasksSettingsProvider");return e},z_=({children:e})=>{const[t,r]=b.useState(()=>{const m=localStorage.getItem("tasks-enabled");return m!==null?JSON.parse(m):!0}),[n,a]=b.useState(null),[i,o]=b.useState(null),[l,c]=b.useState(null),[u,d]=b.useState(!0);b.useEffect(()=>{localStorage.setItem("tasks-enabled",JSON.stringify(t))},[t]),b.useEffect(()=>{setTimeout(async()=>{try{const f=await ct.get("/taskmaster/installation-status");if(f.ok){const g=await f.json();c(g),a(g.installation?.isInstalled||!1),o(g.isReady||!1);const v=localStorage.getItem("tasks-enabled");!g.installation?.isInstalled&&!v&&r(!1)}else console.error("Failed to check TaskMaster installation status"),a(!1),o(!1)}catch(f){console.error("Error checking TaskMaster installation:",f),a(!1),o(!1)}finally{d(!1)}},0)},[]);const h={tasksEnabled:t,setTasksEnabled:r,toggleTasksEnabled:()=>{r(m=>!m)},isTaskMasterInstalled:n,isTaskMasterReady:i,installationStatus:l,isCheckingInstallation:u};return s.jsx(xE.Provider,{value:h,children:e})},yE=b.createContext(null);function Io(){const e=b.useContext(yE);if(!e)throw new Error("usePlugins must be used within a PluginsProvider");return e}function $_({children:e}){const[t,r]=b.useState([]),[n,a]=b.useState(!0),[i,o]=b.useState(null),l=b.useCallback(async()=>{try{const h=await Ce("/api/plugins");if(h.ok){const m=await h.json();r(m.plugins||[]),o(null)}else{let m=`Failed to fetch plugins (${h.status})`;try{const f=await h.json();m=f.details||f.error||m}catch{m=h.statusText||m}o(m)}}catch(h){const m=h instanceof Error?h.message:"Failed to fetch plugins";o(m),console.error("[Plugins] Failed to fetch plugins:",h)}finally{a(!1)}},[]);b.useEffect(()=>{l()},[l]);const c=b.useCallback(async h=>{try{const m=await Ce("/api/plugins/install",{method:"POST",body:JSON.stringify({url:h})}),f=await m.json();return m.ok?(await l(),{success:!0}):{success:!1,error:f.details||f.error||"Install failed"}}catch(m){return{success:!1,error:m instanceof Error?m.message:"Install failed"}}},[l]),u=b.useCallback(async h=>{try{const m=await Ce(`/api/plugins/${encodeURIComponent(h)}`,{method:"DELETE"}),f=await m.json();return m.ok?(await l(),{success:!0}):{success:!1,error:f.details||f.error||"Uninstall failed"}}catch(m){return{success:!1,error:m instanceof Error?m.message:"Uninstall failed"}}},[l]),d=b.useCallback(async h=>{try{const m=await Ce(`/api/plugins/${encodeURIComponent(h)}/update`,{method:"POST"}),f=await m.json();return m.ok?(await l(),{success:!0}):{success:!1,error:f.details||f.error||"Update failed"}}catch(m){return{success:!1,error:m instanceof Error?m.message:"Update failed"}}},[l]),p=b.useCallback(async(h,m)=>{try{const f=await Ce(`/api/plugins/${encodeURIComponent(h)}/enable`,{method:"PUT",body:JSON.stringify({enabled:m})});if(!f.ok){let g=`Toggle failed (${f.status})`;try{const v=await f.json();g=v.details||v.error||g}catch{g=f.statusText||g}return{success:!1,error:g}}return await l(),{success:!0,error:null}}catch(f){return{success:!1,error:f instanceof Error?f.message:"Toggle failed"}}},[l]);return s.jsx(yE.Provider,{value:{plugins:t,loading:n,pluginsError:i,refreshPlugins:l,installPlugin:c,uninstallPlugin:u,updatePlugin:d,togglePlugin:p},children:e})}const tb=e=>typeof window>"u"?!1:window.innerWidth<e,rb=()=>{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 of(e={}){const{mobileBreakpoint:t=768,trackMobile:r=!0,trackPWA:n=!0}=e,[a,i]=b.useState(()=>r?tb(t):!1),[o,l]=b.useState(()=>n?rb():!1);return b.useEffect(()=>{if(!r||typeof window>"u")return;const c=()=>{i(tb(t))};return c(),window.addEventListener("resize",c),()=>{window.removeEventListener("resize",c)}},[t,r]),b.useEffect(()=>{if(!n||typeof window>"u")return;const c=window.matchMedia("(display-mode: standalone)"),u=()=>{l(rb())};return u(),typeof c.addEventListener=="function"?(c.addEventListener("change",u),()=>{c.removeEventListener("change",u)}):(c.addListener(u),()=>{c.removeListener(u)})},[n]),{isMobile:a,isPWA:o}}const nb="1.29.1",U_=(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 i=r[a]||0,o=n[a]||0;if(i!==o)return i-o}return 0},vE=(e,t)=>{const[r,n]=b.useState(!1),[a,i]=b.useState(null),[o,l]=b.useState(null),[c,u]=b.useState("git");return b.useEffect(()=>{(async()=>{try{const h=await(await fetch("/health")).json();(h.installMode==="npm"||h.installMode==="git")&&u(h.installMode)}catch{}})()},[]),b.useEffect(()=>{const d=async()=>{try{const m=await(await fetch(`https://api.github.com/repos/${e}/${t}/releases/latest`)).json();if(m.tag_name){const f=m.tag_name.replace(/^v/,"");i(f),n(U_(f,nb)>0),l({title:m.name||m.tag_name,body:m.body||"",htmlUrl:m.html_url||`https://github.com/${e}/${t}/releases/latest`,publishedAt:m.published_at})}else n(!1),i(null),l(null)}catch(h){console.error("Version check failed:",h),n(!1),i(null),l(null)}};d();const p=setInterval(d,300*1e3);return()=>clearInterval(p)},[e,t]),{updateAvailable:r,latestVersion:a,currentVersion:nb,releaseInfo:o,installMode:c}},Zn={autoExpandTools:!1,showRawParameters:!1,showThinking:!0,autoScrollToBottom:!0,sendByCtrlEnter:!1,sidebarVisible:!0},Qs=Object.keys(Zn),q_=new Set(Qs),nl="ui-preferences:sync",eo=(e,t)=>{if(typeof e=="boolean")return e;if(typeof e=="string"){if(e==="true")return!0;if(e==="false")return!1}return t},G_=(e,t)=>{try{const r=localStorage.getItem(e);if(r===null)return t;const n=JSON.parse(r);return eo(n,t)}catch{return t}},H_=e=>{if(typeof window>"u")return Zn;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 Qs.reduce((a,i)=>(a[i]=eo(n[i],Zn[i]),a),{...Zn})}}}catch{}return Qs.reduce((t,r)=>(t[r]=G_(r,Zn[r]),t),{...Zn})};function W_(e,t){switch(t.type){case"set":{const{key:r,value:n}=t;if(!q_.has(r))return e;const a=eo(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 i of Qs){if(!(i in r))continue;const o=r[i],l=eo(o,e[i]);a[i]!==l&&(a[i]=l,n=!0)}return n?a:e}case"reset":return{...Zn,...t.value||{}};default:return e}}function lf(e="uiPreferences"){const t=b.useRef(`ui-preferences-${Math.random().toString(36).slice(2)}`),[r,n]=b.useReducer(W_,e,H_);return b.useEffect(()=>{typeof window>"u"||(localStorage.setItem(e,JSON.stringify(r)),window.dispatchEvent(new CustomEvent(nl,{detail:{storageKey:e,sourceId:t.current,value:r}})))},[r,e]),b.useEffect(()=>{if(typeof window>"u")return;const l=d=>{!d||typeof d!="object"||Array.isArray(d)||n({type:"set_many",value:d})},c=d=>{if(!(d.key!==e||d.newValue===null))try{const p=JSON.parse(d.newValue);l(p)}catch{}},u=d=>{const h=d.detail;!h||h.storageKey!==e||h.sourceId===t.current||l(h.value)};return window.addEventListener("storage",c),window.addEventListener(nl,u),()=>{window.removeEventListener("storage",c),window.removeEventListener(nl,u)}},[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 V_=()=>{try{const e=localStorage.getItem("claude-settings");return e&&JSON.parse(e).projectSortOrder==="date"?"date":"name"}catch{return"name"}},K_=()=>{try{const e=localStorage.getItem("starredProjects");return e?new Set(JSON.parse(e)):new Set}catch{return new Set}},Y_=e=>{try{localStorage.setItem("starredProjects",JSON.stringify([...e]))}catch{}},to=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),Z_=(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.summary||e.name||t("projects.newSession"):e.summary||t("projects.newSession"),X_=e=>e.__provider==="cursor"?String(e.createdAt||""):e.__provider==="codex"?String(e.createdAt||e.lastActivity||""):String(e.lastActivity||e.createdAt||""),J_=(e,t,r)=>{const n=to(e),a=Math.floor((t.getTime()-n.getTime())/(1e3*60));return{isCursorSession:e.__provider==="cursor",isCodexSession:e.__provider==="codex",isGeminiSession:e.__provider==="gemini",isActive:a<10,sessionName:Z_(e,r),sessionTime:X_(e),messageCount:Number(e.messageCount||0)}},wE=(e,t)=>{const r=[...e.sessions||[],...t[e.name]||[]].map(o=>({...o,__provider:"claude"})),n=(e.cursorSessions||[]).map(o=>({...o,__provider:"cursor"})),a=(e.codexSessions||[]).map(o=>({...o,__provider:"codex"})),i=(e.geminiSessions||[]).map(o=>({...o,__provider:"gemini"}));return[...r,...n,...a,...i].sort((o,l)=>to(l).getTime()-to(o).getTime())},ab=(e,t)=>{const r=wE(e,t);return r.length===0?new Date(0):r.reduce((n,a)=>{const i=to(a);return i>n?i:n},new Date(0))},Q_=(e,t,r,n)=>{const a=[...e];return a.sort((i,o)=>{const l=r.has(i.name),c=r.has(o.name);return l&&!c?-1:!l&&c?1:t==="date"?ab(o,n).getTime()-ab(i,n).getTime():(i.displayName||i.name).localeCompare(o.displayName||o.name)}),a},e8=(e,t)=>{const r=t.trim().toLowerCase();return r?e.filter(n=>{const a=(n.displayName||n.name).toLowerCase(),i=n.name.toLowerCase();return a.includes(r)||i.includes(r)}):e},t8=(e,t)=>{const r=!!e.taskmaster?.hasTaskmaster,n=!!(t?.hasMCPServer&&t?.isConfigured);return r&&n?"fully-configured":r?"taskmaster-only":n?"mcp-only":"not-configured"},r8=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 n8({projects:e,selectedProject:t,selectedSession:r,isLoading:n,isMobile:a,t:i,onRefresh:o,onProjectSelect:l,onSessionSelect:c,onSessionDelete:u,onProjectDelete:d,setCurrentProject:p,setSidebarVisible:h,sidebarVisible:m}){const[f,g]=b.useState(new Set),[v,x]=b.useState(null),[y,w]=b.useState(!1),[S,E]=b.useState(""),[k,C]=b.useState({}),[R,T]=b.useState({}),[I,M]=b.useState(new Set),[_,P]=b.useState(new Date),[N,z]=b.useState("name"),[J,H]=b.useState(!1),[K,q]=b.useState({}),[L,W]=b.useState(null),[B,O]=b.useState(""),[ee,te]=b.useState(""),[ce,ie]=b.useState(new Set),[ge,ye]=b.useState(null),[Re,Ee]=b.useState(null),[Ie,Fe]=b.useState(!1),[D,de]=b.useState(()=>K_()),[le,G]=b.useState("projects"),[U,re]=b.useState(null),[pe,me]=b.useState(!1),[ne,be]=b.useState(null),Z=b.useRef(null),Y=b.useRef(0),V=b.useRef(null),oe=!a&&!m;b.useEffect(()=>{const je=setInterval(()=>{P(new Date)},6e4);return()=>clearInterval(je)},[]),b.useEffect(()=>{T({}),M(new Set),q({})},[e]),b.useEffect(()=>{t&&g(je=>{if(je.has(t.name))return je;const Ge=new Set(je);return Ge.add(t.name),Ge})},[r,t]),b.useEffect(()=>{if(e.length>0&&!n){const je=new Set;e.forEach(Ge=>{Ge.sessions&&Ge.sessions.length>=0&&je.add(Ge.name)}),M(je)}},[e,n]),b.useEffect(()=>{const je=()=>{z(V_())};je();const Ge=ke=>{ke.key==="claude-settings"&&je()};window.addEventListener("storage",Ge);const ve=setInterval(()=>{document.hasFocus()&&je()},1e3);return()=>{window.removeEventListener("storage",Ge),clearInterval(ve)}},[]),b.useEffect(()=>{Z.current&&clearTimeout(Z.current),V.current&&(V.current.close(),V.current=null);const je=ee.trim();if(le!=="conversations"||je.length<2){Y.current+=1,re(null),be(null),me(!1);return}me(!0);const Ge=++Y.current;return Z.current=setTimeout(()=>{if(Ge!==Y.current)return;const ve=ct.searchConversationsUrl(je),ke=new EventSource(ve);V.current=ke;const se=[];let xe=0;ke.addEventListener("result",De=>{if(Ge!==Y.current){ke.close();return}try{const Ve=JSON.parse(De.data);se.push(Ve.projectResult),xe=Ve.totalMatches,re({results:[...se],totalMatches:xe,query:je}),be({scannedProjects:Ve.scannedProjects,totalProjects:Ve.totalProjects})}catch{}}),ke.addEventListener("progress",De=>{if(Ge!==Y.current){ke.close();return}try{const Ve=JSON.parse(De.data);xe=Ve.totalMatches,be({scannedProjects:Ve.scannedProjects,totalProjects:Ve.totalProjects})}catch{}}),ke.addEventListener("done",()=>{if(Ge!==Y.current){ke.close();return}ke.close(),V.current=null,me(!1),be(null),se.length===0&&re({results:[],totalMatches:0,query:je})}),ke.addEventListener("error",()=>{if(Ge!==Y.current){ke.close();return}ke.close(),V.current=null,me(!1),be(null),se.length===0&&re({results:[],totalMatches:0,query:je})})},400),()=>{Z.current&&clearTimeout(Z.current),V.current&&(V.current.close(),V.current=null)}},[ee,le]),b.useCallback(je=>Ge=>{const ve=Ge.target;ve.closest(".overflow-y-auto")||ve.closest("[data-scroll-container]")||(Ge.preventDefault(),Ge.stopPropagation(),je())},[]);const he=b.useCallback(je=>{g(Ge=>{const ve=new Set;return Ge.has(je)||ve.add(je),ve})},[]),Ae=b.useCallback((je,Ge)=>{c({...je,__projectName:Ge})},[c]),$e=b.useCallback(je=>{de(Ge=>{const ve=new Set(Ge);return ve.has(je)?ve.delete(je):ve.add(je),Y_(ve),ve})},[]),it=b.useCallback(je=>D.has(je),[D]),et=b.useCallback(je=>wE(je,R),[R]),We=b.useMemo(()=>e.map(je=>{const Ge=K[je.name];return Ge===void 0?je:{...je,sessionMeta:{...je.sessionMeta,hasMore:Ge}}}),[K,e]),st=b.useMemo(()=>Q_(We,N,D,R),[R,N,We,D]),pt=b.useMemo(()=>e8(st,ee),[ee,st]),nt=b.useCallback(je=>{x(je.name),E(je.displayName)},[]),gt=b.useCallback(()=>{x(null),E("")},[]),mt=b.useCallback(async je=>{try{(await ct.renameProject(je,S)).ok?window.refreshProjects?await window.refreshProjects():window.location.reload():console.error("Failed to rename project")}catch(Ge){console.error("Error renaming project:",Ge)}finally{x(null),E("")}},[S]),yt=b.useCallback((je,Ge,ve,ke="claude")=>{Ee({projectName:je,sessionId:Ge,sessionTitle:ve,provider:ke})},[]),vt=b.useCallback(async()=>{if(!Re)return;const{projectName:je,sessionId:Ge,provider:ve}=Re;Ee(null);try{let ke;if(ve==="codex"?ke=await ct.deleteCodexSession(Ge):ve==="gemini"?ke=await ct.deleteGeminiSession(Ge):ke=await ct.deleteSession(je,Ge),ke.ok)u?.(Ge);else{const se=await ke.text();console.error("[Sidebar] Failed to delete session:",{status:ke.status,error:se}),alert(i("messages.deleteSessionFailed"))}}catch(ke){console.error("[Sidebar] Error deleting session:",ke),alert(i("messages.deleteSessionError"))}},[u,Re,i]),_e=b.useCallback(je=>{ye({project:je,sessionCount:et(je).length})},[et]),Ye=b.useCallback(async()=>{if(!ge)return;const{project:je,sessionCount:Ge}=ge,ve=Ge===0;ye(null),ie(ke=>new Set([...ke,je.name]));try{const ke=await ct.deleteProject(je.name,!ve);if(ke.ok)d?.(je.name);else{const se=await ke.json();alert(se.error||i("messages.deleteProjectFailed"))}}catch(ke){console.error("Error deleting project:",ke),alert(i("messages.deleteProjectError"))}finally{ie(ke=>{const se=new Set(ke);return se.delete(je.name),se})}},[ge,d,i]),Qe=b.useCallback(async je=>{const Ge=K[je.name];if(!(!(Ge!==void 0?Ge:je.sessionMeta?.hasMore===!0)||k[je.name])){C(ke=>({...ke,[je.name]:!0}));try{const ke=(je.sessions?.length||0)+(R[je.name]?.length||0),se=await ct.sessions(je.name,5,ke);if(!se.ok)return;const xe=await se.json();T(De=>({...De,[je.name]:[...De[je.name]||[],...xe.sessions||[]]})),xe.hasMore===!1&&q(De=>({...De,[je.name]:!1}))}catch(ke){console.error("Error loading more sessions:",ke)}finally{C(ke=>({...ke,[je.name]:!1}))}}},[R,k,K]),Ke=b.useCallback(je=>{l(je),p(je)},[l,p]),ft=b.useCallback(async()=>{H(!0);try{await o()}finally{H(!1)}},[o]),bt=b.useCallback(async(je,Ge,ve,ke)=>{const se=ve.trim();if(!se){W(null),O("");return}try{const xe=await ct.renameSession(Ge,se,ke);xe.ok?await o():(console.error("[Sidebar] Failed to rename session:",xe.status),alert(i("messages.renameSessionFailed")))}catch(xe){console.error("[Sidebar] Error renaming session:",xe),alert(i("messages.renameSessionError"))}finally{W(null),O("")}},[o,i]),or=b.useCallback(()=>{h(!1)},[h]),lr=b.useCallback(()=>{h(!0)},[h]);return{isSidebarCollapsed:oe,expandedProjects:f,editingProject:v,showNewProject:y,editingName:S,loadingSessions:k,additionalSessions:R,initialSessionsLoaded:I,currentTime:_,projectSortOrder:N,isRefreshing:J,editingSession:L,editingSessionName:B,searchFilter:ee,deletingProjects:ce,deleteConfirmation:ge,sessionDeleteConfirmation:Re,showVersionModal:Ie,starredProjects:D,filteredProjects:pt,toggleProject:he,handleSessionClick:Ae,toggleStarProject:$e,isProjectStarred:it,getProjectSessions:et,startEditing:nt,cancelEditing:gt,saveProjectName:mt,showDeleteSessionConfirmation:yt,confirmDeleteSession:vt,requestProjectDelete:_e,confirmDeleteProject:Ye,loadMoreSessions:Qe,handleProjectSelect:Ke,refreshProjects:ft,updateSessionSummary:bt,collapseSidebar:or,expandSidebar:lr,setShowNewProject:w,setEditingName:E,setEditingSession:W,setEditingSessionName:O,searchMode:le,setSearchMode:G,conversationResults:U,isSearching:pe,searchProgress:ne,clearConversationResults:b.useCallback(()=>{Y.current+=1,V.current&&(V.current.close(),V.current=null),me(!1),be(null),re(null)},[]),setSearchFilter:te,setDeleteConfirmation:ye,setSessionDeleteConfirmation:Ee,setShowVersionModal:Fe}}const a8="https://discord.gg/buxwujPNRE",i8="https://github.com/siteboon/claudecodeui/issues/new";function s8({className:e}){return s.jsx("svg",{className:e,fill:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:s.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 o8({onExpand:e,onShowSettings:t,updateAvailable:r,onShowVersionModal:n,t:a}){return s.jsxs("div",{className:"flex h-full w-12 flex-col items-center gap-1 bg-background/80 py-3 backdrop-blur-sm",children:[s.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":a("common:versionUpdate.ariaLabels.showSidebar"),title:a("common:versionUpdate.ariaLabels.showSidebar"),children:s.jsx(L7,{className:"h-4 w-4 text-muted-foreground transition-colors group-hover:text-foreground"})}),s.jsx("div",{className:"nav-divider my-1 w-6"}),s.jsx("button",{onClick:t,className:"group flex h-8 w-8 items-center justify-center rounded-lg transition-colors hover:bg-accent/80","aria-label":a("actions.settings"),title:a("actions.settings"),children:s.jsx(Et,{className:"h-4 w-4 text-muted-foreground transition-colors group-hover:text-foreground"})}),s.jsx("a",{href:i8,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":a("actions.reportIssue"),title:a("actions.reportIssue"),children:s.jsx(K0,{className:"h-4 w-4 text-muted-foreground transition-colors group-hover:text-foreground"})}),s.jsx("a",{href:a8,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":a("actions.joinCommunity"),title:a("actions.joinCommunity"),children:s.jsx(s8,{className:"h-4 w-4 text-muted-foreground transition-colors group-hover:text-foreground"})}),r&&s.jsxs("button",{onClick:n,className:"relative flex h-8 w-8 items-center justify-center rounded-lg transition-colors hover:bg-accent/80","aria-label":a("common:versionUpdate.ariaLabels.updateAvailable"),title:a("common:versionUpdate.ariaLabels.updateAvailable"),children:[s.jsx(ia,{className:"h-4 w-4 text-blue-500"}),s.jsx("span",{className:"absolute right-1.5 top-1.5 h-1.5 w-1.5 animate-pulse rounded-full bg-blue-500"})]})]})}function kE(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=kE(e[t]))&&(n&&(n+=" "),n+=r)}else for(r in e)e[r]&&(n&&(n+=" "),n+=r);return n}function SE(){for(var e,t,r=0,n="",a=arguments.length;r<a;r++)(e=arguments[r])&&(t=kE(e))&&(n&&(n+=" "),n+=t);return n}const ib=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,sb=SE,EE=(e,t)=>r=>{var n;if(t?.variants==null)return sb(e,r?.class,r?.className);const{variants:a,defaultVariants:i}=t,o=Object.keys(a).map(u=>{const d=r?.[u],p=i?.[u];if(d===null)return null;const h=ib(d)||ib(p);return a[u][h]}),l=r&&Object.entries(r).reduce((u,d)=>{let[p,h]=d;return h===void 0||(u[p]=h),u},{}),c=t==null||(n=t.compoundVariants)===null||n===void 0?void 0:n.reduce((u,d)=>{let{class:p,className:h,...m}=d;return Object.entries(m).every(f=>{let[g,v]=f;return Array.isArray(v)?v.includes({...i,...l}[g]):{...i,...l}[g]===v})?[...u,p,h]:u},[]);return sb(e,o,c,r?.class,r?.className)},cf="-",l8=e=>{const t=u8(e),{conflictingClassGroups:r,conflictingClassGroupModifiers:n}=e;return{getClassGroupId:o=>{const l=o.split(cf);return l[0]===""&&l.length!==1&&l.shift(),NE(l,t)||c8(o)},getConflictingClassGroupIds:(o,l)=>{const c=r[o]||[];return l&&n[o]?[...c,...n[o]]:c}}},NE=(e,t)=>{if(e.length===0)return t.classGroupId;const r=e[0],n=t.nextPart.get(r),a=n?NE(e.slice(1),n):void 0;if(a)return a;if(t.validators.length===0)return;const i=e.join(cf);return t.validators.find(({validator:o})=>o(i))?.classGroupId},ob=/^\[(.+)\]$/,c8=e=>{if(ob.test(e)){const t=ob.exec(e)[1],r=t?.substring(0,t.indexOf(":"));if(r)return"arbitrary.."+r}},u8=e=>{const{theme:t,classGroups:r}=e,n={nextPart:new Map,validators:[]};for(const a in r)eh(r[a],n,a,t);return n},eh=(e,t,r,n)=>{e.forEach(a=>{if(typeof a=="string"){const i=a===""?t:lb(t,a);i.classGroupId=r;return}if(typeof a=="function"){if(d8(a)){eh(a(n),t,r,n);return}t.validators.push({validator:a,classGroupId:r});return}Object.entries(a).forEach(([i,o])=>{eh(o,lb(t,i),r,n)})})},lb=(e,t)=>{let r=e;return t.split(cf).forEach(n=>{r.nextPart.has(n)||r.nextPart.set(n,{nextPart:new Map,validators:[]}),r=r.nextPart.get(n)}),r},d8=e=>e.isThemeGetter,p8=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,r=new Map,n=new Map;const a=(i,o)=>{r.set(i,o),t++,t>e&&(t=0,n=r,r=new Map)};return{get(i){let o=r.get(i);if(o!==void 0)return o;if((o=n.get(i))!==void 0)return a(i,o),o},set(i,o){r.has(i)?r.set(i,o):a(i,o)}}},th="!",rh=":",m8=rh.length,h8=e=>{const{prefix:t,experimentalParseClassName:r}=e;let n=a=>{const i=[];let o=0,l=0,c=0,u;for(let f=0;f<a.length;f++){let g=a[f];if(o===0&&l===0){if(g===rh){i.push(a.slice(c,f)),c=f+m8;continue}if(g==="/"){u=f;continue}}g==="["?o++:g==="]"?o--:g==="("?l++:g===")"&&l--}const d=i.length===0?a:a.substring(c),p=f8(d),h=p!==d,m=u&&u>c?u-c:void 0;return{modifiers:i,hasImportantModifier:h,baseClassName:p,maybePostfixModifierPosition:m}};if(t){const a=t+rh,i=n;n=o=>o.startsWith(a)?i(o.substring(a.length)):{isExternal:!0,modifiers:[],hasImportantModifier:!1,baseClassName:o,maybePostfixModifierPosition:void 0}}if(r){const a=n;n=i=>r({className:i,parseClassName:a})}return n},f8=e=>e.endsWith(th)?e.substring(0,e.length-1):e.startsWith(th)?e.substring(1):e,g8=e=>{const t=Object.fromEntries(e.orderSensitiveModifiers.map(n=>[n,!0]));return n=>{if(n.length<=1)return n;const a=[];let i=[];return n.forEach(o=>{o[0]==="["||t[o]?(a.push(...i.sort(),o),i=[]):i.push(o)}),a.push(...i.sort()),a}},b8=e=>({cache:p8(e.cacheSize),parseClassName:h8(e),sortModifiers:g8(e),...l8(e)}),x8=/\s+/,y8=(e,t)=>{const{parseClassName:r,getClassGroupId:n,getConflictingClassGroupIds:a,sortModifiers:i}=t,o=[],l=e.trim().split(x8);let c="";for(let u=l.length-1;u>=0;u-=1){const d=l[u],{isExternal:p,modifiers:h,hasImportantModifier:m,baseClassName:f,maybePostfixModifierPosition:g}=r(d);if(p){c=d+(c.length>0?" "+c:c);continue}let v=!!g,x=n(v?f.substring(0,g):f);if(!x){if(!v){c=d+(c.length>0?" "+c:c);continue}if(x=n(f),!x){c=d+(c.length>0?" "+c:c);continue}v=!1}const y=i(h).join(":"),w=m?y+th:y,S=w+x;if(o.includes(S))continue;o.push(S);const E=a(x,v);for(let k=0;k<E.length;++k){const C=E[k];o.push(w+C)}c=d+(c.length>0?" "+c:c)}return c};function v8(){let e=0,t,r,n="";for(;e<arguments.length;)(t=arguments[e++])&&(r=CE(t))&&(n&&(n+=" "),n+=r);return n}const CE=e=>{if(typeof e=="string")return e;let t,r="";for(let n=0;n<e.length;n++)e[n]&&(t=CE(e[n]))&&(r&&(r+=" "),r+=t);return r};function w8(e,...t){let r,n,a,i=o;function o(c){const u=t.reduce((d,p)=>p(d),e());return r=b8(u),n=r.cache.get,a=r.cache.set,i=l,l(c)}function l(c){const u=n(c);if(u)return u;const d=y8(c,r);return a(c,d),d}return function(){return i(v8.apply(null,arguments))}}const $t=e=>{const t=r=>r[e]||[];return t.isThemeGetter=!0,t},TE=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,AE=/^\((?:(\w[\w-]*):)?(.+)\)$/i,k8=/^\d+\/\d+$/,S8=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,E8=/\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$/,N8=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,C8=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,T8=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,ka=e=>k8.test(e),ut=e=>!!e&&!Number.isNaN(Number(e)),kn=e=>!!e&&Number.isInteger(Number(e)),al=e=>e.endsWith("%")&&ut(e.slice(0,-1)),an=e=>S8.test(e),A8=()=>!0,I8=e=>E8.test(e)&&!N8.test(e),IE=()=>!1,_8=e=>C8.test(e),R8=e=>T8.test(e),j8=e=>!Ue(e)&&!qe(e),D8=e=>Za(e,jE,IE),Ue=e=>TE.test(e),Hn=e=>Za(e,DE,I8),il=e=>Za(e,F8,ut),cb=e=>Za(e,_E,IE),M8=e=>Za(e,RE,R8),is=e=>Za(e,ME,_8),qe=e=>AE.test(e),di=e=>Xa(e,DE),O8=e=>Xa(e,B8),ub=e=>Xa(e,_E),L8=e=>Xa(e,jE),P8=e=>Xa(e,RE),ss=e=>Xa(e,ME,!0),Za=(e,t,r)=>{const n=TE.exec(e);return n?n[1]?t(n[1]):r(n[2]):!1},Xa=(e,t,r=!1)=>{const n=AE.exec(e);return n?n[1]?t(n[1]):r:!1},_E=e=>e==="position"||e==="percentage",RE=e=>e==="image"||e==="url",jE=e=>e==="length"||e==="size"||e==="bg-size",DE=e=>e==="length",F8=e=>e==="number",B8=e=>e==="family-name",ME=e=>e==="shadow",z8=()=>{const e=$t("color"),t=$t("font"),r=$t("text"),n=$t("font-weight"),a=$t("tracking"),i=$t("leading"),o=$t("breakpoint"),l=$t("container"),c=$t("spacing"),u=$t("radius"),d=$t("shadow"),p=$t("inset-shadow"),h=$t("text-shadow"),m=$t("drop-shadow"),f=$t("blur"),g=$t("perspective"),v=$t("aspect"),x=$t("ease"),y=$t("animate"),w=()=>["auto","avoid","all","avoid-page","page","left","right","column"],S=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],E=()=>[...S(),qe,Ue],k=()=>["auto","hidden","clip","visible","scroll"],C=()=>["auto","contain","none"],R=()=>[qe,Ue,c],T=()=>[ka,"full","auto",...R()],I=()=>[kn,"none","subgrid",qe,Ue],M=()=>["auto",{span:["full",kn,qe,Ue]},kn,qe,Ue],_=()=>[kn,"auto",qe,Ue],P=()=>["auto","min","max","fr",qe,Ue],N=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],z=()=>["start","end","center","stretch","center-safe","end-safe"],J=()=>["auto",...R()],H=()=>[ka,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...R()],K=()=>[e,qe,Ue],q=()=>[...S(),ub,cb,{position:[qe,Ue]}],L=()=>["no-repeat",{repeat:["","x","y","space","round"]}],W=()=>["auto","cover","contain",L8,D8,{size:[qe,Ue]}],B=()=>[al,di,Hn],O=()=>["","none","full",u,qe,Ue],ee=()=>["",ut,di,Hn],te=()=>["solid","dashed","dotted","double"],ce=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],ie=()=>[ut,al,ub,cb],ge=()=>["","none",f,qe,Ue],ye=()=>["none",ut,qe,Ue],Re=()=>["none",ut,qe,Ue],Ee=()=>[ut,qe,Ue],Ie=()=>[ka,"full",...R()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[an],breakpoint:[an],color:[A8],container:[an],"drop-shadow":[an],ease:["in","out","in-out"],font:[j8],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[an],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[an],shadow:[an],spacing:["px",ut],text:[an],"text-shadow":[an],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",ka,Ue,qe,v]}],container:["container"],columns:[{columns:[ut,Ue,qe,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:E()}],overflow:[{overflow:k()}],"overflow-x":[{"overflow-x":k()}],"overflow-y":[{"overflow-y":k()}],overscroll:[{overscroll:C()}],"overscroll-x":[{"overscroll-x":C()}],"overscroll-y":[{"overscroll-y":C()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:T()}],"inset-x":[{"inset-x":T()}],"inset-y":[{"inset-y":T()}],start:[{start:T()}],end:[{end:T()}],top:[{top:T()}],right:[{right:T()}],bottom:[{bottom:T()}],left:[{left:T()}],visibility:["visible","invisible","collapse"],z:[{z:[kn,"auto",qe,Ue]}],basis:[{basis:[ka,"full","auto",l,...R()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[ut,ka,"auto","initial","none",Ue]}],grow:[{grow:["",ut,qe,Ue]}],shrink:[{shrink:["",ut,qe,Ue]}],order:[{order:[kn,"first","last","none",qe,Ue]}],"grid-cols":[{"grid-cols":I()}],"col-start-end":[{col:M()}],"col-start":[{"col-start":_()}],"col-end":[{"col-end":_()}],"grid-rows":[{"grid-rows":I()}],"row-start-end":[{row:M()}],"row-start":[{"row-start":_()}],"row-end":[{"row-end":_()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":P()}],"auto-rows":[{"auto-rows":P()}],gap:[{gap:R()}],"gap-x":[{"gap-x":R()}],"gap-y":[{"gap-y":R()}],"justify-content":[{justify:[...N(),"normal"]}],"justify-items":[{"justify-items":[...z(),"normal"]}],"justify-self":[{"justify-self":["auto",...z()]}],"align-content":[{content:["normal",...N()]}],"align-items":[{items:[...z(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...z(),{baseline:["","last"]}]}],"place-content":[{"place-content":N()}],"place-items":[{"place-items":[...z(),"baseline"]}],"place-self":[{"place-self":["auto",...z()]}],p:[{p:R()}],px:[{px:R()}],py:[{py:R()}],ps:[{ps:R()}],pe:[{pe:R()}],pt:[{pt:R()}],pr:[{pr:R()}],pb:[{pb:R()}],pl:[{pl:R()}],m:[{m:J()}],mx:[{mx:J()}],my:[{my:J()}],ms:[{ms:J()}],me:[{me:J()}],mt:[{mt:J()}],mr:[{mr:J()}],mb:[{mb:J()}],ml:[{ml:J()}],"space-x":[{"space-x":R()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":R()}],"space-y-reverse":["space-y-reverse"],size:[{size:H()}],w:[{w:[l,"screen",...H()]}],"min-w":[{"min-w":[l,"screen","none",...H()]}],"max-w":[{"max-w":[l,"screen","none","prose",{screen:[o]},...H()]}],h:[{h:["screen","lh",...H()]}],"min-h":[{"min-h":["screen","lh","none",...H()]}],"max-h":[{"max-h":["screen","lh",...H()]}],"font-size":[{text:["base",r,di,Hn]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[n,qe,il]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",al,Ue]}],"font-family":[{font:[O8,Ue,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,qe,Ue]}],"line-clamp":[{"line-clamp":[ut,"none",qe,il]}],leading:[{leading:[i,...R()]}],"list-image":[{"list-image":["none",qe,Ue]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",qe,Ue]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:K()}],"text-color":[{text:K()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...te(),"wavy"]}],"text-decoration-thickness":[{decoration:[ut,"from-font","auto",qe,Hn]}],"text-decoration-color":[{decoration:K()}],"underline-offset":[{"underline-offset":[ut,"auto",qe,Ue]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:R()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",qe,Ue]}],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",qe,Ue]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:q()}],"bg-repeat":[{bg:L()}],"bg-size":[{bg:W()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},kn,qe,Ue],radial:["",qe,Ue],conic:[kn,qe,Ue]},P8,M8]}],"bg-color":[{bg:K()}],"gradient-from-pos":[{from:B()}],"gradient-via-pos":[{via:B()}],"gradient-to-pos":[{to:B()}],"gradient-from":[{from:K()}],"gradient-via":[{via:K()}],"gradient-to":[{to:K()}],rounded:[{rounded:O()}],"rounded-s":[{"rounded-s":O()}],"rounded-e":[{"rounded-e":O()}],"rounded-t":[{"rounded-t":O()}],"rounded-r":[{"rounded-r":O()}],"rounded-b":[{"rounded-b":O()}],"rounded-l":[{"rounded-l":O()}],"rounded-ss":[{"rounded-ss":O()}],"rounded-se":[{"rounded-se":O()}],"rounded-ee":[{"rounded-ee":O()}],"rounded-es":[{"rounded-es":O()}],"rounded-tl":[{"rounded-tl":O()}],"rounded-tr":[{"rounded-tr":O()}],"rounded-br":[{"rounded-br":O()}],"rounded-bl":[{"rounded-bl":O()}],"border-w":[{border:ee()}],"border-w-x":[{"border-x":ee()}],"border-w-y":[{"border-y":ee()}],"border-w-s":[{"border-s":ee()}],"border-w-e":[{"border-e":ee()}],"border-w-t":[{"border-t":ee()}],"border-w-r":[{"border-r":ee()}],"border-w-b":[{"border-b":ee()}],"border-w-l":[{"border-l":ee()}],"divide-x":[{"divide-x":ee()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":ee()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...te(),"hidden","none"]}],"divide-style":[{divide:[...te(),"hidden","none"]}],"border-color":[{border:K()}],"border-color-x":[{"border-x":K()}],"border-color-y":[{"border-y":K()}],"border-color-s":[{"border-s":K()}],"border-color-e":[{"border-e":K()}],"border-color-t":[{"border-t":K()}],"border-color-r":[{"border-r":K()}],"border-color-b":[{"border-b":K()}],"border-color-l":[{"border-l":K()}],"divide-color":[{divide:K()}],"outline-style":[{outline:[...te(),"none","hidden"]}],"outline-offset":[{"outline-offset":[ut,qe,Ue]}],"outline-w":[{outline:["",ut,di,Hn]}],"outline-color":[{outline:K()}],shadow:[{shadow:["","none",d,ss,is]}],"shadow-color":[{shadow:K()}],"inset-shadow":[{"inset-shadow":["none",p,ss,is]}],"inset-shadow-color":[{"inset-shadow":K()}],"ring-w":[{ring:ee()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:K()}],"ring-offset-w":[{"ring-offset":[ut,Hn]}],"ring-offset-color":[{"ring-offset":K()}],"inset-ring-w":[{"inset-ring":ee()}],"inset-ring-color":[{"inset-ring":K()}],"text-shadow":[{"text-shadow":["none",h,ss,is]}],"text-shadow-color":[{"text-shadow":K()}],opacity:[{opacity:[ut,qe,Ue]}],"mix-blend":[{"mix-blend":[...ce(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":ce()}],"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":[ut]}],"mask-image-linear-from-pos":[{"mask-linear-from":ie()}],"mask-image-linear-to-pos":[{"mask-linear-to":ie()}],"mask-image-linear-from-color":[{"mask-linear-from":K()}],"mask-image-linear-to-color":[{"mask-linear-to":K()}],"mask-image-t-from-pos":[{"mask-t-from":ie()}],"mask-image-t-to-pos":[{"mask-t-to":ie()}],"mask-image-t-from-color":[{"mask-t-from":K()}],"mask-image-t-to-color":[{"mask-t-to":K()}],"mask-image-r-from-pos":[{"mask-r-from":ie()}],"mask-image-r-to-pos":[{"mask-r-to":ie()}],"mask-image-r-from-color":[{"mask-r-from":K()}],"mask-image-r-to-color":[{"mask-r-to":K()}],"mask-image-b-from-pos":[{"mask-b-from":ie()}],"mask-image-b-to-pos":[{"mask-b-to":ie()}],"mask-image-b-from-color":[{"mask-b-from":K()}],"mask-image-b-to-color":[{"mask-b-to":K()}],"mask-image-l-from-pos":[{"mask-l-from":ie()}],"mask-image-l-to-pos":[{"mask-l-to":ie()}],"mask-image-l-from-color":[{"mask-l-from":K()}],"mask-image-l-to-color":[{"mask-l-to":K()}],"mask-image-x-from-pos":[{"mask-x-from":ie()}],"mask-image-x-to-pos":[{"mask-x-to":ie()}],"mask-image-x-from-color":[{"mask-x-from":K()}],"mask-image-x-to-color":[{"mask-x-to":K()}],"mask-image-y-from-pos":[{"mask-y-from":ie()}],"mask-image-y-to-pos":[{"mask-y-to":ie()}],"mask-image-y-from-color":[{"mask-y-from":K()}],"mask-image-y-to-color":[{"mask-y-to":K()}],"mask-image-radial":[{"mask-radial":[qe,Ue]}],"mask-image-radial-from-pos":[{"mask-radial-from":ie()}],"mask-image-radial-to-pos":[{"mask-radial-to":ie()}],"mask-image-radial-from-color":[{"mask-radial-from":K()}],"mask-image-radial-to-color":[{"mask-radial-to":K()}],"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":S()}],"mask-image-conic-pos":[{"mask-conic":[ut]}],"mask-image-conic-from-pos":[{"mask-conic-from":ie()}],"mask-image-conic-to-pos":[{"mask-conic-to":ie()}],"mask-image-conic-from-color":[{"mask-conic-from":K()}],"mask-image-conic-to-color":[{"mask-conic-to":K()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:q()}],"mask-repeat":[{mask:L()}],"mask-size":[{mask:W()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",qe,Ue]}],filter:[{filter:["","none",qe,Ue]}],blur:[{blur:ge()}],brightness:[{brightness:[ut,qe,Ue]}],contrast:[{contrast:[ut,qe,Ue]}],"drop-shadow":[{"drop-shadow":["","none",m,ss,is]}],"drop-shadow-color":[{"drop-shadow":K()}],grayscale:[{grayscale:["",ut,qe,Ue]}],"hue-rotate":[{"hue-rotate":[ut,qe,Ue]}],invert:[{invert:["",ut,qe,Ue]}],saturate:[{saturate:[ut,qe,Ue]}],sepia:[{sepia:["",ut,qe,Ue]}],"backdrop-filter":[{"backdrop-filter":["","none",qe,Ue]}],"backdrop-blur":[{"backdrop-blur":ge()}],"backdrop-brightness":[{"backdrop-brightness":[ut,qe,Ue]}],"backdrop-contrast":[{"backdrop-contrast":[ut,qe,Ue]}],"backdrop-grayscale":[{"backdrop-grayscale":["",ut,qe,Ue]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[ut,qe,Ue]}],"backdrop-invert":[{"backdrop-invert":["",ut,qe,Ue]}],"backdrop-opacity":[{"backdrop-opacity":[ut,qe,Ue]}],"backdrop-saturate":[{"backdrop-saturate":[ut,qe,Ue]}],"backdrop-sepia":[{"backdrop-sepia":["",ut,qe,Ue]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":R()}],"border-spacing-x":[{"border-spacing-x":R()}],"border-spacing-y":[{"border-spacing-y":R()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",qe,Ue]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[ut,"initial",qe,Ue]}],ease:[{ease:["linear","initial",x,qe,Ue]}],delay:[{delay:[ut,qe,Ue]}],animate:[{animate:["none",y,qe,Ue]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[g,qe,Ue]}],"perspective-origin":[{"perspective-origin":E()}],rotate:[{rotate:ye()}],"rotate-x":[{"rotate-x":ye()}],"rotate-y":[{"rotate-y":ye()}],"rotate-z":[{"rotate-z":ye()}],scale:[{scale:Re()}],"scale-x":[{"scale-x":Re()}],"scale-y":[{"scale-y":Re()}],"scale-z":[{"scale-z":Re()}],"scale-3d":["scale-3d"],skew:[{skew:Ee()}],"skew-x":[{"skew-x":Ee()}],"skew-y":[{"skew-y":Ee()}],transform:[{transform:[qe,Ue,"","none","gpu","cpu"]}],"transform-origin":[{origin:E()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:Ie()}],"translate-x":[{"translate-x":Ie()}],"translate-y":[{"translate-y":Ie()}],"translate-z":[{"translate-z":Ie()}],"translate-none":["translate-none"],accent:[{accent:K()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:K()}],"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",qe,Ue]}],"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":R()}],"scroll-mx":[{"scroll-mx":R()}],"scroll-my":[{"scroll-my":R()}],"scroll-ms":[{"scroll-ms":R()}],"scroll-me":[{"scroll-me":R()}],"scroll-mt":[{"scroll-mt":R()}],"scroll-mr":[{"scroll-mr":R()}],"scroll-mb":[{"scroll-mb":R()}],"scroll-ml":[{"scroll-ml":R()}],"scroll-p":[{"scroll-p":R()}],"scroll-px":[{"scroll-px":R()}],"scroll-py":[{"scroll-py":R()}],"scroll-ps":[{"scroll-ps":R()}],"scroll-pe":[{"scroll-pe":R()}],"scroll-pt":[{"scroll-pt":R()}],"scroll-pr":[{"scroll-pr":R()}],"scroll-pb":[{"scroll-pb":R()}],"scroll-pl":[{"scroll-pl":R()}],"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",qe,Ue]}],fill:[{fill:["none",...K()]}],"stroke-w":[{stroke:[ut,di,Hn,il]}],stroke:[{stroke:["none",...K()]}],"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"]}},$8=w8(z8);function Oe(...e){return $8(SE(e))}function U8(e){if(!e||typeof e!="string")return null;try{return JSON.parse(e)}catch{return null}}const q8=EE("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 Lr({className:e,variant:t,...r}){return s.jsx("div",{className:Oe(q8({variant:t}),e),...r})}const G8=EE("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium touch-manipulation 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"}}),Be=b.forwardRef(({className:e,variant:t,size:r,...n},a)=>s.jsx("button",{className:Oe(G8({variant:t,size:r,className:e})),ref:a,...n}));Be.displayName="Button";function nh({checked:e,onToggle:t,ariaLabel:r="Toggle dark mode"}){const{isDarkMode:n,toggleDarkMode:a}=Ka(),i=typeof e=="boolean"&&typeof t=="function",o=i?e:n,l=()=>{if(i&&t){t(!o);return}a()};return s.jsxs("button",{onClick:l,className:Oe("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:[s.jsx("span",{className:"sr-only",children:r}),s.jsx("span",{className:Oe("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?s.jsx(nf,{className:"h-3 w-3 text-primary"}):s.jsx(af,{className:"h-3 w-3 text-white dark:text-background"})})]})}const At=b.forwardRef(({className:e,type:t,...r},n)=>s.jsx("input",{type:t,className:Oe("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}));At.displayName="Input";const uf=b.forwardRef(({className:e,children:t,...r},n)=>s.jsx("div",{className:Oe(e,"relative overflow-hidden"),...r,children:s.jsx("div",{ref:n,className:"h-full w-full overflow-auto rounded-[inherit]",style:{WebkitOverflowScrolling:"touch",touchAction:"pan-y"},children:t})}));uf.displayName="ScrollArea";function H8(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 _n({children:e,content:t,position:r="top",className:n="",delay:a=350}){const[i,o]=b.useState(!1),l=b.useRef(null),c=b.useRef(!1),u=b.useRef(null),d=b.useRef(null),[p,h]=b.useState(null),m=b.useCallback(()=>{const w=u.current;if(!w)return;const S=w.getBoundingClientRect(),E=8,k={position:"fixed",zIndex:9999};switch(r){case"bottom":k.left=S.left+S.width/2,k.top=S.bottom+E,k.transform="translateX(-50%)";break;case"left":k.left=S.left-E,k.top=S.top+S.height/2,k.transform="translate(-100%, -50%)";break;case"right":k.left=S.right+E,k.top=S.top+S.height/2,k.transform="translateY(-50%)";break;case"top":default:k.left=S.left+S.width/2,k.top=S.top-E,k.transform="translate(-50%, -100%)";break}h(k)},[r]),f=()=>{l.current!==null&&(window.clearTimeout(l.current),l.current=null)},g=()=>{f(),l.current=window.setTimeout(()=>{o(!0)},a)},v=()=>{f(),o(!1)},x=()=>{f(),c.current=!1,l.current=window.setTimeout(()=>{c.current=!0,o(!0)},a)},y=()=>{f(),!c.current&&o(!1)};return b.useEffect(()=>()=>{f()},[]),b.useEffect(()=>{if(!i||typeof document>"u")return;const w=S=>{const E=S.target;E instanceof Node&&u.current?.contains(E)||(o(!1),c.current=!1)};return document.addEventListener("pointerdown",w,!0),()=>document.removeEventListener("pointerdown",w,!0)},[i]),b.useEffect(()=>{if(!i){h(null);return}const w=window.requestAnimationFrame(m),S=()=>m();return window.addEventListener("resize",S),window.addEventListener("scroll",S,!0),()=>{window.cancelAnimationFrame(w),window.removeEventListener("resize",S),window.removeEventListener("scroll",S,!0)}},[i,m]),t?s.jsxs("div",{ref:u,className:"relative inline-block",onMouseEnter:g,onMouseLeave:v,onTouchStart:x,onTouchEnd:y,onTouchCancel:y,children:[e,i&&typeof document<"u"&&P4.createPortal(s.jsxs("div",{ref:d,style:p||{position:"fixed",top:"-9999px",left:"-9999px",opacity:0},className:Oe("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,s.jsx("div",{className:Oe("absolute w-0 h-0 border-4 border-transparent",H8(r))})]}),document.body)]}):s.jsx(s.Fragment,{children:e})}function df({children:e,className:t}){return s.jsx("div",{className:Oe("inline-flex items-center gap-[2px] rounded-lg bg-muted/60 p-[3px]",t),children:e})}function pf({isActive:e,onClick:t,children:r,className:n}){return s.jsx("button",{onClick:t,className:Oe("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 db="https://github.com/siteboon/claudecodeui/issues/new",W8="https://github.com/siteboon/claudecodeui",pb="https://discord.gg/buxwujPNRE";function mb({className:e}){return s.jsx("svg",{className:e,fill:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:s.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 V8({updateAvailable:e,releaseInfo:t,latestVersion:r,currentVersion:n,onShowVersionModal:a,onShowSettings:i,t:o}){return s.jsxs("div",{className:"flex-shrink-0",style:{paddingBottom:"env(safe-area-inset-bottom, 0)"},children:[e&&s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"nav-divider"}),s.jsx("div",{className:"hidden px-2 py-1.5 md:block",children:s.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:[s.jsxs("div",{className:"relative flex-shrink-0",children:[s.jsx(Ug,{className:"h-4 w-4 text-blue-500 dark:text-blue-400"}),s.jsx("span",{className:"absolute -right-0.5 -top-0.5 h-1.5 w-1.5 animate-pulse rounded-full bg-blue-500"})]}),s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsx("span",{className:"block truncate text-sm font-medium text-blue-600 dark:text-blue-300",children:t?.title||`v${r}`}),s.jsx("span",{className:"text-[10px] text-blue-500/70 dark:text-blue-400/60",children:o("version.updateAvailable")})]})]})}),s.jsx("div",{className:"px-3 py-2 md:hidden",children:s.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:[s.jsxs("div",{className:"relative flex-shrink-0",children:[s.jsx(Ug,{className:"w-4.5 h-4.5 text-blue-500 dark:text-blue-400"}),s.jsx("span",{className:"absolute -right-0.5 -top-0.5 h-1.5 w-1.5 animate-pulse rounded-full bg-blue-500"})]}),s.jsxs("div",{className:"min-w-0 flex-1 text-left",children:[s.jsx("span",{className:"block truncate text-sm font-medium text-blue-600 dark:text-blue-300",children:t?.title||`v${r}`}),s.jsx("span",{className:"text-xs text-blue-500/70 dark:text-blue-400/60",children:o("version.updateAvailable")})]})]})})]}),s.jsx("div",{className:"nav-divider"}),s.jsx("div",{className:"hidden px-2 pt-1.5 md:block",children:s.jsxs("a",{href:db,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:[s.jsx(K0,{className:"h-3.5 w-3.5"}),s.jsx("span",{className:"text-sm",children:o("actions.reportIssue")})]})}),s.jsx("div",{className:"hidden px-2 md:block",children:s.jsxs("a",{href:pb,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:[s.jsx(mb,{className:"h-3.5 w-3.5"}),s.jsx("span",{className:"text-sm",children:o("actions.joinCommunity")})]})}),s.jsx("div",{className:"hidden px-2 py-1.5 md:block",children:s.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:i,children:[s.jsx(Et,{className:"h-3.5 w-3.5"}),s.jsx("span",{className:"text-sm",children:o("actions.settings")})]})}),s.jsx("div",{className:"hidden px-3 py-2 text-center md:block",children:s.jsxs("a",{href:W8,target:"_blank",rel:"noopener noreferrer",className:"text-[10px] text-muted-foreground/40 transition-colors hover:text-muted-foreground",children:["CloudCLI v",n," – ",o("branding.openSource")]})}),s.jsx("div",{className:"px-3 pt-3 md:hidden",children:s.jsxs("a",{href:db,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:[s.jsx("div",{className:"flex h-8 w-8 items-center justify-center rounded-xl bg-background/80",children:s.jsx(K0,{className:"w-4.5 h-4.5 text-muted-foreground"})}),s.jsx("span",{className:"text-base font-medium text-foreground",children:o("actions.reportIssue")})]})}),s.jsx("div",{className:"px-3 pt-2 md:hidden",children:s.jsxs("a",{href:pb,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:[s.jsx("div",{className:"flex h-8 w-8 items-center justify-center rounded-xl bg-background/80",children:s.jsx(mb,{className:"w-4.5 h-4.5 text-muted-foreground"})}),s.jsx("span",{className:"text-base font-medium text-foreground",children:o("actions.joinCommunity")})]})}),s.jsx("div",{className:"px-3 pb-3 pt-2 md:hidden",children:s.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:i,children:[s.jsx("div",{className:"flex h-8 w-8 items-center justify-center rounded-xl bg-background/80",children:s.jsx(Et,{className:"w-4.5 h-4.5 text-muted-foreground"})}),s.jsx("span",{className:"text-base font-medium text-foreground",children:o("actions.settings")})]})})]})}const hb="CLOUDCLI_GITHUB_STARS",fb="CLOUDCLI_HIDE_GITHUB_STAR",K8=3600*1e3,Y8=(e,t)=>{const[r,n]=b.useState(null),[a,i]=b.useState(()=>{try{return localStorage.getItem(fb)==="true"}catch{return!1}});b.useEffect(()=>{if(a)return;try{const u=localStorage.getItem(hb);if(u){const d=JSON.parse(u);if(Date.now()-d.timestamp<K8){n(d.count);return}}}catch{}(async()=>{try{const u=await fetch(`https://api.github.com/repos/${e}/${t}`);if(!u.ok)return;const p=(await u.json()).stargazers_count;if(typeof p=="number"){n(p);try{localStorage.setItem(hb,JSON.stringify({count:p,timestamp:Date.now()}))}catch{}}}catch{}})()},[e,t,a]);const o=b.useCallback(()=>{i(!0);try{localStorage.setItem(fb,"true")}catch{}},[]),l=r!==null?r>=1e3?`${(r/1e3).toFixed(1)}k`:`${r}`:null;return{starCount:r,formattedCount:l,isDismissed:a,dismiss:o}},Z8="https://github.com/siteboon/claudecodeui";function X8({className:e}){return s.jsx("svg",{className:e,fill:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:s.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 J8(){const{formattedCount:e,isDismissed:t,dismiss:r}=Y8("siteboon","claudecodeui");return t?null:s.jsxs("div",{className:"group/star relative hidden md:block",children:[s.jsxs("a",{href:Z8,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:[s.jsx(X8,{className:"h-3.5 w-3.5"}),s.jsx(Xs,{className:"h-3 w-3"}),s.jsx("span",{className:"font-medium",children:"Star"}),e&&s.jsx("span",{className:"border-l border-border/50 pl-1.5 tabular-nums",children:e})]}),s.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:s.jsx(kt,{className:"h-2.5 w-2.5"})})]})}function Q8({isPWA:e,isMobile:t,isLoading:r,projectsCount:n,searchFilter:a,onSearchFilterChange:i,onClearSearchFilter:o,searchMode:l,onSearchModeChange:c,onRefresh:u,isRefreshing:d,onCreateProject:p,onCollapseSidebar:h,t:m}){const f=()=>s.jsxs("div",{className:"flex min-w-0 items-center gap-2.5",children:[s.jsx("div",{className:"flex h-7 w-7 flex-shrink-0 items-center justify-center rounded-lg bg-primary/90 shadow-sm",children:s.jsx("svg",{className:"h-3.5 w-3.5 text-primary-foreground",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2.2,strokeLinecap:"round",strokeLinejoin:"round",children:s.jsx("path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"})})}),s.jsx("h1",{className:"truncate text-sm font-semibold tracking-tight text-foreground",children:m("app.title")})]});return s.jsxs("div",{className:"flex-shrink-0",children:[s.jsxs("div",{className:"hidden px-3 pb-2 pt-3 md:block",style:{},children:[s.jsxs("div",{className:"flex items-center justify-between gap-2",children:[s.jsx(f,{}),s.jsxs("div",{className:"flex flex-shrink-0 items-center gap-0.5",children:[s.jsx(Be,{variant:"ghost",size:"sm",className:"h-7 w-7 rounded-lg p-0 text-muted-foreground hover:bg-accent/80 hover:text-foreground",onClick:u,disabled:d,title:m("tooltips.refresh"),children:s.jsx(mr,{className:`h-3.5 w-3.5 ${d?"animate-spin":""}`})}),s.jsx(Be,{variant:"ghost",size:"sm",className:"h-7 w-7 rounded-lg p-0 text-muted-foreground hover:bg-accent/80 hover:text-foreground",onClick:p,title:m("tooltips.createProject"),children:s.jsx(qt,{className:"h-3.5 w-3.5"})}),s.jsx(Be,{variant:"ghost",size:"sm",className:"h-7 w-7 rounded-lg p-0 text-muted-foreground hover:bg-accent/80 hover:text-foreground",onClick:h,title:m("tooltips.hideSidebar"),children:s.jsx(M7,{className:"h-3.5 w-3.5"})})]})]}),s.jsx(J8,{}),n>0&&!r&&s.jsxs("div",{className:"mt-2.5 space-y-2",children:[s.jsxs("div",{className:"flex rounded-lg bg-muted/50 p-0.5",children:[s.jsxs("button",{onClick:()=>c("projects"),"aria-pressed":l==="projects",className:Oe("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:[s.jsx(Br,{className:"h-3 w-3"}),m("search.modeProjects")]}),s.jsxs("button",{onClick:()=>c("conversations"),"aria-pressed":l==="conversations",className:Oe("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:[s.jsx(aa,{className:"h-3 w-3"}),m("search.modeConversations")]})]}),s.jsxs("div",{className:"relative",children:[s.jsx(On,{className:"pointer-events-none absolute left-3 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-muted-foreground/50"}),s.jsx(At,{type:"text",placeholder:m(l==="conversations"?"search.conversationsPlaceholder":"projects.searchPlaceholder"),value:a,onChange:g=>i(g.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&&s.jsx("button",{onClick:o,"aria-label":m("tooltips.clearSearch"),className:"absolute right-2.5 top-1/2 -translate-y-1/2 rounded-md p-0.5 hover:bg-accent",children:s.jsx(kt,{className:"h-3 w-3 text-muted-foreground"})})]})]})]}),s.jsx("div",{className:"nav-divider hidden md:block"}),s.jsxs("div",{className:"p-3 pb-2 md:hidden",style:e&&t?{paddingTop:"16px"}:{},children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx(f,{}),s.jsxs("div",{className:"flex flex-shrink-0 gap-1.5",children:[s.jsx("button",{className:"flex h-8 w-8 items-center justify-center rounded-lg bg-muted/50 transition-all active:scale-95",onClick:u,disabled:d,children:s.jsx(mr,{className:`h-4 w-4 text-muted-foreground ${d?"animate-spin":""}`})}),s.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:s.jsx(na,{className:"h-4 w-4"})})]})]}),n>0&&!r&&s.jsxs("div",{className:"mt-2.5 space-y-2",children:[s.jsxs("div",{className:"flex rounded-lg bg-muted/50 p-0.5",children:[s.jsxs("button",{onClick:()=>c("projects"),"aria-pressed":l==="projects",className:Oe("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:[s.jsx(Br,{className:"h-3 w-3"}),m("search.modeProjects")]}),s.jsxs("button",{onClick:()=>c("conversations"),"aria-pressed":l==="conversations",className:Oe("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:[s.jsx(aa,{className:"h-3 w-3"}),m("search.modeConversations")]})]}),s.jsxs("div",{className:"relative",children:[s.jsx(On,{className:"pointer-events-none absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground/50"}),s.jsx(At,{type:"text",placeholder:m(l==="conversations"?"search.conversationsPlaceholder":"projects.searchPlaceholder"),value:a,onChange:g=>i(g.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&&s.jsx("button",{onClick:o,"aria-label":m("tooltips.clearSearch"),className:"absolute right-2.5 top-1/2 -translate-y-1/2 rounded-md p-1 hover:bg-accent",children:s.jsx(kt,{className:"h-3.5 w-3.5 text-muted-foreground"})})]})]})]}),s.jsx("div",{className:"nav-divider md:hidden"})]})}const gb={xs:"w-3 h-3",sm:"w-4 h-4",md:"w-5 h-5",lg:"w-6 h-6"},eR={xs:"p-0.5",sm:"p-1",md:"p-1.5",lg:"p-2"},tR=e=>e==="fully-configured"?{icon:No,colorClassName:"text-green-500 dark:text-green-400",backgroundClassName:"bg-green-50 dark:bg-green-950",label:"TaskMaster Ready",title:"TaskMaster fully configured with MCP server"}:e==="taskmaster-only"?{icon:Et,colorClassName:"text-blue-500 dark:text-blue-400",backgroundClassName:"bg-blue-50 dark:bg-blue-950",label:"TaskMaster Init",title:"TaskMaster initialized, MCP server needs setup"}:e==="mcp-only"?{icon:Vi,colorClassName:"text-amber-500 dark:text-amber-400",backgroundClassName:"bg-amber-50 dark:bg-amber-950",label:"MCP Ready",title:"MCP server configured, TaskMaster needs initialization"}:{icon:kt,colorClassName:"text-gray-400 dark:text-gray-500",backgroundClassName:"bg-gray-50 dark:bg-gray-900",label:"No TaskMaster",title:"TaskMaster not configured"};function rR({status:e="not-configured",size:t="sm",className:r="",showLabel:n=!1}){const a=tR(e),i=a.icon;return n?s.jsxs("div",{className:Oe("inline-flex items-center gap-1.5 text-xs rounded-md px-2 py-1 transition-colors",a.backgroundClassName,a.colorClassName,r),title:a.title,children:[s.jsx(i,{className:gb[t]}),s.jsx("span",{className:"font-medium",children:a.label})]}):s.jsx("div",{className:Oe("inline-flex items-center justify-center rounded-full transition-colors",a.backgroundClassName,eR[t],r),title:a.title,children:s.jsx(i,{className:Oe(gb[t],a.colorClassName)})})}const bb=(e,t,r)=>{const n=new Date(e),a=t;if(isNaN(n.getTime()))return r?r("status.unknown"):"Unknown";const i=a.getTime()-n.getTime(),o=Math.floor(i/1e3),l=Math.floor(i/(1e3*60)),c=Math.floor(i/(1e3*60*60)),u=Math.floor(i/(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`:u===1?r?r("time.oneDayAgo"):"1 day ago":u<7?r?r("time.daysAgo",{count:u}):`${u} days ago`:n.toLocaleDateString()};function nR({project:e,session:t,selectedSession:r,currentTime:n,editingSession:a,editingSessionName:i,onEditingSessionNameChange:o,onStartEditingSession:l,onCancelEditingSession:c,onSaveEditingSession:u,onProjectSelect:d,onSessionSelect:p,onDeleteSession:h,t:m}){const f=J_(t,n,m),g=r?.id===t.id,v=()=>{d(e),p(t,e.name)},x=()=>{u(e.name,t.id,i,t.__provider)},y=()=>{h(e.name,t.id,f.sessionName,t.__provider)};return s.jsxs("div",{className:"group relative",children:[f.isActive&&s.jsx("div",{className:"absolute left-0 top-1/2 -translate-x-1 -translate-y-1/2 transform",children:s.jsx("div",{className:"h-2 w-2 animate-pulse rounded-full bg-green-500"})}),s.jsx("div",{className:"md:hidden",children:s.jsx("div",{className:Oe("p-2 mx-3 my-0.5 rounded-md bg-card border active:scale-[0.98] transition-all duration-150 relative",g?"bg-primary/5 border-primary/20":"",!g&&f.isActive?"border-green-500/30 bg-green-50/5 dark:bg-green-900/5":"border-border/30"),onClick:v,children:s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("div",{className:Oe("w-5 h-5 rounded-md flex items-center justify-center flex-shrink-0",g?"bg-primary/10":"bg-muted/50"),children:s.jsx(Or,{provider:t.__provider,className:"h-3 w-3"})}),s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsx("div",{className:"truncate text-xs font-medium text-foreground",children:f.sessionName}),s.jsxs("div",{className:"mt-0.5 flex items-center gap-1",children:[s.jsx(Li,{className:"h-2.5 w-2.5 text-muted-foreground"}),s.jsx("span",{className:"text-xs text-muted-foreground",children:bb(f.sessionTime,n,m)}),f.messageCount>0&&s.jsx(Lr,{variant:"secondary",className:"ml-auto px-1 py-0 text-xs",children:f.messageCount}),s.jsx("span",{className:"ml-1 opacity-70",children:s.jsx(Or,{provider:t.__provider,className:"h-3 w-3"})})]})]}),!f.isCursorSession&&s.jsx("button",{className:"ml-1 flex h-5 w-5 items-center justify-center rounded-md bg-red-50 opacity-70 transition-transform active:scale-95 dark:bg-red-900/20",onClick:w=>{w.stopPropagation(),y()},children:s.jsx(Vt,{className:"h-2.5 w-2.5 text-red-600 dark:text-red-400"})})]})})}),s.jsxs("div",{className:"hidden md:block",children:[s.jsx(Be,{variant:"ghost",className:Oe("w-full justify-start p-2 h-auto font-normal text-left hover:bg-accent/50 transition-colors duration-200",g&&"bg-accent text-accent-foreground"),onClick:()=>p(t,e.name),children:s.jsxs("div",{className:"flex w-full min-w-0 items-start gap-2",children:[s.jsx(Or,{provider:t.__provider,className:"mt-0.5 h-3 w-3 flex-shrink-0"}),s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsx("div",{className:"truncate text-xs font-medium text-foreground",children:f.sessionName}),s.jsxs("div",{className:"mt-0.5 flex items-center gap-1",children:[s.jsx(Li,{className:"h-2.5 w-2.5 text-muted-foreground"}),s.jsx("span",{className:"text-xs text-muted-foreground",children:bb(f.sessionTime,n,m)}),f.messageCount>0&&s.jsx(Lr,{variant:"secondary",className:"ml-auto px-1 py-0 text-xs transition-opacity group-hover:opacity-0",children:f.messageCount}),s.jsx("span",{className:"ml-1 opacity-70 transition-opacity group-hover:opacity-0",children:s.jsx(Or,{provider:t.__provider,className:"h-3 w-3"})})]})]})]})}),s.jsx("div",{className:"absolute right-2 top-1/2 flex -translate-y-1/2 transform items-center gap-1 opacity-0 transition-all duration-200 group-hover:opacity-100",children:a===t.id?s.jsxs(s.Fragment,{children:[s.jsx("input",{type:"text",value:i,onChange:w=>o(w.target.value),onKeyDown:w=>{w.stopPropagation(),w.key==="Enter"?x():w.key==="Escape"&&c()},onClick:w=>w.stopPropagation(),className:"w-32 rounded border border-border bg-background px-2 py-1 text-xs focus:outline-none focus:ring-1 focus:ring-primary",autoFocus:!0}),s.jsx("button",{className:"flex h-6 w-6 items-center justify-center rounded bg-green-50 hover:bg-green-100 dark:bg-green-900/20 dark:hover:bg-green-900/40",onClick:w=>{w.stopPropagation(),x()},title:m("tooltips.save"),children:s.jsx(Xt,{className:"h-3 w-3 text-green-600 dark:text-green-400"})}),s.jsx("button",{className:"flex h-6 w-6 items-center justify-center rounded bg-gray-50 hover:bg-gray-100 dark:bg-gray-900/20 dark:hover:bg-gray-900/40",onClick:w=>{w.stopPropagation(),c()},title:m("tooltips.cancel"),children:s.jsx(kt,{className:"h-3 w-3 text-gray-600 dark:text-gray-400"})})]}):s.jsxs(s.Fragment,{children:[s.jsx("button",{className:"flex h-6 w-6 items-center justify-center rounded bg-gray-50 hover:bg-gray-100 dark:bg-gray-900/20 dark:hover:bg-gray-900/40",onClick:w=>{w.stopPropagation(),l(t.id,f.sessionName)},title:m("tooltips.editSessionName"),children:s.jsx(z7,{className:"h-3 w-3 text-gray-600 dark:text-gray-400"})}),!f.isCursorSession&&s.jsx("button",{className:"flex h-6 w-6 items-center justify-center rounded bg-red-50 hover:bg-red-100 dark:bg-red-900/20 dark:hover:bg-red-900/40",onClick:w=>{w.stopPropagation(),y()},title:m("tooltips.deleteSession"),children:s.jsx(Vt,{className:"h-3 w-3 text-red-600 dark:text-red-400"})})]})})]})]})}function aR(){return s.jsx(s.Fragment,{children:Array.from({length:3}).map((e,t)=>s.jsx("div",{className:"rounded-md p-2",children:s.jsxs("div",{className:"flex items-start gap-2",children:[s.jsx("div",{className:"mt-0.5 h-3 w-3 animate-pulse rounded-full bg-muted"}),s.jsxs("div",{className:"flex-1 space-y-1",children:[s.jsx("div",{className:"h-3 animate-pulse rounded bg-muted",style:{width:`${60+t*15}%`}}),s.jsx("div",{className:"h-2 w-1/2 animate-pulse rounded bg-muted"})]})]})},t))})}function iR({project:e,isExpanded:t,sessions:r,selectedSession:n,initialSessionsLoaded:a,isLoadingSessions:i,currentTime:o,editingSession:l,editingSessionName:c,onEditingSessionNameChange:u,onStartEditingSession:d,onCancelEditingSession:p,onSaveEditingSession:h,onProjectSelect:m,onSessionSelect:f,onDeleteSession:g,onLoadMoreSessions:v,onNewSession:x,t:y}){if(!t)return null;const w=r.length>0,S=e.sessionMeta?.hasMore===!0;return s.jsxs("div",{className:"ml-3 space-y-1 border-l border-border pl-3",children:[s.jsx("div",{className:"px-3 pb-1 pt-1 md:hidden",children:s.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:()=>{m(e),x(e)},children:[s.jsx(qt,{className:"h-3 w-3"}),y("sessions.newSession")]})}),s.jsxs(Be,{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:()=>x(e),children:[s.jsx(qt,{className:"h-3 w-3"}),y("sessions.newSession")]}),a?!w&&!i?s.jsx("div",{className:"px-3 py-2 text-left",children:s.jsx("p",{className:"text-xs text-muted-foreground",children:y("sessions.noSessions")})}):r.map(E=>s.jsx(nR,{project:e,session:E,selectedSession:n,currentTime:o,editingSession:l,editingSessionName:c,onEditingSessionNameChange:u,onStartEditingSession:d,onCancelEditingSession:p,onSaveEditingSession:h,onProjectSelect:m,onSessionSelect:f,onDeleteSession:g,t:y},E.id)):s.jsx(aR,{}),w&&S&&s.jsx(Be,{variant:"ghost",size:"sm",className:"mt-2 w-full justify-center gap-2 text-muted-foreground",onClick:()=>v(e),disabled:i,children:i?s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"h-3 w-3 animate-spin rounded-full border border-muted-foreground border-t-transparent"}),y("sessions.loading")]}):s.jsxs(s.Fragment,{children:[s.jsx(pr,{className:"h-3 w-3"}),y("sessions.showMore")]})})]})}const sR=(e,t)=>{const r=e.length;return t&&r>=5?`${r}+`:`${r}`};function oR({project:e,selectedProject:t,selectedSession:r,isExpanded:n,isDeleting:a,isStarred:i,editingProject:o,editingName:l,sessions:c,initialSessionsLoaded:u,isLoadingSessions:d,currentTime:p,editingSession:h,editingSessionName:m,tasksEnabled:f,mcpServerStatus:g,onEditingNameChange:v,onToggleProject:x,onProjectSelect:y,onToggleStarProject:w,onStartEditingProject:S,onCancelEditingProject:E,onSaveProjectName:k,onDeleteProject:C,onSessionSelect:R,onDeleteSession:T,onLoadMoreSessions:I,onNewSession:M,onEditingSessionNameChange:_,onStartEditingSession:P,onCancelEditingSession:N,onSaveEditingSession:z,t:J}){const H=t?.name===e.name,K=o===e.name,q=e.sessionMeta?.hasMore===!0,L=sR(c,q),W=`${L} session${c.length===1?"":"s"}`,B=t8(e,g),O=()=>x(e.name),ee=()=>w(e.name),te=()=>{k(e.name)},ce=()=>{t?.name!==e.name&&y(e),O()};return s.jsxs("div",{className:Oe("md:space-y-1",a&&"opacity-50 pointer-events-none"),children:[s.jsxs("div",{className:"md:group group",children:[s.jsx("div",{className:"md:hidden",children:s.jsx("div",{className:Oe("p-3 mx-3 my-1 rounded-lg bg-card border border-border/50 active:scale-[0.98] transition-all duration-150",H&&"bg-primary/5 border-primary/20",i&&!H&&"bg-yellow-50/50 dark:bg-yellow-900/5 border-yellow-200/30 dark:border-yellow-800/30"),onClick:O,children:s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("div",{className:"flex min-w-0 flex-1 items-center gap-3",children:[s.jsx("div",{className:Oe("w-8 h-8 rounded-lg flex items-center justify-center transition-colors",n?"bg-primary/10":"bg-muted"),children:n?s.jsx(Mn,{className:"h-4 w-4 text-primary"}):s.jsx(Br,{className:"h-4 w-4 text-muted-foreground"})}),s.jsx("div",{className:"min-w-0 flex-1",children:K?s.jsx("input",{type:"text",value:l,onChange:ie=>v(ie.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:J("projects.projectNamePlaceholder"),autoFocus:!0,autoComplete:"off",onClick:ie=>ie.stopPropagation(),onKeyDown:ie=>{ie.key==="Enter"&&te(),ie.key==="Escape"&&E()},style:{fontSize:"16px",WebkitAppearance:"none",borderRadius:"8px"}}):s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"flex min-w-0 flex-1 items-center justify-between",children:[s.jsx("h3",{className:"truncate text-sm font-medium text-foreground",children:e.displayName}),f&&s.jsx(rR,{status:B,size:"xs",className:"ml-2 hidden flex-shrink-0 md:inline-flex"})]}),s.jsx("p",{className:"text-xs text-muted-foreground",children:W})]})})]}),s.jsx("div",{className:"flex items-center gap-1",children:K?s.jsxs(s.Fragment,{children:[s.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:ie=>{ie.stopPropagation(),te()},children:s.jsx(Xt,{className:"h-4 w-4 text-white"})}),s.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:ie=>{ie.stopPropagation(),E()},children:s.jsx(kt,{className:"h-4 w-4 text-white"})})]}):s.jsxs(s.Fragment,{children:[s.jsx("button",{className:Oe("w-8 h-8 rounded-lg flex items-center justify-center active:scale-90 transition-all duration-150 border",i?"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:ie=>{ie.stopPropagation(),ee()},title:J(i?"tooltips.removeFromFavorites":"tooltips.addToFavorites"),children:s.jsx(Xs,{className:Oe("w-4 h-4 transition-colors",i?"text-yellow-600 dark:text-yellow-400 fill-current":"text-gray-600 dark:text-gray-400")})}),s.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:ie=>{ie.stopPropagation(),C(e)},children:s.jsx(Vt,{className:"h-4 w-4 text-red-600 dark:text-red-400"})}),s.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:ie=>{ie.stopPropagation(),S(e)},children:s.jsx(Pi,{className:"h-4 w-4 text-primary"})}),s.jsx("div",{className:"flex h-6 w-6 items-center justify-center rounded-md bg-muted/30",children:n?s.jsx(pr,{className:"h-3 w-3 text-muted-foreground"}):s.jsx(Fr,{className:"h-3 w-3 text-muted-foreground"})})]})})]})})}),s.jsxs(Be,{variant:"ghost",className:Oe("hidden md:flex w-full justify-between p-2 h-auto font-normal hover:bg-accent/50",H&&"bg-accent text-accent-foreground",i&&!H&&"bg-yellow-50/50 dark:bg-yellow-900/10 hover:bg-yellow-100/50 dark:hover:bg-yellow-900/20"),onClick:ce,children:[s.jsxs("div",{className:"flex min-w-0 flex-1 items-center gap-3",children:[n?s.jsx(Mn,{className:"h-4 w-4 flex-shrink-0 text-primary"}):s.jsx(Br,{className:"h-4 w-4 flex-shrink-0 text-muted-foreground"}),s.jsx("div",{className:"min-w-0 flex-1 text-left",children:K?s.jsxs("div",{className:"space-y-1",children:[s.jsx("input",{type:"text",value:l,onChange:ie=>v(ie.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:J("projects.projectNamePlaceholder"),autoFocus:!0,onKeyDown:ie=>{ie.key==="Enter"&&te(),ie.key==="Escape"&&E()}}),s.jsx("div",{className:"truncate text-xs text-muted-foreground",title:e.fullPath,children:e.fullPath})]}):s.jsxs("div",{children:[s.jsx("div",{className:"truncate text-sm font-semibold text-foreground",title:e.displayName,children:e.displayName}),s.jsxs("div",{className:"text-xs text-muted-foreground",children:[L,e.fullPath!==e.displayName&&s.jsxs("span",{className:"ml-1 opacity-60",title:e.fullPath,children:[" - ",e.fullPath.length>25?`...${e.fullPath.slice(-22)}`:e.fullPath]})]})]})})]}),s.jsx("div",{className:"flex flex-shrink-0 items-center gap-1",children:K?s.jsxs(s.Fragment,{children:[s.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:ie=>{ie.stopPropagation(),te()},children:s.jsx(Xt,{className:"h-3 w-3"})}),s.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:ie=>{ie.stopPropagation(),E()},children:s.jsx(kt,{className:"h-3 w-3"})})]}):s.jsxs(s.Fragment,{children:[s.jsx("div",{className:Oe("w-6 h-6 opacity-0 group-hover:opacity-100 transition-all duration-200 flex items-center justify-center rounded cursor-pointer touch:opacity-100",i?"hover:bg-yellow-50 dark:hover:bg-yellow-900/20 opacity-100":"hover:bg-accent"),onClick:ie=>{ie.stopPropagation(),ee()},title:J(i?"tooltips.removeFromFavorites":"tooltips.addToFavorites"),children:s.jsx(Xs,{className:Oe("w-3 h-3 transition-colors",i?"text-yellow-600 dark:text-yellow-400 fill-current":"text-muted-foreground")})}),s.jsx("div",{className:"touch:opacity-100 flex h-6 w-6 cursor-pointer items-center justify-center rounded opacity-0 transition-all duration-200 hover:bg-accent group-hover:opacity-100",onClick:ie=>{ie.stopPropagation(),S(e)},title:J("tooltips.renameProject"),children:s.jsx(Pi,{className:"h-3 w-3"})}),s.jsx("div",{className:"touch:opacity-100 flex h-6 w-6 cursor-pointer items-center justify-center rounded opacity-0 transition-all duration-200 hover:bg-red-50 group-hover:opacity-100 dark:hover:bg-red-900/20",onClick:ie=>{ie.stopPropagation(),C(e)},title:J("tooltips.deleteProject"),children:s.jsx(Vt,{className:"h-3 w-3 text-red-600 dark:text-red-400"})}),n?s.jsx(pr,{className:"h-4 w-4 text-muted-foreground transition-colors group-hover:text-foreground"}):s.jsx(Fr,{className:"h-4 w-4 text-muted-foreground transition-colors group-hover:text-foreground"})]})})]})]}),s.jsx(iR,{project:e,isExpanded:n,sessions:c,selectedSession:r,initialSessionsLoaded:u,isLoadingSessions:d,currentTime:p,editingSession:h,editingSessionName:m,onEditingSessionNameChange:_,onStartEditingSession:P,onCancelEditingSession:N,onSaveEditingSession:z,onProjectSelect:y,onSessionSelect:R,onDeleteSession:T,onLoadMoreSessions:I,onNewSession:M,t:J})]})}function lR({isLoading:e,loadingProgress:t,projectsCount:r,filteredProjectsCount:n,t:a}){return e?s.jsxs("div",{className:"px-4 py-12 text-center md:py-8",children:[s.jsx("div",{className:"mx-auto mb-4 flex h-12 w-12 items-center justify-center rounded-lg bg-muted md:mb-3",children:s.jsx("div",{className:"h-6 w-6 animate-spin rounded-full border-2 border-muted-foreground border-t-transparent"})}),s.jsx("h3",{className:"mb-2 text-base font-medium text-foreground md:mb-1",children:a("projects.loadingProjects")}),t&&t.total>0?s.jsxs("div",{className:"space-y-2",children:[s.jsx("div",{className:"h-2 w-full overflow-hidden rounded-full bg-muted",children:s.jsx("div",{className:"h-full bg-primary transition-all duration-300 ease-out",style:{width:`${t.current/t.total*100}%`}})}),s.jsxs("p",{className:"text-sm text-muted-foreground",children:[t.current,"/",t.total," ",a("projects.projects")]}),t.currentProject&&s.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("/")})]}):s.jsx("p",{className:"text-sm text-muted-foreground",children:a("projects.fetchingProjects")})]}):r===0?s.jsxs("div",{className:"px-4 py-12 text-center md:py-8",children:[s.jsx("div",{className:"mx-auto mb-4 flex h-12 w-12 items-center justify-center rounded-lg bg-muted md:mb-3",children:s.jsx(Br,{className:"h-6 w-6 text-muted-foreground"})}),s.jsx("h3",{className:"mb-2 text-base font-medium text-foreground md:mb-1",children:a("projects.noProjects")}),s.jsx("p",{className:"text-sm text-muted-foreground",children:a("projects.runClaudeCli")})]}):n===0?s.jsxs("div",{className:"px-4 py-12 text-center md:py-8",children:[s.jsx("div",{className:"mx-auto mb-4 flex h-12 w-12 items-center justify-center rounded-lg bg-muted md:mb-3",children:s.jsx(On,{className:"h-6 w-6 text-muted-foreground"})}),s.jsx("h3",{className:"mb-2 text-base font-medium text-foreground md:mb-1",children:a("projects.noMatchingProjects")}),s.jsx("p",{className:"text-sm text-muted-foreground",children:a("projects.tryDifferentSearch")})]}):null}function cR({projects:e,filteredProjects:t,selectedProject:r,selectedSession:n,isLoading:a,loadingProgress:i,expandedProjects:o,editingProject:l,editingName:c,loadingSessions:u,initialSessionsLoaded:d,currentTime:p,editingSession:h,editingSessionName:m,deletingProjects:f,tasksEnabled:g,mcpServerStatus:v,getProjectSessions:x,isProjectStarred:y,onEditingNameChange:w,onToggleProject:S,onProjectSelect:E,onToggleStarProject:k,onStartEditingProject:C,onCancelEditingProject:R,onSaveProjectName:T,onDeleteProject:I,onSessionSelect:M,onDeleteSession:_,onLoadMoreSessions:P,onNewSession:N,onEditingSessionNameChange:z,onStartEditingSession:J,onCancelEditingSession:H,onSaveEditingSession:K,t:q}){const L=s.jsx(lR,{isLoading:a,loadingProgress:i,projectsCount:e.length,filteredProjectsCount:t.length,t:q});b.useEffect(()=>{let B="CloudCLI UI";const O=r?.displayName?.trim();O&&(B=`${O} - ${B}`),document.title=B},[r]);const W=!a&&e.length>0&&t.length>0;return s.jsx("div",{className:"pb-safe-area-inset-bottom md:space-y-1",children:W?t.map(B=>s.jsx(oR,{project:B,selectedProject:r,selectedSession:n,isExpanded:o.has(B.name),isDeleting:f.has(B.name),isStarred:y(B.name),editingProject:l,editingName:c,sessions:x(B),initialSessionsLoaded:d.has(B.name),isLoadingSessions:!!u[B.name],currentTime:p,editingSession:h,editingSessionName:m,tasksEnabled:g,mcpServerStatus:v,onEditingNameChange:w,onToggleProject:S,onProjectSelect:E,onToggleStarProject:k,onStartEditingProject:C,onCancelEditingProject:R,onSaveProjectName:T,onDeleteProject:I,onSessionSelect:M,onDeleteSession:_,onLoadMoreSessions:P,onNewSession:N,onEditingSessionNameChange:z,onStartEditingSession:J,onCancelEditingSession:H,onSaveEditingSession:K,t:q},B.name)):L})}function uR({snippet:e,highlights:t}){const r=[];let n=0;for(const a of t)a.start>n&&r.push(e.slice(n,a.start)),r.push(s.jsx("mark",{className:"rounded-sm bg-yellow-200 px-0.5 text-foreground dark:bg-yellow-800",children:e.slice(a.start,a.end)},a.start)),n=a.end;return n<e.length&&r.push(e.slice(n)),s.jsx("span",{className:"text-xs leading-relaxed text-muted-foreground",children:r})}function dR({isPWA:e,isMobile:t,isLoading:r,projects:n,searchFilter:a,onSearchFilterChange:i,onClearSearchFilter:o,searchMode:l,onSearchModeChange:c,conversationResults:u,isSearching:d,searchProgress:p,onConversationResultClick:h,onRefresh:m,isRefreshing:f,onCreateProject:g,onCollapseSidebar:v,updateAvailable:x,releaseInfo:y,latestVersion:w,currentVersion:S,onShowVersionModal:E,onShowSettings:k,projectListProps:C,t:R}){const T=l==="conversations"&&a.trim().length>=2,I=u&&u.results.length>0;return s.jsxs("div",{className:"flex h-full flex-col bg-background/80 backdrop-blur-sm md:w-72 md:select-none",style:{},children:[s.jsx(Q8,{isPWA:e,isMobile:t,isLoading:r,projectsCount:n.length,searchFilter:a,onSearchFilterChange:i,onClearSearchFilter:o,searchMode:l,onSearchModeChange:c,onRefresh:m,isRefreshing:f,onCreateProject:g,onCollapseSidebar:v,t:R}),s.jsx(uf,{className:"flex-1 overflow-y-auto overscroll-contain md:px-1.5 md:py-2",children:T?d&&!I?s.jsxs("div",{className:"px-4 py-12 text-center md:py-8",children:[s.jsx("div",{className:"mx-auto mb-4 flex h-12 w-12 items-center justify-center rounded-lg bg-muted md:mb-3",children:s.jsx("div",{className:"h-6 w-6 animate-spin rounded-full border-2 border-muted-foreground border-t-transparent"})}),s.jsx("p",{className:"text-sm text-muted-foreground",children:R("search.searching")}),p&&s.jsxs("p",{className:"mt-1 text-xs text-muted-foreground/60",children:[R("search.projectsScanned",{count:p.scannedProjects}),"/",p.totalProjects]})]}):!d&&u&&u.results.length===0?s.jsxs("div",{className:"px-4 py-12 text-center md:py-8",children:[s.jsx("div",{className:"mx-auto mb-4 flex h-12 w-12 items-center justify-center rounded-lg bg-muted md:mb-3",children:s.jsx(On,{className:"h-6 w-6 text-muted-foreground"})}),s.jsx("h3",{className:"mb-2 text-base font-medium text-foreground md:mb-1",children:R("search.noResults")}),s.jsx("p",{className:"text-sm text-muted-foreground",children:R("search.tryDifferentQuery")})]}):I?s.jsxs("div",{className:"space-y-3 px-2",children:[s.jsxs("div",{className:"flex items-center justify-between px-1",children:[s.jsx("p",{className:"text-xs text-muted-foreground",children:R("search.matches",{count:u.totalMatches})}),d&&p&&s.jsxs("div",{className:"flex items-center gap-1.5",children:[s.jsx("div",{className:"h-3 w-3 animate-spin rounded-full border-[1.5px] border-muted-foreground/40 border-t-primary"}),s.jsxs("p",{className:"text-[10px] text-muted-foreground/60",children:[p.scannedProjects,"/",p.totalProjects]})]})]}),d&&p&&s.jsx("div",{className:"mx-1 h-0.5 overflow-hidden rounded-full bg-muted",children:s.jsx("div",{className:"h-full rounded-full bg-primary/60 transition-all duration-300",style:{width:`${Math.round(p.scannedProjects/p.totalProjects*100)}%`}})}),u.results.map(M=>s.jsxs("div",{className:"space-y-1",children:[s.jsxs("div",{className:"flex items-center gap-1.5 px-1 py-1",children:[s.jsx(Br,{className:"h-3 w-3 flex-shrink-0 text-muted-foreground"}),s.jsx("span",{className:"truncate text-xs font-medium text-foreground",children:M.projectDisplayName})]}),M.sessions.map(_=>s.jsxs("button",{className:"w-full rounded-md px-2 py-2 text-left transition-colors hover:bg-accent/50",onClick:()=>h(M.projectName,_.sessionId,_.provider||_.matches[0]?.provider||"claude",_.matches[0]?.timestamp,_.matches[0]?.snippet),children:[s.jsxs("div",{className:"mb-1 flex items-center gap-1.5",children:[s.jsx(aa,{className:"h-3 w-3 flex-shrink-0 text-primary"}),s.jsx("span",{className:"truncate text-xs font-medium text-foreground",children:_.sessionSummary}),_.provider&&_.provider!=="claude"&&s.jsx("span",{className:"flex-shrink-0 rounded bg-muted px-1 py-0.5 text-[9px] uppercase text-muted-foreground",children:_.provider})]}),s.jsx("div",{className:"space-y-1 pl-4",children:_.matches.map((P,N)=>s.jsxs("div",{className:"flex items-start gap-1",children:[s.jsx("span",{className:"mt-0.5 flex-shrink-0 text-[10px] font-medium uppercase text-muted-foreground/60",children:P.role==="user"?"U":"A"}),s.jsx(uR,{snippet:P.snippet,highlights:P.highlights})]},N))})]},`${M.projectName}-${_.sessionId}`))]},M.projectName))]}):null:s.jsx(cR,{...C})}),s.jsx(V8,{updateAvailable:x,releaseInfo:y,latestVersion:w,currentVersion:S,onShowVersionModal:E,onShowSettings:k,t:R})]})}const pR={fontSize:"14"},os={authenticated:!1,email:null,loading:!0,error:null},xb={name:"",type:"stdio",scope:"user",projectPath:"",config:{command:"",args:[],env:{},url:"",headers:{},timeout:3e4},importMode:"form",jsonInput:""},yb={name:"",type:"stdio",config:{command:"",args:[],env:{}}},mR={allowedCommands:[],disallowedCommands:[],skipPermissions:!1},hR={claude:"/api/cli/claude/status",cursor:"/api/cli/cursor/status",codex:"/api/cli/codex/status",gemini:"/api/cli/gemini/status"},OE=e=>e==="sse"||e==="http"?e:"stdio",fR=e=>e==="local"?"local":"user",gR=e=>e instanceof Error?e.message:"Unknown error",bR=e=>({name:e.name||"",type:OE(e.type),scope:fR(e.scope),projectPath:e.projectPath||"",config:{command:e.config?.command||"",args:e.config?.args||[],env:e.config?.env||{},url:e.config?.url||"",headers:e.config?.headers||{},timeout:e.config?.timeout||3e4},importMode:"form",jsonInput:"",raw:e.raw});function xR({isOpen:e,editingServer:t,projects:r,onClose:n,onSubmit:a}){const{t:i}=Le("settings"),[o,l]=b.useState(xb),[c,u]=b.useState(""),[d,p]=b.useState(!1),h=!!t;b.useEffect(()=>{if(e){if(u(""),t){l(bR(t));return}l(xb)}},[t,e]);const m=b.useMemo(()=>o.name.trim()?o.importMode==="json"?!!o.jsonInput.trim()&&!c:o.scope==="local"&&!o.projectPath.trim()?!1:o.type==="stdio"?!!o.config.command.trim():!!o.config.url.trim():!1,[o,c]);if(!e)return null;const f=(x,y)=>{l(w=>({...w,config:{...w.config,[x]:y}}))},g=x=>{if(!x.trim()){u("");return}try{const y=JSON.parse(x);y.type?y.type==="stdio"&&!y.command?u(i("mcpForm.validation.stdioRequiresCommand")):(y.type==="http"||y.type==="sse")&&!y.url?u(i("mcpForm.validation.httpRequiresUrl",{type:y.type})):u(""):u(i("mcpForm.validation.missingType"))}catch{u(i("mcpForm.validation.invalidJson"))}},v=async x=>{x.preventDefault(),p(!0);try{await a(o,t)}catch(y){alert(`Error: ${gR(y)}`)}finally{p(!1)}};return s.jsx("div",{className:"fixed inset-0 z-[110] flex items-center justify-center bg-black/50 p-4",children:s.jsxs("div",{className:"max-h-[90vh] w-full max-w-2xl overflow-y-auto rounded-lg border border-border bg-background",children:[s.jsxs("div",{className:"flex items-center justify-between border-b border-border p-4",children:[s.jsx("h3",{className:"text-lg font-medium text-foreground",children:i(h?"mcpForm.title.edit":"mcpForm.title.add")}),s.jsx(Be,{variant:"ghost",size:"sm",onClick:n,children:s.jsx(kt,{className:"h-4 w-4"})})]}),s.jsxs("form",{onSubmit:v,className:"space-y-4 p-4",children:[!h&&s.jsxs("div",{className:"mb-4 flex gap-2",children:[s.jsx("button",{type:"button",onClick:()=>l(x=>({...x,importMode:"form"})),className:`rounded-lg px-4 py-2 font-medium transition-colors ${o.importMode==="form"?"bg-blue-600 text-white":"bg-gray-100 text-gray-700 hover:bg-gray-200 dark:bg-gray-800 dark:text-gray-300 dark:hover:bg-gray-700"}`,children:i("mcpForm.importMode.form")}),s.jsx("button",{type:"button",onClick:()=>l(x=>({...x,importMode:"json"})),className:`rounded-lg px-4 py-2 font-medium transition-colors ${o.importMode==="json"?"bg-blue-600 text-white":"bg-gray-100 text-gray-700 hover:bg-gray-200 dark:bg-gray-800 dark:text-gray-300 dark:hover:bg-gray-700"}`,children:i("mcpForm.importMode.json")})]}),o.importMode==="form"&&h&&s.jsxs("div",{className:"rounded-lg border border-gray-200 bg-gray-50 p-3 dark:border-gray-700 dark:bg-gray-900/50",children:[s.jsx("label",{className:"mb-2 block text-sm font-medium text-foreground",children:i("mcpForm.scope.label")}),s.jsxs("div",{className:"flex items-center gap-2",children:[o.scope==="user"?s.jsx($a,{className:"h-4 w-4"}):s.jsx(Mn,{className:"h-4 w-4"}),s.jsx("span",{className:"text-sm",children:o.scope==="user"?i("mcpForm.scope.userGlobal"):i("mcpForm.scope.projectLocal")}),o.scope==="local"&&o.projectPath&&s.jsxs("span",{className:"text-xs text-muted-foreground",children:["- ",o.projectPath]})]}),s.jsx("p",{className:"mt-2 text-xs text-muted-foreground",children:i("mcpForm.scope.cannotChange")})]}),o.importMode==="form"&&!h&&s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{children:[s.jsxs("label",{className:"mb-2 block text-sm font-medium text-foreground",children:[i("mcpForm.scope.label")," *"]}),s.jsxs("div",{className:"flex gap-2",children:[s.jsx("button",{type:"button",onClick:()=>l(x=>({...x,scope:"user",projectPath:""})),className:`flex-1 rounded-lg px-4 py-2 font-medium transition-colors ${o.scope==="user"?"bg-blue-600 text-white":"bg-gray-100 text-gray-700 hover:bg-gray-200 dark:bg-gray-800 dark:text-gray-300 dark:hover:bg-gray-700"}`,children:s.jsxs("div",{className:"flex items-center justify-center gap-2",children:[s.jsx($a,{className:"h-4 w-4"}),s.jsx("span",{children:i("mcpForm.scope.userGlobal")})]})}),s.jsx("button",{type:"button",onClick:()=>l(x=>({...x,scope:"local"})),className:`flex-1 rounded-lg px-4 py-2 font-medium transition-colors ${o.scope==="local"?"bg-blue-600 text-white":"bg-gray-100 text-gray-700 hover:bg-gray-200 dark:bg-gray-800 dark:text-gray-300 dark:hover:bg-gray-700"}`,children:s.jsxs("div",{className:"flex items-center justify-center gap-2",children:[s.jsx(Mn,{className:"h-4 w-4"}),s.jsx("span",{children:i("mcpForm.scope.projectLocal")})]})})]}),s.jsx("p",{className:"mt-2 text-xs text-muted-foreground",children:o.scope==="user"?i("mcpForm.scope.userDescription"):i("mcpForm.scope.projectDescription")})]}),o.scope==="local"&&s.jsxs("div",{children:[s.jsxs("label",{className:"mb-2 block text-sm font-medium text-foreground",children:[i("mcpForm.fields.selectProject")," *"]}),s.jsxs("select",{value:o.projectPath,onChange:x=>{l(y=>({...y,projectPath:x.target.value}))},className:"w-full rounded-lg border border-gray-300 bg-gray-50 px-3 py-2 text-gray-900 focus:border-blue-500 focus:ring-blue-500 dark:border-gray-600 dark:bg-gray-800 dark:text-gray-100",required:!0,children:[s.jsxs("option",{value:"",children:[i("mcpForm.fields.selectProject"),"..."]}),r.map(x=>s.jsx("option",{value:x.path||x.fullPath,children:x.displayName||x.name},x.name))]}),o.projectPath&&s.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:i("mcpForm.projectPath",{path:o.projectPath})})]})]}),s.jsxs("div",{className:"grid grid-cols-1 gap-4 md:grid-cols-2",children:[s.jsxs("div",{className:o.importMode==="json"?"md:col-span-2":"",children:[s.jsxs("label",{className:"mb-2 block text-sm font-medium text-foreground",children:[i("mcpForm.fields.serverName")," *"]}),s.jsx(At,{value:o.name,onChange:x=>l(y=>({...y,name:x.target.value})),placeholder:i("mcpForm.placeholders.serverName"),required:!0})]}),o.importMode==="form"&&s.jsxs("div",{children:[s.jsxs("label",{className:"mb-2 block text-sm font-medium text-foreground",children:[i("mcpForm.fields.transportType")," *"]}),s.jsxs("select",{value:o.type,onChange:x=>{l(y=>({...y,type:OE(x.target.value)}))},className:"w-full rounded-lg border border-gray-300 bg-gray-50 px-3 py-2 text-gray-900 focus:border-blue-500 focus:ring-blue-500 dark:border-gray-600 dark:bg-gray-800 dark:text-gray-100",children:[s.jsx("option",{value:"stdio",children:"stdio"}),s.jsx("option",{value:"sse",children:"SSE"}),s.jsx("option",{value:"http",children:"HTTP"})]})]})]}),h&&!!o.raw&&o.importMode==="form"&&s.jsxs("div",{className:"rounded-lg border border-gray-200 bg-gray-50 p-4 dark:border-gray-700 dark:bg-gray-900/50",children:[s.jsx("h4",{className:"mb-2 text-sm font-medium text-foreground",children:i("mcpForm.configDetails",{configFile:t?.scope==="global"?"~/.claude.json":"project config"})}),s.jsx("pre",{className:"overflow-x-auto rounded bg-gray-100 p-3 text-xs dark:bg-gray-800",children:JSON.stringify(o.raw,null,2)})]}),o.importMode==="json"&&s.jsx("div",{className:"space-y-4",children:s.jsxs("div",{children:[s.jsxs("label",{className:"mb-2 block text-sm font-medium text-foreground",children:[i("mcpForm.fields.jsonConfig")," *"]}),s.jsx("textarea",{value:o.jsonInput,onChange:x=>{const y=x.target.value;l(w=>({...w,jsonInput:y})),g(y)},className:`w-full border px-3 py-2 ${c?"border-red-500":"border-gray-300 dark:border-gray-600"} rounded-lg bg-gray-50 font-mono text-sm text-gray-900 focus:border-blue-500 focus:ring-blue-500 dark:bg-gray-800 dark:text-gray-100`,rows:8,placeholder:`{
670
670
  "type": "stdio",
671
671
  "command": "/path/to/server",
672
672
  "args": ["--api-key", "abc123"],
package/dist/index.html CHANGED
@@ -25,7 +25,7 @@
25
25
 
26
26
  <!-- Prevent zoom on iOS -->
27
27
  <meta name="format-detection" content="telephone=no" />
28
- <script type="module" crossorigin src="/assets/index-Cdn2Scm1.js"></script>
28
+ <script type="module" crossorigin src="/assets/index-BOWaxSnV.js"></script>
29
29
  <link rel="modulepreload" crossorigin href="/assets/vendor-react-D7WwDXvu.js">
30
30
  <link rel="modulepreload" crossorigin href="/assets/vendor-codemirror-NA4v81it.js">
31
31
  <link rel="modulepreload" crossorigin href="/assets/vendor-xterm-CJZjLICi.js">
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cloudcli-ai/cloudcli",
3
- "version": "1.29.0",
3
+ "version": "1.29.1",
4
4
  "description": "A web-based UI for Claude Code CLI",
5
5
  "type": "module",
6
6
  "main": "server/index.js",
package/server/cli.js CHANGED
@@ -448,7 +448,7 @@ async function sandboxCommand(args) {
448
448
  } catch { /* might already be running */ }
449
449
 
450
450
  console.log(`${c.info('▶')} Launching CloudCLI web server...`);
451
- sbx(['exec', '-d', opts.name, 'bash', '-c', '. ~/.cloudcli-start.sh']);
451
+ sbx(['exec', '-d', opts.name, 'cloudcli', 'start', '--port', '3001']);
452
452
 
453
453
  console.log(`${c.info('▶')} Forwarding port ${opts.port} → 3001...`);
454
454
  try {
@@ -548,14 +548,11 @@ async function sandboxCommand(args) {
548
548
  }
549
549
  }
550
550
 
551
- // Step 3: Start CloudCLI
551
+ // Step 3: Start CloudCLI as a long-running detached exec session.
552
+ // Using -d with a long-running command (cloudcli start never exits)
553
+ // keeps the exec session alive, which keeps the sandbox running.
552
554
  console.log(`${c.info('▶')} Launching CloudCLI web server...`);
553
- try {
554
- sbx(['exec', '-d', opts.name, 'bash', '-c', '. ~/.cloudcli-start.sh']);
555
- } catch (e) {
556
- console.error(`${c.error('❌')} Failed to start CloudCLI: ${e.message}`);
557
- process.exit(1);
558
- }
555
+ sbx(['exec', '-d', opts.name, 'cloudcli', 'start', '--port', '3001']);
559
556
 
560
557
  // Step 4: Forward port
561
558
  console.log(`${c.info('▶')} Forwarding port ${opts.port} → 3001...`);
@@ -582,10 +579,11 @@ async function sandboxCommand(args) {
582
579
  console.log(`\n${c.ok('✔')} ${c.bright('CloudCLI is ready!')}`);
583
580
  console.log(` ${c.info('→')} Open ${c.bright(`http://localhost:${opts.port}`)}`);
584
581
  console.log(`\n${c.dim(' Manage with:')}`);
585
- console.log(` ${c.dim('$')} cloudcli sandbox ls`);
586
- console.log(` ${c.dim('$')} cloudcli sandbox stop ${opts.name}`);
587
- console.log(` ${c.dim('$')} cloudcli sandbox start ${opts.name}`);
588
- console.log(` ${c.dim('$')} cloudcli sandbox rm ${opts.name}\n`);
582
+ console.log(` ${c.dim('$')} sbx ls`);
583
+ console.log(` ${c.dim('$')} sbx stop ${opts.name}`);
584
+ console.log(` ${c.dim('$')} sbx start ${opts.name}`);
585
+ console.log(` ${c.dim('$')} sbx rm ${opts.name}`);
586
+ console.log(`\n${c.dim(' Or install globally:')} npm install -g @cloudcli-ai/cloudcli\n`);
589
587
  break;
590
588
  }
591
589