@cloudcli-ai/cloudcli 1.31.0 → 1.31.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -164,7 +164,7 @@ CloudCLI has a plugin system that lets you add custom tabs with their own fronte
164
164
  |---|---|
165
165
  | **[Project Stats](https://github.com/cloudcli-ai/cloudcli-plugin-starter)** | Shows file counts, lines of code, file-type breakdown, largest files, and recently modified files for your current project |
166
166
  | **[Web Terminal](https://github.com/cloudcli-ai/cloudcli-plugin-terminal)** | Full xterm.js terminal with multi-tab support|
167
-
167
+ | **[CloudCLI Scheduler](https://github.com/grostim/cloudcli-cron)** | Create workspace-scoped scheduled prompts and execute them through a local CLI such as Codex, Claude Code, or Gemini CLI|
168
168
  ### Build Your Own
169
169
 
170
170
  **[Plugin Starter Template →](https://github.com/cloudcli-ai/cloudcli-plugin-starter)** — fork this repo to create your own plugin. It includes a working example with frontend rendering, live context updates, and RPC communication to a backend server.
@@ -676,7 +676,7 @@ import{j as s,_ as jA,a as _A,m as xE,E as jr,R as yE,o as vE,T as kE,P as wE,S
676
676
  .xterm-screen:focus {
677
677
  outline: none !important;
678
678
  }
679
- `;function B_(){if(typeof document>"u"||document.getElementById(_b))return;const e=document.createElement("style");e.id=_b,e.type="text/css",e.innerText=z_,document.head.appendChild(e)}function $_({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]=g.useState(!1),f=g.useRef(null),b=a?.fullPath||a?.path||"",x=!!a;g.useEffect(()=>{B_()},[]);const y=g.useCallback(()=>{t.current&&(t.current.clear(),t.current.write("\x1B[2J\x1B[H"))},[t]),v=g.useCallback(()=>{t.current&&(t.current.dispose(),t.current=null),r.current=null,m(!1)},[r,t]);return g.useEffect(()=>{if(!e.current||!x||o||t.current)return;const k=new L_.Terminal(C_);t.current=k;const S=new R_.FitAddon;r.current=S,k.loadAddon(S),i||k.loadAddon(new M_.WebLinksAddon);try{k.loadAddon(new O_.WebglAddon)}catch{console.warn("[Shell] WebGL renderer unavailable, using Canvas fallback")}k.open(e.current);const E=async()=>{const N=k.getSelection();return N?Jr(N):!1},w=N=>{if(!k.hasSelection())return;const j=k.getSelection();if(j){if(N.preventDefault(),N.clipboardData){N.clipboardData.setData("text/plain",j);return}Jr(j)}};e.current.addEventListener("copy",w),k.attachCustomKeyEventHandler(N=>{const j=eC(l.current)?JE:u.current;return N.type==="keydown"&&i&&c.current&&j&&!N.ctrlKey&&!N.metaKey&&!N.altKey&&N.key?.toLowerCase()==="c"?(N.preventDefault(),N.stopPropagation(),d(j),!1):N.type==="keydown"&&(N.ctrlKey||N.metaKey)&&N.key?.toLowerCase()==="c"&&k.hasSelection()?(N.preventDefault(),N.stopPropagation(),E(),!1):N.type==="keydown"&&(N.ctrlKey||N.metaKey)&&N.key?.toLowerCase()==="v"?(N.preventDefault(),N.stopPropagation(),typeof navigator<"u"&&navigator.clipboard?.readText&&navigator.clipboard.readText().then(D=>{na(n.current,{type:"input",data:D})}).catch(()=>{}),!1):!0}),window.setTimeout(()=>{const N=r.current,j=t.current;!N||!j||(N.fit(),na(n.current,{type:"resize",cols:j.cols,rows:j.rows}))},QE),m(!0);const I=k.onData(N=>{na(n.current,{type:"input",data:N})}),_=new ResizeObserver(()=>{f.current!==null&&window.clearTimeout(f.current),f.current=window.setTimeout(()=>{const N=r.current,j=t.current;!N||!j||(N.fit(),na(n.current,{type:"resize",cols:j.cols,rows:j.rows}))},y_)});return _.observe(e.current),()=>{e.current?.removeEventListener("copy",w),_.disconnect(),f.current!==null&&(window.clearTimeout(f.current),f.current=null),I.dispose(),p(),v()}},[u,p,d,v,r,l,c,o,i,x,b,e,t,n]),{isInitialized:h,clearTerminalScreen:y,disposeTerminal:v}}function U_({selectedProject:e,selectedSession:t,initialCommand:r,isPlainShell:n,minimal:a,autoConnect:i,isRestarting:o,onProcessComplete:l,onOutputRef:c}){const u=g.useRef(null),d=g.useRef(null),p=g.useRef(null),h=g.useRef(null),[m,f]=g.useState(""),[b,x]=g.useState(0),y=g.useRef(e),v=g.useRef(t),k=g.useRef(r),S=g.useRef(n),E=g.useRef(l),w=g.useRef(""),I=g.useRef(t?.id??null);g.useEffect(()=>{y.current=e,v.current=t,k.current=r,S.current=n,E.current=l},[e,t,r,n,l]);const _=g.useCallback(G=>{w.current=G,f(G),x(O=>O+1)},[]),N=g.useCallback(()=>{const G=h.current;G&&((G.readyState===WebSocket.OPEN||G.readyState===WebSocket.CONNECTING)&&G.close(),h.current=null)},[]),j=g.useCallback((G=w.current)=>{if(!G)return!1;const O=window.open(G,"_blank");if(O){try{O.opener=null}catch{}return!0}return!1},[]),D=g.useCallback(async(G=w.current)=>G?Jr(G):!1,[]),{isInitialized:A,clearTerminalScreen:L,disposeTerminal:C}=$_({terminalContainerRef:u,terminalRef:d,fitAddonRef:p,wsRef:h,selectedProject:e,minimal:a,isRestarting:o,initialCommandRef:k,isPlainShellRef:S,authUrlRef:w,copyAuthUrlToClipboard:D,closeSocket:N}),{isConnected:z,isConnecting:Y,connectToShell:V,disconnectFromShell:W}=__({wsRef:h,terminalRef:d,fitAddonRef:p,selectedProjectRef:y,selectedSessionRef:v,initialCommandRef:k,isPlainShellRef:S,onProcessCompleteRef:E,isInitialized:A,autoConnect:i,closeSocket:N,clearTerminalScreen:L,setAuthUrl:_,onOutputRef:c});return g.useEffect(()=>{o&&(W(),C())},[W,C,o]),g.useEffect(()=>{e||(W(),C())},[W,C,e]),g.useEffect(()=>{const G=t?.id??null;I.current!==G&&A&&W(),I.current=G},[W,A,t?.id]),{terminalContainerRef:u,terminalRef:d,wsRef:h,isConnected:z,isInitialized:A,isConnecting:Y,authUrl:m,authUrlVersion:b,connectToShell:V,disconnectFromShell:W,openAuthUrlInBrowser:j,copyAuthUrlToClipboard:D}}function G_({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 q_({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 H_({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 V_({terminalContainerRef:e,authUrl:t,authUrlVersion:r,initialCommand:n,isConnected:a,openAuthUrlInBrowser:i,copyAuthUrlToClipboard:o}){const[l,c]=g.useState("idle"),[u,d]=g.useState(!1),p=g.useMemo(()=>P_(n,t),[t,n]);g.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:b=>b.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 b=await o(p);c(b?"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 W_=[{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"}],K_={up:LE,down:Lo,left:lI,right:Nf},gi=e=>e.preventDefault(),Rb="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",Y_="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",yl="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 Db({wsRef:e,terminalRef:t,isConnected:r,bottomOffset:n="bottom-0"}){const{t:a}=Le("settings"),[i,o]=g.useState(!1),[l,c]=g.useState(!1),u=g.useCallback(m=>{na(e.current,{type:"input",data:m})},[e]),d=g.useCallback(()=>{t.current?.scrollToBottom()},[t]),p=g.useCallback(async()=>{if(!(typeof navigator>"u"||!navigator.clipboard?.readText))try{const m=await navigator.clipboard.readText();m.length>0&&u(m)}catch{}},[u]),h=g.useCallback(m=>{let f=m;if(i&&m.length===1){const b=m.toLowerCase().charCodeAt(0);b>=97&&b<=122&&(f=String.fromCharCode(b-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:gi,onClick:()=>{p()},disabled:!r,className:yl,title:a("terminalShortcuts.paste",{defaultValue:"Paste"}),"aria-label":a("terminalShortcuts.paste",{defaultValue:"Paste"}),children:s.jsx(YI,{className:"h-4 w-4"})}),W_.map(m=>{if(m.type==="modifier"){const f=m.modifier==="ctrl"?i:l,b=m.modifier==="ctrl"?()=>o(x=>!x):()=>c(x=>!x);return s.jsx("button",{type:"button",onPointerDown:gi,onClick:b,disabled:!r,className:f?Y_:Rb,children:m.label},m.id)}if(m.type==="arrow"){const f=K_[m.icon];return s.jsx("button",{type:"button",onPointerDown:gi,onClick:()=>u(m.sequence),disabled:!r,className:yl,children:s.jsx(f,{className:"h-4 w-4"})},m.id)}return s.jsx("button",{type:"button",onPointerDown:gi,onClick:()=>h(m.sequence),disabled:!r,className:Rb,children:m.label},m.id)}),s.jsx("button",{type:"button",onPointerDown:gi,onClick:d,disabled:!r,className:yl,title:a("terminalShortcuts.scrollDown"),"aria-label":a("terminalShortcuts.scrollDown"),children:s.jsx(iI,{className:"h-4 w-4"})})]})})}function tC({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]=g.useState(!1),[p,h]=g.useState(null),m=g.useRef(null),f=g.useRef(null),{terminalContainerRef:b,terminalRef:x,wsRef:y,isConnected:v,isInitialized:k,isConnecting:S,authUrl:E,authUrlVersion:w,connectToShell:I,disconnectFromShell:_,openAuthUrlInBrowser:N,copyAuthUrlToClipboard:j}=U_({selectedProject:e,selectedSession:t,initialCommand:r,isPlainShell:n,minimal:i,autoConnect:o,isRestarting:u,onProcessComplete:a,onOutputRef:f}),D=g.useCallback(()=>{const B=x.current;if(!B)return;const P=B.buffer.active,te=P.baseY+P.cursorY,K=Math.min(P.baseY+P.length-1,te+10),ie=Math.max(0,te-k_),ae=[];for(let Te=ie;Te<=K;Te++){const Re=P.getLine(Te);Re&&ae.push(Re.translateToString().trimEnd())}let he=-1;for(let Te=ae.length-1;Te>=0;Te--)if(/esc to cancel/i.test(ae[Te])||/enter to select/i.test(ae[Te])){he=Te;break}if(he===-1){h(null);return}const ge=new Map,ke=Math.max(0,he-w_);for(let Te=he-1;Te>=ke;Te--){const Re=ae[Te].match(/^\s*[❯›>]?\s*(\d+)\.\s+(.+)/);if(Re){const M=Re[1],de=Re[2].trim();parseInt(M,10)<=S_&&de.length>0&&!ge.has(M)&&ge.set(M,de)}}const xe=[];for(let Te=1;Te<=ge.size&&ge.has(String(Te));Te++)xe.push({number:String(Te),label:ge.get(String(Te))});h(xe.length>=E_?xe:null)},[x]),A=g.useCallback(()=>{m.current&&clearTimeout(m.current),m.current=setTimeout(D,v_)},[D]);g.useEffect(()=>{f.current=A},[A]),g.useEffect(()=>()=>{m.current&&clearTimeout(m.current)},[]),g.useEffect(()=>{v||(m.current&&(clearTimeout(m.current),m.current=null),h(null))},[v]),g.useEffect(()=>{if(!l||!k||!v)return;const B=()=>{x.current?.focus()},P=window.requestAnimationFrame(B),te=window.setTimeout(B,0);return()=>{window.cancelAnimationFrame(P),window.clearTimeout(te)}},[l,v,k,x]);const L=g.useCallback(B=>{na(y.current,{type:"input",data:B})},[y]),C=g.useMemo(()=>F_(t),[t]),z=g.useMemo(()=>C?C.slice(0,30):null,[C]),Y=g.useMemo(()=>C?C.slice(0,50):null,[C]),V=g.useCallback(()=>{d(!0),window.setTimeout(()=>{d(!1)},x_)},[]);if(!e)return s.jsx(q_,{title:c("shell.selectProject.title"),description:c("shell.selectProject.description")});if(i)return s.jsxs(s.Fragment,{children:[s.jsx(V_,{terminalContainerRef:b,authUrl:E,authUrlVersion:w,initialCommand:r,isConnected:v,openAuthUrlInBrowser:N,copyAuthUrlToClipboard:j}),s.jsx(Db,{wsRef:y,terminalRef:x,isConnected:v,bottomOffset:"bottom-0"})]});const W=n?c("shell.runCommand",{command:r||c("shell.defaultCommand"),projectName:e.displayName}):t?c("shell.resumeSession",{displayName:Y}):c("shell.startSession"),G=n?c("shell.runCommand",{command:r||c("shell.defaultCommand"),projectName:e.displayName}):c("shell.startCli",{projectName:e.displayName}),O=k?S?"connecting":v?null:"connect":"loading",$=O==="connecting"?G:W;return s.jsxs("div",{className:"flex h-full w-full flex-col bg-gray-900",children:[s.jsx(H_,{isConnected:v,isInitialized:k,isRestarting:u,hasSession:!!t,sessionDisplayNameShort:z,onDisconnect:_,onRestart:V,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||v}),s.jsxs("div",{className:"relative flex-1 overflow-hidden p-2",children:[s.jsx("div",{ref:b,className:"h-full w-full focus:outline-none",style:{outline:"none"}}),O&&s.jsx(G_,{mode:O,description:$,loadingLabel:c("shell.loading"),connectLabel:c("shell.actions.connect"),connectTitle:c("shell.actions.connectTitle"),connectingLabel:c("shell.connecting"),onConnect:I}),p&&v&&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:()=>{L(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:()=>{L("\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(Db,{wsRef:y,terminalRef:x,isConnected:v})]})}function Z_({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 X_({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 rC({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]=g.useState(!1),b=n!==null?n:r!==null,x=g.useCallback(y=>{f(!0),o?.(y)},[o]);return e?s.jsxs("div",{className:`flex h-full w-full flex-col ${u}`,children:[!h&&d&&c&&s.jsx(X_,{title:c,isCompleted:m,onClose:l}),s.jsx("div",{className:"min-h-0 w-full flex-1",children:s.jsx(tC,{selectedProject:e,selectedSession:t,initialCommand:r,isPlainShell:b,isActive:a,onProcessComplete:x,minimal:h,autoConnect:h?!0:i})})]}):s.jsx(Z_,{className:u})}const J_=({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"),Q_=e=>e==="claude"?"Claude CLI Login":e==="cursor"?"Cursor CLI Login":e==="codex"?"Codex CLI Login":"Gemini CLI Configuration";function nC({isOpen:e,onClose:t,provider:r="claude",onComplete:n,customCommand:a,isAuthenticated:i=!1}){if(!e)return null;const o=J_({provider:r,customCommand:a,isAuthenticated:i}),l=Q_(r),c=u=>{n?.(u)};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:l}),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(xt,{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(H7,{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(Lr,{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(rC,{project:W6,command:o,onComplete:c,minimal:!0})})]})})}const eR=({className:e="w-5 h-5"})=>s.jsx("img",{src:"/icons/claude-ai-icon.svg",alt:"Claude",className:e}),tR=({className:e="w-5 h-5"})=>{const{isDarkMode:t}=ei();return s.jsx("img",{src:t?"/icons/codex-white.svg":"/icons/codex.svg",alt:"Codex",className:e})},rR=({className:e="w-5 h-5"})=>{const{isDarkMode:t}=ei();return s.jsx("img",{src:t?"/icons/cursor-white.svg":"/icons/cursor.svg",alt:"Cursor",className:e})},nR=({className:e="w-5 h-5"})=>s.jsx("img",{src:"/icons/gemini-ai-icon.svg",alt:"Gemini",className:e});function Qr({provider:e="claude",className:t="w-5 h-5"}){return e==="cursor"?s.jsx(rR,{className:t}):e==="codex"?s.jsx(tR,{className:t}):e==="gemini"?s.jsx(nR,{className:t}):s.jsx(eR,{className:t})}function aR({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(Qr,{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(Wt,{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 iR=[{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 sR({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:iR.map(r=>s.jsx(aR,{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 oR({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(cr,{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(i_,{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(tj,{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 Mb=[{title:"Git Configuration",icon:cr,required:!0},{title:"Connect Agents",icon:GE,required:!1}];function lR({currentStep:e}){return s.jsx("div",{className:"mb-8",children:s.jsx("div",{className:"flex items-center justify-between",children:Mb.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(Wt,{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<Mb.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 Ob=/^[^\s@]+@[^\s@]+\.[^\s@]+$/,Lb=async(e,t)=>{try{return(await e.json()).error||t}catch{return t}};function cR({onComplete:e}){const[t,r]=g.useState(0),[n,a]=g.useState(""),[i,o]=g.useState(""),[l,c]=g.useState(!1),[u,d]=g.useState(""),[p,h]=g.useState(null),{providerAuthStatus:m,checkProviderAuthStatus:f,refreshProviderAuthStatuses:b}=XE(),x=g.useRef(void 0),y=g.useCallback(async()=>{try{const _=await Ie("/api/user/git-config");if(!_.ok)return;const N=await _.json();N.gitName&&a(N.gitName),N.gitEmail&&o(N.gitEmail)}catch(_){console.error("Error loading git config:",_)}},[]);g.useEffect(()=>{y(),b()},[y,b]),g.useEffect(()=>{const _=x.current;x.current=p,_!=null&&p===null&&b()},[p,b]);const v=_=>{h(_)},k=_=>{_===0&&p&&f(p)},S=async()=>{if(d(""),t!==0){r(_=>_+1);return}if(!n.trim()||!i.trim()){d("Both git name and email are required.");return}if(!Ob.test(i)){d("Please enter a valid email address.");return}c(!0);try{const _=await Ie("/api/user/git-config",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({gitName:n,gitEmail:i})});if(!_.ok){const N=await Lb(_,"Failed to save git configuration");throw new Error(N)}r(N=>N+1)}catch(_){d(_ instanceof Error?_.message:"Failed to save git configuration")}finally{c(!1)}},E=()=>{d(""),r(_=>_-1)},w=async()=>{c(!0),d("");try{const _=await Ie("/api/user/complete-onboarding",{method:"POST"});if(!_.ok){const N=await Lb(_,"Failed to complete onboarding");throw new Error(N)}await e?.()}catch(_){d(_ instanceof Error?_.message:"Failed to complete onboarding")}finally{c(!1)}},I=t===0?!!(n.trim()&&i.trim()&&Ob.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(lR,{currentStep:t}),s.jsxs("div",{className:"rounded-lg border border-border bg-card p-8 shadow-lg",children:[t===0?s.jsx(oR,{gitName:n,gitEmail:i,isSubmitting:l,onGitNameChange:a,onGitEmailChange:o}):s.jsx(sR,{providerStatuses:m,onOpenProviderLogin:v}),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:E,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(Tf,{className:"h-4 w-4"}),"Previous"]}),s.jsx("div",{className:"flex items-center gap-3",children:t<1?s.jsx("button",{onClick:S,disabled:!I||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(wr,{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:w,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(wr,{className:"h-4 w-4 animate-spin"}),"Completing..."]}):s.jsxs(s.Fragment,{children:[s.jsx(Wt,{className:"h-4 w-4"}),"Complete Setup"]})})})]})]})]})}),p&&s.jsx(nC,{isOpen:!!p,onClose:()=>h(null),provider:p,onComplete:k})]})}const uR=["0s","0.1s","0.2s"];function dR(){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(zn,{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:uR.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 aC({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 Pi({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 iC({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(zn,{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 pR={username:"",password:""};function mR(){const{t:e}=Le("auth"),{login:t}=Qi(),[r,n]=g.useState(pR),[a,i]=g.useState(""),[o,l]=g.useState(!1),c=g.useCallback((d,p)=>{n(h=>({...h,[d]:p}))},[]),u=g.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(iC,{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(Pi,{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(Pi,{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(aC,{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 hR={username:"",password:"",confirmPassword:""};function fR(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 gR(){const{register:e}=Qi(),[t,r]=g.useState(hR),[n,a]=g.useState(""),[i,o]=g.useState(!1),l=g.useCallback((u,d)=>{r(p=>({...p,[u]:d}))},[]),c=g.useCallback(async u=>{u.preventDefault(),a("");const d=fR(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(iC,{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(Pi,{id:"username",name:"username",label:"Username",value:t.username,onChange:u=>l("username",u),placeholder:"Enter your username",isDisabled:i,autoComplete:"username"}),s.jsx(Pi,{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(Pi,{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(aC,{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 bR({children:e}){const{user:t,isLoading:r,needsSetup:n,hasCompletedOnboarding:a,refreshOnboardingStatus:i}=Qi();return r?s.jsx(dR,{}):n?s.jsx(gR,{}):t?a?s.jsx(s.Fragment,{children:e}):s.jsx(cR,{onComplete:i}):s.jsx(mR,{})}const sC=g.createContext(null),oC=()=>{const e=g.useContext(sC);if(!e)throw new Error("useWebSocket must be used within a WebSocketProvider");return e},xR=e=>{const t=window.location.protocol==="https:"?"wss:":"ws:";return e?`${t}//${window.location.host}/ws?token=${encodeURIComponent(e)}`:null},yR=()=>{const e=g.useRef(null),t=g.useRef(!1),r=g.useRef(!1),[n,a]=g.useState(null),[i,o]=g.useState(!1),l=g.useRef(null),{token:c}=Qi();g.useEffect(()=>(u(),()=>{t.current=!0,l.current&&clearTimeout(l.current),e.current&&e.current.close()}),[c]);const u=g.useCallback(()=>{if(!t.current)try{const h=xR(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 b=JSON.parse(f.data);a(b)}catch(b){console.error("Error parsing WebSocket message:",b)}},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=g.useCallback(h=>{const m=e.current;m&&m.readyState===WebSocket.OPEN?m.send(JSON.stringify(h)):console.warn("WebSocket not connected")},[]);return g.useMemo(()=>({ws:e.current,sendMessage:d,latestMessage:n,isConnected:i}),[d,n,i])},vR=({children:e})=>{const t=yR();return s.jsx(sC.Provider,{value:t,children:e})},lC=g.createContext(null);function kR(e,t){return{message:t instanceof Error?t.message:`Failed to ${e}`,context:e,timestamp:new Date().toISOString()}}function Ca(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 wR(e){return e.find(t=>t.status==="pending"||t.status==="in-progress")??null}function SR(e){return e?.type?e.type.startsWith("taskmaster-"):!1}function ti(){const e=g.useContext(lC);if(!e)throw new Error("useTaskMaster must be used within a TaskMasterProvider");return e}function ER({children:e}){const{latestMessage:t}=oC(),{user:r,token:n,isLoading:a}=Qi(),[i,o]=g.useState([]),[l,c]=g.useState(null),[u,d]=g.useState(null),[p,h]=g.useState(null),[m,f]=g.useState([]),[b,x]=g.useState(null),[y,v]=g.useState(!1),[k,S]=g.useState(!1),[E,w]=g.useState(!1),[I,_]=g.useState(null),N=g.useRef(null),j=g.useRef(null),D=g.useRef(0);g.useEffect(()=>{N.current=l?.projectId??null},[l?.projectId]),g.useEffect(()=>{j.current=u},[u]);const A=g.useCallback(()=>{_(null)},[]),L=g.useCallback(($,B)=>{console.error(`TaskMaster ${$} error:`,B),_(kR($,B))},[]),C=g.useCallback(($,B)=>{d(B),o(P=>P.map(te=>te.projectId!==$?te:Ca({...te,taskmaster:B??void 0}))),c(P=>!P||P.projectId!==$?P:Ca({...P,taskmaster:B??void 0}))},[]),z=g.useCallback(async $=>{if(!$||!r||!n)return;const B=++D.current;try{const P=await tt.projectTaskmaster($);if(!P.ok)throw new Error(`Failed to fetch TaskMaster details: ${P.status}`);const K=(await P.json()).taskmaster??null;if(B!==D.current||N.current!==$)return;C($,K)}catch(P){if(B!==D.current||N.current!==$)return;L("load selected project TaskMaster info",P)}},[C,L,n,r]),Y=g.useCallback($=>{const B=$?Ca($):null;if(c(B),d(B?.taskmaster??null),f([]),x(null),!B?.projectId){D.current+=1;return}z(B.projectId)},[z]),V=g.useCallback(async()=>{if(!r||!n){o([]),c(null),d(null),f([]),x(null);return}try{v(!0),A();const $=await tt.get("/projects");if(!$.ok)throw new Error(`Failed to fetch projects: ${$.status}`);const B=await $.json(),te=(Array.isArray(B)?B:[]).map(he=>Ca(he));o(he=>{const ge=new Map(he.filter(ke=>!!ke.taskmaster).map(ke=>[ke.projectId,ke.taskmaster]));return te.map(ke=>{const xe=ge.get(ke.projectId);return xe?Ca({...ke,taskmaster:xe}):ke})});const K=N.current;if(!K)return;const ie=te.find(he=>he.projectId===K)??null;if(!ie){D.current+=1,c(null),d(null),f([]),x(null);return}const ae=ie.taskmaster??j.current??null;c(ae?Ca({...ie,taskmaster:ae}):ie),d(ae),z(K)}catch($){L("load projects",$)}finally{v(!1)}},[A,L,z,n,r]),W=g.useCallback(async()=>{const $=l?.projectId;if(!$||!r||!n){f([]),x(null);return}try{S(!0),A();const B=await tt.get(`/taskmaster/tasks/${encodeURIComponent($)}`);if(!B.ok){const K=await B.json();throw new Error(K.message??"Failed to load tasks")}const P=await B.json(),te=Array.isArray(P.tasks)?P.tasks:[];f(te),x(wR(te))}catch(B){L("load tasks",B),f([]),x(null)}finally{S(!1)}},[A,l?.projectId,L,n,r]),G=g.useCallback(async()=>{if(!r||!n){h(null);return}try{w(!0),A();const $=await tt.get("/mcp-utils/taskmaster-server");if(!$.ok)throw new Error(`Failed to load MCP status: ${$.status}`);const B=await $.json();h(B)}catch($){L("check MCP server status",$),h(null)}finally{w(!1)}},[A,L,n,r]);g.useEffect(()=>{!a&&r&&n&&(V(),G())},[a,G,V,n,r]),g.useEffect(()=>{l?.projectId&&r&&n&&W()},[l?.projectId,W,n,r]),g.useEffect(()=>{const $=t;if(SR($)){if($.type==="taskmaster-project-updated"&&$.projectId){$.projectId===N.current&&z($.projectId),V();return}if($.type==="taskmaster-tasks-updated"&&$.projectId===l?.projectId){W();return}$.type==="taskmaster-mcp-status-changed"&&G()}},[l?.projectId,t,z,G,V,W]);const O=g.useMemo(()=>({projects:i,currentProject:l,projectTaskMaster:u,mcpServerStatus:p,tasks:m,nextTask:b,isLoading:y,isLoadingTasks:k,isLoadingMCP:E,error:I,refreshProjects:V,setCurrentProject:Y,refreshTasks:W,refreshMCPStatus:G,clearError:A}),[A,l,I,y,E,k,p,b,u,i,G,V,W,Y,m]);return s.jsx(lC.Provider,{value:O,children:e})}const cC=g.createContext({tasksEnabled:!0,setTasksEnabled:()=>{},toggleTasksEnabled:()=>{},isTaskMasterInstalled:null,isTaskMasterReady:null,installationStatus:null,isCheckingInstallation:!0}),Bo=()=>{const e=g.useContext(cC);if(!e)throw new Error("useTasksSettings must be used within a TasksSettingsProvider");return e},CR=({children:e})=>{const[t,r]=g.useState(()=>{const m=localStorage.getItem("tasks-enabled");return m!==null?JSON.parse(m):!0}),[n,a]=g.useState(null),[i,o]=g.useState(null),[l,c]=g.useState(null),[u,d]=g.useState(!0);g.useEffect(()=>{localStorage.setItem("tasks-enabled",JSON.stringify(t))},[t]),g.useEffect(()=>{setTimeout(async()=>{try{const f=await tt.get("/taskmaster/installation-status");if(f.ok){const b=await f.json();c(b),a(b.installation?.isInstalled||!1),o(b.isReady||!1);const x=localStorage.getItem("tasks-enabled");!b.installation?.isInstalled&&!x&&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(cC.Provider,{value:h,children:e})},uC=g.createContext(null);function $o(){const e=g.useContext(uC);if(!e)throw new Error("usePlugins must be used within a PluginsProvider");return e}function NR({children:e}){const[t,r]=g.useState([]),[n,a]=g.useState(!0),[i,o]=g.useState(null),l=g.useCallback(async()=>{try{const h=await Ie("/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)}},[]);g.useEffect(()=>{l()},[l]);const c=g.useCallback(async h=>{try{const m=await Ie("/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=g.useCallback(async h=>{try{const m=await Ie(`/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=g.useCallback(async h=>{try{const m=await Ie(`/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=g.useCallback(async(h,m)=>{try{const f=await Ie(`/api/plugins/${encodeURIComponent(h)}/enable`,{method:"PUT",body:JSON.stringify({enabled:m})});if(!f.ok){let b=`Toggle failed (${f.status})`;try{const x=await f.json();b=x.details||x.error||b}catch{b=f.statusText||b}return{success:!1,error:b}}return await l(),{success:!0,error:null}}catch(f){return{success:!1,error:f instanceof Error?f.message:"Toggle failed"}}},[l]);return s.jsx(uC.Provider,{value:{plugins:t,loading:n,pluginsError:i,refreshPlugins:l,installPlugin:c,uninstallPlugin:u,updatePlugin:d,togglePlugin:p},children:e})}const Pb=e=>typeof window>"u"?!1:window.innerWidth<e,Fb=()=>{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 Mf(e={}){const{mobileBreakpoint:t=768,trackMobile:r=!0,trackPWA:n=!0}=e,[a,i]=g.useState(()=>r?Pb(t):!1),[o,l]=g.useState(()=>n?Fb():!1);return g.useEffect(()=>{if(!r||typeof window>"u")return;const c=()=>{i(Pb(t))};return c(),window.addEventListener("resize",c),()=>{window.removeEventListener("resize",c)}},[t,r]),g.useEffect(()=>{if(!n||typeof window>"u")return;const c=window.matchMedia("(display-mode: standalone)"),u=()=>{l(Fb())};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 zb="1.31.0",TR=(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},dC=(e,t)=>{const[r,n]=g.useState(!1),[a,i]=g.useState(null),[o,l]=g.useState(null),[c,u]=g.useState("git");return g.useEffect(()=>{(async()=>{try{const h=await(await fetch("/health")).json();(h.installMode==="npm"||h.installMode==="git")&&u(h.installMode)}catch{}})()},[]),g.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(TR(f,zb)>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:zb,releaseInfo:o,installMode:c}},ea={autoExpandTools:!1,showRawParameters:!1,showThinking:!0,autoScrollToBottom:!0,sendByCtrlEnter:!1,sidebarVisible:!0},uo=Object.keys(ea),AR=new Set(uo),vl="ui-preferences:sync",po=(e,t)=>{if(typeof e=="boolean")return e;if(typeof e=="string"){if(e==="true")return!0;if(e==="false")return!1}return t},IR=(e,t)=>{try{const r=localStorage.getItem(e);if(r===null)return t;const n=JSON.parse(r);return po(n,t)}catch{return t}},jR=e=>{if(typeof window>"u")return ea;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 uo.reduce((a,i)=>(a[i]=po(n[i],ea[i]),a),{...ea})}}}catch{}return uo.reduce((t,r)=>(t[r]=IR(r,ea[r]),t),{...ea})};function _R(e,t){switch(t.type){case"set":{const{key:r,value:n}=t;if(!AR.has(r))return e;const a=po(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 uo){if(!(i in r))continue;const o=r[i],l=po(o,e[i]);a[i]!==l&&(a[i]=l,n=!0)}return n?a:e}case"reset":return{...ea,...t.value||{}};default:return e}}function Of(e="uiPreferences"){const t=g.useRef(`ui-preferences-${Math.random().toString(36).slice(2)}`),[r,n]=g.useReducer(_R,e,jR);return g.useEffect(()=>{typeof window>"u"||(localStorage.setItem(e,JSON.stringify(r)),window.dispatchEvent(new CustomEvent(vl,{detail:{storageKey:e,sourceId:t.current,value:r}})))},[r,e]),g.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(vl,u),()=>{window.removeEventListener("storage",c),window.removeEventListener(vl,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 RR=()=>{try{const e=localStorage.getItem("claude-settings");return e&&JSON.parse(e).projectSortOrder==="date"?"date":"name"}catch{return"name"}},pC="starredProjects",DR=()=>{try{const e=localStorage.getItem(pC);if(!e)return[];const t=JSON.parse(e);return Array.isArray(t)?t.map(r=>String(r).trim()).filter(r=>r.length>0):[]}catch{return[]}},MR=()=>{try{localStorage.removeItem(pC)}catch{}},mo=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),OR=(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"),LR=e=>e.__provider==="cursor"?String(e.createdAt||""):e.__provider==="codex"?String(e.createdAt||e.lastActivity||""):String(e.lastActivity||e.createdAt||""),PR=(e,t,r)=>{const n=mo(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:OR(e,r),sessionTime:LR(e),messageCount:Number(e.messageCount||0)}},mC=e=>{const t=[...e.sessions||[]].map(i=>({...i,__provider:"claude"})),r=(e.cursorSessions||[]).map(i=>({...i,__provider:"cursor"})),n=(e.codexSessions||[]).map(i=>({...i,__provider:"codex"})),a=(e.geminiSessions||[]).map(i=>({...i,__provider:"gemini"}));return[...t,...r,...n,...a].sort((i,o)=>mo(o).getTime()-mo(i).getTime())},Bb=e=>{const t=mC(e);return t.length===0?new Date(0):t.reduce((r,n)=>{const a=mo(n);return a>r?a:r},new Date(0))},FR=(e,t)=>{const r=[...e];return r.sort((n,a)=>{const i=!!n.isStarred,o=!!a.isStarred;return i&&!o?-1:!i&&o?1:t==="date"?Bb(a).getTime()-Bb(n).getTime():(n.displayName||n.projectId).localeCompare(a.displayName||a.projectId)}),r},zR=(e,t)=>{const r=t.trim().toLowerCase();return r?e.filter(n=>{const a=(n.displayName||n.projectId).toLowerCase(),i=(n.path||n.fullPath||"").toLowerCase();return a.includes(r)||i.includes(r)}):e},BR=(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"},$R=e=>{const t=typeof e.fullPath=="string"&&e.fullPath.length>0?e.fullPath:typeof e.path=="string"?e.path:"";return{name:e.projectId,displayName:typeof e.displayName=="string"&&e.displayName.trim().length>0?e.displayName:e.projectId,fullPath:t,path:typeof e.path=="string"&&e.path.length>0?e.path:t}};function UR({projects:e,selectedProject:t,selectedSession:r,isLoading:n,isMobile:a,t:i,onRefresh:o,onProjectSelect:l,onSessionSelect:c,onSessionDelete:u,onLoadMoreSessions:d,onProjectDelete:p,setCurrentProject:h,setSidebarVisible:m,sidebarVisible:f}){const[b,x]=g.useState(new Set),[y,v]=g.useState(null),[k,S]=g.useState(!1),[E,w]=g.useState(""),[I,_]=g.useState(new Set),[N,j]=g.useState(new Date),[D,A]=g.useState("name"),[L,C]=g.useState(!1),[z,Y]=g.useState(null),[V,W]=g.useState(""),[G,O]=g.useState(""),[$,B]=g.useState(new Set),[P,te]=g.useState(null),[K,ie]=g.useState(null),[ae,he]=g.useState(!1),[ge,ke]=g.useState("projects"),[xe,Te]=g.useState(null),[Re,M]=g.useState(!1),[de,oe]=g.useState(null),[H,q]=g.useState(""),[re,me]=g.useState(new Map),[pe,se]=g.useState(new Set),ye=g.useRef(0),J=g.useRef(null),Q=g.useRef(new Map),Z=g.useRef(!1),le=g.useRef(o),fe=!a&&!f;g.useEffect(()=>{const ue=setInterval(()=>{j(new Date)},6e4);return()=>clearInterval(ue)},[]),g.useEffect(()=>{_(new Set)},[e]),g.useEffect(()=>{const ue=t?.projectId;ue&&x(Se=>{if(Se.has(ue))return Se;const we=new Set(Se);return we.add(ue),we})},[t?.projectId]),g.useEffect(()=>{if(e.length>0&&!n){const ue=new Set;e.forEach(Se=>{Se.sessions&&Se.sessions.length>=0&&ue.add(Se.projectId)}),_(ue)}},[e,n]),g.useEffect(()=>{const ue=()=>{A(RR())};ue();const Se=Me=>{Me.key==="claude-settings"&&ue()};window.addEventListener("storage",Se);const we=setInterval(()=>{document.hasFocus()&&ue()},1e3);return()=>{window.removeEventListener("storage",Se),clearInterval(we)}},[]),g.useEffect(()=>{le.current=o},[o]),g.useEffect(()=>{if(Z.current)return;const ue=DR();if(ue.length===0)return;Z.current=!0,(async()=>{try{await tt.migrateLegacyProjectStars(ue),await le.current()}catch(we){console.error("[Sidebar] Failed to migrate legacy starred projects:",we)}finally{MR()}})()},[o]),g.useEffect(()=>{me(ue=>{if(ue.size===0)return ue;const Se=new Map(ue);let we=!1;for(const[Me,at]of ue.entries()){const lt=e.find(ct=>ct.projectId===Me);if(!lt){Se.delete(Me),we=!0;continue}!!lt.isStarred===at&&(Se.delete(Me),we=!0)}return we?Se:ue})},[e]),g.useEffect(()=>{const ue=setTimeout(()=>{q(G.trim())},300);return()=>{clearTimeout(ue)}},[G]),g.useEffect(()=>{J.current&&(J.current.close(),J.current=null);const ue=H;if(ge!=="conversations"||ue.length<2){ye.current+=1,Te(null),oe(null),M(!1);return}M(!0);const Se=++ye.current;if(Se!==ye.current)return;const we=tt.searchConversationsUrl(ue),Me=new EventSource(we);J.current=Me;const at=[];let lt=0;return Me.addEventListener("result",ct=>{if(Se!==ye.current){Me.close();return}try{const Ot=JSON.parse(ct.data);at.push(Ot.projectResult),lt=Ot.totalMatches,Te({results:[...at],totalMatches:lt,query:ue}),oe({scannedProjects:Ot.scannedProjects,totalProjects:Ot.totalProjects})}catch{}}),Me.addEventListener("progress",ct=>{if(Se!==ye.current){Me.close();return}try{const Ot=JSON.parse(ct.data);lt=Ot.totalMatches,oe({scannedProjects:Ot.scannedProjects,totalProjects:Ot.totalProjects})}catch{}}),Me.addEventListener("done",()=>{if(Se!==ye.current){Me.close();return}Me.close(),J.current=null,M(!1),oe(null),at.length===0&&Te({results:[],totalMatches:0,query:ue})}),Me.addEventListener("error",()=>{if(Se!==ye.current){Me.close();return}Me.close(),J.current=null,M(!1),oe(null),at.length===0&&Te({results:[],totalMatches:0,query:ue})}),()=>{J.current&&(J.current.close(),J.current=null)}},[H,ge]);const De=g.useCallback(ue=>{x(Se=>{const we=new Set;return Se.has(ue)||we.add(ue),we})},[]),$e=g.useCallback((ue,Se)=>{c({...ue,__projectId:Se})},[c]),Qe=g.useCallback(ue=>re.has(ue)?!!re.get(ue):e.some(Se=>Se.projectId===ue&&!!Se.isStarred),[re,e]),Xe=g.useCallback(ue=>{const Se=Qe(ue),we=!Se,Me=(Q.current.get(ue)??0)+1;Q.current.set(ue,Me),me(lt=>{const ct=new Map(lt);return ct.set(ue,we),ct}),(async()=>{try{const lt=await tt.toggleProjectStar(ue);if(!lt.ok){const Yt=(await lt.json()).error,Sn=typeof Yt=="string"?Yt:Yt&&typeof Yt=="object"&&Yt.message?Yt.message:i("messages.updateProjectError");throw new Error(Sn)}const ct=await lt.json();if(!(Q.current.get(ue)===Me))return;me(Nr=>{const Yt=new Map(Nr);return Yt.set(ue,!!ct.isStarred),Yt})}catch(lt){if(!(Q.current.get(ue)===Me))return;me(Ot=>{const Nr=new Map(Ot);return Nr.set(ue,Se),Nr}),console.error("[Sidebar] Failed to toggle project star:",lt),alert(i("messages.updateProjectError"))}})()},[Qe,i]),Ge=g.useCallback(ue=>Qe(ue),[Qe]),it=g.useCallback(ue=>mC(ue),[]),pt=g.useCallback(async ue=>{if(!d)return;let Se=!1;if(se(we=>{if(we.has(ue))return we;Se=!0;const Me=new Set(we);return Me.add(ue),Me}),!!Se)try{await d(ue)}catch(we){console.error("[Sidebar] Failed to load more sessions:",we),alert(i("messages.refreshError"))}finally{se(we=>{const Me=new Set(we);return Me.delete(ue),Me})}},[d,i]),Je=g.useMemo(()=>re.size===0?e:e.map(ue=>{const Se=re.get(ue.projectId);return Se===void 0||!!ue.isStarred===Se?ue:{...ue,isStarred:Se}}),[re,e]),bt=g.useMemo(()=>FR(Je,D),[D,Je]),ht=g.useMemo(()=>zR(bt,H),[H,bt]),yt=g.useCallback(ue=>{v(ue.projectId),w(ue.displayName)},[]),vt=g.useCallback(()=>{v(null),w("")},[]),_e=g.useCallback(async ue=>{try{(await tt.renameProject(ue,E)).ok?window.refreshProjects?await window.refreshProjects():window.location.reload():console.error("Failed to rename project")}catch(Se){console.error("Error renaming project:",Se)}finally{v(null),w("")}},[E]),Ve=g.useCallback((ue,Se,we,Me="claude")=>{ie({projectId:ue,sessionId:Se,sessionTitle:we,provider:Me})},[]),We=g.useCallback(async()=>{if(!K)return;const{sessionId:ue}=K;ie(null);try{const Se=await tt.deleteSession(ue);if(Se.ok)u?.(ue);else{const we=await Se.text();console.error("[Sidebar] Failed to delete session:",{status:Se.status,error:we}),alert(i("messages.deleteSessionFailed"))}}catch(Se){console.error("[Sidebar] Error deleting session:",Se),alert(i("messages.deleteSessionError"))}},[u,K,i]),dt=g.useCallback(ue=>{te({project:ue,sessionCount:it(ue).length})},[it]),et=g.useCallback(async(ue=!1)=>{if(!P)return;const{project:Se}=P;te(null),B(we=>new Set([...we,Se.projectId]));try{const we=await tt.deleteProject(Se.projectId,ue);if(we.ok)p?.(Se.projectId);else{const at=(await we.json()).error,lt=typeof at=="string"?at:at&&typeof at=="object"&&at.message?at.message:i("messages.deleteProjectFailed");alert(lt)}}catch(we){console.error("Error deleting project:",we),alert(i("messages.deleteProjectError"))}finally{B(we=>{const Me=new Set(we);return Me.delete(Se.projectId),Me})}},[P,p,i]),mt=g.useCallback(ue=>{l(ue),h(ue)},[l,h]),Er=g.useCallback(async()=>{C(!0);try{await o()}finally{C(!1)}},[o]),nr=g.useCallback(async(ue,Se,we,Me)=>{const at=we.trim();if(!at){Y(null),W("");return}try{const lt=await tt.renameSession(Se,at);lt.ok?await o():(console.error("[Sidebar] Failed to rename session:",lt.status),alert(i("messages.renameSessionFailed")))}catch(lt){console.error("[Sidebar] Error renaming session:",lt),alert(i("messages.renameSessionError"))}finally{Y(null),W("")}},[o,i]),Cr=g.useCallback(()=>{m(!1)},[m]),mr=g.useCallback(()=>{m(!0)},[m]);return{isSidebarCollapsed:fe,expandedProjects:b,editingProject:y,showNewProject:k,editingName:E,initialSessionsLoaded:I,currentTime:N,projectSortOrder:D,isRefreshing:L,editingSession:z,editingSessionName:V,searchFilter:G,deletingProjects:$,loadingMoreProjects:pe,deleteConfirmation:P,sessionDeleteConfirmation:K,showVersionModal:ae,filteredProjects:ht,toggleProject:De,handleSessionClick:$e,toggleStarProject:Xe,isProjectStarred:Ge,getProjectSessions:it,loadMoreSessionsForProject:pt,startEditing:yt,cancelEditing:vt,saveProjectName:_e,showDeleteSessionConfirmation:Ve,confirmDeleteSession:We,requestProjectDelete:dt,confirmDeleteProject:et,handleProjectSelect:mt,refreshProjects:Er,updateSessionSummary:nr,collapseSidebar:Cr,expandSidebar:mr,setShowNewProject:S,setEditingName:w,setEditingSession:Y,setEditingSessionName:W,searchMode:ge,setSearchMode:ke,conversationResults:xe,isSearching:Re,searchProgress:de,clearConversationResults:g.useCallback(()=>{ye.current+=1,J.current&&(J.current.close(),J.current=null),M(!1),oe(null),Te(null)},[]),setSearchFilter:O,setDeleteConfirmation:te,setSessionDeleteConfirmation:ie,setShowVersionModal:he}}const GR="https://discord.gg/buxwujPNRE",qR="https://github.com/siteboon/claudecodeui/issues/new";function HR({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 VR({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(fj,{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(wt,{className:"h-4 w-4 text-muted-foreground transition-colors group-hover:text-foreground"})}),s.jsx("a",{href:qR,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(x0,{className:"h-4 w-4 text-muted-foreground transition-colors group-hover:text-foreground"})}),s.jsx("a",{href:GR,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(HR,{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(oa,{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 hC(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=hC(e[t]))&&(n&&(n+=" "),n+=r)}else for(r in e)e[r]&&(n&&(n+=" "),n+=r);return n}function fC(){for(var e,t,r=0,n="",a=arguments.length;r<a;r++)(e=arguments[r])&&(t=hC(e))&&(n&&(n+=" "),n+=t);return n}const $b=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,Ub=fC,Lf=(e,t)=>r=>{var n;if(t?.variants==null)return Ub(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=$b(d)||$b(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[b,x]=f;return Array.isArray(x)?x.includes({...i,...l}[b]):{...i,...l}[b]===x})?[...u,p,h]:u},[]);return Ub(e,o,c,r?.class,r?.className)},Pf="-",WR=e=>{const t=YR(e),{conflictingClassGroups:r,conflictingClassGroupModifiers:n}=e;return{getClassGroupId:o=>{const l=o.split(Pf);return l[0]===""&&l.length!==1&&l.shift(),gC(l,t)||KR(o)},getConflictingClassGroupIds:(o,l)=>{const c=r[o]||[];return l&&n[o]?[...c,...n[o]]:c}}},gC=(e,t)=>{if(e.length===0)return t.classGroupId;const r=e[0],n=t.nextPart.get(r),a=n?gC(e.slice(1),n):void 0;if(a)return a;if(t.validators.length===0)return;const i=e.join(Pf);return t.validators.find(({validator:o})=>o(i))?.classGroupId},Gb=/^\[(.+)\]$/,KR=e=>{if(Gb.test(e)){const t=Gb.exec(e)[1],r=t?.substring(0,t.indexOf(":"));if(r)return"arbitrary.."+r}},YR=e=>{const{theme:t,classGroups:r}=e,n={nextPart:new Map,validators:[]};for(const a in r)C0(r[a],n,a,t);return n},C0=(e,t,r,n)=>{e.forEach(a=>{if(typeof a=="string"){const i=a===""?t:qb(t,a);i.classGroupId=r;return}if(typeof a=="function"){if(ZR(a)){C0(a(n),t,r,n);return}t.validators.push({validator:a,classGroupId:r});return}Object.entries(a).forEach(([i,o])=>{C0(o,qb(t,i),r,n)})})},qb=(e,t)=>{let r=e;return t.split(Pf).forEach(n=>{r.nextPart.has(n)||r.nextPart.set(n,{nextPart:new Map,validators:[]}),r=r.nextPart.get(n)}),r},ZR=e=>e.isThemeGetter,XR=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)}}},N0="!",T0=":",JR=T0.length,QR=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 b=a[f];if(o===0&&l===0){if(b===T0){i.push(a.slice(c,f)),c=f+JR;continue}if(b==="/"){u=f;continue}}b==="["?o++:b==="]"?o--:b==="("?l++:b===")"&&l--}const d=i.length===0?a:a.substring(c),p=e8(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+T0,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},e8=e=>e.endsWith(N0)?e.substring(0,e.length-1):e.startsWith(N0)?e.substring(1):e,t8=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}},r8=e=>({cache:XR(e.cacheSize),parseClassName:QR(e),sortModifiers:t8(e),...WR(e)}),n8=/\s+/,a8=(e,t)=>{const{parseClassName:r,getClassGroupId:n,getConflictingClassGroupIds:a,sortModifiers:i}=t,o=[],l=e.trim().split(n8);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:b}=r(d);if(p){c=d+(c.length>0?" "+c:c);continue}let x=!!b,y=n(x?f.substring(0,b):f);if(!y){if(!x){c=d+(c.length>0?" "+c:c);continue}if(y=n(f),!y){c=d+(c.length>0?" "+c:c);continue}x=!1}const v=i(h).join(":"),k=m?v+N0:v,S=k+y;if(o.includes(S))continue;o.push(S);const E=a(y,x);for(let w=0;w<E.length;++w){const I=E[w];o.push(k+I)}c=d+(c.length>0?" "+c:c)}return c};function i8(){let e=0,t,r,n="";for(;e<arguments.length;)(t=arguments[e++])&&(r=bC(t))&&(n&&(n+=" "),n+=r);return n}const bC=e=>{if(typeof e=="string")return e;let t,r="";for(let n=0;n<e.length;n++)e[n]&&(t=bC(e[n]))&&(r&&(r+=" "),r+=t);return r};function s8(e,...t){let r,n,a,i=o;function o(c){const u=t.reduce((d,p)=>p(d),e());return r=r8(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=a8(c,r);return a(c,d),d}return function(){return i(i8.apply(null,arguments))}}const zt=e=>{const t=r=>r[e]||[];return t.isThemeGetter=!0,t},xC=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,yC=/^\((?:(\w[\w-]*):)?(.+)\)$/i,o8=/^\d+\/\d+$/,l8=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,c8=/\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$/,u8=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,d8=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,p8=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Na=e=>o8.test(e),st=e=>!!e&&!Number.isNaN(Number(e)),En=e=>!!e&&Number.isInteger(Number(e)),kl=e=>e.endsWith("%")&&st(e.slice(0,-1)),an=e=>l8.test(e),m8=()=>!0,h8=e=>c8.test(e)&&!u8.test(e),vC=()=>!1,f8=e=>d8.test(e),g8=e=>p8.test(e),b8=e=>!ze(e)&&!Be(e),x8=e=>ri(e,SC,vC),ze=e=>xC.test(e),Yn=e=>ri(e,EC,h8),wl=e=>ri(e,S8,st),Hb=e=>ri(e,kC,vC),y8=e=>ri(e,wC,g8),ps=e=>ri(e,CC,f8),Be=e=>yC.test(e),bi=e=>ni(e,EC),v8=e=>ni(e,E8),Vb=e=>ni(e,kC),k8=e=>ni(e,SC),w8=e=>ni(e,wC),ms=e=>ni(e,CC,!0),ri=(e,t,r)=>{const n=xC.exec(e);return n?n[1]?t(n[1]):r(n[2]):!1},ni=(e,t,r=!1)=>{const n=yC.exec(e);return n?n[1]?t(n[1]):r:!1},kC=e=>e==="position"||e==="percentage",wC=e=>e==="image"||e==="url",SC=e=>e==="length"||e==="size"||e==="bg-size",EC=e=>e==="length",S8=e=>e==="number",E8=e=>e==="family-name",CC=e=>e==="shadow",C8=()=>{const e=zt("color"),t=zt("font"),r=zt("text"),n=zt("font-weight"),a=zt("tracking"),i=zt("leading"),o=zt("breakpoint"),l=zt("container"),c=zt("spacing"),u=zt("radius"),d=zt("shadow"),p=zt("inset-shadow"),h=zt("text-shadow"),m=zt("drop-shadow"),f=zt("blur"),b=zt("perspective"),x=zt("aspect"),y=zt("ease"),v=zt("animate"),k=()=>["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(),Be,ze],w=()=>["auto","hidden","clip","visible","scroll"],I=()=>["auto","contain","none"],_=()=>[Be,ze,c],N=()=>[Na,"full","auto",..._()],j=()=>[En,"none","subgrid",Be,ze],D=()=>["auto",{span:["full",En,Be,ze]},En,Be,ze],A=()=>[En,"auto",Be,ze],L=()=>["auto","min","max","fr",Be,ze],C=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],z=()=>["start","end","center","stretch","center-safe","end-safe"],Y=()=>["auto",..._()],V=()=>[Na,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",..._()],W=()=>[e,Be,ze],G=()=>[...S(),Vb,Hb,{position:[Be,ze]}],O=()=>["no-repeat",{repeat:["","x","y","space","round"]}],$=()=>["auto","cover","contain",k8,x8,{size:[Be,ze]}],B=()=>[kl,bi,Yn],P=()=>["","none","full",u,Be,ze],te=()=>["",st,bi,Yn],K=()=>["solid","dashed","dotted","double"],ie=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],ae=()=>[st,kl,Vb,Hb],he=()=>["","none",f,Be,ze],ge=()=>["none",st,Be,ze],ke=()=>["none",st,Be,ze],xe=()=>[st,Be,ze],Te=()=>[Na,"full",..._()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[an],breakpoint:[an],color:[m8],container:[an],"drop-shadow":[an],ease:["in","out","in-out"],font:[b8],"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",st],text:[an],"text-shadow":[an],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",Na,ze,Be,x]}],container:["container"],columns:[{columns:[st,ze,Be,l]}],"break-after":[{"break-after":k()}],"break-before":[{"break-before":k()}],"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:w()}],"overflow-x":[{"overflow-x":w()}],"overflow-y":[{"overflow-y":w()}],overscroll:[{overscroll:I()}],"overscroll-x":[{"overscroll-x":I()}],"overscroll-y":[{"overscroll-y":I()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:N()}],"inset-x":[{"inset-x":N()}],"inset-y":[{"inset-y":N()}],start:[{start:N()}],end:[{end:N()}],top:[{top:N()}],right:[{right:N()}],bottom:[{bottom:N()}],left:[{left:N()}],visibility:["visible","invisible","collapse"],z:[{z:[En,"auto",Be,ze]}],basis:[{basis:[Na,"full","auto",l,..._()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[st,Na,"auto","initial","none",ze]}],grow:[{grow:["",st,Be,ze]}],shrink:[{shrink:["",st,Be,ze]}],order:[{order:[En,"first","last","none",Be,ze]}],"grid-cols":[{"grid-cols":j()}],"col-start-end":[{col:D()}],"col-start":[{"col-start":A()}],"col-end":[{"col-end":A()}],"grid-rows":[{"grid-rows":j()}],"row-start-end":[{row:D()}],"row-start":[{"row-start":A()}],"row-end":[{"row-end":A()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":L()}],"auto-rows":[{"auto-rows":L()}],gap:[{gap:_()}],"gap-x":[{"gap-x":_()}],"gap-y":[{"gap-y":_()}],"justify-content":[{justify:[...C(),"normal"]}],"justify-items":[{"justify-items":[...z(),"normal"]}],"justify-self":[{"justify-self":["auto",...z()]}],"align-content":[{content:["normal",...C()]}],"align-items":[{items:[...z(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...z(),{baseline:["","last"]}]}],"place-content":[{"place-content":C()}],"place-items":[{"place-items":[...z(),"baseline"]}],"place-self":[{"place-self":["auto",...z()]}],p:[{p:_()}],px:[{px:_()}],py:[{py:_()}],ps:[{ps:_()}],pe:[{pe:_()}],pt:[{pt:_()}],pr:[{pr:_()}],pb:[{pb:_()}],pl:[{pl:_()}],m:[{m:Y()}],mx:[{mx:Y()}],my:[{my:Y()}],ms:[{ms:Y()}],me:[{me:Y()}],mt:[{mt:Y()}],mr:[{mr:Y()}],mb:[{mb:Y()}],ml:[{ml:Y()}],"space-x":[{"space-x":_()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":_()}],"space-y-reverse":["space-y-reverse"],size:[{size:V()}],w:[{w:[l,"screen",...V()]}],"min-w":[{"min-w":[l,"screen","none",...V()]}],"max-w":[{"max-w":[l,"screen","none","prose",{screen:[o]},...V()]}],h:[{h:["screen","lh",...V()]}],"min-h":[{"min-h":["screen","lh","none",...V()]}],"max-h":[{"max-h":["screen","lh",...V()]}],"font-size":[{text:["base",r,bi,Yn]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[n,Be,wl]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",kl,ze]}],"font-family":[{font:[v8,ze,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,Be,ze]}],"line-clamp":[{"line-clamp":[st,"none",Be,wl]}],leading:[{leading:[i,..._()]}],"list-image":[{"list-image":["none",Be,ze]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",Be,ze]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:W()}],"text-color":[{text:W()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...K(),"wavy"]}],"text-decoration-thickness":[{decoration:[st,"from-font","auto",Be,Yn]}],"text-decoration-color":[{decoration:W()}],"underline-offset":[{"underline-offset":[st,"auto",Be,ze]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:_()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",Be,ze]}],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",Be,ze]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:G()}],"bg-repeat":[{bg:O()}],"bg-size":[{bg:$()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},En,Be,ze],radial:["",Be,ze],conic:[En,Be,ze]},w8,y8]}],"bg-color":[{bg:W()}],"gradient-from-pos":[{from:B()}],"gradient-via-pos":[{via:B()}],"gradient-to-pos":[{to:B()}],"gradient-from":[{from:W()}],"gradient-via":[{via:W()}],"gradient-to":[{to:W()}],rounded:[{rounded:P()}],"rounded-s":[{"rounded-s":P()}],"rounded-e":[{"rounded-e":P()}],"rounded-t":[{"rounded-t":P()}],"rounded-r":[{"rounded-r":P()}],"rounded-b":[{"rounded-b":P()}],"rounded-l":[{"rounded-l":P()}],"rounded-ss":[{"rounded-ss":P()}],"rounded-se":[{"rounded-se":P()}],"rounded-ee":[{"rounded-ee":P()}],"rounded-es":[{"rounded-es":P()}],"rounded-tl":[{"rounded-tl":P()}],"rounded-tr":[{"rounded-tr":P()}],"rounded-br":[{"rounded-br":P()}],"rounded-bl":[{"rounded-bl":P()}],"border-w":[{border:te()}],"border-w-x":[{"border-x":te()}],"border-w-y":[{"border-y":te()}],"border-w-s":[{"border-s":te()}],"border-w-e":[{"border-e":te()}],"border-w-t":[{"border-t":te()}],"border-w-r":[{"border-r":te()}],"border-w-b":[{"border-b":te()}],"border-w-l":[{"border-l":te()}],"divide-x":[{"divide-x":te()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":te()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...K(),"hidden","none"]}],"divide-style":[{divide:[...K(),"hidden","none"]}],"border-color":[{border:W()}],"border-color-x":[{"border-x":W()}],"border-color-y":[{"border-y":W()}],"border-color-s":[{"border-s":W()}],"border-color-e":[{"border-e":W()}],"border-color-t":[{"border-t":W()}],"border-color-r":[{"border-r":W()}],"border-color-b":[{"border-b":W()}],"border-color-l":[{"border-l":W()}],"divide-color":[{divide:W()}],"outline-style":[{outline:[...K(),"none","hidden"]}],"outline-offset":[{"outline-offset":[st,Be,ze]}],"outline-w":[{outline:["",st,bi,Yn]}],"outline-color":[{outline:W()}],shadow:[{shadow:["","none",d,ms,ps]}],"shadow-color":[{shadow:W()}],"inset-shadow":[{"inset-shadow":["none",p,ms,ps]}],"inset-shadow-color":[{"inset-shadow":W()}],"ring-w":[{ring:te()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:W()}],"ring-offset-w":[{"ring-offset":[st,Yn]}],"ring-offset-color":[{"ring-offset":W()}],"inset-ring-w":[{"inset-ring":te()}],"inset-ring-color":[{"inset-ring":W()}],"text-shadow":[{"text-shadow":["none",h,ms,ps]}],"text-shadow-color":[{"text-shadow":W()}],opacity:[{opacity:[st,Be,ze]}],"mix-blend":[{"mix-blend":[...ie(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":ie()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[st]}],"mask-image-linear-from-pos":[{"mask-linear-from":ae()}],"mask-image-linear-to-pos":[{"mask-linear-to":ae()}],"mask-image-linear-from-color":[{"mask-linear-from":W()}],"mask-image-linear-to-color":[{"mask-linear-to":W()}],"mask-image-t-from-pos":[{"mask-t-from":ae()}],"mask-image-t-to-pos":[{"mask-t-to":ae()}],"mask-image-t-from-color":[{"mask-t-from":W()}],"mask-image-t-to-color":[{"mask-t-to":W()}],"mask-image-r-from-pos":[{"mask-r-from":ae()}],"mask-image-r-to-pos":[{"mask-r-to":ae()}],"mask-image-r-from-color":[{"mask-r-from":W()}],"mask-image-r-to-color":[{"mask-r-to":W()}],"mask-image-b-from-pos":[{"mask-b-from":ae()}],"mask-image-b-to-pos":[{"mask-b-to":ae()}],"mask-image-b-from-color":[{"mask-b-from":W()}],"mask-image-b-to-color":[{"mask-b-to":W()}],"mask-image-l-from-pos":[{"mask-l-from":ae()}],"mask-image-l-to-pos":[{"mask-l-to":ae()}],"mask-image-l-from-color":[{"mask-l-from":W()}],"mask-image-l-to-color":[{"mask-l-to":W()}],"mask-image-x-from-pos":[{"mask-x-from":ae()}],"mask-image-x-to-pos":[{"mask-x-to":ae()}],"mask-image-x-from-color":[{"mask-x-from":W()}],"mask-image-x-to-color":[{"mask-x-to":W()}],"mask-image-y-from-pos":[{"mask-y-from":ae()}],"mask-image-y-to-pos":[{"mask-y-to":ae()}],"mask-image-y-from-color":[{"mask-y-from":W()}],"mask-image-y-to-color":[{"mask-y-to":W()}],"mask-image-radial":[{"mask-radial":[Be,ze]}],"mask-image-radial-from-pos":[{"mask-radial-from":ae()}],"mask-image-radial-to-pos":[{"mask-radial-to":ae()}],"mask-image-radial-from-color":[{"mask-radial-from":W()}],"mask-image-radial-to-color":[{"mask-radial-to":W()}],"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":[st]}],"mask-image-conic-from-pos":[{"mask-conic-from":ae()}],"mask-image-conic-to-pos":[{"mask-conic-to":ae()}],"mask-image-conic-from-color":[{"mask-conic-from":W()}],"mask-image-conic-to-color":[{"mask-conic-to":W()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:G()}],"mask-repeat":[{mask:O()}],"mask-size":[{mask:$()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",Be,ze]}],filter:[{filter:["","none",Be,ze]}],blur:[{blur:he()}],brightness:[{brightness:[st,Be,ze]}],contrast:[{contrast:[st,Be,ze]}],"drop-shadow":[{"drop-shadow":["","none",m,ms,ps]}],"drop-shadow-color":[{"drop-shadow":W()}],grayscale:[{grayscale:["",st,Be,ze]}],"hue-rotate":[{"hue-rotate":[st,Be,ze]}],invert:[{invert:["",st,Be,ze]}],saturate:[{saturate:[st,Be,ze]}],sepia:[{sepia:["",st,Be,ze]}],"backdrop-filter":[{"backdrop-filter":["","none",Be,ze]}],"backdrop-blur":[{"backdrop-blur":he()}],"backdrop-brightness":[{"backdrop-brightness":[st,Be,ze]}],"backdrop-contrast":[{"backdrop-contrast":[st,Be,ze]}],"backdrop-grayscale":[{"backdrop-grayscale":["",st,Be,ze]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[st,Be,ze]}],"backdrop-invert":[{"backdrop-invert":["",st,Be,ze]}],"backdrop-opacity":[{"backdrop-opacity":[st,Be,ze]}],"backdrop-saturate":[{"backdrop-saturate":[st,Be,ze]}],"backdrop-sepia":[{"backdrop-sepia":["",st,Be,ze]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":_()}],"border-spacing-x":[{"border-spacing-x":_()}],"border-spacing-y":[{"border-spacing-y":_()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",Be,ze]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[st,"initial",Be,ze]}],ease:[{ease:["linear","initial",y,Be,ze]}],delay:[{delay:[st,Be,ze]}],animate:[{animate:["none",v,Be,ze]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[b,Be,ze]}],"perspective-origin":[{"perspective-origin":E()}],rotate:[{rotate:ge()}],"rotate-x":[{"rotate-x":ge()}],"rotate-y":[{"rotate-y":ge()}],"rotate-z":[{"rotate-z":ge()}],scale:[{scale:ke()}],"scale-x":[{"scale-x":ke()}],"scale-y":[{"scale-y":ke()}],"scale-z":[{"scale-z":ke()}],"scale-3d":["scale-3d"],skew:[{skew:xe()}],"skew-x":[{"skew-x":xe()}],"skew-y":[{"skew-y":xe()}],transform:[{transform:[Be,ze,"","none","gpu","cpu"]}],"transform-origin":[{origin:E()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:Te()}],"translate-x":[{"translate-x":Te()}],"translate-y":[{"translate-y":Te()}],"translate-z":[{"translate-z":Te()}],"translate-none":["translate-none"],accent:[{accent:W()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:W()}],"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",Be,ze]}],"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":_()}],"scroll-mx":[{"scroll-mx":_()}],"scroll-my":[{"scroll-my":_()}],"scroll-ms":[{"scroll-ms":_()}],"scroll-me":[{"scroll-me":_()}],"scroll-mt":[{"scroll-mt":_()}],"scroll-mr":[{"scroll-mr":_()}],"scroll-mb":[{"scroll-mb":_()}],"scroll-ml":[{"scroll-ml":_()}],"scroll-p":[{"scroll-p":_()}],"scroll-px":[{"scroll-px":_()}],"scroll-py":[{"scroll-py":_()}],"scroll-ps":[{"scroll-ps":_()}],"scroll-pe":[{"scroll-pe":_()}],"scroll-pt":[{"scroll-pt":_()}],"scroll-pr":[{"scroll-pr":_()}],"scroll-pb":[{"scroll-pb":_()}],"scroll-pl":[{"scroll-pl":_()}],"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",Be,ze]}],fill:[{fill:["none",...W()]}],"stroke-w":[{stroke:[st,bi,Yn,wl]}],stroke:[{stroke:["none",...W()]}],"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"]}},N8=s8(C8);function ve(...e){return N8(fC(e))}function T8(e){if(!e||typeof e!="string")return null;try{return JSON.parse(e)}catch{return null}}const A8=Lf("relative w-full rounded-lg border px-4 py-3 text-sm grid has-[>svg]:grid-cols-[calc(var(--spacing)*4)_1fr] grid-cols-[0_1fr] has-[>svg]:gap-x-3 gap-y-0.5 items-start [&>svg]:size-4 [&>svg]:translate-y-0.5 [&>svg]:text-current",{variants:{variant:{default:"bg-card text-card-foreground",destructive:"text-destructive bg-card [&>svg]:text-current *:data-[slot=alert-description]:text-destructive/90"}},defaultVariants:{variant:"default"}}),NC=g.forwardRef(({className:e,variant:t,...r},n)=>s.jsx("div",{ref:n,role:"alert","data-slot":"alert",className:ve(A8({variant:t}),e),...r}));NC.displayName="Alert";const I8=g.forwardRef(({className:e,...t},r)=>s.jsx("div",{ref:r,"data-slot":"alert-title",className:ve("col-start-2 line-clamp-1 min-h-4 font-medium tracking-tight",e),...t}));I8.displayName="AlertTitle";const j8=g.forwardRef(({className:e,...t},r)=>s.jsx("div",{ref:r,"data-slot":"alert-description",className:ve("text-muted-foreground col-start-2 grid justify-items-start gap-1 text-sm [&_p]:leading-relaxed",e),...t}));j8.displayName="AlertDescription";const _8=Lf("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 Ln({className:e,variant:t,...r}){return s.jsx("div",{className:ve(_8({variant:t}),e),...r})}const R8=Lf("inline-flex touch-manipulation items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",{variants:{variant:{default:"bg-primary text-primary-foreground shadow hover:bg-primary/90 active:bg-primary/80",destructive:"bg-destructive text-destructive-foreground shadow-sm hover:bg-destructive/90 active:bg-destructive/80",outline:"border border-input bg-background shadow-sm hover:bg-accent hover:text-accent-foreground active:bg-accent/80",secondary:"bg-secondary text-secondary-foreground shadow-sm hover:bg-secondary/80 active:bg-secondary/70",ghost:"hover:bg-accent hover:text-accent-foreground active:bg-accent/80",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-10 px-4 py-2",sm:"h-9 rounded-md px-3 text-sm",lg:"h-11 rounded-md px-8",icon:"h-10 w-10"}},defaultVariants:{variant:"default",size:"default"}}),Fe=g.forwardRef(({className:e,variant:t,size:r,...n},a)=>s.jsx("button",{className:ve(R8({variant:t,size:r,className:e})),ref:a,...n}));Fe.displayName="Button";const TC=g.createContext(null),AC=()=>{const e=g.useContext(TC);if(!e)throw new Error("Confirmation components must be used within Confirmation");return e},IC=({className:e,approval:t="pending",children:r,...n})=>{const a=g.useMemo(()=>({approval:t}),[t]);return s.jsx(TC.Provider,{value:a,children:s.jsx(NC,{className:ve("flex flex-col gap-2",e),...n,children:r})})};IC.displayName="Confirmation";const jC=({className:e,...t})=>s.jsx("div",{"data-slot":"confirmation-title",className:ve("text-muted-foreground inline text-sm",e),...t});jC.displayName="ConfirmationTitle";const _C=({children:e})=>{const{approval:t}=AC();return t!=="pending"?null:s.jsx(s.Fragment,{children:e})};_C.displayName="ConfirmationRequest";const RC=({className:e,...t})=>{const{approval:r}=AC();return r!=="pending"?null:s.jsx("div",{"data-slot":"confirmation-actions",className:ve("flex items-center justify-end gap-2 self-end",e),...t})};RC.displayName="ConfirmationActions";const Hs=({variant:e="default",...t})=>s.jsx(Fe,{className:"h-8 px-3 text-sm",variant:e,type:"button",...t});Hs.displayName="ConfirmationAction";const Ff=g.forwardRef(({className:e,...t},r)=>s.jsx("div",{ref:r,className:ve("rounded-xl border bg-card text-card-foreground shadow-sm",e),...t}));Ff.displayName="Card";const DC=g.forwardRef(({className:e,...t},r)=>s.jsx("div",{ref:r,className:ve("flex flex-col space-y-1.5 p-4",e),...t}));DC.displayName="CardHeader";const MC=g.forwardRef(({className:e,...t},r)=>s.jsx("h3",{ref:r,className:ve("font-semibold leading-none tracking-tight",e),...t}));MC.displayName="CardTitle";const D8=g.forwardRef(({className:e,...t},r)=>s.jsx("p",{ref:r,className:ve("text-sm text-muted-foreground",e),...t}));D8.displayName="CardDescription";const OC=g.forwardRef(({className:e,...t},r)=>s.jsx("div",{ref:r,className:ve("p-4 pt-0",e),...t}));OC.displayName="CardContent";const LC=g.forwardRef(({className:e,...t},r)=>s.jsx("div",{ref:r,className:ve("flex items-center p-4 pt-0",e),...t}));LC.displayName="CardFooter";const M8=g.forwardRef(({className:e,...t},r)=>s.jsx("div",{ref:r,className:ve("ml-auto shrink-0",e),...t}));M8.displayName="CardAction";const PC=g.createContext(null);function FC(){const e=g.useContext(PC);if(!e)throw new Error("Collapsible components must be used within <Collapsible>");return e}const la=g.forwardRef(({defaultOpen:e=!1,open:t,onOpenChange:r,className:n,children:a,...i},o)=>{const[l,c]=g.useState(e),u=t!==void 0,d=u?t:l,p=g.useCallback(m=>{u||c(m),r?.(m)},[u,r]),h=g.useMemo(()=>({open:d,onOpenChange:p}),[d,p]);return s.jsx(PC.Provider,{value:h,children:s.jsx("div",{ref:o,"data-state":d?"open":"closed",className:n,...i,children:a})})});la.displayName="Collapsible";const Bn=g.forwardRef(({onClick:e,children:t,className:r,...n},a)=>{const{open:i,onOpenChange:o}=FC(),l=g.useCallback(c=>{o(!i),e?.(c)},[i,o,e]);return s.jsx("button",{ref:a,type:"button","aria-expanded":i,"data-state":i?"open":"closed",onClick:l,className:r,...n,children:t})});Bn.displayName="CollapsibleTrigger";const ca=g.forwardRef(({className:e,children:t,...r},n)=>{const{open:a}=FC();return s.jsx("div",{ref:n,"data-state":a?"open":"closed",className:ve("grid transition-[grid-template-rows] duration-200 ease-out",a?"grid-rows-[1fr]":"grid-rows-[0fr]",e),...r,children:s.jsx("div",{className:"overflow-hidden",children:t})})});ca.displayName="CollapsibleContent";const zC=g.createContext(null);function zf(){const e=g.useContext(zC);if(!e)throw new Error("Command components must be used within <Command>");return e}const BC=g.forwardRef(({className:e,children:t,...r},n)=>{const[a,i]=g.useState(""),o=g.useRef(new Map),[l,c]=g.useState(0),u=g.useCallback(v=>{o.current.set(v.id,v),c(k=>k+1)},[]),d=g.useCallback(v=>{o.current.delete(v),c(k=>k+1)},[]),p=g.useCallback((v,k)=>{const S=o.current.get(v);S&&Object.assign(S,k)},[]),h=g.useMemo(()=>{const v=a.toLowerCase(),k=new Set;for(const[S,E]of o.current)(!v||E.value.includes(v))&&k.add(S);return k},[a,l]),m=g.useMemo(()=>{const v=[];for(const[,k]of o.current)h.has(k.id)&&v.push(k);return v},[h]),[f,b]=g.useState(null);g.useEffect(()=>{b(m.length>0?m[0].id:null)},[m]);const x=g.useCallback(v=>{if(v.key==="ArrowDown"||v.key==="ArrowUp"||v.key==="Enter")v.preventDefault();else return;const k=m;if(k.length===0)return;if(v.key==="Enter"){k.find(N=>N.id===f)?.onSelect();return}const S=k.findIndex(_=>_.id===f);let E;v.key==="ArrowDown"?E=S<k.length-1?S+1:0:E=S>0?S-1:k.length-1;const w=k[E].id;b(w),k[E].element?.scrollIntoView({block:"nearest"})},[m,f]),y=g.useMemo(()=>({search:a,setSearch:i,visibleIds:h,activeId:f,setActiveId:b,register:u,unregister:d,updateEntry:p}),[a,h,f,u,d,p]);return s.jsx(zC.Provider,{value:y,children:s.jsx("div",{ref:n,role:"combobox","aria-expanded":"true","aria-haspopup":"listbox",className:ve("flex flex-col",e),onKeyDown:x,...r,children:t})})});BC.displayName="Command";const $C=g.forwardRef(({className:e,placeholder:t="Search...",...r},n)=>{const{search:a,setSearch:i}=zf();return s.jsxs("div",{className:"flex items-center border-b px-3",role:"presentation",children:[s.jsx(hn,{className:"mr-2 h-4 w-4 shrink-0 text-muted-foreground","aria-hidden":!0}),s.jsx("input",{ref:n,type:"text",role:"searchbox","aria-autocomplete":"list",autoComplete:"off",autoCorrect:"off",spellCheck:!1,value:a,onChange:o=>i(o.target.value),placeholder:t,className:ve("flex h-11 w-full rounded-md bg-transparent py-3 text-sm outline-none","placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50",e),...r})]})});$C.displayName="CommandInput";const UC=g.forwardRef(({className:e,...t},r)=>s.jsx("div",{ref:r,role:"listbox",className:ve("max-h-[300px] overflow-y-auto overflow-x-hidden",e),...t}));UC.displayName="CommandList";const GC=g.forwardRef(({className:e,...t},r)=>{const{search:n,visibleIds:a}=zf();return!n||a.size>0?null:s.jsx("div",{ref:r,className:ve("py-6 text-center text-sm text-muted-foreground",e),...t})});GC.displayName="CommandEmpty";const qC=g.forwardRef(({className:e,heading:t,children:r,...n},a)=>s.jsxs("div",{ref:a,className:ve("overflow-hidden p-1",e),role:"group","aria-label":typeof t=="string"?t:void 0,...n,children:[t&&s.jsx("div",{className:"px-2 py-1.5 text-xs font-medium text-muted-foreground",role:"presentation",children:t}),r]}));qC.displayName="CommandGroup";const HC=g.forwardRef(({className:e,value:t,onSelect:r,disabled:n,children:a,...i},o)=>{const{visibleIds:l,activeId:c,setActiveId:u,register:d,unregister:p,updateEntry:h}=zf(),m=g.useId(),f=g.useRef(null),b=t||(typeof a=="string"?a:"");g.useEffect(()=>(d({id:m,value:b.toLowerCase(),onSelect:r||(()=>{}),element:f.current}),()=>p(m)),[m,b,d,p]),g.useEffect(()=>{h(m,{onSelect:r||(()=>{})})},[m,r,h]);const x=g.useCallback(v=>{f.current=v,h(m,{element:v}),typeof o=="function"?o(v):o&&(o.current=v)},[m,h,o]);if(!l.has(m))return null;const y=c===m;return s.jsx("div",{ref:x,role:"option","aria-selected":y,"aria-disabled":n||void 0,"data-active":y||void 0,className:ve("relative flex cursor-pointer select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none",y&&"bg-accent text-accent-foreground",n&&"pointer-events-none opacity-50",e),onPointerMove:()=>{!n&&c!==m&&u(m)},onClick:()=>!n&&r?.(),...i,children:a})});HC.displayName="CommandItem";const O8=g.forwardRef(({className:e,...t},r)=>s.jsx("div",{ref:r,className:ve("-mx-1 h-px bg-border",e),...t}));O8.displayName="CommandSeparator";function A0({checked:e,onToggle:t,ariaLabel:r="Toggle dark mode"}){const{isDarkMode:n,toggleDarkMode:a}=ei(),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:ve("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:ve("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(_f,{className:"h-3 w-3 text-primary"}):s.jsx(Rf,{className:"h-3 w-3 text-white dark:text-background"})})]})}const VC=g.createContext(null);function WC(){const e=g.useContext(VC);if(!e)throw new Error("Dialog components must be used within <Dialog>");return e}const L8=({open:e,onOpenChange:t,defaultOpen:r=!1,children:n})=>{const[a,i]=g.useState(r),o=g.useRef(null),l=e!==void 0,c=l?e:a,u=g.useCallback(p=>{l||i(p),t?.(p)},[l,t]),d=g.useMemo(()=>({open:c,onOpenChange:u,triggerRef:o}),[c,u]);return s.jsx(VC.Provider,{value:d,children:n})},KC=g.forwardRef(({onClick:e,children:t,asChild:r,...n},a)=>{const{onOpenChange:i,triggerRef:o}=WC(),l=g.useCallback(c=>{i(!0),e?.(c)},[i,e]);if(r&&g.isValidElement(t)){const c=t;return g.cloneElement(c,{onClick:u=>{i(!0),c.props.onClick?.(u)},ref:u=>{o.current=u,typeof a=="function"?a(u):a&&(a.current=u)}})}return s.jsx("button",{ref:c=>{o.current=c,typeof a=="function"?a(c):a&&(a.current=c)},type:"button",onClick:l,...n,children:t})});KC.displayName="DialogTrigger";const Wb='a[href], button:not([disabled]), input:not([disabled]), textarea:not([disabled]), select:not([disabled]), [tabindex]:not([tabindex="-1"])',YC=g.forwardRef(({className:e,children:t,onEscapeKeyDown:r,onPointerDownOutside:n,...a},i)=>{const{open:o,onOpenChange:l,triggerRef:c}=WC(),u=g.useRef(null),d=g.useRef(null);return g.useEffect(()=>{o?d.current=document.activeElement:d.current&&((c.current||d.current)?.focus(),d.current=null)},[o,c]),g.useEffect(()=>{if(!o)return;const p=m=>{if(m.key==="Escape"){m.stopPropagation(),r?.(),l(!1);return}if(m.key==="Tab"&&u.current){const f=Array.from(u.current.querySelectorAll(Wb));if(f.length===0)return;const b=f[0],x=f[f.length-1];m.shiftKey&&document.activeElement===b?(m.preventDefault(),x.focus()):!m.shiftKey&&document.activeElement===x&&(m.preventDefault(),b.focus())}};document.addEventListener("keydown",p,!0);const h=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.removeEventListener("keydown",p,!0),document.body.style.overflow=h}},[o,l,r]),g.useEffect(()=>{o&&u.current&&requestAnimationFrame(()=>{u.current?.querySelector(Wb)?.focus()})},[o]),o?Ef.createPortal(s.jsxs("div",{className:"fixed inset-0 z-50",children:[s.jsx("div",{className:"fixed inset-0 animate-dialog-overlay-show bg-black/50 backdrop-blur-sm",onClick:()=>{n?.(),l(!1)},"aria-hidden":!0}),s.jsx("div",{ref:p=>{u.current=p,typeof i=="function"?i(p):i&&(i.current=p)},role:"dialog","aria-modal":"true",className:ve("fixed left-1/2 top-1/2 z-50 w-full max-w-lg -translate-x-1/2 -translate-y-1/2","rounded-xl border bg-popover text-popover-foreground shadow-lg","animate-dialog-content-show",e),...a,children:t})]}),document.body):null});YC.displayName="DialogContent";const ZC=g.forwardRef(({className:e,...t},r)=>s.jsx("h2",{ref:r,className:ve("sr-only",e),...t}));ZC.displayName="DialogTitle";const Nt=g.forwardRef(({className:e,type:t,...r},n)=>s.jsx("input",{type:t,className:ve("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}));Nt.displayName="Input";const Bf=g.forwardRef(({className:e,children:t,...r},n)=>s.jsx("div",{className:ve(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})}));Bf.displayName="ScrollArea";const ho=g.memo(({children:e,className:t,as:r="span"})=>s.jsx(r,{className:ve("animate-shimmer inline-block bg-[length:250%_100%] bg-clip-text text-transparent","bg-[linear-gradient(90deg,transparent_33%,hsl(var(--foreground))_50%,transparent_67%),linear-gradient(hsl(var(--muted-foreground)),hsl(var(--muted-foreground)))]",t),children:e}));ho.displayName="Shimmer";const XC=g.createContext(null),P8=()=>{const e=g.useContext(XC);if(!e)throw new Error("Reasoning components must be used within Reasoning");return e},F8=1e3,z8=1e3,I0=g.memo(({className:e,isStreaming:t=!1,open:r,defaultOpen:n,onOpenChange:a,duration:i,children:o,...l})=>{const c=n??t,u=n===!1,[d,p]=g.useState(c),h=r!==void 0,m=h?r:d,f=g.useCallback(w=>{h||p(w),a?.(w)},[h,a]),[b,x]=g.useState(i),y=g.useRef(t),[v,k]=g.useState(!1),S=g.useRef(null);g.useEffect(()=>{i!==void 0&&x(i)},[i]),g.useEffect(()=>{t?(y.current=!0,S.current===null&&(S.current=Date.now())):S.current!==null&&(x(Math.ceil((Date.now()-S.current)/z8)),S.current=null)},[t]),g.useEffect(()=>{t&&!m&&!u&&f(!0)},[t,m,f,u]),g.useEffect(()=>{if(y.current&&!t&&m&&!v){const w=setTimeout(()=>{f(!1),k(!0)},F8);return()=>clearTimeout(w)}},[t,m,f,v]);const E=g.useMemo(()=>({duration:b,isOpen:m,isStreaming:t,setIsOpen:f}),[b,m,t,f]);return s.jsx(XC.Provider,{value:E,children:s.jsx(la,{open:m,onOpenChange:f,className:ve("not-prose",e),...l,children:o})})});I0.displayName="Reasoning";const B8=(e,t)=>e||t===0?s.jsx(ho,{children:"Thinking..."}):t===void 0?s.jsx("p",{children:"Thought for a few seconds"}):s.jsxs("p",{children:["Thought for ",t," seconds"]}),j0=g.memo(({className:e,children:t,getThinkingMessage:r=B8,...n})=>{const{isStreaming:a,isOpen:i,duration:o}=P8();return s.jsx(Bn,{className:ve("flex w-full items-center gap-2 text-sm text-muted-foreground transition-colors hover:text-foreground",e),...n,children:t??s.jsxs(s.Fragment,{children:[s.jsx(Po,{className:"h-4 w-4"}),r(a,o),s.jsx(or,{className:ve("h-4 w-4 transition-transform",i?"rotate-180":"rotate-0")})]})})});j0.displayName="ReasoningTrigger";const _0=g.memo(({className:e,children:t,...r})=>s.jsx(ca,{className:ve("mt-4 text-sm text-muted-foreground",e),...r,children:t}));_0.displayName="ReasoningContent";function $8(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 dn({children:e,content:t,position:r="top",className:n="",delay:a=350}){const[i,o]=g.useState(!1),l=g.useRef(null),c=g.useRef(!1),u=g.useRef(null),d=g.useRef(null),[p,h]=g.useState(null),m=g.useCallback(()=>{const k=u.current;if(!k)return;const S=k.getBoundingClientRect(),E=8,w={position:"fixed",zIndex:9999};switch(r){case"bottom":w.left=S.left+S.width/2,w.top=S.bottom+E,w.transform="translateX(-50%)";break;case"left":w.left=S.left-E,w.top=S.top+S.height/2,w.transform="translate(-100%, -50%)";break;case"right":w.left=S.right+E,w.top=S.top+S.height/2,w.transform="translateY(-50%)";break;case"top":default:w.left=S.left+S.width/2,w.top=S.top-E,w.transform="translate(-50%, -100%)";break}h(w)},[r]),f=()=>{l.current!==null&&(window.clearTimeout(l.current),l.current=null)},b=()=>{f(),l.current=window.setTimeout(()=>{o(!0)},a)},x=()=>{f(),o(!1)},y=()=>{f(),c.current=!1,l.current=window.setTimeout(()=>{c.current=!0,o(!0)},a)},v=()=>{f(),!c.current&&o(!1)};return g.useEffect(()=>()=>{f()},[]),g.useEffect(()=>{if(!i||typeof document>"u")return;const k=S=>{const E=S.target;E instanceof Node&&u.current?.contains(E)||(o(!1),c.current=!1)};return document.addEventListener("pointerdown",k,!0),()=>document.removeEventListener("pointerdown",k,!0)},[i]),g.useEffect(()=>{if(!i){h(null);return}const k=window.requestAnimationFrame(m),S=()=>m();return window.addEventListener("resize",S),window.addEventListener("scroll",S,!0),()=>{window.cancelAnimationFrame(k),window.removeEventListener("resize",S),window.removeEventListener("scroll",S,!0)}},[i,m]),t?s.jsxs("div",{ref:u,className:"relative inline-block",onMouseEnter:b,onMouseLeave:x,onTouchStart:y,onTouchEnd:v,onTouchCancel:v,children:[e,i&&typeof document<"u"&&Ef.createPortal(s.jsxs("div",{ref:d,style:p||{position:"fixed",top:"-9999px",left:"-9999px",opacity:0},className:ve("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:ve("absolute w-0 h-0 border-4 border-transparent",$8(r))})]}),document.body)]}):s.jsx(s.Fragment,{children:e})}const JC=g.createContext(null),QC=g.forwardRef(({className:e,status:t="ready",children:r,...n},a)=>{const i=g.useMemo(()=>({status:t}),[t]);return s.jsx(JC.Provider,{value:i,children:s.jsx("form",{ref:a,"data-slot":"prompt-input",className:ve("relative overflow-hidden rounded-xl border border-border/50 bg-card/80 shadow-sm backdrop-blur-sm transition-all duration-200 focus-within:border-primary/30 focus-within:shadow-md focus-within:ring-1 focus-within:ring-primary/15",e),...n,children:r})})});QC.displayName="PromptInput";const eN=g.forwardRef(({className:e,...t},r)=>s.jsx("div",{ref:r,"data-slot":"prompt-input-header",className:ve("px-3 pt-3",e),...t}));eN.displayName="PromptInputHeader";const tN=g.forwardRef(({className:e,...t},r)=>s.jsx("div",{ref:r,"data-slot":"prompt-input-body",className:ve("relative",e),...t}));tN.displayName="PromptInputBody";const rN=g.forwardRef(({className:e,...t},r)=>s.jsx("textarea",{ref:r,"data-slot":"prompt-input-textarea",className:ve("chat-input-placeholder block max-h-[40vh] w-full resize-none overflow-y-auto bg-transparent px-4 py-2 text-sm leading-6 text-foreground placeholder-muted-foreground/50 focus:outline-none sm:max-h-[300px]",e),...t}));rN.displayName="PromptInputTextarea";const nN=g.forwardRef(({className:e,...t},r)=>s.jsx("div",{ref:r,"data-slot":"prompt-input-footer",className:ve("flex items-center justify-between border-t border-border/30 px-3 py-2",e),...t}));nN.displayName="PromptInputFooter";const aN=g.forwardRef(({className:e,...t},r)=>s.jsx("div",{ref:r,"data-slot":"prompt-input-tools",className:ve("flex items-center gap-1",e),...t}));aN.displayName="PromptInputTools";const Vs=g.forwardRef(({className:e,tooltip:t,children:r,...n},a)=>{const i=s.jsx(Fe,{ref:a,type:"button",variant:"ghost",size:"icon",className:ve("h-8 w-8 [&_svg]:size-4",e),...n,children:r});return t?s.jsx(dn,{content:t.shortcut?s.jsxs("span",{className:"flex items-center gap-1.5",children:[t.content,s.jsx("kbd",{className:"rounded bg-white/20 px-1 text-[10px]",children:t.shortcut})]}):t.content,position:t.side??"top",children:i}):i});Vs.displayName="PromptInputButton";const iN=g.forwardRef(({className:e,status:t,children:r,...n},a)=>{const i=g.useContext(JC),o=t??i?.status??"ready",l=o==="submitted"||o==="streaming";return s.jsx(Fe,{ref:a,type:l?"button":"submit",variant:"default",size:"icon",className:ve("h-8 w-8 rounded-lg",e),...n,children:r??(l?s.jsx(Wj,{className:"h-3.5 w-3.5 fill-current"}):s.jsx(Rj,{className:"h-4 w-4"}))})});iN.displayName="PromptInputSubmit";function $f({children:e,className:t}){return s.jsx("div",{className:ve("inline-flex items-center gap-[2px] rounded-lg bg-muted/60 p-[3px]",t),children:e})}function Uf({isActive:e,onClick:t,children:r,className:n}){return s.jsx("button",{onClick:t,className:ve("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 sN=g.createContext(null);function oN(){const e=g.useContext(sN);if(!e)throw new Error("QueueItem sub-components must be used within <QueueItem>");return e}const lN=g.forwardRef(({className:e,...t},r)=>s.jsx("div",{ref:r,"data-slot":"queue",role:"list",className:ve("space-y-0.5",e),...t}));lN.displayName="Queue";const cN=g.forwardRef(({status:e="pending",className:t,children:r,...n},a)=>{const i=g.useMemo(()=>({status:e}),[e]);return s.jsx(sN.Provider,{value:i,children:s.jsx("div",{ref:a,"data-slot":"queue-item","data-status":e,role:"listitem",className:ve("flex items-start gap-2 py-0.5",t),...n,children:r})})});cN.displayName="QueueItem";const uN=g.forwardRef(({className:e,...t},r)=>{const{status:n}=oN();return s.jsxs("div",{ref:r,"data-slot":"queue-item-indicator","aria-hidden":"true",className:ve("mt-0.5 flex h-3.5 w-3.5 flex-shrink-0 items-center justify-center",e),...t,children:[n==="completed"&&s.jsx("svg",{className:"h-3.5 w-3.5 text-green-500 dark:text-green-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z"})}),n==="in_progress"&&s.jsx("span",{className:"h-2 w-2 animate-pulse rounded-full bg-blue-500 dark:bg-blue-400"}),n==="pending"&&s.jsx("svg",{className:"h-3.5 w-3.5 text-muted-foreground/50",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:s.jsx("circle",{cx:"12",cy:"12",r:"9",strokeWidth:2})})]})});uN.displayName="QueueItemIndicator";const dN=g.forwardRef(({className:e,children:t,...r},n)=>{const{status:a}=oN();return s.jsx("div",{ref:n,"data-slot":"queue-item-content",className:ve("min-w-0 flex-1 text-xs",a==="completed"&&"text-muted-foreground line-through",a==="in_progress"&&"font-medium text-foreground",a==="pending"&&"text-foreground",e),...r,children:t})});dN.displayName="QueueItemContent";const Kb="https://github.com/siteboon/claudecodeui/issues/new",U8="https://github.com/siteboon/claudecodeui",Yb="https://discord.gg/buxwujPNRE";function Zb({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 G8({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(Cb,{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(Cb,{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:Kb,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(x0,{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:Yb,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(Zb,{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(wt,{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:U8,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:Kb,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(x0,{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:Yb,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(Zb,{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(wt,{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 Xb="CLOUDCLI_GITHUB_STARS",Jb="CLOUDCLI_HIDE_GITHUB_STAR",q8=3600*1e3,H8=(e,t)=>{const[r,n]=g.useState(null),[a,i]=g.useState(()=>{try{return localStorage.getItem(Jb)==="true"}catch{return!1}});g.useEffect(()=>{if(a)return;try{const u=localStorage.getItem(Xb);if(u){const d=JSON.parse(u);if(Date.now()-d.timestamp<q8){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(Xb,JSON.stringify({count:p,timestamp:Date.now()}))}catch{}}}catch{}})()},[e,t,a]);const o=g.useCallback(()=>{i(!0);try{localStorage.setItem(Jb,"true")}catch{}},[]),l=r!==null?r>=1e3?`${(r/1e3).toFixed(1)}k`:`${r}`:null;return{starCount:r,formattedCount:l,isDismissed:a,dismiss:o}},V8="https://github.com/siteboon/claudecodeui";function W8({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 K8(){const{formattedCount:e,isDismissed:t,dismiss:r}=H8("siteboon","claudecodeui");return t?null:s.jsxs("div",{className:"group/star relative hidden md:block",children:[s.jsxs("a",{href:V8,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(W8,{className:"h-3.5 w-3.5"}),s.jsx(lo,{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(xt,{className:"h-2.5 w-2.5"})})]})}function Y8({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(Fe,{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(lr,{className:`h-3.5 w-3.5 ${d?"animate-spin":""}`})}),s.jsx(Fe,{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(Fe,{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(mj,{className:"h-3.5 w-3.5"})})]})]}),s.jsx(K8,{}),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:ve("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(zr,{className:"h-3 w-3"}),m("search.modeProjects")]}),s.jsxs("button",{onClick:()=>c("conversations"),"aria-pressed":l==="conversations",className:ve("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(zn,{className:"h-3 w-3"}),m("search.modeConversations")]})]}),s.jsxs("div",{className:"relative",children:[s.jsx(hn,{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(Nt,{type:"text",placeholder:m(l==="conversations"?"search.conversationsPlaceholder":"projects.searchPlaceholder"),value:a,onChange:b=>i(b.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(xt,{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(lr,{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(Va,{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:ve("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(zr,{className:"h-3 w-3"}),m("search.modeProjects")]}),s.jsxs("button",{onClick:()=>c("conversations"),"aria-pressed":l==="conversations",className:ve("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(zn,{className:"h-3 w-3"}),m("search.modeConversations")]})]}),s.jsxs("div",{className:"relative",children:[s.jsx(hn,{className:"pointer-events-none absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground/50"}),s.jsx(Nt,{type:"text",placeholder:m(l==="conversations"?"search.conversationsPlaceholder":"projects.searchPlaceholder"),value:a,onChange:b=>i(b.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(xt,{className:"h-3.5 w-3.5 text-muted-foreground"})})]})]})]}),s.jsx("div",{className:"nav-divider md:hidden"})]})}const Qb={xs:"w-3 h-3",sm:"w-4 h-4",md:"w-5 h-5",lg:"w-6 h-6"},Z8={xs:"p-0.5",sm:"p-1",md:"p-1.5",lg:"p-2"},X8=e=>e==="fully-configured"?{icon:Fo,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:wt,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:es,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:xt,colorClassName:"text-gray-400 dark:text-gray-500",backgroundClassName:"bg-gray-50 dark:bg-gray-900",label:"No TaskMaster",title:"TaskMaster not configured"};function J8({status:e="not-configured",size:t="sm",className:r="",showLabel:n=!1}){const a=X8(e),i=a.icon;return n?s.jsxs("div",{className:ve("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:Qb[t]}),s.jsx("span",{className:"font-medium",children:a.label})]}):s.jsx("div",{className:ve("inline-flex items-center justify-center rounded-full transition-colors",a.backgroundClassName,Z8[t],r),title:a.title,children:s.jsx(i,{className:ve(Qb[t],a.colorClassName)})})}const Q8=(e,t)=>{const r=new Date(e);if(Number.isNaN(r.getTime()))return"";const n=Math.floor(Math.max(0,t.getTime()-r.getTime())/(1e3*60));if(n<1)return"<1m";if(n<60)return`${n}m`;const a=Math.floor(n/60);return a<24?`${a}hr`:`${Math.floor(a/24)}d`};function eD({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=PR(t,n,m),b=r?.id===t.id,x=Q8(f.sessionTime,n),y=()=>{d(e),p(t,e.projectId)},v=()=>{u(e.projectId,t.id,i,t.__provider)},k=()=>{h(e.projectId,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:ve("p-2 mx-3 my-0.5 rounded-md bg-card border active:scale-[0.98] transition-all duration-150 relative",b?"bg-primary/5 border-primary/20":"",!b&&f.isActive?"border-green-500/30 bg-green-50/5 dark:bg-green-900/5":"border-border/30"),onClick:y,children:s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("div",{className:ve("w-5 h-5 rounded-md flex items-center justify-center flex-shrink-0",b?"bg-primary/10":"bg-muted/50"),children:s.jsx(Qr,{provider:t.__provider,className:"h-3 w-3"})}),s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("div",{className:"truncate text-xs font-medium text-foreground",children:f.sessionName}),x&&s.jsx("span",{className:"ml-auto flex-shrink-0 text-[11px] text-muted-foreground",children:x})]}),s.jsx("div",{className:"mt-0.5 flex items-center",children:f.messageCount>0&&s.jsx(Ln,{variant:"secondary",className:"px-1 py-0 text-xs",children:f.messageCount})})]}),!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:S=>{S.stopPropagation(),k()},children:s.jsx(tr,{className:"h-2.5 w-2.5 text-red-600 dark:text-red-400"})})]})})}),s.jsxs("div",{className:"hidden md:block",children:[s.jsx(Fe,{variant:"ghost",className:ve("w-full justify-start p-2 h-auto font-normal text-left hover:bg-accent/50 transition-colors duration-200",b&&"bg-accent text-accent-foreground"),onClick:()=>p(t,e.projectId),children:s.jsxs("div",{className:"flex w-full min-w-0 items-start gap-2",children:[s.jsx(Qr,{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.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("div",{className:"truncate text-xs font-medium text-foreground",children:f.sessionName}),x&&s.jsx("span",{className:"ml-auto flex-shrink-0 text-[11px] text-muted-foreground transition-opacity duration-200 group-hover:opacity-0",children:x})]}),s.jsx("div",{className:"mt-0.5 flex items-center",children:f.messageCount>0&&s.jsx(Ln,{variant:"secondary",className:"px-1 py-0 text-xs",children:f.messageCount})})]})]})}),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:S=>o(S.target.value),onKeyDown:S=>{S.stopPropagation(),S.key==="Enter"?v():S.key==="Escape"&&c()},onClick:S=>S.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:S=>{S.stopPropagation(),v()},title:m("tooltips.save"),children:s.jsx(Wt,{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:S=>{S.stopPropagation(),c()},title:m("tooltips.cancel"),children:s.jsx(xt,{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:S=>{S.stopPropagation(),l(t.id,f.sessionName)},title:m("tooltips.editSessionName"),children:s.jsx(yj,{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:S=>{S.stopPropagation(),k()},title:m("tooltips.deleteSession"),children:s.jsx(tr,{className:"h-3 w-3 text-red-600 dark:text-red-400"})})]})})]})]})}function tD(){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 rD({project:e,isExpanded:t,sessions:r,selectedSession:n,initialSessionsLoaded:a,hasMoreSessions:i,isLoadingMoreSessions:o,currentTime:l,editingSession:c,editingSessionName:u,onEditingSessionNameChange:d,onStartEditingSession:p,onCancelEditingSession:h,onSaveEditingSession:m,onProjectSelect:f,onSessionSelect:b,onDeleteSession:x,onLoadMoreSessions:y,onNewSession:v,t:k}){if(!t)return null;const S=r.length>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:()=>{f(e),v(e)},children:[s.jsx(qt,{className:"h-3 w-3"}),k("sessions.newSession")]})}),s.jsxs(Fe,{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:()=>v(e),children:[s.jsx(qt,{className:"h-3 w-3"}),k("sessions.newSession")]}),a?S?s.jsxs(s.Fragment,{children:[r.map(E=>s.jsx(eD,{project:e,session:E,selectedSession:n,currentTime:l,editingSession:c,editingSessionName:u,onEditingSessionNameChange:d,onStartEditingSession:p,onCancelEditingSession:h,onSaveEditingSession:m,onProjectSelect:f,onSessionSelect:b,onDeleteSession:x,t:k},E.id)),i&&s.jsx(Fe,{variant:"ghost",size:"sm",className:"h-8 w-full justify-center text-xs text-muted-foreground hover:text-foreground",onClick:()=>y(e.projectId),disabled:o,children:o?k("sessions.loadingSessions"):"Load more sessions"})]}):s.jsx("div",{className:"px-3 py-2 text-left",children:s.jsx("p",{className:"text-xs text-muted-foreground",children:k("sessions.noSessions")})}):s.jsx(tD,{})]})}const nD=(e,t)=>{const r=Number(e.sessionMeta?.total??t.length);return String(r)};function aD({project:e,selectedProject:t,selectedSession:r,isExpanded:n,isDeleting:a,isStarred:i,editingProject:o,editingName:l,sessions:c,initialSessionsLoaded:u,isLoadingMoreSessions:d,currentTime:p,editingSession:h,editingSessionName:m,tasksEnabled:f,mcpServerStatus:b,onEditingNameChange:x,onToggleProject:y,onProjectSelect:v,onToggleStarProject:k,onStartEditingProject:S,onCancelEditingProject:E,onSaveProjectName:w,onDeleteProject:I,onSessionSelect:_,onDeleteSession:N,onLoadMoreSessions:j,onNewSession:D,onEditingSessionNameChange:A,onStartEditingSession:L,onCancelEditingSession:C,onSaveEditingSession:z,t:Y}){const V=t?.projectId===e.projectId,W=o===e.projectId,G=Number(e.sessionMeta?.total??c.length),O=nD(e,c),$=`${O} session${G===1?"":"s"}`,B=BR(e,b),P=()=>y(e.projectId),te=()=>k(e.projectId),K=()=>{w(e.projectId)},ie=()=>{t?.projectId!==e.projectId&&v(e),P()};return s.jsxs("div",{className:ve("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:ve("p-3 mx-3 my-1 rounded-lg bg-card border border-border/50 active:scale-[0.98] transition-all duration-150",V&&"bg-primary/5 border-primary/20",i&&!V&&"bg-yellow-50/50 dark:bg-yellow-900/5 border-yellow-200/30 dark:border-yellow-800/30"),onClick:P,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:ve("w-8 h-8 rounded-lg flex items-center justify-center transition-colors",n?"bg-primary/10":"bg-muted"),children:n?s.jsx(Fn,{className:"h-4 w-4 text-primary"}):s.jsx(zr,{className:"h-4 w-4 text-muted-foreground"})}),s.jsx("div",{className:"min-w-0 flex-1",children:W?s.jsx("input",{type:"text",value:l,onChange:ae=>x(ae.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:Y("projects.projectNamePlaceholder"),autoFocus:!0,autoComplete:"off",onClick:ae=>ae.stopPropagation(),onKeyDown:ae=>{ae.key==="Enter"&&K(),ae.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(J8,{status:B,size:"xs",className:"ml-2 hidden flex-shrink-0 md:inline-flex"})]}),s.jsx("p",{className:"text-xs text-muted-foreground",children:$})]})})]}),s.jsx("div",{className:"flex items-center gap-1",children:W?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:ae=>{ae.stopPropagation(),K()},children:s.jsx(Wt,{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:ae=>{ae.stopPropagation(),E()},children:s.jsx(xt,{className:"h-4 w-4 text-white"})})]}):s.jsxs(s.Fragment,{children:[s.jsx("button",{className:ve("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:ae=>{ae.stopPropagation(),te()},title:Y(i?"tooltips.removeFromFavorites":"tooltips.addToFavorites"),children:s.jsx(lo,{className:ve("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:ae=>{ae.stopPropagation(),I(e)},children:s.jsx(tr,{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:ae=>{ae.stopPropagation(),S(e)},children:s.jsx(S0,{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(or,{className:"h-3 w-3 text-muted-foreground"}):s.jsx(Fr,{className:"h-3 w-3 text-muted-foreground"})})]})})]})})}),s.jsxs(Fe,{variant:"ghost",className:ve("hidden md:flex w-full justify-between p-2 h-auto font-normal hover:bg-accent/50",V&&"bg-accent text-accent-foreground",i&&!V&&"bg-yellow-50/50 dark:bg-yellow-900/10 hover:bg-yellow-100/50 dark:hover:bg-yellow-900/20"),onClick:ie,children:[s.jsxs("div",{className:"flex min-w-0 flex-1 items-center gap-3",children:[n?s.jsx(Fn,{className:"h-4 w-4 flex-shrink-0 text-primary"}):s.jsx(zr,{className:"h-4 w-4 flex-shrink-0 text-muted-foreground"}),s.jsx("div",{className:"min-w-0 flex-1 text-left",children:W?s.jsxs("div",{className:"space-y-1",children:[s.jsx("input",{type:"text",value:l,onChange:ae=>x(ae.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:Y("projects.projectNamePlaceholder"),autoFocus:!0,onKeyDown:ae=>{ae.key==="Enter"&&K(),ae.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:[O,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:W?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:ae=>{ae.stopPropagation(),K()},children:s.jsx(Wt,{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:ae=>{ae.stopPropagation(),E()},children:s.jsx(xt,{className:"h-3 w-3"})})]}):s.jsxs(s.Fragment,{children:[s.jsx("div",{className:ve("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:ae=>{ae.stopPropagation(),te()},title:Y(i?"tooltips.removeFromFavorites":"tooltips.addToFavorites"),children:s.jsx(lo,{className:ve("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:ae=>{ae.stopPropagation(),S(e)},title:Y("tooltips.renameProject"),children:s.jsx(S0,{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:ae=>{ae.stopPropagation(),I(e)},title:Y("tooltips.deleteProject"),children:s.jsx(tr,{className:"h-3 w-3 text-red-600 dark:text-red-400"})}),n?s.jsx(or,{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(rD,{project:e,isExpanded:n,sessions:c,selectedSession:r,initialSessionsLoaded:u,hasMoreSessions:!!e.sessionMeta?.hasMore,isLoadingMoreSessions:d,currentTime:p,editingSession:h,editingSessionName:m,onEditingSessionNameChange:A,onStartEditingSession:L,onCancelEditingSession:C,onSaveEditingSession:z,onProjectSelect:v,onSessionSelect:_,onDeleteSession:N,onLoadMoreSessions:j,onNewSession:D,t:Y})]})}function iD({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(zr,{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(hn,{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 sD({projects:e,filteredProjects:t,selectedProject:r,selectedSession:n,isLoading:a,loadingProgress:i,expandedProjects:o,editingProject:l,editingName:c,initialSessionsLoaded:u,currentTime:d,editingSession:p,editingSessionName:h,deletingProjects:m,tasksEnabled:f,mcpServerStatus:b,getProjectSessions:x,onLoadMoreSessions:y,loadingMoreProjects:v,isProjectStarred:k,onEditingNameChange:S,onToggleProject:E,onProjectSelect:w,onToggleStarProject:I,onStartEditingProject:_,onCancelEditingProject:N,onSaveProjectName:j,onDeleteProject:D,onSessionSelect:A,onDeleteSession:L,onNewSession:C,onEditingSessionNameChange:z,onStartEditingSession:Y,onCancelEditingSession:V,onSaveEditingSession:W,t:G}){const O=s.jsx(iD,{isLoading:a,loadingProgress:i,projectsCount:e.length,filteredProjectsCount:t.length,t:G});g.useEffect(()=>{let B="CloudCLI UI";const P=r?.displayName?.trim();P&&(B=`${P} - ${B}`),document.title=B},[r]);const $=!a&&e.length>0&&t.length>0;return s.jsx("div",{className:"pb-safe-area-inset-bottom md:space-y-1",children:$?t.map(B=>s.jsx(aD,{project:B,selectedProject:r,selectedSession:n,isExpanded:o.has(B.projectId),isDeleting:m.has(B.projectId),isStarred:k(B.projectId),editingProject:l,editingName:c,sessions:x(B),initialSessionsLoaded:u.has(B.projectId),isLoadingMoreSessions:v.has(B.projectId),currentTime:d,editingSession:p,editingSessionName:h,tasksEnabled:f,mcpServerStatus:b,onEditingNameChange:S,onToggleProject:E,onProjectSelect:w,onToggleStarProject:I,onStartEditingProject:_,onCancelEditingProject:N,onSaveProjectName:j,onDeleteProject:D,onSessionSelect:A,onDeleteSession:L,onLoadMoreSessions:y,onNewSession:C,onEditingSessionNameChange:z,onStartEditingSession:Y,onCancelEditingSession:V,onSaveEditingSession:W,t:G},B.projectId)):O})}function oD({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 lD({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:b,onCollapseSidebar:x,updateAvailable:y,releaseInfo:v,latestVersion:k,currentVersion:S,onShowVersionModal:E,onShowSettings:w,projectListProps:I,t:_}){const N=l==="conversations"&&a.trim().length>=2,j=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(Y8,{isPWA:e,isMobile:t,isLoading:r,projectsCount:n.length,searchFilter:a,onSearchFilterChange:i,onClearSearchFilter:o,searchMode:l,onSearchModeChange:c,onRefresh:m,isRefreshing:f,onCreateProject:b,onCollapseSidebar:x,t:_}),s.jsx(Bf,{className:"flex-1 overflow-y-auto overscroll-contain md:px-1.5 md:py-2",children:N?d&&!j?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:_("search.searching")}),p&&s.jsxs("p",{className:"mt-1 text-xs text-muted-foreground/60",children:[_("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(hn,{className:"h-6 w-6 text-muted-foreground"})}),s.jsx("h3",{className:"mb-2 text-base font-medium text-foreground md:mb-1",children:_("search.noResults")}),s.jsx("p",{className:"text-sm text-muted-foreground",children:_("search.tryDifferentQuery")})]}):j?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:_("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(D=>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(zr,{className:"h-3 w-3 flex-shrink-0 text-muted-foreground"}),s.jsx("span",{className:"truncate text-xs font-medium text-foreground",children:D.projectDisplayName})]}),D.sessions.map(A=>s.jsxs("button",{className:"w-full rounded-md px-2 py-2 text-left transition-colors hover:bg-accent/50",onClick:()=>h(D.projectId,A.sessionId,A.provider||A.matches[0]?.provider||"claude",A.matches[0]?.timestamp,A.matches[0]?.snippet),children:[s.jsxs("div",{className:"mb-1 flex items-center gap-1.5",children:[s.jsx(zn,{className:"h-3 w-3 flex-shrink-0 text-primary"}),s.jsx("span",{className:"truncate text-xs font-medium text-foreground",children:A.sessionSummary}),A.provider&&A.provider!=="claude"&&s.jsx("span",{className:"flex-shrink-0 rounded bg-muted px-1 py-0.5 text-[9px] uppercase text-muted-foreground",children:A.provider})]}),s.jsx("div",{className:"space-y-1 pl-4",children:A.matches.map((L,C)=>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:L.role==="user"?"U":"A"}),s.jsx(oD,{snippet:L.snippet,highlights:L.highlights})]},C))})]},`${D.projectId??D.projectName}-${A.sessionId}`))]},D.projectName))]}):null:s.jsx(sD,{...I})}),s.jsx(G8,{updateAvailable:y,releaseInfo:v,latestVersion:k,currentVersion:S,onShowVersionModal:E,onShowSettings:w,t:_})]})}const ex=[{id:"agents",labelKey:"mainTabs.agents",icon:CI},{id:"appearance",labelKey:"mainTabs.appearance",icon:HE},{id:"git",labelKey:"mainTabs.git",icon:cr},{id:"api",labelKey:"mainTabs.apiTokens",icon:If},{id:"tasks",labelKey:"mainTabs.tasks",icon:Y7},{id:"plugins",labelKey:"mainTabs.plugins",icon:Cj},{id:"notifications",labelKey:"mainTabs.notifications",icon:PE},{id:"about",labelKey:"mainTabs.about",icon:$E}];function cD({activeTab:e,onChange:t}){const{t:r}=Le("settings");return s.jsxs(s.Fragment,{children:[s.jsx("aside",{className:"hidden w-56 flex-shrink-0 border-r border-border bg-muted/30 md:flex md:flex-col",children:s.jsx("nav",{className:"flex flex-col gap-1 p-3",children:ex.map(n=>{const a=n.icon,i=e===n.id;return s.jsxs("button",{onClick:()=>t(n.id),className:ve("flex items-center gap-3 rounded-lg px-3 py-2.5 text-left text-sm font-medium transition-colors duration-150",i?"bg-accent text-accent-foreground":"text-muted-foreground hover:bg-accent/50 hover:text-foreground active:bg-accent/50"),children:[s.jsx(a,{className:"h-4 w-4 flex-shrink-0"}),r(n.labelKey)]},n.id)})})}),s.jsx("div",{className:"flex-shrink-0 border-b border-border px-3 py-2 md:hidden",children:s.jsx($f,{className:"scrollbar-hide w-full overflow-x-auto",children:ex.map(n=>{const a=n.icon;return s.jsxs(Uf,{isActive:e===n.id,onClick:()=>t(n.id),className:"flex-shrink-0",children:[s.jsx(a,{className:"h-3.5 w-3.5"}),r(n.labelKey)]},n.id)})})})]})}function pN(){const[e,t]=g.useState(null);return g.useEffect(()=>{let r=!1;return(async()=>{try{const n=await Ie("/api/settings/server-env");if(!n.ok)return;const a=await n.json();!r&&typeof a.platform=="string"&&t(a.platform)}catch{}})(),()=>{r=!0}},[]),{serverPlatform:e,isWindowsServer:e==="win32"}}const Gf={claude:"Claude",cursor:"Cursor",codex:"Codex",gemini:"Gemini"},Uo={claude:["user","project","local"],cursor:["user","project"],codex:["user","project"],gemini:["user","project"]},Go={claude:["stdio","http","sse"],cursor:["stdio","http"],codex:["stdio","http"],gemini:["stdio","http","sse"]},uD=["user","project"],mN=["stdio","http"],dD={claude:"bg-purple-600 text-white hover:bg-purple-700",cursor:"bg-purple-600 text-white hover:bg-purple-700",codex:"bg-gray-800 text-white hover:bg-gray-900 dark:bg-gray-700 dark:hover:bg-gray-600",gemini:"bg-blue-600 text-white hover:bg-blue-700"},qf={claude:!1,cursor:!1,codex:!0,gemini:!0},pD={name:"",scope:"user",workspacePath:"",transport:"stdio",command:"",args:[],env:{},cwd:"",url:"",headers:{},envVars:[],bearerTokenEnvVar:"",envHttpHeaders:{},importMode:"form",jsonInput:""},hN=e=>!!e&&typeof e=="object"&&!Array.isArray(e),Cn=e=>typeof e=="string"&&e.trim()?e.trim():void 0,tx=e=>Array.isArray(e)?e.filter(t=>typeof t=="string"):void 0,Sl=e=>{if(!hN(e))return;const t={};return Object.entries(e).forEach(([r,n])=>{typeof n=="string"&&(t[r]=n)}),Object.keys(t).length>0?t:void 0},El=e=>Object.entries(e).map(([t,r])=>`${t}=${r}`).join(`
679
+ `;function B_(){if(typeof document>"u"||document.getElementById(_b))return;const e=document.createElement("style");e.id=_b,e.type="text/css",e.innerText=z_,document.head.appendChild(e)}function $_({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]=g.useState(!1),f=g.useRef(null),b=a?.fullPath||a?.path||"",x=!!a;g.useEffect(()=>{B_()},[]);const y=g.useCallback(()=>{t.current&&(t.current.clear(),t.current.write("\x1B[2J\x1B[H"))},[t]),v=g.useCallback(()=>{t.current&&(t.current.dispose(),t.current=null),r.current=null,m(!1)},[r,t]);return g.useEffect(()=>{if(!e.current||!x||o||t.current)return;const k=new L_.Terminal(C_);t.current=k;const S=new R_.FitAddon;r.current=S,k.loadAddon(S),i||k.loadAddon(new M_.WebLinksAddon);try{k.loadAddon(new O_.WebglAddon)}catch{console.warn("[Shell] WebGL renderer unavailable, using Canvas fallback")}k.open(e.current);const E=async()=>{const N=k.getSelection();return N?Jr(N):!1},w=N=>{if(!k.hasSelection())return;const j=k.getSelection();if(j){if(N.preventDefault(),N.clipboardData){N.clipboardData.setData("text/plain",j);return}Jr(j)}};e.current.addEventListener("copy",w),k.attachCustomKeyEventHandler(N=>{const j=eC(l.current)?JE:u.current;return N.type==="keydown"&&i&&c.current&&j&&!N.ctrlKey&&!N.metaKey&&!N.altKey&&N.key?.toLowerCase()==="c"?(N.preventDefault(),N.stopPropagation(),d(j),!1):N.type==="keydown"&&(N.ctrlKey||N.metaKey)&&N.key?.toLowerCase()==="c"&&k.hasSelection()?(N.preventDefault(),N.stopPropagation(),E(),!1):N.type==="keydown"&&(N.ctrlKey||N.metaKey)&&N.key?.toLowerCase()==="v"?(N.preventDefault(),N.stopPropagation(),typeof navigator<"u"&&navigator.clipboard?.readText&&navigator.clipboard.readText().then(D=>{na(n.current,{type:"input",data:D})}).catch(()=>{}),!1):!0}),window.setTimeout(()=>{const N=r.current,j=t.current;!N||!j||(N.fit(),na(n.current,{type:"resize",cols:j.cols,rows:j.rows}))},QE),m(!0);const I=k.onData(N=>{na(n.current,{type:"input",data:N})}),_=new ResizeObserver(()=>{f.current!==null&&window.clearTimeout(f.current),f.current=window.setTimeout(()=>{const N=r.current,j=t.current;!N||!j||(N.fit(),na(n.current,{type:"resize",cols:j.cols,rows:j.rows}))},y_)});return _.observe(e.current),()=>{e.current?.removeEventListener("copy",w),_.disconnect(),f.current!==null&&(window.clearTimeout(f.current),f.current=null),I.dispose(),p(),v()}},[u,p,d,v,r,l,c,o,i,x,b,e,t,n]),{isInitialized:h,clearTerminalScreen:y,disposeTerminal:v}}function U_({selectedProject:e,selectedSession:t,initialCommand:r,isPlainShell:n,minimal:a,autoConnect:i,isRestarting:o,onProcessComplete:l,onOutputRef:c}){const u=g.useRef(null),d=g.useRef(null),p=g.useRef(null),h=g.useRef(null),[m,f]=g.useState(""),[b,x]=g.useState(0),y=g.useRef(e),v=g.useRef(t),k=g.useRef(r),S=g.useRef(n),E=g.useRef(l),w=g.useRef(""),I=g.useRef(t?.id??null);g.useEffect(()=>{y.current=e,v.current=t,k.current=r,S.current=n,E.current=l},[e,t,r,n,l]);const _=g.useCallback(G=>{w.current=G,f(G),x(O=>O+1)},[]),N=g.useCallback(()=>{const G=h.current;G&&((G.readyState===WebSocket.OPEN||G.readyState===WebSocket.CONNECTING)&&G.close(),h.current=null)},[]),j=g.useCallback((G=w.current)=>{if(!G)return!1;const O=window.open(G,"_blank");if(O){try{O.opener=null}catch{}return!0}return!1},[]),D=g.useCallback(async(G=w.current)=>G?Jr(G):!1,[]),{isInitialized:A,clearTerminalScreen:L,disposeTerminal:C}=$_({terminalContainerRef:u,terminalRef:d,fitAddonRef:p,wsRef:h,selectedProject:e,minimal:a,isRestarting:o,initialCommandRef:k,isPlainShellRef:S,authUrlRef:w,copyAuthUrlToClipboard:D,closeSocket:N}),{isConnected:z,isConnecting:Y,connectToShell:V,disconnectFromShell:W}=__({wsRef:h,terminalRef:d,fitAddonRef:p,selectedProjectRef:y,selectedSessionRef:v,initialCommandRef:k,isPlainShellRef:S,onProcessCompleteRef:E,isInitialized:A,autoConnect:i,closeSocket:N,clearTerminalScreen:L,setAuthUrl:_,onOutputRef:c});return g.useEffect(()=>{o&&(W(),C())},[W,C,o]),g.useEffect(()=>{e||(W(),C())},[W,C,e]),g.useEffect(()=>{const G=t?.id??null;I.current!==G&&A&&W(),I.current=G},[W,A,t?.id]),{terminalContainerRef:u,terminalRef:d,wsRef:h,isConnected:z,isInitialized:A,isConnecting:Y,authUrl:m,authUrlVersion:b,connectToShell:V,disconnectFromShell:W,openAuthUrlInBrowser:j,copyAuthUrlToClipboard:D}}function G_({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 q_({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 H_({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 V_({terminalContainerRef:e,authUrl:t,authUrlVersion:r,initialCommand:n,isConnected:a,openAuthUrlInBrowser:i,copyAuthUrlToClipboard:o}){const[l,c]=g.useState("idle"),[u,d]=g.useState(!1),p=g.useMemo(()=>P_(n,t),[t,n]);g.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:b=>b.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 b=await o(p);c(b?"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 W_=[{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"}],K_={up:LE,down:Lo,left:lI,right:Nf},gi=e=>e.preventDefault(),Rb="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",Y_="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",yl="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 Db({wsRef:e,terminalRef:t,isConnected:r,bottomOffset:n="bottom-0"}){const{t:a}=Le("settings"),[i,o]=g.useState(!1),[l,c]=g.useState(!1),u=g.useCallback(m=>{na(e.current,{type:"input",data:m})},[e]),d=g.useCallback(()=>{t.current?.scrollToBottom()},[t]),p=g.useCallback(async()=>{if(!(typeof navigator>"u"||!navigator.clipboard?.readText))try{const m=await navigator.clipboard.readText();m.length>0&&u(m)}catch{}},[u]),h=g.useCallback(m=>{let f=m;if(i&&m.length===1){const b=m.toLowerCase().charCodeAt(0);b>=97&&b<=122&&(f=String.fromCharCode(b-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:gi,onClick:()=>{p()},disabled:!r,className:yl,title:a("terminalShortcuts.paste",{defaultValue:"Paste"}),"aria-label":a("terminalShortcuts.paste",{defaultValue:"Paste"}),children:s.jsx(YI,{className:"h-4 w-4"})}),W_.map(m=>{if(m.type==="modifier"){const f=m.modifier==="ctrl"?i:l,b=m.modifier==="ctrl"?()=>o(x=>!x):()=>c(x=>!x);return s.jsx("button",{type:"button",onPointerDown:gi,onClick:b,disabled:!r,className:f?Y_:Rb,children:m.label},m.id)}if(m.type==="arrow"){const f=K_[m.icon];return s.jsx("button",{type:"button",onPointerDown:gi,onClick:()=>u(m.sequence),disabled:!r,className:yl,children:s.jsx(f,{className:"h-4 w-4"})},m.id)}return s.jsx("button",{type:"button",onPointerDown:gi,onClick:()=>h(m.sequence),disabled:!r,className:Rb,children:m.label},m.id)}),s.jsx("button",{type:"button",onPointerDown:gi,onClick:d,disabled:!r,className:yl,title:a("terminalShortcuts.scrollDown"),"aria-label":a("terminalShortcuts.scrollDown"),children:s.jsx(iI,{className:"h-4 w-4"})})]})})}function tC({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]=g.useState(!1),[p,h]=g.useState(null),m=g.useRef(null),f=g.useRef(null),{terminalContainerRef:b,terminalRef:x,wsRef:y,isConnected:v,isInitialized:k,isConnecting:S,authUrl:E,authUrlVersion:w,connectToShell:I,disconnectFromShell:_,openAuthUrlInBrowser:N,copyAuthUrlToClipboard:j}=U_({selectedProject:e,selectedSession:t,initialCommand:r,isPlainShell:n,minimal:i,autoConnect:o,isRestarting:u,onProcessComplete:a,onOutputRef:f}),D=g.useCallback(()=>{const B=x.current;if(!B)return;const P=B.buffer.active,te=P.baseY+P.cursorY,K=Math.min(P.baseY+P.length-1,te+10),ie=Math.max(0,te-k_),ae=[];for(let Te=ie;Te<=K;Te++){const Re=P.getLine(Te);Re&&ae.push(Re.translateToString().trimEnd())}let he=-1;for(let Te=ae.length-1;Te>=0;Te--)if(/esc to cancel/i.test(ae[Te])||/enter to select/i.test(ae[Te])){he=Te;break}if(he===-1){h(null);return}const ge=new Map,ke=Math.max(0,he-w_);for(let Te=he-1;Te>=ke;Te--){const Re=ae[Te].match(/^\s*[❯›>]?\s*(\d+)\.\s+(.+)/);if(Re){const M=Re[1],de=Re[2].trim();parseInt(M,10)<=S_&&de.length>0&&!ge.has(M)&&ge.set(M,de)}}const xe=[];for(let Te=1;Te<=ge.size&&ge.has(String(Te));Te++)xe.push({number:String(Te),label:ge.get(String(Te))});h(xe.length>=E_?xe:null)},[x]),A=g.useCallback(()=>{m.current&&clearTimeout(m.current),m.current=setTimeout(D,v_)},[D]);g.useEffect(()=>{f.current=A},[A]),g.useEffect(()=>()=>{m.current&&clearTimeout(m.current)},[]),g.useEffect(()=>{v||(m.current&&(clearTimeout(m.current),m.current=null),h(null))},[v]),g.useEffect(()=>{if(!l||!k||!v)return;const B=()=>{x.current?.focus()},P=window.requestAnimationFrame(B),te=window.setTimeout(B,0);return()=>{window.cancelAnimationFrame(P),window.clearTimeout(te)}},[l,v,k,x]);const L=g.useCallback(B=>{na(y.current,{type:"input",data:B})},[y]),C=g.useMemo(()=>F_(t),[t]),z=g.useMemo(()=>C?C.slice(0,30):null,[C]),Y=g.useMemo(()=>C?C.slice(0,50):null,[C]),V=g.useCallback(()=>{d(!0),window.setTimeout(()=>{d(!1)},x_)},[]);if(!e)return s.jsx(q_,{title:c("shell.selectProject.title"),description:c("shell.selectProject.description")});if(i)return s.jsxs(s.Fragment,{children:[s.jsx(V_,{terminalContainerRef:b,authUrl:E,authUrlVersion:w,initialCommand:r,isConnected:v,openAuthUrlInBrowser:N,copyAuthUrlToClipboard:j}),s.jsx(Db,{wsRef:y,terminalRef:x,isConnected:v,bottomOffset:"bottom-0"})]});const W=n?c("shell.runCommand",{command:r||c("shell.defaultCommand"),projectName:e.displayName}):t?c("shell.resumeSession",{displayName:Y}):c("shell.startSession"),G=n?c("shell.runCommand",{command:r||c("shell.defaultCommand"),projectName:e.displayName}):c("shell.startCli",{projectName:e.displayName}),O=k?S?"connecting":v?null:"connect":"loading",$=O==="connecting"?G:W;return s.jsxs("div",{className:"flex h-full w-full flex-col bg-gray-900",children:[s.jsx(H_,{isConnected:v,isInitialized:k,isRestarting:u,hasSession:!!t,sessionDisplayNameShort:z,onDisconnect:_,onRestart:V,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||v}),s.jsxs("div",{className:"relative flex-1 overflow-hidden p-2",children:[s.jsx("div",{ref:b,className:"h-full w-full focus:outline-none",style:{outline:"none"}}),O&&s.jsx(G_,{mode:O,description:$,loadingLabel:c("shell.loading"),connectLabel:c("shell.actions.connect"),connectTitle:c("shell.actions.connectTitle"),connectingLabel:c("shell.connecting"),onConnect:I}),p&&v&&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:()=>{L(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:()=>{L("\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(Db,{wsRef:y,terminalRef:x,isConnected:v})]})}function Z_({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 X_({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 rC({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]=g.useState(!1),b=n!==null?n:r!==null,x=g.useCallback(y=>{f(!0),o?.(y)},[o]);return e?s.jsxs("div",{className:`flex h-full w-full flex-col ${u}`,children:[!h&&d&&c&&s.jsx(X_,{title:c,isCompleted:m,onClose:l}),s.jsx("div",{className:"min-h-0 w-full flex-1",children:s.jsx(tC,{selectedProject:e,selectedSession:t,initialCommand:r,isPlainShell:b,isActive:a,onProcessComplete:x,minimal:h,autoConnect:h?!0:i})})]}):s.jsx(Z_,{className:u})}const J_=({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"),Q_=e=>e==="claude"?"Claude CLI Login":e==="cursor"?"Cursor CLI Login":e==="codex"?"Codex CLI Login":"Gemini CLI Configuration";function nC({isOpen:e,onClose:t,provider:r="claude",onComplete:n,customCommand:a,isAuthenticated:i=!1}){if(!e)return null;const o=J_({provider:r,customCommand:a,isAuthenticated:i}),l=Q_(r),c=u=>{n?.(u)};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:l}),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(xt,{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(H7,{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(Lr,{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(rC,{project:W6,command:o,onComplete:c,minimal:!0})})]})})}const eR=({className:e="w-5 h-5"})=>s.jsx("img",{src:"/icons/claude-ai-icon.svg",alt:"Claude",className:e}),tR=({className:e="w-5 h-5"})=>{const{isDarkMode:t}=ei();return s.jsx("img",{src:t?"/icons/codex-white.svg":"/icons/codex.svg",alt:"Codex",className:e})},rR=({className:e="w-5 h-5"})=>{const{isDarkMode:t}=ei();return s.jsx("img",{src:t?"/icons/cursor-white.svg":"/icons/cursor.svg",alt:"Cursor",className:e})},nR=({className:e="w-5 h-5"})=>s.jsx("img",{src:"/icons/gemini-ai-icon.svg",alt:"Gemini",className:e});function Qr({provider:e="claude",className:t="w-5 h-5"}){return e==="cursor"?s.jsx(rR,{className:t}):e==="codex"?s.jsx(tR,{className:t}):e==="gemini"?s.jsx(nR,{className:t}):s.jsx(eR,{className:t})}function aR({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(Qr,{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(Wt,{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 iR=[{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 sR({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:iR.map(r=>s.jsx(aR,{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 oR({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(cr,{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(i_,{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(tj,{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 Mb=[{title:"Git Configuration",icon:cr,required:!0},{title:"Connect Agents",icon:GE,required:!1}];function lR({currentStep:e}){return s.jsx("div",{className:"mb-8",children:s.jsx("div",{className:"flex items-center justify-between",children:Mb.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(Wt,{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<Mb.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 Ob=/^[^\s@]+@[^\s@]+\.[^\s@]+$/,Lb=async(e,t)=>{try{return(await e.json()).error||t}catch{return t}};function cR({onComplete:e}){const[t,r]=g.useState(0),[n,a]=g.useState(""),[i,o]=g.useState(""),[l,c]=g.useState(!1),[u,d]=g.useState(""),[p,h]=g.useState(null),{providerAuthStatus:m,checkProviderAuthStatus:f,refreshProviderAuthStatuses:b}=XE(),x=g.useRef(void 0),y=g.useCallback(async()=>{try{const _=await Ie("/api/user/git-config");if(!_.ok)return;const N=await _.json();N.gitName&&a(N.gitName),N.gitEmail&&o(N.gitEmail)}catch(_){console.error("Error loading git config:",_)}},[]);g.useEffect(()=>{y(),b()},[y,b]),g.useEffect(()=>{const _=x.current;x.current=p,_!=null&&p===null&&b()},[p,b]);const v=_=>{h(_)},k=_=>{_===0&&p&&f(p)},S=async()=>{if(d(""),t!==0){r(_=>_+1);return}if(!n.trim()||!i.trim()){d("Both git name and email are required.");return}if(!Ob.test(i)){d("Please enter a valid email address.");return}c(!0);try{const _=await Ie("/api/user/git-config",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({gitName:n,gitEmail:i})});if(!_.ok){const N=await Lb(_,"Failed to save git configuration");throw new Error(N)}r(N=>N+1)}catch(_){d(_ instanceof Error?_.message:"Failed to save git configuration")}finally{c(!1)}},E=()=>{d(""),r(_=>_-1)},w=async()=>{c(!0),d("");try{const _=await Ie("/api/user/complete-onboarding",{method:"POST"});if(!_.ok){const N=await Lb(_,"Failed to complete onboarding");throw new Error(N)}await e?.()}catch(_){d(_ instanceof Error?_.message:"Failed to complete onboarding")}finally{c(!1)}},I=t===0?!!(n.trim()&&i.trim()&&Ob.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(lR,{currentStep:t}),s.jsxs("div",{className:"rounded-lg border border-border bg-card p-8 shadow-lg",children:[t===0?s.jsx(oR,{gitName:n,gitEmail:i,isSubmitting:l,onGitNameChange:a,onGitEmailChange:o}):s.jsx(sR,{providerStatuses:m,onOpenProviderLogin:v}),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:E,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(Tf,{className:"h-4 w-4"}),"Previous"]}),s.jsx("div",{className:"flex items-center gap-3",children:t<1?s.jsx("button",{onClick:S,disabled:!I||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(wr,{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:w,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(wr,{className:"h-4 w-4 animate-spin"}),"Completing..."]}):s.jsxs(s.Fragment,{children:[s.jsx(Wt,{className:"h-4 w-4"}),"Complete Setup"]})})})]})]})]})}),p&&s.jsx(nC,{isOpen:!!p,onClose:()=>h(null),provider:p,onComplete:k})]})}const uR=["0s","0.1s","0.2s"];function dR(){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(zn,{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:uR.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 aC({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 Pi({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 iC({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(zn,{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 pR={username:"",password:""};function mR(){const{t:e}=Le("auth"),{login:t}=Qi(),[r,n]=g.useState(pR),[a,i]=g.useState(""),[o,l]=g.useState(!1),c=g.useCallback((d,p)=>{n(h=>({...h,[d]:p}))},[]),u=g.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(iC,{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(Pi,{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(Pi,{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(aC,{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 hR={username:"",password:"",confirmPassword:""};function fR(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 gR(){const{register:e}=Qi(),[t,r]=g.useState(hR),[n,a]=g.useState(""),[i,o]=g.useState(!1),l=g.useCallback((u,d)=>{r(p=>({...p,[u]:d}))},[]),c=g.useCallback(async u=>{u.preventDefault(),a("");const d=fR(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(iC,{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(Pi,{id:"username",name:"username",label:"Username",value:t.username,onChange:u=>l("username",u),placeholder:"Enter your username",isDisabled:i,autoComplete:"username"}),s.jsx(Pi,{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(Pi,{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(aC,{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 bR({children:e}){const{user:t,isLoading:r,needsSetup:n,hasCompletedOnboarding:a,refreshOnboardingStatus:i}=Qi();return r?s.jsx(dR,{}):n?s.jsx(gR,{}):t?a?s.jsx(s.Fragment,{children:e}):s.jsx(cR,{onComplete:i}):s.jsx(mR,{})}const sC=g.createContext(null),oC=()=>{const e=g.useContext(sC);if(!e)throw new Error("useWebSocket must be used within a WebSocketProvider");return e},xR=e=>{const t=window.location.protocol==="https:"?"wss:":"ws:";return e?`${t}//${window.location.host}/ws?token=${encodeURIComponent(e)}`:null},yR=()=>{const e=g.useRef(null),t=g.useRef(!1),r=g.useRef(!1),[n,a]=g.useState(null),[i,o]=g.useState(!1),l=g.useRef(null),{token:c}=Qi();g.useEffect(()=>(u(),()=>{t.current=!0,l.current&&clearTimeout(l.current),e.current&&e.current.close()}),[c]);const u=g.useCallback(()=>{if(!t.current)try{const h=xR(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 b=JSON.parse(f.data);a(b)}catch(b){console.error("Error parsing WebSocket message:",b)}},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=g.useCallback(h=>{const m=e.current;m&&m.readyState===WebSocket.OPEN?m.send(JSON.stringify(h)):console.warn("WebSocket not connected")},[]);return g.useMemo(()=>({ws:e.current,sendMessage:d,latestMessage:n,isConnected:i}),[d,n,i])},vR=({children:e})=>{const t=yR();return s.jsx(sC.Provider,{value:t,children:e})},lC=g.createContext(null);function kR(e,t){return{message:t instanceof Error?t.message:`Failed to ${e}`,context:e,timestamp:new Date().toISOString()}}function Ca(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 wR(e){return e.find(t=>t.status==="pending"||t.status==="in-progress")??null}function SR(e){return e?.type?e.type.startsWith("taskmaster-"):!1}function ti(){const e=g.useContext(lC);if(!e)throw new Error("useTaskMaster must be used within a TaskMasterProvider");return e}function ER({children:e}){const{latestMessage:t}=oC(),{user:r,token:n,isLoading:a}=Qi(),[i,o]=g.useState([]),[l,c]=g.useState(null),[u,d]=g.useState(null),[p,h]=g.useState(null),[m,f]=g.useState([]),[b,x]=g.useState(null),[y,v]=g.useState(!1),[k,S]=g.useState(!1),[E,w]=g.useState(!1),[I,_]=g.useState(null),N=g.useRef(null),j=g.useRef(null),D=g.useRef(0);g.useEffect(()=>{N.current=l?.projectId??null},[l?.projectId]),g.useEffect(()=>{j.current=u},[u]);const A=g.useCallback(()=>{_(null)},[]),L=g.useCallback(($,B)=>{console.error(`TaskMaster ${$} error:`,B),_(kR($,B))},[]),C=g.useCallback(($,B)=>{d(B),o(P=>P.map(te=>te.projectId!==$?te:Ca({...te,taskmaster:B??void 0}))),c(P=>!P||P.projectId!==$?P:Ca({...P,taskmaster:B??void 0}))},[]),z=g.useCallback(async $=>{if(!$||!r||!n)return;const B=++D.current;try{const P=await tt.projectTaskmaster($);if(!P.ok)throw new Error(`Failed to fetch TaskMaster details: ${P.status}`);const K=(await P.json()).taskmaster??null;if(B!==D.current||N.current!==$)return;C($,K)}catch(P){if(B!==D.current||N.current!==$)return;L("load selected project TaskMaster info",P)}},[C,L,n,r]),Y=g.useCallback($=>{const B=$?Ca($):null;if(c(B),d(B?.taskmaster??null),f([]),x(null),!B?.projectId){D.current+=1;return}z(B.projectId)},[z]),V=g.useCallback(async()=>{if(!r||!n){o([]),c(null),d(null),f([]),x(null);return}try{v(!0),A();const $=await tt.get("/projects");if(!$.ok)throw new Error(`Failed to fetch projects: ${$.status}`);const B=await $.json(),te=(Array.isArray(B)?B:[]).map(he=>Ca(he));o(he=>{const ge=new Map(he.filter(ke=>!!ke.taskmaster).map(ke=>[ke.projectId,ke.taskmaster]));return te.map(ke=>{const xe=ge.get(ke.projectId);return xe?Ca({...ke,taskmaster:xe}):ke})});const K=N.current;if(!K)return;const ie=te.find(he=>he.projectId===K)??null;if(!ie){D.current+=1,c(null),d(null),f([]),x(null);return}const ae=ie.taskmaster??j.current??null;c(ae?Ca({...ie,taskmaster:ae}):ie),d(ae),z(K)}catch($){L("load projects",$)}finally{v(!1)}},[A,L,z,n,r]),W=g.useCallback(async()=>{const $=l?.projectId;if(!$||!r||!n){f([]),x(null);return}try{S(!0),A();const B=await tt.get(`/taskmaster/tasks/${encodeURIComponent($)}`);if(!B.ok){const K=await B.json();throw new Error(K.message??"Failed to load tasks")}const P=await B.json(),te=Array.isArray(P.tasks)?P.tasks:[];f(te),x(wR(te))}catch(B){L("load tasks",B),f([]),x(null)}finally{S(!1)}},[A,l?.projectId,L,n,r]),G=g.useCallback(async()=>{if(!r||!n){h(null);return}try{w(!0),A();const $=await tt.get("/mcp-utils/taskmaster-server");if(!$.ok)throw new Error(`Failed to load MCP status: ${$.status}`);const B=await $.json();h(B)}catch($){L("check MCP server status",$),h(null)}finally{w(!1)}},[A,L,n,r]);g.useEffect(()=>{!a&&r&&n&&(V(),G())},[a,G,V,n,r]),g.useEffect(()=>{l?.projectId&&r&&n&&W()},[l?.projectId,W,n,r]),g.useEffect(()=>{const $=t;if(SR($)){if($.type==="taskmaster-project-updated"&&$.projectId){$.projectId===N.current&&z($.projectId),V();return}if($.type==="taskmaster-tasks-updated"&&$.projectId===l?.projectId){W();return}$.type==="taskmaster-mcp-status-changed"&&G()}},[l?.projectId,t,z,G,V,W]);const O=g.useMemo(()=>({projects:i,currentProject:l,projectTaskMaster:u,mcpServerStatus:p,tasks:m,nextTask:b,isLoading:y,isLoadingTasks:k,isLoadingMCP:E,error:I,refreshProjects:V,setCurrentProject:Y,refreshTasks:W,refreshMCPStatus:G,clearError:A}),[A,l,I,y,E,k,p,b,u,i,G,V,W,Y,m]);return s.jsx(lC.Provider,{value:O,children:e})}const cC=g.createContext({tasksEnabled:!0,setTasksEnabled:()=>{},toggleTasksEnabled:()=>{},isTaskMasterInstalled:null,isTaskMasterReady:null,installationStatus:null,isCheckingInstallation:!0}),Bo=()=>{const e=g.useContext(cC);if(!e)throw new Error("useTasksSettings must be used within a TasksSettingsProvider");return e},CR=({children:e})=>{const[t,r]=g.useState(()=>{const m=localStorage.getItem("tasks-enabled");return m!==null?JSON.parse(m):!0}),[n,a]=g.useState(null),[i,o]=g.useState(null),[l,c]=g.useState(null),[u,d]=g.useState(!0);g.useEffect(()=>{localStorage.setItem("tasks-enabled",JSON.stringify(t))},[t]),g.useEffect(()=>{setTimeout(async()=>{try{const f=await tt.get("/taskmaster/installation-status");if(f.ok){const b=await f.json();c(b),a(b.installation?.isInstalled||!1),o(b.isReady||!1);const x=localStorage.getItem("tasks-enabled");!b.installation?.isInstalled&&!x&&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(cC.Provider,{value:h,children:e})},uC=g.createContext(null);function $o(){const e=g.useContext(uC);if(!e)throw new Error("usePlugins must be used within a PluginsProvider");return e}function NR({children:e}){const[t,r]=g.useState([]),[n,a]=g.useState(!0),[i,o]=g.useState(null),l=g.useCallback(async()=>{try{const h=await Ie("/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)}},[]);g.useEffect(()=>{l()},[l]);const c=g.useCallback(async h=>{try{const m=await Ie("/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=g.useCallback(async h=>{try{const m=await Ie(`/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=g.useCallback(async h=>{try{const m=await Ie(`/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=g.useCallback(async(h,m)=>{try{const f=await Ie(`/api/plugins/${encodeURIComponent(h)}/enable`,{method:"PUT",body:JSON.stringify({enabled:m})});if(!f.ok){let b=`Toggle failed (${f.status})`;try{const x=await f.json();b=x.details||x.error||b}catch{b=f.statusText||b}return{success:!1,error:b}}return await l(),{success:!0,error:null}}catch(f){return{success:!1,error:f instanceof Error?f.message:"Toggle failed"}}},[l]);return s.jsx(uC.Provider,{value:{plugins:t,loading:n,pluginsError:i,refreshPlugins:l,installPlugin:c,uninstallPlugin:u,updatePlugin:d,togglePlugin:p},children:e})}const Pb=e=>typeof window>"u"?!1:window.innerWidth<e,Fb=()=>{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 Mf(e={}){const{mobileBreakpoint:t=768,trackMobile:r=!0,trackPWA:n=!0}=e,[a,i]=g.useState(()=>r?Pb(t):!1),[o,l]=g.useState(()=>n?Fb():!1);return g.useEffect(()=>{if(!r||typeof window>"u")return;const c=()=>{i(Pb(t))};return c(),window.addEventListener("resize",c),()=>{window.removeEventListener("resize",c)}},[t,r]),g.useEffect(()=>{if(!n||typeof window>"u")return;const c=window.matchMedia("(display-mode: standalone)"),u=()=>{l(Fb())};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 zb="1.31.2",TR=(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},dC=(e,t)=>{const[r,n]=g.useState(!1),[a,i]=g.useState(null),[o,l]=g.useState(null),[c,u]=g.useState("git");return g.useEffect(()=>{(async()=>{try{const h=await(await fetch("/health")).json();(h.installMode==="npm"||h.installMode==="git")&&u(h.installMode)}catch{}})()},[]),g.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(TR(f,zb)>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:zb,releaseInfo:o,installMode:c}},ea={autoExpandTools:!1,showRawParameters:!1,showThinking:!0,autoScrollToBottom:!0,sendByCtrlEnter:!1,sidebarVisible:!0},uo=Object.keys(ea),AR=new Set(uo),vl="ui-preferences:sync",po=(e,t)=>{if(typeof e=="boolean")return e;if(typeof e=="string"){if(e==="true")return!0;if(e==="false")return!1}return t},IR=(e,t)=>{try{const r=localStorage.getItem(e);if(r===null)return t;const n=JSON.parse(r);return po(n,t)}catch{return t}},jR=e=>{if(typeof window>"u")return ea;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 uo.reduce((a,i)=>(a[i]=po(n[i],ea[i]),a),{...ea})}}}catch{}return uo.reduce((t,r)=>(t[r]=IR(r,ea[r]),t),{...ea})};function _R(e,t){switch(t.type){case"set":{const{key:r,value:n}=t;if(!AR.has(r))return e;const a=po(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 uo){if(!(i in r))continue;const o=r[i],l=po(o,e[i]);a[i]!==l&&(a[i]=l,n=!0)}return n?a:e}case"reset":return{...ea,...t.value||{}};default:return e}}function Of(e="uiPreferences"){const t=g.useRef(`ui-preferences-${Math.random().toString(36).slice(2)}`),[r,n]=g.useReducer(_R,e,jR);return g.useEffect(()=>{typeof window>"u"||(localStorage.setItem(e,JSON.stringify(r)),window.dispatchEvent(new CustomEvent(vl,{detail:{storageKey:e,sourceId:t.current,value:r}})))},[r,e]),g.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(vl,u),()=>{window.removeEventListener("storage",c),window.removeEventListener(vl,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 RR=()=>{try{const e=localStorage.getItem("claude-settings");return e&&JSON.parse(e).projectSortOrder==="date"?"date":"name"}catch{return"name"}},pC="starredProjects",DR=()=>{try{const e=localStorage.getItem(pC);if(!e)return[];const t=JSON.parse(e);return Array.isArray(t)?t.map(r=>String(r).trim()).filter(r=>r.length>0):[]}catch{return[]}},MR=()=>{try{localStorage.removeItem(pC)}catch{}},mo=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),OR=(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"),LR=e=>e.__provider==="cursor"?String(e.createdAt||""):e.__provider==="codex"?String(e.createdAt||e.lastActivity||""):String(e.lastActivity||e.createdAt||""),PR=(e,t,r)=>{const n=mo(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:OR(e,r),sessionTime:LR(e),messageCount:Number(e.messageCount||0)}},mC=e=>{const t=[...e.sessions||[]].map(i=>({...i,__provider:"claude"})),r=(e.cursorSessions||[]).map(i=>({...i,__provider:"cursor"})),n=(e.codexSessions||[]).map(i=>({...i,__provider:"codex"})),a=(e.geminiSessions||[]).map(i=>({...i,__provider:"gemini"}));return[...t,...r,...n,...a].sort((i,o)=>mo(o).getTime()-mo(i).getTime())},Bb=e=>{const t=mC(e);return t.length===0?new Date(0):t.reduce((r,n)=>{const a=mo(n);return a>r?a:r},new Date(0))},FR=(e,t)=>{const r=[...e];return r.sort((n,a)=>{const i=!!n.isStarred,o=!!a.isStarred;return i&&!o?-1:!i&&o?1:t==="date"?Bb(a).getTime()-Bb(n).getTime():(n.displayName||n.projectId).localeCompare(a.displayName||a.projectId)}),r},zR=(e,t)=>{const r=t.trim().toLowerCase();return r?e.filter(n=>{const a=(n.displayName||n.projectId).toLowerCase(),i=(n.path||n.fullPath||"").toLowerCase();return a.includes(r)||i.includes(r)}):e},BR=(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"},$R=e=>{const t=typeof e.fullPath=="string"&&e.fullPath.length>0?e.fullPath:typeof e.path=="string"?e.path:"";return{name:e.projectId,displayName:typeof e.displayName=="string"&&e.displayName.trim().length>0?e.displayName:e.projectId,fullPath:t,path:typeof e.path=="string"&&e.path.length>0?e.path:t}};function UR({projects:e,selectedProject:t,selectedSession:r,isLoading:n,isMobile:a,t:i,onRefresh:o,onProjectSelect:l,onSessionSelect:c,onSessionDelete:u,onLoadMoreSessions:d,onProjectDelete:p,setCurrentProject:h,setSidebarVisible:m,sidebarVisible:f}){const[b,x]=g.useState(new Set),[y,v]=g.useState(null),[k,S]=g.useState(!1),[E,w]=g.useState(""),[I,_]=g.useState(new Set),[N,j]=g.useState(new Date),[D,A]=g.useState("name"),[L,C]=g.useState(!1),[z,Y]=g.useState(null),[V,W]=g.useState(""),[G,O]=g.useState(""),[$,B]=g.useState(new Set),[P,te]=g.useState(null),[K,ie]=g.useState(null),[ae,he]=g.useState(!1),[ge,ke]=g.useState("projects"),[xe,Te]=g.useState(null),[Re,M]=g.useState(!1),[de,oe]=g.useState(null),[H,q]=g.useState(""),[re,me]=g.useState(new Map),[pe,se]=g.useState(new Set),ye=g.useRef(0),J=g.useRef(null),Q=g.useRef(new Map),Z=g.useRef(!1),le=g.useRef(o),fe=!a&&!f;g.useEffect(()=>{const ue=setInterval(()=>{j(new Date)},6e4);return()=>clearInterval(ue)},[]),g.useEffect(()=>{_(new Set)},[e]),g.useEffect(()=>{const ue=t?.projectId;ue&&x(Se=>{if(Se.has(ue))return Se;const we=new Set(Se);return we.add(ue),we})},[t?.projectId]),g.useEffect(()=>{if(e.length>0&&!n){const ue=new Set;e.forEach(Se=>{Se.sessions&&Se.sessions.length>=0&&ue.add(Se.projectId)}),_(ue)}},[e,n]),g.useEffect(()=>{const ue=()=>{A(RR())};ue();const Se=Me=>{Me.key==="claude-settings"&&ue()};window.addEventListener("storage",Se);const we=setInterval(()=>{document.hasFocus()&&ue()},1e3);return()=>{window.removeEventListener("storage",Se),clearInterval(we)}},[]),g.useEffect(()=>{le.current=o},[o]),g.useEffect(()=>{if(Z.current)return;const ue=DR();if(ue.length===0)return;Z.current=!0,(async()=>{try{await tt.migrateLegacyProjectStars(ue),await le.current()}catch(we){console.error("[Sidebar] Failed to migrate legacy starred projects:",we)}finally{MR()}})()},[o]),g.useEffect(()=>{me(ue=>{if(ue.size===0)return ue;const Se=new Map(ue);let we=!1;for(const[Me,at]of ue.entries()){const lt=e.find(ct=>ct.projectId===Me);if(!lt){Se.delete(Me),we=!0;continue}!!lt.isStarred===at&&(Se.delete(Me),we=!0)}return we?Se:ue})},[e]),g.useEffect(()=>{const ue=setTimeout(()=>{q(G.trim())},300);return()=>{clearTimeout(ue)}},[G]),g.useEffect(()=>{J.current&&(J.current.close(),J.current=null);const ue=H;if(ge!=="conversations"||ue.length<2){ye.current+=1,Te(null),oe(null),M(!1);return}M(!0);const Se=++ye.current;if(Se!==ye.current)return;const we=tt.searchConversationsUrl(ue),Me=new EventSource(we);J.current=Me;const at=[];let lt=0;return Me.addEventListener("result",ct=>{if(Se!==ye.current){Me.close();return}try{const Ot=JSON.parse(ct.data);at.push(Ot.projectResult),lt=Ot.totalMatches,Te({results:[...at],totalMatches:lt,query:ue}),oe({scannedProjects:Ot.scannedProjects,totalProjects:Ot.totalProjects})}catch{}}),Me.addEventListener("progress",ct=>{if(Se!==ye.current){Me.close();return}try{const Ot=JSON.parse(ct.data);lt=Ot.totalMatches,oe({scannedProjects:Ot.scannedProjects,totalProjects:Ot.totalProjects})}catch{}}),Me.addEventListener("done",()=>{if(Se!==ye.current){Me.close();return}Me.close(),J.current=null,M(!1),oe(null),at.length===0&&Te({results:[],totalMatches:0,query:ue})}),Me.addEventListener("error",()=>{if(Se!==ye.current){Me.close();return}Me.close(),J.current=null,M(!1),oe(null),at.length===0&&Te({results:[],totalMatches:0,query:ue})}),()=>{J.current&&(J.current.close(),J.current=null)}},[H,ge]);const De=g.useCallback(ue=>{x(Se=>{const we=new Set;return Se.has(ue)||we.add(ue),we})},[]),$e=g.useCallback((ue,Se)=>{c({...ue,__projectId:Se})},[c]),Qe=g.useCallback(ue=>re.has(ue)?!!re.get(ue):e.some(Se=>Se.projectId===ue&&!!Se.isStarred),[re,e]),Xe=g.useCallback(ue=>{const Se=Qe(ue),we=!Se,Me=(Q.current.get(ue)??0)+1;Q.current.set(ue,Me),me(lt=>{const ct=new Map(lt);return ct.set(ue,we),ct}),(async()=>{try{const lt=await tt.toggleProjectStar(ue);if(!lt.ok){const Yt=(await lt.json()).error,Sn=typeof Yt=="string"?Yt:Yt&&typeof Yt=="object"&&Yt.message?Yt.message:i("messages.updateProjectError");throw new Error(Sn)}const ct=await lt.json();if(!(Q.current.get(ue)===Me))return;me(Nr=>{const Yt=new Map(Nr);return Yt.set(ue,!!ct.isStarred),Yt})}catch(lt){if(!(Q.current.get(ue)===Me))return;me(Ot=>{const Nr=new Map(Ot);return Nr.set(ue,Se),Nr}),console.error("[Sidebar] Failed to toggle project star:",lt),alert(i("messages.updateProjectError"))}})()},[Qe,i]),Ge=g.useCallback(ue=>Qe(ue),[Qe]),it=g.useCallback(ue=>mC(ue),[]),pt=g.useCallback(async ue=>{if(!d)return;let Se=!1;if(se(we=>{if(we.has(ue))return we;Se=!0;const Me=new Set(we);return Me.add(ue),Me}),!!Se)try{await d(ue)}catch(we){console.error("[Sidebar] Failed to load more sessions:",we),alert(i("messages.refreshError"))}finally{se(we=>{const Me=new Set(we);return Me.delete(ue),Me})}},[d,i]),Je=g.useMemo(()=>re.size===0?e:e.map(ue=>{const Se=re.get(ue.projectId);return Se===void 0||!!ue.isStarred===Se?ue:{...ue,isStarred:Se}}),[re,e]),bt=g.useMemo(()=>FR(Je,D),[D,Je]),ht=g.useMemo(()=>zR(bt,H),[H,bt]),yt=g.useCallback(ue=>{v(ue.projectId),w(ue.displayName)},[]),vt=g.useCallback(()=>{v(null),w("")},[]),_e=g.useCallback(async ue=>{try{(await tt.renameProject(ue,E)).ok?window.refreshProjects?await window.refreshProjects():window.location.reload():console.error("Failed to rename project")}catch(Se){console.error("Error renaming project:",Se)}finally{v(null),w("")}},[E]),Ve=g.useCallback((ue,Se,we,Me="claude")=>{ie({projectId:ue,sessionId:Se,sessionTitle:we,provider:Me})},[]),We=g.useCallback(async()=>{if(!K)return;const{sessionId:ue}=K;ie(null);try{const Se=await tt.deleteSession(ue);if(Se.ok)u?.(ue);else{const we=await Se.text();console.error("[Sidebar] Failed to delete session:",{status:Se.status,error:we}),alert(i("messages.deleteSessionFailed"))}}catch(Se){console.error("[Sidebar] Error deleting session:",Se),alert(i("messages.deleteSessionError"))}},[u,K,i]),dt=g.useCallback(ue=>{te({project:ue,sessionCount:it(ue).length})},[it]),et=g.useCallback(async(ue=!1)=>{if(!P)return;const{project:Se}=P;te(null),B(we=>new Set([...we,Se.projectId]));try{const we=await tt.deleteProject(Se.projectId,ue);if(we.ok)p?.(Se.projectId);else{const at=(await we.json()).error,lt=typeof at=="string"?at:at&&typeof at=="object"&&at.message?at.message:i("messages.deleteProjectFailed");alert(lt)}}catch(we){console.error("Error deleting project:",we),alert(i("messages.deleteProjectError"))}finally{B(we=>{const Me=new Set(we);return Me.delete(Se.projectId),Me})}},[P,p,i]),mt=g.useCallback(ue=>{l(ue),h(ue)},[l,h]),Er=g.useCallback(async()=>{C(!0);try{await o()}finally{C(!1)}},[o]),nr=g.useCallback(async(ue,Se,we,Me)=>{const at=we.trim();if(!at){Y(null),W("");return}try{const lt=await tt.renameSession(Se,at);lt.ok?await o():(console.error("[Sidebar] Failed to rename session:",lt.status),alert(i("messages.renameSessionFailed")))}catch(lt){console.error("[Sidebar] Error renaming session:",lt),alert(i("messages.renameSessionError"))}finally{Y(null),W("")}},[o,i]),Cr=g.useCallback(()=>{m(!1)},[m]),mr=g.useCallback(()=>{m(!0)},[m]);return{isSidebarCollapsed:fe,expandedProjects:b,editingProject:y,showNewProject:k,editingName:E,initialSessionsLoaded:I,currentTime:N,projectSortOrder:D,isRefreshing:L,editingSession:z,editingSessionName:V,searchFilter:G,deletingProjects:$,loadingMoreProjects:pe,deleteConfirmation:P,sessionDeleteConfirmation:K,showVersionModal:ae,filteredProjects:ht,toggleProject:De,handleSessionClick:$e,toggleStarProject:Xe,isProjectStarred:Ge,getProjectSessions:it,loadMoreSessionsForProject:pt,startEditing:yt,cancelEditing:vt,saveProjectName:_e,showDeleteSessionConfirmation:Ve,confirmDeleteSession:We,requestProjectDelete:dt,confirmDeleteProject:et,handleProjectSelect:mt,refreshProjects:Er,updateSessionSummary:nr,collapseSidebar:Cr,expandSidebar:mr,setShowNewProject:S,setEditingName:w,setEditingSession:Y,setEditingSessionName:W,searchMode:ge,setSearchMode:ke,conversationResults:xe,isSearching:Re,searchProgress:de,clearConversationResults:g.useCallback(()=>{ye.current+=1,J.current&&(J.current.close(),J.current=null),M(!1),oe(null),Te(null)},[]),setSearchFilter:O,setDeleteConfirmation:te,setSessionDeleteConfirmation:ie,setShowVersionModal:he}}const GR="https://discord.gg/buxwujPNRE",qR="https://github.com/siteboon/claudecodeui/issues/new";function HR({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 VR({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(fj,{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(wt,{className:"h-4 w-4 text-muted-foreground transition-colors group-hover:text-foreground"})}),s.jsx("a",{href:qR,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(x0,{className:"h-4 w-4 text-muted-foreground transition-colors group-hover:text-foreground"})}),s.jsx("a",{href:GR,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(HR,{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(oa,{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 hC(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=hC(e[t]))&&(n&&(n+=" "),n+=r)}else for(r in e)e[r]&&(n&&(n+=" "),n+=r);return n}function fC(){for(var e,t,r=0,n="",a=arguments.length;r<a;r++)(e=arguments[r])&&(t=hC(e))&&(n&&(n+=" "),n+=t);return n}const $b=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,Ub=fC,Lf=(e,t)=>r=>{var n;if(t?.variants==null)return Ub(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=$b(d)||$b(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[b,x]=f;return Array.isArray(x)?x.includes({...i,...l}[b]):{...i,...l}[b]===x})?[...u,p,h]:u},[]);return Ub(e,o,c,r?.class,r?.className)},Pf="-",WR=e=>{const t=YR(e),{conflictingClassGroups:r,conflictingClassGroupModifiers:n}=e;return{getClassGroupId:o=>{const l=o.split(Pf);return l[0]===""&&l.length!==1&&l.shift(),gC(l,t)||KR(o)},getConflictingClassGroupIds:(o,l)=>{const c=r[o]||[];return l&&n[o]?[...c,...n[o]]:c}}},gC=(e,t)=>{if(e.length===0)return t.classGroupId;const r=e[0],n=t.nextPart.get(r),a=n?gC(e.slice(1),n):void 0;if(a)return a;if(t.validators.length===0)return;const i=e.join(Pf);return t.validators.find(({validator:o})=>o(i))?.classGroupId},Gb=/^\[(.+)\]$/,KR=e=>{if(Gb.test(e)){const t=Gb.exec(e)[1],r=t?.substring(0,t.indexOf(":"));if(r)return"arbitrary.."+r}},YR=e=>{const{theme:t,classGroups:r}=e,n={nextPart:new Map,validators:[]};for(const a in r)C0(r[a],n,a,t);return n},C0=(e,t,r,n)=>{e.forEach(a=>{if(typeof a=="string"){const i=a===""?t:qb(t,a);i.classGroupId=r;return}if(typeof a=="function"){if(ZR(a)){C0(a(n),t,r,n);return}t.validators.push({validator:a,classGroupId:r});return}Object.entries(a).forEach(([i,o])=>{C0(o,qb(t,i),r,n)})})},qb=(e,t)=>{let r=e;return t.split(Pf).forEach(n=>{r.nextPart.has(n)||r.nextPart.set(n,{nextPart:new Map,validators:[]}),r=r.nextPart.get(n)}),r},ZR=e=>e.isThemeGetter,XR=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)}}},N0="!",T0=":",JR=T0.length,QR=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 b=a[f];if(o===0&&l===0){if(b===T0){i.push(a.slice(c,f)),c=f+JR;continue}if(b==="/"){u=f;continue}}b==="["?o++:b==="]"?o--:b==="("?l++:b===")"&&l--}const d=i.length===0?a:a.substring(c),p=e8(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+T0,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},e8=e=>e.endsWith(N0)?e.substring(0,e.length-1):e.startsWith(N0)?e.substring(1):e,t8=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}},r8=e=>({cache:XR(e.cacheSize),parseClassName:QR(e),sortModifiers:t8(e),...WR(e)}),n8=/\s+/,a8=(e,t)=>{const{parseClassName:r,getClassGroupId:n,getConflictingClassGroupIds:a,sortModifiers:i}=t,o=[],l=e.trim().split(n8);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:b}=r(d);if(p){c=d+(c.length>0?" "+c:c);continue}let x=!!b,y=n(x?f.substring(0,b):f);if(!y){if(!x){c=d+(c.length>0?" "+c:c);continue}if(y=n(f),!y){c=d+(c.length>0?" "+c:c);continue}x=!1}const v=i(h).join(":"),k=m?v+N0:v,S=k+y;if(o.includes(S))continue;o.push(S);const E=a(y,x);for(let w=0;w<E.length;++w){const I=E[w];o.push(k+I)}c=d+(c.length>0?" "+c:c)}return c};function i8(){let e=0,t,r,n="";for(;e<arguments.length;)(t=arguments[e++])&&(r=bC(t))&&(n&&(n+=" "),n+=r);return n}const bC=e=>{if(typeof e=="string")return e;let t,r="";for(let n=0;n<e.length;n++)e[n]&&(t=bC(e[n]))&&(r&&(r+=" "),r+=t);return r};function s8(e,...t){let r,n,a,i=o;function o(c){const u=t.reduce((d,p)=>p(d),e());return r=r8(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=a8(c,r);return a(c,d),d}return function(){return i(i8.apply(null,arguments))}}const zt=e=>{const t=r=>r[e]||[];return t.isThemeGetter=!0,t},xC=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,yC=/^\((?:(\w[\w-]*):)?(.+)\)$/i,o8=/^\d+\/\d+$/,l8=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,c8=/\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$/,u8=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,d8=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,p8=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Na=e=>o8.test(e),st=e=>!!e&&!Number.isNaN(Number(e)),En=e=>!!e&&Number.isInteger(Number(e)),kl=e=>e.endsWith("%")&&st(e.slice(0,-1)),an=e=>l8.test(e),m8=()=>!0,h8=e=>c8.test(e)&&!u8.test(e),vC=()=>!1,f8=e=>d8.test(e),g8=e=>p8.test(e),b8=e=>!ze(e)&&!Be(e),x8=e=>ri(e,SC,vC),ze=e=>xC.test(e),Yn=e=>ri(e,EC,h8),wl=e=>ri(e,S8,st),Hb=e=>ri(e,kC,vC),y8=e=>ri(e,wC,g8),ps=e=>ri(e,CC,f8),Be=e=>yC.test(e),bi=e=>ni(e,EC),v8=e=>ni(e,E8),Vb=e=>ni(e,kC),k8=e=>ni(e,SC),w8=e=>ni(e,wC),ms=e=>ni(e,CC,!0),ri=(e,t,r)=>{const n=xC.exec(e);return n?n[1]?t(n[1]):r(n[2]):!1},ni=(e,t,r=!1)=>{const n=yC.exec(e);return n?n[1]?t(n[1]):r:!1},kC=e=>e==="position"||e==="percentage",wC=e=>e==="image"||e==="url",SC=e=>e==="length"||e==="size"||e==="bg-size",EC=e=>e==="length",S8=e=>e==="number",E8=e=>e==="family-name",CC=e=>e==="shadow",C8=()=>{const e=zt("color"),t=zt("font"),r=zt("text"),n=zt("font-weight"),a=zt("tracking"),i=zt("leading"),o=zt("breakpoint"),l=zt("container"),c=zt("spacing"),u=zt("radius"),d=zt("shadow"),p=zt("inset-shadow"),h=zt("text-shadow"),m=zt("drop-shadow"),f=zt("blur"),b=zt("perspective"),x=zt("aspect"),y=zt("ease"),v=zt("animate"),k=()=>["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(),Be,ze],w=()=>["auto","hidden","clip","visible","scroll"],I=()=>["auto","contain","none"],_=()=>[Be,ze,c],N=()=>[Na,"full","auto",..._()],j=()=>[En,"none","subgrid",Be,ze],D=()=>["auto",{span:["full",En,Be,ze]},En,Be,ze],A=()=>[En,"auto",Be,ze],L=()=>["auto","min","max","fr",Be,ze],C=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],z=()=>["start","end","center","stretch","center-safe","end-safe"],Y=()=>["auto",..._()],V=()=>[Na,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",..._()],W=()=>[e,Be,ze],G=()=>[...S(),Vb,Hb,{position:[Be,ze]}],O=()=>["no-repeat",{repeat:["","x","y","space","round"]}],$=()=>["auto","cover","contain",k8,x8,{size:[Be,ze]}],B=()=>[kl,bi,Yn],P=()=>["","none","full",u,Be,ze],te=()=>["",st,bi,Yn],K=()=>["solid","dashed","dotted","double"],ie=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],ae=()=>[st,kl,Vb,Hb],he=()=>["","none",f,Be,ze],ge=()=>["none",st,Be,ze],ke=()=>["none",st,Be,ze],xe=()=>[st,Be,ze],Te=()=>[Na,"full",..._()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[an],breakpoint:[an],color:[m8],container:[an],"drop-shadow":[an],ease:["in","out","in-out"],font:[b8],"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",st],text:[an],"text-shadow":[an],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",Na,ze,Be,x]}],container:["container"],columns:[{columns:[st,ze,Be,l]}],"break-after":[{"break-after":k()}],"break-before":[{"break-before":k()}],"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:w()}],"overflow-x":[{"overflow-x":w()}],"overflow-y":[{"overflow-y":w()}],overscroll:[{overscroll:I()}],"overscroll-x":[{"overscroll-x":I()}],"overscroll-y":[{"overscroll-y":I()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:N()}],"inset-x":[{"inset-x":N()}],"inset-y":[{"inset-y":N()}],start:[{start:N()}],end:[{end:N()}],top:[{top:N()}],right:[{right:N()}],bottom:[{bottom:N()}],left:[{left:N()}],visibility:["visible","invisible","collapse"],z:[{z:[En,"auto",Be,ze]}],basis:[{basis:[Na,"full","auto",l,..._()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[st,Na,"auto","initial","none",ze]}],grow:[{grow:["",st,Be,ze]}],shrink:[{shrink:["",st,Be,ze]}],order:[{order:[En,"first","last","none",Be,ze]}],"grid-cols":[{"grid-cols":j()}],"col-start-end":[{col:D()}],"col-start":[{"col-start":A()}],"col-end":[{"col-end":A()}],"grid-rows":[{"grid-rows":j()}],"row-start-end":[{row:D()}],"row-start":[{"row-start":A()}],"row-end":[{"row-end":A()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":L()}],"auto-rows":[{"auto-rows":L()}],gap:[{gap:_()}],"gap-x":[{"gap-x":_()}],"gap-y":[{"gap-y":_()}],"justify-content":[{justify:[...C(),"normal"]}],"justify-items":[{"justify-items":[...z(),"normal"]}],"justify-self":[{"justify-self":["auto",...z()]}],"align-content":[{content:["normal",...C()]}],"align-items":[{items:[...z(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...z(),{baseline:["","last"]}]}],"place-content":[{"place-content":C()}],"place-items":[{"place-items":[...z(),"baseline"]}],"place-self":[{"place-self":["auto",...z()]}],p:[{p:_()}],px:[{px:_()}],py:[{py:_()}],ps:[{ps:_()}],pe:[{pe:_()}],pt:[{pt:_()}],pr:[{pr:_()}],pb:[{pb:_()}],pl:[{pl:_()}],m:[{m:Y()}],mx:[{mx:Y()}],my:[{my:Y()}],ms:[{ms:Y()}],me:[{me:Y()}],mt:[{mt:Y()}],mr:[{mr:Y()}],mb:[{mb:Y()}],ml:[{ml:Y()}],"space-x":[{"space-x":_()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":_()}],"space-y-reverse":["space-y-reverse"],size:[{size:V()}],w:[{w:[l,"screen",...V()]}],"min-w":[{"min-w":[l,"screen","none",...V()]}],"max-w":[{"max-w":[l,"screen","none","prose",{screen:[o]},...V()]}],h:[{h:["screen","lh",...V()]}],"min-h":[{"min-h":["screen","lh","none",...V()]}],"max-h":[{"max-h":["screen","lh",...V()]}],"font-size":[{text:["base",r,bi,Yn]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[n,Be,wl]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",kl,ze]}],"font-family":[{font:[v8,ze,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,Be,ze]}],"line-clamp":[{"line-clamp":[st,"none",Be,wl]}],leading:[{leading:[i,..._()]}],"list-image":[{"list-image":["none",Be,ze]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",Be,ze]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:W()}],"text-color":[{text:W()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...K(),"wavy"]}],"text-decoration-thickness":[{decoration:[st,"from-font","auto",Be,Yn]}],"text-decoration-color":[{decoration:W()}],"underline-offset":[{"underline-offset":[st,"auto",Be,ze]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:_()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",Be,ze]}],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",Be,ze]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:G()}],"bg-repeat":[{bg:O()}],"bg-size":[{bg:$()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},En,Be,ze],radial:["",Be,ze],conic:[En,Be,ze]},w8,y8]}],"bg-color":[{bg:W()}],"gradient-from-pos":[{from:B()}],"gradient-via-pos":[{via:B()}],"gradient-to-pos":[{to:B()}],"gradient-from":[{from:W()}],"gradient-via":[{via:W()}],"gradient-to":[{to:W()}],rounded:[{rounded:P()}],"rounded-s":[{"rounded-s":P()}],"rounded-e":[{"rounded-e":P()}],"rounded-t":[{"rounded-t":P()}],"rounded-r":[{"rounded-r":P()}],"rounded-b":[{"rounded-b":P()}],"rounded-l":[{"rounded-l":P()}],"rounded-ss":[{"rounded-ss":P()}],"rounded-se":[{"rounded-se":P()}],"rounded-ee":[{"rounded-ee":P()}],"rounded-es":[{"rounded-es":P()}],"rounded-tl":[{"rounded-tl":P()}],"rounded-tr":[{"rounded-tr":P()}],"rounded-br":[{"rounded-br":P()}],"rounded-bl":[{"rounded-bl":P()}],"border-w":[{border:te()}],"border-w-x":[{"border-x":te()}],"border-w-y":[{"border-y":te()}],"border-w-s":[{"border-s":te()}],"border-w-e":[{"border-e":te()}],"border-w-t":[{"border-t":te()}],"border-w-r":[{"border-r":te()}],"border-w-b":[{"border-b":te()}],"border-w-l":[{"border-l":te()}],"divide-x":[{"divide-x":te()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":te()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...K(),"hidden","none"]}],"divide-style":[{divide:[...K(),"hidden","none"]}],"border-color":[{border:W()}],"border-color-x":[{"border-x":W()}],"border-color-y":[{"border-y":W()}],"border-color-s":[{"border-s":W()}],"border-color-e":[{"border-e":W()}],"border-color-t":[{"border-t":W()}],"border-color-r":[{"border-r":W()}],"border-color-b":[{"border-b":W()}],"border-color-l":[{"border-l":W()}],"divide-color":[{divide:W()}],"outline-style":[{outline:[...K(),"none","hidden"]}],"outline-offset":[{"outline-offset":[st,Be,ze]}],"outline-w":[{outline:["",st,bi,Yn]}],"outline-color":[{outline:W()}],shadow:[{shadow:["","none",d,ms,ps]}],"shadow-color":[{shadow:W()}],"inset-shadow":[{"inset-shadow":["none",p,ms,ps]}],"inset-shadow-color":[{"inset-shadow":W()}],"ring-w":[{ring:te()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:W()}],"ring-offset-w":[{"ring-offset":[st,Yn]}],"ring-offset-color":[{"ring-offset":W()}],"inset-ring-w":[{"inset-ring":te()}],"inset-ring-color":[{"inset-ring":W()}],"text-shadow":[{"text-shadow":["none",h,ms,ps]}],"text-shadow-color":[{"text-shadow":W()}],opacity:[{opacity:[st,Be,ze]}],"mix-blend":[{"mix-blend":[...ie(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":ie()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[st]}],"mask-image-linear-from-pos":[{"mask-linear-from":ae()}],"mask-image-linear-to-pos":[{"mask-linear-to":ae()}],"mask-image-linear-from-color":[{"mask-linear-from":W()}],"mask-image-linear-to-color":[{"mask-linear-to":W()}],"mask-image-t-from-pos":[{"mask-t-from":ae()}],"mask-image-t-to-pos":[{"mask-t-to":ae()}],"mask-image-t-from-color":[{"mask-t-from":W()}],"mask-image-t-to-color":[{"mask-t-to":W()}],"mask-image-r-from-pos":[{"mask-r-from":ae()}],"mask-image-r-to-pos":[{"mask-r-to":ae()}],"mask-image-r-from-color":[{"mask-r-from":W()}],"mask-image-r-to-color":[{"mask-r-to":W()}],"mask-image-b-from-pos":[{"mask-b-from":ae()}],"mask-image-b-to-pos":[{"mask-b-to":ae()}],"mask-image-b-from-color":[{"mask-b-from":W()}],"mask-image-b-to-color":[{"mask-b-to":W()}],"mask-image-l-from-pos":[{"mask-l-from":ae()}],"mask-image-l-to-pos":[{"mask-l-to":ae()}],"mask-image-l-from-color":[{"mask-l-from":W()}],"mask-image-l-to-color":[{"mask-l-to":W()}],"mask-image-x-from-pos":[{"mask-x-from":ae()}],"mask-image-x-to-pos":[{"mask-x-to":ae()}],"mask-image-x-from-color":[{"mask-x-from":W()}],"mask-image-x-to-color":[{"mask-x-to":W()}],"mask-image-y-from-pos":[{"mask-y-from":ae()}],"mask-image-y-to-pos":[{"mask-y-to":ae()}],"mask-image-y-from-color":[{"mask-y-from":W()}],"mask-image-y-to-color":[{"mask-y-to":W()}],"mask-image-radial":[{"mask-radial":[Be,ze]}],"mask-image-radial-from-pos":[{"mask-radial-from":ae()}],"mask-image-radial-to-pos":[{"mask-radial-to":ae()}],"mask-image-radial-from-color":[{"mask-radial-from":W()}],"mask-image-radial-to-color":[{"mask-radial-to":W()}],"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":[st]}],"mask-image-conic-from-pos":[{"mask-conic-from":ae()}],"mask-image-conic-to-pos":[{"mask-conic-to":ae()}],"mask-image-conic-from-color":[{"mask-conic-from":W()}],"mask-image-conic-to-color":[{"mask-conic-to":W()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:G()}],"mask-repeat":[{mask:O()}],"mask-size":[{mask:$()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",Be,ze]}],filter:[{filter:["","none",Be,ze]}],blur:[{blur:he()}],brightness:[{brightness:[st,Be,ze]}],contrast:[{contrast:[st,Be,ze]}],"drop-shadow":[{"drop-shadow":["","none",m,ms,ps]}],"drop-shadow-color":[{"drop-shadow":W()}],grayscale:[{grayscale:["",st,Be,ze]}],"hue-rotate":[{"hue-rotate":[st,Be,ze]}],invert:[{invert:["",st,Be,ze]}],saturate:[{saturate:[st,Be,ze]}],sepia:[{sepia:["",st,Be,ze]}],"backdrop-filter":[{"backdrop-filter":["","none",Be,ze]}],"backdrop-blur":[{"backdrop-blur":he()}],"backdrop-brightness":[{"backdrop-brightness":[st,Be,ze]}],"backdrop-contrast":[{"backdrop-contrast":[st,Be,ze]}],"backdrop-grayscale":[{"backdrop-grayscale":["",st,Be,ze]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[st,Be,ze]}],"backdrop-invert":[{"backdrop-invert":["",st,Be,ze]}],"backdrop-opacity":[{"backdrop-opacity":[st,Be,ze]}],"backdrop-saturate":[{"backdrop-saturate":[st,Be,ze]}],"backdrop-sepia":[{"backdrop-sepia":["",st,Be,ze]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":_()}],"border-spacing-x":[{"border-spacing-x":_()}],"border-spacing-y":[{"border-spacing-y":_()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",Be,ze]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[st,"initial",Be,ze]}],ease:[{ease:["linear","initial",y,Be,ze]}],delay:[{delay:[st,Be,ze]}],animate:[{animate:["none",v,Be,ze]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[b,Be,ze]}],"perspective-origin":[{"perspective-origin":E()}],rotate:[{rotate:ge()}],"rotate-x":[{"rotate-x":ge()}],"rotate-y":[{"rotate-y":ge()}],"rotate-z":[{"rotate-z":ge()}],scale:[{scale:ke()}],"scale-x":[{"scale-x":ke()}],"scale-y":[{"scale-y":ke()}],"scale-z":[{"scale-z":ke()}],"scale-3d":["scale-3d"],skew:[{skew:xe()}],"skew-x":[{"skew-x":xe()}],"skew-y":[{"skew-y":xe()}],transform:[{transform:[Be,ze,"","none","gpu","cpu"]}],"transform-origin":[{origin:E()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:Te()}],"translate-x":[{"translate-x":Te()}],"translate-y":[{"translate-y":Te()}],"translate-z":[{"translate-z":Te()}],"translate-none":["translate-none"],accent:[{accent:W()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:W()}],"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",Be,ze]}],"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":_()}],"scroll-mx":[{"scroll-mx":_()}],"scroll-my":[{"scroll-my":_()}],"scroll-ms":[{"scroll-ms":_()}],"scroll-me":[{"scroll-me":_()}],"scroll-mt":[{"scroll-mt":_()}],"scroll-mr":[{"scroll-mr":_()}],"scroll-mb":[{"scroll-mb":_()}],"scroll-ml":[{"scroll-ml":_()}],"scroll-p":[{"scroll-p":_()}],"scroll-px":[{"scroll-px":_()}],"scroll-py":[{"scroll-py":_()}],"scroll-ps":[{"scroll-ps":_()}],"scroll-pe":[{"scroll-pe":_()}],"scroll-pt":[{"scroll-pt":_()}],"scroll-pr":[{"scroll-pr":_()}],"scroll-pb":[{"scroll-pb":_()}],"scroll-pl":[{"scroll-pl":_()}],"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",Be,ze]}],fill:[{fill:["none",...W()]}],"stroke-w":[{stroke:[st,bi,Yn,wl]}],stroke:[{stroke:["none",...W()]}],"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"]}},N8=s8(C8);function ve(...e){return N8(fC(e))}function T8(e){if(!e||typeof e!="string")return null;try{return JSON.parse(e)}catch{return null}}const A8=Lf("relative w-full rounded-lg border px-4 py-3 text-sm grid has-[>svg]:grid-cols-[calc(var(--spacing)*4)_1fr] grid-cols-[0_1fr] has-[>svg]:gap-x-3 gap-y-0.5 items-start [&>svg]:size-4 [&>svg]:translate-y-0.5 [&>svg]:text-current",{variants:{variant:{default:"bg-card text-card-foreground",destructive:"text-destructive bg-card [&>svg]:text-current *:data-[slot=alert-description]:text-destructive/90"}},defaultVariants:{variant:"default"}}),NC=g.forwardRef(({className:e,variant:t,...r},n)=>s.jsx("div",{ref:n,role:"alert","data-slot":"alert",className:ve(A8({variant:t}),e),...r}));NC.displayName="Alert";const I8=g.forwardRef(({className:e,...t},r)=>s.jsx("div",{ref:r,"data-slot":"alert-title",className:ve("col-start-2 line-clamp-1 min-h-4 font-medium tracking-tight",e),...t}));I8.displayName="AlertTitle";const j8=g.forwardRef(({className:e,...t},r)=>s.jsx("div",{ref:r,"data-slot":"alert-description",className:ve("text-muted-foreground col-start-2 grid justify-items-start gap-1 text-sm [&_p]:leading-relaxed",e),...t}));j8.displayName="AlertDescription";const _8=Lf("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 Ln({className:e,variant:t,...r}){return s.jsx("div",{className:ve(_8({variant:t}),e),...r})}const R8=Lf("inline-flex touch-manipulation items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",{variants:{variant:{default:"bg-primary text-primary-foreground shadow hover:bg-primary/90 active:bg-primary/80",destructive:"bg-destructive text-destructive-foreground shadow-sm hover:bg-destructive/90 active:bg-destructive/80",outline:"border border-input bg-background shadow-sm hover:bg-accent hover:text-accent-foreground active:bg-accent/80",secondary:"bg-secondary text-secondary-foreground shadow-sm hover:bg-secondary/80 active:bg-secondary/70",ghost:"hover:bg-accent hover:text-accent-foreground active:bg-accent/80",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-10 px-4 py-2",sm:"h-9 rounded-md px-3 text-sm",lg:"h-11 rounded-md px-8",icon:"h-10 w-10"}},defaultVariants:{variant:"default",size:"default"}}),Fe=g.forwardRef(({className:e,variant:t,size:r,...n},a)=>s.jsx("button",{className:ve(R8({variant:t,size:r,className:e})),ref:a,...n}));Fe.displayName="Button";const TC=g.createContext(null),AC=()=>{const e=g.useContext(TC);if(!e)throw new Error("Confirmation components must be used within Confirmation");return e},IC=({className:e,approval:t="pending",children:r,...n})=>{const a=g.useMemo(()=>({approval:t}),[t]);return s.jsx(TC.Provider,{value:a,children:s.jsx(NC,{className:ve("flex flex-col gap-2",e),...n,children:r})})};IC.displayName="Confirmation";const jC=({className:e,...t})=>s.jsx("div",{"data-slot":"confirmation-title",className:ve("text-muted-foreground inline text-sm",e),...t});jC.displayName="ConfirmationTitle";const _C=({children:e})=>{const{approval:t}=AC();return t!=="pending"?null:s.jsx(s.Fragment,{children:e})};_C.displayName="ConfirmationRequest";const RC=({className:e,...t})=>{const{approval:r}=AC();return r!=="pending"?null:s.jsx("div",{"data-slot":"confirmation-actions",className:ve("flex items-center justify-end gap-2 self-end",e),...t})};RC.displayName="ConfirmationActions";const Hs=({variant:e="default",...t})=>s.jsx(Fe,{className:"h-8 px-3 text-sm",variant:e,type:"button",...t});Hs.displayName="ConfirmationAction";const Ff=g.forwardRef(({className:e,...t},r)=>s.jsx("div",{ref:r,className:ve("rounded-xl border bg-card text-card-foreground shadow-sm",e),...t}));Ff.displayName="Card";const DC=g.forwardRef(({className:e,...t},r)=>s.jsx("div",{ref:r,className:ve("flex flex-col space-y-1.5 p-4",e),...t}));DC.displayName="CardHeader";const MC=g.forwardRef(({className:e,...t},r)=>s.jsx("h3",{ref:r,className:ve("font-semibold leading-none tracking-tight",e),...t}));MC.displayName="CardTitle";const D8=g.forwardRef(({className:e,...t},r)=>s.jsx("p",{ref:r,className:ve("text-sm text-muted-foreground",e),...t}));D8.displayName="CardDescription";const OC=g.forwardRef(({className:e,...t},r)=>s.jsx("div",{ref:r,className:ve("p-4 pt-0",e),...t}));OC.displayName="CardContent";const LC=g.forwardRef(({className:e,...t},r)=>s.jsx("div",{ref:r,className:ve("flex items-center p-4 pt-0",e),...t}));LC.displayName="CardFooter";const M8=g.forwardRef(({className:e,...t},r)=>s.jsx("div",{ref:r,className:ve("ml-auto shrink-0",e),...t}));M8.displayName="CardAction";const PC=g.createContext(null);function FC(){const e=g.useContext(PC);if(!e)throw new Error("Collapsible components must be used within <Collapsible>");return e}const la=g.forwardRef(({defaultOpen:e=!1,open:t,onOpenChange:r,className:n,children:a,...i},o)=>{const[l,c]=g.useState(e),u=t!==void 0,d=u?t:l,p=g.useCallback(m=>{u||c(m),r?.(m)},[u,r]),h=g.useMemo(()=>({open:d,onOpenChange:p}),[d,p]);return s.jsx(PC.Provider,{value:h,children:s.jsx("div",{ref:o,"data-state":d?"open":"closed",className:n,...i,children:a})})});la.displayName="Collapsible";const Bn=g.forwardRef(({onClick:e,children:t,className:r,...n},a)=>{const{open:i,onOpenChange:o}=FC(),l=g.useCallback(c=>{o(!i),e?.(c)},[i,o,e]);return s.jsx("button",{ref:a,type:"button","aria-expanded":i,"data-state":i?"open":"closed",onClick:l,className:r,...n,children:t})});Bn.displayName="CollapsibleTrigger";const ca=g.forwardRef(({className:e,children:t,...r},n)=>{const{open:a}=FC();return s.jsx("div",{ref:n,"data-state":a?"open":"closed",className:ve("grid transition-[grid-template-rows] duration-200 ease-out",a?"grid-rows-[1fr]":"grid-rows-[0fr]",e),...r,children:s.jsx("div",{className:"overflow-hidden",children:t})})});ca.displayName="CollapsibleContent";const zC=g.createContext(null);function zf(){const e=g.useContext(zC);if(!e)throw new Error("Command components must be used within <Command>");return e}const BC=g.forwardRef(({className:e,children:t,...r},n)=>{const[a,i]=g.useState(""),o=g.useRef(new Map),[l,c]=g.useState(0),u=g.useCallback(v=>{o.current.set(v.id,v),c(k=>k+1)},[]),d=g.useCallback(v=>{o.current.delete(v),c(k=>k+1)},[]),p=g.useCallback((v,k)=>{const S=o.current.get(v);S&&Object.assign(S,k)},[]),h=g.useMemo(()=>{const v=a.toLowerCase(),k=new Set;for(const[S,E]of o.current)(!v||E.value.includes(v))&&k.add(S);return k},[a,l]),m=g.useMemo(()=>{const v=[];for(const[,k]of o.current)h.has(k.id)&&v.push(k);return v},[h]),[f,b]=g.useState(null);g.useEffect(()=>{b(m.length>0?m[0].id:null)},[m]);const x=g.useCallback(v=>{if(v.key==="ArrowDown"||v.key==="ArrowUp"||v.key==="Enter")v.preventDefault();else return;const k=m;if(k.length===0)return;if(v.key==="Enter"){k.find(N=>N.id===f)?.onSelect();return}const S=k.findIndex(_=>_.id===f);let E;v.key==="ArrowDown"?E=S<k.length-1?S+1:0:E=S>0?S-1:k.length-1;const w=k[E].id;b(w),k[E].element?.scrollIntoView({block:"nearest"})},[m,f]),y=g.useMemo(()=>({search:a,setSearch:i,visibleIds:h,activeId:f,setActiveId:b,register:u,unregister:d,updateEntry:p}),[a,h,f,u,d,p]);return s.jsx(zC.Provider,{value:y,children:s.jsx("div",{ref:n,role:"combobox","aria-expanded":"true","aria-haspopup":"listbox",className:ve("flex flex-col",e),onKeyDown:x,...r,children:t})})});BC.displayName="Command";const $C=g.forwardRef(({className:e,placeholder:t="Search...",...r},n)=>{const{search:a,setSearch:i}=zf();return s.jsxs("div",{className:"flex items-center border-b px-3",role:"presentation",children:[s.jsx(hn,{className:"mr-2 h-4 w-4 shrink-0 text-muted-foreground","aria-hidden":!0}),s.jsx("input",{ref:n,type:"text",role:"searchbox","aria-autocomplete":"list",autoComplete:"off",autoCorrect:"off",spellCheck:!1,value:a,onChange:o=>i(o.target.value),placeholder:t,className:ve("flex h-11 w-full rounded-md bg-transparent py-3 text-sm outline-none","placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50",e),...r})]})});$C.displayName="CommandInput";const UC=g.forwardRef(({className:e,...t},r)=>s.jsx("div",{ref:r,role:"listbox",className:ve("max-h-[300px] overflow-y-auto overflow-x-hidden",e),...t}));UC.displayName="CommandList";const GC=g.forwardRef(({className:e,...t},r)=>{const{search:n,visibleIds:a}=zf();return!n||a.size>0?null:s.jsx("div",{ref:r,className:ve("py-6 text-center text-sm text-muted-foreground",e),...t})});GC.displayName="CommandEmpty";const qC=g.forwardRef(({className:e,heading:t,children:r,...n},a)=>s.jsxs("div",{ref:a,className:ve("overflow-hidden p-1",e),role:"group","aria-label":typeof t=="string"?t:void 0,...n,children:[t&&s.jsx("div",{className:"px-2 py-1.5 text-xs font-medium text-muted-foreground",role:"presentation",children:t}),r]}));qC.displayName="CommandGroup";const HC=g.forwardRef(({className:e,value:t,onSelect:r,disabled:n,children:a,...i},o)=>{const{visibleIds:l,activeId:c,setActiveId:u,register:d,unregister:p,updateEntry:h}=zf(),m=g.useId(),f=g.useRef(null),b=t||(typeof a=="string"?a:"");g.useEffect(()=>(d({id:m,value:b.toLowerCase(),onSelect:r||(()=>{}),element:f.current}),()=>p(m)),[m,b,d,p]),g.useEffect(()=>{h(m,{onSelect:r||(()=>{})})},[m,r,h]);const x=g.useCallback(v=>{f.current=v,h(m,{element:v}),typeof o=="function"?o(v):o&&(o.current=v)},[m,h,o]);if(!l.has(m))return null;const y=c===m;return s.jsx("div",{ref:x,role:"option","aria-selected":y,"aria-disabled":n||void 0,"data-active":y||void 0,className:ve("relative flex cursor-pointer select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none",y&&"bg-accent text-accent-foreground",n&&"pointer-events-none opacity-50",e),onPointerMove:()=>{!n&&c!==m&&u(m)},onClick:()=>!n&&r?.(),...i,children:a})});HC.displayName="CommandItem";const O8=g.forwardRef(({className:e,...t},r)=>s.jsx("div",{ref:r,className:ve("-mx-1 h-px bg-border",e),...t}));O8.displayName="CommandSeparator";function A0({checked:e,onToggle:t,ariaLabel:r="Toggle dark mode"}){const{isDarkMode:n,toggleDarkMode:a}=ei(),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:ve("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:ve("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(_f,{className:"h-3 w-3 text-primary"}):s.jsx(Rf,{className:"h-3 w-3 text-white dark:text-background"})})]})}const VC=g.createContext(null);function WC(){const e=g.useContext(VC);if(!e)throw new Error("Dialog components must be used within <Dialog>");return e}const L8=({open:e,onOpenChange:t,defaultOpen:r=!1,children:n})=>{const[a,i]=g.useState(r),o=g.useRef(null),l=e!==void 0,c=l?e:a,u=g.useCallback(p=>{l||i(p),t?.(p)},[l,t]),d=g.useMemo(()=>({open:c,onOpenChange:u,triggerRef:o}),[c,u]);return s.jsx(VC.Provider,{value:d,children:n})},KC=g.forwardRef(({onClick:e,children:t,asChild:r,...n},a)=>{const{onOpenChange:i,triggerRef:o}=WC(),l=g.useCallback(c=>{i(!0),e?.(c)},[i,e]);if(r&&g.isValidElement(t)){const c=t;return g.cloneElement(c,{onClick:u=>{i(!0),c.props.onClick?.(u)},ref:u=>{o.current=u,typeof a=="function"?a(u):a&&(a.current=u)}})}return s.jsx("button",{ref:c=>{o.current=c,typeof a=="function"?a(c):a&&(a.current=c)},type:"button",onClick:l,...n,children:t})});KC.displayName="DialogTrigger";const Wb='a[href], button:not([disabled]), input:not([disabled]), textarea:not([disabled]), select:not([disabled]), [tabindex]:not([tabindex="-1"])',YC=g.forwardRef(({className:e,children:t,onEscapeKeyDown:r,onPointerDownOutside:n,...a},i)=>{const{open:o,onOpenChange:l,triggerRef:c}=WC(),u=g.useRef(null),d=g.useRef(null);return g.useEffect(()=>{o?d.current=document.activeElement:d.current&&((c.current||d.current)?.focus(),d.current=null)},[o,c]),g.useEffect(()=>{if(!o)return;const p=m=>{if(m.key==="Escape"){m.stopPropagation(),r?.(),l(!1);return}if(m.key==="Tab"&&u.current){const f=Array.from(u.current.querySelectorAll(Wb));if(f.length===0)return;const b=f[0],x=f[f.length-1];m.shiftKey&&document.activeElement===b?(m.preventDefault(),x.focus()):!m.shiftKey&&document.activeElement===x&&(m.preventDefault(),b.focus())}};document.addEventListener("keydown",p,!0);const h=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.removeEventListener("keydown",p,!0),document.body.style.overflow=h}},[o,l,r]),g.useEffect(()=>{o&&u.current&&requestAnimationFrame(()=>{u.current?.querySelector(Wb)?.focus()})},[o]),o?Ef.createPortal(s.jsxs("div",{className:"fixed inset-0 z-50",children:[s.jsx("div",{className:"fixed inset-0 animate-dialog-overlay-show bg-black/50 backdrop-blur-sm",onClick:()=>{n?.(),l(!1)},"aria-hidden":!0}),s.jsx("div",{ref:p=>{u.current=p,typeof i=="function"?i(p):i&&(i.current=p)},role:"dialog","aria-modal":"true",className:ve("fixed left-1/2 top-1/2 z-50 w-full max-w-lg -translate-x-1/2 -translate-y-1/2","rounded-xl border bg-popover text-popover-foreground shadow-lg","animate-dialog-content-show",e),...a,children:t})]}),document.body):null});YC.displayName="DialogContent";const ZC=g.forwardRef(({className:e,...t},r)=>s.jsx("h2",{ref:r,className:ve("sr-only",e),...t}));ZC.displayName="DialogTitle";const Nt=g.forwardRef(({className:e,type:t,...r},n)=>s.jsx("input",{type:t,className:ve("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}));Nt.displayName="Input";const Bf=g.forwardRef(({className:e,children:t,...r},n)=>s.jsx("div",{className:ve(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})}));Bf.displayName="ScrollArea";const ho=g.memo(({children:e,className:t,as:r="span"})=>s.jsx(r,{className:ve("animate-shimmer inline-block bg-[length:250%_100%] bg-clip-text text-transparent","bg-[linear-gradient(90deg,transparent_33%,hsl(var(--foreground))_50%,transparent_67%),linear-gradient(hsl(var(--muted-foreground)),hsl(var(--muted-foreground)))]",t),children:e}));ho.displayName="Shimmer";const XC=g.createContext(null),P8=()=>{const e=g.useContext(XC);if(!e)throw new Error("Reasoning components must be used within Reasoning");return e},F8=1e3,z8=1e3,I0=g.memo(({className:e,isStreaming:t=!1,open:r,defaultOpen:n,onOpenChange:a,duration:i,children:o,...l})=>{const c=n??t,u=n===!1,[d,p]=g.useState(c),h=r!==void 0,m=h?r:d,f=g.useCallback(w=>{h||p(w),a?.(w)},[h,a]),[b,x]=g.useState(i),y=g.useRef(t),[v,k]=g.useState(!1),S=g.useRef(null);g.useEffect(()=>{i!==void 0&&x(i)},[i]),g.useEffect(()=>{t?(y.current=!0,S.current===null&&(S.current=Date.now())):S.current!==null&&(x(Math.ceil((Date.now()-S.current)/z8)),S.current=null)},[t]),g.useEffect(()=>{t&&!m&&!u&&f(!0)},[t,m,f,u]),g.useEffect(()=>{if(y.current&&!t&&m&&!v){const w=setTimeout(()=>{f(!1),k(!0)},F8);return()=>clearTimeout(w)}},[t,m,f,v]);const E=g.useMemo(()=>({duration:b,isOpen:m,isStreaming:t,setIsOpen:f}),[b,m,t,f]);return s.jsx(XC.Provider,{value:E,children:s.jsx(la,{open:m,onOpenChange:f,className:ve("not-prose",e),...l,children:o})})});I0.displayName="Reasoning";const B8=(e,t)=>e||t===0?s.jsx(ho,{children:"Thinking..."}):t===void 0?s.jsx("p",{children:"Thought for a few seconds"}):s.jsxs("p",{children:["Thought for ",t," seconds"]}),j0=g.memo(({className:e,children:t,getThinkingMessage:r=B8,...n})=>{const{isStreaming:a,isOpen:i,duration:o}=P8();return s.jsx(Bn,{className:ve("flex w-full items-center gap-2 text-sm text-muted-foreground transition-colors hover:text-foreground",e),...n,children:t??s.jsxs(s.Fragment,{children:[s.jsx(Po,{className:"h-4 w-4"}),r(a,o),s.jsx(or,{className:ve("h-4 w-4 transition-transform",i?"rotate-180":"rotate-0")})]})})});j0.displayName="ReasoningTrigger";const _0=g.memo(({className:e,children:t,...r})=>s.jsx(ca,{className:ve("mt-4 text-sm text-muted-foreground",e),...r,children:t}));_0.displayName="ReasoningContent";function $8(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 dn({children:e,content:t,position:r="top",className:n="",delay:a=350}){const[i,o]=g.useState(!1),l=g.useRef(null),c=g.useRef(!1),u=g.useRef(null),d=g.useRef(null),[p,h]=g.useState(null),m=g.useCallback(()=>{const k=u.current;if(!k)return;const S=k.getBoundingClientRect(),E=8,w={position:"fixed",zIndex:9999};switch(r){case"bottom":w.left=S.left+S.width/2,w.top=S.bottom+E,w.transform="translateX(-50%)";break;case"left":w.left=S.left-E,w.top=S.top+S.height/2,w.transform="translate(-100%, -50%)";break;case"right":w.left=S.right+E,w.top=S.top+S.height/2,w.transform="translateY(-50%)";break;case"top":default:w.left=S.left+S.width/2,w.top=S.top-E,w.transform="translate(-50%, -100%)";break}h(w)},[r]),f=()=>{l.current!==null&&(window.clearTimeout(l.current),l.current=null)},b=()=>{f(),l.current=window.setTimeout(()=>{o(!0)},a)},x=()=>{f(),o(!1)},y=()=>{f(),c.current=!1,l.current=window.setTimeout(()=>{c.current=!0,o(!0)},a)},v=()=>{f(),!c.current&&o(!1)};return g.useEffect(()=>()=>{f()},[]),g.useEffect(()=>{if(!i||typeof document>"u")return;const k=S=>{const E=S.target;E instanceof Node&&u.current?.contains(E)||(o(!1),c.current=!1)};return document.addEventListener("pointerdown",k,!0),()=>document.removeEventListener("pointerdown",k,!0)},[i]),g.useEffect(()=>{if(!i){h(null);return}const k=window.requestAnimationFrame(m),S=()=>m();return window.addEventListener("resize",S),window.addEventListener("scroll",S,!0),()=>{window.cancelAnimationFrame(k),window.removeEventListener("resize",S),window.removeEventListener("scroll",S,!0)}},[i,m]),t?s.jsxs("div",{ref:u,className:"relative inline-block",onMouseEnter:b,onMouseLeave:x,onTouchStart:y,onTouchEnd:v,onTouchCancel:v,children:[e,i&&typeof document<"u"&&Ef.createPortal(s.jsxs("div",{ref:d,style:p||{position:"fixed",top:"-9999px",left:"-9999px",opacity:0},className:ve("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:ve("absolute w-0 h-0 border-4 border-transparent",$8(r))})]}),document.body)]}):s.jsx(s.Fragment,{children:e})}const JC=g.createContext(null),QC=g.forwardRef(({className:e,status:t="ready",children:r,...n},a)=>{const i=g.useMemo(()=>({status:t}),[t]);return s.jsx(JC.Provider,{value:i,children:s.jsx("form",{ref:a,"data-slot":"prompt-input",className:ve("relative overflow-hidden rounded-xl border border-border/50 bg-card/80 shadow-sm backdrop-blur-sm transition-all duration-200 focus-within:border-primary/30 focus-within:shadow-md focus-within:ring-1 focus-within:ring-primary/15",e),...n,children:r})})});QC.displayName="PromptInput";const eN=g.forwardRef(({className:e,...t},r)=>s.jsx("div",{ref:r,"data-slot":"prompt-input-header",className:ve("px-3 pt-3",e),...t}));eN.displayName="PromptInputHeader";const tN=g.forwardRef(({className:e,...t},r)=>s.jsx("div",{ref:r,"data-slot":"prompt-input-body",className:ve("relative",e),...t}));tN.displayName="PromptInputBody";const rN=g.forwardRef(({className:e,...t},r)=>s.jsx("textarea",{ref:r,"data-slot":"prompt-input-textarea",className:ve("chat-input-placeholder block max-h-[40vh] w-full resize-none overflow-y-auto bg-transparent px-4 py-2 text-sm leading-6 text-foreground placeholder-muted-foreground/50 focus:outline-none sm:max-h-[300px]",e),...t}));rN.displayName="PromptInputTextarea";const nN=g.forwardRef(({className:e,...t},r)=>s.jsx("div",{ref:r,"data-slot":"prompt-input-footer",className:ve("flex items-center justify-between border-t border-border/30 px-3 py-2",e),...t}));nN.displayName="PromptInputFooter";const aN=g.forwardRef(({className:e,...t},r)=>s.jsx("div",{ref:r,"data-slot":"prompt-input-tools",className:ve("flex items-center gap-1",e),...t}));aN.displayName="PromptInputTools";const Vs=g.forwardRef(({className:e,tooltip:t,children:r,...n},a)=>{const i=s.jsx(Fe,{ref:a,type:"button",variant:"ghost",size:"icon",className:ve("h-8 w-8 [&_svg]:size-4",e),...n,children:r});return t?s.jsx(dn,{content:t.shortcut?s.jsxs("span",{className:"flex items-center gap-1.5",children:[t.content,s.jsx("kbd",{className:"rounded bg-white/20 px-1 text-[10px]",children:t.shortcut})]}):t.content,position:t.side??"top",children:i}):i});Vs.displayName="PromptInputButton";const iN=g.forwardRef(({className:e,status:t,children:r,...n},a)=>{const i=g.useContext(JC),o=t??i?.status??"ready",l=o==="submitted"||o==="streaming";return s.jsx(Fe,{ref:a,type:l?"button":"submit",variant:"default",size:"icon",className:ve("h-8 w-8 rounded-lg",e),...n,children:r??(l?s.jsx(Wj,{className:"h-3.5 w-3.5 fill-current"}):s.jsx(Rj,{className:"h-4 w-4"}))})});iN.displayName="PromptInputSubmit";function $f({children:e,className:t}){return s.jsx("div",{className:ve("inline-flex items-center gap-[2px] rounded-lg bg-muted/60 p-[3px]",t),children:e})}function Uf({isActive:e,onClick:t,children:r,className:n}){return s.jsx("button",{onClick:t,className:ve("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 sN=g.createContext(null);function oN(){const e=g.useContext(sN);if(!e)throw new Error("QueueItem sub-components must be used within <QueueItem>");return e}const lN=g.forwardRef(({className:e,...t},r)=>s.jsx("div",{ref:r,"data-slot":"queue",role:"list",className:ve("space-y-0.5",e),...t}));lN.displayName="Queue";const cN=g.forwardRef(({status:e="pending",className:t,children:r,...n},a)=>{const i=g.useMemo(()=>({status:e}),[e]);return s.jsx(sN.Provider,{value:i,children:s.jsx("div",{ref:a,"data-slot":"queue-item","data-status":e,role:"listitem",className:ve("flex items-start gap-2 py-0.5",t),...n,children:r})})});cN.displayName="QueueItem";const uN=g.forwardRef(({className:e,...t},r)=>{const{status:n}=oN();return s.jsxs("div",{ref:r,"data-slot":"queue-item-indicator","aria-hidden":"true",className:ve("mt-0.5 flex h-3.5 w-3.5 flex-shrink-0 items-center justify-center",e),...t,children:[n==="completed"&&s.jsx("svg",{className:"h-3.5 w-3.5 text-green-500 dark:text-green-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z"})}),n==="in_progress"&&s.jsx("span",{className:"h-2 w-2 animate-pulse rounded-full bg-blue-500 dark:bg-blue-400"}),n==="pending"&&s.jsx("svg",{className:"h-3.5 w-3.5 text-muted-foreground/50",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:s.jsx("circle",{cx:"12",cy:"12",r:"9",strokeWidth:2})})]})});uN.displayName="QueueItemIndicator";const dN=g.forwardRef(({className:e,children:t,...r},n)=>{const{status:a}=oN();return s.jsx("div",{ref:n,"data-slot":"queue-item-content",className:ve("min-w-0 flex-1 text-xs",a==="completed"&&"text-muted-foreground line-through",a==="in_progress"&&"font-medium text-foreground",a==="pending"&&"text-foreground",e),...r,children:t})});dN.displayName="QueueItemContent";const Kb="https://github.com/siteboon/claudecodeui/issues/new",U8="https://github.com/siteboon/claudecodeui",Yb="https://discord.gg/buxwujPNRE";function Zb({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 G8({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(Cb,{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(Cb,{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:Kb,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(x0,{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:Yb,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(Zb,{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(wt,{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:U8,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:Kb,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(x0,{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:Yb,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(Zb,{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(wt,{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 Xb="CLOUDCLI_GITHUB_STARS",Jb="CLOUDCLI_HIDE_GITHUB_STAR",q8=3600*1e3,H8=(e,t)=>{const[r,n]=g.useState(null),[a,i]=g.useState(()=>{try{return localStorage.getItem(Jb)==="true"}catch{return!1}});g.useEffect(()=>{if(a)return;try{const u=localStorage.getItem(Xb);if(u){const d=JSON.parse(u);if(Date.now()-d.timestamp<q8){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(Xb,JSON.stringify({count:p,timestamp:Date.now()}))}catch{}}}catch{}})()},[e,t,a]);const o=g.useCallback(()=>{i(!0);try{localStorage.setItem(Jb,"true")}catch{}},[]),l=r!==null?r>=1e3?`${(r/1e3).toFixed(1)}k`:`${r}`:null;return{starCount:r,formattedCount:l,isDismissed:a,dismiss:o}},V8="https://github.com/siteboon/claudecodeui";function W8({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 K8(){const{formattedCount:e,isDismissed:t,dismiss:r}=H8("siteboon","claudecodeui");return t?null:s.jsxs("div",{className:"group/star relative hidden md:block",children:[s.jsxs("a",{href:V8,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(W8,{className:"h-3.5 w-3.5"}),s.jsx(lo,{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(xt,{className:"h-2.5 w-2.5"})})]})}function Y8({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(Fe,{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(lr,{className:`h-3.5 w-3.5 ${d?"animate-spin":""}`})}),s.jsx(Fe,{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(Fe,{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(mj,{className:"h-3.5 w-3.5"})})]})]}),s.jsx(K8,{}),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:ve("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(zr,{className:"h-3 w-3"}),m("search.modeProjects")]}),s.jsxs("button",{onClick:()=>c("conversations"),"aria-pressed":l==="conversations",className:ve("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(zn,{className:"h-3 w-3"}),m("search.modeConversations")]})]}),s.jsxs("div",{className:"relative",children:[s.jsx(hn,{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(Nt,{type:"text",placeholder:m(l==="conversations"?"search.conversationsPlaceholder":"projects.searchPlaceholder"),value:a,onChange:b=>i(b.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(xt,{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(lr,{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(Va,{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:ve("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(zr,{className:"h-3 w-3"}),m("search.modeProjects")]}),s.jsxs("button",{onClick:()=>c("conversations"),"aria-pressed":l==="conversations",className:ve("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(zn,{className:"h-3 w-3"}),m("search.modeConversations")]})]}),s.jsxs("div",{className:"relative",children:[s.jsx(hn,{className:"pointer-events-none absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground/50"}),s.jsx(Nt,{type:"text",placeholder:m(l==="conversations"?"search.conversationsPlaceholder":"projects.searchPlaceholder"),value:a,onChange:b=>i(b.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(xt,{className:"h-3.5 w-3.5 text-muted-foreground"})})]})]})]}),s.jsx("div",{className:"nav-divider md:hidden"})]})}const Qb={xs:"w-3 h-3",sm:"w-4 h-4",md:"w-5 h-5",lg:"w-6 h-6"},Z8={xs:"p-0.5",sm:"p-1",md:"p-1.5",lg:"p-2"},X8=e=>e==="fully-configured"?{icon:Fo,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:wt,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:es,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:xt,colorClassName:"text-gray-400 dark:text-gray-500",backgroundClassName:"bg-gray-50 dark:bg-gray-900",label:"No TaskMaster",title:"TaskMaster not configured"};function J8({status:e="not-configured",size:t="sm",className:r="",showLabel:n=!1}){const a=X8(e),i=a.icon;return n?s.jsxs("div",{className:ve("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:Qb[t]}),s.jsx("span",{className:"font-medium",children:a.label})]}):s.jsx("div",{className:ve("inline-flex items-center justify-center rounded-full transition-colors",a.backgroundClassName,Z8[t],r),title:a.title,children:s.jsx(i,{className:ve(Qb[t],a.colorClassName)})})}const Q8=(e,t)=>{const r=new Date(e);if(Number.isNaN(r.getTime()))return"";const n=Math.floor(Math.max(0,t.getTime()-r.getTime())/(1e3*60));if(n<1)return"<1m";if(n<60)return`${n}m`;const a=Math.floor(n/60);return a<24?`${a}hr`:`${Math.floor(a/24)}d`};function eD({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=PR(t,n,m),b=r?.id===t.id,x=Q8(f.sessionTime,n),y=()=>{d(e),p(t,e.projectId)},v=()=>{u(e.projectId,t.id,i,t.__provider)},k=()=>{h(e.projectId,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:ve("p-2 mx-3 my-0.5 rounded-md bg-card border active:scale-[0.98] transition-all duration-150 relative",b?"bg-primary/5 border-primary/20":"",!b&&f.isActive?"border-green-500/30 bg-green-50/5 dark:bg-green-900/5":"border-border/30"),onClick:y,children:s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("div",{className:ve("w-5 h-5 rounded-md flex items-center justify-center flex-shrink-0",b?"bg-primary/10":"bg-muted/50"),children:s.jsx(Qr,{provider:t.__provider,className:"h-3 w-3"})}),s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("div",{className:"truncate text-xs font-medium text-foreground",children:f.sessionName}),x&&s.jsx("span",{className:"ml-auto flex-shrink-0 text-[11px] text-muted-foreground",children:x})]}),s.jsx("div",{className:"mt-0.5 flex items-center",children:f.messageCount>0&&s.jsx(Ln,{variant:"secondary",className:"px-1 py-0 text-xs",children:f.messageCount})})]}),!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:S=>{S.stopPropagation(),k()},children:s.jsx(tr,{className:"h-2.5 w-2.5 text-red-600 dark:text-red-400"})})]})})}),s.jsxs("div",{className:"hidden md:block",children:[s.jsx(Fe,{variant:"ghost",className:ve("w-full justify-start p-2 h-auto font-normal text-left hover:bg-accent/50 transition-colors duration-200",b&&"bg-accent text-accent-foreground"),onClick:()=>p(t,e.projectId),children:s.jsxs("div",{className:"flex w-full min-w-0 items-start gap-2",children:[s.jsx(Qr,{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.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("div",{className:"truncate text-xs font-medium text-foreground",children:f.sessionName}),x&&s.jsx("span",{className:"ml-auto flex-shrink-0 text-[11px] text-muted-foreground transition-opacity duration-200 group-hover:opacity-0",children:x})]}),s.jsx("div",{className:"mt-0.5 flex items-center",children:f.messageCount>0&&s.jsx(Ln,{variant:"secondary",className:"px-1 py-0 text-xs",children:f.messageCount})})]})]})}),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:S=>o(S.target.value),onKeyDown:S=>{S.stopPropagation(),S.key==="Enter"?v():S.key==="Escape"&&c()},onClick:S=>S.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:S=>{S.stopPropagation(),v()},title:m("tooltips.save"),children:s.jsx(Wt,{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:S=>{S.stopPropagation(),c()},title:m("tooltips.cancel"),children:s.jsx(xt,{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:S=>{S.stopPropagation(),l(t.id,f.sessionName)},title:m("tooltips.editSessionName"),children:s.jsx(yj,{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:S=>{S.stopPropagation(),k()},title:m("tooltips.deleteSession"),children:s.jsx(tr,{className:"h-3 w-3 text-red-600 dark:text-red-400"})})]})})]})]})}function tD(){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 rD({project:e,isExpanded:t,sessions:r,selectedSession:n,initialSessionsLoaded:a,hasMoreSessions:i,isLoadingMoreSessions:o,currentTime:l,editingSession:c,editingSessionName:u,onEditingSessionNameChange:d,onStartEditingSession:p,onCancelEditingSession:h,onSaveEditingSession:m,onProjectSelect:f,onSessionSelect:b,onDeleteSession:x,onLoadMoreSessions:y,onNewSession:v,t:k}){if(!t)return null;const S=r.length>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:()=>{f(e),v(e)},children:[s.jsx(qt,{className:"h-3 w-3"}),k("sessions.newSession")]})}),s.jsxs(Fe,{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:()=>v(e),children:[s.jsx(qt,{className:"h-3 w-3"}),k("sessions.newSession")]}),a?S?s.jsxs(s.Fragment,{children:[r.map(E=>s.jsx(eD,{project:e,session:E,selectedSession:n,currentTime:l,editingSession:c,editingSessionName:u,onEditingSessionNameChange:d,onStartEditingSession:p,onCancelEditingSession:h,onSaveEditingSession:m,onProjectSelect:f,onSessionSelect:b,onDeleteSession:x,t:k},E.id)),i&&s.jsx(Fe,{variant:"ghost",size:"sm",className:"h-8 w-full justify-center text-xs text-muted-foreground hover:text-foreground",onClick:()=>y(e.projectId),disabled:o,children:o?k("sessions.loadingSessions"):"Load more sessions"})]}):s.jsx("div",{className:"px-3 py-2 text-left",children:s.jsx("p",{className:"text-xs text-muted-foreground",children:k("sessions.noSessions")})}):s.jsx(tD,{})]})}const nD=(e,t)=>{const r=Number(e.sessionMeta?.total??t.length);return String(r)};function aD({project:e,selectedProject:t,selectedSession:r,isExpanded:n,isDeleting:a,isStarred:i,editingProject:o,editingName:l,sessions:c,initialSessionsLoaded:u,isLoadingMoreSessions:d,currentTime:p,editingSession:h,editingSessionName:m,tasksEnabled:f,mcpServerStatus:b,onEditingNameChange:x,onToggleProject:y,onProjectSelect:v,onToggleStarProject:k,onStartEditingProject:S,onCancelEditingProject:E,onSaveProjectName:w,onDeleteProject:I,onSessionSelect:_,onDeleteSession:N,onLoadMoreSessions:j,onNewSession:D,onEditingSessionNameChange:A,onStartEditingSession:L,onCancelEditingSession:C,onSaveEditingSession:z,t:Y}){const V=t?.projectId===e.projectId,W=o===e.projectId,G=Number(e.sessionMeta?.total??c.length),O=nD(e,c),$=`${O} session${G===1?"":"s"}`,B=BR(e,b),P=()=>y(e.projectId),te=()=>k(e.projectId),K=()=>{w(e.projectId)},ie=()=>{t?.projectId!==e.projectId&&v(e),P()};return s.jsxs("div",{className:ve("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:ve("p-3 mx-3 my-1 rounded-lg bg-card border border-border/50 active:scale-[0.98] transition-all duration-150",V&&"bg-primary/5 border-primary/20",i&&!V&&"bg-yellow-50/50 dark:bg-yellow-900/5 border-yellow-200/30 dark:border-yellow-800/30"),onClick:P,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:ve("w-8 h-8 rounded-lg flex items-center justify-center transition-colors",n?"bg-primary/10":"bg-muted"),children:n?s.jsx(Fn,{className:"h-4 w-4 text-primary"}):s.jsx(zr,{className:"h-4 w-4 text-muted-foreground"})}),s.jsx("div",{className:"min-w-0 flex-1",children:W?s.jsx("input",{type:"text",value:l,onChange:ae=>x(ae.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:Y("projects.projectNamePlaceholder"),autoFocus:!0,autoComplete:"off",onClick:ae=>ae.stopPropagation(),onKeyDown:ae=>{ae.key==="Enter"&&K(),ae.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(J8,{status:B,size:"xs",className:"ml-2 hidden flex-shrink-0 md:inline-flex"})]}),s.jsx("p",{className:"text-xs text-muted-foreground",children:$})]})})]}),s.jsx("div",{className:"flex items-center gap-1",children:W?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:ae=>{ae.stopPropagation(),K()},children:s.jsx(Wt,{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:ae=>{ae.stopPropagation(),E()},children:s.jsx(xt,{className:"h-4 w-4 text-white"})})]}):s.jsxs(s.Fragment,{children:[s.jsx("button",{className:ve("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:ae=>{ae.stopPropagation(),te()},title:Y(i?"tooltips.removeFromFavorites":"tooltips.addToFavorites"),children:s.jsx(lo,{className:ve("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:ae=>{ae.stopPropagation(),I(e)},children:s.jsx(tr,{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:ae=>{ae.stopPropagation(),S(e)},children:s.jsx(S0,{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(or,{className:"h-3 w-3 text-muted-foreground"}):s.jsx(Fr,{className:"h-3 w-3 text-muted-foreground"})})]})})]})})}),s.jsxs(Fe,{variant:"ghost",className:ve("hidden md:flex w-full justify-between p-2 h-auto font-normal hover:bg-accent/50",V&&"bg-accent text-accent-foreground",i&&!V&&"bg-yellow-50/50 dark:bg-yellow-900/10 hover:bg-yellow-100/50 dark:hover:bg-yellow-900/20"),onClick:ie,children:[s.jsxs("div",{className:"flex min-w-0 flex-1 items-center gap-3",children:[n?s.jsx(Fn,{className:"h-4 w-4 flex-shrink-0 text-primary"}):s.jsx(zr,{className:"h-4 w-4 flex-shrink-0 text-muted-foreground"}),s.jsx("div",{className:"min-w-0 flex-1 text-left",children:W?s.jsxs("div",{className:"space-y-1",children:[s.jsx("input",{type:"text",value:l,onChange:ae=>x(ae.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:Y("projects.projectNamePlaceholder"),autoFocus:!0,onKeyDown:ae=>{ae.key==="Enter"&&K(),ae.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:[O,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:W?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:ae=>{ae.stopPropagation(),K()},children:s.jsx(Wt,{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:ae=>{ae.stopPropagation(),E()},children:s.jsx(xt,{className:"h-3 w-3"})})]}):s.jsxs(s.Fragment,{children:[s.jsx("div",{className:ve("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:ae=>{ae.stopPropagation(),te()},title:Y(i?"tooltips.removeFromFavorites":"tooltips.addToFavorites"),children:s.jsx(lo,{className:ve("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:ae=>{ae.stopPropagation(),S(e)},title:Y("tooltips.renameProject"),children:s.jsx(S0,{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:ae=>{ae.stopPropagation(),I(e)},title:Y("tooltips.deleteProject"),children:s.jsx(tr,{className:"h-3 w-3 text-red-600 dark:text-red-400"})}),n?s.jsx(or,{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(rD,{project:e,isExpanded:n,sessions:c,selectedSession:r,initialSessionsLoaded:u,hasMoreSessions:!!e.sessionMeta?.hasMore,isLoadingMoreSessions:d,currentTime:p,editingSession:h,editingSessionName:m,onEditingSessionNameChange:A,onStartEditingSession:L,onCancelEditingSession:C,onSaveEditingSession:z,onProjectSelect:v,onSessionSelect:_,onDeleteSession:N,onLoadMoreSessions:j,onNewSession:D,t:Y})]})}function iD({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(zr,{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(hn,{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 sD({projects:e,filteredProjects:t,selectedProject:r,selectedSession:n,isLoading:a,loadingProgress:i,expandedProjects:o,editingProject:l,editingName:c,initialSessionsLoaded:u,currentTime:d,editingSession:p,editingSessionName:h,deletingProjects:m,tasksEnabled:f,mcpServerStatus:b,getProjectSessions:x,onLoadMoreSessions:y,loadingMoreProjects:v,isProjectStarred:k,onEditingNameChange:S,onToggleProject:E,onProjectSelect:w,onToggleStarProject:I,onStartEditingProject:_,onCancelEditingProject:N,onSaveProjectName:j,onDeleteProject:D,onSessionSelect:A,onDeleteSession:L,onNewSession:C,onEditingSessionNameChange:z,onStartEditingSession:Y,onCancelEditingSession:V,onSaveEditingSession:W,t:G}){const O=s.jsx(iD,{isLoading:a,loadingProgress:i,projectsCount:e.length,filteredProjectsCount:t.length,t:G});g.useEffect(()=>{let B="CloudCLI UI";const P=r?.displayName?.trim();P&&(B=`${P} - ${B}`),document.title=B},[r]);const $=!a&&e.length>0&&t.length>0;return s.jsx("div",{className:"pb-safe-area-inset-bottom md:space-y-1",children:$?t.map(B=>s.jsx(aD,{project:B,selectedProject:r,selectedSession:n,isExpanded:o.has(B.projectId),isDeleting:m.has(B.projectId),isStarred:k(B.projectId),editingProject:l,editingName:c,sessions:x(B),initialSessionsLoaded:u.has(B.projectId),isLoadingMoreSessions:v.has(B.projectId),currentTime:d,editingSession:p,editingSessionName:h,tasksEnabled:f,mcpServerStatus:b,onEditingNameChange:S,onToggleProject:E,onProjectSelect:w,onToggleStarProject:I,onStartEditingProject:_,onCancelEditingProject:N,onSaveProjectName:j,onDeleteProject:D,onSessionSelect:A,onDeleteSession:L,onLoadMoreSessions:y,onNewSession:C,onEditingSessionNameChange:z,onStartEditingSession:Y,onCancelEditingSession:V,onSaveEditingSession:W,t:G},B.projectId)):O})}function oD({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 lD({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:b,onCollapseSidebar:x,updateAvailable:y,releaseInfo:v,latestVersion:k,currentVersion:S,onShowVersionModal:E,onShowSettings:w,projectListProps:I,t:_}){const N=l==="conversations"&&a.trim().length>=2,j=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(Y8,{isPWA:e,isMobile:t,isLoading:r,projectsCount:n.length,searchFilter:a,onSearchFilterChange:i,onClearSearchFilter:o,searchMode:l,onSearchModeChange:c,onRefresh:m,isRefreshing:f,onCreateProject:b,onCollapseSidebar:x,t:_}),s.jsx(Bf,{className:"flex-1 overflow-y-auto overscroll-contain md:px-1.5 md:py-2",children:N?d&&!j?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:_("search.searching")}),p&&s.jsxs("p",{className:"mt-1 text-xs text-muted-foreground/60",children:[_("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(hn,{className:"h-6 w-6 text-muted-foreground"})}),s.jsx("h3",{className:"mb-2 text-base font-medium text-foreground md:mb-1",children:_("search.noResults")}),s.jsx("p",{className:"text-sm text-muted-foreground",children:_("search.tryDifferentQuery")})]}):j?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:_("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(D=>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(zr,{className:"h-3 w-3 flex-shrink-0 text-muted-foreground"}),s.jsx("span",{className:"truncate text-xs font-medium text-foreground",children:D.projectDisplayName})]}),D.sessions.map(A=>s.jsxs("button",{className:"w-full rounded-md px-2 py-2 text-left transition-colors hover:bg-accent/50",onClick:()=>h(D.projectId,A.sessionId,A.provider||A.matches[0]?.provider||"claude",A.matches[0]?.timestamp,A.matches[0]?.snippet),children:[s.jsxs("div",{className:"mb-1 flex items-center gap-1.5",children:[s.jsx(zn,{className:"h-3 w-3 flex-shrink-0 text-primary"}),s.jsx("span",{className:"truncate text-xs font-medium text-foreground",children:A.sessionSummary}),A.provider&&A.provider!=="claude"&&s.jsx("span",{className:"flex-shrink-0 rounded bg-muted px-1 py-0.5 text-[9px] uppercase text-muted-foreground",children:A.provider})]}),s.jsx("div",{className:"space-y-1 pl-4",children:A.matches.map((L,C)=>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:L.role==="user"?"U":"A"}),s.jsx(oD,{snippet:L.snippet,highlights:L.highlights})]},C))})]},`${D.projectId??D.projectName}-${A.sessionId}`))]},D.projectName))]}):null:s.jsx(sD,{...I})}),s.jsx(G8,{updateAvailable:y,releaseInfo:v,latestVersion:k,currentVersion:S,onShowVersionModal:E,onShowSettings:w,t:_})]})}const ex=[{id:"agents",labelKey:"mainTabs.agents",icon:CI},{id:"appearance",labelKey:"mainTabs.appearance",icon:HE},{id:"git",labelKey:"mainTabs.git",icon:cr},{id:"api",labelKey:"mainTabs.apiTokens",icon:If},{id:"tasks",labelKey:"mainTabs.tasks",icon:Y7},{id:"plugins",labelKey:"mainTabs.plugins",icon:Cj},{id:"notifications",labelKey:"mainTabs.notifications",icon:PE},{id:"about",labelKey:"mainTabs.about",icon:$E}];function cD({activeTab:e,onChange:t}){const{t:r}=Le("settings");return s.jsxs(s.Fragment,{children:[s.jsx("aside",{className:"hidden w-56 flex-shrink-0 border-r border-border bg-muted/30 md:flex md:flex-col",children:s.jsx("nav",{className:"flex flex-col gap-1 p-3",children:ex.map(n=>{const a=n.icon,i=e===n.id;return s.jsxs("button",{onClick:()=>t(n.id),className:ve("flex items-center gap-3 rounded-lg px-3 py-2.5 text-left text-sm font-medium transition-colors duration-150",i?"bg-accent text-accent-foreground":"text-muted-foreground hover:bg-accent/50 hover:text-foreground active:bg-accent/50"),children:[s.jsx(a,{className:"h-4 w-4 flex-shrink-0"}),r(n.labelKey)]},n.id)})})}),s.jsx("div",{className:"flex-shrink-0 border-b border-border px-3 py-2 md:hidden",children:s.jsx($f,{className:"scrollbar-hide w-full overflow-x-auto",children:ex.map(n=>{const a=n.icon;return s.jsxs(Uf,{isActive:e===n.id,onClick:()=>t(n.id),className:"flex-shrink-0",children:[s.jsx(a,{className:"h-3.5 w-3.5"}),r(n.labelKey)]},n.id)})})})]})}function pN(){const[e,t]=g.useState(null);return g.useEffect(()=>{let r=!1;return(async()=>{try{const n=await Ie("/api/settings/server-env");if(!n.ok)return;const a=await n.json();!r&&typeof a.platform=="string"&&t(a.platform)}catch{}})(),()=>{r=!0}},[]),{serverPlatform:e,isWindowsServer:e==="win32"}}const Gf={claude:"Claude",cursor:"Cursor",codex:"Codex",gemini:"Gemini"},Uo={claude:["user","project","local"],cursor:["user","project"],codex:["user","project"],gemini:["user","project"]},Go={claude:["stdio","http","sse"],cursor:["stdio","http"],codex:["stdio","http"],gemini:["stdio","http","sse"]},uD=["user","project"],mN=["stdio","http"],dD={claude:"bg-purple-600 text-white hover:bg-purple-700",cursor:"bg-purple-600 text-white hover:bg-purple-700",codex:"bg-gray-800 text-white hover:bg-gray-900 dark:bg-gray-700 dark:hover:bg-gray-600",gemini:"bg-blue-600 text-white hover:bg-blue-700"},qf={claude:!1,cursor:!1,codex:!0,gemini:!0},pD={name:"",scope:"user",workspacePath:"",transport:"stdio",command:"",args:[],env:{},cwd:"",url:"",headers:{},envVars:[],bearerTokenEnvVar:"",envHttpHeaders:{},importMode:"form",jsonInput:""},hN=e=>!!e&&typeof e=="object"&&!Array.isArray(e),Cn=e=>typeof e=="string"&&e.trim()?e.trim():void 0,tx=e=>Array.isArray(e)?e.filter(t=>typeof t=="string"):void 0,Sl=e=>{if(!hN(e))return;const t={};return Object.entries(e).forEach(([r,n])=>{typeof n=="string"&&(t[r]=n)}),Object.keys(t).length>0?t:void 0},El=e=>Object.entries(e).map(([t,r])=>`${t}=${r}`).join(`
680
680
  `),Cl=e=>{const t={};return e.split(`
681
681
  `).forEach(r=>{const[n,...a]=r.split("=");n?.trim()&&(t[n.trim()]=a.join("=").trim())}),t},rx=e=>e.split(`
682
682
  `).map(t=>t.trim()).filter(Boolean),mD=e=>{const t=String(e??"");return t.length<=4?"****":`${t.slice(0,2)}****${t.slice(-2)}`},hD=e=>e==="user"||e==="local"||e==="project",Hf=e=>e==="stdio"||e==="http"||e==="sse",fN=e=>e.fullPath||e.path||"",Ws=e=>e instanceof Error?e.message:"Unknown error",gN=(e,t,r)=>{if(!(r?.supportedTransports??Go[e]).includes(t))throw new Error(r?.unsupportedTransportMessage?.(t)??`${e} does not support ${t} MCP servers`)},fD=(e,t,r)=>{const n=JSON.parse(t.jsonInput);if(!hN(n))throw new Error("JSON configuration must be an object");const a=Cn(n.transport)??Cn(n.type),i=Hf(a)?a:void 0;if(!i)throw new Error("Missing required field: type");if(gN(e,i,r),i==="stdio"&&!Cn(n.command))throw new Error("stdio type requires a command field");if((i==="http"||i==="sse")&&!Cn(n.url))throw new Error(`${i} type requires a url field`);return{name:t.name.trim(),scope:t.scope,workspacePath:t.scope==="user"?void 0:t.workspacePath,transport:i,command:Cn(n.command),args:tx(n.args)??[],env:Sl(n.env)??{},cwd:r?.supportsWorkingDirectory??qf[e]?Cn(n.cwd):void 0,url:Cn(n.url),headers:Sl(n.headers??n.http_headers)??{},envVars:r?.includeProviderSpecificFields??e==="codex"?tx(n.envVars??n.env_vars)??[]:void 0,bearerTokenEnvVar:r?.includeProviderSpecificFields??e==="codex"?Cn(n.bearerTokenEnvVar??n.bearer_token_env_var):void 0,envHttpHeaders:r?.includeProviderSpecificFields??e==="codex"?Sl(n.envHttpHeaders??n.env_http_headers)??{}:void 0}},nx=(e,t,r)=>{if(t.importMode==="json")return fD(e,t,r);gN(e,t.transport,r);const n=r?.supportsWorkingDirectory??qf[e],a=r?.includeProviderSpecificFields??e==="codex";return{name:t.name.trim(),scope:t.scope,workspacePath:t.scope==="user"?void 0:t.workspacePath,transport:t.transport,command:t.transport==="stdio"?t.command.trim():void 0,args:t.transport==="stdio"?t.args:void 0,env:t.env,cwd:n&&t.cwd.trim()||void 0,url:t.transport!=="stdio"?t.url.trim():void 0,headers:t.transport!=="stdio"?t.headers:void 0,envVars:a?t.envVars:void 0,bearerTokenEnvVar:a&&t.bearerTokenEnvVar.trim()||void 0,envHttpHeaders:a?t.envHttpHeaders:void 0}},gD=3e4,Ta=new Map,qo=async e=>e.json(),Ho=(e,t)=>{if(!e||typeof e!="object")return t;const r=e,n=r.error;if(n&&typeof n=="object"){const i=n.message;if(typeof i=="string"&&i.trim())return i}if(typeof n=="string"&&n.trim())return n;const a=r.details;return typeof a=="string"&&a.trim()?a:t},bD=(e,t="stdio")=>Hf(e)?e:t,xD=(e,t)=>hD(e)?e:t,yD=(e,t,r,n)=>{const a=bD(r.transport,r.url?"http":"stdio");return{provider:e,name:String(r.name??""),scope:xD(r.scope,t),transport:a,command:r.command,args:r.args??[],env:r.env??{},cwd:r.cwd,url:r.url,headers:r.headers??{},envVars:r.envVars??[],bearerTokenEnvVar:r.bearerTokenEnvVar,envHttpHeaders:r.envHttpHeaders??{},workspacePath:n?.path||r.workspacePath,projectName:n?.name||r.projectName,projectDisplayName:n?.displayName||r.projectDisplayName}},vD=e=>{const t=new Set;return e.reduce((r,n)=>{const a=fN(n);return!a||t.has(a)||(t.add(a),r.push({name:n.projectId,displayName:n.displayName||n.projectId,path:a})),r},[])},ax=async(e,t,r)=>{const n=new URLSearchParams({scope:t});r?.path&&n.set("workspacePath",r.path);const a=await Ie(`/api/providers/${e}/mcp/servers?${n.toString()}`),i=await qo(a);if(!a.ok||!i.success)throw new Error(Ho(i,`Failed to load ${e} MCP servers`));return(i.data.servers||[]).map(o=>yD(e,t,o,r))},ix=async(e,t)=>{const r=new URLSearchParams({scope:t.scope});t.workspacePath&&r.set("workspacePath",t.workspacePath);const n=await Ie(`/api/providers/${e}/mcp/servers/${encodeURIComponent(t.name)}?${r.toString()}`,{method:"DELETE"}),a=await qo(n);if(!n.ok||!a.success)throw new Error(Ho(a,"Failed to delete MCP server"))},kD=async(e,t)=>{const r=await Ie(`/api/providers/${e}/mcp/servers`,{method:"POST",body:JSON.stringify(t)}),n=await qo(r);if(!r.ok||!n.success)throw new Error(Ho(n,"Failed to save MCP server"))},wD=async e=>{const t=await Ie("/api/providers/mcp/servers/global",{method:"POST",body:JSON.stringify(e)}),r=await qo(t);if(!t.ok||!r.success)throw new Error(Ho(r,"Failed to save MCP server to all providers"));return r.data.results||[]},SD=(e,t)=>e.name!==t.name||e.scope!==t.scope||(e.workspacePath||"")!==(t.workspacePath||""),sx=e=>`${e.provider}:${e.scope}:${e.workspacePath||"global"}:${e.name}`,ED=(e,t)=>{const r=t.map(n=>n.path).sort().join("|");return`${e}:${r}`},CD=e=>e.map(t=>`${Gf[t.provider]}: ${t.error||"Unknown error"}`).join("; "),Ks=e=>{const t={user:0,project:1,local:2};return[...e].sort((r,n)=>{const a=t[r.scope]-t[n.scope];if(a!==0)return a;const i=(r.projectDisplayName||"").localeCompare(n.projectDisplayName||"");return i!==0?i:r.name.localeCompare(n.name)})},ND=(e,t)=>{const r=new Map;return e.forEach(n=>{r.set(sx(n),n)}),t.forEach(n=>{r.set(sx(n),n)}),Ks([...r.values()])},ox=(e,t,r,n)=>{const a=e.filter(i=>i.scope!==r||(i.workspacePath||"")!==(n||""));return ND(a,t)};function TD({selectedProvider:e,currentProjects:t}){const[r,n]=g.useState([]),[a,i]=g.useState(!1),[o,l]=g.useState(null),[c,u]=g.useState(null),[d,p]=g.useState(null),[h,m]=g.useState(!1),[f,b]=g.useState(!1),[x,y]=g.useState(!1),[v,k]=g.useState(null),S=g.useRef(0),E=g.useMemo(()=>vD(t),[t]),w=g.useMemo(()=>ED(e,E),[E,e]),I=g.useCallback(async(z={})=>{const Y=S.current+1;S.current=Y;const V=Ta.get(w);if(!z.force&&V&&Date.now()-V.updatedAt<gD){n(V.servers),i(!1),m(!1),l(null);return}V&&!z.force?n(V.servers):n([]),i(!V),m(!1),l(null);const G=Uo[e];let O=V&&!z.force?V.servers:[],$=null;if(G.includes("user"))try{const te=await ax(e,"user");if(S.current!==Y)return;O=ox(O,te,"user"),n(Ks(O))}catch(te){$=Ws(te)}if(S.current!==Y)return;i(!1);const B=[];if(E.forEach(te=>{G.includes("project")&&B.push({scope:"project",project:te}),G.includes("local")&&B.push({scope:"local",project:te})}),B.length===0){const te=Ks(O);Ta.set(w,{servers:te,updatedAt:Date.now()}),l($);return}if(m(!0),await Promise.all(B.map(async({scope:te,project:K})=>{try{const ie=await ax(e,te,K);if(S.current!==Y)return;O=ox(O,ie,te,K.path),n(O)}catch(ie){$=$||Ws(ie)}})),S.current!==Y)return;const P=Ks(O);Ta.set(w,{servers:P,updatedAt:Date.now()}),n(P),l($),m(!1)},[w,E,e]),_=g.useCallback(z=>{k(z||null),b(!0)},[]),N=g.useCallback(()=>{b(!1),k(null)},[]),j=g.useCallback(()=>{y(!0)},[]),D=g.useCallback(()=>{y(!1)},[]),A=g.useCallback(async(z,Y)=>{const V=nx(e,z);if(V.scope!=="user"&&!V.workspacePath)throw new Error("Select a project for project-scoped MCP servers");await kD(e,V),Y&&SD(Y,V)&&await ix(e,Y),Ta.delete(w),await I({force:!0}),p("success"),N()},[w,N,I,e]),L=g.useCallback(async z=>{const Y=nx(e,z,{supportedTransports:mN,supportsWorkingDirectory:!1,includeProviderSpecificFields:!1,unsupportedTransportMessage:G=>`Add MCP Server supports only stdio and http across all providers, not ${G}.`});if(Y.scope==="local")throw new Error("Add MCP Server supports only user or project scope across all providers.");if(Y.scope!=="user"&&!Y.workspacePath)throw new Error("Select a project for project-scoped MCP servers");const V=await wD(Y);Ta.clear(),await I({force:!0});const W=V.filter(G=>!G.created);if(W.length>0)throw p("error"),new Error(`Failed to add MCP server to all providers. ${CD(W)}`);p("success"),D()},[D,I,e]),C=g.useCallback(async z=>{if(window.confirm("Are you sure you want to delete this MCP server?")){u(null);try{await ix(e,z),Ta.delete(w),await I({force:!0}),p("success")}catch(Y){u(Ws(Y)),p("error")}}},[w,I,e]);return g.useEffect(()=>{I()},[I]),g.useEffect(()=>{b(!1),y(!1),k(null),u(null),p(null)},[e]),g.useEffect(()=>{if(d===null)return;const z=window.setTimeout(()=>p(null),2e3);return()=>window.clearTimeout(z)},[d]),{servers:r,isLoading:a,isLoadingProjectScopes:h,loadError:o,deleteError:c,saveStatus:d,isFormOpen:f,isGlobalFormOpen:x,editingServer:v,openForm:_,openGlobalForm:j,closeForm:N,closeGlobalForm:D,submitForm:A,submitGlobalForm:L,deleteServer:C,refreshServers:I}}const Ys=(e,t=Uo[e],r=Go[e])=>({...pD,scope:t[0],transport:r[0],args:[],env:{},headers:{},envVars:[],envHttpHeaders:{}}),AD=(e,t,r,n)=>({...Ys(e,r,n),name:t.name,scope:t.scope,workspacePath:t.workspacePath||"",transport:t.transport,command:t.command||"",args:t.args||[],env:t.env||{},cwd:t.cwd||"",url:t.url||"",headers:t.headers||{},envVars:t.envVars||[],bearerTokenEnvVar:t.bearerTokenEnvVar||"",envHttpHeaders:t.envHttpHeaders||{}}),Nl=e=>({args:e.args.join(`
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-DbZAcc9z.js"></script>
28
+ <script type="module" crossorigin src="/assets/index-CqZEr2p5.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">
@@ -33,6 +33,7 @@ const migrateLegacySessionNames = (db) => {
33
33
  COALESCE(created_at, CURRENT_TIMESTAMP),
34
34
  COALESCE(updated_at, CURRENT_TIMESTAMP)
35
35
  FROM session_names
36
+ WHERE true
36
37
  ON CONFLICT(session_id) DO UPDATE SET
37
38
  provider = excluded.provider,
38
39
  custom_name = COALESCE(excluded.custom_name, sessions.custom_name),
@@ -1 +1 @@
1
- {"version":3,"file":"migrations.js","sourceRoot":"","sources":["../../../../server/modules/database/migrations.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,2BAA2B,EAC3B,mBAAmB,EACnB,yBAAyB,EACzB,mCAAmC,EACnC,yBAAyB,EACzB,8CAA8C,EAC9C,2BAA2B,GAC5B,MAAM,8BAA8B,CAAC;AAEtC,MAAM,eAAe,GAAG;;;;;;CAMvB,CAAC;AAOF,MAAM,2BAA2B,GAAG,CAClC,EAAY,EACZ,SAAiB,EACjB,WAAqB,EACrB,UAAkB,EAClB,UAAkB,EAClB,EAAE;IACF,IAAI,CAAC,WAAW,CAAC,QAAQ,CAAC,UAAU,CAAC,EAAE,CAAC;QACtC,OAAO,CAAC,GAAG,CAAC,6BAA6B,UAAU,cAAc,SAAS,QAAQ,CAAC,CAAC;QACpF,EAAE,CAAC,IAAI,CAAC,eAAe,SAAS,eAAe,UAAU,IAAI,UAAU,EAAE,CAAC,CAAC;IAC7E,CAAC;AACH,CAAC,CAAC;AAEF,MAAM,WAAW,GAAG,CAAC,EAAY,EAAE,SAAiB,EAAW,EAAE,CAC/D,OAAO,CACL,EAAE;KACC,OAAO,CAAC,kEAAkE,CAAC;KAC3E,GAAG,CAAC,SAAS,CAAC,CAClB,CAAC;AAEJ,MAAM,YAAY,GAAG,CAAC,EAAY,EAAE,SAAiB,EAAkB,EAAE,CACvE,EAAE,CAAC,OAAO,CAAC,qBAAqB,SAAS,GAAG,CAAC,CAAC,GAAG,EAAoB,CAAC;AAExE,MAAM,yBAAyB,GAAG,CAAC,EAAY,EAAQ,EAAE;IACvD,MAAM,0BAA0B,GAAG,WAAW,CAAC,EAAE,EAAE,eAAe,CAAC,CAAC;IACpE,MAAM,gBAAgB,GAAG,WAAW,CAAC,EAAE,EAAE,UAAU,CAAC,CAAC;IAErD,IAAI,CAAC,0BAA0B,EAAE,CAAC;QAChC,OAAO;IACT,CAAC;IAED,IAAI,gBAAgB,EAAE,CAAC;QACrB,OAAO,CAAC,GAAG,CAAC,wDAAwD,CAAC,CAAC;QACtE,EAAE,CAAC,IAAI,CAAC;;;;;;;;;;;;;;KAcP,CAAC,CAAC;QACH,EAAE,CAAC,IAAI,CAAC,0BAA0B,CAAC,CAAC;QACpC,OAAO;IACT,CAAC;IAED,OAAO,CAAC,GAAG,CAAC,6DAA6D,CAAC,CAAC;IAC3E,EAAE,CAAC,IAAI,CAAC,8CAA8C,CAAC,CAAC;AAC1D,CAAC,CAAC;AAEF,MAAM,uCAAuC,GAAG,CAAC,EAAY,EAAQ,EAAE;IACrE,EAAE,CAAC,IAAI,CAAC,yBAAyB,CAAC,CAAC;IAEnC,IAAI,CAAC,WAAW,CAAC,EAAE,EAAE,0BAA0B,CAAC,EAAE,CAAC;QACjD,OAAO;IACT,CAAC;IAED,OAAO,CAAC,GAAG,CAAC,0EAA0E,CAAC,CAAC;IACxF,EAAE,CAAC,IAAI,CAAC;;;;;eAKK,eAAe;;;;;;;;;;;;GAY3B,CAAC,CAAC;AACL,CAAC,CAAC;AAEF,MAAM,wCAAwC,GAAG,CAAC,EAAY,EAAQ,EAAE;IACtE,MAAM,gBAAgB,GAAG,WAAW,CAAC,EAAE,EAAE,UAAU,CAAC,CAAC;IACrD,IAAI,CAAC,gBAAgB,EAAE,CAAC;QACtB,EAAE,CAAC,IAAI,CAAC,yBAAyB,CAAC,CAAC;QACnC,OAAO;IACT,CAAC;IAED,MAAM,iBAAiB,GAAG,YAAY,CAAC,EAAE,EAAE,UAAU,CAAC,CAAC;IACvD,MAAM,WAAW,GAAG,iBAAiB,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IACnE,MAAM,sBAAsB,GAAG,iBAAiB,CAAC,IAAI,CACnD,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,IAAI,KAAK,YAAY,IAAI,MAAM,CAAC,EAAE,KAAK,CAAC,CAC5D,CAAC;IAEF,IAAI,sBAAsB,EAAE,CAAC;QAC3B,2BAA2B,CAAC,EAAE,EAAE,UAAU,EAAE,WAAW,EAAE,qBAAqB,EAAE,mBAAmB,CAAC,CAAC;QACrG,2BAA2B,CAAC,EAAE,EAAE,UAAU,EAAE,WAAW,EAAE,WAAW,EAAE,mBAAmB,CAAC,CAAC;QAC3F,2BAA2B,CAAC,EAAE,EAAE,UAAU,EAAE,WAAW,EAAE,YAAY,EAAE,mBAAmB,CAAC,CAAC;QAC5F,EAAE,CAAC,IAAI,CAAC;;yBAEa,eAAe;;KAEnC,CAAC,CAAC;QACH,OAAO;IACT,CAAC;IAED,OAAO,CAAC,GAAG,CAAC,gFAAgF,CAAC,CAAC;IAE9F,MAAM,qBAAqB,GAAG,WAAW,CAAC,QAAQ,CAAC,cAAc,CAAC;QAChE,CAAC,CAAC,cAAc;QAChB,CAAC,CAAC,WAAW,CAAC,QAAQ,CAAC,gBAAgB,CAAC;YACtC,CAAC,CAAC,gBAAgB;YAClB,CAAC,CAAC,MAAM,CAAC;IAEb,MAAM,2BAA2B,GAAG,WAAW,CAAC,QAAQ,CAAC,qBAAqB,CAAC;QAC7E,CAAC,CAAC,qBAAqB;QACvB,CAAC,CAAC,WAAW,CAAC,QAAQ,CAAC,uBAAuB,CAAC;YAC7C,CAAC,CAAC,uBAAuB;YACzB,CAAC,CAAC,MAAM,CAAC;IAEb,MAAM,mBAAmB,GAAG,WAAW,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,wBAAwB,CAAC,CAAC,CAAC,GAAG,CAAC;IAE/F,MAAM,oBAAoB,GAAG,WAAW,CAAC,QAAQ,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,yBAAyB,CAAC,CAAC,CAAC,GAAG,CAAC;IAElG,MAAM,mBAAmB,GAAG,WAAW,CAAC,QAAQ,CAAC,YAAY,CAAC;QAC5D,CAAC,CAAC;;gBAEU,eAAe;;WAEpB;QACP,CAAC,CAAC,eAAe,CAAC;IAEpB,EAAE,CAAC,IAAI,CAAC,2BAA2B,CAAC,CAAC;IACrC,IAAI,CAAC;QACH,EAAE,CAAC,IAAI,CAAC,mBAAmB,CAAC,CAAC;QAC7B,EAAE,CAAC,IAAI,CAAC,oCAAoC,CAAC,CAAC;QAC9C,EAAE,CAAC,IAAI,CAAC;;;;;;;;KAQP,CAAC,CAAC;QACH,EAAE,CAAC,IAAI,CAAC;;;YAGA,qBAAqB;YACrB,2BAA2B;YAC3B,mBAAmB;YACnB,oBAAoB;YACpB,mBAAmB;;;gBAGf,qBAAqB,yBAAyB,qBAAqB;;;;;;;;;;;;;;;;;;mBAkBhE,eAAe;;;;;;;;;;;;;;;;;;;;;;;KAuB7B,CAAC,CAAC;QACH,EAAE,CAAC,IAAI,CAAC,qBAAqB,CAAC,CAAC;QAC/B,EAAE,CAAC,IAAI,CAAC,8CAA8C,CAAC,CAAC;QACxD,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IACpB,CAAC;IAAC,OAAO,cAAc,EAAE,CAAC;QACxB,EAAE,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;QACpB,MAAM,cAAc,CAAC;IACvB,CAAC;YAAS,CAAC;QACT,EAAE,CAAC,IAAI,CAAC,0BAA0B,CAAC,CAAC;IACtC,CAAC;AACH,CAAC,CAAC;AAEF,MAAM,qCAAqC,GAAG,CAAC,EAAY,EAAQ,EAAE;IACnE,MAAM,WAAW,GAAG,WAAW,CAAC,EAAE,EAAE,UAAU,CAAC,CAAC;IAChD,IAAI,CAAC,WAAW,EAAE,CAAC;QACjB,EAAE,CAAC,IAAI,CAAC,yBAAyB,CAAC,CAAC;QACnC,OAAO;IACT,CAAC;IAED,MAAM,iBAAiB,GAAG,YAAY,CAAC,EAAE,EAAE,UAAU,CAAC,CAAC;IACvD,MAAM,WAAW,GAAG,iBAAiB,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IACnE,MAAM,iBAAiB,GAAG,iBAAiB;SACxC,MAAM,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,EAAE,GAAG,CAAC,CAAC;SACjC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,EAAE,CAAC;SAC3B,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IAEhC,MAAM,aAAa,GACjB,CAAC,WAAW,CAAC,QAAQ,CAAC,cAAc,CAAC;QACrC,iBAAiB,CAAC,MAAM,KAAK,CAAC;QAC9B,iBAAiB,CAAC,CAAC,CAAC,KAAK,YAAY;QACrC,CAAC,WAAW,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAC;IAEpC,IAAI,CAAC,aAAa,EAAE,CAAC;QACnB,2BAA2B,CAAC,EAAE,EAAE,UAAU,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,CAAC,CAAC;QAC/E,2BAA2B,CAAC,EAAE,EAAE,UAAU,EAAE,WAAW,EAAE,YAAY,EAAE,UAAU,CAAC,CAAC;QACnF,2BAA2B,CAAC,EAAE,EAAE,UAAU,EAAE,WAAW,EAAE,YAAY,EAAE,UAAU,CAAC,CAAC;QACnF,EAAE,CAAC,IAAI,CAAC,0EAA0E,CAAC,CAAC;QACpF,EAAE,CAAC,IAAI,CAAC,0EAA0E,CAAC,CAAC;QACpF,OAAO;IACT,CAAC;IAED,OAAO,CAAC,GAAG,CAAC,sEAAsE,CAAC,CAAC;IAEpF,MAAM,qBAAqB,GAAG,WAAW,CAAC,QAAQ,CAAC,cAAc,CAAC;QAChE,CAAC,CAAC,cAAc;QAChB,CAAC,CAAC,WAAW,CAAC,QAAQ,CAAC,gBAAgB,CAAC;YACtC,CAAC,CAAC,gBAAgB;YAClB,CAAC,CAAC,MAAM,CAAC;IAEb,MAAM,kBAAkB,GAAG,WAAW,CAAC,QAAQ,CAAC,UAAU,CAAC;QACzD,CAAC,CAAC,8BAA8B;QAChC,CAAC,CAAC,UAAU,CAAC;IAEf,MAAM,oBAAoB,GAAG,WAAW,CAAC,QAAQ,CAAC,aAAa,CAAC;QAC9D,CAAC,CAAC,aAAa;QACf,CAAC,CAAC,MAAM,CAAC;IAEX,MAAM,mBAAmB,GAAG,WAAW,CAAC,QAAQ,CAAC,YAAY,CAAC;QAC5D,CAAC,CAAC,YAAY;QACd,CAAC,CAAC,MAAM,CAAC;IAEX,MAAM,mBAAmB,GAAG,WAAW,CAAC,QAAQ,CAAC,YAAY,CAAC;QAC5D,CAAC,CAAC,yCAAyC;QAC3C,CAAC,CAAC,mBAAmB,CAAC;IAExB,MAAM,mBAAmB,GAAG,WAAW,CAAC,QAAQ,CAAC,YAAY,CAAC;QAC5D,CAAC,CAAC,yCAAyC;QAC3C,CAAC,CAAC,mBAAmB,CAAC;IAExB,EAAE,CAAC,IAAI,CAAC,2BAA2B,CAAC,CAAC;IACrC,IAAI,CAAC;QACH,EAAE,CAAC,IAAI,CAAC,mBAAmB,CAAC,CAAC;QAC7B,EAAE,CAAC,IAAI,CAAC,oCAAoC,CAAC,CAAC;QAC9C,EAAE,CAAC,IAAI,CAAC;;;;;;;;;;;;;;KAcP,CAAC,CAAC;QACH,EAAE,CAAC,IAAI,CAAC;;;;YAIA,kBAAkB;YAClB,oBAAoB;YACpB,qBAAqB;YACrB,mBAAmB;YACnB,mBAAmB;YACnB,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAuC1B,CAAC,CAAC;QACH,EAAE,CAAC,IAAI,CAAC,qBAAqB,CAAC,CAAC;QAC/B,EAAE,CAAC,IAAI,CAAC,8CAA8C,CAAC,CAAC;QACxD,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IACpB,CAAC;IAAC,OAAO,cAAc,EAAE,CAAC;QACxB,EAAE,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;QACpB,MAAM,cAAc,CAAC;IACvB,CAAC;YAAS,CAAC;QACT,EAAE,CAAC,IAAI,CAAC,0BAA0B,CAAC,CAAC;IACtC,CAAC;AACH,CAAC,CAAC;AAEF,MAAM,6BAA6B,GAAG,CAAC,EAAY,EAAQ,EAAE;IAC3D,IAAI,CAAC,WAAW,CAAC,EAAE,EAAE,UAAU,CAAC,EAAE,CAAC;QACjC,OAAO;IACT,CAAC;IAED,EAAE,CAAC,IAAI,CAAC;;;QAGF,eAAe;;;;;;;;GAQpB,CAAC,CAAC;AACL,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,EAAY,EAAE,EAAE;IAC5C,IAAI,CAAC;QACH,MAAM,cAAc,GAAG,EAAE,CAAC,OAAO,CAAC,0BAA0B,CAAC,CAAC,GAAG,EAAwB,CAAC;QAC1F,MAAM,eAAe,GAAG,cAAc,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;QAEpE,2BAA2B,CAAC,EAAE,EAAE,OAAO,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,CAAC,CAAC;QAC9E,2BAA2B,CAAC,EAAE,EAAE,OAAO,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,CAAC,CAAC;QAC/E,2BAA2B,CACzB,EAAE,EACF,OAAO,EACP,eAAe,EACf,0BAA0B,EAC1B,mBAAmB,CACpB,CAAC;QAEF,EAAE,CAAC,IAAI,CAAC,2BAA2B,CAAC,CAAC;QACrC,EAAE,CAAC,IAAI,CAAC,8CAA8C,CAAC,CAAC;QACxD,EAAE,CAAC,IAAI,CAAC,2BAA2B,CAAC,CAAC;QACrC,EAAE,CAAC,IAAI,CAAC,mCAAmC,CAAC,CAAC;QAC7C,EAAE,CAAC,IAAI,CAAC,0FAA0F,CAAC,CAAC;QAEpG,EAAE,CAAC,IAAI,CAAC,yBAAyB,CAAC,CAAC;QACnC,wCAAwC,CAAC,EAAE,CAAC,CAAC;QAE7C,uCAAuC,CAAC,EAAE,CAAC,CAAC;QAC5C,qCAAqC,CAAC,EAAE,CAAC,CAAC;QAC1C,yBAAyB,CAAC,EAAE,CAAC,CAAC;QAC9B,6BAA6B,CAAC,EAAE,CAAC,CAAC;QAElC,EAAE,CAAC,IAAI,CAAC,2EAA2E,CAAC,CAAC;QACrF,EAAE,CAAC,IAAI,CAAC,gFAAgF,CAAC,CAAC;QAC1F,EAAE,CAAC,IAAI,CAAC,2EAA2E,CAAC,CAAC;QACrF,EAAE,CAAC,IAAI,CAAC,6EAA6E,CAAC,CAAC;QAEvF,EAAE,CAAC,IAAI,CAAC,+CAA+C,CAAC,CAAC;QACzD,EAAE,CAAC,IAAI,CAAC,kDAAkD,CAAC,CAAC;QAC5D,EAAE,CAAC,IAAI,CAAC,8DAA8D,CAAC,CAAC;QACxE,EAAE,CAAC,IAAI,CAAC,gEAAgE,CAAC,CAAC;QAE1E,IAAI,WAAW,CAAC,EAAE,EAAE,0BAA0B,CAAC,EAAE,CAAC;YAChD,OAAO,CAAC,GAAG,CAAC,mEAAmE,CAAC,CAAC;YACjF,EAAE,CAAC,IAAI,CAAC,qCAAqC,CAAC,CAAC;QACjD,CAAC;QAED,EAAE,CAAC,IAAI,CAAC,mBAAmB,CAAC,CAAC;QAC7B,OAAO,CAAC,GAAG,CAAC,4CAA4C,CAAC,CAAC;IAC5D,CAAC;IAAC,OAAO,KAAU,EAAE,CAAC;QACpB,OAAO,CAAC,KAAK,CAAC,2BAA2B,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC;QAC1D,MAAM,KAAK,CAAC;IACd,CAAC;AACH,CAAC,CAAC"}
1
+ {"version":3,"file":"migrations.js","sourceRoot":"","sources":["../../../../server/modules/database/migrations.ts"],"names":[],"mappings":"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"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cloudcli-ai/cloudcli",
3
- "version": "1.31.0",
3
+ "version": "1.31.2",
4
4
  "description": "A web-based UI for Claude Code CLI",
5
5
  "type": "module",
6
6
  "main": "dist-server/server/index.js",
@@ -65,6 +65,7 @@ const migrateLegacySessionNames = (db: Database): void => {
65
65
  COALESCE(created_at, CURRENT_TIMESTAMP),
66
66
  COALESCE(updated_at, CURRENT_TIMESTAMP)
67
67
  FROM session_names
68
+ WHERE true
68
69
  ON CONFLICT(session_id) DO UPDATE SET
69
70
  provider = excluded.provider,
70
71
  custom_name = COALESCE(excluded.custom_name, sessions.custom_name),