@siteboon/claude-code-ui 1.25.1 → 1.25.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.
@@ -646,7 +646,7 @@ import{j as s,_ as PC,a as FC,m as h4,E as jr,R as f4,o as g4,T as b4,P as x4,S
646
646
  .xterm-screen:focus {
647
647
  outline: none !important;
648
648
  }
649
- `;function A_(){if(typeof document>"u"||document.getElementById(Gg))return;const e=document.createElement("style");e.id=Gg,e.type="text/css",e.innerText=T_,document.head.appendChild(e)}function I_({terminalContainerRef:e,terminalRef:t,fitAddonRef:r,wsRef:n,selectedProject:a,minimal:i,isRestarting:o,initialCommandRef:l,isPlainShellRef:c,authUrlRef:u,copyAuthUrlToClipboard:d,closeSocket:p}){const[h,m]=b.useState(!1),f=b.useRef(null),g=a?.fullPath||a?.path||"",v=!!a;b.useEffect(()=>{A_()},[]);const x=b.useCallback(()=>{t.current&&(t.current.clear(),t.current.write("\x1B[2J\x1B[H"))},[t]),y=b.useCallback(()=>{t.current&&(t.current.dispose(),t.current=null),r.current=null,m(!1)},[r,t]);return b.useEffect(()=>{if(!e.current||!v||o||t.current)return;const w=new E_.Terminal(m_);t.current=w;const N=new v_.FitAddon;r.current=N,w.loadAddon(N),i||w.loadAddon(new k_.WebLinksAddon);try{w.loadAddon(new S_.WebglAddon)}catch{console.warn("[Shell] WebGL renderer unavailable, using Canvas fallback")}w.open(e.current);const S=async()=>{const I=w.getSelection();return I?en(I):!1},k=I=>{if(!w.hasSelection())return;const A=w.getSelection();if(A){if(I.preventDefault(),I.clipboardData){I.clipboardData.setData("text/plain",A);return}en(A)}};e.current.addEventListener("copy",k),w.attachCustomKeyEventHandler(I=>{const A=V4(l.current)?H4:u.current;return I.type==="keydown"&&i&&c.current&&A&&!I.ctrlKey&&!I.metaKey&&!I.altKey&&I.key?.toLowerCase()==="c"?(I.preventDefault(),I.stopPropagation(),d(A),!1):I.type==="keydown"&&(I.ctrlKey||I.metaKey)&&I.key?.toLowerCase()==="c"&&w.hasSelection()?(I.preventDefault(),I.stopPropagation(),S(),!1):I.type==="keydown"&&(I.ctrlKey||I.metaKey)&&I.key?.toLowerCase()==="v"?(I.preventDefault(),I.stopPropagation(),typeof navigator<"u"&&navigator.clipboard?.readText&&navigator.clipboard.readText().then(D=>{ta(n.current,{type:"input",data:D})}).catch(()=>{}),!1):!0}),window.setTimeout(()=>{const I=r.current,A=t.current;!I||!A||(I.fit(),ta(n.current,{type:"resize",cols:A.cols,rows:A.rows}))},W4),m(!0);const T=w.onData(I=>{ta(n.current,{type:"input",data:I})}),j=new ResizeObserver(()=>{f.current!==null&&window.clearTimeout(f.current),f.current=window.setTimeout(()=>{const I=r.current,A=t.current;!I||!A||(I.fit(),ta(n.current,{type:"resize",cols:A.cols,rows:A.rows}))},o_)});return j.observe(e.current),()=>{e.current?.removeEventListener("copy",k),j.disconnect(),f.current!==null&&(window.clearTimeout(f.current),f.current=null),T.dispose(),p(),y()}},[u,p,d,y,r,l,c,o,i,v,g,e,t,n]),{isInitialized:h,clearTerminalScreen:x,disposeTerminal:y}}function __({selectedProject:e,selectedSession:t,initialCommand:r,isPlainShell:n,minimal:a,autoConnect:i,isRestarting:o,onProcessComplete:l,onOutputRef:c}){const u=b.useRef(null),d=b.useRef(null),p=b.useRef(null),h=b.useRef(null),[m,f]=b.useState(""),[g,v]=b.useState(0),x=b.useRef(e),y=b.useRef(t),w=b.useRef(r),N=b.useRef(n),S=b.useRef(l),k=b.useRef(""),T=b.useRef(t?.id??null);b.useEffect(()=>{x.current=e,y.current=t,w.current=r,N.current=n,S.current=l},[e,t,r,n,l]);const j=b.useCallback(H=>{k.current=H,f(H),v(P=>P+1)},[]),I=b.useCallback(()=>{const H=h.current;H&&((H.readyState===WebSocket.OPEN||H.readyState===WebSocket.CONNECTING)&&H.close(),h.current=null)},[]),A=b.useCallback((H=k.current)=>{if(!H)return!1;const P=window.open(H,"_blank");if(P){try{P.opener=null}catch{}return!0}return!1},[]),D=b.useCallback(async(H=k.current)=>H?en(H):!1,[]),{isInitialized:_,clearTerminalScreen:M,disposeTerminal:E}=I_({terminalContainerRef:u,terminalRef:d,fitAddonRef:p,wsRef:h,selectedProject:e,minimal:a,isRestarting:o,initialCommandRef:w,isPlainShellRef:N,authUrlRef:k,copyAuthUrlToClipboard:D,closeSocket:I}),{isConnected:G,isConnecting:J,connectToShell:W,disconnectFromShell:U}=y_({wsRef:h,terminalRef:d,fitAddonRef:p,selectedProjectRef:x,selectedSessionRef:y,initialCommandRef:w,isPlainShellRef:N,onProcessCompleteRef:S,isInitialized:_,autoConnect:i,closeSocket:I,clearTerminalScreen:M,setAuthUrl:j,onOutputRef:c});return b.useEffect(()=>{o&&(U(),E())},[U,E,o]),b.useEffect(()=>{e||(U(),E())},[U,E,e]),b.useEffect(()=>{const H=t?.id??null;T.current!==H&&_&&U(),T.current=H},[U,_,t?.id]),{terminalContainerRef:u,terminalRef:d,wsRef:h,isConnected:G,isInitialized:_,isConnecting:J,authUrl:m,authUrlVersion:g,connectToShell:W,disconnectFromShell:U,openAuthUrlInBrowser:A,copyAuthUrlToClipboard:D}}function R_({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 j_({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 O_({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 D_({terminalContainerRef:e,authUrl:t,authUrlVersion:r,initialCommand:n,isConnected:a,openAuthUrlInBrowser:i,copyAuthUrlToClipboard:o}){const[l,c]=b.useState("idle"),[u,d]=b.useState(!1),p=b.useMemo(()=>N_(n,t),[t,n]);b.useEffect(()=>{c("idle"),d(!1)},[r,p,a]);const h=!!p,m=h&&!u,f=h&&u;return s.jsxs("div",{className:"relative h-full w-full bg-gray-900",children:[s.jsx("div",{ref:e,className:"h-full w-full focus:outline-none",style:{outline:"none"}}),m&&s.jsx("div",{className:"absolute inset-x-0 bottom-14 z-20 border-t border-gray-700/80 bg-gray-900/95 p-3 backdrop-blur-sm md:hidden",children:s.jsxs("div",{className:"flex flex-col gap-2",children:[s.jsxs("div",{className:"flex items-center justify-between gap-2",children:[s.jsx("p",{className:"text-xs text-gray-300",children:"Open or copy the login URL:"}),s.jsx("button",{type:"button",onClick:()=>d(!0),className:"rounded bg-gray-700 px-2 py-1 text-[10px] font-medium uppercase tracking-wide text-gray-100 hover:bg-gray-600",children:"Hide"})]}),s.jsx("input",{type:"text",value:p,readOnly:!0,onClick:g=>g.currentTarget.select(),className:"w-full rounded border border-gray-600 bg-gray-800 px-2 py-1 text-xs text-gray-100 focus:outline-none focus:ring-1 focus:ring-blue-500","aria-label":"Authentication URL"}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("button",{type:"button",onClick:()=>{i(p)},className:"flex-1 rounded bg-blue-600 px-3 py-2 text-xs font-medium text-white hover:bg-blue-700",children:"Open URL"}),s.jsx("button",{type:"button",onClick:async()=>{const g=await o(p);c(g?"copied":"failed")},className:"flex-1 rounded bg-gray-700 px-3 py-2 text-xs font-medium text-white hover:bg-gray-600",children:l==="copied"?"Copied":"Copy URL"})]})]})}),f&&s.jsx("div",{className:"absolute bottom-14 right-3 z-20 md:hidden",children:s.jsx("button",{type:"button",onClick:()=>d(!1),className:"rounded bg-gray-800/95 px-3 py-2 text-xs font-medium text-gray-100 shadow-lg backdrop-blur-sm hover:bg-gray-700",children:"Show login URL"})})]})}const L_=[{id:"escape",labelKey:"escape",sequence:"\x1B",hint:"Esc"},{id:"tab",labelKey:"tab",sequence:" ",hint:"Tab"},{id:"shift-tab",labelKey:"shiftTab",sequence:"\x1B[Z",hint:"⇧Tab"},{id:"arrow-up",labelKey:"arrowUp",sequence:"\x1B[A",hint:"↑"},{id:"arrow-down",labelKey:"arrowDown",sequence:"\x1B[B",hint:"↓"}],ss=e=>e.preventDefault();function M_({wsRef:e,terminalRef:t,isConnected:r}){const{t:n}=Me("settings"),[a,i]=b.useState(!1),o=b.useRef(null);b.useEffect(()=>()=>{o.current&&clearTimeout(o.current)},[]);const l=b.useCallback(()=>{i(p=>!p)},[]),c=b.useCallback(p=>{p(),document.activeElement instanceof HTMLElement&&document.activeElement.blur(),o.current&&clearTimeout(o.current),o.current=setTimeout(()=>i(!1),50)},[]),u=b.useCallback(p=>{ta(e.current,{type:"input",data:p})},[e]),d=b.useCallback(()=>{t.current?.scrollToBottom()},[t]);return s.jsxs(s.Fragment,{children:[s.jsx("button",{type:"button",onPointerDown:ss,onClick:l,className:`fixed ${a?"right-64":"right-0"} z-50 cursor-pointer rounded-l-md border border-gray-200 bg-white p-2 shadow-lg transition-all duration-150 ease-out hover:bg-gray-100 dark:border-gray-700 dark:bg-gray-800 dark:hover:bg-gray-700`,style:{top:"50%",transform:"translateY(-50%)"},"aria-label":n(a?"terminalShortcuts.handle.closePanel":"terminalShortcuts.handle.openPanel"),children:a?s.jsx(Or,{className:"h-5 w-5 text-gray-600 dark:text-gray-400"}):s.jsx(Ao,{className:"h-5 w-5 text-gray-600 dark:text-gray-400"})}),s.jsx("div",{className:`fixed right-0 top-0 z-40 h-full w-64 transform border-l border-border bg-background shadow-xl transition-transform duration-150 ease-out ${a?"translate-x-0":"translate-x-full"}`,children:s.jsxs("div",{className:"flex h-full flex-col",children:[s.jsx("div",{className:"border-b border-gray-200 bg-gray-50 p-4 dark:border-gray-700 dark:bg-gray-900",children:s.jsxs("h3",{className:"flex items-center gap-2 text-lg font-semibold text-gray-900 dark:text-white",children:[s.jsx(q6,{className:"h-5 w-5 text-gray-600 dark:text-gray-400"}),n("terminalShortcuts.title")]})}),a&&s.jsxs("div",{className:"flex-1 space-y-6 overflow-y-auto overflow-x-hidden bg-background p-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx("h4",{className:"mb-2 text-xs font-semibold uppercase tracking-wider text-gray-500 dark:text-gray-400",children:n("terminalShortcuts.sectionKeys")}),L_.map(p=>s.jsxs("button",{type:"button",onPointerDown:ss,onClick:()=>c(()=>u(p.sequence)),disabled:!r,className:"flex w-full items-center justify-between rounded-lg border border-transparent bg-gray-50 p-3 transition-colors hover:border-gray-300 hover:bg-gray-100 disabled:cursor-not-allowed disabled:opacity-40 dark:bg-gray-800 dark:hover:border-gray-600 dark:hover:bg-gray-700",children:[s.jsx("span",{className:"text-sm text-gray-900 dark:text-white",children:n(`terminalShortcuts.${p.labelKey}`)}),s.jsx("kbd",{className:"rounded border border-gray-300 bg-gray-200 px-2 py-0.5 font-mono text-xs text-gray-600 dark:border-gray-600 dark:bg-gray-700 dark:text-gray-300",children:p.hint})]},p.id))]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx("h4",{className:"mb-2 text-xs font-semibold uppercase tracking-wider text-gray-500 dark:text-gray-400",children:n("terminalShortcuts.sectionNavigation")}),s.jsxs("button",{type:"button",onPointerDown:ss,onClick:()=>c(d),disabled:!r,className:"flex w-full items-center justify-between rounded-lg border border-transparent bg-gray-50 p-3 transition-colors hover:border-gray-300 hover:bg-gray-100 disabled:cursor-not-allowed disabled:opacity-40 dark:bg-gray-800 dark:hover:border-gray-600 dark:hover:bg-gray-700",children:[s.jsx("span",{className:"text-sm text-gray-900 dark:text-white",children:n("terminalShortcuts.scrollDown")}),s.jsx(dA,{className:"h-4 w-4 text-gray-600 dark:text-gray-400"})]})]})]})]})}),a&&s.jsx("div",{className:"fixed inset-0 z-30 bg-background/80 backdrop-blur-sm transition-opacity duration-150 ease-out",onPointerDown:ss,onClick:l})]})}function K4({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}=Me("chat"),[u,d]=b.useState(!1),[p,h]=b.useState(null),m=b.useRef(null),f=b.useRef(null),{terminalContainerRef:g,terminalRef:v,wsRef:x,isConnected:y,isInitialized:w,isConnecting:N,authUrl:S,authUrlVersion:k,connectToShell:T,disconnectFromShell:j,openAuthUrlInBrowser:I,copyAuthUrlToClipboard:A}=__({selectedProject:e,selectedSession:t,initialCommand:r,isPlainShell:n,minimal:i,autoConnect:o,isRestarting:u,onProcessComplete:a,onOutputRef:f}),D=b.useCallback(()=>{const B=v.current;if(!B)return;const L=B.buffer.active,X=L.baseY+L.cursorY,re=Math.min(L.baseY+L.length-1,X+10),we=Math.max(0,X-c_),ie=[];for(let ve=we;ve<=re;ve++){const _e=L.getLine(ve);_e&&ie.push(_e.translateToString().trimEnd())}let be=-1;for(let ve=ie.length-1;ve>=0;ve--)if(/esc to cancel/i.test(ie[ve])||/enter to select/i.test(ie[ve])){be=ve;break}if(be===-1){h(null);return}const ke=new Map,ee=Math.max(0,be-u_);for(let ve=be-1;ve>=ee;ve--){const _e=ie[ve].match(/^\s*[❯›>]?\s*(\d+)\.\s+(.+)/);if(_e){const O=_e[1],ue=_e[2].trim();parseInt(O,10)<=d_&&ue.length>0&&!ke.has(O)&&ke.set(O,ue)}}const se=[];for(let ve=1;ve<=ke.size&&ke.has(String(ve));ve++)se.push({number:String(ve),label:ke.get(String(ve))});h(se.length>=p_?se:null)},[v]),_=b.useCallback(()=>{m.current&&clearTimeout(m.current),m.current=setTimeout(D,l_)},[D]);b.useEffect(()=>{f.current=_},[_]),b.useEffect(()=>()=>{m.current&&clearTimeout(m.current)},[]),b.useEffect(()=>{y||(m.current&&(clearTimeout(m.current),m.current=null),h(null))},[y]),b.useEffect(()=>{if(!l||!w||!y)return;const B=()=>{v.current?.focus()},L=window.requestAnimationFrame(B),X=window.setTimeout(B,0);return()=>{window.cancelAnimationFrame(L),window.clearTimeout(X)}},[l,y,w,v]);const M=b.useCallback(B=>{ta(x.current,{type:"input",data:B})},[x]),E=b.useMemo(()=>C_(t),[t]),G=b.useMemo(()=>E?E.slice(0,30):null,[E]),J=b.useMemo(()=>E?E.slice(0,50):null,[E]),W=b.useCallback(()=>{d(!0),window.setTimeout(()=>{d(!1)},s_)},[]);if(!e)return s.jsx(j_,{title:c("shell.selectProject.title"),description:c("shell.selectProject.description")});if(i)return s.jsx(D_,{terminalContainerRef:g,authUrl:S,authUrlVersion:k,initialCommand:r,isConnected:y,openAuthUrlInBrowser:I,copyAuthUrlToClipboard:A});const U=n?c("shell.runCommand",{command:r||c("shell.defaultCommand"),projectName:e.displayName}):t?c("shell.resumeSession",{displayName:J}):c("shell.startSession"),H=n?c("shell.runCommand",{command:r||c("shell.defaultCommand"),projectName:e.displayName}):c("shell.startCli",{projectName:e.displayName}),P=w?N?"connecting":y?null:"connect":"loading",V=P==="connecting"?H:U;return s.jsxs("div",{className:"flex h-full w-full flex-col bg-gray-900",children:[s.jsx(O_,{isConnected:y,isInitialized:w,isRestarting:u,hasSession:!!t,sessionDisplayNameShort:G,onDisconnect:j,onRestart:W,statusNewSessionText:c("shell.status.newSession"),statusInitializingText:c("shell.status.initializing"),statusRestartingText:c("shell.status.restarting"),disconnectLabel:c("shell.actions.disconnect"),disconnectTitle:c("shell.actions.disconnectTitle"),restartLabel:c("shell.actions.restart"),restartTitle:c("shell.actions.restartTitle"),disableRestart:u||y}),s.jsxs("div",{className:"relative flex-1 overflow-hidden p-2",children:[s.jsx("div",{ref:g,className:"h-full w-full focus:outline-none",style:{outline:"none"}}),P&&s.jsx(R_,{mode:P,description:V,loadingLabel:c("shell.loading"),connectLabel:c("shell.actions.connect"),connectTitle:c("shell.actions.connectTitle"),connectingLabel:c("shell.connecting"),onConnect:T}),p&&y&&s.jsx("div",{className:"absolute inset-x-0 bottom-0 z-10 border-t border-gray-700/80 bg-gray-800/95 px-3 py-2 backdrop-blur-sm",onMouseDown:B=>B.preventDefault(),children:s.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[p.map(B=>s.jsxs("button",{type:"button",onClick:()=>{M(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:()=>{M("\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(M_,{wsRef:x,terminalRef:v,isConnected:y})]})}function P_({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 F_({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 Y4({project:e=null,session:t=null,command:r=null,isPlainShell:n=null,isActive:a=!0,autoConnect:i=!0,onComplete:o=null,onClose:l=null,title:c=null,className:u="",showHeader:d=!0,compact:p=!1,minimal:h=!1}){const[m,f]=b.useState(!1),g=n!==null?n:r!==null,v=b.useCallback(x=>{f(!0),o?.(x)},[o]);return e?s.jsxs("div",{className:`flex h-full w-full flex-col ${u}`,children:[!h&&d&&c&&s.jsx(F_,{title:c,isCompleted:m,onClose:l}),s.jsx("div",{className:"min-h-0 w-full flex-1",children:s.jsx(K4,{selectedProject:e,selectedSession:t,initialCommand:r,isPlainShell:g,isActive:a,onProcessComplete:v,minimal:h,autoConnect:h?!0:i})})]}):s.jsx(P_,{className:u})}const B_=({provider:e,customCommand:t,isAuthenticated:r,isOnboarding:n})=>t||(e==="claude"?r?"claude setup-token --dangerously-skip-permissions":n?"claude /exit --dangerously-skip-permissions":"claude /login --dangerously-skip-permissions":e==="cursor"?"cursor-agent login":e==="codex"?"codex login":"gemini status"),z_=e=>e==="claude"?"Claude CLI Login":e==="cursor"?"Cursor CLI Login":e==="codex"?"Codex CLI Login":"Gemini CLI Configuration",$_=e=>{const t=e?.name||"default",r=e?.fullPath??e?.path??"";return{name:t,displayName:e?.displayName||t,fullPath:r,path:e?.path??r}};function Z4({isOpen:e,onClose:t,provider:r="claude",project:n=null,onComplete:a,customCommand:i,isAuthenticated:o=!1,isOnboarding:l=!1}){if(!e)return null;const c=B_({provider:r,customCommand:i,isAuthenticated:o,isOnboarding:l}),u=z_(r),d=$_(n),p=h=>{a?.(h)};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:u}),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(vt,{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(z6,{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($a,{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(Y4,{project:d,command:c,onComplete:p,minimal:!0})})]})})}const U_=({className:e="w-5 h-5"})=>s.jsx("img",{src:"/icons/claude-ai-icon.svg",alt:"Claude",className:e}),q_=({className:e="w-5 h-5"})=>{const{isDarkMode:t}=Ya();return s.jsx("img",{src:t?"/icons/codex-white.svg":"/icons/codex.svg",alt:"Codex",className:e})},G_=({className:e="w-5 h-5"})=>{const{isDarkMode:t}=Ya();return s.jsx("img",{src:t?"/icons/cursor-white.svg":"/icons/cursor.svg",alt:"Cursor",className:e})},H_=({className:e="w-5 h-5"})=>s.jsx("img",{src:"/icons/gemini-ai-icon.svg",alt:"Gemini",className:e});function _r({provider:e="claude",className:t="w-5 h-5"}){return e==="cursor"?s.jsx(G_,{className:t}):e==="codex"?s.jsx(q_,{className:t}):e==="gemini"?s.jsx(H_,{className:t}):s.jsx(U_,{className:t})}function W_({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(_r,{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(lr,{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 V_=[{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 K_({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:V_.map(r=>s.jsx(W_,{provider:r.provider,title:r.title,status:e[r.provider],connectedClassName:r.connectedClassName,iconContainerClassName:r.iconContainerClassName,loginButtonClassName:r.loginButtonClassName,onLogin:()=>t(r.provider)},r.provider))}),s.jsx("div",{className:"pt-2 text-center text-sm text-muted-foreground",children:s.jsx("p",{children:"You can configure these later in Settings."})})]})}function Y_({gitName:e,gitEmail:t,isSubmitting:r,onGitNameChange:n,onGitEmailChange:a}){return s.jsxs("div",{className:"space-y-6",children:[s.jsxs("div",{className:"mb-8 text-center",children:[s.jsx("div",{className:"mx-auto mb-4 flex h-16 w-16 items-center justify-center rounded-full bg-blue-100 dark:bg-blue-900/30",children:s.jsx(Nr,{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(QI,{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(J6,{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 Hg=[{title:"Git Configuration",icon:Nr,required:!0},{title:"Connect Agents",icon:z4,required:!1}];function Z_({currentStep:e}){return s.jsx("div",{className:"mb-8",children:s.jsx("div",{className:"flex items-center justify-between",children:Hg.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(lr,{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<Hg.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 X_=["claude","cursor","codex","gemini"],Wg=/^[^\s@]+@[^\s@]+\.[^\s@]+$/,J_={name:"default",displayName:"default",fullPath:"",path:""},Q_=()=>({claude:{authenticated:!1,email:null,loading:!0,error:null},cursor:{authenticated:!1,email:null,loading:!0,error:null},codex:{authenticated:!1,email:null,loading:!0,error:null},gemini:{authenticated:!1,email:null,loading:!0,error:null}}),Vg=async(e,t)=>{try{return(await e.json()).error||t}catch{return t}};function e7({onComplete:e}){const[t,r]=b.useState(0),[n,a]=b.useState(""),[i,o]=b.useState(""),[l,c]=b.useState(!1),[u,d]=b.useState(""),[p,h]=b.useState(null),[m,f]=b.useState(Q_),g=b.useRef(void 0),v=b.useCallback(async I=>{try{const A=await Re(`/api/cli/${I}/status`);if(!A.ok){f(_=>({..._,[I]:{authenticated:!1,email:null,loading:!1,error:"Failed to check authentication status"}}));return}const D=await A.json();f(_=>({..._,[I]:{authenticated:!!D.authenticated,email:D.email??null,loading:!1,error:D.error??null}}))}catch(A){console.error(`Error checking ${I} auth status:`,A),f(D=>({...D,[I]:{authenticated:!1,email:null,loading:!1,error:A instanceof Error?A.message:"Unknown error"}}))}},[]),x=b.useCallback(async()=>{await Promise.all(X_.map(I=>v(I)))},[v]),y=b.useCallback(async()=>{try{const I=await Re("/api/user/git-config");if(!I.ok)return;const A=await I.json();A.gitName&&a(A.gitName),A.gitEmail&&o(A.gitEmail)}catch(I){console.error("Error loading git config:",I)}},[]);b.useEffect(()=>{y(),x()},[y,x]),b.useEffect(()=>{const I=g.current;g.current=p,(I===void 0||I!==null&&p===null)&&x()},[p,x]);const w=I=>{h(I)},N=I=>{I===0&&p&&v(p)},S=async()=>{if(d(""),t!==0){r(I=>I+1);return}if(!n.trim()||!i.trim()){d("Both git name and email are required.");return}if(!Wg.test(i)){d("Please enter a valid email address.");return}c(!0);try{const I=await Re("/api/user/git-config",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({gitName:n,gitEmail:i})});if(!I.ok){const A=await Vg(I,"Failed to save git configuration");throw new Error(A)}r(A=>A+1)}catch(I){d(I instanceof Error?I.message:"Failed to save git configuration")}finally{c(!1)}},k=()=>{d(""),r(I=>I-1)},T=async()=>{c(!0),d("");try{const I=await Re("/api/user/complete-onboarding",{method:"POST"});if(!I.ok){const A=await Vg(I,"Failed to complete onboarding");throw new Error(A)}await e?.()}catch(I){d(I instanceof Error?I.message:"Failed to complete onboarding")}finally{c(!1)}},j=t===0?!!(n.trim()&&i.trim()&&Wg.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(Z_,{currentStep:t}),s.jsxs("div",{className:"rounded-lg border border-border bg-card p-8 shadow-lg",children:[t===0?s.jsx(Y_,{gitName:n,gitEmail:i,isSubmitting:l,onGitNameChange:a,onGitEmailChange:o}):s.jsx(K_,{providerStatuses:m,onOpenProviderLogin:w}),u&&s.jsx("div",{className:"mt-6 rounded-lg border border-red-300 bg-red-100 p-4 dark:border-red-800 dark:bg-red-900/20",children:s.jsx("p",{className:"text-sm text-red-700 dark:text-red-400",children:u})}),s.jsxs("div",{className:"mt-8 flex items-center justify-between border-t border-border pt-6",children:[s.jsxs("button",{onClick:k,disabled:t===0||l,className:"flex items-center gap-2 px-4 py-2 text-sm font-medium text-muted-foreground transition-colors duration-200 hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50",children:[s.jsx(Ao,{className:"h-4 w-4"}),"Previous"]}),s.jsx("div",{className:"flex items-center gap-3",children:t<1?s.jsx("button",{onClick:S,disabled:!j||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(Dr,{className:"h-4 w-4 animate-spin"}),"Saving..."]}):s.jsxs(s.Fragment,{children:["Next",s.jsx(Or,{className:"h-4 w-4"})]})}):s.jsx("button",{onClick:T,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(Dr,{className:"h-4 w-4 animate-spin"}),"Completing..."]}):s.jsxs(s.Fragment,{children:[s.jsx(lr,{className:"h-4 w-4"}),"Complete Setup"]})})})]})]})]})}),p&&s.jsx(Z4,{isOpen:!!p,onClose:()=>h(null),provider:p,project:J_,onComplete:N,isOnboarding:!0})]})}const t7=["0s","0.1s","0.2s"];function r7(){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(Dn,{className:"h-8 w-8 text-primary-foreground"})})}),s.jsx("h1",{className:"mb-2 text-2xl font-bold text-foreground",children:"Claude Code UI"}),s.jsx("div",{className:"flex items-center justify-center space-x-2",children:t7.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 X4({errorMessage:e}){return e?s.jsx("div",{className:"rounded-md border border-red-300 bg-red-100 p-3 dark:border-red-800 dark:bg-red-900/20",children:s.jsx("p",{className:"text-sm text-red-700 dark:text-red-400",children:e})}):null}function _i({id:e,label:t,value:r,onChange:n,placeholder:a,isDisabled:i,type:o="text"}){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,value:r,onChange:l=>n(l.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 J4({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(Dn,{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})})]})})})}const n7={username:"",password:""};function a7(){const{t:e}=Me("auth"),{login:t}=Wi(),[r,n]=b.useState(n7),[a,i]=b.useState(""),[o,l]=b.useState(!1),c=b.useCallback((d,p)=>{n(h=>({...h,[d]:p}))},[]),u=b.useCallback(async d=>{if(d.preventDefault(),i(""),!r.username.trim()||!r.password){i(e("login.errors.requiredFields"));return}l(!0);const p=await t(r.username.trim(),r.password);p.success||i(p.error),l(!1)},[r.password,r.username,t,e]);return s.jsx(J4,{title:e("login.title"),description:e("login.description"),footerText:"Enter your credentials to access Claude Code UI",children:s.jsxs("form",{onSubmit:u,className:"space-y-4",children:[s.jsx(_i,{id:"username",label:e("login.username"),value:r.username,onChange:d=>c("username",d),placeholder:e("login.placeholders.username"),isDisabled:o}),s.jsx(_i,{id:"password",label:e("login.password"),value:r.password,onChange:d=>c("password",d),placeholder:e("login.placeholders.password"),isDisabled:o,type:"password"}),s.jsx(X4,{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 i7={username:"",password:"",confirmPassword:""};function s7(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 o7(){const{register:e}=Wi(),[t,r]=b.useState(i7),[n,a]=b.useState(""),[i,o]=b.useState(!1),l=b.useCallback((u,d)=>{r(p=>({...p,[u]:d}))},[]),c=b.useCallback(async u=>{u.preventDefault(),a("");const d=s7(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(J4,{title:"Welcome to Claude Code UI",description:"Set up your account to get started",footerText:"This is a single-user system. Only one account can be created.",logo:s.jsx("img",{src:"/logo.svg",alt:"CloudCLI",className:"h-16 w-16"}),children:s.jsxs("form",{onSubmit:c,className:"space-y-4",children:[s.jsx(_i,{id:"username",label:"Username",value:t.username,onChange:u=>l("username",u),placeholder:"Enter your username",isDisabled:i}),s.jsx(_i,{id:"password",label:"Password",value:t.password,onChange:u=>l("password",u),placeholder:"Enter your password",isDisabled:i,type:"password"}),s.jsx(_i,{id:"confirmPassword",label:"Confirm Password",value:t.confirmPassword,onChange:u=>l("confirmPassword",u),placeholder:"Confirm your password",isDisabled:i,type:"password"}),s.jsx(X4,{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 l7({children:e}){const{user:t,isLoading:r,needsSetup:n,hasCompletedOnboarding:a,refreshOnboardingStatus:i}=Wi();return r?s.jsx(r7,{}):n?s.jsx(o7,{}):t?a?s.jsx(s.Fragment,{children:e}):s.jsx(e7,{onComplete:i}):s.jsx(a7,{})}const Q4=b.createContext(null),eE=()=>{const e=b.useContext(Q4);if(!e)throw new Error("useWebSocket must be used within a WebSocketProvider");return e},c7=e=>{const t=window.location.protocol==="https:"?"wss:":"ws:";return e?`${t}//${window.location.host}/ws?token=${encodeURIComponent(e)}`:null},u7=()=>{const e=b.useRef(null),t=b.useRef(!1),r=b.useRef(!1),[n,a]=b.useState(null),[i,o]=b.useState(!1),l=b.useRef(null),{token:c}=Wi();b.useEffect(()=>(u(),()=>{t.current=!0,l.current&&clearTimeout(l.current),e.current&&e.current.close()}),[c]);const u=b.useCallback(()=>{if(!t.current)try{const h=c7(c);if(!h)return console.warn("No authentication token found for WebSocket connection");const m=new WebSocket(h);m.onopen=()=>{o(!0),e.current=m,r.current&&a({type:"websocket-reconnected",timestamp:Date.now()}),r.current=!0},m.onmessage=f=>{try{const g=JSON.parse(f.data);a(g)}catch(g){console.error("Error parsing WebSocket message:",g)}},m.onclose=()=>{o(!1),e.current=null,l.current=setTimeout(()=>{t.current||u()},3e3)},m.onerror=f=>{console.error("WebSocket error:",f)}}catch(h){console.error("Error creating WebSocket connection:",h)}},[c]),d=b.useCallback(h=>{const m=e.current;m&&m.readyState===WebSocket.OPEN?m.send(JSON.stringify(h)):console.warn("WebSocket not connected")},[]);return b.useMemo(()=>({ws:e.current,sendMessage:d,latestMessage:n,isConnected:i}),[d,n,i])},d7=({children:e})=>{const t=u7();return s.jsx(Q4.Provider,{value:t,children:e})},tE=b.createContext(null);function p7(e,t){return{message:t instanceof Error?t.message:`Failed to ${e}`,context:e,timestamp:new Date().toISOString()}}function Kg(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 m7(e){return e.find(t=>t.status==="pending"||t.status==="in-progress")??null}function h7(e){return e?.type?e.type.startsWith("taskmaster-"):!1}function Za(){const e=b.useContext(tE);if(!e)throw new Error("useTaskMaster must be used within a TaskMasterProvider");return e}function f7({children:e}){const{latestMessage:t}=eE(),{user:r,token:n,isLoading:a}=Wi(),[i,o]=b.useState([]),[l,c]=b.useState(null),[u,d]=b.useState(null),[p,h]=b.useState(null),[m,f]=b.useState([]),[g,v]=b.useState(null),[x,y]=b.useState(!1),[w,N]=b.useState(!1),[S,k]=b.useState(!1),[T,j]=b.useState(null),I=b.useRef(null);b.useEffect(()=>{I.current=l?.name??null},[l?.name]);const A=b.useCallback(()=>{j(null)},[]),D=b.useCallback((W,U)=>{console.error(`TaskMaster ${W} error:`,U),j(p7(W,U))},[]),_=b.useCallback(W=>{const U=W?Kg(W):null;c(U),d(U?.taskmaster??null),f([]),v(null)},[]),M=b.useCallback(async()=>{if(!r||!n){o([]),c(null),d(null),f([]),v(null);return}try{y(!0),A();const W=await st.get("/projects");if(!W.ok)throw new Error(`Failed to fetch projects: ${W.status}`);const U=await W.json(),P=(Array.isArray(U)?U:[]).map(L=>Kg(L));o(P);const V=I.current;if(!V)return;const B=P.find(L=>L.name===V)??null;c(B),d(B?.taskmaster??null)}catch(W){D("load projects",W)}finally{y(!1)}},[A,D,n,r]),E=b.useCallback(async()=>{const W=l?.name;if(!W||!r||!n){f([]),v(null);return}try{N(!0),A();const U=await st.get(`/taskmaster/tasks/${encodeURIComponent(W)}`);if(!U.ok){const V=await U.json();throw new Error(V.message??"Failed to load tasks")}const H=await U.json(),P=Array.isArray(H.tasks)?H.tasks:[];f(P),v(m7(P))}catch(U){D("load tasks",U),f([]),v(null)}finally{N(!1)}},[A,l?.name,D,n,r]),G=b.useCallback(async()=>{if(!r||!n){h(null);return}try{k(!0),A();const W=await st.get("/mcp-utils/taskmaster-server");if(!W.ok)throw new Error(`Failed to load MCP status: ${W.status}`);const U=await W.json();h(U)}catch(W){D("check MCP server status",W),h(null)}finally{k(!1)}},[A,D,n,r]);b.useEffect(()=>{!a&&r&&n&&(M(),G())},[a,G,M,n,r]),b.useEffect(()=>{l?.name&&r&&n&&E()},[l?.name,E,n,r]),b.useEffect(()=>{const W=t;if(h7(W)){if(W.type==="taskmaster-project-updated"&&W.projectName){M();return}if(W.type==="taskmaster-tasks-updated"&&W.projectName===l?.name){E();return}W.type==="taskmaster-mcp-status-changed"&&G()}},[l?.name,t,G,M,E]);const J=b.useMemo(()=>({projects:i,currentProject:l,projectTaskMaster:u,mcpServerStatus:p,tasks:m,nextTask:g,isLoading:x,isLoadingTasks:w,isLoadingMCP:S,error:T,refreshProjects:M,setCurrentProject:_,refreshTasks:E,refreshMCPStatus:G,clearError:A}),[A,l,T,x,S,w,p,g,u,i,G,M,E,_,m]);return s.jsx(tE.Provider,{value:J,children:e})}const rE=b.createContext({tasksEnabled:!0,setTasksEnabled:()=>{},toggleTasksEnabled:()=>{},isTaskMasterInstalled:null,isTaskMasterReady:null,installationStatus:null,isCheckingInstallation:!0}),Vi=()=>{const e=b.useContext(rE);if(!e)throw new Error("useTasksSettings must be used within a TasksSettingsProvider");return e},g7=({children:e})=>{const[t,r]=b.useState(()=>{const m=localStorage.getItem("tasks-enabled");return m!==null?JSON.parse(m):!0}),[n,a]=b.useState(null),[i,o]=b.useState(null),[l,c]=b.useState(null),[u,d]=b.useState(!0);b.useEffect(()=>{localStorage.setItem("tasks-enabled",JSON.stringify(t))},[t]),b.useEffect(()=>{setTimeout(async()=>{try{const f=await st.get("/taskmaster/installation-status");if(f.ok){const g=await f.json();c(g),a(g.installation?.isInstalled||!1),o(g.isReady||!1);const v=localStorage.getItem("tasks-enabled");!g.installation?.isInstalled&&!v&&r(!1)}else console.error("Failed to check TaskMaster installation status"),a(!1),o(!1)}catch(f){console.error("Error checking TaskMaster installation:",f),a(!1),o(!1)}finally{d(!1)}},0)},[]);const h={tasksEnabled:t,setTasksEnabled:r,toggleTasksEnabled:()=>{r(m=>!m)},isTaskMasterInstalled:n,isTaskMasterReady:i,installationStatus:l,isCheckingInstallation:u};return s.jsx(rE.Provider,{value:h,children:e})},nE=b.createContext(null);function Ki(){const e=b.useContext(nE);if(!e)throw new Error("usePlugins must be used within a PluginsProvider");return e}function b7({children:e}){const[t,r]=b.useState([]),[n,a]=b.useState(!0),[i,o]=b.useState(null),l=b.useCallback(async()=>{try{const h=await Re("/api/plugins");if(h.ok){const m=await h.json();r(m.plugins||[]),o(null)}else{let m=`Failed to fetch plugins (${h.status})`;try{const f=await h.json();m=f.details||f.error||m}catch{m=h.statusText||m}o(m)}}catch(h){const m=h instanceof Error?h.message:"Failed to fetch plugins";o(m),console.error("[Plugins] Failed to fetch plugins:",h)}finally{a(!1)}},[]);b.useEffect(()=>{l()},[l]);const c=b.useCallback(async h=>{try{const m=await Re("/api/plugins/install",{method:"POST",body:JSON.stringify({url:h})}),f=await m.json();return m.ok?(await l(),{success:!0}):{success:!1,error:f.details||f.error||"Install failed"}}catch(m){return{success:!1,error:m instanceof Error?m.message:"Install failed"}}},[l]),u=b.useCallback(async h=>{try{const m=await Re(`/api/plugins/${encodeURIComponent(h)}`,{method:"DELETE"}),f=await m.json();return m.ok?(await l(),{success:!0}):{success:!1,error:f.details||f.error||"Uninstall failed"}}catch(m){return{success:!1,error:m instanceof Error?m.message:"Uninstall failed"}}},[l]),d=b.useCallback(async h=>{try{const m=await Re(`/api/plugins/${encodeURIComponent(h)}/update`,{method:"POST"}),f=await m.json();return m.ok?(await l(),{success:!0}):{success:!1,error:f.details||f.error||"Update failed"}}catch(m){return{success:!1,error:m instanceof Error?m.message:"Update failed"}}},[l]),p=b.useCallback(async(h,m)=>{try{const f=await Re(`/api/plugins/${encodeURIComponent(h)}/enable`,{method:"PUT",body:JSON.stringify({enabled:m})});if(!f.ok){let g=`Toggle failed (${f.status})`;try{const v=await f.json();g=v.details||v.error||g}catch{g=f.statusText||g}return{success:!1,error:g}}return await l(),{success:!0,error:null}}catch(f){return{success:!1,error:f instanceof Error?f.message:"Toggle failed"}}},[l]);return s.jsx(nE.Provider,{value:{plugins:t,loading:n,pluginsError:i,refreshPlugins:l,installPlugin:c,uninstallPlugin:u,updatePlugin:d,togglePlugin:p},children:e})}const Yg=e=>typeof window>"u"?!1:window.innerWidth<e,Zg=()=>{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 rf(e={}){const{mobileBreakpoint:t=768,trackMobile:r=!0,trackPWA:n=!0}=e,[a,i]=b.useState(()=>r?Yg(t):!1),[o,l]=b.useState(()=>n?Zg():!1);return b.useEffect(()=>{if(!r||typeof window>"u")return;const c=()=>{i(Yg(t))};return c(),window.addEventListener("resize",c),()=>{window.removeEventListener("resize",c)}},[t,r]),b.useEffect(()=>{if(!n||typeof window>"u")return;const c=window.matchMedia("(display-mode: standalone)"),u=()=>{l(Zg())};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 Xg="1.25.1",x7=(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},aE=(e,t)=>{const[r,n]=b.useState(!1),[a,i]=b.useState(null),[o,l]=b.useState(null),[c,u]=b.useState("git");return b.useEffect(()=>{(async()=>{try{const h=await(await fetch("/health")).json();(h.installMode==="npm"||h.installMode==="git")&&u(h.installMode)}catch{}})()},[]),b.useEffect(()=>{const d=async()=>{try{const m=await(await fetch(`https://api.github.com/repos/${e}/${t}/releases/latest`)).json();if(m.tag_name){const f=m.tag_name.replace(/^v/,"");i(f),n(x7(f,Xg)>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:Xg,releaseInfo:o,installMode:c}},Jn={autoExpandTools:!1,showRawParameters:!1,showThinking:!0,autoScrollToBottom:!0,sendByCtrlEnter:!1,sidebarVisible:!0},eo=Object.keys(Jn),y7=new Set(eo),il="ui-preferences:sync",to=(e,t)=>{if(typeof e=="boolean")return e;if(typeof e=="string"){if(e==="true")return!0;if(e==="false")return!1}return t},v7=(e,t)=>{try{const r=localStorage.getItem(e);if(r===null)return t;const n=JSON.parse(r);return to(n,t)}catch{return t}},w7=e=>{if(typeof window>"u")return Jn;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 eo.reduce((a,i)=>(a[i]=to(n[i],Jn[i]),a),{...Jn})}}}catch{}return eo.reduce((t,r)=>(t[r]=v7(r,Jn[r]),t),{...Jn})};function k7(e,t){switch(t.type){case"set":{const{key:r,value:n}=t;if(!y7.has(r))return e;const a=to(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 eo){if(!(i in r))continue;const o=r[i],l=to(o,e[i]);a[i]!==l&&(a[i]=l,n=!0)}return n?a:e}case"reset":return{...Jn,...t.value||{}};default:return e}}function nf(e="uiPreferences"){const t=b.useRef(`ui-preferences-${Math.random().toString(36).slice(2)}`),[r,n]=b.useReducer(k7,e,w7);return b.useEffect(()=>{typeof window>"u"||(localStorage.setItem(e,JSON.stringify(r)),window.dispatchEvent(new CustomEvent(il,{detail:{storageKey:e,sourceId:t.current,value:r}})))},[r,e]),b.useEffect(()=>{if(typeof window>"u")return;const l=d=>{!d||typeof d!="object"||Array.isArray(d)||n({type:"set_many",value:d})},c=d=>{if(!(d.key!==e||d.newValue===null))try{const p=JSON.parse(d.newValue);l(p)}catch{}},u=d=>{const h=d.detail;!h||h.storageKey!==e||h.sourceId===t.current||l(h.value)};return window.addEventListener("storage",c),window.addEventListener(il,u),()=>{window.removeEventListener("storage",c),window.removeEventListener(il,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 S7=()=>{try{const e=localStorage.getItem("claude-settings");return e&&JSON.parse(e).projectSortOrder==="date"?"date":"name"}catch{return"name"}},E7=()=>{try{const e=localStorage.getItem("starredProjects");return e?new Set(JSON.parse(e)):new Set}catch{return new Set}},N7=e=>{try{localStorage.setItem("starredProjects",JSON.stringify([...e]))}catch{}},ro=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),C7=(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"),T7=e=>e.__provider==="cursor"?String(e.createdAt||""):e.__provider==="codex"?String(e.createdAt||e.lastActivity||""):String(e.lastActivity||e.createdAt||""),A7=(e,t,r)=>{const n=ro(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:C7(e,r),sessionTime:T7(e),messageCount:Number(e.messageCount||0)}},iE=(e,t)=>{const r=[...e.sessions||[],...t[e.name]||[]].map(o=>({...o,__provider:"claude"})),n=(e.cursorSessions||[]).map(o=>({...o,__provider:"cursor"})),a=(e.codexSessions||[]).map(o=>({...o,__provider:"codex"})),i=(e.geminiSessions||[]).map(o=>({...o,__provider:"gemini"}));return[...r,...n,...a,...i].sort((o,l)=>ro(l).getTime()-ro(o).getTime())},Jg=(e,t)=>{const r=iE(e,t);return r.length===0?new Date(0):r.reduce((n,a)=>{const i=ro(a);return i>n?i:n},new Date(0))},I7=(e,t,r,n)=>{const a=[...e];return a.sort((i,o)=>{const l=r.has(i.name),c=r.has(o.name);return l&&!c?-1:!l&&c?1:t==="date"?Jg(o,n).getTime()-Jg(i,n).getTime():(i.displayName||i.name).localeCompare(o.displayName||o.name)}),a},_7=(e,t)=>{const r=t.trim().toLowerCase();return r?e.filter(n=>{const a=(n.displayName||n.name).toLowerCase(),i=n.name.toLowerCase();return a.includes(r)||i.includes(r)}):e},R7=(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"},j7=e=>{const t=typeof e.fullPath=="string"&&e.fullPath.length>0?e.fullPath:typeof e.path=="string"?e.path:"";return{name:e.name,displayName:typeof e.displayName=="string"&&e.displayName.trim().length>0?e.displayName:e.name,fullPath:t,path:typeof e.path=="string"&&e.path.length>0?e.path:t}};function O7({projects:e,selectedProject:t,selectedSession:r,isLoading:n,isMobile:a,t:i,onRefresh:o,onProjectSelect:l,onSessionSelect:c,onSessionDelete:u,onProjectDelete:d,setCurrentProject:p,setSidebarVisible:h,sidebarVisible:m}){const[f,g]=b.useState(new Set),[v,x]=b.useState(null),[y,w]=b.useState(!1),[N,S]=b.useState(""),[k,T]=b.useState({}),[j,I]=b.useState({}),[A,D]=b.useState(new Set),[_,M]=b.useState(new Date),[E,G]=b.useState("name"),[J,W]=b.useState(!1),[U,H]=b.useState({}),[P,V]=b.useState(null),[B,L]=b.useState(""),[X,re]=b.useState(""),[we,ie]=b.useState(new Set),[be,ke]=b.useState(null),[ee,se]=b.useState(null),[ve,_e]=b.useState(!1),[O,ue]=b.useState(()=>E7()),[K,z]=b.useState("projects"),[$,Y]=b.useState(null),[he,ge]=b.useState(!1),[oe,xe]=b.useState(null),ce=b.useRef(null),le=b.useRef(0),te=b.useRef(null),de=!a&&!m;b.useEffect(()=>{const Ie=setInterval(()=>{M(new Date)},6e4);return()=>clearInterval(Ie)},[]),b.useEffect(()=>{I({}),D(new Set),H({})},[e]),b.useEffect(()=>{t&&g(Ie=>{if(Ie.has(t.name))return Ie;const He=new Set(Ie);return He.add(t.name),He})},[r,t]),b.useEffect(()=>{if(e.length>0&&!n){const Ie=new Set;e.forEach(He=>{He.sessions&&He.sessions.length>=0&&Ie.add(He.name)}),D(Ie)}},[e,n]),b.useEffect(()=>{const Ie=()=>{G(S7())};Ie();const He=me=>{me.key==="claude-settings"&&Ie()};window.addEventListener("storage",He);const ne=setInterval(()=>{document.hasFocus()&&Ie()},1e3);return()=>{window.removeEventListener("storage",He),clearInterval(ne)}},[]),b.useEffect(()=>{ce.current&&clearTimeout(ce.current),te.current&&(te.current.close(),te.current=null);const Ie=X.trim();if(K!=="conversations"||Ie.length<2){le.current+=1,Y(null),xe(null),ge(!1);return}ge(!0);const He=++le.current;return ce.current=setTimeout(()=>{if(He!==le.current)return;const ne=st.searchConversationsUrl(Ie),me=new EventSource(ne);te.current=me;const fe=[];let Ee=0;me.addEventListener("result",We=>{if(He!==le.current){me.close();return}try{const wt=JSON.parse(We.data);fe.push(wt.projectResult),Ee=wt.totalMatches,Y({results:[...fe],totalMatches:Ee,query:Ie}),xe({scannedProjects:wt.scannedProjects,totalProjects:wt.totalProjects})}catch{}}),me.addEventListener("progress",We=>{if(He!==le.current){me.close();return}try{const wt=JSON.parse(We.data);Ee=wt.totalMatches,xe({scannedProjects:wt.scannedProjects,totalProjects:wt.totalProjects})}catch{}}),me.addEventListener("done",()=>{if(He!==le.current){me.close();return}me.close(),te.current=null,ge(!1),xe(null),fe.length===0&&Y({results:[],totalMatches:0,query:Ie})}),me.addEventListener("error",()=>{if(He!==le.current){me.close();return}me.close(),te.current=null,ge(!1),xe(null),fe.length===0&&Y({results:[],totalMatches:0,query:Ie})})},400),()=>{ce.current&&clearTimeout(ce.current),te.current&&(te.current.close(),te.current=null)}},[X,K]),b.useCallback(Ie=>He=>{const ne=He.target;ne.closest(".overflow-y-auto")||ne.closest("[data-scroll-container]")||(He.preventDefault(),He.stopPropagation(),Ie())},[]);const ye=b.useCallback(Ie=>{g(He=>{const ne=new Set;return He.has(Ie)||ne.add(Ie),ne})},[]),je=b.useCallback((Ie,He)=>{c({...Ie,__projectName:He})},[c]),qe=b.useCallback(Ie=>{ue(He=>{const ne=new Set(He);return ne.has(Ie)?ne.delete(Ie):ne.add(Ie),N7(ne),ne})},[]),at=b.useCallback(Ie=>O.has(Ie),[O]),rt=b.useCallback(Ie=>iE(Ie,j),[j]),Ke=b.useMemo(()=>e.map(Ie=>{const He=U[Ie.name];return He===void 0?Ie:{...Ie,sessionMeta:{...Ie.sessionMeta,hasMore:He}}}),[U,e]),ct=b.useMemo(()=>I7(Ke,E,O,j),[j,E,Ke,O]),ft=b.useMemo(()=>_7(ct,X),[X,ct]),tt=b.useCallback(Ie=>{x(Ie.name),S(Ie.displayName)},[]),gt=b.useCallback(()=>{x(null),S("")},[]),dt=b.useCallback(async Ie=>{try{(await st.renameProject(Ie,N)).ok?window.refreshProjects?await window.refreshProjects():window.location.reload():console.error("Failed to rename project")}catch(He){console.error("Error renaming project:",He)}finally{x(null),S("")}},[N]),Oe=b.useCallback((Ie,He,ne,me="claude")=>{se({projectName:Ie,sessionId:He,sessionTitle:ne,provider:me})},[]),ze=b.useCallback(async()=>{if(!ee)return;const{projectName:Ie,sessionId:He,provider:ne}=ee;se(null);try{let me;if(ne==="codex"?me=await st.deleteCodexSession(He):ne==="gemini"?me=await st.deleteGeminiSession(He):me=await st.deleteSession(Ie,He),me.ok)u?.(He);else{const fe=await me.text();console.error("[Sidebar] Failed to delete session:",{status:me.status,error:fe}),alert(i("messages.deleteSessionFailed"))}}catch(me){console.error("[Sidebar] Error deleting session:",me),alert(i("messages.deleteSessionError"))}},[u,ee,i]),Ye=b.useCallback(Ie=>{ke({project:Ie,sessionCount:rt(Ie).length})},[rt]),it=b.useCallback(async()=>{if(!be)return;const{project:Ie,sessionCount:He}=be,ne=He===0;ke(null),ie(me=>new Set([...me,Ie.name]));try{const me=await st.deleteProject(Ie.name,!ne);if(me.ok)d?.(Ie.name);else{const fe=await me.json();alert(fe.error||i("messages.deleteProjectFailed"))}}catch(me){console.error("Error deleting project:",me),alert(i("messages.deleteProjectError"))}finally{ie(me=>{const fe=new Set(me);return fe.delete(Ie.name),fe})}},[be,d,i]),Je=b.useCallback(async Ie=>{const He=U[Ie.name];if(!(!(He!==void 0?He:Ie.sessionMeta?.hasMore===!0)||k[Ie.name])){T(me=>({...me,[Ie.name]:!0}));try{const me=(Ie.sessions?.length||0)+(j[Ie.name]?.length||0),fe=await st.sessions(Ie.name,5,me);if(!fe.ok)return;const Ee=await fe.json();I(We=>({...We,[Ie.name]:[...We[Ie.name]||[],...Ee.sessions||[]]})),Ee.hasMore===!1&&H(We=>({...We,[Ie.name]:!1}))}catch(me){console.error("Error loading more sessions:",me)}finally{T(me=>({...me,[Ie.name]:!1}))}}},[j,k,U]),Ge=b.useCallback(Ie=>{l(Ie),p(Ie)},[l,p]),bt=b.useCallback(async()=>{W(!0);try{await o()}finally{W(!1)}},[o]),pt=b.useCallback(async(Ie,He,ne,me)=>{const fe=ne.trim();if(!fe){V(null),L("");return}try{const Ee=await st.renameSession(He,fe,me);Ee.ok?await o():(console.error("[Sidebar] Failed to rename session:",Ee.status),alert(i("messages.renameSessionFailed")))}catch(Ee){console.error("[Sidebar] Error renaming session:",Ee),alert(i("messages.renameSessionError"))}finally{V(null),L("")}},[o,i]),Ft=b.useCallback(()=>{h(!1)},[h]),Vt=b.useCallback(()=>{h(!0)},[h]);return{isSidebarCollapsed:de,expandedProjects:f,editingProject:v,showNewProject:y,editingName:N,loadingSessions:k,additionalSessions:j,initialSessionsLoaded:A,currentTime:_,projectSortOrder:E,isRefreshing:J,editingSession:P,editingSessionName:B,searchFilter:X,deletingProjects:we,deleteConfirmation:be,sessionDeleteConfirmation:ee,showVersionModal:ve,starredProjects:O,filteredProjects:ft,toggleProject:ye,handleSessionClick:je,toggleStarProject:qe,isProjectStarred:at,getProjectSessions:rt,startEditing:tt,cancelEditing:gt,saveProjectName:dt,showDeleteSessionConfirmation:Oe,confirmDeleteSession:ze,requestProjectDelete:Ye,confirmDeleteProject:it,loadMoreSessions:Je,handleProjectSelect:Ge,refreshProjects:bt,updateSessionSummary:pt,collapseSidebar:Ft,expandSidebar:Vt,setShowNewProject:w,setEditingName:S,setEditingSession:V,setEditingSessionName:L,searchMode:K,setSearchMode:z,conversationResults:$,isSearching:he,searchProgress:oe,clearConversationResults:b.useCallback(()=>{le.current+=1,te.current&&(te.current.close(),te.current=null),ge(!1),xe(null),Y(null)},[]),setSearchFilter:re,setDeleteConfirmation:ke,setSessionDeleteConfirmation:se,setShowVersionModal:_e}}const D7="https://discord.gg/buxwujPNRE";function L7({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 M7({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(mI,{className:"h-4 w-4 text-muted-foreground transition-colors group-hover:text-foreground"})}),s.jsx("div",{className:"nav-divider my-1 w-6"}),s.jsx("button",{onClick:t,className:"group flex h-8 w-8 items-center justify-center rounded-lg transition-colors hover:bg-accent/80","aria-label":a("actions.settings"),title:a("actions.settings"),children:s.jsx(Et,{className:"h-4 w-4 text-muted-foreground transition-colors group-hover:text-foreground"})}),s.jsx("a",{href:D7,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(L7,{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(Mn,{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 sE(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=sE(e[t]))&&(n&&(n+=" "),n+=r)}else for(r in e)e[r]&&(n&&(n+=" "),n+=r);return n}function oE(){for(var e,t,r=0,n="",a=arguments.length;r<a;r++)(e=arguments[r])&&(t=sE(e))&&(n&&(n+=" "),n+=t);return n}const Qg=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,eb=oE,lE=(e,t)=>r=>{var n;if(t?.variants==null)return eb(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=Qg(d)||Qg(p);return a[u][h]}),l=r&&Object.entries(r).reduce((u,d)=>{let[p,h]=d;return h===void 0||(u[p]=h),u},{}),c=t==null||(n=t.compoundVariants)===null||n===void 0?void 0:n.reduce((u,d)=>{let{class:p,className:h,...m}=d;return Object.entries(m).every(f=>{let[g,v]=f;return Array.isArray(v)?v.includes({...i,...l}[g]):{...i,...l}[g]===v})?[...u,p,h]:u},[]);return eb(e,o,c,r?.class,r?.className)},af="-",P7=e=>{const t=B7(e),{conflictingClassGroups:r,conflictingClassGroupModifiers:n}=e;return{getClassGroupId:o=>{const l=o.split(af);return l[0]===""&&l.length!==1&&l.shift(),cE(l,t)||F7(o)},getConflictingClassGroupIds:(o,l)=>{const c=r[o]||[];return l&&n[o]?[...c,...n[o]]:c}}},cE=(e,t)=>{if(e.length===0)return t.classGroupId;const r=e[0],n=t.nextPart.get(r),a=n?cE(e.slice(1),n):void 0;if(a)return a;if(t.validators.length===0)return;const i=e.join(af);return t.validators.find(({validator:o})=>o(i))?.classGroupId},tb=/^\[(.+)\]$/,F7=e=>{if(tb.test(e)){const t=tb.exec(e)[1],r=t?.substring(0,t.indexOf(":"));if(r)return"arbitrary.."+r}},B7=e=>{const{theme:t,classGroups:r}=e,n={nextPart:new Map,validators:[]};for(const a in r)eh(r[a],n,a,t);return n},eh=(e,t,r,n)=>{e.forEach(a=>{if(typeof a=="string"){const i=a===""?t:rb(t,a);i.classGroupId=r;return}if(typeof a=="function"){if(z7(a)){eh(a(n),t,r,n);return}t.validators.push({validator:a,classGroupId:r});return}Object.entries(a).forEach(([i,o])=>{eh(o,rb(t,i),r,n)})})},rb=(e,t)=>{let r=e;return t.split(af).forEach(n=>{r.nextPart.has(n)||r.nextPart.set(n,{nextPart:new Map,validators:[]}),r=r.nextPart.get(n)}),r},z7=e=>e.isThemeGetter,$7=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,r=new Map,n=new Map;const a=(i,o)=>{r.set(i,o),t++,t>e&&(t=0,n=r,r=new Map)};return{get(i){let o=r.get(i);if(o!==void 0)return o;if((o=n.get(i))!==void 0)return a(i,o),o},set(i,o){r.has(i)?r.set(i,o):a(i,o)}}},th="!",rh=":",U7=rh.length,q7=e=>{const{prefix:t,experimentalParseClassName:r}=e;let n=a=>{const i=[];let o=0,l=0,c=0,u;for(let f=0;f<a.length;f++){let g=a[f];if(o===0&&l===0){if(g===rh){i.push(a.slice(c,f)),c=f+U7;continue}if(g==="/"){u=f;continue}}g==="["?o++:g==="]"?o--:g==="("?l++:g===")"&&l--}const d=i.length===0?a:a.substring(c),p=G7(d),h=p!==d,m=u&&u>c?u-c:void 0;return{modifiers:i,hasImportantModifier:h,baseClassName:p,maybePostfixModifierPosition:m}};if(t){const a=t+rh,i=n;n=o=>o.startsWith(a)?i(o.substring(a.length)):{isExternal:!0,modifiers:[],hasImportantModifier:!1,baseClassName:o,maybePostfixModifierPosition:void 0}}if(r){const a=n;n=i=>r({className:i,parseClassName:a})}return n},G7=e=>e.endsWith(th)?e.substring(0,e.length-1):e.startsWith(th)?e.substring(1):e,H7=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}},W7=e=>({cache:$7(e.cacheSize),parseClassName:q7(e),sortModifiers:H7(e),...P7(e)}),V7=/\s+/,K7=(e,t)=>{const{parseClassName:r,getClassGroupId:n,getConflictingClassGroupIds:a,sortModifiers:i}=t,o=[],l=e.trim().split(V7);let c="";for(let u=l.length-1;u>=0;u-=1){const d=l[u],{isExternal:p,modifiers:h,hasImportantModifier:m,baseClassName:f,maybePostfixModifierPosition:g}=r(d);if(p){c=d+(c.length>0?" "+c:c);continue}let v=!!g,x=n(v?f.substring(0,g):f);if(!x){if(!v){c=d+(c.length>0?" "+c:c);continue}if(x=n(f),!x){c=d+(c.length>0?" "+c:c);continue}v=!1}const y=i(h).join(":"),w=m?y+th:y,N=w+x;if(o.includes(N))continue;o.push(N);const S=a(x,v);for(let k=0;k<S.length;++k){const T=S[k];o.push(w+T)}c=d+(c.length>0?" "+c:c)}return c};function Y7(){let e=0,t,r,n="";for(;e<arguments.length;)(t=arguments[e++])&&(r=uE(t))&&(n&&(n+=" "),n+=r);return n}const uE=e=>{if(typeof e=="string")return e;let t,r="";for(let n=0;n<e.length;n++)e[n]&&(t=uE(e[n]))&&(r&&(r+=" "),r+=t);return r};function Z7(e,...t){let r,n,a,i=o;function o(c){const u=t.reduce((d,p)=>p(d),e());return r=W7(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=K7(c,r);return a(c,d),d}return function(){return i(Y7.apply(null,arguments))}}const Ut=e=>{const t=r=>r[e]||[];return t.isThemeGetter=!0,t},dE=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,pE=/^\((?:(\w[\w-]*):)?(.+)\)$/i,X7=/^\d+\/\d+$/,J7=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,Q7=/\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$/,e8=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,t8=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,r8=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,wa=e=>X7.test(e),ut=e=>!!e&&!Number.isNaN(Number(e)),kn=e=>!!e&&Number.isInteger(Number(e)),sl=e=>e.endsWith("%")&&ut(e.slice(0,-1)),sn=e=>J7.test(e),n8=()=>!0,a8=e=>Q7.test(e)&&!e8.test(e),mE=()=>!1,i8=e=>t8.test(e),s8=e=>r8.test(e),o8=e=>!$e(e)&&!Ue(e),l8=e=>Xa(e,gE,mE),$e=e=>dE.test(e),Wn=e=>Xa(e,bE,a8),ol=e=>Xa(e,m8,ut),nb=e=>Xa(e,hE,mE),c8=e=>Xa(e,fE,s8),os=e=>Xa(e,xE,i8),Ue=e=>pE.test(e),mi=e=>Ja(e,bE),u8=e=>Ja(e,h8),ab=e=>Ja(e,hE),d8=e=>Ja(e,gE),p8=e=>Ja(e,fE),ls=e=>Ja(e,xE,!0),Xa=(e,t,r)=>{const n=dE.exec(e);return n?n[1]?t(n[1]):r(n[2]):!1},Ja=(e,t,r=!1)=>{const n=pE.exec(e);return n?n[1]?t(n[1]):r:!1},hE=e=>e==="position"||e==="percentage",fE=e=>e==="image"||e==="url",gE=e=>e==="length"||e==="size"||e==="bg-size",bE=e=>e==="length",m8=e=>e==="number",h8=e=>e==="family-name",xE=e=>e==="shadow",f8=()=>{const e=Ut("color"),t=Ut("font"),r=Ut("text"),n=Ut("font-weight"),a=Ut("tracking"),i=Ut("leading"),o=Ut("breakpoint"),l=Ut("container"),c=Ut("spacing"),u=Ut("radius"),d=Ut("shadow"),p=Ut("inset-shadow"),h=Ut("text-shadow"),m=Ut("drop-shadow"),f=Ut("blur"),g=Ut("perspective"),v=Ut("aspect"),x=Ut("ease"),y=Ut("animate"),w=()=>["auto","avoid","all","avoid-page","page","left","right","column"],N=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],S=()=>[...N(),Ue,$e],k=()=>["auto","hidden","clip","visible","scroll"],T=()=>["auto","contain","none"],j=()=>[Ue,$e,c],I=()=>[wa,"full","auto",...j()],A=()=>[kn,"none","subgrid",Ue,$e],D=()=>["auto",{span:["full",kn,Ue,$e]},kn,Ue,$e],_=()=>[kn,"auto",Ue,$e],M=()=>["auto","min","max","fr",Ue,$e],E=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],G=()=>["start","end","center","stretch","center-safe","end-safe"],J=()=>["auto",...j()],W=()=>[wa,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...j()],U=()=>[e,Ue,$e],H=()=>[...N(),ab,nb,{position:[Ue,$e]}],P=()=>["no-repeat",{repeat:["","x","y","space","round"]}],V=()=>["auto","cover","contain",d8,l8,{size:[Ue,$e]}],B=()=>[sl,mi,Wn],L=()=>["","none","full",u,Ue,$e],X=()=>["",ut,mi,Wn],re=()=>["solid","dashed","dotted","double"],we=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],ie=()=>[ut,sl,ab,nb],be=()=>["","none",f,Ue,$e],ke=()=>["none",ut,Ue,$e],ee=()=>["none",ut,Ue,$e],se=()=>[ut,Ue,$e],ve=()=>[wa,"full",...j()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[sn],breakpoint:[sn],color:[n8],container:[sn],"drop-shadow":[sn],ease:["in","out","in-out"],font:[o8],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[sn],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[sn],shadow:[sn],spacing:["px",ut],text:[sn],"text-shadow":[sn],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",wa,$e,Ue,v]}],container:["container"],columns:[{columns:[ut,$e,Ue,l]}],"break-after":[{"break-after":w()}],"break-before":[{"break-before":w()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:S()}],overflow:[{overflow:k()}],"overflow-x":[{"overflow-x":k()}],"overflow-y":[{"overflow-y":k()}],overscroll:[{overscroll:T()}],"overscroll-x":[{"overscroll-x":T()}],"overscroll-y":[{"overscroll-y":T()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:I()}],"inset-x":[{"inset-x":I()}],"inset-y":[{"inset-y":I()}],start:[{start:I()}],end:[{end:I()}],top:[{top:I()}],right:[{right:I()}],bottom:[{bottom:I()}],left:[{left:I()}],visibility:["visible","invisible","collapse"],z:[{z:[kn,"auto",Ue,$e]}],basis:[{basis:[wa,"full","auto",l,...j()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[ut,wa,"auto","initial","none",$e]}],grow:[{grow:["",ut,Ue,$e]}],shrink:[{shrink:["",ut,Ue,$e]}],order:[{order:[kn,"first","last","none",Ue,$e]}],"grid-cols":[{"grid-cols":A()}],"col-start-end":[{col:D()}],"col-start":[{"col-start":_()}],"col-end":[{"col-end":_()}],"grid-rows":[{"grid-rows":A()}],"row-start-end":[{row:D()}],"row-start":[{"row-start":_()}],"row-end":[{"row-end":_()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":M()}],"auto-rows":[{"auto-rows":M()}],gap:[{gap:j()}],"gap-x":[{"gap-x":j()}],"gap-y":[{"gap-y":j()}],"justify-content":[{justify:[...E(),"normal"]}],"justify-items":[{"justify-items":[...G(),"normal"]}],"justify-self":[{"justify-self":["auto",...G()]}],"align-content":[{content:["normal",...E()]}],"align-items":[{items:[...G(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...G(),{baseline:["","last"]}]}],"place-content":[{"place-content":E()}],"place-items":[{"place-items":[...G(),"baseline"]}],"place-self":[{"place-self":["auto",...G()]}],p:[{p:j()}],px:[{px:j()}],py:[{py:j()}],ps:[{ps:j()}],pe:[{pe:j()}],pt:[{pt:j()}],pr:[{pr:j()}],pb:[{pb:j()}],pl:[{pl:j()}],m:[{m:J()}],mx:[{mx:J()}],my:[{my:J()}],ms:[{ms:J()}],me:[{me:J()}],mt:[{mt:J()}],mr:[{mr:J()}],mb:[{mb:J()}],ml:[{ml:J()}],"space-x":[{"space-x":j()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":j()}],"space-y-reverse":["space-y-reverse"],size:[{size:W()}],w:[{w:[l,"screen",...W()]}],"min-w":[{"min-w":[l,"screen","none",...W()]}],"max-w":[{"max-w":[l,"screen","none","prose",{screen:[o]},...W()]}],h:[{h:["screen","lh",...W()]}],"min-h":[{"min-h":["screen","lh","none",...W()]}],"max-h":[{"max-h":["screen","lh",...W()]}],"font-size":[{text:["base",r,mi,Wn]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[n,Ue,ol]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",sl,$e]}],"font-family":[{font:[u8,$e,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,Ue,$e]}],"line-clamp":[{"line-clamp":[ut,"none",Ue,ol]}],leading:[{leading:[i,...j()]}],"list-image":[{"list-image":["none",Ue,$e]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",Ue,$e]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:U()}],"text-color":[{text:U()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...re(),"wavy"]}],"text-decoration-thickness":[{decoration:[ut,"from-font","auto",Ue,Wn]}],"text-decoration-color":[{decoration:U()}],"underline-offset":[{"underline-offset":[ut,"auto",Ue,$e]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:j()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",Ue,$e]}],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",Ue,$e]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:H()}],"bg-repeat":[{bg:P()}],"bg-size":[{bg:V()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},kn,Ue,$e],radial:["",Ue,$e],conic:[kn,Ue,$e]},p8,c8]}],"bg-color":[{bg:U()}],"gradient-from-pos":[{from:B()}],"gradient-via-pos":[{via:B()}],"gradient-to-pos":[{to:B()}],"gradient-from":[{from:U()}],"gradient-via":[{via:U()}],"gradient-to":[{to:U()}],rounded:[{rounded:L()}],"rounded-s":[{"rounded-s":L()}],"rounded-e":[{"rounded-e":L()}],"rounded-t":[{"rounded-t":L()}],"rounded-r":[{"rounded-r":L()}],"rounded-b":[{"rounded-b":L()}],"rounded-l":[{"rounded-l":L()}],"rounded-ss":[{"rounded-ss":L()}],"rounded-se":[{"rounded-se":L()}],"rounded-ee":[{"rounded-ee":L()}],"rounded-es":[{"rounded-es":L()}],"rounded-tl":[{"rounded-tl":L()}],"rounded-tr":[{"rounded-tr":L()}],"rounded-br":[{"rounded-br":L()}],"rounded-bl":[{"rounded-bl":L()}],"border-w":[{border:X()}],"border-w-x":[{"border-x":X()}],"border-w-y":[{"border-y":X()}],"border-w-s":[{"border-s":X()}],"border-w-e":[{"border-e":X()}],"border-w-t":[{"border-t":X()}],"border-w-r":[{"border-r":X()}],"border-w-b":[{"border-b":X()}],"border-w-l":[{"border-l":X()}],"divide-x":[{"divide-x":X()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":X()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...re(),"hidden","none"]}],"divide-style":[{divide:[...re(),"hidden","none"]}],"border-color":[{border:U()}],"border-color-x":[{"border-x":U()}],"border-color-y":[{"border-y":U()}],"border-color-s":[{"border-s":U()}],"border-color-e":[{"border-e":U()}],"border-color-t":[{"border-t":U()}],"border-color-r":[{"border-r":U()}],"border-color-b":[{"border-b":U()}],"border-color-l":[{"border-l":U()}],"divide-color":[{divide:U()}],"outline-style":[{outline:[...re(),"none","hidden"]}],"outline-offset":[{"outline-offset":[ut,Ue,$e]}],"outline-w":[{outline:["",ut,mi,Wn]}],"outline-color":[{outline:U()}],shadow:[{shadow:["","none",d,ls,os]}],"shadow-color":[{shadow:U()}],"inset-shadow":[{"inset-shadow":["none",p,ls,os]}],"inset-shadow-color":[{"inset-shadow":U()}],"ring-w":[{ring:X()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:U()}],"ring-offset-w":[{"ring-offset":[ut,Wn]}],"ring-offset-color":[{"ring-offset":U()}],"inset-ring-w":[{"inset-ring":X()}],"inset-ring-color":[{"inset-ring":U()}],"text-shadow":[{"text-shadow":["none",h,ls,os]}],"text-shadow-color":[{"text-shadow":U()}],opacity:[{opacity:[ut,Ue,$e]}],"mix-blend":[{"mix-blend":[...we(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":we()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[ut]}],"mask-image-linear-from-pos":[{"mask-linear-from":ie()}],"mask-image-linear-to-pos":[{"mask-linear-to":ie()}],"mask-image-linear-from-color":[{"mask-linear-from":U()}],"mask-image-linear-to-color":[{"mask-linear-to":U()}],"mask-image-t-from-pos":[{"mask-t-from":ie()}],"mask-image-t-to-pos":[{"mask-t-to":ie()}],"mask-image-t-from-color":[{"mask-t-from":U()}],"mask-image-t-to-color":[{"mask-t-to":U()}],"mask-image-r-from-pos":[{"mask-r-from":ie()}],"mask-image-r-to-pos":[{"mask-r-to":ie()}],"mask-image-r-from-color":[{"mask-r-from":U()}],"mask-image-r-to-color":[{"mask-r-to":U()}],"mask-image-b-from-pos":[{"mask-b-from":ie()}],"mask-image-b-to-pos":[{"mask-b-to":ie()}],"mask-image-b-from-color":[{"mask-b-from":U()}],"mask-image-b-to-color":[{"mask-b-to":U()}],"mask-image-l-from-pos":[{"mask-l-from":ie()}],"mask-image-l-to-pos":[{"mask-l-to":ie()}],"mask-image-l-from-color":[{"mask-l-from":U()}],"mask-image-l-to-color":[{"mask-l-to":U()}],"mask-image-x-from-pos":[{"mask-x-from":ie()}],"mask-image-x-to-pos":[{"mask-x-to":ie()}],"mask-image-x-from-color":[{"mask-x-from":U()}],"mask-image-x-to-color":[{"mask-x-to":U()}],"mask-image-y-from-pos":[{"mask-y-from":ie()}],"mask-image-y-to-pos":[{"mask-y-to":ie()}],"mask-image-y-from-color":[{"mask-y-from":U()}],"mask-image-y-to-color":[{"mask-y-to":U()}],"mask-image-radial":[{"mask-radial":[Ue,$e]}],"mask-image-radial-from-pos":[{"mask-radial-from":ie()}],"mask-image-radial-to-pos":[{"mask-radial-to":ie()}],"mask-image-radial-from-color":[{"mask-radial-from":U()}],"mask-image-radial-to-color":[{"mask-radial-to":U()}],"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":N()}],"mask-image-conic-pos":[{"mask-conic":[ut]}],"mask-image-conic-from-pos":[{"mask-conic-from":ie()}],"mask-image-conic-to-pos":[{"mask-conic-to":ie()}],"mask-image-conic-from-color":[{"mask-conic-from":U()}],"mask-image-conic-to-color":[{"mask-conic-to":U()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:H()}],"mask-repeat":[{mask:P()}],"mask-size":[{mask:V()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",Ue,$e]}],filter:[{filter:["","none",Ue,$e]}],blur:[{blur:be()}],brightness:[{brightness:[ut,Ue,$e]}],contrast:[{contrast:[ut,Ue,$e]}],"drop-shadow":[{"drop-shadow":["","none",m,ls,os]}],"drop-shadow-color":[{"drop-shadow":U()}],grayscale:[{grayscale:["",ut,Ue,$e]}],"hue-rotate":[{"hue-rotate":[ut,Ue,$e]}],invert:[{invert:["",ut,Ue,$e]}],saturate:[{saturate:[ut,Ue,$e]}],sepia:[{sepia:["",ut,Ue,$e]}],"backdrop-filter":[{"backdrop-filter":["","none",Ue,$e]}],"backdrop-blur":[{"backdrop-blur":be()}],"backdrop-brightness":[{"backdrop-brightness":[ut,Ue,$e]}],"backdrop-contrast":[{"backdrop-contrast":[ut,Ue,$e]}],"backdrop-grayscale":[{"backdrop-grayscale":["",ut,Ue,$e]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[ut,Ue,$e]}],"backdrop-invert":[{"backdrop-invert":["",ut,Ue,$e]}],"backdrop-opacity":[{"backdrop-opacity":[ut,Ue,$e]}],"backdrop-saturate":[{"backdrop-saturate":[ut,Ue,$e]}],"backdrop-sepia":[{"backdrop-sepia":["",ut,Ue,$e]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":j()}],"border-spacing-x":[{"border-spacing-x":j()}],"border-spacing-y":[{"border-spacing-y":j()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",Ue,$e]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[ut,"initial",Ue,$e]}],ease:[{ease:["linear","initial",x,Ue,$e]}],delay:[{delay:[ut,Ue,$e]}],animate:[{animate:["none",y,Ue,$e]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[g,Ue,$e]}],"perspective-origin":[{"perspective-origin":S()}],rotate:[{rotate:ke()}],"rotate-x":[{"rotate-x":ke()}],"rotate-y":[{"rotate-y":ke()}],"rotate-z":[{"rotate-z":ke()}],scale:[{scale:ee()}],"scale-x":[{"scale-x":ee()}],"scale-y":[{"scale-y":ee()}],"scale-z":[{"scale-z":ee()}],"scale-3d":["scale-3d"],skew:[{skew:se()}],"skew-x":[{"skew-x":se()}],"skew-y":[{"skew-y":se()}],transform:[{transform:[Ue,$e,"","none","gpu","cpu"]}],"transform-origin":[{origin:S()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:ve()}],"translate-x":[{"translate-x":ve()}],"translate-y":[{"translate-y":ve()}],"translate-z":[{"translate-z":ve()}],"translate-none":["translate-none"],accent:[{accent:U()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:U()}],"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",Ue,$e]}],"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":j()}],"scroll-mx":[{"scroll-mx":j()}],"scroll-my":[{"scroll-my":j()}],"scroll-ms":[{"scroll-ms":j()}],"scroll-me":[{"scroll-me":j()}],"scroll-mt":[{"scroll-mt":j()}],"scroll-mr":[{"scroll-mr":j()}],"scroll-mb":[{"scroll-mb":j()}],"scroll-ml":[{"scroll-ml":j()}],"scroll-p":[{"scroll-p":j()}],"scroll-px":[{"scroll-px":j()}],"scroll-py":[{"scroll-py":j()}],"scroll-ps":[{"scroll-ps":j()}],"scroll-pe":[{"scroll-pe":j()}],"scroll-pt":[{"scroll-pt":j()}],"scroll-pr":[{"scroll-pr":j()}],"scroll-pb":[{"scroll-pb":j()}],"scroll-pl":[{"scroll-pl":j()}],"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",Ue,$e]}],fill:[{fill:["none",...U()]}],"stroke-w":[{stroke:[ut,mi,Wn,ol]}],stroke:[{stroke:["none",...U()]}],"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"]}},g8=Z7(f8);function Le(...e){return g8(oE(e))}function b8(e){if(!e||typeof e!="string")return null;try{return JSON.parse(e)}catch{return null}}const x8=lE("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 $r({className:e,variant:t,...r}){return s.jsx("div",{className:Le(x8({variant:t}),e),...r})}const y8=lE("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium touch-manipulation transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",{variants:{variant:{default:"bg-primary text-primary-foreground shadow hover:bg-primary/90 active:bg-primary/80",destructive:"bg-destructive text-destructive-foreground shadow-sm hover:bg-destructive/90 active:bg-destructive/80",outline:"border border-input bg-background shadow-sm hover:bg-accent hover:text-accent-foreground active:bg-accent/80",secondary:"bg-secondary text-secondary-foreground shadow-sm hover:bg-secondary/80 active:bg-secondary/70",ghost:"hover:bg-accent hover:text-accent-foreground active:bg-accent/80",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-10 px-4 py-2",sm:"h-9 rounded-md px-3 text-sm",lg:"h-11 rounded-md px-8",icon:"h-10 w-10"}},defaultVariants:{variant:"default",size:"default"}}),Fe=b.forwardRef(({className:e,variant:t,size:r,...n},a)=>s.jsx("button",{className:Le(y8({variant:t,size:r,className:e})),ref:a,...n}));Fe.displayName="Button";function nh({checked:e,onToggle:t,ariaLabel:r="Toggle dark mode"}){const{isDarkMode:n,toggleDarkMode:a}=Ya(),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:Le("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:Le("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(Qh,{className:"h-3 w-3 text-primary"}):s.jsx(tf,{className:"h-3 w-3 text-white dark:text-background"})})]})}const At=b.forwardRef(({className:e,type:t,...r},n)=>s.jsx("input",{type:t,className:Le("flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-sm shadow-sm transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50",e),ref:n,...r}));At.displayName="Input";const sf=b.forwardRef(({className:e,children:t,...r},n)=>s.jsx("div",{className:Le(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})}));sf.displayName="ScrollArea";function v8(e){switch(e){case"top":return"bottom-full left-1/2 transform -translate-x-1/2 mb-2";case"bottom":return"top-full left-1/2 transform -translate-x-1/2 mt-2";case"left":return"right-full top-1/2 transform -translate-y-1/2 mr-2";case"right":return"left-full top-1/2 transform -translate-y-1/2 ml-2";default:return"bottom-full left-1/2 transform -translate-x-1/2 mb-2"}}function w8(e){switch(e){case"top":return"top-full left-1/2 transform -translate-x-1/2 border-t-gray-900 dark:border-t-gray-100";case"bottom":return"bottom-full left-1/2 transform -translate-x-1/2 border-b-gray-900 dark:border-b-gray-100";case"left":return"left-full top-1/2 transform -translate-y-1/2 border-l-gray-900 dark:border-l-gray-100";case"right":return"right-full top-1/2 transform -translate-y-1/2 border-r-gray-900 dark:border-r-gray-100";default:return"top-full left-1/2 transform -translate-x-1/2 border-t-gray-900 dark:border-t-gray-100"}}function _n({children:e,content:t,position:r="top",className:n="",delay:a=500}){const[i,o]=b.useState(!1),l=b.useRef(null),c=()=>{l.current!==null&&(window.clearTimeout(l.current),l.current=null)},u=()=>{c(),l.current=window.setTimeout(()=>{o(!0)},a)},d=()=>{c(),o(!1)};return b.useEffect(()=>()=>{c()},[]),t?s.jsxs("div",{className:"relative inline-block",onMouseEnter:u,onMouseLeave:d,children:[e,i&&s.jsxs("div",{className:Le("absolute z-50 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",v8(r),n),children:[t,s.jsx("div",{className:Le("absolute w-0 h-0 border-4 border-transparent",w8(r))})]})]}):s.jsx(s.Fragment,{children:e})}function of({children:e,className:t}){return s.jsx("div",{className:Le("inline-flex items-center gap-[2px] rounded-lg bg-muted/60 p-[3px]",t),children:e})}function lf({isActive:e,onClick:t,children:r,className:n}){return s.jsx("button",{onClick:t,className:Le("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 ib="https://discord.gg/buxwujPNRE";function sb({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 k8({updateAvailable:e,releaseInfo:t,latestVersion:r,onShowVersionModal:n,onShowSettings:a,t:i}){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:n,children:[s.jsxs("div",{className:"relative flex-shrink-0",children:[s.jsx(Pg,{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:i("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:n,children:[s.jsxs("div",{className:"relative flex-shrink-0",children:[s.jsx(Pg,{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:i("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:ib,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(sb,{className:"h-3.5 w-3.5"}),s.jsx("span",{className:"text-sm",children:i("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:a,children:[s.jsx(Et,{className:"h-3.5 w-3.5"}),s.jsx("span",{className:"text-sm",children:i("actions.settings")})]})}),s.jsx("div",{className:"px-3 pt-3 md:hidden",children:s.jsxs("a",{href:ib,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(sb,{className:"w-4.5 h-4.5 text-muted-foreground"})}),s.jsx("span",{className:"text-base font-medium text-foreground",children:i("actions.joinCommunity")})]})}),s.jsx("div",{className:"px-3 pb-20 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:a,children:[s.jsx("div",{className:"flex h-8 w-8 items-center justify-center rounded-xl bg-background/80",children:s.jsx(Et,{className:"w-4.5 h-4.5 text-muted-foreground"})}),s.jsx("span",{className:"text-base font-medium text-foreground",children:i("actions.settings")})]})})]})}function S8({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(Er,{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(Wt,{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(dI,{className:"h-3.5 w-3.5"})})]})]}),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:Le("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(Sr,{className:"h-3 w-3"}),m("search.modeProjects")]}),s.jsxs("button",{onClick:()=>c("conversations"),"aria-pressed":l==="conversations",className:Le("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(Dn,{className:"h-3 w-3"}),m("search.modeConversations")]})]}),s.jsxs("div",{className:"relative",children:[s.jsx(Ln,{className:"pointer-events-none absolute left-3 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-muted-foreground/50"}),s.jsx(At,{type:"text",placeholder:m(l==="conversations"?"search.conversationsPlaceholder":"projects.searchPlaceholder"),value:a,onChange:g=>i(g.target.value),className:"nav-search-input h-9 rounded-xl border-0 pl-9 pr-8 text-sm transition-all duration-200 placeholder:text-muted-foreground/40 focus-visible:ring-0 focus-visible:ring-offset-0"}),a&&s.jsx("button",{onClick:o,"aria-label":m("tooltips.clearSearch"),className:"absolute right-2.5 top-1/2 -translate-y-1/2 rounded-md p-0.5 hover:bg-accent",children:s.jsx(vt,{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(Er,{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(sa,{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:Le("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(Sr,{className:"h-3 w-3"}),m("search.modeProjects")]}),s.jsxs("button",{onClick:()=>c("conversations"),"aria-pressed":l==="conversations",className:Le("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(Dn,{className:"h-3 w-3"}),m("search.modeConversations")]})]}),s.jsxs("div",{className:"relative",children:[s.jsx(Ln,{className:"pointer-events-none absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground/50"}),s.jsx(At,{type:"text",placeholder:m(l==="conversations"?"search.conversationsPlaceholder":"projects.searchPlaceholder"),value:a,onChange:g=>i(g.target.value),className:"nav-search-input h-10 rounded-xl border-0 pl-10 pr-9 text-sm transition-all duration-200 placeholder:text-muted-foreground/40 focus-visible:ring-0 focus-visible:ring-offset-0"}),a&&s.jsx("button",{onClick:o,"aria-label":m("tooltips.clearSearch"),className:"absolute right-2.5 top-1/2 -translate-y-1/2 rounded-md p-1 hover:bg-accent",children:s.jsx(vt,{className:"h-3.5 w-3.5 text-muted-foreground"})})]})]})]}),s.jsx("div",{className:"nav-divider md:hidden"})]})}const ob={xs:"w-3 h-3",sm:"w-4 h-4",md:"w-5 h-5",lg:"w-6 h-6"},E8={xs:"p-0.5",sm:"p-1",md:"p-1.5",lg:"p-2"},N8=e=>e==="fully-configured"?{icon:_o,colorClassName:"text-green-500 dark:text-green-400",backgroundClassName:"bg-green-50 dark:bg-green-950",label:"TaskMaster Ready",title:"TaskMaster fully configured with MCP server"}:e==="taskmaster-only"?{icon:Et,colorClassName:"text-blue-500 dark:text-blue-400",backgroundClassName:"bg-blue-50 dark:bg-blue-950",label:"TaskMaster Init",title:"TaskMaster initialized, MCP server needs setup"}:e==="mcp-only"?{icon:Io,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:vt,colorClassName:"text-gray-400 dark:text-gray-500",backgroundClassName:"bg-gray-50 dark:bg-gray-900",label:"No TaskMaster",title:"TaskMaster not configured"};function C8({status:e="not-configured",size:t="sm",className:r="",showLabel:n=!1}){const a=N8(e),i=a.icon;return n?s.jsxs("div",{className:Le("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:ob[t]}),s.jsx("span",{className:"font-medium",children:a.label})]}):s.jsx("div",{className:Le("inline-flex items-center justify-center rounded-full transition-colors",a.backgroundClassName,E8[t],r),title:a.title,children:s.jsx(i,{className:Le(ob[t],a.colorClassName)})})}const lb=(e,t,r)=>{const n=new Date(e),a=t;if(isNaN(n.getTime()))return r?r("status.unknown"):"Unknown";const i=a.getTime()-n.getTime(),o=Math.floor(i/1e3),l=Math.floor(i/(1e3*60)),c=Math.floor(i/(1e3*60*60)),u=Math.floor(i/(1e3*60*60*24));return o<60?r?r("time.justNow"):"Just now":l===1?r?r("time.oneMinuteAgo"):"1 min ago":l<60?r?r("time.minutesAgo",{count:l}):`${l} mins ago`:c===1?r?r("time.oneHourAgo"):"1 hour ago":c<24?r?r("time.hoursAgo",{count:c}):`${c} hours ago`:u===1?r?r("time.oneDayAgo"):"1 day ago":u<7?r?r("time.daysAgo",{count:u}):`${u} days ago`:n.toLocaleDateString()};function T8({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=A7(t,n,m),g=r?.id===t.id,v=()=>{d(e),p(t,e.name)},x=()=>{u(e.name,t.id,i,t.__provider)},y=()=>{h(e.name,t.id,f.sessionName,t.__provider)};return s.jsxs("div",{className:"group relative",children:[f.isActive&&s.jsx("div",{className:"absolute left-0 top-1/2 -translate-x-1 -translate-y-1/2 transform",children:s.jsx("div",{className:"h-2 w-2 animate-pulse rounded-full bg-green-500"})}),s.jsx("div",{className:"md:hidden",children:s.jsx("div",{className:Le("p-2 mx-3 my-0.5 rounded-md bg-card border active:scale-[0.98] transition-all duration-150 relative",g?"bg-primary/5 border-primary/20":"",!g&&f.isActive?"border-green-500/30 bg-green-50/5 dark:bg-green-900/5":"border-border/30"),onClick:v,children:s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("div",{className:Le("w-5 h-5 rounded-md flex items-center justify-center flex-shrink-0",g?"bg-primary/10":"bg-muted/50"),children:s.jsx(_r,{provider:t.__provider,className:"h-3 w-3"})}),s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsx("div",{className:"truncate text-xs font-medium text-foreground",children:f.sessionName}),s.jsxs("div",{className:"mt-0.5 flex items-center gap-1",children:[s.jsx(Mi,{className:"h-2.5 w-2.5 text-muted-foreground"}),s.jsx("span",{className:"text-xs text-muted-foreground",children:lb(f.sessionTime,n,m)}),f.messageCount>0&&s.jsx($r,{variant:"secondary",className:"ml-auto px-1 py-0 text-xs",children:f.messageCount}),s.jsx("span",{className:"ml-1 opacity-70",children:s.jsx(_r,{provider:t.__provider,className:"h-3 w-3"})})]})]}),!f.isCursorSession&&s.jsx("button",{className:"ml-1 flex h-5 w-5 items-center justify-center rounded-md bg-red-50 opacity-70 transition-transform active:scale-95 dark:bg-red-900/20",onClick:w=>{w.stopPropagation(),y()},children:s.jsx(Qt,{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:Le("w-full justify-start p-2 h-auto font-normal text-left hover:bg-accent/50 transition-colors duration-200",g&&"bg-accent text-accent-foreground"),onClick:()=>p(t,e.name),children:s.jsxs("div",{className:"flex w-full min-w-0 items-start gap-2",children:[s.jsx(_r,{provider:t.__provider,className:"mt-0.5 h-3 w-3 flex-shrink-0"}),s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsx("div",{className:"truncate text-xs font-medium text-foreground",children:f.sessionName}),s.jsxs("div",{className:"mt-0.5 flex items-center gap-1",children:[s.jsx(Mi,{className:"h-2.5 w-2.5 text-muted-foreground"}),s.jsx("span",{className:"text-xs text-muted-foreground",children:lb(f.sessionTime,n,m)}),f.messageCount>0&&s.jsx($r,{variant:"secondary",className:"ml-auto px-1 py-0 text-xs transition-opacity group-hover:opacity-0",children:f.messageCount}),s.jsx("span",{className:"ml-1 opacity-70 transition-opacity group-hover:opacity-0",children:s.jsx(_r,{provider:t.__provider,className:"h-3 w-3"})})]})]})]})}),s.jsx("div",{className:"absolute right-2 top-1/2 flex -translate-y-1/2 transform items-center gap-1 opacity-0 transition-all duration-200 group-hover:opacity-100",children:a===t.id?s.jsxs(s.Fragment,{children:[s.jsx("input",{type:"text",value:i,onChange:w=>o(w.target.value),onKeyDown:w=>{w.stopPropagation(),w.key==="Enter"?x():w.key==="Escape"&&c()},onClick:w=>w.stopPropagation(),className:"w-32 rounded border border-border bg-background px-2 py-1 text-xs focus:outline-none focus:ring-1 focus:ring-primary",autoFocus:!0}),s.jsx("button",{className:"flex h-6 w-6 items-center justify-center rounded bg-green-50 hover:bg-green-100 dark:bg-green-900/20 dark:hover:bg-green-900/40",onClick:w=>{w.stopPropagation(),x()},title:m("tooltips.save"),children:s.jsx(lr,{className:"h-3 w-3 text-green-600 dark:text-green-400"})}),s.jsx("button",{className:"flex h-6 w-6 items-center justify-center rounded bg-gray-50 hover:bg-gray-100 dark:bg-gray-900/20 dark:hover:bg-gray-900/40",onClick:w=>{w.stopPropagation(),c()},title:m("tooltips.cancel"),children:s.jsx(vt,{className:"h-3 w-3 text-gray-600 dark:text-gray-400"})})]}):s.jsxs(s.Fragment,{children:[s.jsx("button",{className:"flex h-6 w-6 items-center justify-center rounded bg-gray-50 hover:bg-gray-100 dark:bg-gray-900/20 dark:hover:bg-gray-900/40",onClick:w=>{w.stopPropagation(),l(t.id,f.sessionName)},title:m("tooltips.editSessionName"),children:s.jsx(bI,{className:"h-3 w-3 text-gray-600 dark:text-gray-400"})}),!f.isCursorSession&&s.jsx("button",{className:"flex h-6 w-6 items-center justify-center rounded bg-red-50 hover:bg-red-100 dark:bg-red-900/20 dark:hover:bg-red-900/40",onClick:w=>{w.stopPropagation(),y()},title:m("tooltips.deleteSession"),children:s.jsx(Qt,{className:"h-3 w-3 text-red-600 dark:text-red-400"})})]})})]})]})}function A8(){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 I8({project:e,isExpanded:t,sessions:r,selectedSession:n,initialSessionsLoaded:a,isLoadingSessions:i,currentTime:o,editingSession:l,editingSessionName:c,onEditingSessionNameChange:u,onStartEditingSession:d,onCancelEditingSession:p,onSaveEditingSession:h,onProjectSelect:m,onSessionSelect:f,onDeleteSession:g,onLoadMoreSessions:v,onNewSession:x,t:y}){if(!t)return null;const w=r.length>0,N=e.sessionMeta?.hasMore===!0;return s.jsxs("div",{className:"ml-3 space-y-1 border-l border-border pl-3",children:[a?!w&&!i?s.jsx("div",{className:"px-3 py-2 text-left",children:s.jsx("p",{className:"text-xs text-muted-foreground",children:y("sessions.noSessions")})}):r.map(S=>s.jsx(T8,{project:e,session:S,selectedSession:n,currentTime:o,editingSession:l,editingSessionName:c,onEditingSessionNameChange:u,onStartEditingSession:d,onCancelEditingSession:p,onSaveEditingSession:h,onProjectSelect:m,onSessionSelect:f,onDeleteSession:g,t:y},S.id)):s.jsx(A8,{}),w&&N&&s.jsx(Fe,{variant:"ghost",size:"sm",className:"mt-2 w-full justify-center gap-2 text-muted-foreground",onClick:()=>v(e),disabled:i,children:i?s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"h-3 w-3 animate-spin rounded-full border border-muted-foreground border-t-transparent"}),y("sessions.loading")]}):s.jsxs(s.Fragment,{children:[s.jsx(mr,{className:"h-3 w-3"}),y("sessions.showMore")]})}),s.jsx("div",{className:"px-3 pb-2 md:hidden",children:s.jsxs("button",{className:"flex h-8 w-full items-center justify-center gap-2 rounded-md bg-primary text-xs font-medium text-primary-foreground transition-all duration-150 hover:bg-primary/90 active:scale-[0.98]",onClick:()=>{m(e),x(e)},children:[s.jsx(Wt,{className:"h-3 w-3"}),y("sessions.newSession")]})}),s.jsxs(Fe,{variant:"default",size:"sm",className:"mt-1 hidden h-8 w-full justify-start gap-2 bg-primary text-xs font-medium text-primary-foreground transition-colors hover:bg-primary/90 md:flex",onClick:()=>x(e),children:[s.jsx(Wt,{className:"h-3 w-3"}),y("sessions.newSession")]})]})}const _8=(e,t)=>{const r=e.length;return t&&r>=5?`${r}+`:`${r}`};function R8({project:e,selectedProject:t,selectedSession:r,isExpanded:n,isDeleting:a,isStarred:i,editingProject:o,editingName:l,sessions:c,initialSessionsLoaded:u,isLoadingSessions:d,currentTime:p,editingSession:h,editingSessionName:m,tasksEnabled:f,mcpServerStatus:g,onEditingNameChange:v,onToggleProject:x,onProjectSelect:y,onToggleStarProject:w,onStartEditingProject:N,onCancelEditingProject:S,onSaveProjectName:k,onDeleteProject:T,onSessionSelect:j,onDeleteSession:I,onLoadMoreSessions:A,onNewSession:D,onEditingSessionNameChange:_,onStartEditingSession:M,onCancelEditingSession:E,onSaveEditingSession:G,t:J}){const W=t?.name===e.name,U=o===e.name,H=e.sessionMeta?.hasMore===!0,P=_8(c,H),V=`${P} session${c.length===1?"":"s"}`,B=R7(e,g),L=()=>x(e.name),X=()=>w(e.name),re=()=>{k(e.name)},we=()=>{t?.name!==e.name&&y(e),L()};return s.jsxs("div",{className:Le("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:Le("p-3 mx-3 my-1 rounded-lg bg-card border border-border/50 active:scale-[0.98] transition-all duration-150",W&&"bg-primary/5 border-primary/20",i&&!W&&"bg-yellow-50/50 dark:bg-yellow-900/5 border-yellow-200/30 dark:border-yellow-800/30"),onClick:L,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:Le("w-8 h-8 rounded-lg flex items-center justify-center transition-colors",n?"bg-primary/10":"bg-muted"),children:n?s.jsx(On,{className:"h-4 w-4 text-primary"}):s.jsx(Sr,{className:"h-4 w-4 text-muted-foreground"})}),s.jsx("div",{className:"min-w-0 flex-1",children:U?s.jsx("input",{type:"text",value:l,onChange:ie=>v(ie.target.value),className:"w-full rounded-lg border-2 border-primary/40 bg-background px-3 py-2 text-sm text-foreground shadow-sm transition-all duration-200 focus:border-primary focus:shadow-md focus:outline-none",placeholder:J("projects.projectNamePlaceholder"),autoFocus:!0,autoComplete:"off",onClick:ie=>ie.stopPropagation(),onKeyDown:ie=>{ie.key==="Enter"&&re(),ie.key==="Escape"&&S()},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(C8,{status:B,size:"xs",className:"ml-2 hidden flex-shrink-0 md:inline-flex"})]}),s.jsx("p",{className:"text-xs text-muted-foreground",children:V})]})})]}),s.jsx("div",{className:"flex items-center gap-1",children:U?s.jsxs(s.Fragment,{children:[s.jsx("button",{className:"flex h-8 w-8 items-center justify-center rounded-lg bg-green-500 shadow-sm transition-all duration-150 active:scale-90 active:shadow-none dark:bg-green-600",onClick:ie=>{ie.stopPropagation(),re()},children:s.jsx(lr,{className:"h-4 w-4 text-white"})}),s.jsx("button",{className:"flex h-8 w-8 items-center justify-center rounded-lg bg-gray-500 shadow-sm transition-all duration-150 active:scale-90 active:shadow-none dark:bg-gray-600",onClick:ie=>{ie.stopPropagation(),S()},children:s.jsx(vt,{className:"h-4 w-4 text-white"})})]}):s.jsxs(s.Fragment,{children:[s.jsx("button",{className:Le("w-8 h-8 rounded-lg flex items-center justify-center active:scale-90 transition-all duration-150 border",i?"bg-yellow-500/10 dark:bg-yellow-900/30 border-yellow-200 dark:border-yellow-800":"bg-gray-500/10 dark:bg-gray-900/30 border-gray-200 dark:border-gray-800"),onClick:ie=>{ie.stopPropagation(),X()},title:J(i?"tooltips.removeFromFavorites":"tooltips.addToFavorites"),children:s.jsx($g,{className:Le("w-4 h-4 transition-colors",i?"text-yellow-600 dark:text-yellow-400 fill-current":"text-gray-600 dark:text-gray-400")})}),s.jsx("button",{className:"flex h-8 w-8 items-center justify-center rounded-lg border border-red-200 bg-red-500/10 active:scale-90 dark:border-red-800 dark:bg-red-900/30",onClick:ie=>{ie.stopPropagation(),T(e)},children:s.jsx(Qt,{className:"h-4 w-4 text-red-600 dark:text-red-400"})}),s.jsx("button",{className:"flex h-8 w-8 items-center justify-center rounded-lg border border-primary/20 bg-primary/10 active:scale-90 dark:border-primary/30 dark:bg-primary/20",onClick:ie=>{ie.stopPropagation(),N(e)},children:s.jsx(Pi,{className:"h-4 w-4 text-primary"})}),s.jsx("div",{className:"flex h-6 w-6 items-center justify-center rounded-md bg-muted/30",children:n?s.jsx(mr,{className:"h-3 w-3 text-muted-foreground"}):s.jsx(Or,{className:"h-3 w-3 text-muted-foreground"})})]})})]})})}),s.jsxs(Fe,{variant:"ghost",className:Le("hidden md:flex w-full justify-between p-2 h-auto font-normal hover:bg-accent/50",W&&"bg-accent text-accent-foreground",i&&!W&&"bg-yellow-50/50 dark:bg-yellow-900/10 hover:bg-yellow-100/50 dark:hover:bg-yellow-900/20"),onClick:we,children:[s.jsxs("div",{className:"flex min-w-0 flex-1 items-center gap-3",children:[n?s.jsx(On,{className:"h-4 w-4 flex-shrink-0 text-primary"}):s.jsx(Sr,{className:"h-4 w-4 flex-shrink-0 text-muted-foreground"}),s.jsx("div",{className:"min-w-0 flex-1 text-left",children:U?s.jsxs("div",{className:"space-y-1",children:[s.jsx("input",{type:"text",value:l,onChange:ie=>v(ie.target.value),className:"w-full rounded border border-border bg-background px-2 py-1 text-sm text-foreground focus:ring-2 focus:ring-primary/20",placeholder:J("projects.projectNamePlaceholder"),autoFocus:!0,onKeyDown:ie=>{ie.key==="Enter"&&re(),ie.key==="Escape"&&S()}}),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:[P,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:U?s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"flex h-6 w-6 cursor-pointer items-center justify-center rounded text-green-600 transition-colors hover:bg-green-50 hover:text-green-700 dark:hover:bg-green-900/20",onClick:ie=>{ie.stopPropagation(),re()},children:s.jsx(lr,{className:"h-3 w-3"})}),s.jsx("div",{className:"flex h-6 w-6 cursor-pointer items-center justify-center rounded text-gray-500 transition-colors hover:bg-gray-50 hover:text-gray-700 dark:hover:bg-gray-800",onClick:ie=>{ie.stopPropagation(),S()},children:s.jsx(vt,{className:"h-3 w-3"})})]}):s.jsxs(s.Fragment,{children:[s.jsx("div",{className:Le("w-6 h-6 opacity-0 group-hover:opacity-100 transition-all duration-200 flex items-center justify-center rounded cursor-pointer touch:opacity-100",i?"hover:bg-yellow-50 dark:hover:bg-yellow-900/20 opacity-100":"hover:bg-accent"),onClick:ie=>{ie.stopPropagation(),X()},title:J(i?"tooltips.removeFromFavorites":"tooltips.addToFavorites"),children:s.jsx($g,{className:Le("w-3 h-3 transition-colors",i?"text-yellow-600 dark:text-yellow-400 fill-current":"text-muted-foreground")})}),s.jsx("div",{className:"touch:opacity-100 flex h-6 w-6 cursor-pointer items-center justify-center rounded opacity-0 transition-all duration-200 hover:bg-accent group-hover:opacity-100",onClick:ie=>{ie.stopPropagation(),N(e)},title:J("tooltips.renameProject"),children:s.jsx(Pi,{className:"h-3 w-3"})}),s.jsx("div",{className:"touch:opacity-100 flex h-6 w-6 cursor-pointer items-center justify-center rounded opacity-0 transition-all duration-200 hover:bg-red-50 group-hover:opacity-100 dark:hover:bg-red-900/20",onClick:ie=>{ie.stopPropagation(),T(e)},title:J("tooltips.deleteProject"),children:s.jsx(Qt,{className:"h-3 w-3 text-red-600 dark:text-red-400"})}),n?s.jsx(mr,{className:"h-4 w-4 text-muted-foreground transition-colors group-hover:text-foreground"}):s.jsx(Or,{className:"h-4 w-4 text-muted-foreground transition-colors group-hover:text-foreground"})]})})]})]}),s.jsx(I8,{project:e,isExpanded:n,sessions:c,selectedSession:r,initialSessionsLoaded:u,isLoadingSessions:d,currentTime:p,editingSession:h,editingSessionName:m,onEditingSessionNameChange:_,onStartEditingSession:M,onCancelEditingSession:E,onSaveEditingSession:G,onProjectSelect:y,onSessionSelect:j,onDeleteSession:I,onLoadMoreSessions:A,onNewSession:D,t:J})]})}function j8({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(Sr,{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(Ln,{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 O8({projects:e,filteredProjects:t,selectedProject:r,selectedSession:n,isLoading:a,loadingProgress:i,expandedProjects:o,editingProject:l,editingName:c,loadingSessions:u,initialSessionsLoaded:d,currentTime:p,editingSession:h,editingSessionName:m,deletingProjects:f,tasksEnabled:g,mcpServerStatus:v,getProjectSessions:x,isProjectStarred:y,onEditingNameChange:w,onToggleProject:N,onProjectSelect:S,onToggleStarProject:k,onStartEditingProject:T,onCancelEditingProject:j,onSaveProjectName:I,onDeleteProject:A,onSessionSelect:D,onDeleteSession:_,onLoadMoreSessions:M,onNewSession:E,onEditingSessionNameChange:G,onStartEditingSession:J,onCancelEditingSession:W,onSaveEditingSession:U,t:H}){const P=s.jsx(j8,{isLoading:a,loadingProgress:i,projectsCount:e.length,filteredProjectsCount:t.length,t:H});b.useEffect(()=>{let B="CloudCLI UI";const L=r?.displayName?.trim();L&&(B=`${L} - ${B}`),document.title=B},[r]);const V=!a&&e.length>0&&t.length>0;return s.jsx("div",{className:"pb-safe-area-inset-bottom md:space-y-1",children:V?t.map(B=>s.jsx(R8,{project:B,selectedProject:r,selectedSession:n,isExpanded:o.has(B.name),isDeleting:f.has(B.name),isStarred:y(B.name),editingProject:l,editingName:c,sessions:x(B),initialSessionsLoaded:d.has(B.name),isLoadingSessions:!!u[B.name],currentTime:p,editingSession:h,editingSessionName:m,tasksEnabled:g,mcpServerStatus:v,onEditingNameChange:w,onToggleProject:N,onProjectSelect:S,onToggleStarProject:k,onStartEditingProject:T,onCancelEditingProject:j,onSaveProjectName:I,onDeleteProject:A,onSessionSelect:D,onDeleteSession:_,onLoadMoreSessions:M,onNewSession:E,onEditingSessionNameChange:G,onStartEditingSession:J,onCancelEditingSession:W,onSaveEditingSession:U,t:H},B.name)):P})}function D8({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 L8({isPWA:e,isMobile:t,isLoading:r,projects:n,searchFilter:a,onSearchFilterChange:i,onClearSearchFilter:o,searchMode:l,onSearchModeChange:c,conversationResults:u,isSearching:d,searchProgress:p,onConversationResultClick:h,onRefresh:m,isRefreshing:f,onCreateProject:g,onCollapseSidebar:v,updateAvailable:x,releaseInfo:y,latestVersion:w,onShowVersionModal:N,onShowSettings:S,projectListProps:k,t:T}){const j=l==="conversations"&&a.trim().length>=2,I=u&&u.results.length>0;return s.jsxs("div",{className:"flex h-full flex-col bg-background/80 backdrop-blur-sm md:w-72 md:select-none",style:{},children:[s.jsx(S8,{isPWA:e,isMobile:t,isLoading:r,projectsCount:n.length,searchFilter:a,onSearchFilterChange:i,onClearSearchFilter:o,searchMode:l,onSearchModeChange:c,onRefresh:m,isRefreshing:f,onCreateProject:g,onCollapseSidebar:v,t:T}),s.jsx(sf,{className:"flex-1 overflow-y-auto overscroll-contain md:px-1.5 md:py-2",children:j?d&&!I?s.jsxs("div",{className:"px-4 py-12 text-center md:py-8",children:[s.jsx("div",{className:"mx-auto mb-4 flex h-12 w-12 items-center justify-center rounded-lg bg-muted md:mb-3",children:s.jsx("div",{className:"h-6 w-6 animate-spin rounded-full border-2 border-muted-foreground border-t-transparent"})}),s.jsx("p",{className:"text-sm text-muted-foreground",children:T("search.searching")}),p&&s.jsxs("p",{className:"mt-1 text-xs text-muted-foreground/60",children:[T("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(Ln,{className:"h-6 w-6 text-muted-foreground"})}),s.jsx("h3",{className:"mb-2 text-base font-medium text-foreground md:mb-1",children:T("search.noResults")}),s.jsx("p",{className:"text-sm text-muted-foreground",children:T("search.tryDifferentQuery")})]}):I?s.jsxs("div",{className:"space-y-3 px-2",children:[s.jsxs("div",{className:"flex items-center justify-between px-1",children:[s.jsx("p",{className:"text-xs text-muted-foreground",children:T("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(A=>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(Sr,{className:"h-3 w-3 flex-shrink-0 text-muted-foreground"}),s.jsx("span",{className:"truncate text-xs font-medium text-foreground",children:A.projectDisplayName})]}),A.sessions.map(D=>s.jsxs("button",{className:"w-full rounded-md px-2 py-2 text-left transition-colors hover:bg-accent/50",onClick:()=>h(A.projectName,D.sessionId,D.provider||D.matches[0]?.provider||"claude",D.matches[0]?.timestamp,D.matches[0]?.snippet),children:[s.jsxs("div",{className:"mb-1 flex items-center gap-1.5",children:[s.jsx(Dn,{className:"h-3 w-3 flex-shrink-0 text-primary"}),s.jsx("span",{className:"truncate text-xs font-medium text-foreground",children:D.sessionSummary}),D.provider&&D.provider!=="claude"&&s.jsx("span",{className:"flex-shrink-0 rounded bg-muted px-1 py-0.5 text-[9px] uppercase text-muted-foreground",children:D.provider})]}),s.jsx("div",{className:"space-y-1 pl-4",children:D.matches.map((_,M)=>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:_.role==="user"?"U":"A"}),s.jsx(D8,{snippet:_.snippet,highlights:_.highlights})]},M))})]},`${A.projectName}-${D.sessionId}`))]},A.projectName))]}):null:s.jsx(O8,{...k})}),s.jsx(k8,{updateAvailable:x,releaseInfo:y,latestVersion:w,onShowVersionModal:N,onShowSettings:S,t:T})]})}const M8={fontSize:"14"},cs={authenticated:!1,email:null,loading:!0,error:null},cb={name:"",type:"stdio",scope:"user",projectPath:"",config:{command:"",args:[],env:{},url:"",headers:{},timeout:3e4},importMode:"form",jsonInput:""},ub={name:"",type:"stdio",config:{command:"",args:[],env:{}}},P8={allowedCommands:[],disallowedCommands:[],skipPermissions:!1},F8={claude:"/api/cli/claude/status",cursor:"/api/cli/cursor/status",codex:"/api/cli/codex/status",gemini:"/api/cli/gemini/status"},yE=e=>e==="sse"||e==="http"?e:"stdio",B8=e=>e==="local"?"local":"user",z8=e=>e instanceof Error?e.message:"Unknown error",$8=e=>({name:e.name||"",type:yE(e.type),scope:B8(e.scope),projectPath:e.projectPath||"",config:{command:e.config?.command||"",args:e.config?.args||[],env:e.config?.env||{},url:e.config?.url||"",headers:e.config?.headers||{},timeout:e.config?.timeout||3e4},importMode:"form",jsonInput:"",raw:e.raw});function U8({isOpen:e,editingServer:t,projects:r,onClose:n,onSubmit:a}){const{t:i}=Me("settings"),[o,l]=b.useState(cb),[c,u]=b.useState(""),[d,p]=b.useState(!1),h=!!t;b.useEffect(()=>{if(e){if(u(""),t){l($8(t));return}l(cb)}},[t,e]);const m=b.useMemo(()=>o.name.trim()?o.importMode==="json"?!!o.jsonInput.trim()&&!c:o.scope==="local"&&!o.projectPath.trim()?!1:o.type==="stdio"?!!o.config.command.trim():!!o.config.url.trim():!1,[o,c]);if(!e)return null;const f=(x,y)=>{l(w=>({...w,config:{...w.config,[x]:y}}))},g=x=>{if(!x.trim()){u("");return}try{const y=JSON.parse(x);y.type?y.type==="stdio"&&!y.command?u(i("mcpForm.validation.stdioRequiresCommand")):(y.type==="http"||y.type==="sse")&&!y.url?u(i("mcpForm.validation.httpRequiresUrl",{type:y.type})):u(""):u(i("mcpForm.validation.missingType"))}catch{u(i("mcpForm.validation.invalidJson"))}},v=async x=>{x.preventDefault(),p(!0);try{await a(o,t)}catch(y){alert(`Error: ${z8(y)}`)}finally{p(!1)}};return s.jsx("div",{className:"fixed inset-0 z-[110] flex items-center justify-center bg-black/50 p-4",children:s.jsxs("div",{className:"max-h-[90vh] w-full max-w-2xl overflow-y-auto rounded-lg border border-border bg-background",children:[s.jsxs("div",{className:"flex items-center justify-between border-b border-border p-4",children:[s.jsx("h3",{className:"text-lg font-medium text-foreground",children:i(h?"mcpForm.title.edit":"mcpForm.title.add")}),s.jsx(Fe,{variant:"ghost",size:"sm",onClick:n,children:s.jsx(vt,{className:"h-4 w-4"})})]}),s.jsxs("form",{onSubmit:v,className:"space-y-4 p-4",children:[!h&&s.jsxs("div",{className:"mb-4 flex gap-2",children:[s.jsx("button",{type:"button",onClick:()=>l(x=>({...x,importMode:"form"})),className:`rounded-lg px-4 py-2 font-medium transition-colors ${o.importMode==="form"?"bg-blue-600 text-white":"bg-gray-100 text-gray-700 hover:bg-gray-200 dark:bg-gray-800 dark:text-gray-300 dark:hover:bg-gray-700"}`,children:i("mcpForm.importMode.form")}),s.jsx("button",{type:"button",onClick:()=>l(x=>({...x,importMode:"json"})),className:`rounded-lg px-4 py-2 font-medium transition-colors ${o.importMode==="json"?"bg-blue-600 text-white":"bg-gray-100 text-gray-700 hover:bg-gray-200 dark:bg-gray-800 dark:text-gray-300 dark:hover:bg-gray-700"}`,children:i("mcpForm.importMode.json")})]}),o.importMode==="form"&&h&&s.jsxs("div",{className:"rounded-lg border border-gray-200 bg-gray-50 p-3 dark:border-gray-700 dark:bg-gray-900/50",children:[s.jsx("label",{className:"mb-2 block text-sm font-medium text-foreground",children:i("mcpForm.scope.label")}),s.jsxs("div",{className:"flex items-center gap-2",children:[o.scope==="user"?s.jsx(Ua,{className:"h-4 w-4"}):s.jsx(On,{className:"h-4 w-4"}),s.jsx("span",{className:"text-sm",children:o.scope==="user"?i("mcpForm.scope.userGlobal"):i("mcpForm.scope.projectLocal")}),o.scope==="local"&&o.projectPath&&s.jsxs("span",{className:"text-xs text-muted-foreground",children:["- ",o.projectPath]})]}),s.jsx("p",{className:"mt-2 text-xs text-muted-foreground",children:i("mcpForm.scope.cannotChange")})]}),o.importMode==="form"&&!h&&s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{children:[s.jsxs("label",{className:"mb-2 block text-sm font-medium text-foreground",children:[i("mcpForm.scope.label")," *"]}),s.jsxs("div",{className:"flex gap-2",children:[s.jsx("button",{type:"button",onClick:()=>l(x=>({...x,scope:"user",projectPath:""})),className:`flex-1 rounded-lg px-4 py-2 font-medium transition-colors ${o.scope==="user"?"bg-blue-600 text-white":"bg-gray-100 text-gray-700 hover:bg-gray-200 dark:bg-gray-800 dark:text-gray-300 dark:hover:bg-gray-700"}`,children:s.jsxs("div",{className:"flex items-center justify-center gap-2",children:[s.jsx(Ua,{className:"h-4 w-4"}),s.jsx("span",{children:i("mcpForm.scope.userGlobal")})]})}),s.jsx("button",{type:"button",onClick:()=>l(x=>({...x,scope:"local"})),className:`flex-1 rounded-lg px-4 py-2 font-medium transition-colors ${o.scope==="local"?"bg-blue-600 text-white":"bg-gray-100 text-gray-700 hover:bg-gray-200 dark:bg-gray-800 dark:text-gray-300 dark:hover:bg-gray-700"}`,children:s.jsxs("div",{className:"flex items-center justify-center gap-2",children:[s.jsx(On,{className:"h-4 w-4"}),s.jsx("span",{children:i("mcpForm.scope.projectLocal")})]})})]}),s.jsx("p",{className:"mt-2 text-xs text-muted-foreground",children:o.scope==="user"?i("mcpForm.scope.userDescription"):i("mcpForm.scope.projectDescription")})]}),o.scope==="local"&&s.jsxs("div",{children:[s.jsxs("label",{className:"mb-2 block text-sm font-medium text-foreground",children:[i("mcpForm.fields.selectProject")," *"]}),s.jsxs("select",{value:o.projectPath,onChange:x=>{l(y=>({...y,projectPath:x.target.value}))},className:"w-full rounded-lg border border-gray-300 bg-gray-50 px-3 py-2 text-gray-900 focus:border-blue-500 focus:ring-blue-500 dark:border-gray-600 dark:bg-gray-800 dark:text-gray-100",required:!0,children:[s.jsxs("option",{value:"",children:[i("mcpForm.fields.selectProject"),"..."]}),r.map(x=>s.jsx("option",{value:x.path||x.fullPath,children:x.displayName||x.name},x.name))]}),o.projectPath&&s.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:i("mcpForm.projectPath",{path:o.projectPath})})]})]}),s.jsxs("div",{className:"grid grid-cols-1 gap-4 md:grid-cols-2",children:[s.jsxs("div",{className:o.importMode==="json"?"md:col-span-2":"",children:[s.jsxs("label",{className:"mb-2 block text-sm font-medium text-foreground",children:[i("mcpForm.fields.serverName")," *"]}),s.jsx(At,{value:o.name,onChange:x=>l(y=>({...y,name:x.target.value})),placeholder:i("mcpForm.placeholders.serverName"),required:!0})]}),o.importMode==="form"&&s.jsxs("div",{children:[s.jsxs("label",{className:"mb-2 block text-sm font-medium text-foreground",children:[i("mcpForm.fields.transportType")," *"]}),s.jsxs("select",{value:o.type,onChange:x=>{l(y=>({...y,type:yE(x.target.value)}))},className:"w-full rounded-lg border border-gray-300 bg-gray-50 px-3 py-2 text-gray-900 focus:border-blue-500 focus:ring-blue-500 dark:border-gray-600 dark:bg-gray-800 dark:text-gray-100",children:[s.jsx("option",{value:"stdio",children:"stdio"}),s.jsx("option",{value:"sse",children:"SSE"}),s.jsx("option",{value:"http",children:"HTTP"})]})]})]}),h&&!!o.raw&&o.importMode==="form"&&s.jsxs("div",{className:"rounded-lg border border-gray-200 bg-gray-50 p-4 dark:border-gray-700 dark:bg-gray-900/50",children:[s.jsx("h4",{className:"mb-2 text-sm font-medium text-foreground",children:i("mcpForm.configDetails",{configFile:t?.scope==="global"?"~/.claude.json":"project config"})}),s.jsx("pre",{className:"overflow-x-auto rounded bg-gray-100 p-3 text-xs dark:bg-gray-800",children:JSON.stringify(o.raw,null,2)})]}),o.importMode==="json"&&s.jsx("div",{className:"space-y-4",children:s.jsxs("div",{children:[s.jsxs("label",{className:"mb-2 block text-sm font-medium text-foreground",children:[i("mcpForm.fields.jsonConfig")," *"]}),s.jsx("textarea",{value:o.jsonInput,onChange:x=>{const y=x.target.value;l(w=>({...w,jsonInput:y})),g(y)},className:`w-full border px-3 py-2 ${c?"border-red-500":"border-gray-300 dark:border-gray-600"} rounded-lg bg-gray-50 font-mono text-sm text-gray-900 focus:border-blue-500 focus:ring-blue-500 dark:bg-gray-800 dark:text-gray-100`,rows:8,placeholder:`{
649
+ `;function A_(){if(typeof document>"u"||document.getElementById(Gg))return;const e=document.createElement("style");e.id=Gg,e.type="text/css",e.innerText=T_,document.head.appendChild(e)}function I_({terminalContainerRef:e,terminalRef:t,fitAddonRef:r,wsRef:n,selectedProject:a,minimal:i,isRestarting:o,initialCommandRef:l,isPlainShellRef:c,authUrlRef:u,copyAuthUrlToClipboard:d,closeSocket:p}){const[h,m]=b.useState(!1),f=b.useRef(null),g=a?.fullPath||a?.path||"",v=!!a;b.useEffect(()=>{A_()},[]);const x=b.useCallback(()=>{t.current&&(t.current.clear(),t.current.write("\x1B[2J\x1B[H"))},[t]),y=b.useCallback(()=>{t.current&&(t.current.dispose(),t.current=null),r.current=null,m(!1)},[r,t]);return b.useEffect(()=>{if(!e.current||!v||o||t.current)return;const w=new E_.Terminal(m_);t.current=w;const N=new v_.FitAddon;r.current=N,w.loadAddon(N),i||w.loadAddon(new k_.WebLinksAddon);try{w.loadAddon(new S_.WebglAddon)}catch{console.warn("[Shell] WebGL renderer unavailable, using Canvas fallback")}w.open(e.current);const S=async()=>{const I=w.getSelection();return I?en(I):!1},k=I=>{if(!w.hasSelection())return;const A=w.getSelection();if(A){if(I.preventDefault(),I.clipboardData){I.clipboardData.setData("text/plain",A);return}en(A)}};e.current.addEventListener("copy",k),w.attachCustomKeyEventHandler(I=>{const A=V4(l.current)?H4:u.current;return I.type==="keydown"&&i&&c.current&&A&&!I.ctrlKey&&!I.metaKey&&!I.altKey&&I.key?.toLowerCase()==="c"?(I.preventDefault(),I.stopPropagation(),d(A),!1):I.type==="keydown"&&(I.ctrlKey||I.metaKey)&&I.key?.toLowerCase()==="c"&&w.hasSelection()?(I.preventDefault(),I.stopPropagation(),S(),!1):I.type==="keydown"&&(I.ctrlKey||I.metaKey)&&I.key?.toLowerCase()==="v"?(I.preventDefault(),I.stopPropagation(),typeof navigator<"u"&&navigator.clipboard?.readText&&navigator.clipboard.readText().then(D=>{ta(n.current,{type:"input",data:D})}).catch(()=>{}),!1):!0}),window.setTimeout(()=>{const I=r.current,A=t.current;!I||!A||(I.fit(),ta(n.current,{type:"resize",cols:A.cols,rows:A.rows}))},W4),m(!0);const T=w.onData(I=>{ta(n.current,{type:"input",data:I})}),j=new ResizeObserver(()=>{f.current!==null&&window.clearTimeout(f.current),f.current=window.setTimeout(()=>{const I=r.current,A=t.current;!I||!A||(I.fit(),ta(n.current,{type:"resize",cols:A.cols,rows:A.rows}))},o_)});return j.observe(e.current),()=>{e.current?.removeEventListener("copy",k),j.disconnect(),f.current!==null&&(window.clearTimeout(f.current),f.current=null),T.dispose(),p(),y()}},[u,p,d,y,r,l,c,o,i,v,g,e,t,n]),{isInitialized:h,clearTerminalScreen:x,disposeTerminal:y}}function __({selectedProject:e,selectedSession:t,initialCommand:r,isPlainShell:n,minimal:a,autoConnect:i,isRestarting:o,onProcessComplete:l,onOutputRef:c}){const u=b.useRef(null),d=b.useRef(null),p=b.useRef(null),h=b.useRef(null),[m,f]=b.useState(""),[g,v]=b.useState(0),x=b.useRef(e),y=b.useRef(t),w=b.useRef(r),N=b.useRef(n),S=b.useRef(l),k=b.useRef(""),T=b.useRef(t?.id??null);b.useEffect(()=>{x.current=e,y.current=t,w.current=r,N.current=n,S.current=l},[e,t,r,n,l]);const j=b.useCallback(H=>{k.current=H,f(H),v(P=>P+1)},[]),I=b.useCallback(()=>{const H=h.current;H&&((H.readyState===WebSocket.OPEN||H.readyState===WebSocket.CONNECTING)&&H.close(),h.current=null)},[]),A=b.useCallback((H=k.current)=>{if(!H)return!1;const P=window.open(H,"_blank");if(P){try{P.opener=null}catch{}return!0}return!1},[]),D=b.useCallback(async(H=k.current)=>H?en(H):!1,[]),{isInitialized:_,clearTerminalScreen:M,disposeTerminal:E}=I_({terminalContainerRef:u,terminalRef:d,fitAddonRef:p,wsRef:h,selectedProject:e,minimal:a,isRestarting:o,initialCommandRef:w,isPlainShellRef:N,authUrlRef:k,copyAuthUrlToClipboard:D,closeSocket:I}),{isConnected:G,isConnecting:J,connectToShell:W,disconnectFromShell:U}=y_({wsRef:h,terminalRef:d,fitAddonRef:p,selectedProjectRef:x,selectedSessionRef:y,initialCommandRef:w,isPlainShellRef:N,onProcessCompleteRef:S,isInitialized:_,autoConnect:i,closeSocket:I,clearTerminalScreen:M,setAuthUrl:j,onOutputRef:c});return b.useEffect(()=>{o&&(U(),E())},[U,E,o]),b.useEffect(()=>{e||(U(),E())},[U,E,e]),b.useEffect(()=>{const H=t?.id??null;T.current!==H&&_&&U(),T.current=H},[U,_,t?.id]),{terminalContainerRef:u,terminalRef:d,wsRef:h,isConnected:G,isInitialized:_,isConnecting:J,authUrl:m,authUrlVersion:g,connectToShell:W,disconnectFromShell:U,openAuthUrlInBrowser:A,copyAuthUrlToClipboard:D}}function R_({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 j_({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 O_({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 D_({terminalContainerRef:e,authUrl:t,authUrlVersion:r,initialCommand:n,isConnected:a,openAuthUrlInBrowser:i,copyAuthUrlToClipboard:o}){const[l,c]=b.useState("idle"),[u,d]=b.useState(!1),p=b.useMemo(()=>N_(n,t),[t,n]);b.useEffect(()=>{c("idle"),d(!1)},[r,p,a]);const h=!!p,m=h&&!u,f=h&&u;return s.jsxs("div",{className:"relative h-full w-full bg-gray-900",children:[s.jsx("div",{ref:e,className:"h-full w-full focus:outline-none",style:{outline:"none"}}),m&&s.jsx("div",{className:"absolute inset-x-0 bottom-14 z-20 border-t border-gray-700/80 bg-gray-900/95 p-3 backdrop-blur-sm md:hidden",children:s.jsxs("div",{className:"flex flex-col gap-2",children:[s.jsxs("div",{className:"flex items-center justify-between gap-2",children:[s.jsx("p",{className:"text-xs text-gray-300",children:"Open or copy the login URL:"}),s.jsx("button",{type:"button",onClick:()=>d(!0),className:"rounded bg-gray-700 px-2 py-1 text-[10px] font-medium uppercase tracking-wide text-gray-100 hover:bg-gray-600",children:"Hide"})]}),s.jsx("input",{type:"text",value:p,readOnly:!0,onClick:g=>g.currentTarget.select(),className:"w-full rounded border border-gray-600 bg-gray-800 px-2 py-1 text-xs text-gray-100 focus:outline-none focus:ring-1 focus:ring-blue-500","aria-label":"Authentication URL"}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("button",{type:"button",onClick:()=>{i(p)},className:"flex-1 rounded bg-blue-600 px-3 py-2 text-xs font-medium text-white hover:bg-blue-700",children:"Open URL"}),s.jsx("button",{type:"button",onClick:async()=>{const g=await o(p);c(g?"copied":"failed")},className:"flex-1 rounded bg-gray-700 px-3 py-2 text-xs font-medium text-white hover:bg-gray-600",children:l==="copied"?"Copied":"Copy URL"})]})]})}),f&&s.jsx("div",{className:"absolute bottom-14 right-3 z-20 md:hidden",children:s.jsx("button",{type:"button",onClick:()=>d(!1),className:"rounded bg-gray-800/95 px-3 py-2 text-xs font-medium text-gray-100 shadow-lg backdrop-blur-sm hover:bg-gray-700",children:"Show login URL"})})]})}const L_=[{id:"escape",labelKey:"escape",sequence:"\x1B",hint:"Esc"},{id:"tab",labelKey:"tab",sequence:" ",hint:"Tab"},{id:"shift-tab",labelKey:"shiftTab",sequence:"\x1B[Z",hint:"⇧Tab"},{id:"arrow-up",labelKey:"arrowUp",sequence:"\x1B[A",hint:"↑"},{id:"arrow-down",labelKey:"arrowDown",sequence:"\x1B[B",hint:"↓"}],ss=e=>e.preventDefault();function M_({wsRef:e,terminalRef:t,isConnected:r}){const{t:n}=Me("settings"),[a,i]=b.useState(!1),o=b.useRef(null);b.useEffect(()=>()=>{o.current&&clearTimeout(o.current)},[]);const l=b.useCallback(()=>{i(p=>!p)},[]),c=b.useCallback(p=>{p(),document.activeElement instanceof HTMLElement&&document.activeElement.blur(),o.current&&clearTimeout(o.current),o.current=setTimeout(()=>i(!1),50)},[]),u=b.useCallback(p=>{ta(e.current,{type:"input",data:p})},[e]),d=b.useCallback(()=>{t.current?.scrollToBottom()},[t]);return s.jsxs(s.Fragment,{children:[s.jsx("button",{type:"button",onPointerDown:ss,onClick:l,className:`fixed ${a?"right-64":"right-0"} z-50 cursor-pointer rounded-l-md border border-gray-200 bg-white p-2 shadow-lg transition-all duration-150 ease-out hover:bg-gray-100 dark:border-gray-700 dark:bg-gray-800 dark:hover:bg-gray-700`,style:{top:"50%",transform:"translateY(-50%)"},"aria-label":n(a?"terminalShortcuts.handle.closePanel":"terminalShortcuts.handle.openPanel"),children:a?s.jsx(Or,{className:"h-5 w-5 text-gray-600 dark:text-gray-400"}):s.jsx(Ao,{className:"h-5 w-5 text-gray-600 dark:text-gray-400"})}),s.jsx("div",{className:`fixed right-0 top-0 z-40 h-full w-64 transform border-l border-border bg-background shadow-xl transition-transform duration-150 ease-out ${a?"translate-x-0":"translate-x-full"}`,children:s.jsxs("div",{className:"flex h-full flex-col",children:[s.jsx("div",{className:"border-b border-gray-200 bg-gray-50 p-4 dark:border-gray-700 dark:bg-gray-900",children:s.jsxs("h3",{className:"flex items-center gap-2 text-lg font-semibold text-gray-900 dark:text-white",children:[s.jsx(q6,{className:"h-5 w-5 text-gray-600 dark:text-gray-400"}),n("terminalShortcuts.title")]})}),a&&s.jsxs("div",{className:"flex-1 space-y-6 overflow-y-auto overflow-x-hidden bg-background p-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx("h4",{className:"mb-2 text-xs font-semibold uppercase tracking-wider text-gray-500 dark:text-gray-400",children:n("terminalShortcuts.sectionKeys")}),L_.map(p=>s.jsxs("button",{type:"button",onPointerDown:ss,onClick:()=>c(()=>u(p.sequence)),disabled:!r,className:"flex w-full items-center justify-between rounded-lg border border-transparent bg-gray-50 p-3 transition-colors hover:border-gray-300 hover:bg-gray-100 disabled:cursor-not-allowed disabled:opacity-40 dark:bg-gray-800 dark:hover:border-gray-600 dark:hover:bg-gray-700",children:[s.jsx("span",{className:"text-sm text-gray-900 dark:text-white",children:n(`terminalShortcuts.${p.labelKey}`)}),s.jsx("kbd",{className:"rounded border border-gray-300 bg-gray-200 px-2 py-0.5 font-mono text-xs text-gray-600 dark:border-gray-600 dark:bg-gray-700 dark:text-gray-300",children:p.hint})]},p.id))]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx("h4",{className:"mb-2 text-xs font-semibold uppercase tracking-wider text-gray-500 dark:text-gray-400",children:n("terminalShortcuts.sectionNavigation")}),s.jsxs("button",{type:"button",onPointerDown:ss,onClick:()=>c(d),disabled:!r,className:"flex w-full items-center justify-between rounded-lg border border-transparent bg-gray-50 p-3 transition-colors hover:border-gray-300 hover:bg-gray-100 disabled:cursor-not-allowed disabled:opacity-40 dark:bg-gray-800 dark:hover:border-gray-600 dark:hover:bg-gray-700",children:[s.jsx("span",{className:"text-sm text-gray-900 dark:text-white",children:n("terminalShortcuts.scrollDown")}),s.jsx(dA,{className:"h-4 w-4 text-gray-600 dark:text-gray-400"})]})]})]})]})}),a&&s.jsx("div",{className:"fixed inset-0 z-30 bg-background/80 backdrop-blur-sm transition-opacity duration-150 ease-out",onPointerDown:ss,onClick:l})]})}function K4({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}=Me("chat"),[u,d]=b.useState(!1),[p,h]=b.useState(null),m=b.useRef(null),f=b.useRef(null),{terminalContainerRef:g,terminalRef:v,wsRef:x,isConnected:y,isInitialized:w,isConnecting:N,authUrl:S,authUrlVersion:k,connectToShell:T,disconnectFromShell:j,openAuthUrlInBrowser:I,copyAuthUrlToClipboard:A}=__({selectedProject:e,selectedSession:t,initialCommand:r,isPlainShell:n,minimal:i,autoConnect:o,isRestarting:u,onProcessComplete:a,onOutputRef:f}),D=b.useCallback(()=>{const B=v.current;if(!B)return;const L=B.buffer.active,X=L.baseY+L.cursorY,re=Math.min(L.baseY+L.length-1,X+10),we=Math.max(0,X-c_),ie=[];for(let ve=we;ve<=re;ve++){const _e=L.getLine(ve);_e&&ie.push(_e.translateToString().trimEnd())}let be=-1;for(let ve=ie.length-1;ve>=0;ve--)if(/esc to cancel/i.test(ie[ve])||/enter to select/i.test(ie[ve])){be=ve;break}if(be===-1){h(null);return}const ke=new Map,ee=Math.max(0,be-u_);for(let ve=be-1;ve>=ee;ve--){const _e=ie[ve].match(/^\s*[❯›>]?\s*(\d+)\.\s+(.+)/);if(_e){const O=_e[1],ue=_e[2].trim();parseInt(O,10)<=d_&&ue.length>0&&!ke.has(O)&&ke.set(O,ue)}}const se=[];for(let ve=1;ve<=ke.size&&ke.has(String(ve));ve++)se.push({number:String(ve),label:ke.get(String(ve))});h(se.length>=p_?se:null)},[v]),_=b.useCallback(()=>{m.current&&clearTimeout(m.current),m.current=setTimeout(D,l_)},[D]);b.useEffect(()=>{f.current=_},[_]),b.useEffect(()=>()=>{m.current&&clearTimeout(m.current)},[]),b.useEffect(()=>{y||(m.current&&(clearTimeout(m.current),m.current=null),h(null))},[y]),b.useEffect(()=>{if(!l||!w||!y)return;const B=()=>{v.current?.focus()},L=window.requestAnimationFrame(B),X=window.setTimeout(B,0);return()=>{window.cancelAnimationFrame(L),window.clearTimeout(X)}},[l,y,w,v]);const M=b.useCallback(B=>{ta(x.current,{type:"input",data:B})},[x]),E=b.useMemo(()=>C_(t),[t]),G=b.useMemo(()=>E?E.slice(0,30):null,[E]),J=b.useMemo(()=>E?E.slice(0,50):null,[E]),W=b.useCallback(()=>{d(!0),window.setTimeout(()=>{d(!1)},s_)},[]);if(!e)return s.jsx(j_,{title:c("shell.selectProject.title"),description:c("shell.selectProject.description")});if(i)return s.jsx(D_,{terminalContainerRef:g,authUrl:S,authUrlVersion:k,initialCommand:r,isConnected:y,openAuthUrlInBrowser:I,copyAuthUrlToClipboard:A});const U=n?c("shell.runCommand",{command:r||c("shell.defaultCommand"),projectName:e.displayName}):t?c("shell.resumeSession",{displayName:J}):c("shell.startSession"),H=n?c("shell.runCommand",{command:r||c("shell.defaultCommand"),projectName:e.displayName}):c("shell.startCli",{projectName:e.displayName}),P=w?N?"connecting":y?null:"connect":"loading",V=P==="connecting"?H:U;return s.jsxs("div",{className:"flex h-full w-full flex-col bg-gray-900",children:[s.jsx(O_,{isConnected:y,isInitialized:w,isRestarting:u,hasSession:!!t,sessionDisplayNameShort:G,onDisconnect:j,onRestart:W,statusNewSessionText:c("shell.status.newSession"),statusInitializingText:c("shell.status.initializing"),statusRestartingText:c("shell.status.restarting"),disconnectLabel:c("shell.actions.disconnect"),disconnectTitle:c("shell.actions.disconnectTitle"),restartLabel:c("shell.actions.restart"),restartTitle:c("shell.actions.restartTitle"),disableRestart:u||y}),s.jsxs("div",{className:"relative flex-1 overflow-hidden p-2",children:[s.jsx("div",{ref:g,className:"h-full w-full focus:outline-none",style:{outline:"none"}}),P&&s.jsx(R_,{mode:P,description:V,loadingLabel:c("shell.loading"),connectLabel:c("shell.actions.connect"),connectTitle:c("shell.actions.connectTitle"),connectingLabel:c("shell.connecting"),onConnect:T}),p&&y&&s.jsx("div",{className:"absolute inset-x-0 bottom-0 z-10 border-t border-gray-700/80 bg-gray-800/95 px-3 py-2 backdrop-blur-sm",onMouseDown:B=>B.preventDefault(),children:s.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[p.map(B=>s.jsxs("button",{type:"button",onClick:()=>{M(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:()=>{M("\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(M_,{wsRef:x,terminalRef:v,isConnected:y})]})}function P_({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 F_({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 Y4({project:e=null,session:t=null,command:r=null,isPlainShell:n=null,isActive:a=!0,autoConnect:i=!0,onComplete:o=null,onClose:l=null,title:c=null,className:u="",showHeader:d=!0,compact:p=!1,minimal:h=!1}){const[m,f]=b.useState(!1),g=n!==null?n:r!==null,v=b.useCallback(x=>{f(!0),o?.(x)},[o]);return e?s.jsxs("div",{className:`flex h-full w-full flex-col ${u}`,children:[!h&&d&&c&&s.jsx(F_,{title:c,isCompleted:m,onClose:l}),s.jsx("div",{className:"min-h-0 w-full flex-1",children:s.jsx(K4,{selectedProject:e,selectedSession:t,initialCommand:r,isPlainShell:g,isActive:a,onProcessComplete:v,minimal:h,autoConnect:h?!0:i})})]}):s.jsx(P_,{className:u})}const B_=({provider:e,customCommand:t,isAuthenticated:r,isOnboarding:n})=>t||(e==="claude"?r?"claude setup-token --dangerously-skip-permissions":n?"claude /exit --dangerously-skip-permissions":"claude /login --dangerously-skip-permissions":e==="cursor"?"cursor-agent login":e==="codex"?"codex login":"gemini status"),z_=e=>e==="claude"?"Claude CLI Login":e==="cursor"?"Cursor CLI Login":e==="codex"?"Codex CLI Login":"Gemini CLI Configuration",$_=e=>{const t=e?.name||"default",r=e?.fullPath??e?.path??"";return{name:t,displayName:e?.displayName||t,fullPath:r,path:e?.path??r}};function Z4({isOpen:e,onClose:t,provider:r="claude",project:n=null,onComplete:a,customCommand:i,isAuthenticated:o=!1,isOnboarding:l=!1}){if(!e)return null;const c=B_({provider:r,customCommand:i,isAuthenticated:o,isOnboarding:l}),u=z_(r),d=$_(n),p=h=>{a?.(h)};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:u}),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(vt,{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(z6,{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($a,{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(Y4,{project:d,command:c,onComplete:p,minimal:!0})})]})})}const U_=({className:e="w-5 h-5"})=>s.jsx("img",{src:"/icons/claude-ai-icon.svg",alt:"Claude",className:e}),q_=({className:e="w-5 h-5"})=>{const{isDarkMode:t}=Ya();return s.jsx("img",{src:t?"/icons/codex-white.svg":"/icons/codex.svg",alt:"Codex",className:e})},G_=({className:e="w-5 h-5"})=>{const{isDarkMode:t}=Ya();return s.jsx("img",{src:t?"/icons/cursor-white.svg":"/icons/cursor.svg",alt:"Cursor",className:e})},H_=({className:e="w-5 h-5"})=>s.jsx("img",{src:"/icons/gemini-ai-icon.svg",alt:"Gemini",className:e});function _r({provider:e="claude",className:t="w-5 h-5"}){return e==="cursor"?s.jsx(G_,{className:t}):e==="codex"?s.jsx(q_,{className:t}):e==="gemini"?s.jsx(H_,{className:t}):s.jsx(U_,{className:t})}function W_({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(_r,{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(lr,{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 V_=[{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 K_({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:V_.map(r=>s.jsx(W_,{provider:r.provider,title:r.title,status:e[r.provider],connectedClassName:r.connectedClassName,iconContainerClassName:r.iconContainerClassName,loginButtonClassName:r.loginButtonClassName,onLogin:()=>t(r.provider)},r.provider))}),s.jsx("div",{className:"pt-2 text-center text-sm text-muted-foreground",children:s.jsx("p",{children:"You can configure these later in Settings."})})]})}function Y_({gitName:e,gitEmail:t,isSubmitting:r,onGitNameChange:n,onGitEmailChange:a}){return s.jsxs("div",{className:"space-y-6",children:[s.jsxs("div",{className:"mb-8 text-center",children:[s.jsx("div",{className:"mx-auto mb-4 flex h-16 w-16 items-center justify-center rounded-full bg-blue-100 dark:bg-blue-900/30",children:s.jsx(Nr,{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(QI,{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(J6,{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 Hg=[{title:"Git Configuration",icon:Nr,required:!0},{title:"Connect Agents",icon:z4,required:!1}];function Z_({currentStep:e}){return s.jsx("div",{className:"mb-8",children:s.jsx("div",{className:"flex items-center justify-between",children:Hg.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(lr,{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<Hg.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 X_=["claude","cursor","codex","gemini"],Wg=/^[^\s@]+@[^\s@]+\.[^\s@]+$/,J_={name:"default",displayName:"default",fullPath:"",path:""},Q_=()=>({claude:{authenticated:!1,email:null,loading:!0,error:null},cursor:{authenticated:!1,email:null,loading:!0,error:null},codex:{authenticated:!1,email:null,loading:!0,error:null},gemini:{authenticated:!1,email:null,loading:!0,error:null}}),Vg=async(e,t)=>{try{return(await e.json()).error||t}catch{return t}};function e7({onComplete:e}){const[t,r]=b.useState(0),[n,a]=b.useState(""),[i,o]=b.useState(""),[l,c]=b.useState(!1),[u,d]=b.useState(""),[p,h]=b.useState(null),[m,f]=b.useState(Q_),g=b.useRef(void 0),v=b.useCallback(async I=>{try{const A=await Re(`/api/cli/${I}/status`);if(!A.ok){f(_=>({..._,[I]:{authenticated:!1,email:null,loading:!1,error:"Failed to check authentication status"}}));return}const D=await A.json();f(_=>({..._,[I]:{authenticated:!!D.authenticated,email:D.email??null,loading:!1,error:D.error??null}}))}catch(A){console.error(`Error checking ${I} auth status:`,A),f(D=>({...D,[I]:{authenticated:!1,email:null,loading:!1,error:A instanceof Error?A.message:"Unknown error"}}))}},[]),x=b.useCallback(async()=>{await Promise.all(X_.map(I=>v(I)))},[v]),y=b.useCallback(async()=>{try{const I=await Re("/api/user/git-config");if(!I.ok)return;const A=await I.json();A.gitName&&a(A.gitName),A.gitEmail&&o(A.gitEmail)}catch(I){console.error("Error loading git config:",I)}},[]);b.useEffect(()=>{y(),x()},[y,x]),b.useEffect(()=>{const I=g.current;g.current=p,(I===void 0||I!==null&&p===null)&&x()},[p,x]);const w=I=>{h(I)},N=I=>{I===0&&p&&v(p)},S=async()=>{if(d(""),t!==0){r(I=>I+1);return}if(!n.trim()||!i.trim()){d("Both git name and email are required.");return}if(!Wg.test(i)){d("Please enter a valid email address.");return}c(!0);try{const I=await Re("/api/user/git-config",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({gitName:n,gitEmail:i})});if(!I.ok){const A=await Vg(I,"Failed to save git configuration");throw new Error(A)}r(A=>A+1)}catch(I){d(I instanceof Error?I.message:"Failed to save git configuration")}finally{c(!1)}},k=()=>{d(""),r(I=>I-1)},T=async()=>{c(!0),d("");try{const I=await Re("/api/user/complete-onboarding",{method:"POST"});if(!I.ok){const A=await Vg(I,"Failed to complete onboarding");throw new Error(A)}await e?.()}catch(I){d(I instanceof Error?I.message:"Failed to complete onboarding")}finally{c(!1)}},j=t===0?!!(n.trim()&&i.trim()&&Wg.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(Z_,{currentStep:t}),s.jsxs("div",{className:"rounded-lg border border-border bg-card p-8 shadow-lg",children:[t===0?s.jsx(Y_,{gitName:n,gitEmail:i,isSubmitting:l,onGitNameChange:a,onGitEmailChange:o}):s.jsx(K_,{providerStatuses:m,onOpenProviderLogin:w}),u&&s.jsx("div",{className:"mt-6 rounded-lg border border-red-300 bg-red-100 p-4 dark:border-red-800 dark:bg-red-900/20",children:s.jsx("p",{className:"text-sm text-red-700 dark:text-red-400",children:u})}),s.jsxs("div",{className:"mt-8 flex items-center justify-between border-t border-border pt-6",children:[s.jsxs("button",{onClick:k,disabled:t===0||l,className:"flex items-center gap-2 px-4 py-2 text-sm font-medium text-muted-foreground transition-colors duration-200 hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50",children:[s.jsx(Ao,{className:"h-4 w-4"}),"Previous"]}),s.jsx("div",{className:"flex items-center gap-3",children:t<1?s.jsx("button",{onClick:S,disabled:!j||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(Dr,{className:"h-4 w-4 animate-spin"}),"Saving..."]}):s.jsxs(s.Fragment,{children:["Next",s.jsx(Or,{className:"h-4 w-4"})]})}):s.jsx("button",{onClick:T,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(Dr,{className:"h-4 w-4 animate-spin"}),"Completing..."]}):s.jsxs(s.Fragment,{children:[s.jsx(lr,{className:"h-4 w-4"}),"Complete Setup"]})})})]})]})]})}),p&&s.jsx(Z4,{isOpen:!!p,onClose:()=>h(null),provider:p,project:J_,onComplete:N,isOnboarding:!0})]})}const t7=["0s","0.1s","0.2s"];function r7(){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(Dn,{className:"h-8 w-8 text-primary-foreground"})})}),s.jsx("h1",{className:"mb-2 text-2xl font-bold text-foreground",children:"Claude Code UI"}),s.jsx("div",{className:"flex items-center justify-center space-x-2",children:t7.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 X4({errorMessage:e}){return e?s.jsx("div",{className:"rounded-md border border-red-300 bg-red-100 p-3 dark:border-red-800 dark:bg-red-900/20",children:s.jsx("p",{className:"text-sm text-red-700 dark:text-red-400",children:e})}):null}function _i({id:e,label:t,value:r,onChange:n,placeholder:a,isDisabled:i,type:o="text"}){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,value:r,onChange:l=>n(l.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 J4({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(Dn,{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})})]})})})}const n7={username:"",password:""};function a7(){const{t:e}=Me("auth"),{login:t}=Wi(),[r,n]=b.useState(n7),[a,i]=b.useState(""),[o,l]=b.useState(!1),c=b.useCallback((d,p)=>{n(h=>({...h,[d]:p}))},[]),u=b.useCallback(async d=>{if(d.preventDefault(),i(""),!r.username.trim()||!r.password){i(e("login.errors.requiredFields"));return}l(!0);const p=await t(r.username.trim(),r.password);p.success||i(p.error),l(!1)},[r.password,r.username,t,e]);return s.jsx(J4,{title:e("login.title"),description:e("login.description"),footerText:"Enter your credentials to access Claude Code UI",children:s.jsxs("form",{onSubmit:u,className:"space-y-4",children:[s.jsx(_i,{id:"username",label:e("login.username"),value:r.username,onChange:d=>c("username",d),placeholder:e("login.placeholders.username"),isDisabled:o}),s.jsx(_i,{id:"password",label:e("login.password"),value:r.password,onChange:d=>c("password",d),placeholder:e("login.placeholders.password"),isDisabled:o,type:"password"}),s.jsx(X4,{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 i7={username:"",password:"",confirmPassword:""};function s7(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 o7(){const{register:e}=Wi(),[t,r]=b.useState(i7),[n,a]=b.useState(""),[i,o]=b.useState(!1),l=b.useCallback((u,d)=>{r(p=>({...p,[u]:d}))},[]),c=b.useCallback(async u=>{u.preventDefault(),a("");const d=s7(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(J4,{title:"Welcome to Claude Code UI",description:"Set up your account to get started",footerText:"This is a single-user system. Only one account can be created.",logo:s.jsx("img",{src:"/logo.svg",alt:"CloudCLI",className:"h-16 w-16"}),children:s.jsxs("form",{onSubmit:c,className:"space-y-4",children:[s.jsx(_i,{id:"username",label:"Username",value:t.username,onChange:u=>l("username",u),placeholder:"Enter your username",isDisabled:i}),s.jsx(_i,{id:"password",label:"Password",value:t.password,onChange:u=>l("password",u),placeholder:"Enter your password",isDisabled:i,type:"password"}),s.jsx(_i,{id:"confirmPassword",label:"Confirm Password",value:t.confirmPassword,onChange:u=>l("confirmPassword",u),placeholder:"Confirm your password",isDisabled:i,type:"password"}),s.jsx(X4,{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 l7({children:e}){const{user:t,isLoading:r,needsSetup:n,hasCompletedOnboarding:a,refreshOnboardingStatus:i}=Wi();return r?s.jsx(r7,{}):n?s.jsx(o7,{}):t?a?s.jsx(s.Fragment,{children:e}):s.jsx(e7,{onComplete:i}):s.jsx(a7,{})}const Q4=b.createContext(null),eE=()=>{const e=b.useContext(Q4);if(!e)throw new Error("useWebSocket must be used within a WebSocketProvider");return e},c7=e=>{const t=window.location.protocol==="https:"?"wss:":"ws:";return e?`${t}//${window.location.host}/ws?token=${encodeURIComponent(e)}`:null},u7=()=>{const e=b.useRef(null),t=b.useRef(!1),r=b.useRef(!1),[n,a]=b.useState(null),[i,o]=b.useState(!1),l=b.useRef(null),{token:c}=Wi();b.useEffect(()=>(u(),()=>{t.current=!0,l.current&&clearTimeout(l.current),e.current&&e.current.close()}),[c]);const u=b.useCallback(()=>{if(!t.current)try{const h=c7(c);if(!h)return console.warn("No authentication token found for WebSocket connection");const m=new WebSocket(h);m.onopen=()=>{o(!0),e.current=m,r.current&&a({type:"websocket-reconnected",timestamp:Date.now()}),r.current=!0},m.onmessage=f=>{try{const g=JSON.parse(f.data);a(g)}catch(g){console.error("Error parsing WebSocket message:",g)}},m.onclose=()=>{o(!1),e.current=null,l.current=setTimeout(()=>{t.current||u()},3e3)},m.onerror=f=>{console.error("WebSocket error:",f)}}catch(h){console.error("Error creating WebSocket connection:",h)}},[c]),d=b.useCallback(h=>{const m=e.current;m&&m.readyState===WebSocket.OPEN?m.send(JSON.stringify(h)):console.warn("WebSocket not connected")},[]);return b.useMemo(()=>({ws:e.current,sendMessage:d,latestMessage:n,isConnected:i}),[d,n,i])},d7=({children:e})=>{const t=u7();return s.jsx(Q4.Provider,{value:t,children:e})},tE=b.createContext(null);function p7(e,t){return{message:t instanceof Error?t.message:`Failed to ${e}`,context:e,timestamp:new Date().toISOString()}}function Kg(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 m7(e){return e.find(t=>t.status==="pending"||t.status==="in-progress")??null}function h7(e){return e?.type?e.type.startsWith("taskmaster-"):!1}function Za(){const e=b.useContext(tE);if(!e)throw new Error("useTaskMaster must be used within a TaskMasterProvider");return e}function f7({children:e}){const{latestMessage:t}=eE(),{user:r,token:n,isLoading:a}=Wi(),[i,o]=b.useState([]),[l,c]=b.useState(null),[u,d]=b.useState(null),[p,h]=b.useState(null),[m,f]=b.useState([]),[g,v]=b.useState(null),[x,y]=b.useState(!1),[w,N]=b.useState(!1),[S,k]=b.useState(!1),[T,j]=b.useState(null),I=b.useRef(null);b.useEffect(()=>{I.current=l?.name??null},[l?.name]);const A=b.useCallback(()=>{j(null)},[]),D=b.useCallback((W,U)=>{console.error(`TaskMaster ${W} error:`,U),j(p7(W,U))},[]),_=b.useCallback(W=>{const U=W?Kg(W):null;c(U),d(U?.taskmaster??null),f([]),v(null)},[]),M=b.useCallback(async()=>{if(!r||!n){o([]),c(null),d(null),f([]),v(null);return}try{y(!0),A();const W=await st.get("/projects");if(!W.ok)throw new Error(`Failed to fetch projects: ${W.status}`);const U=await W.json(),P=(Array.isArray(U)?U:[]).map(L=>Kg(L));o(P);const V=I.current;if(!V)return;const B=P.find(L=>L.name===V)??null;c(B),d(B?.taskmaster??null)}catch(W){D("load projects",W)}finally{y(!1)}},[A,D,n,r]),E=b.useCallback(async()=>{const W=l?.name;if(!W||!r||!n){f([]),v(null);return}try{N(!0),A();const U=await st.get(`/taskmaster/tasks/${encodeURIComponent(W)}`);if(!U.ok){const V=await U.json();throw new Error(V.message??"Failed to load tasks")}const H=await U.json(),P=Array.isArray(H.tasks)?H.tasks:[];f(P),v(m7(P))}catch(U){D("load tasks",U),f([]),v(null)}finally{N(!1)}},[A,l?.name,D,n,r]),G=b.useCallback(async()=>{if(!r||!n){h(null);return}try{k(!0),A();const W=await st.get("/mcp-utils/taskmaster-server");if(!W.ok)throw new Error(`Failed to load MCP status: ${W.status}`);const U=await W.json();h(U)}catch(W){D("check MCP server status",W),h(null)}finally{k(!1)}},[A,D,n,r]);b.useEffect(()=>{!a&&r&&n&&(M(),G())},[a,G,M,n,r]),b.useEffect(()=>{l?.name&&r&&n&&E()},[l?.name,E,n,r]),b.useEffect(()=>{const W=t;if(h7(W)){if(W.type==="taskmaster-project-updated"&&W.projectName){M();return}if(W.type==="taskmaster-tasks-updated"&&W.projectName===l?.name){E();return}W.type==="taskmaster-mcp-status-changed"&&G()}},[l?.name,t,G,M,E]);const J=b.useMemo(()=>({projects:i,currentProject:l,projectTaskMaster:u,mcpServerStatus:p,tasks:m,nextTask:g,isLoading:x,isLoadingTasks:w,isLoadingMCP:S,error:T,refreshProjects:M,setCurrentProject:_,refreshTasks:E,refreshMCPStatus:G,clearError:A}),[A,l,T,x,S,w,p,g,u,i,G,M,E,_,m]);return s.jsx(tE.Provider,{value:J,children:e})}const rE=b.createContext({tasksEnabled:!0,setTasksEnabled:()=>{},toggleTasksEnabled:()=>{},isTaskMasterInstalled:null,isTaskMasterReady:null,installationStatus:null,isCheckingInstallation:!0}),Vi=()=>{const e=b.useContext(rE);if(!e)throw new Error("useTasksSettings must be used within a TasksSettingsProvider");return e},g7=({children:e})=>{const[t,r]=b.useState(()=>{const m=localStorage.getItem("tasks-enabled");return m!==null?JSON.parse(m):!0}),[n,a]=b.useState(null),[i,o]=b.useState(null),[l,c]=b.useState(null),[u,d]=b.useState(!0);b.useEffect(()=>{localStorage.setItem("tasks-enabled",JSON.stringify(t))},[t]),b.useEffect(()=>{setTimeout(async()=>{try{const f=await st.get("/taskmaster/installation-status");if(f.ok){const g=await f.json();c(g),a(g.installation?.isInstalled||!1),o(g.isReady||!1);const v=localStorage.getItem("tasks-enabled");!g.installation?.isInstalled&&!v&&r(!1)}else console.error("Failed to check TaskMaster installation status"),a(!1),o(!1)}catch(f){console.error("Error checking TaskMaster installation:",f),a(!1),o(!1)}finally{d(!1)}},0)},[]);const h={tasksEnabled:t,setTasksEnabled:r,toggleTasksEnabled:()=>{r(m=>!m)},isTaskMasterInstalled:n,isTaskMasterReady:i,installationStatus:l,isCheckingInstallation:u};return s.jsx(rE.Provider,{value:h,children:e})},nE=b.createContext(null);function Ki(){const e=b.useContext(nE);if(!e)throw new Error("usePlugins must be used within a PluginsProvider");return e}function b7({children:e}){const[t,r]=b.useState([]),[n,a]=b.useState(!0),[i,o]=b.useState(null),l=b.useCallback(async()=>{try{const h=await Re("/api/plugins");if(h.ok){const m=await h.json();r(m.plugins||[]),o(null)}else{let m=`Failed to fetch plugins (${h.status})`;try{const f=await h.json();m=f.details||f.error||m}catch{m=h.statusText||m}o(m)}}catch(h){const m=h instanceof Error?h.message:"Failed to fetch plugins";o(m),console.error("[Plugins] Failed to fetch plugins:",h)}finally{a(!1)}},[]);b.useEffect(()=>{l()},[l]);const c=b.useCallback(async h=>{try{const m=await Re("/api/plugins/install",{method:"POST",body:JSON.stringify({url:h})}),f=await m.json();return m.ok?(await l(),{success:!0}):{success:!1,error:f.details||f.error||"Install failed"}}catch(m){return{success:!1,error:m instanceof Error?m.message:"Install failed"}}},[l]),u=b.useCallback(async h=>{try{const m=await Re(`/api/plugins/${encodeURIComponent(h)}`,{method:"DELETE"}),f=await m.json();return m.ok?(await l(),{success:!0}):{success:!1,error:f.details||f.error||"Uninstall failed"}}catch(m){return{success:!1,error:m instanceof Error?m.message:"Uninstall failed"}}},[l]),d=b.useCallback(async h=>{try{const m=await Re(`/api/plugins/${encodeURIComponent(h)}/update`,{method:"POST"}),f=await m.json();return m.ok?(await l(),{success:!0}):{success:!1,error:f.details||f.error||"Update failed"}}catch(m){return{success:!1,error:m instanceof Error?m.message:"Update failed"}}},[l]),p=b.useCallback(async(h,m)=>{try{const f=await Re(`/api/plugins/${encodeURIComponent(h)}/enable`,{method:"PUT",body:JSON.stringify({enabled:m})});if(!f.ok){let g=`Toggle failed (${f.status})`;try{const v=await f.json();g=v.details||v.error||g}catch{g=f.statusText||g}return{success:!1,error:g}}return await l(),{success:!0,error:null}}catch(f){return{success:!1,error:f instanceof Error?f.message:"Toggle failed"}}},[l]);return s.jsx(nE.Provider,{value:{plugins:t,loading:n,pluginsError:i,refreshPlugins:l,installPlugin:c,uninstallPlugin:u,updatePlugin:d,togglePlugin:p},children:e})}const Yg=e=>typeof window>"u"?!1:window.innerWidth<e,Zg=()=>{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 rf(e={}){const{mobileBreakpoint:t=768,trackMobile:r=!0,trackPWA:n=!0}=e,[a,i]=b.useState(()=>r?Yg(t):!1),[o,l]=b.useState(()=>n?Zg():!1);return b.useEffect(()=>{if(!r||typeof window>"u")return;const c=()=>{i(Yg(t))};return c(),window.addEventListener("resize",c),()=>{window.removeEventListener("resize",c)}},[t,r]),b.useEffect(()=>{if(!n||typeof window>"u")return;const c=window.matchMedia("(display-mode: standalone)"),u=()=>{l(Zg())};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 Xg="1.25.2",x7=(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},aE=(e,t)=>{const[r,n]=b.useState(!1),[a,i]=b.useState(null),[o,l]=b.useState(null),[c,u]=b.useState("git");return b.useEffect(()=>{(async()=>{try{const h=await(await fetch("/health")).json();(h.installMode==="npm"||h.installMode==="git")&&u(h.installMode)}catch{}})()},[]),b.useEffect(()=>{const d=async()=>{try{const m=await(await fetch(`https://api.github.com/repos/${e}/${t}/releases/latest`)).json();if(m.tag_name){const f=m.tag_name.replace(/^v/,"");i(f),n(x7(f,Xg)>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:Xg,releaseInfo:o,installMode:c}},Jn={autoExpandTools:!1,showRawParameters:!1,showThinking:!0,autoScrollToBottom:!0,sendByCtrlEnter:!1,sidebarVisible:!0},eo=Object.keys(Jn),y7=new Set(eo),il="ui-preferences:sync",to=(e,t)=>{if(typeof e=="boolean")return e;if(typeof e=="string"){if(e==="true")return!0;if(e==="false")return!1}return t},v7=(e,t)=>{try{const r=localStorage.getItem(e);if(r===null)return t;const n=JSON.parse(r);return to(n,t)}catch{return t}},w7=e=>{if(typeof window>"u")return Jn;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 eo.reduce((a,i)=>(a[i]=to(n[i],Jn[i]),a),{...Jn})}}}catch{}return eo.reduce((t,r)=>(t[r]=v7(r,Jn[r]),t),{...Jn})};function k7(e,t){switch(t.type){case"set":{const{key:r,value:n}=t;if(!y7.has(r))return e;const a=to(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 eo){if(!(i in r))continue;const o=r[i],l=to(o,e[i]);a[i]!==l&&(a[i]=l,n=!0)}return n?a:e}case"reset":return{...Jn,...t.value||{}};default:return e}}function nf(e="uiPreferences"){const t=b.useRef(`ui-preferences-${Math.random().toString(36).slice(2)}`),[r,n]=b.useReducer(k7,e,w7);return b.useEffect(()=>{typeof window>"u"||(localStorage.setItem(e,JSON.stringify(r)),window.dispatchEvent(new CustomEvent(il,{detail:{storageKey:e,sourceId:t.current,value:r}})))},[r,e]),b.useEffect(()=>{if(typeof window>"u")return;const l=d=>{!d||typeof d!="object"||Array.isArray(d)||n({type:"set_many",value:d})},c=d=>{if(!(d.key!==e||d.newValue===null))try{const p=JSON.parse(d.newValue);l(p)}catch{}},u=d=>{const h=d.detail;!h||h.storageKey!==e||h.sourceId===t.current||l(h.value)};return window.addEventListener("storage",c),window.addEventListener(il,u),()=>{window.removeEventListener("storage",c),window.removeEventListener(il,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 S7=()=>{try{const e=localStorage.getItem("claude-settings");return e&&JSON.parse(e).projectSortOrder==="date"?"date":"name"}catch{return"name"}},E7=()=>{try{const e=localStorage.getItem("starredProjects");return e?new Set(JSON.parse(e)):new Set}catch{return new Set}},N7=e=>{try{localStorage.setItem("starredProjects",JSON.stringify([...e]))}catch{}},ro=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),C7=(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"),T7=e=>e.__provider==="cursor"?String(e.createdAt||""):e.__provider==="codex"?String(e.createdAt||e.lastActivity||""):String(e.lastActivity||e.createdAt||""),A7=(e,t,r)=>{const n=ro(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:C7(e,r),sessionTime:T7(e),messageCount:Number(e.messageCount||0)}},iE=(e,t)=>{const r=[...e.sessions||[],...t[e.name]||[]].map(o=>({...o,__provider:"claude"})),n=(e.cursorSessions||[]).map(o=>({...o,__provider:"cursor"})),a=(e.codexSessions||[]).map(o=>({...o,__provider:"codex"})),i=(e.geminiSessions||[]).map(o=>({...o,__provider:"gemini"}));return[...r,...n,...a,...i].sort((o,l)=>ro(l).getTime()-ro(o).getTime())},Jg=(e,t)=>{const r=iE(e,t);return r.length===0?new Date(0):r.reduce((n,a)=>{const i=ro(a);return i>n?i:n},new Date(0))},I7=(e,t,r,n)=>{const a=[...e];return a.sort((i,o)=>{const l=r.has(i.name),c=r.has(o.name);return l&&!c?-1:!l&&c?1:t==="date"?Jg(o,n).getTime()-Jg(i,n).getTime():(i.displayName||i.name).localeCompare(o.displayName||o.name)}),a},_7=(e,t)=>{const r=t.trim().toLowerCase();return r?e.filter(n=>{const a=(n.displayName||n.name).toLowerCase(),i=n.name.toLowerCase();return a.includes(r)||i.includes(r)}):e},R7=(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"},j7=e=>{const t=typeof e.fullPath=="string"&&e.fullPath.length>0?e.fullPath:typeof e.path=="string"?e.path:"";return{name:e.name,displayName:typeof e.displayName=="string"&&e.displayName.trim().length>0?e.displayName:e.name,fullPath:t,path:typeof e.path=="string"&&e.path.length>0?e.path:t}};function O7({projects:e,selectedProject:t,selectedSession:r,isLoading:n,isMobile:a,t:i,onRefresh:o,onProjectSelect:l,onSessionSelect:c,onSessionDelete:u,onProjectDelete:d,setCurrentProject:p,setSidebarVisible:h,sidebarVisible:m}){const[f,g]=b.useState(new Set),[v,x]=b.useState(null),[y,w]=b.useState(!1),[N,S]=b.useState(""),[k,T]=b.useState({}),[j,I]=b.useState({}),[A,D]=b.useState(new Set),[_,M]=b.useState(new Date),[E,G]=b.useState("name"),[J,W]=b.useState(!1),[U,H]=b.useState({}),[P,V]=b.useState(null),[B,L]=b.useState(""),[X,re]=b.useState(""),[we,ie]=b.useState(new Set),[be,ke]=b.useState(null),[ee,se]=b.useState(null),[ve,_e]=b.useState(!1),[O,ue]=b.useState(()=>E7()),[K,z]=b.useState("projects"),[$,Y]=b.useState(null),[he,ge]=b.useState(!1),[oe,xe]=b.useState(null),ce=b.useRef(null),le=b.useRef(0),te=b.useRef(null),de=!a&&!m;b.useEffect(()=>{const Ie=setInterval(()=>{M(new Date)},6e4);return()=>clearInterval(Ie)},[]),b.useEffect(()=>{I({}),D(new Set),H({})},[e]),b.useEffect(()=>{t&&g(Ie=>{if(Ie.has(t.name))return Ie;const He=new Set(Ie);return He.add(t.name),He})},[r,t]),b.useEffect(()=>{if(e.length>0&&!n){const Ie=new Set;e.forEach(He=>{He.sessions&&He.sessions.length>=0&&Ie.add(He.name)}),D(Ie)}},[e,n]),b.useEffect(()=>{const Ie=()=>{G(S7())};Ie();const He=me=>{me.key==="claude-settings"&&Ie()};window.addEventListener("storage",He);const ne=setInterval(()=>{document.hasFocus()&&Ie()},1e3);return()=>{window.removeEventListener("storage",He),clearInterval(ne)}},[]),b.useEffect(()=>{ce.current&&clearTimeout(ce.current),te.current&&(te.current.close(),te.current=null);const Ie=X.trim();if(K!=="conversations"||Ie.length<2){le.current+=1,Y(null),xe(null),ge(!1);return}ge(!0);const He=++le.current;return ce.current=setTimeout(()=>{if(He!==le.current)return;const ne=st.searchConversationsUrl(Ie),me=new EventSource(ne);te.current=me;const fe=[];let Ee=0;me.addEventListener("result",We=>{if(He!==le.current){me.close();return}try{const wt=JSON.parse(We.data);fe.push(wt.projectResult),Ee=wt.totalMatches,Y({results:[...fe],totalMatches:Ee,query:Ie}),xe({scannedProjects:wt.scannedProjects,totalProjects:wt.totalProjects})}catch{}}),me.addEventListener("progress",We=>{if(He!==le.current){me.close();return}try{const wt=JSON.parse(We.data);Ee=wt.totalMatches,xe({scannedProjects:wt.scannedProjects,totalProjects:wt.totalProjects})}catch{}}),me.addEventListener("done",()=>{if(He!==le.current){me.close();return}me.close(),te.current=null,ge(!1),xe(null),fe.length===0&&Y({results:[],totalMatches:0,query:Ie})}),me.addEventListener("error",()=>{if(He!==le.current){me.close();return}me.close(),te.current=null,ge(!1),xe(null),fe.length===0&&Y({results:[],totalMatches:0,query:Ie})})},400),()=>{ce.current&&clearTimeout(ce.current),te.current&&(te.current.close(),te.current=null)}},[X,K]),b.useCallback(Ie=>He=>{const ne=He.target;ne.closest(".overflow-y-auto")||ne.closest("[data-scroll-container]")||(He.preventDefault(),He.stopPropagation(),Ie())},[]);const ye=b.useCallback(Ie=>{g(He=>{const ne=new Set;return He.has(Ie)||ne.add(Ie),ne})},[]),je=b.useCallback((Ie,He)=>{c({...Ie,__projectName:He})},[c]),qe=b.useCallback(Ie=>{ue(He=>{const ne=new Set(He);return ne.has(Ie)?ne.delete(Ie):ne.add(Ie),N7(ne),ne})},[]),at=b.useCallback(Ie=>O.has(Ie),[O]),rt=b.useCallback(Ie=>iE(Ie,j),[j]),Ke=b.useMemo(()=>e.map(Ie=>{const He=U[Ie.name];return He===void 0?Ie:{...Ie,sessionMeta:{...Ie.sessionMeta,hasMore:He}}}),[U,e]),ct=b.useMemo(()=>I7(Ke,E,O,j),[j,E,Ke,O]),ft=b.useMemo(()=>_7(ct,X),[X,ct]),tt=b.useCallback(Ie=>{x(Ie.name),S(Ie.displayName)},[]),gt=b.useCallback(()=>{x(null),S("")},[]),dt=b.useCallback(async Ie=>{try{(await st.renameProject(Ie,N)).ok?window.refreshProjects?await window.refreshProjects():window.location.reload():console.error("Failed to rename project")}catch(He){console.error("Error renaming project:",He)}finally{x(null),S("")}},[N]),Oe=b.useCallback((Ie,He,ne,me="claude")=>{se({projectName:Ie,sessionId:He,sessionTitle:ne,provider:me})},[]),ze=b.useCallback(async()=>{if(!ee)return;const{projectName:Ie,sessionId:He,provider:ne}=ee;se(null);try{let me;if(ne==="codex"?me=await st.deleteCodexSession(He):ne==="gemini"?me=await st.deleteGeminiSession(He):me=await st.deleteSession(Ie,He),me.ok)u?.(He);else{const fe=await me.text();console.error("[Sidebar] Failed to delete session:",{status:me.status,error:fe}),alert(i("messages.deleteSessionFailed"))}}catch(me){console.error("[Sidebar] Error deleting session:",me),alert(i("messages.deleteSessionError"))}},[u,ee,i]),Ye=b.useCallback(Ie=>{ke({project:Ie,sessionCount:rt(Ie).length})},[rt]),it=b.useCallback(async()=>{if(!be)return;const{project:Ie,sessionCount:He}=be,ne=He===0;ke(null),ie(me=>new Set([...me,Ie.name]));try{const me=await st.deleteProject(Ie.name,!ne);if(me.ok)d?.(Ie.name);else{const fe=await me.json();alert(fe.error||i("messages.deleteProjectFailed"))}}catch(me){console.error("Error deleting project:",me),alert(i("messages.deleteProjectError"))}finally{ie(me=>{const fe=new Set(me);return fe.delete(Ie.name),fe})}},[be,d,i]),Je=b.useCallback(async Ie=>{const He=U[Ie.name];if(!(!(He!==void 0?He:Ie.sessionMeta?.hasMore===!0)||k[Ie.name])){T(me=>({...me,[Ie.name]:!0}));try{const me=(Ie.sessions?.length||0)+(j[Ie.name]?.length||0),fe=await st.sessions(Ie.name,5,me);if(!fe.ok)return;const Ee=await fe.json();I(We=>({...We,[Ie.name]:[...We[Ie.name]||[],...Ee.sessions||[]]})),Ee.hasMore===!1&&H(We=>({...We,[Ie.name]:!1}))}catch(me){console.error("Error loading more sessions:",me)}finally{T(me=>({...me,[Ie.name]:!1}))}}},[j,k,U]),Ge=b.useCallback(Ie=>{l(Ie),p(Ie)},[l,p]),bt=b.useCallback(async()=>{W(!0);try{await o()}finally{W(!1)}},[o]),pt=b.useCallback(async(Ie,He,ne,me)=>{const fe=ne.trim();if(!fe){V(null),L("");return}try{const Ee=await st.renameSession(He,fe,me);Ee.ok?await o():(console.error("[Sidebar] Failed to rename session:",Ee.status),alert(i("messages.renameSessionFailed")))}catch(Ee){console.error("[Sidebar] Error renaming session:",Ee),alert(i("messages.renameSessionError"))}finally{V(null),L("")}},[o,i]),Ft=b.useCallback(()=>{h(!1)},[h]),Vt=b.useCallback(()=>{h(!0)},[h]);return{isSidebarCollapsed:de,expandedProjects:f,editingProject:v,showNewProject:y,editingName:N,loadingSessions:k,additionalSessions:j,initialSessionsLoaded:A,currentTime:_,projectSortOrder:E,isRefreshing:J,editingSession:P,editingSessionName:B,searchFilter:X,deletingProjects:we,deleteConfirmation:be,sessionDeleteConfirmation:ee,showVersionModal:ve,starredProjects:O,filteredProjects:ft,toggleProject:ye,handleSessionClick:je,toggleStarProject:qe,isProjectStarred:at,getProjectSessions:rt,startEditing:tt,cancelEditing:gt,saveProjectName:dt,showDeleteSessionConfirmation:Oe,confirmDeleteSession:ze,requestProjectDelete:Ye,confirmDeleteProject:it,loadMoreSessions:Je,handleProjectSelect:Ge,refreshProjects:bt,updateSessionSummary:pt,collapseSidebar:Ft,expandSidebar:Vt,setShowNewProject:w,setEditingName:S,setEditingSession:V,setEditingSessionName:L,searchMode:K,setSearchMode:z,conversationResults:$,isSearching:he,searchProgress:oe,clearConversationResults:b.useCallback(()=>{le.current+=1,te.current&&(te.current.close(),te.current=null),ge(!1),xe(null),Y(null)},[]),setSearchFilter:re,setDeleteConfirmation:ke,setSessionDeleteConfirmation:se,setShowVersionModal:_e}}const D7="https://discord.gg/buxwujPNRE";function L7({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 M7({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(mI,{className:"h-4 w-4 text-muted-foreground transition-colors group-hover:text-foreground"})}),s.jsx("div",{className:"nav-divider my-1 w-6"}),s.jsx("button",{onClick:t,className:"group flex h-8 w-8 items-center justify-center rounded-lg transition-colors hover:bg-accent/80","aria-label":a("actions.settings"),title:a("actions.settings"),children:s.jsx(Et,{className:"h-4 w-4 text-muted-foreground transition-colors group-hover:text-foreground"})}),s.jsx("a",{href:D7,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(L7,{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(Mn,{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 sE(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=sE(e[t]))&&(n&&(n+=" "),n+=r)}else for(r in e)e[r]&&(n&&(n+=" "),n+=r);return n}function oE(){for(var e,t,r=0,n="",a=arguments.length;r<a;r++)(e=arguments[r])&&(t=sE(e))&&(n&&(n+=" "),n+=t);return n}const Qg=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,eb=oE,lE=(e,t)=>r=>{var n;if(t?.variants==null)return eb(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=Qg(d)||Qg(p);return a[u][h]}),l=r&&Object.entries(r).reduce((u,d)=>{let[p,h]=d;return h===void 0||(u[p]=h),u},{}),c=t==null||(n=t.compoundVariants)===null||n===void 0?void 0:n.reduce((u,d)=>{let{class:p,className:h,...m}=d;return Object.entries(m).every(f=>{let[g,v]=f;return Array.isArray(v)?v.includes({...i,...l}[g]):{...i,...l}[g]===v})?[...u,p,h]:u},[]);return eb(e,o,c,r?.class,r?.className)},af="-",P7=e=>{const t=B7(e),{conflictingClassGroups:r,conflictingClassGroupModifiers:n}=e;return{getClassGroupId:o=>{const l=o.split(af);return l[0]===""&&l.length!==1&&l.shift(),cE(l,t)||F7(o)},getConflictingClassGroupIds:(o,l)=>{const c=r[o]||[];return l&&n[o]?[...c,...n[o]]:c}}},cE=(e,t)=>{if(e.length===0)return t.classGroupId;const r=e[0],n=t.nextPart.get(r),a=n?cE(e.slice(1),n):void 0;if(a)return a;if(t.validators.length===0)return;const i=e.join(af);return t.validators.find(({validator:o})=>o(i))?.classGroupId},tb=/^\[(.+)\]$/,F7=e=>{if(tb.test(e)){const t=tb.exec(e)[1],r=t?.substring(0,t.indexOf(":"));if(r)return"arbitrary.."+r}},B7=e=>{const{theme:t,classGroups:r}=e,n={nextPart:new Map,validators:[]};for(const a in r)eh(r[a],n,a,t);return n},eh=(e,t,r,n)=>{e.forEach(a=>{if(typeof a=="string"){const i=a===""?t:rb(t,a);i.classGroupId=r;return}if(typeof a=="function"){if(z7(a)){eh(a(n),t,r,n);return}t.validators.push({validator:a,classGroupId:r});return}Object.entries(a).forEach(([i,o])=>{eh(o,rb(t,i),r,n)})})},rb=(e,t)=>{let r=e;return t.split(af).forEach(n=>{r.nextPart.has(n)||r.nextPart.set(n,{nextPart:new Map,validators:[]}),r=r.nextPart.get(n)}),r},z7=e=>e.isThemeGetter,$7=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,r=new Map,n=new Map;const a=(i,o)=>{r.set(i,o),t++,t>e&&(t=0,n=r,r=new Map)};return{get(i){let o=r.get(i);if(o!==void 0)return o;if((o=n.get(i))!==void 0)return a(i,o),o},set(i,o){r.has(i)?r.set(i,o):a(i,o)}}},th="!",rh=":",U7=rh.length,q7=e=>{const{prefix:t,experimentalParseClassName:r}=e;let n=a=>{const i=[];let o=0,l=0,c=0,u;for(let f=0;f<a.length;f++){let g=a[f];if(o===0&&l===0){if(g===rh){i.push(a.slice(c,f)),c=f+U7;continue}if(g==="/"){u=f;continue}}g==="["?o++:g==="]"?o--:g==="("?l++:g===")"&&l--}const d=i.length===0?a:a.substring(c),p=G7(d),h=p!==d,m=u&&u>c?u-c:void 0;return{modifiers:i,hasImportantModifier:h,baseClassName:p,maybePostfixModifierPosition:m}};if(t){const a=t+rh,i=n;n=o=>o.startsWith(a)?i(o.substring(a.length)):{isExternal:!0,modifiers:[],hasImportantModifier:!1,baseClassName:o,maybePostfixModifierPosition:void 0}}if(r){const a=n;n=i=>r({className:i,parseClassName:a})}return n},G7=e=>e.endsWith(th)?e.substring(0,e.length-1):e.startsWith(th)?e.substring(1):e,H7=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}},W7=e=>({cache:$7(e.cacheSize),parseClassName:q7(e),sortModifiers:H7(e),...P7(e)}),V7=/\s+/,K7=(e,t)=>{const{parseClassName:r,getClassGroupId:n,getConflictingClassGroupIds:a,sortModifiers:i}=t,o=[],l=e.trim().split(V7);let c="";for(let u=l.length-1;u>=0;u-=1){const d=l[u],{isExternal:p,modifiers:h,hasImportantModifier:m,baseClassName:f,maybePostfixModifierPosition:g}=r(d);if(p){c=d+(c.length>0?" "+c:c);continue}let v=!!g,x=n(v?f.substring(0,g):f);if(!x){if(!v){c=d+(c.length>0?" "+c:c);continue}if(x=n(f),!x){c=d+(c.length>0?" "+c:c);continue}v=!1}const y=i(h).join(":"),w=m?y+th:y,N=w+x;if(o.includes(N))continue;o.push(N);const S=a(x,v);for(let k=0;k<S.length;++k){const T=S[k];o.push(w+T)}c=d+(c.length>0?" "+c:c)}return c};function Y7(){let e=0,t,r,n="";for(;e<arguments.length;)(t=arguments[e++])&&(r=uE(t))&&(n&&(n+=" "),n+=r);return n}const uE=e=>{if(typeof e=="string")return e;let t,r="";for(let n=0;n<e.length;n++)e[n]&&(t=uE(e[n]))&&(r&&(r+=" "),r+=t);return r};function Z7(e,...t){let r,n,a,i=o;function o(c){const u=t.reduce((d,p)=>p(d),e());return r=W7(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=K7(c,r);return a(c,d),d}return function(){return i(Y7.apply(null,arguments))}}const Ut=e=>{const t=r=>r[e]||[];return t.isThemeGetter=!0,t},dE=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,pE=/^\((?:(\w[\w-]*):)?(.+)\)$/i,X7=/^\d+\/\d+$/,J7=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,Q7=/\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$/,e8=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,t8=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,r8=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,wa=e=>X7.test(e),ut=e=>!!e&&!Number.isNaN(Number(e)),kn=e=>!!e&&Number.isInteger(Number(e)),sl=e=>e.endsWith("%")&&ut(e.slice(0,-1)),sn=e=>J7.test(e),n8=()=>!0,a8=e=>Q7.test(e)&&!e8.test(e),mE=()=>!1,i8=e=>t8.test(e),s8=e=>r8.test(e),o8=e=>!$e(e)&&!Ue(e),l8=e=>Xa(e,gE,mE),$e=e=>dE.test(e),Wn=e=>Xa(e,bE,a8),ol=e=>Xa(e,m8,ut),nb=e=>Xa(e,hE,mE),c8=e=>Xa(e,fE,s8),os=e=>Xa(e,xE,i8),Ue=e=>pE.test(e),mi=e=>Ja(e,bE),u8=e=>Ja(e,h8),ab=e=>Ja(e,hE),d8=e=>Ja(e,gE),p8=e=>Ja(e,fE),ls=e=>Ja(e,xE,!0),Xa=(e,t,r)=>{const n=dE.exec(e);return n?n[1]?t(n[1]):r(n[2]):!1},Ja=(e,t,r=!1)=>{const n=pE.exec(e);return n?n[1]?t(n[1]):r:!1},hE=e=>e==="position"||e==="percentage",fE=e=>e==="image"||e==="url",gE=e=>e==="length"||e==="size"||e==="bg-size",bE=e=>e==="length",m8=e=>e==="number",h8=e=>e==="family-name",xE=e=>e==="shadow",f8=()=>{const e=Ut("color"),t=Ut("font"),r=Ut("text"),n=Ut("font-weight"),a=Ut("tracking"),i=Ut("leading"),o=Ut("breakpoint"),l=Ut("container"),c=Ut("spacing"),u=Ut("radius"),d=Ut("shadow"),p=Ut("inset-shadow"),h=Ut("text-shadow"),m=Ut("drop-shadow"),f=Ut("blur"),g=Ut("perspective"),v=Ut("aspect"),x=Ut("ease"),y=Ut("animate"),w=()=>["auto","avoid","all","avoid-page","page","left","right","column"],N=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],S=()=>[...N(),Ue,$e],k=()=>["auto","hidden","clip","visible","scroll"],T=()=>["auto","contain","none"],j=()=>[Ue,$e,c],I=()=>[wa,"full","auto",...j()],A=()=>[kn,"none","subgrid",Ue,$e],D=()=>["auto",{span:["full",kn,Ue,$e]},kn,Ue,$e],_=()=>[kn,"auto",Ue,$e],M=()=>["auto","min","max","fr",Ue,$e],E=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],G=()=>["start","end","center","stretch","center-safe","end-safe"],J=()=>["auto",...j()],W=()=>[wa,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...j()],U=()=>[e,Ue,$e],H=()=>[...N(),ab,nb,{position:[Ue,$e]}],P=()=>["no-repeat",{repeat:["","x","y","space","round"]}],V=()=>["auto","cover","contain",d8,l8,{size:[Ue,$e]}],B=()=>[sl,mi,Wn],L=()=>["","none","full",u,Ue,$e],X=()=>["",ut,mi,Wn],re=()=>["solid","dashed","dotted","double"],we=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],ie=()=>[ut,sl,ab,nb],be=()=>["","none",f,Ue,$e],ke=()=>["none",ut,Ue,$e],ee=()=>["none",ut,Ue,$e],se=()=>[ut,Ue,$e],ve=()=>[wa,"full",...j()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[sn],breakpoint:[sn],color:[n8],container:[sn],"drop-shadow":[sn],ease:["in","out","in-out"],font:[o8],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[sn],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[sn],shadow:[sn],spacing:["px",ut],text:[sn],"text-shadow":[sn],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",wa,$e,Ue,v]}],container:["container"],columns:[{columns:[ut,$e,Ue,l]}],"break-after":[{"break-after":w()}],"break-before":[{"break-before":w()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:S()}],overflow:[{overflow:k()}],"overflow-x":[{"overflow-x":k()}],"overflow-y":[{"overflow-y":k()}],overscroll:[{overscroll:T()}],"overscroll-x":[{"overscroll-x":T()}],"overscroll-y":[{"overscroll-y":T()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:I()}],"inset-x":[{"inset-x":I()}],"inset-y":[{"inset-y":I()}],start:[{start:I()}],end:[{end:I()}],top:[{top:I()}],right:[{right:I()}],bottom:[{bottom:I()}],left:[{left:I()}],visibility:["visible","invisible","collapse"],z:[{z:[kn,"auto",Ue,$e]}],basis:[{basis:[wa,"full","auto",l,...j()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[ut,wa,"auto","initial","none",$e]}],grow:[{grow:["",ut,Ue,$e]}],shrink:[{shrink:["",ut,Ue,$e]}],order:[{order:[kn,"first","last","none",Ue,$e]}],"grid-cols":[{"grid-cols":A()}],"col-start-end":[{col:D()}],"col-start":[{"col-start":_()}],"col-end":[{"col-end":_()}],"grid-rows":[{"grid-rows":A()}],"row-start-end":[{row:D()}],"row-start":[{"row-start":_()}],"row-end":[{"row-end":_()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":M()}],"auto-rows":[{"auto-rows":M()}],gap:[{gap:j()}],"gap-x":[{"gap-x":j()}],"gap-y":[{"gap-y":j()}],"justify-content":[{justify:[...E(),"normal"]}],"justify-items":[{"justify-items":[...G(),"normal"]}],"justify-self":[{"justify-self":["auto",...G()]}],"align-content":[{content:["normal",...E()]}],"align-items":[{items:[...G(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...G(),{baseline:["","last"]}]}],"place-content":[{"place-content":E()}],"place-items":[{"place-items":[...G(),"baseline"]}],"place-self":[{"place-self":["auto",...G()]}],p:[{p:j()}],px:[{px:j()}],py:[{py:j()}],ps:[{ps:j()}],pe:[{pe:j()}],pt:[{pt:j()}],pr:[{pr:j()}],pb:[{pb:j()}],pl:[{pl:j()}],m:[{m:J()}],mx:[{mx:J()}],my:[{my:J()}],ms:[{ms:J()}],me:[{me:J()}],mt:[{mt:J()}],mr:[{mr:J()}],mb:[{mb:J()}],ml:[{ml:J()}],"space-x":[{"space-x":j()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":j()}],"space-y-reverse":["space-y-reverse"],size:[{size:W()}],w:[{w:[l,"screen",...W()]}],"min-w":[{"min-w":[l,"screen","none",...W()]}],"max-w":[{"max-w":[l,"screen","none","prose",{screen:[o]},...W()]}],h:[{h:["screen","lh",...W()]}],"min-h":[{"min-h":["screen","lh","none",...W()]}],"max-h":[{"max-h":["screen","lh",...W()]}],"font-size":[{text:["base",r,mi,Wn]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[n,Ue,ol]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",sl,$e]}],"font-family":[{font:[u8,$e,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,Ue,$e]}],"line-clamp":[{"line-clamp":[ut,"none",Ue,ol]}],leading:[{leading:[i,...j()]}],"list-image":[{"list-image":["none",Ue,$e]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",Ue,$e]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:U()}],"text-color":[{text:U()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...re(),"wavy"]}],"text-decoration-thickness":[{decoration:[ut,"from-font","auto",Ue,Wn]}],"text-decoration-color":[{decoration:U()}],"underline-offset":[{"underline-offset":[ut,"auto",Ue,$e]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:j()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",Ue,$e]}],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",Ue,$e]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:H()}],"bg-repeat":[{bg:P()}],"bg-size":[{bg:V()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},kn,Ue,$e],radial:["",Ue,$e],conic:[kn,Ue,$e]},p8,c8]}],"bg-color":[{bg:U()}],"gradient-from-pos":[{from:B()}],"gradient-via-pos":[{via:B()}],"gradient-to-pos":[{to:B()}],"gradient-from":[{from:U()}],"gradient-via":[{via:U()}],"gradient-to":[{to:U()}],rounded:[{rounded:L()}],"rounded-s":[{"rounded-s":L()}],"rounded-e":[{"rounded-e":L()}],"rounded-t":[{"rounded-t":L()}],"rounded-r":[{"rounded-r":L()}],"rounded-b":[{"rounded-b":L()}],"rounded-l":[{"rounded-l":L()}],"rounded-ss":[{"rounded-ss":L()}],"rounded-se":[{"rounded-se":L()}],"rounded-ee":[{"rounded-ee":L()}],"rounded-es":[{"rounded-es":L()}],"rounded-tl":[{"rounded-tl":L()}],"rounded-tr":[{"rounded-tr":L()}],"rounded-br":[{"rounded-br":L()}],"rounded-bl":[{"rounded-bl":L()}],"border-w":[{border:X()}],"border-w-x":[{"border-x":X()}],"border-w-y":[{"border-y":X()}],"border-w-s":[{"border-s":X()}],"border-w-e":[{"border-e":X()}],"border-w-t":[{"border-t":X()}],"border-w-r":[{"border-r":X()}],"border-w-b":[{"border-b":X()}],"border-w-l":[{"border-l":X()}],"divide-x":[{"divide-x":X()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":X()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...re(),"hidden","none"]}],"divide-style":[{divide:[...re(),"hidden","none"]}],"border-color":[{border:U()}],"border-color-x":[{"border-x":U()}],"border-color-y":[{"border-y":U()}],"border-color-s":[{"border-s":U()}],"border-color-e":[{"border-e":U()}],"border-color-t":[{"border-t":U()}],"border-color-r":[{"border-r":U()}],"border-color-b":[{"border-b":U()}],"border-color-l":[{"border-l":U()}],"divide-color":[{divide:U()}],"outline-style":[{outline:[...re(),"none","hidden"]}],"outline-offset":[{"outline-offset":[ut,Ue,$e]}],"outline-w":[{outline:["",ut,mi,Wn]}],"outline-color":[{outline:U()}],shadow:[{shadow:["","none",d,ls,os]}],"shadow-color":[{shadow:U()}],"inset-shadow":[{"inset-shadow":["none",p,ls,os]}],"inset-shadow-color":[{"inset-shadow":U()}],"ring-w":[{ring:X()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:U()}],"ring-offset-w":[{"ring-offset":[ut,Wn]}],"ring-offset-color":[{"ring-offset":U()}],"inset-ring-w":[{"inset-ring":X()}],"inset-ring-color":[{"inset-ring":U()}],"text-shadow":[{"text-shadow":["none",h,ls,os]}],"text-shadow-color":[{"text-shadow":U()}],opacity:[{opacity:[ut,Ue,$e]}],"mix-blend":[{"mix-blend":[...we(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":we()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[ut]}],"mask-image-linear-from-pos":[{"mask-linear-from":ie()}],"mask-image-linear-to-pos":[{"mask-linear-to":ie()}],"mask-image-linear-from-color":[{"mask-linear-from":U()}],"mask-image-linear-to-color":[{"mask-linear-to":U()}],"mask-image-t-from-pos":[{"mask-t-from":ie()}],"mask-image-t-to-pos":[{"mask-t-to":ie()}],"mask-image-t-from-color":[{"mask-t-from":U()}],"mask-image-t-to-color":[{"mask-t-to":U()}],"mask-image-r-from-pos":[{"mask-r-from":ie()}],"mask-image-r-to-pos":[{"mask-r-to":ie()}],"mask-image-r-from-color":[{"mask-r-from":U()}],"mask-image-r-to-color":[{"mask-r-to":U()}],"mask-image-b-from-pos":[{"mask-b-from":ie()}],"mask-image-b-to-pos":[{"mask-b-to":ie()}],"mask-image-b-from-color":[{"mask-b-from":U()}],"mask-image-b-to-color":[{"mask-b-to":U()}],"mask-image-l-from-pos":[{"mask-l-from":ie()}],"mask-image-l-to-pos":[{"mask-l-to":ie()}],"mask-image-l-from-color":[{"mask-l-from":U()}],"mask-image-l-to-color":[{"mask-l-to":U()}],"mask-image-x-from-pos":[{"mask-x-from":ie()}],"mask-image-x-to-pos":[{"mask-x-to":ie()}],"mask-image-x-from-color":[{"mask-x-from":U()}],"mask-image-x-to-color":[{"mask-x-to":U()}],"mask-image-y-from-pos":[{"mask-y-from":ie()}],"mask-image-y-to-pos":[{"mask-y-to":ie()}],"mask-image-y-from-color":[{"mask-y-from":U()}],"mask-image-y-to-color":[{"mask-y-to":U()}],"mask-image-radial":[{"mask-radial":[Ue,$e]}],"mask-image-radial-from-pos":[{"mask-radial-from":ie()}],"mask-image-radial-to-pos":[{"mask-radial-to":ie()}],"mask-image-radial-from-color":[{"mask-radial-from":U()}],"mask-image-radial-to-color":[{"mask-radial-to":U()}],"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":N()}],"mask-image-conic-pos":[{"mask-conic":[ut]}],"mask-image-conic-from-pos":[{"mask-conic-from":ie()}],"mask-image-conic-to-pos":[{"mask-conic-to":ie()}],"mask-image-conic-from-color":[{"mask-conic-from":U()}],"mask-image-conic-to-color":[{"mask-conic-to":U()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:H()}],"mask-repeat":[{mask:P()}],"mask-size":[{mask:V()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",Ue,$e]}],filter:[{filter:["","none",Ue,$e]}],blur:[{blur:be()}],brightness:[{brightness:[ut,Ue,$e]}],contrast:[{contrast:[ut,Ue,$e]}],"drop-shadow":[{"drop-shadow":["","none",m,ls,os]}],"drop-shadow-color":[{"drop-shadow":U()}],grayscale:[{grayscale:["",ut,Ue,$e]}],"hue-rotate":[{"hue-rotate":[ut,Ue,$e]}],invert:[{invert:["",ut,Ue,$e]}],saturate:[{saturate:[ut,Ue,$e]}],sepia:[{sepia:["",ut,Ue,$e]}],"backdrop-filter":[{"backdrop-filter":["","none",Ue,$e]}],"backdrop-blur":[{"backdrop-blur":be()}],"backdrop-brightness":[{"backdrop-brightness":[ut,Ue,$e]}],"backdrop-contrast":[{"backdrop-contrast":[ut,Ue,$e]}],"backdrop-grayscale":[{"backdrop-grayscale":["",ut,Ue,$e]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[ut,Ue,$e]}],"backdrop-invert":[{"backdrop-invert":["",ut,Ue,$e]}],"backdrop-opacity":[{"backdrop-opacity":[ut,Ue,$e]}],"backdrop-saturate":[{"backdrop-saturate":[ut,Ue,$e]}],"backdrop-sepia":[{"backdrop-sepia":["",ut,Ue,$e]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":j()}],"border-spacing-x":[{"border-spacing-x":j()}],"border-spacing-y":[{"border-spacing-y":j()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",Ue,$e]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[ut,"initial",Ue,$e]}],ease:[{ease:["linear","initial",x,Ue,$e]}],delay:[{delay:[ut,Ue,$e]}],animate:[{animate:["none",y,Ue,$e]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[g,Ue,$e]}],"perspective-origin":[{"perspective-origin":S()}],rotate:[{rotate:ke()}],"rotate-x":[{"rotate-x":ke()}],"rotate-y":[{"rotate-y":ke()}],"rotate-z":[{"rotate-z":ke()}],scale:[{scale:ee()}],"scale-x":[{"scale-x":ee()}],"scale-y":[{"scale-y":ee()}],"scale-z":[{"scale-z":ee()}],"scale-3d":["scale-3d"],skew:[{skew:se()}],"skew-x":[{"skew-x":se()}],"skew-y":[{"skew-y":se()}],transform:[{transform:[Ue,$e,"","none","gpu","cpu"]}],"transform-origin":[{origin:S()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:ve()}],"translate-x":[{"translate-x":ve()}],"translate-y":[{"translate-y":ve()}],"translate-z":[{"translate-z":ve()}],"translate-none":["translate-none"],accent:[{accent:U()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:U()}],"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",Ue,$e]}],"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":j()}],"scroll-mx":[{"scroll-mx":j()}],"scroll-my":[{"scroll-my":j()}],"scroll-ms":[{"scroll-ms":j()}],"scroll-me":[{"scroll-me":j()}],"scroll-mt":[{"scroll-mt":j()}],"scroll-mr":[{"scroll-mr":j()}],"scroll-mb":[{"scroll-mb":j()}],"scroll-ml":[{"scroll-ml":j()}],"scroll-p":[{"scroll-p":j()}],"scroll-px":[{"scroll-px":j()}],"scroll-py":[{"scroll-py":j()}],"scroll-ps":[{"scroll-ps":j()}],"scroll-pe":[{"scroll-pe":j()}],"scroll-pt":[{"scroll-pt":j()}],"scroll-pr":[{"scroll-pr":j()}],"scroll-pb":[{"scroll-pb":j()}],"scroll-pl":[{"scroll-pl":j()}],"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",Ue,$e]}],fill:[{fill:["none",...U()]}],"stroke-w":[{stroke:[ut,mi,Wn,ol]}],stroke:[{stroke:["none",...U()]}],"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"]}},g8=Z7(f8);function Le(...e){return g8(oE(e))}function b8(e){if(!e||typeof e!="string")return null;try{return JSON.parse(e)}catch{return null}}const x8=lE("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 $r({className:e,variant:t,...r}){return s.jsx("div",{className:Le(x8({variant:t}),e),...r})}const y8=lE("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium touch-manipulation transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",{variants:{variant:{default:"bg-primary text-primary-foreground shadow hover:bg-primary/90 active:bg-primary/80",destructive:"bg-destructive text-destructive-foreground shadow-sm hover:bg-destructive/90 active:bg-destructive/80",outline:"border border-input bg-background shadow-sm hover:bg-accent hover:text-accent-foreground active:bg-accent/80",secondary:"bg-secondary text-secondary-foreground shadow-sm hover:bg-secondary/80 active:bg-secondary/70",ghost:"hover:bg-accent hover:text-accent-foreground active:bg-accent/80",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-10 px-4 py-2",sm:"h-9 rounded-md px-3 text-sm",lg:"h-11 rounded-md px-8",icon:"h-10 w-10"}},defaultVariants:{variant:"default",size:"default"}}),Fe=b.forwardRef(({className:e,variant:t,size:r,...n},a)=>s.jsx("button",{className:Le(y8({variant:t,size:r,className:e})),ref:a,...n}));Fe.displayName="Button";function nh({checked:e,onToggle:t,ariaLabel:r="Toggle dark mode"}){const{isDarkMode:n,toggleDarkMode:a}=Ya(),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:Le("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:Le("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(Qh,{className:"h-3 w-3 text-primary"}):s.jsx(tf,{className:"h-3 w-3 text-white dark:text-background"})})]})}const At=b.forwardRef(({className:e,type:t,...r},n)=>s.jsx("input",{type:t,className:Le("flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-sm shadow-sm transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50",e),ref:n,...r}));At.displayName="Input";const sf=b.forwardRef(({className:e,children:t,...r},n)=>s.jsx("div",{className:Le(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})}));sf.displayName="ScrollArea";function v8(e){switch(e){case"top":return"bottom-full left-1/2 transform -translate-x-1/2 mb-2";case"bottom":return"top-full left-1/2 transform -translate-x-1/2 mt-2";case"left":return"right-full top-1/2 transform -translate-y-1/2 mr-2";case"right":return"left-full top-1/2 transform -translate-y-1/2 ml-2";default:return"bottom-full left-1/2 transform -translate-x-1/2 mb-2"}}function w8(e){switch(e){case"top":return"top-full left-1/2 transform -translate-x-1/2 border-t-gray-900 dark:border-t-gray-100";case"bottom":return"bottom-full left-1/2 transform -translate-x-1/2 border-b-gray-900 dark:border-b-gray-100";case"left":return"left-full top-1/2 transform -translate-y-1/2 border-l-gray-900 dark:border-l-gray-100";case"right":return"right-full top-1/2 transform -translate-y-1/2 border-r-gray-900 dark:border-r-gray-100";default:return"top-full left-1/2 transform -translate-x-1/2 border-t-gray-900 dark:border-t-gray-100"}}function _n({children:e,content:t,position:r="top",className:n="",delay:a=500}){const[i,o]=b.useState(!1),l=b.useRef(null),c=()=>{l.current!==null&&(window.clearTimeout(l.current),l.current=null)},u=()=>{c(),l.current=window.setTimeout(()=>{o(!0)},a)},d=()=>{c(),o(!1)};return b.useEffect(()=>()=>{c()},[]),t?s.jsxs("div",{className:"relative inline-block",onMouseEnter:u,onMouseLeave:d,children:[e,i&&s.jsxs("div",{className:Le("absolute z-50 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",v8(r),n),children:[t,s.jsx("div",{className:Le("absolute w-0 h-0 border-4 border-transparent",w8(r))})]})]}):s.jsx(s.Fragment,{children:e})}function of({children:e,className:t}){return s.jsx("div",{className:Le("inline-flex items-center gap-[2px] rounded-lg bg-muted/60 p-[3px]",t),children:e})}function lf({isActive:e,onClick:t,children:r,className:n}){return s.jsx("button",{onClick:t,className:Le("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 ib="https://discord.gg/buxwujPNRE";function sb({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 k8({updateAvailable:e,releaseInfo:t,latestVersion:r,onShowVersionModal:n,onShowSettings:a,t:i}){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:n,children:[s.jsxs("div",{className:"relative flex-shrink-0",children:[s.jsx(Pg,{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:i("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:n,children:[s.jsxs("div",{className:"relative flex-shrink-0",children:[s.jsx(Pg,{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:i("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:ib,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(sb,{className:"h-3.5 w-3.5"}),s.jsx("span",{className:"text-sm",children:i("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:a,children:[s.jsx(Et,{className:"h-3.5 w-3.5"}),s.jsx("span",{className:"text-sm",children:i("actions.settings")})]})}),s.jsx("div",{className:"px-3 pt-3 md:hidden",children:s.jsxs("a",{href:ib,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(sb,{className:"w-4.5 h-4.5 text-muted-foreground"})}),s.jsx("span",{className:"text-base font-medium text-foreground",children:i("actions.joinCommunity")})]})}),s.jsx("div",{className:"px-3 pb-20 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:a,children:[s.jsx("div",{className:"flex h-8 w-8 items-center justify-center rounded-xl bg-background/80",children:s.jsx(Et,{className:"w-4.5 h-4.5 text-muted-foreground"})}),s.jsx("span",{className:"text-base font-medium text-foreground",children:i("actions.settings")})]})})]})}function S8({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(Er,{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(Wt,{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(dI,{className:"h-3.5 w-3.5"})})]})]}),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:Le("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(Sr,{className:"h-3 w-3"}),m("search.modeProjects")]}),s.jsxs("button",{onClick:()=>c("conversations"),"aria-pressed":l==="conversations",className:Le("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(Dn,{className:"h-3 w-3"}),m("search.modeConversations")]})]}),s.jsxs("div",{className:"relative",children:[s.jsx(Ln,{className:"pointer-events-none absolute left-3 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-muted-foreground/50"}),s.jsx(At,{type:"text",placeholder:m(l==="conversations"?"search.conversationsPlaceholder":"projects.searchPlaceholder"),value:a,onChange:g=>i(g.target.value),className:"nav-search-input h-9 rounded-xl border-0 pl-9 pr-8 text-sm transition-all duration-200 placeholder:text-muted-foreground/40 focus-visible:ring-0 focus-visible:ring-offset-0"}),a&&s.jsx("button",{onClick:o,"aria-label":m("tooltips.clearSearch"),className:"absolute right-2.5 top-1/2 -translate-y-1/2 rounded-md p-0.5 hover:bg-accent",children:s.jsx(vt,{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(Er,{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(sa,{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:Le("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(Sr,{className:"h-3 w-3"}),m("search.modeProjects")]}),s.jsxs("button",{onClick:()=>c("conversations"),"aria-pressed":l==="conversations",className:Le("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(Dn,{className:"h-3 w-3"}),m("search.modeConversations")]})]}),s.jsxs("div",{className:"relative",children:[s.jsx(Ln,{className:"pointer-events-none absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground/50"}),s.jsx(At,{type:"text",placeholder:m(l==="conversations"?"search.conversationsPlaceholder":"projects.searchPlaceholder"),value:a,onChange:g=>i(g.target.value),className:"nav-search-input h-10 rounded-xl border-0 pl-10 pr-9 text-sm transition-all duration-200 placeholder:text-muted-foreground/40 focus-visible:ring-0 focus-visible:ring-offset-0"}),a&&s.jsx("button",{onClick:o,"aria-label":m("tooltips.clearSearch"),className:"absolute right-2.5 top-1/2 -translate-y-1/2 rounded-md p-1 hover:bg-accent",children:s.jsx(vt,{className:"h-3.5 w-3.5 text-muted-foreground"})})]})]})]}),s.jsx("div",{className:"nav-divider md:hidden"})]})}const ob={xs:"w-3 h-3",sm:"w-4 h-4",md:"w-5 h-5",lg:"w-6 h-6"},E8={xs:"p-0.5",sm:"p-1",md:"p-1.5",lg:"p-2"},N8=e=>e==="fully-configured"?{icon:_o,colorClassName:"text-green-500 dark:text-green-400",backgroundClassName:"bg-green-50 dark:bg-green-950",label:"TaskMaster Ready",title:"TaskMaster fully configured with MCP server"}:e==="taskmaster-only"?{icon:Et,colorClassName:"text-blue-500 dark:text-blue-400",backgroundClassName:"bg-blue-50 dark:bg-blue-950",label:"TaskMaster Init",title:"TaskMaster initialized, MCP server needs setup"}:e==="mcp-only"?{icon:Io,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:vt,colorClassName:"text-gray-400 dark:text-gray-500",backgroundClassName:"bg-gray-50 dark:bg-gray-900",label:"No TaskMaster",title:"TaskMaster not configured"};function C8({status:e="not-configured",size:t="sm",className:r="",showLabel:n=!1}){const a=N8(e),i=a.icon;return n?s.jsxs("div",{className:Le("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:ob[t]}),s.jsx("span",{className:"font-medium",children:a.label})]}):s.jsx("div",{className:Le("inline-flex items-center justify-center rounded-full transition-colors",a.backgroundClassName,E8[t],r),title:a.title,children:s.jsx(i,{className:Le(ob[t],a.colorClassName)})})}const lb=(e,t,r)=>{const n=new Date(e),a=t;if(isNaN(n.getTime()))return r?r("status.unknown"):"Unknown";const i=a.getTime()-n.getTime(),o=Math.floor(i/1e3),l=Math.floor(i/(1e3*60)),c=Math.floor(i/(1e3*60*60)),u=Math.floor(i/(1e3*60*60*24));return o<60?r?r("time.justNow"):"Just now":l===1?r?r("time.oneMinuteAgo"):"1 min ago":l<60?r?r("time.minutesAgo",{count:l}):`${l} mins ago`:c===1?r?r("time.oneHourAgo"):"1 hour ago":c<24?r?r("time.hoursAgo",{count:c}):`${c} hours ago`:u===1?r?r("time.oneDayAgo"):"1 day ago":u<7?r?r("time.daysAgo",{count:u}):`${u} days ago`:n.toLocaleDateString()};function T8({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=A7(t,n,m),g=r?.id===t.id,v=()=>{d(e),p(t,e.name)},x=()=>{u(e.name,t.id,i,t.__provider)},y=()=>{h(e.name,t.id,f.sessionName,t.__provider)};return s.jsxs("div",{className:"group relative",children:[f.isActive&&s.jsx("div",{className:"absolute left-0 top-1/2 -translate-x-1 -translate-y-1/2 transform",children:s.jsx("div",{className:"h-2 w-2 animate-pulse rounded-full bg-green-500"})}),s.jsx("div",{className:"md:hidden",children:s.jsx("div",{className:Le("p-2 mx-3 my-0.5 rounded-md bg-card border active:scale-[0.98] transition-all duration-150 relative",g?"bg-primary/5 border-primary/20":"",!g&&f.isActive?"border-green-500/30 bg-green-50/5 dark:bg-green-900/5":"border-border/30"),onClick:v,children:s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("div",{className:Le("w-5 h-5 rounded-md flex items-center justify-center flex-shrink-0",g?"bg-primary/10":"bg-muted/50"),children:s.jsx(_r,{provider:t.__provider,className:"h-3 w-3"})}),s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsx("div",{className:"truncate text-xs font-medium text-foreground",children:f.sessionName}),s.jsxs("div",{className:"mt-0.5 flex items-center gap-1",children:[s.jsx(Mi,{className:"h-2.5 w-2.5 text-muted-foreground"}),s.jsx("span",{className:"text-xs text-muted-foreground",children:lb(f.sessionTime,n,m)}),f.messageCount>0&&s.jsx($r,{variant:"secondary",className:"ml-auto px-1 py-0 text-xs",children:f.messageCount}),s.jsx("span",{className:"ml-1 opacity-70",children:s.jsx(_r,{provider:t.__provider,className:"h-3 w-3"})})]})]}),!f.isCursorSession&&s.jsx("button",{className:"ml-1 flex h-5 w-5 items-center justify-center rounded-md bg-red-50 opacity-70 transition-transform active:scale-95 dark:bg-red-900/20",onClick:w=>{w.stopPropagation(),y()},children:s.jsx(Qt,{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:Le("w-full justify-start p-2 h-auto font-normal text-left hover:bg-accent/50 transition-colors duration-200",g&&"bg-accent text-accent-foreground"),onClick:()=>p(t,e.name),children:s.jsxs("div",{className:"flex w-full min-w-0 items-start gap-2",children:[s.jsx(_r,{provider:t.__provider,className:"mt-0.5 h-3 w-3 flex-shrink-0"}),s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsx("div",{className:"truncate text-xs font-medium text-foreground",children:f.sessionName}),s.jsxs("div",{className:"mt-0.5 flex items-center gap-1",children:[s.jsx(Mi,{className:"h-2.5 w-2.5 text-muted-foreground"}),s.jsx("span",{className:"text-xs text-muted-foreground",children:lb(f.sessionTime,n,m)}),f.messageCount>0&&s.jsx($r,{variant:"secondary",className:"ml-auto px-1 py-0 text-xs transition-opacity group-hover:opacity-0",children:f.messageCount}),s.jsx("span",{className:"ml-1 opacity-70 transition-opacity group-hover:opacity-0",children:s.jsx(_r,{provider:t.__provider,className:"h-3 w-3"})})]})]})]})}),s.jsx("div",{className:"absolute right-2 top-1/2 flex -translate-y-1/2 transform items-center gap-1 opacity-0 transition-all duration-200 group-hover:opacity-100",children:a===t.id?s.jsxs(s.Fragment,{children:[s.jsx("input",{type:"text",value:i,onChange:w=>o(w.target.value),onKeyDown:w=>{w.stopPropagation(),w.key==="Enter"?x():w.key==="Escape"&&c()},onClick:w=>w.stopPropagation(),className:"w-32 rounded border border-border bg-background px-2 py-1 text-xs focus:outline-none focus:ring-1 focus:ring-primary",autoFocus:!0}),s.jsx("button",{className:"flex h-6 w-6 items-center justify-center rounded bg-green-50 hover:bg-green-100 dark:bg-green-900/20 dark:hover:bg-green-900/40",onClick:w=>{w.stopPropagation(),x()},title:m("tooltips.save"),children:s.jsx(lr,{className:"h-3 w-3 text-green-600 dark:text-green-400"})}),s.jsx("button",{className:"flex h-6 w-6 items-center justify-center rounded bg-gray-50 hover:bg-gray-100 dark:bg-gray-900/20 dark:hover:bg-gray-900/40",onClick:w=>{w.stopPropagation(),c()},title:m("tooltips.cancel"),children:s.jsx(vt,{className:"h-3 w-3 text-gray-600 dark:text-gray-400"})})]}):s.jsxs(s.Fragment,{children:[s.jsx("button",{className:"flex h-6 w-6 items-center justify-center rounded bg-gray-50 hover:bg-gray-100 dark:bg-gray-900/20 dark:hover:bg-gray-900/40",onClick:w=>{w.stopPropagation(),l(t.id,f.sessionName)},title:m("tooltips.editSessionName"),children:s.jsx(bI,{className:"h-3 w-3 text-gray-600 dark:text-gray-400"})}),!f.isCursorSession&&s.jsx("button",{className:"flex h-6 w-6 items-center justify-center rounded bg-red-50 hover:bg-red-100 dark:bg-red-900/20 dark:hover:bg-red-900/40",onClick:w=>{w.stopPropagation(),y()},title:m("tooltips.deleteSession"),children:s.jsx(Qt,{className:"h-3 w-3 text-red-600 dark:text-red-400"})})]})})]})]})}function A8(){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 I8({project:e,isExpanded:t,sessions:r,selectedSession:n,initialSessionsLoaded:a,isLoadingSessions:i,currentTime:o,editingSession:l,editingSessionName:c,onEditingSessionNameChange:u,onStartEditingSession:d,onCancelEditingSession:p,onSaveEditingSession:h,onProjectSelect:m,onSessionSelect:f,onDeleteSession:g,onLoadMoreSessions:v,onNewSession:x,t:y}){if(!t)return null;const w=r.length>0,N=e.sessionMeta?.hasMore===!0;return s.jsxs("div",{className:"ml-3 space-y-1 border-l border-border pl-3",children:[a?!w&&!i?s.jsx("div",{className:"px-3 py-2 text-left",children:s.jsx("p",{className:"text-xs text-muted-foreground",children:y("sessions.noSessions")})}):r.map(S=>s.jsx(T8,{project:e,session:S,selectedSession:n,currentTime:o,editingSession:l,editingSessionName:c,onEditingSessionNameChange:u,onStartEditingSession:d,onCancelEditingSession:p,onSaveEditingSession:h,onProjectSelect:m,onSessionSelect:f,onDeleteSession:g,t:y},S.id)):s.jsx(A8,{}),w&&N&&s.jsx(Fe,{variant:"ghost",size:"sm",className:"mt-2 w-full justify-center gap-2 text-muted-foreground",onClick:()=>v(e),disabled:i,children:i?s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"h-3 w-3 animate-spin rounded-full border border-muted-foreground border-t-transparent"}),y("sessions.loading")]}):s.jsxs(s.Fragment,{children:[s.jsx(mr,{className:"h-3 w-3"}),y("sessions.showMore")]})}),s.jsx("div",{className:"px-3 pb-2 md:hidden",children:s.jsxs("button",{className:"flex h-8 w-full items-center justify-center gap-2 rounded-md bg-primary text-xs font-medium text-primary-foreground transition-all duration-150 hover:bg-primary/90 active:scale-[0.98]",onClick:()=>{m(e),x(e)},children:[s.jsx(Wt,{className:"h-3 w-3"}),y("sessions.newSession")]})}),s.jsxs(Fe,{variant:"default",size:"sm",className:"mt-1 hidden h-8 w-full justify-start gap-2 bg-primary text-xs font-medium text-primary-foreground transition-colors hover:bg-primary/90 md:flex",onClick:()=>x(e),children:[s.jsx(Wt,{className:"h-3 w-3"}),y("sessions.newSession")]})]})}const _8=(e,t)=>{const r=e.length;return t&&r>=5?`${r}+`:`${r}`};function R8({project:e,selectedProject:t,selectedSession:r,isExpanded:n,isDeleting:a,isStarred:i,editingProject:o,editingName:l,sessions:c,initialSessionsLoaded:u,isLoadingSessions:d,currentTime:p,editingSession:h,editingSessionName:m,tasksEnabled:f,mcpServerStatus:g,onEditingNameChange:v,onToggleProject:x,onProjectSelect:y,onToggleStarProject:w,onStartEditingProject:N,onCancelEditingProject:S,onSaveProjectName:k,onDeleteProject:T,onSessionSelect:j,onDeleteSession:I,onLoadMoreSessions:A,onNewSession:D,onEditingSessionNameChange:_,onStartEditingSession:M,onCancelEditingSession:E,onSaveEditingSession:G,t:J}){const W=t?.name===e.name,U=o===e.name,H=e.sessionMeta?.hasMore===!0,P=_8(c,H),V=`${P} session${c.length===1?"":"s"}`,B=R7(e,g),L=()=>x(e.name),X=()=>w(e.name),re=()=>{k(e.name)},we=()=>{t?.name!==e.name&&y(e),L()};return s.jsxs("div",{className:Le("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:Le("p-3 mx-3 my-1 rounded-lg bg-card border border-border/50 active:scale-[0.98] transition-all duration-150",W&&"bg-primary/5 border-primary/20",i&&!W&&"bg-yellow-50/50 dark:bg-yellow-900/5 border-yellow-200/30 dark:border-yellow-800/30"),onClick:L,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:Le("w-8 h-8 rounded-lg flex items-center justify-center transition-colors",n?"bg-primary/10":"bg-muted"),children:n?s.jsx(On,{className:"h-4 w-4 text-primary"}):s.jsx(Sr,{className:"h-4 w-4 text-muted-foreground"})}),s.jsx("div",{className:"min-w-0 flex-1",children:U?s.jsx("input",{type:"text",value:l,onChange:ie=>v(ie.target.value),className:"w-full rounded-lg border-2 border-primary/40 bg-background px-3 py-2 text-sm text-foreground shadow-sm transition-all duration-200 focus:border-primary focus:shadow-md focus:outline-none",placeholder:J("projects.projectNamePlaceholder"),autoFocus:!0,autoComplete:"off",onClick:ie=>ie.stopPropagation(),onKeyDown:ie=>{ie.key==="Enter"&&re(),ie.key==="Escape"&&S()},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(C8,{status:B,size:"xs",className:"ml-2 hidden flex-shrink-0 md:inline-flex"})]}),s.jsx("p",{className:"text-xs text-muted-foreground",children:V})]})})]}),s.jsx("div",{className:"flex items-center gap-1",children:U?s.jsxs(s.Fragment,{children:[s.jsx("button",{className:"flex h-8 w-8 items-center justify-center rounded-lg bg-green-500 shadow-sm transition-all duration-150 active:scale-90 active:shadow-none dark:bg-green-600",onClick:ie=>{ie.stopPropagation(),re()},children:s.jsx(lr,{className:"h-4 w-4 text-white"})}),s.jsx("button",{className:"flex h-8 w-8 items-center justify-center rounded-lg bg-gray-500 shadow-sm transition-all duration-150 active:scale-90 active:shadow-none dark:bg-gray-600",onClick:ie=>{ie.stopPropagation(),S()},children:s.jsx(vt,{className:"h-4 w-4 text-white"})})]}):s.jsxs(s.Fragment,{children:[s.jsx("button",{className:Le("w-8 h-8 rounded-lg flex items-center justify-center active:scale-90 transition-all duration-150 border",i?"bg-yellow-500/10 dark:bg-yellow-900/30 border-yellow-200 dark:border-yellow-800":"bg-gray-500/10 dark:bg-gray-900/30 border-gray-200 dark:border-gray-800"),onClick:ie=>{ie.stopPropagation(),X()},title:J(i?"tooltips.removeFromFavorites":"tooltips.addToFavorites"),children:s.jsx($g,{className:Le("w-4 h-4 transition-colors",i?"text-yellow-600 dark:text-yellow-400 fill-current":"text-gray-600 dark:text-gray-400")})}),s.jsx("button",{className:"flex h-8 w-8 items-center justify-center rounded-lg border border-red-200 bg-red-500/10 active:scale-90 dark:border-red-800 dark:bg-red-900/30",onClick:ie=>{ie.stopPropagation(),T(e)},children:s.jsx(Qt,{className:"h-4 w-4 text-red-600 dark:text-red-400"})}),s.jsx("button",{className:"flex h-8 w-8 items-center justify-center rounded-lg border border-primary/20 bg-primary/10 active:scale-90 dark:border-primary/30 dark:bg-primary/20",onClick:ie=>{ie.stopPropagation(),N(e)},children:s.jsx(Pi,{className:"h-4 w-4 text-primary"})}),s.jsx("div",{className:"flex h-6 w-6 items-center justify-center rounded-md bg-muted/30",children:n?s.jsx(mr,{className:"h-3 w-3 text-muted-foreground"}):s.jsx(Or,{className:"h-3 w-3 text-muted-foreground"})})]})})]})})}),s.jsxs(Fe,{variant:"ghost",className:Le("hidden md:flex w-full justify-between p-2 h-auto font-normal hover:bg-accent/50",W&&"bg-accent text-accent-foreground",i&&!W&&"bg-yellow-50/50 dark:bg-yellow-900/10 hover:bg-yellow-100/50 dark:hover:bg-yellow-900/20"),onClick:we,children:[s.jsxs("div",{className:"flex min-w-0 flex-1 items-center gap-3",children:[n?s.jsx(On,{className:"h-4 w-4 flex-shrink-0 text-primary"}):s.jsx(Sr,{className:"h-4 w-4 flex-shrink-0 text-muted-foreground"}),s.jsx("div",{className:"min-w-0 flex-1 text-left",children:U?s.jsxs("div",{className:"space-y-1",children:[s.jsx("input",{type:"text",value:l,onChange:ie=>v(ie.target.value),className:"w-full rounded border border-border bg-background px-2 py-1 text-sm text-foreground focus:ring-2 focus:ring-primary/20",placeholder:J("projects.projectNamePlaceholder"),autoFocus:!0,onKeyDown:ie=>{ie.key==="Enter"&&re(),ie.key==="Escape"&&S()}}),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:[P,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:U?s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"flex h-6 w-6 cursor-pointer items-center justify-center rounded text-green-600 transition-colors hover:bg-green-50 hover:text-green-700 dark:hover:bg-green-900/20",onClick:ie=>{ie.stopPropagation(),re()},children:s.jsx(lr,{className:"h-3 w-3"})}),s.jsx("div",{className:"flex h-6 w-6 cursor-pointer items-center justify-center rounded text-gray-500 transition-colors hover:bg-gray-50 hover:text-gray-700 dark:hover:bg-gray-800",onClick:ie=>{ie.stopPropagation(),S()},children:s.jsx(vt,{className:"h-3 w-3"})})]}):s.jsxs(s.Fragment,{children:[s.jsx("div",{className:Le("w-6 h-6 opacity-0 group-hover:opacity-100 transition-all duration-200 flex items-center justify-center rounded cursor-pointer touch:opacity-100",i?"hover:bg-yellow-50 dark:hover:bg-yellow-900/20 opacity-100":"hover:bg-accent"),onClick:ie=>{ie.stopPropagation(),X()},title:J(i?"tooltips.removeFromFavorites":"tooltips.addToFavorites"),children:s.jsx($g,{className:Le("w-3 h-3 transition-colors",i?"text-yellow-600 dark:text-yellow-400 fill-current":"text-muted-foreground")})}),s.jsx("div",{className:"touch:opacity-100 flex h-6 w-6 cursor-pointer items-center justify-center rounded opacity-0 transition-all duration-200 hover:bg-accent group-hover:opacity-100",onClick:ie=>{ie.stopPropagation(),N(e)},title:J("tooltips.renameProject"),children:s.jsx(Pi,{className:"h-3 w-3"})}),s.jsx("div",{className:"touch:opacity-100 flex h-6 w-6 cursor-pointer items-center justify-center rounded opacity-0 transition-all duration-200 hover:bg-red-50 group-hover:opacity-100 dark:hover:bg-red-900/20",onClick:ie=>{ie.stopPropagation(),T(e)},title:J("tooltips.deleteProject"),children:s.jsx(Qt,{className:"h-3 w-3 text-red-600 dark:text-red-400"})}),n?s.jsx(mr,{className:"h-4 w-4 text-muted-foreground transition-colors group-hover:text-foreground"}):s.jsx(Or,{className:"h-4 w-4 text-muted-foreground transition-colors group-hover:text-foreground"})]})})]})]}),s.jsx(I8,{project:e,isExpanded:n,sessions:c,selectedSession:r,initialSessionsLoaded:u,isLoadingSessions:d,currentTime:p,editingSession:h,editingSessionName:m,onEditingSessionNameChange:_,onStartEditingSession:M,onCancelEditingSession:E,onSaveEditingSession:G,onProjectSelect:y,onSessionSelect:j,onDeleteSession:I,onLoadMoreSessions:A,onNewSession:D,t:J})]})}function j8({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(Sr,{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(Ln,{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 O8({projects:e,filteredProjects:t,selectedProject:r,selectedSession:n,isLoading:a,loadingProgress:i,expandedProjects:o,editingProject:l,editingName:c,loadingSessions:u,initialSessionsLoaded:d,currentTime:p,editingSession:h,editingSessionName:m,deletingProjects:f,tasksEnabled:g,mcpServerStatus:v,getProjectSessions:x,isProjectStarred:y,onEditingNameChange:w,onToggleProject:N,onProjectSelect:S,onToggleStarProject:k,onStartEditingProject:T,onCancelEditingProject:j,onSaveProjectName:I,onDeleteProject:A,onSessionSelect:D,onDeleteSession:_,onLoadMoreSessions:M,onNewSession:E,onEditingSessionNameChange:G,onStartEditingSession:J,onCancelEditingSession:W,onSaveEditingSession:U,t:H}){const P=s.jsx(j8,{isLoading:a,loadingProgress:i,projectsCount:e.length,filteredProjectsCount:t.length,t:H});b.useEffect(()=>{let B="CloudCLI UI";const L=r?.displayName?.trim();L&&(B=`${L} - ${B}`),document.title=B},[r]);const V=!a&&e.length>0&&t.length>0;return s.jsx("div",{className:"pb-safe-area-inset-bottom md:space-y-1",children:V?t.map(B=>s.jsx(R8,{project:B,selectedProject:r,selectedSession:n,isExpanded:o.has(B.name),isDeleting:f.has(B.name),isStarred:y(B.name),editingProject:l,editingName:c,sessions:x(B),initialSessionsLoaded:d.has(B.name),isLoadingSessions:!!u[B.name],currentTime:p,editingSession:h,editingSessionName:m,tasksEnabled:g,mcpServerStatus:v,onEditingNameChange:w,onToggleProject:N,onProjectSelect:S,onToggleStarProject:k,onStartEditingProject:T,onCancelEditingProject:j,onSaveProjectName:I,onDeleteProject:A,onSessionSelect:D,onDeleteSession:_,onLoadMoreSessions:M,onNewSession:E,onEditingSessionNameChange:G,onStartEditingSession:J,onCancelEditingSession:W,onSaveEditingSession:U,t:H},B.name)):P})}function D8({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 L8({isPWA:e,isMobile:t,isLoading:r,projects:n,searchFilter:a,onSearchFilterChange:i,onClearSearchFilter:o,searchMode:l,onSearchModeChange:c,conversationResults:u,isSearching:d,searchProgress:p,onConversationResultClick:h,onRefresh:m,isRefreshing:f,onCreateProject:g,onCollapseSidebar:v,updateAvailable:x,releaseInfo:y,latestVersion:w,onShowVersionModal:N,onShowSettings:S,projectListProps:k,t:T}){const j=l==="conversations"&&a.trim().length>=2,I=u&&u.results.length>0;return s.jsxs("div",{className:"flex h-full flex-col bg-background/80 backdrop-blur-sm md:w-72 md:select-none",style:{},children:[s.jsx(S8,{isPWA:e,isMobile:t,isLoading:r,projectsCount:n.length,searchFilter:a,onSearchFilterChange:i,onClearSearchFilter:o,searchMode:l,onSearchModeChange:c,onRefresh:m,isRefreshing:f,onCreateProject:g,onCollapseSidebar:v,t:T}),s.jsx(sf,{className:"flex-1 overflow-y-auto overscroll-contain md:px-1.5 md:py-2",children:j?d&&!I?s.jsxs("div",{className:"px-4 py-12 text-center md:py-8",children:[s.jsx("div",{className:"mx-auto mb-4 flex h-12 w-12 items-center justify-center rounded-lg bg-muted md:mb-3",children:s.jsx("div",{className:"h-6 w-6 animate-spin rounded-full border-2 border-muted-foreground border-t-transparent"})}),s.jsx("p",{className:"text-sm text-muted-foreground",children:T("search.searching")}),p&&s.jsxs("p",{className:"mt-1 text-xs text-muted-foreground/60",children:[T("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(Ln,{className:"h-6 w-6 text-muted-foreground"})}),s.jsx("h3",{className:"mb-2 text-base font-medium text-foreground md:mb-1",children:T("search.noResults")}),s.jsx("p",{className:"text-sm text-muted-foreground",children:T("search.tryDifferentQuery")})]}):I?s.jsxs("div",{className:"space-y-3 px-2",children:[s.jsxs("div",{className:"flex items-center justify-between px-1",children:[s.jsx("p",{className:"text-xs text-muted-foreground",children:T("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(A=>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(Sr,{className:"h-3 w-3 flex-shrink-0 text-muted-foreground"}),s.jsx("span",{className:"truncate text-xs font-medium text-foreground",children:A.projectDisplayName})]}),A.sessions.map(D=>s.jsxs("button",{className:"w-full rounded-md px-2 py-2 text-left transition-colors hover:bg-accent/50",onClick:()=>h(A.projectName,D.sessionId,D.provider||D.matches[0]?.provider||"claude",D.matches[0]?.timestamp,D.matches[0]?.snippet),children:[s.jsxs("div",{className:"mb-1 flex items-center gap-1.5",children:[s.jsx(Dn,{className:"h-3 w-3 flex-shrink-0 text-primary"}),s.jsx("span",{className:"truncate text-xs font-medium text-foreground",children:D.sessionSummary}),D.provider&&D.provider!=="claude"&&s.jsx("span",{className:"flex-shrink-0 rounded bg-muted px-1 py-0.5 text-[9px] uppercase text-muted-foreground",children:D.provider})]}),s.jsx("div",{className:"space-y-1 pl-4",children:D.matches.map((_,M)=>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:_.role==="user"?"U":"A"}),s.jsx(D8,{snippet:_.snippet,highlights:_.highlights})]},M))})]},`${A.projectName}-${D.sessionId}`))]},A.projectName))]}):null:s.jsx(O8,{...k})}),s.jsx(k8,{updateAvailable:x,releaseInfo:y,latestVersion:w,onShowVersionModal:N,onShowSettings:S,t:T})]})}const M8={fontSize:"14"},cs={authenticated:!1,email:null,loading:!0,error:null},cb={name:"",type:"stdio",scope:"user",projectPath:"",config:{command:"",args:[],env:{},url:"",headers:{},timeout:3e4},importMode:"form",jsonInput:""},ub={name:"",type:"stdio",config:{command:"",args:[],env:{}}},P8={allowedCommands:[],disallowedCommands:[],skipPermissions:!1},F8={claude:"/api/cli/claude/status",cursor:"/api/cli/cursor/status",codex:"/api/cli/codex/status",gemini:"/api/cli/gemini/status"},yE=e=>e==="sse"||e==="http"?e:"stdio",B8=e=>e==="local"?"local":"user",z8=e=>e instanceof Error?e.message:"Unknown error",$8=e=>({name:e.name||"",type:yE(e.type),scope:B8(e.scope),projectPath:e.projectPath||"",config:{command:e.config?.command||"",args:e.config?.args||[],env:e.config?.env||{},url:e.config?.url||"",headers:e.config?.headers||{},timeout:e.config?.timeout||3e4},importMode:"form",jsonInput:"",raw:e.raw});function U8({isOpen:e,editingServer:t,projects:r,onClose:n,onSubmit:a}){const{t:i}=Me("settings"),[o,l]=b.useState(cb),[c,u]=b.useState(""),[d,p]=b.useState(!1),h=!!t;b.useEffect(()=>{if(e){if(u(""),t){l($8(t));return}l(cb)}},[t,e]);const m=b.useMemo(()=>o.name.trim()?o.importMode==="json"?!!o.jsonInput.trim()&&!c:o.scope==="local"&&!o.projectPath.trim()?!1:o.type==="stdio"?!!o.config.command.trim():!!o.config.url.trim():!1,[o,c]);if(!e)return null;const f=(x,y)=>{l(w=>({...w,config:{...w.config,[x]:y}}))},g=x=>{if(!x.trim()){u("");return}try{const y=JSON.parse(x);y.type?y.type==="stdio"&&!y.command?u(i("mcpForm.validation.stdioRequiresCommand")):(y.type==="http"||y.type==="sse")&&!y.url?u(i("mcpForm.validation.httpRequiresUrl",{type:y.type})):u(""):u(i("mcpForm.validation.missingType"))}catch{u(i("mcpForm.validation.invalidJson"))}},v=async x=>{x.preventDefault(),p(!0);try{await a(o,t)}catch(y){alert(`Error: ${z8(y)}`)}finally{p(!1)}};return s.jsx("div",{className:"fixed inset-0 z-[110] flex items-center justify-center bg-black/50 p-4",children:s.jsxs("div",{className:"max-h-[90vh] w-full max-w-2xl overflow-y-auto rounded-lg border border-border bg-background",children:[s.jsxs("div",{className:"flex items-center justify-between border-b border-border p-4",children:[s.jsx("h3",{className:"text-lg font-medium text-foreground",children:i(h?"mcpForm.title.edit":"mcpForm.title.add")}),s.jsx(Fe,{variant:"ghost",size:"sm",onClick:n,children:s.jsx(vt,{className:"h-4 w-4"})})]}),s.jsxs("form",{onSubmit:v,className:"space-y-4 p-4",children:[!h&&s.jsxs("div",{className:"mb-4 flex gap-2",children:[s.jsx("button",{type:"button",onClick:()=>l(x=>({...x,importMode:"form"})),className:`rounded-lg px-4 py-2 font-medium transition-colors ${o.importMode==="form"?"bg-blue-600 text-white":"bg-gray-100 text-gray-700 hover:bg-gray-200 dark:bg-gray-800 dark:text-gray-300 dark:hover:bg-gray-700"}`,children:i("mcpForm.importMode.form")}),s.jsx("button",{type:"button",onClick:()=>l(x=>({...x,importMode:"json"})),className:`rounded-lg px-4 py-2 font-medium transition-colors ${o.importMode==="json"?"bg-blue-600 text-white":"bg-gray-100 text-gray-700 hover:bg-gray-200 dark:bg-gray-800 dark:text-gray-300 dark:hover:bg-gray-700"}`,children:i("mcpForm.importMode.json")})]}),o.importMode==="form"&&h&&s.jsxs("div",{className:"rounded-lg border border-gray-200 bg-gray-50 p-3 dark:border-gray-700 dark:bg-gray-900/50",children:[s.jsx("label",{className:"mb-2 block text-sm font-medium text-foreground",children:i("mcpForm.scope.label")}),s.jsxs("div",{className:"flex items-center gap-2",children:[o.scope==="user"?s.jsx(Ua,{className:"h-4 w-4"}):s.jsx(On,{className:"h-4 w-4"}),s.jsx("span",{className:"text-sm",children:o.scope==="user"?i("mcpForm.scope.userGlobal"):i("mcpForm.scope.projectLocal")}),o.scope==="local"&&o.projectPath&&s.jsxs("span",{className:"text-xs text-muted-foreground",children:["- ",o.projectPath]})]}),s.jsx("p",{className:"mt-2 text-xs text-muted-foreground",children:i("mcpForm.scope.cannotChange")})]}),o.importMode==="form"&&!h&&s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{children:[s.jsxs("label",{className:"mb-2 block text-sm font-medium text-foreground",children:[i("mcpForm.scope.label")," *"]}),s.jsxs("div",{className:"flex gap-2",children:[s.jsx("button",{type:"button",onClick:()=>l(x=>({...x,scope:"user",projectPath:""})),className:`flex-1 rounded-lg px-4 py-2 font-medium transition-colors ${o.scope==="user"?"bg-blue-600 text-white":"bg-gray-100 text-gray-700 hover:bg-gray-200 dark:bg-gray-800 dark:text-gray-300 dark:hover:bg-gray-700"}`,children:s.jsxs("div",{className:"flex items-center justify-center gap-2",children:[s.jsx(Ua,{className:"h-4 w-4"}),s.jsx("span",{children:i("mcpForm.scope.userGlobal")})]})}),s.jsx("button",{type:"button",onClick:()=>l(x=>({...x,scope:"local"})),className:`flex-1 rounded-lg px-4 py-2 font-medium transition-colors ${o.scope==="local"?"bg-blue-600 text-white":"bg-gray-100 text-gray-700 hover:bg-gray-200 dark:bg-gray-800 dark:text-gray-300 dark:hover:bg-gray-700"}`,children:s.jsxs("div",{className:"flex items-center justify-center gap-2",children:[s.jsx(On,{className:"h-4 w-4"}),s.jsx("span",{children:i("mcpForm.scope.projectLocal")})]})})]}),s.jsx("p",{className:"mt-2 text-xs text-muted-foreground",children:o.scope==="user"?i("mcpForm.scope.userDescription"):i("mcpForm.scope.projectDescription")})]}),o.scope==="local"&&s.jsxs("div",{children:[s.jsxs("label",{className:"mb-2 block text-sm font-medium text-foreground",children:[i("mcpForm.fields.selectProject")," *"]}),s.jsxs("select",{value:o.projectPath,onChange:x=>{l(y=>({...y,projectPath:x.target.value}))},className:"w-full rounded-lg border border-gray-300 bg-gray-50 px-3 py-2 text-gray-900 focus:border-blue-500 focus:ring-blue-500 dark:border-gray-600 dark:bg-gray-800 dark:text-gray-100",required:!0,children:[s.jsxs("option",{value:"",children:[i("mcpForm.fields.selectProject"),"..."]}),r.map(x=>s.jsx("option",{value:x.path||x.fullPath,children:x.displayName||x.name},x.name))]}),o.projectPath&&s.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:i("mcpForm.projectPath",{path:o.projectPath})})]})]}),s.jsxs("div",{className:"grid grid-cols-1 gap-4 md:grid-cols-2",children:[s.jsxs("div",{className:o.importMode==="json"?"md:col-span-2":"",children:[s.jsxs("label",{className:"mb-2 block text-sm font-medium text-foreground",children:[i("mcpForm.fields.serverName")," *"]}),s.jsx(At,{value:o.name,onChange:x=>l(y=>({...y,name:x.target.value})),placeholder:i("mcpForm.placeholders.serverName"),required:!0})]}),o.importMode==="form"&&s.jsxs("div",{children:[s.jsxs("label",{className:"mb-2 block text-sm font-medium text-foreground",children:[i("mcpForm.fields.transportType")," *"]}),s.jsxs("select",{value:o.type,onChange:x=>{l(y=>({...y,type:yE(x.target.value)}))},className:"w-full rounded-lg border border-gray-300 bg-gray-50 px-3 py-2 text-gray-900 focus:border-blue-500 focus:ring-blue-500 dark:border-gray-600 dark:bg-gray-800 dark:text-gray-100",children:[s.jsx("option",{value:"stdio",children:"stdio"}),s.jsx("option",{value:"sse",children:"SSE"}),s.jsx("option",{value:"http",children:"HTTP"})]})]})]}),h&&!!o.raw&&o.importMode==="form"&&s.jsxs("div",{className:"rounded-lg border border-gray-200 bg-gray-50 p-4 dark:border-gray-700 dark:bg-gray-900/50",children:[s.jsx("h4",{className:"mb-2 text-sm font-medium text-foreground",children:i("mcpForm.configDetails",{configFile:t?.scope==="global"?"~/.claude.json":"project config"})}),s.jsx("pre",{className:"overflow-x-auto rounded bg-gray-100 p-3 text-xs dark:bg-gray-800",children:JSON.stringify(o.raw,null,2)})]}),o.importMode==="json"&&s.jsx("div",{className:"space-y-4",children:s.jsxs("div",{children:[s.jsxs("label",{className:"mb-2 block text-sm font-medium text-foreground",children:[i("mcpForm.fields.jsonConfig")," *"]}),s.jsx("textarea",{value:o.jsonInput,onChange:x=>{const y=x.target.value;l(w=>({...w,jsonInput:y})),g(y)},className:`w-full border px-3 py-2 ${c?"border-red-500":"border-gray-300 dark:border-gray-600"} rounded-lg bg-gray-50 font-mono text-sm text-gray-900 focus:border-blue-500 focus:ring-blue-500 dark:bg-gray-800 dark:text-gray-100`,rows:8,placeholder:`{
650
650
  "type": "stdio",
651
651
  "command": "/path/to/server",
652
652
  "args": ["--api-key", "abc123"],
package/dist/index.html CHANGED
@@ -25,7 +25,7 @@
25
25
 
26
26
  <!-- Prevent zoom on iOS -->
27
27
  <meta name="format-detection" content="telephone=no" />
28
- <script type="module" crossorigin src="/assets/index-D6EffcRY.js"></script>
28
+ <script type="module" crossorigin src="/assets/index-DF_FFT3b.js"></script>
29
29
  <link rel="modulepreload" crossorigin href="/assets/vendor-react-CdSTmIF1.js">
30
30
  <link rel="modulepreload" crossorigin href="/assets/vendor-codemirror-C8f1vU1x.js">
31
31
  <link rel="modulepreload" crossorigin href="/assets/vendor-xterm-CJZjLICi.js">
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@siteboon/claude-code-ui",
3
- "version": "1.25.1",
3
+ "version": "1.25.2",
4
4
  "description": "A web-based UI for Claude Code CLI",
5
5
  "type": "module",
6
6
  "main": "server/index.js",