@siteboon/claude-code-ui 1.23.0 → 1.23.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.
@@ -601,7 +601,7 @@ import{j as s,_ as gC,a as bC,m as t4,E as wr,R as r4,o as n4,T as a4,P as i4,S
601
601
  .xterm-screen:focus {
602
602
  outline: none !important;
603
603
  }
604
- `;function K7(){if(typeof document>"u"||document.getElementById(Dg))return;const e=document.createElement("style");e.id=Dg,e.type="text/css",e.innerText=V7,document.head.appendChild(e)}function Y7({terminalContainerRef:e,terminalRef:t,fitAddonRef:r,wsRef:n,selectedProject:a,minimal:i,isRestarting:o,initialCommandRef:l,isPlainShellRef:c,authUrlRef:u,copyAuthUrlToClipboard:p,closeSocket:d}){const[h,m]=x.useState(!1),f=x.useRef(null),g=a?.fullPath||a?.path||"",v=!!a;x.useEffect(()=>{K7()},[]);const b=x.useCallback(()=>{t.current&&(t.current.clear(),t.current.write("\x1B[2J\x1B[H"))},[t]),y=x.useCallback(()=>{t.current&&(t.current.dispose(),t.current=null),r.current=null,m(!1)},[r,t]);return x.useEffect(()=>{if(!e.current||!v||o||t.current)return;const k=new G7.Terminal(O7);t.current=k;const E=new z7.FitAddon;r.current=E,k.loadAddon(E),i||k.loadAddon(new $7.WebLinksAddon);try{k.loadAddon(new q7.WebglAddon)}catch{console.warn("[Shell] WebGL renderer unavailable, using Canvas fallback")}k.open(e.current),k.attachCustomKeyEventHandler(S=>{const j=_4(l.current)?A4:u.current;return S.type==="keydown"&&i&&c.current&&j&&!S.ctrlKey&&!S.metaKey&&!S.altKey&&S.key?.toLowerCase()==="c"?(S.preventDefault(),S.stopPropagation(),p(j),!1):S.type==="keydown"&&(S.ctrlKey||S.metaKey)&&S.key?.toLowerCase()==="c"&&k.hasSelection()?(S.preventDefault(),S.stopPropagation(),document.execCommand("copy"),!1):S.type==="keydown"&&(S.ctrlKey||S.metaKey)&&S.key?.toLowerCase()==="v"?(S.preventDefault(),S.stopPropagation(),typeof navigator<"u"&&navigator.clipboard?.readText&&navigator.clipboard.readText().then(I=>{Vn(n.current,{type:"input",data:I})}).catch(()=>{}),!1):!0}),window.setTimeout(()=>{const S=r.current,j=t.current;!S||!j||(S.fit(),Vn(n.current,{type:"resize",cols:j.cols,rows:j.rows}))},I4),m(!0);const T=k.onData(S=>{Vn(n.current,{type:"input",data:S})}),w=new ResizeObserver(()=>{f.current!==null&&window.clearTimeout(f.current),f.current=window.setTimeout(()=>{const S=r.current,j=t.current;!S||!j||(S.fit(),Vn(n.current,{type:"resize",cols:j.cols,rows:j.rows}))},T7)});return w.observe(e.current),()=>{w.disconnect(),f.current!==null&&(window.clearTimeout(f.current),f.current=null),T.dispose(),d(),y()}},[u,d,p,y,r,l,c,o,i,v,g,e,t,n]),{isInitialized:h,clearTerminalScreen:b,disposeTerminal:y}}function Z7({selectedProject:e,selectedSession:t,initialCommand:r,isPlainShell:n,minimal:a,autoConnect:i,isRestarting:o,onProcessComplete:l,onOutputRef:c}){const u=x.useRef(null),p=x.useRef(null),d=x.useRef(null),h=x.useRef(null),[m,f]=x.useState(""),[g,v]=x.useState(0),b=x.useRef(e),y=x.useRef(t),k=x.useRef(r),E=x.useRef(n),T=x.useRef(l),w=x.useRef(""),S=x.useRef(t?.id??null);x.useEffect(()=>{b.current=e,y.current=t,k.current=r,E.current=n,T.current=l},[e,t,r,n,l]);const j=x.useCallback(V=>{w.current=V,f(V),v(P=>P+1)},[]),I=x.useCallback(()=>{const V=h.current;V&&((V.readyState===WebSocket.OPEN||V.readyState===WebSocket.CONNECTING)&&V.close(),h.current=null)},[]),A=x.useCallback((V=w.current)=>{if(!V)return!1;const P=window.open(V,"_blank");if(P){try{P.opener=null}catch{}return!0}return!1},[]),L=x.useCallback(async(V=w.current)=>V?Rn(V):!1,[]),{isInitialized:R,clearTerminalScreen:F,disposeTerminal:C}=Y7({terminalContainerRef:u,terminalRef:p,fitAddonRef:d,wsRef:h,selectedProject:e,minimal:a,isRestarting:o,initialCommandRef:k,isPlainShellRef:E,authUrlRef:w,copyAuthUrlToClipboard:L,closeSocket:I}),{isConnected:H,isConnecting:Y,connectToShell:W,disconnectFromShell:q}=B7({wsRef:h,terminalRef:p,fitAddonRef:d,selectedProjectRef:b,selectedSessionRef:y,initialCommandRef:k,isPlainShellRef:E,onProcessCompleteRef:T,isInitialized:R,autoConnect:i,closeSocket:I,clearTerminalScreen:F,setAuthUrl:j,onOutputRef:c});return x.useEffect(()=>{o&&(q(),C())},[q,C,o]),x.useEffect(()=>{e||(q(),C())},[q,C,e]),x.useEffect(()=>{const V=t?.id??null;S.current!==V&&R&&q(),S.current=V},[q,R,t?.id]),{terminalContainerRef:u,terminalRef:p,wsRef:h,isConnected:H,isInitialized:R,isConnecting:Y,authUrl:m,authUrlVersion:g,connectToShell:W,disconnectFromShell:q,openAuthUrlInBrowser:A,copyAuthUrlToClipboard:L}}function X7({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 J7({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 Q7({isConnected:e,isInitialized:t,isRestarting:r,hasSession:n,sessionDisplayNameShort:a,onDisconnect:i,onRestart:o,statusNewSessionText:l,statusInitializingText:c,statusRestartingText:u,disconnectLabel:p,disconnectTitle:d,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:d,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:p})]}),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 eI({terminalContainerRef:e,authUrl:t,authUrlVersion:r,initialCommand:n,isConnected:a,openAuthUrlInBrowser:i,copyAuthUrlToClipboard:o}){const[l,c]=x.useState("idle"),[u,p]=x.useState(!1),d=x.useMemo(()=>H7(n,t),[t,n]);x.useEffect(()=>{c("idle"),p(!1)},[r,d,a]);const h=!!d,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:()=>p(!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:d,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(d)},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(d);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:()=>p(!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 tI=[{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:"↓"}],es=e=>e.preventDefault();function rI({wsRef:e,terminalRef:t,isConnected:r}){const{t:n}=ze("settings"),[a,i]=x.useState(!1),o=x.useRef(null);x.useEffect(()=>()=>{o.current&&clearTimeout(o.current)},[]);const l=x.useCallback(()=>{i(d=>!d)},[]),c=x.useCallback(d=>{d(),document.activeElement instanceof HTMLElement&&document.activeElement.blur(),o.current&&clearTimeout(o.current),o.current=setTimeout(()=>i(!1),50)},[]),u=x.useCallback(d=>{Vn(e.current,{type:"input",data:d})},[e]),p=x.useCallback(()=>{t.current?.scrollToBottom()},[t]);return s.jsxs(s.Fragment,{children:[s.jsx("button",{type:"button",onPointerDown:es,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(Sr,{className:"h-5 w-5 text-gray-600 dark:text-gray-400"}):s.jsx(vo,{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(xA,{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")}),tI.map(d=>s.jsxs("button",{type:"button",onPointerDown:es,onClick:()=>c(()=>u(d.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.${d.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:d.hint})]},d.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:es,onClick:()=>c(p),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(GT,{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:es,onClick:l})]})}function R4({selectedProject:e=null,selectedSession:t=null,initialCommand:r=null,isPlainShell:n=!1,onProcessComplete:a=null,minimal:i=!1,autoConnect:o=!1,isActive:l}){const{t:c}=ze("chat"),[u,p]=x.useState(!1),[d,h]=x.useState(null),m=x.useRef(null),f=x.useRef(null),{terminalContainerRef:g,terminalRef:v,wsRef:b,isConnected:y,isInitialized:k,isConnecting:E,authUrl:T,authUrlVersion:w,connectToShell:S,disconnectFromShell:j,openAuthUrlInBrowser:I,copyAuthUrlToClipboard:A}=Z7({selectedProject:e,selectedSession:t,initialCommand:r,isPlainShell:n,minimal:i,autoConnect:o,isRestarting:u,onProcessComplete:a,onOutputRef:f}),L=x.useCallback(()=>{const U=v.current;if(!U)return;const D=U.buffer.active,ee=D.baseY+D.cursorY,re=Math.min(D.baseY+D.length-1,ee+10),ge=Math.max(0,ee-I7),oe=[];for(let we=ge;we<=re;we++){const De=D.getLine(we);De&&oe.push(De.translateToString().trimEnd())}let fe=-1;for(let we=oe.length-1;we>=0;we--)if(/esc to cancel/i.test(oe[we])||/enter to select/i.test(oe[we])){fe=we;break}if(fe===-1){h(null);return}const K=new Map,ae=Math.max(0,fe-_7);for(let we=fe-1;we>=ae;we--){const De=oe[we].match(/^\s*[❯›>]?\s*(\d+)\.\s+(.+)/);if(De){const O=De[1],ce=De[2].trim();parseInt(O,10)<=R7&&ce.length>0&&!K.has(O)&&K.set(O,ce)}}const ve=[];for(let we=1;we<=K.size&&K.has(String(we));we++)ve.push({number:String(we),label:K.get(String(we))});h(ve.length>=j7?ve:null)},[v]),R=x.useCallback(()=>{m.current&&clearTimeout(m.current),m.current=setTimeout(L,A7)},[L]);x.useEffect(()=>{f.current=R},[R]),x.useEffect(()=>()=>{m.current&&clearTimeout(m.current)},[]),x.useEffect(()=>{y||(m.current&&(clearTimeout(m.current),m.current=null),h(null))},[y]);const F=x.useCallback(U=>{Vn(b.current,{type:"input",data:U})},[b]),C=x.useMemo(()=>W7(t),[t]),H=x.useMemo(()=>C?C.slice(0,30):null,[C]),Y=x.useMemo(()=>C?C.slice(0,50):null,[C]),W=x.useCallback(()=>{p(!0),window.setTimeout(()=>{p(!1)},C7)},[]);if(!e)return s.jsx(J7,{title:c("shell.selectProject.title"),description:c("shell.selectProject.description")});if(i)return s.jsx(eI,{terminalContainerRef:g,authUrl:T,authUrlVersion:w,initialCommand:r,isConnected:y,openAuthUrlInBrowser:I,copyAuthUrlToClipboard:A});const q=n?c("shell.runCommand",{command:r||c("shell.defaultCommand"),projectName:e.displayName}):t?c("shell.resumeSession",{displayName:Y}):c("shell.startSession"),V=n?c("shell.runCommand",{command:r||c("shell.defaultCommand"),projectName:e.displayName}):c("shell.startCli",{projectName:e.displayName}),P=k?E?"connecting":y?null:"connect":"loading",G=P==="connecting"?V:q;return s.jsxs("div",{className:"flex h-full w-full flex-col bg-gray-900",children:[s.jsx(Q7,{isConnected:y,isInitialized:k,isRestarting:u,hasSession:!!t,sessionDisplayNameShort:H,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(X7,{mode:P,description:G,loadingLabel:c("shell.loading"),connectLabel:c("shell.actions.connect"),connectTitle:c("shell.actions.connectTitle"),connectingLabel:c("shell.connecting"),onConnect:S}),d&&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:U=>U.preventDefault(),children:s.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[d.map(U=>s.jsxs("button",{type:"button",onClick:()=>{F(U.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:`${U.number}. ${U.label}`,children:[U.number,". ",U.label]},U.number)),s.jsx("button",{type:"button",onClick:()=>{F("\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(rI,{wsRef:b,terminalRef:v,isConnected:y})]})}function nI({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 aI({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 j4({project:e=null,session:t=null,command:r=null,isPlainShell:n=null,autoConnect:a=!0,onComplete:i=null,onClose:o=null,title:l=null,className:c="",showHeader:u=!0,compact:p=!1,minimal:d=!1}){const[h,m]=x.useState(!1),f=n!==null?n:r!==null,g=x.useCallback(v=>{m(!0),i?.(v)},[i]);return e?s.jsxs("div",{className:`flex h-full w-full flex-col ${c}`,children:[!d&&u&&l&&s.jsx(aI,{title:l,isCompleted:h,onClose:o}),s.jsx("div",{className:"min-h-0 w-full flex-1",children:s.jsx(R4,{selectedProject:e,selectedSession:t,initialCommand:r,isPlainShell:f,onProcessComplete:g,minimal:d,autoConnect:d?!0:a})})]}):s.jsx(nI,{className:c})}const iI=({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"),sI=e=>e==="claude"?"Claude CLI Login":e==="cursor"?"Cursor CLI Login":e==="codex"?"Codex CLI Login":"Gemini CLI Configuration",oI=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 O4({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=iI({provider:r,customCommand:i,isAuthenticated:o,isOnboarding:l}),u=sI(r),p=oI(n),d=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(ft,{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(fA,{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(So,{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(j4,{project:p,command:c,onComplete:d,minimal:!0})})]})})}const lI=({className:e="w-5 h-5"})=>s.jsx("img",{src:"/icons/claude-ai-icon.svg",alt:"Claude",className:e}),cI=({className:e="w-5 h-5"})=>{const{isDarkMode:t}=zi();return s.jsx("img",{src:t?"/icons/codex-white.svg":"/icons/codex.svg",alt:"Codex",className:e})},uI=({className:e="w-5 h-5"})=>{const{isDarkMode:t}=zi();return s.jsx("img",{src:t?"/icons/cursor-white.svg":"/icons/cursor.svg",alt:"Cursor",className:e})},dI=({className:e="w-5 h-5"})=>s.jsx("img",{src:"/icons/gemini-ai-icon.svg",alt:"Gemini",className:e});function gr({provider:e="claude",className:t="w-5 h-5"}){return e==="cursor"?s.jsx(uI,{className:t}):e==="codex"?s.jsx(cI,{className:t}):e==="gemini"?s.jsx(dI,{className:t}):s.jsx(lI,{className:t})}function pI({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(gr,{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(rr,{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 mI=[{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 hI({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:mI.map(r=>s.jsx(pI,{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 fI({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(Gr,{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(k7,{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(NA,{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 Lg=[{title:"Git Configuration",icon:Gr,required:!0},{title:"Connect Agents",icon:N4,required:!1}];function gI({currentStep:e}){return s.jsx("div",{className:"mb-8",children:s.jsx("div",{className:"flex items-center justify-between",children:Lg.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(rr,{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<Lg.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 bI=["claude","cursor","codex","gemini"],Mg=/^[^\s@]+@[^\s@]+\.[^\s@]+$/,xI={name:"default",displayName:"default",fullPath:"",path:""},yI=()=>({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}}),Pg=async(e,t)=>{try{return(await e.json()).error||t}catch{return t}};function vI({onComplete:e}){const[t,r]=x.useState(0),[n,a]=x.useState(""),[i,o]=x.useState(""),[l,c]=x.useState(!1),[u,p]=x.useState(""),[d,h]=x.useState(null),[m,f]=x.useState(yI),g=x.useRef(void 0),v=x.useCallback(async I=>{try{const A=await Le(`/api/cli/${I}/status`);if(!A.ok){f(R=>({...R,[I]:{authenticated:!1,email:null,loading:!1,error:"Failed to check authentication status"}}));return}const L=await A.json();f(R=>({...R,[I]:{authenticated:!!L.authenticated,email:L.email??null,loading:!1,error:L.error??null}}))}catch(A){console.error(`Error checking ${I} auth status:`,A),f(L=>({...L,[I]:{authenticated:!1,email:null,loading:!1,error:A instanceof Error?A.message:"Unknown error"}}))}},[]),b=x.useCallback(async()=>{await Promise.all(bI.map(I=>v(I)))},[v]),y=x.useCallback(async()=>{try{const I=await Le("/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)}},[]);x.useEffect(()=>{y(),b()},[y,b]),x.useEffect(()=>{const I=g.current;g.current=d,(I===void 0||I!==null&&d===null)&&b()},[d,b]);const k=I=>{h(I)},E=I=>{I===0&&d&&v(d)},T=async()=>{if(p(""),t!==0){r(I=>I+1);return}if(!n.trim()||!i.trim()){p("Both git name and email are required.");return}if(!Mg.test(i)){p("Please enter a valid email address.");return}c(!0);try{const I=await Le("/api/user/git-config",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({gitName:n,gitEmail:i})});if(!I.ok){const A=await Pg(I,"Failed to save git configuration");throw new Error(A)}r(A=>A+1)}catch(I){p(I instanceof Error?I.message:"Failed to save git configuration")}finally{c(!1)}},w=()=>{p(""),r(I=>I-1)},S=async()=>{c(!0),p("");try{const I=await Le("/api/user/complete-onboarding",{method:"POST"});if(!I.ok){const A=await Pg(I,"Failed to complete onboarding");throw new Error(A)}await e?.()}catch(I){p(I instanceof Error?I.message:"Failed to complete onboarding")}finally{c(!1)}},j=t===0?!!(n.trim()&&i.trim()&&Mg.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(gI,{currentStep:t}),s.jsxs("div",{className:"rounded-lg border border-border bg-card p-8 shadow-lg",children:[t===0?s.jsx(fI,{gitName:n,gitEmail:i,isSubmitting:l,onGitNameChange:a,onGitEmailChange:o}):s.jsx(hI,{providerStatuses:m,onOpenProviderLogin:k}),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:w,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(vo,{className:"h-4 w-4"}),"Previous"]}),s.jsx("div",{className:"flex items-center gap-3",children:t<1?s.jsx("button",{onClick:T,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(Cn,{className:"h-4 w-4 animate-spin"}),"Saving..."]}):s.jsxs(s.Fragment,{children:["Next",s.jsx(Sr,{className:"h-4 w-4"})]})}):s.jsx("button",{onClick:S,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(Cn,{className:"h-4 w-4 animate-spin"}),"Completing..."]}):s.jsxs(s.Fragment,{children:[s.jsx(rr,{className:"h-4 w-4"}),"Complete Setup"]})})})]})]})]})}),d&&s.jsx(O4,{isOpen:!!d,onClose:()=>h(null),provider:d,project:xI,onComplete:E,isOnboarding:!0})]})}const kI=["0s","0.1s","0.2s"];function wI(){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(Eo,{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:kI.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 D4({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 Si({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 L4({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(Eo,{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 SI={username:"",password:""};function EI(){const{t:e}=ze("auth"),{login:t}=Ui(),[r,n]=x.useState(SI),[a,i]=x.useState(""),[o,l]=x.useState(!1),c=x.useCallback((p,d)=>{n(h=>({...h,[p]:d}))},[]),u=x.useCallback(async p=>{if(p.preventDefault(),i(""),!r.username.trim()||!r.password){i(e("login.errors.requiredFields"));return}l(!0);const d=await t(r.username.trim(),r.password);d.success||i(d.error),l(!1)},[r.password,r.username,t,e]);return s.jsx(L4,{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(Si,{id:"username",label:e("login.username"),value:r.username,onChange:p=>c("username",p),placeholder:e("login.placeholders.username"),isDisabled:o}),s.jsx(Si,{id:"password",label:e("login.password"),value:r.password,onChange:p=>c("password",p),placeholder:e("login.placeholders.password"),isDisabled:o,type:"password"}),s.jsx(D4,{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 NI={username:"",password:"",confirmPassword:""};function CI(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 TI(){const{register:e}=Ui(),[t,r]=x.useState(NI),[n,a]=x.useState(""),[i,o]=x.useState(!1),l=x.useCallback((u,p)=>{r(d=>({...d,[u]:p}))},[]),c=x.useCallback(async u=>{u.preventDefault(),a("");const p=CI(t);if(p){a(p);return}o(!0);const d=await e(t.username.trim(),t.password);d.success||a(d.error),o(!1)},[t,e]);return s.jsx(L4,{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(Si,{id:"username",label:"Username",value:t.username,onChange:u=>l("username",u),placeholder:"Enter your username",isDisabled:i}),s.jsx(Si,{id:"password",label:"Password",value:t.password,onChange:u=>l("password",u),placeholder:"Enter your password",isDisabled:i,type:"password"}),s.jsx(Si,{id:"confirmPassword",label:"Confirm Password",value:t.confirmPassword,onChange:u=>l("confirmPassword",u),placeholder:"Confirm your password",isDisabled:i,type:"password"}),s.jsx(D4,{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 AI({children:e}){const{user:t,isLoading:r,needsSetup:n,hasCompletedOnboarding:a,refreshOnboardingStatus:i}=Ui();return r?s.jsx(wI,{}):n?s.jsx(TI,{}):t?a?s.jsx(s.Fragment,{children:e}):s.jsx(vI,{onComplete:i}):s.jsx(EI,{})}const M4=x.createContext(null),P4=()=>{const e=x.useContext(M4);if(!e)throw new Error("useWebSocket must be used within a WebSocketProvider");return e},II=e=>{const t=window.location.protocol==="https:"?"wss:":"ws:";return e?`${t}//${window.location.host}/ws?token=${encodeURIComponent(e)}`:null},_I=()=>{const e=x.useRef(null),t=x.useRef(!1),[r,n]=x.useState(null),[a,i]=x.useState(!1),o=x.useRef(null),{token:l}=Ui();x.useEffect(()=>(c(),()=>{t.current=!0,o.current&&clearTimeout(o.current),e.current&&e.current.close()}),[l]);const c=x.useCallback(()=>{if(!t.current)try{const d=II(l);if(!d)return console.warn("No authentication token found for WebSocket connection");const h=new WebSocket(d);h.onopen=()=>{i(!0),e.current=h},h.onmessage=m=>{try{const f=JSON.parse(m.data);n(f)}catch(f){console.error("Error parsing WebSocket message:",f)}},h.onclose=()=>{i(!1),e.current=null,o.current=setTimeout(()=>{t.current||c()},3e3)},h.onerror=m=>{console.error("WebSocket error:",m)}}catch(d){console.error("Error creating WebSocket connection:",d)}},[l]),u=x.useCallback(d=>{const h=e.current;h&&h.readyState===WebSocket.OPEN?h.send(JSON.stringify(d)):console.warn("WebSocket not connected")},[]);return x.useMemo(()=>({ws:e.current,sendMessage:u,latestMessage:r,isConnected:a}),[u,r,a])},RI=({children:e})=>{const t=_I();return s.jsx(M4.Provider,{value:t,children:e})},F4=x.createContext(null);function jI(e,t){return{message:t instanceof Error?t.message:`Failed to ${e}`,context:e,timestamp:new Date().toISOString()}}function Fg(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 OI(e){return e.find(t=>t.status==="pending"||t.status==="in-progress")??null}function DI(e){return e?.type?e.type.startsWith("taskmaster-"):!1}function Fa(){const e=x.useContext(F4);if(!e)throw new Error("useTaskMaster must be used within a TaskMasterProvider");return e}function LI({children:e}){const{latestMessage:t}=P4(),{user:r,token:n,isLoading:a}=Ui(),[i,o]=x.useState([]),[l,c]=x.useState(null),[u,p]=x.useState(null),[d,h]=x.useState(null),[m,f]=x.useState([]),[g,v]=x.useState(null),[b,y]=x.useState(!1),[k,E]=x.useState(!1),[T,w]=x.useState(!1),[S,j]=x.useState(null),I=x.useRef(null);x.useEffect(()=>{I.current=l?.name??null},[l?.name]);const A=x.useCallback(()=>{j(null)},[]),L=x.useCallback((W,q)=>{console.error(`TaskMaster ${W} error:`,q),j(jI(W,q))},[]),R=x.useCallback(W=>{const q=W?Fg(W):null;c(q),p(q?.taskmaster??null),f([]),v(null)},[]),F=x.useCallback(async()=>{if(!r||!n){o([]),c(null),p(null),f([]),v(null);return}try{y(!0),A();const W=await rt.get("/projects");if(!W.ok)throw new Error(`Failed to fetch projects: ${W.status}`);const q=await W.json(),P=(Array.isArray(q)?q:[]).map(D=>Fg(D));o(P);const G=I.current;if(!G)return;const U=P.find(D=>D.name===G)??null;c(U),p(U?.taskmaster??null)}catch(W){L("load projects",W)}finally{y(!1)}},[A,L,n,r]),C=x.useCallback(async()=>{const W=l?.name;if(!W||!r||!n){f([]),v(null);return}try{E(!0),A();const q=await rt.get(`/taskmaster/tasks/${encodeURIComponent(W)}`);if(!q.ok){const G=await q.json();throw new Error(G.message??"Failed to load tasks")}const V=await q.json(),P=Array.isArray(V.tasks)?V.tasks:[];f(P),v(OI(P))}catch(q){L("load tasks",q),f([]),v(null)}finally{E(!1)}},[A,l?.name,L,n,r]),H=x.useCallback(async()=>{if(!r||!n){h(null);return}try{w(!0),A();const W=await rt.get("/mcp-utils/taskmaster-server");if(!W.ok)throw new Error(`Failed to load MCP status: ${W.status}`);const q=await W.json();h(q)}catch(W){L("check MCP server status",W),h(null)}finally{w(!1)}},[A,L,n,r]);x.useEffect(()=>{!a&&r&&n&&(F(),H())},[a,H,F,n,r]),x.useEffect(()=>{l?.name&&r&&n&&C()},[l?.name,C,n,r]),x.useEffect(()=>{const W=t;if(DI(W)){if(W.type==="taskmaster-project-updated"&&W.projectName){F();return}if(W.type==="taskmaster-tasks-updated"&&W.projectName===l?.name){C();return}W.type==="taskmaster-mcp-status-changed"&&H()}},[l?.name,t,H,F,C]);const Y=x.useMemo(()=>({projects:i,currentProject:l,projectTaskMaster:u,mcpServerStatus:d,tasks:m,nextTask:g,isLoading:b,isLoadingTasks:k,isLoadingMCP:T,error:S,refreshProjects:F,setCurrentProject:R,refreshTasks:C,refreshMCPStatus:H,clearError:A}),[A,l,S,b,T,k,d,g,u,i,H,F,C,R,m]);return s.jsx(F4.Provider,{value:Y,children:e})}const B4=x.createContext({tasksEnabled:!0,setTasksEnabled:()=>{},toggleTasksEnabled:()=>{},isTaskMasterInstalled:null,isTaskMasterReady:null,installationStatus:null,isCheckingInstallation:!0}),$i=()=>{const e=x.useContext(B4);if(!e)throw new Error("useTasksSettings must be used within a TasksSettingsProvider");return e},MI=({children:e})=>{const[t,r]=x.useState(()=>{const m=localStorage.getItem("tasks-enabled");return m!==null?JSON.parse(m):!0}),[n,a]=x.useState(null),[i,o]=x.useState(null),[l,c]=x.useState(null),[u,p]=x.useState(!0);x.useEffect(()=>{localStorage.setItem("tasks-enabled",JSON.stringify(t))},[t]),x.useEffect(()=>{setTimeout(async()=>{try{const f=await rt.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{p(!1)}},0)},[]);const h={tasksEnabled:t,setTasksEnabled:r,toggleTasksEnabled:()=>{r(m=>!m)},isTaskMasterInstalled:n,isTaskMasterReady:i,installationStatus:l,isCheckingInstallation:u};return s.jsx(B4.Provider,{value:h,children:e})},Bg=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 Kh(e={}){const{mobileBreakpoint:t=768,trackMobile:r=!0,trackPWA:n=!0}=e,[a,i]=x.useState(()=>r?Bg(t):!1),[o,l]=x.useState(()=>n?zg():!1);return x.useEffect(()=>{if(!r||typeof window>"u")return;const c=()=>{i(Bg(t))};return c(),window.addEventListener("resize",c),()=>{window.removeEventListener("resize",c)}},[t,r]),x.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 Ug="1.23.0",PI=(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},z4=(e,t)=>{const[r,n]=x.useState(!1),[a,i]=x.useState(null),[o,l]=x.useState(null),[c,u]=x.useState("git");return x.useEffect(()=>{(async()=>{try{const h=await(await fetch("/health")).json();(h.installMode==="npm"||h.installMode==="git")&&u(h.installMode)}catch{}})()},[]),x.useEffect(()=>{const p=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(PI(f,Ug)>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)}};p();const d=setInterval(p,300*1e3);return()=>clearInterval(d)},[e,t]),{updateAvailable:r,latestVersion:a,currentVersion:Ug,releaseInfo:o,installMode:c}},Gn={autoExpandTools:!1,showRawParameters:!1,showThinking:!0,autoScrollToBottom:!0,sendByCtrlEnter:!1,sidebarVisible:!0},Ws=Object.keys(Gn),FI=new Set(Ws),Jo="ui-preferences:sync",Vs=(e,t)=>{if(typeof e=="boolean")return e;if(typeof e=="string"){if(e==="true")return!0;if(e==="false")return!1}return t},BI=(e,t)=>{try{const r=localStorage.getItem(e);if(r===null)return t;const n=JSON.parse(r);return Vs(n,t)}catch{return t}},zI=e=>{if(typeof window>"u")return Gn;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 Ws.reduce((a,i)=>(a[i]=Vs(n[i],Gn[i]),a),{...Gn})}}}catch{}return Ws.reduce((t,r)=>(t[r]=BI(r,Gn[r]),t),{...Gn})};function UI(e,t){switch(t.type){case"set":{const{key:r,value:n}=t;if(!FI.has(r))return e;const a=Vs(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 Ws){if(!(i in r))continue;const o=r[i],l=Vs(o,e[i]);a[i]!==l&&(a[i]=l,n=!0)}return n?a:e}case"reset":return{...Gn,...t.value||{}};default:return e}}function Yh(e="uiPreferences"){const t=x.useRef(`ui-preferences-${Math.random().toString(36).slice(2)}`),[r,n]=x.useReducer(UI,e,zI);return x.useEffect(()=>{typeof window>"u"||(localStorage.setItem(e,JSON.stringify(r)),window.dispatchEvent(new CustomEvent(Jo,{detail:{storageKey:e,sourceId:t.current,value:r}})))},[r,e]),x.useEffect(()=>{if(typeof window>"u")return;const l=p=>{!p||typeof p!="object"||Array.isArray(p)||n({type:"set_many",value:p})},c=p=>{if(!(p.key!==e||p.newValue===null))try{const d=JSON.parse(p.newValue);l(d)}catch{}},u=p=>{const h=p.detail;!h||h.storageKey!==e||h.sourceId===t.current||l(h.value)};return window.addEventListener("storage",c),window.addEventListener(Jo,u),()=>{window.removeEventListener("storage",c),window.removeEventListener(Jo,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 $I=()=>{try{const e=localStorage.getItem("claude-settings");return e&&JSON.parse(e).projectSortOrder==="date"?"date":"name"}catch{return"name"}},qI=()=>{try{const e=localStorage.getItem("starredProjects");return e?new Set(JSON.parse(e)):new Set}catch{return new Set}},GI=e=>{try{localStorage.setItem("starredProjects",JSON.stringify([...e]))}catch{}},Ks=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),HI=(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"),WI=e=>e.__provider==="cursor"?String(e.createdAt||""):e.__provider==="codex"?String(e.createdAt||e.lastActivity||""):String(e.lastActivity||e.createdAt||""),VI=(e,t,r)=>{const n=Ks(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:HI(e,r),sessionTime:WI(e),messageCount:Number(e.messageCount||0)}},U4=(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)=>Ks(l).getTime()-Ks(o).getTime())},$g=(e,t)=>{const r=U4(e,t);return r.length===0?new Date(0):r.reduce((n,a)=>{const i=Ks(a);return i>n?i:n},new Date(0))},KI=(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"?$g(o,n).getTime()-$g(i,n).getTime():(i.displayName||i.name).localeCompare(o.displayName||o.name)}),a},YI=(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},ZI=(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"},XI=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 JI({projects:e,selectedProject:t,selectedSession:r,isLoading:n,isMobile:a,t:i,onRefresh:o,onProjectSelect:l,onSessionSelect:c,onSessionDelete:u,onProjectDelete:p,setCurrentProject:d,setSidebarVisible:h,sidebarVisible:m}){const[f,g]=x.useState(new Set),[v,b]=x.useState(null),[y,k]=x.useState(!1),[E,T]=x.useState(""),[w,S]=x.useState({}),[j,I]=x.useState({}),[A,L]=x.useState(new Set),[R,F]=x.useState(new Date),[C,H]=x.useState("name"),[Y,W]=x.useState(!1),[q,V]=x.useState({}),[P,G]=x.useState(null),[U,D]=x.useState(""),[ee,re]=x.useState(""),[ge,oe]=x.useState(new Set),[fe,K]=x.useState(null),[ae,ve]=x.useState(null),[we,De]=x.useState(!1),[O,ce]=x.useState(()=>qI()),Z=!a&&!m;x.useEffect(()=>{const he=setInterval(()=>{F(new Date)},6e4);return()=>clearInterval(he)},[]),x.useEffect(()=>{I({}),L(new Set),V({})},[e]),x.useEffect(()=>{t&&g(he=>{if(he.has(t.name))return he;const Oe=new Set(he);return Oe.add(t.name),Oe})},[r,t]),x.useEffect(()=>{if(e.length>0&&!n){const he=new Set;e.forEach(Oe=>{Oe.sessions&&Oe.sessions.length>=0&&he.add(Oe.name)}),L(he)}},[e,n]),x.useEffect(()=>{const he=()=>{H($I())};he();const Oe=Be=>{Be.key==="claude-settings"&&he()};window.addEventListener("storage",Oe);const Me=setInterval(()=>{document.hasFocus()&&he()},1e3);return()=>{window.removeEventListener("storage",Oe),clearInterval(Me)}},[]);const z=x.useCallback(he=>{g(Oe=>{const Me=new Set;return Oe.has(he)||Me.add(he),Me})},[]),B=x.useCallback((he,Oe)=>{c({...he,__projectName:Oe})},[c]),J=x.useCallback(he=>{ce(Oe=>{const Me=new Set(Oe);return Me.has(he)?Me.delete(he):Me.add(he),GI(Me),Me})},[]),me=x.useCallback(he=>O.has(he),[O]),ye=x.useCallback(he=>U4(he,j),[j]),ie=x.useMemo(()=>e.map(he=>{const Oe=q[he.name];return Oe===void 0?he:{...he,sessionMeta:{...he.sessionMeta,hasMore:Oe}}}),[q,e]),xe=x.useMemo(()=>KI(ie,C,O,j),[j,C,ie,O]),le=x.useMemo(()=>YI(xe,ee),[ee,xe]),se=x.useCallback(he=>{b(he.name),T(he.displayName)},[]),te=x.useCallback(()=>{b(null),T("")},[]),de=x.useCallback(async he=>{try{(await rt.renameProject(he,E)).ok?window.refreshProjects?await window.refreshProjects():window.location.reload():console.error("Failed to rename project")}catch(Oe){console.error("Error renaming project:",Oe)}finally{b(null),T("")}},[E]),be=x.useCallback((he,Oe,Me,Be="claude")=>{ve({projectName:he,sessionId:Oe,sessionTitle:Me,provider:Be})},[]),_e=x.useCallback(async()=>{if(!ae)return;const{projectName:he,sessionId:Oe,provider:Me}=ae;ve(null);try{let Be;if(Me==="codex"?Be=await rt.deleteCodexSession(Oe):Me==="gemini"?Be=await rt.deleteGeminiSession(Oe):Be=await rt.deleteSession(he,Oe),Be.ok)u?.(Oe);else{const pt=await Be.text();console.error("[Sidebar] Failed to delete session:",{status:Be.status,error:pt}),alert(i("messages.deleteSessionFailed"))}}catch(Be){console.error("[Sidebar] Error deleting session:",Be),alert(i("messages.deleteSessionError"))}},[u,ae,i]),$e=x.useCallback(he=>{K({project:he,sessionCount:ye(he).length})},[ye]),Xe=x.useCallback(async()=>{if(!fe)return;const{project:he,sessionCount:Oe}=fe,Me=Oe===0;K(null),oe(Be=>new Set([...Be,he.name]));try{const Be=await rt.deleteProject(he.name,!Me);if(Be.ok)p?.(he.name);else{const pt=await Be.json();alert(pt.error||i("messages.deleteProjectFailed"))}}catch(Be){console.error("Error deleting project:",Be),alert(i("messages.deleteProjectError"))}finally{oe(Be=>{const pt=new Set(Be);return pt.delete(he.name),pt})}},[fe,p,i]),nt=x.useCallback(async he=>{const Oe=q[he.name];if(!(!(Oe!==void 0?Oe:he.sessionMeta?.hasMore===!0)||w[he.name])){S(Be=>({...Be,[he.name]:!0}));try{const Be=(he.sessions?.length||0)+(j[he.name]?.length||0),pt=await rt.sessions(he.name,5,Be);if(!pt.ok)return;const lt=await pt.json();I($t=>({...$t,[he.name]:[...$t[he.name]||[],...lt.sessions||[]]})),lt.hasMore===!1&&V($t=>({...$t,[he.name]:!1}))}catch(Be){console.error("Error loading more sessions:",Be)}finally{S(Be=>({...Be,[he.name]:!1}))}}},[j,w,q]),Ke=x.useCallback(he=>{l(he),d(he)},[l,d]),dt=x.useCallback(async()=>{W(!0);try{await o()}finally{W(!1)}},[o]),st=x.useCallback(async(he,Oe,Me,Be)=>{const pt=Me.trim();if(!pt){G(null),D("");return}try{const lt=await rt.renameSession(Oe,pt,Be);lt.ok?await o():(console.error("[Sidebar] Failed to rename session:",lt.status),alert(i("messages.renameSessionFailed")))}catch(lt){console.error("[Sidebar] Error renaming session:",lt),alert(i("messages.renameSessionError"))}finally{G(null),D("")}},[o,i]),Ae=x.useCallback(()=>{h(!1)},[h]),We=x.useCallback(()=>{h(!0)},[h]);return{isSidebarCollapsed:Z,expandedProjects:f,editingProject:v,showNewProject:y,editingName:E,loadingSessions:w,additionalSessions:j,initialSessionsLoaded:A,currentTime:R,projectSortOrder:C,isRefreshing:Y,editingSession:P,editingSessionName:U,searchFilter:ee,deletingProjects:ge,deleteConfirmation:fe,sessionDeleteConfirmation:ae,showVersionModal:we,starredProjects:O,filteredProjects:le,toggleProject:z,handleSessionClick:B,toggleStarProject:J,isProjectStarred:me,getProjectSessions:ye,startEditing:se,cancelEditing:te,saveProjectName:de,showDeleteSessionConfirmation:be,confirmDeleteSession:_e,requestProjectDelete:$e,confirmDeleteProject:Xe,loadMoreSessions:nt,handleProjectSelect:Ke,refreshProjects:dt,updateSessionSummary:st,collapseSidebar:Ae,expandSidebar:We,setShowNewProject:k,setEditingName:T,setEditingSession:G,setEditingSessionName:D,setSearchFilter:re,setDeleteConfirmation:K,setSessionDeleteConfirmation:ve,setShowVersionModal:De}}const QI="https://discord.gg/buxwujPNRE";function e_({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 t_({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(UA,{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(gt,{className:"h-4 w-4 text-muted-foreground transition-colors group-hover:text-foreground"})}),s.jsx("a",{href:QI,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(e_,{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(Tn,{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 $4(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=$4(e[t]))&&(n&&(n+=" "),n+=r)}else for(r in e)e[r]&&(n&&(n+=" "),n+=r);return n}function q4(){for(var e,t,r=0,n="",a=arguments.length;r<a;r++)(e=arguments[r])&&(t=$4(e))&&(n&&(n+=" "),n+=t);return n}const qg=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,Gg=q4,G4=(e,t)=>r=>{var n;if(t?.variants==null)return Gg(e,r?.class,r?.className);const{variants:a,defaultVariants:i}=t,o=Object.keys(a).map(u=>{const p=r?.[u],d=i?.[u];if(p===null)return null;const h=qg(p)||qg(d);return a[u][h]}),l=r&&Object.entries(r).reduce((u,p)=>{let[d,h]=p;return h===void 0||(u[d]=h),u},{}),c=t==null||(n=t.compoundVariants)===null||n===void 0?void 0:n.reduce((u,p)=>{let{class:d,className:h,...m}=p;return Object.entries(m).every(f=>{let[g,v]=f;return Array.isArray(v)?v.includes({...i,...l}[g]):{...i,...l}[g]===v})?[...u,d,h]:u},[]);return Gg(e,o,c,r?.class,r?.className)},Zh="-",r_=e=>{const t=a_(e),{conflictingClassGroups:r,conflictingClassGroupModifiers:n}=e;return{getClassGroupId:o=>{const l=o.split(Zh);return l[0]===""&&l.length!==1&&l.shift(),H4(l,t)||n_(o)},getConflictingClassGroupIds:(o,l)=>{const c=r[o]||[];return l&&n[o]?[...c,...n[o]]:c}}},H4=(e,t)=>{if(e.length===0)return t.classGroupId;const r=e[0],n=t.nextPart.get(r),a=n?H4(e.slice(1),n):void 0;if(a)return a;if(t.validators.length===0)return;const i=e.join(Zh);return t.validators.find(({validator:o})=>o(i))?.classGroupId},Hg=/^\[(.+)\]$/,n_=e=>{if(Hg.test(e)){const t=Hg.exec(e)[1],r=t?.substring(0,t.indexOf(":"));if(r)return"arbitrary.."+r}},a_=e=>{const{theme:t,classGroups:r}=e,n={nextPart:new Map,validators:[]};for(const a in r)Vm(r[a],n,a,t);return n},Vm=(e,t,r,n)=>{e.forEach(a=>{if(typeof a=="string"){const i=a===""?t:Wg(t,a);i.classGroupId=r;return}if(typeof a=="function"){if(i_(a)){Vm(a(n),t,r,n);return}t.validators.push({validator:a,classGroupId:r});return}Object.entries(a).forEach(([i,o])=>{Vm(o,Wg(t,i),r,n)})})},Wg=(e,t)=>{let r=e;return t.split(Zh).forEach(n=>{r.nextPart.has(n)||r.nextPart.set(n,{nextPart:new Map,validators:[]}),r=r.nextPart.get(n)}),r},i_=e=>e.isThemeGetter,s_=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)}}},Km="!",Ym=":",o_=Ym.length,l_=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===Ym){i.push(a.slice(c,f)),c=f+o_;continue}if(g==="/"){u=f;continue}}g==="["?o++:g==="]"?o--:g==="("?l++:g===")"&&l--}const p=i.length===0?a:a.substring(c),d=c_(p),h=d!==p,m=u&&u>c?u-c:void 0;return{modifiers:i,hasImportantModifier:h,baseClassName:d,maybePostfixModifierPosition:m}};if(t){const a=t+Ym,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},c_=e=>e.endsWith(Km)?e.substring(0,e.length-1):e.startsWith(Km)?e.substring(1):e,u_=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}},d_=e=>({cache:s_(e.cacheSize),parseClassName:l_(e),sortModifiers:u_(e),...r_(e)}),p_=/\s+/,m_=(e,t)=>{const{parseClassName:r,getClassGroupId:n,getConflictingClassGroupIds:a,sortModifiers:i}=t,o=[],l=e.trim().split(p_);let c="";for(let u=l.length-1;u>=0;u-=1){const p=l[u],{isExternal:d,modifiers:h,hasImportantModifier:m,baseClassName:f,maybePostfixModifierPosition:g}=r(p);if(d){c=p+(c.length>0?" "+c:c);continue}let v=!!g,b=n(v?f.substring(0,g):f);if(!b){if(!v){c=p+(c.length>0?" "+c:c);continue}if(b=n(f),!b){c=p+(c.length>0?" "+c:c);continue}v=!1}const y=i(h).join(":"),k=m?y+Km:y,E=k+b;if(o.includes(E))continue;o.push(E);const T=a(b,v);for(let w=0;w<T.length;++w){const S=T[w];o.push(k+S)}c=p+(c.length>0?" "+c:c)}return c};function h_(){let e=0,t,r,n="";for(;e<arguments.length;)(t=arguments[e++])&&(r=W4(t))&&(n&&(n+=" "),n+=r);return n}const W4=e=>{if(typeof e=="string")return e;let t,r="";for(let n=0;n<e.length;n++)e[n]&&(t=W4(e[n]))&&(r&&(r+=" "),r+=t);return r};function f_(e,...t){let r,n,a,i=o;function o(c){const u=t.reduce((p,d)=>d(p),e());return r=d_(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 p=m_(c,r);return a(c,p),p}return function(){return i(h_.apply(null,arguments))}}const Mt=e=>{const t=r=>r[e]||[];return t.isThemeGetter=!0,t},V4=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,K4=/^\((?:(\w[\w-]*):)?(.+)\)$/i,g_=/^\d+\/\d+$/,b_=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,x_=/\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$/,y_=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,v_=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,k_=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,ma=e=>g_.test(e),ot=e=>!!e&&!Number.isNaN(Number(e)),fn=e=>!!e&&Number.isInteger(Number(e)),Qo=e=>e.endsWith("%")&&ot(e.slice(0,-1)),Zr=e=>b_.test(e),w_=()=>!0,S_=e=>x_.test(e)&&!y_.test(e),Y4=()=>!1,E_=e=>v_.test(e),N_=e=>k_.test(e),C_=e=>!Ge(e)&&!He(e),T_=e=>Ba(e,J4,Y4),Ge=e=>V4.test(e),Fn=e=>Ba(e,Q4,S_),el=e=>Ba(e,j_,ot),Vg=e=>Ba(e,Z4,Y4),A_=e=>Ba(e,X4,N_),ts=e=>Ba(e,eE,E_),He=e=>K4.test(e),ii=e=>za(e,Q4),I_=e=>za(e,O_),Kg=e=>za(e,Z4),__=e=>za(e,J4),R_=e=>za(e,X4),rs=e=>za(e,eE,!0),Ba=(e,t,r)=>{const n=V4.exec(e);return n?n[1]?t(n[1]):r(n[2]):!1},za=(e,t,r=!1)=>{const n=K4.exec(e);return n?n[1]?t(n[1]):r:!1},Z4=e=>e==="position"||e==="percentage",X4=e=>e==="image"||e==="url",J4=e=>e==="length"||e==="size"||e==="bg-size",Q4=e=>e==="length",j_=e=>e==="number",O_=e=>e==="family-name",eE=e=>e==="shadow",D_=()=>{const e=Mt("color"),t=Mt("font"),r=Mt("text"),n=Mt("font-weight"),a=Mt("tracking"),i=Mt("leading"),o=Mt("breakpoint"),l=Mt("container"),c=Mt("spacing"),u=Mt("radius"),p=Mt("shadow"),d=Mt("inset-shadow"),h=Mt("text-shadow"),m=Mt("drop-shadow"),f=Mt("blur"),g=Mt("perspective"),v=Mt("aspect"),b=Mt("ease"),y=Mt("animate"),k=()=>["auto","avoid","all","avoid-page","page","left","right","column"],E=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],T=()=>[...E(),He,Ge],w=()=>["auto","hidden","clip","visible","scroll"],S=()=>["auto","contain","none"],j=()=>[He,Ge,c],I=()=>[ma,"full","auto",...j()],A=()=>[fn,"none","subgrid",He,Ge],L=()=>["auto",{span:["full",fn,He,Ge]},fn,He,Ge],R=()=>[fn,"auto",He,Ge],F=()=>["auto","min","max","fr",He,Ge],C=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],H=()=>["start","end","center","stretch","center-safe","end-safe"],Y=()=>["auto",...j()],W=()=>[ma,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...j()],q=()=>[e,He,Ge],V=()=>[...E(),Kg,Vg,{position:[He,Ge]}],P=()=>["no-repeat",{repeat:["","x","y","space","round"]}],G=()=>["auto","cover","contain",__,T_,{size:[He,Ge]}],U=()=>[Qo,ii,Fn],D=()=>["","none","full",u,He,Ge],ee=()=>["",ot,ii,Fn],re=()=>["solid","dashed","dotted","double"],ge=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],oe=()=>[ot,Qo,Kg,Vg],fe=()=>["","none",f,He,Ge],K=()=>["none",ot,He,Ge],ae=()=>["none",ot,He,Ge],ve=()=>[ot,He,Ge],we=()=>[ma,"full",...j()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[Zr],breakpoint:[Zr],color:[w_],container:[Zr],"drop-shadow":[Zr],ease:["in","out","in-out"],font:[C_],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[Zr],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[Zr],shadow:[Zr],spacing:["px",ot],text:[Zr],"text-shadow":[Zr],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",ma,Ge,He,v]}],container:["container"],columns:[{columns:[ot,Ge,He,l]}],"break-after":[{"break-after":k()}],"break-before":[{"break-before":k()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:T()}],overflow:[{overflow:w()}],"overflow-x":[{"overflow-x":w()}],"overflow-y":[{"overflow-y":w()}],overscroll:[{overscroll:S()}],"overscroll-x":[{"overscroll-x":S()}],"overscroll-y":[{"overscroll-y":S()}],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:[fn,"auto",He,Ge]}],basis:[{basis:[ma,"full","auto",l,...j()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[ot,ma,"auto","initial","none",Ge]}],grow:[{grow:["",ot,He,Ge]}],shrink:[{shrink:["",ot,He,Ge]}],order:[{order:[fn,"first","last","none",He,Ge]}],"grid-cols":[{"grid-cols":A()}],"col-start-end":[{col:L()}],"col-start":[{"col-start":R()}],"col-end":[{"col-end":R()}],"grid-rows":[{"grid-rows":A()}],"row-start-end":[{row:L()}],"row-start":[{"row-start":R()}],"row-end":[{"row-end":R()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":F()}],"auto-rows":[{"auto-rows":F()}],gap:[{gap:j()}],"gap-x":[{"gap-x":j()}],"gap-y":[{"gap-y":j()}],"justify-content":[{justify:[...C(),"normal"]}],"justify-items":[{"justify-items":[...H(),"normal"]}],"justify-self":[{"justify-self":["auto",...H()]}],"align-content":[{content:["normal",...C()]}],"align-items":[{items:[...H(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...H(),{baseline:["","last"]}]}],"place-content":[{"place-content":C()}],"place-items":[{"place-items":[...H(),"baseline"]}],"place-self":[{"place-self":["auto",...H()]}],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:Y()}],mx:[{mx:Y()}],my:[{my:Y()}],ms:[{ms:Y()}],me:[{me:Y()}],mt:[{mt:Y()}],mr:[{mr:Y()}],mb:[{mb:Y()}],ml:[{ml:Y()}],"space-x":[{"space-x":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,ii,Fn]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[n,He,el]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",Qo,Ge]}],"font-family":[{font:[I_,Ge,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,He,Ge]}],"line-clamp":[{"line-clamp":[ot,"none",He,el]}],leading:[{leading:[i,...j()]}],"list-image":[{"list-image":["none",He,Ge]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",He,Ge]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:q()}],"text-color":[{text:q()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...re(),"wavy"]}],"text-decoration-thickness":[{decoration:[ot,"from-font","auto",He,Fn]}],"text-decoration-color":[{decoration:q()}],"underline-offset":[{"underline-offset":[ot,"auto",He,Ge]}],"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",He,Ge]}],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",He,Ge]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:V()}],"bg-repeat":[{bg:P()}],"bg-size":[{bg:G()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},fn,He,Ge],radial:["",He,Ge],conic:[fn,He,Ge]},R_,A_]}],"bg-color":[{bg:q()}],"gradient-from-pos":[{from:U()}],"gradient-via-pos":[{via:U()}],"gradient-to-pos":[{to:U()}],"gradient-from":[{from:q()}],"gradient-via":[{via:q()}],"gradient-to":[{to:q()}],rounded:[{rounded:D()}],"rounded-s":[{"rounded-s":D()}],"rounded-e":[{"rounded-e":D()}],"rounded-t":[{"rounded-t":D()}],"rounded-r":[{"rounded-r":D()}],"rounded-b":[{"rounded-b":D()}],"rounded-l":[{"rounded-l":D()}],"rounded-ss":[{"rounded-ss":D()}],"rounded-se":[{"rounded-se":D()}],"rounded-ee":[{"rounded-ee":D()}],"rounded-es":[{"rounded-es":D()}],"rounded-tl":[{"rounded-tl":D()}],"rounded-tr":[{"rounded-tr":D()}],"rounded-br":[{"rounded-br":D()}],"rounded-bl":[{"rounded-bl":D()}],"border-w":[{border:ee()}],"border-w-x":[{"border-x":ee()}],"border-w-y":[{"border-y":ee()}],"border-w-s":[{"border-s":ee()}],"border-w-e":[{"border-e":ee()}],"border-w-t":[{"border-t":ee()}],"border-w-r":[{"border-r":ee()}],"border-w-b":[{"border-b":ee()}],"border-w-l":[{"border-l":ee()}],"divide-x":[{"divide-x":ee()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":ee()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...re(),"hidden","none"]}],"divide-style":[{divide:[...re(),"hidden","none"]}],"border-color":[{border:q()}],"border-color-x":[{"border-x":q()}],"border-color-y":[{"border-y":q()}],"border-color-s":[{"border-s":q()}],"border-color-e":[{"border-e":q()}],"border-color-t":[{"border-t":q()}],"border-color-r":[{"border-r":q()}],"border-color-b":[{"border-b":q()}],"border-color-l":[{"border-l":q()}],"divide-color":[{divide:q()}],"outline-style":[{outline:[...re(),"none","hidden"]}],"outline-offset":[{"outline-offset":[ot,He,Ge]}],"outline-w":[{outline:["",ot,ii,Fn]}],"outline-color":[{outline:q()}],shadow:[{shadow:["","none",p,rs,ts]}],"shadow-color":[{shadow:q()}],"inset-shadow":[{"inset-shadow":["none",d,rs,ts]}],"inset-shadow-color":[{"inset-shadow":q()}],"ring-w":[{ring:ee()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:q()}],"ring-offset-w":[{"ring-offset":[ot,Fn]}],"ring-offset-color":[{"ring-offset":q()}],"inset-ring-w":[{"inset-ring":ee()}],"inset-ring-color":[{"inset-ring":q()}],"text-shadow":[{"text-shadow":["none",h,rs,ts]}],"text-shadow-color":[{"text-shadow":q()}],opacity:[{opacity:[ot,He,Ge]}],"mix-blend":[{"mix-blend":[...ge(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":ge()}],"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":[ot]}],"mask-image-linear-from-pos":[{"mask-linear-from":oe()}],"mask-image-linear-to-pos":[{"mask-linear-to":oe()}],"mask-image-linear-from-color":[{"mask-linear-from":q()}],"mask-image-linear-to-color":[{"mask-linear-to":q()}],"mask-image-t-from-pos":[{"mask-t-from":oe()}],"mask-image-t-to-pos":[{"mask-t-to":oe()}],"mask-image-t-from-color":[{"mask-t-from":q()}],"mask-image-t-to-color":[{"mask-t-to":q()}],"mask-image-r-from-pos":[{"mask-r-from":oe()}],"mask-image-r-to-pos":[{"mask-r-to":oe()}],"mask-image-r-from-color":[{"mask-r-from":q()}],"mask-image-r-to-color":[{"mask-r-to":q()}],"mask-image-b-from-pos":[{"mask-b-from":oe()}],"mask-image-b-to-pos":[{"mask-b-to":oe()}],"mask-image-b-from-color":[{"mask-b-from":q()}],"mask-image-b-to-color":[{"mask-b-to":q()}],"mask-image-l-from-pos":[{"mask-l-from":oe()}],"mask-image-l-to-pos":[{"mask-l-to":oe()}],"mask-image-l-from-color":[{"mask-l-from":q()}],"mask-image-l-to-color":[{"mask-l-to":q()}],"mask-image-x-from-pos":[{"mask-x-from":oe()}],"mask-image-x-to-pos":[{"mask-x-to":oe()}],"mask-image-x-from-color":[{"mask-x-from":q()}],"mask-image-x-to-color":[{"mask-x-to":q()}],"mask-image-y-from-pos":[{"mask-y-from":oe()}],"mask-image-y-to-pos":[{"mask-y-to":oe()}],"mask-image-y-from-color":[{"mask-y-from":q()}],"mask-image-y-to-color":[{"mask-y-to":q()}],"mask-image-radial":[{"mask-radial":[He,Ge]}],"mask-image-radial-from-pos":[{"mask-radial-from":oe()}],"mask-image-radial-to-pos":[{"mask-radial-to":oe()}],"mask-image-radial-from-color":[{"mask-radial-from":q()}],"mask-image-radial-to-color":[{"mask-radial-to":q()}],"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":E()}],"mask-image-conic-pos":[{"mask-conic":[ot]}],"mask-image-conic-from-pos":[{"mask-conic-from":oe()}],"mask-image-conic-to-pos":[{"mask-conic-to":oe()}],"mask-image-conic-from-color":[{"mask-conic-from":q()}],"mask-image-conic-to-color":[{"mask-conic-to":q()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:V()}],"mask-repeat":[{mask:P()}],"mask-size":[{mask:G()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",He,Ge]}],filter:[{filter:["","none",He,Ge]}],blur:[{blur:fe()}],brightness:[{brightness:[ot,He,Ge]}],contrast:[{contrast:[ot,He,Ge]}],"drop-shadow":[{"drop-shadow":["","none",m,rs,ts]}],"drop-shadow-color":[{"drop-shadow":q()}],grayscale:[{grayscale:["",ot,He,Ge]}],"hue-rotate":[{"hue-rotate":[ot,He,Ge]}],invert:[{invert:["",ot,He,Ge]}],saturate:[{saturate:[ot,He,Ge]}],sepia:[{sepia:["",ot,He,Ge]}],"backdrop-filter":[{"backdrop-filter":["","none",He,Ge]}],"backdrop-blur":[{"backdrop-blur":fe()}],"backdrop-brightness":[{"backdrop-brightness":[ot,He,Ge]}],"backdrop-contrast":[{"backdrop-contrast":[ot,He,Ge]}],"backdrop-grayscale":[{"backdrop-grayscale":["",ot,He,Ge]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[ot,He,Ge]}],"backdrop-invert":[{"backdrop-invert":["",ot,He,Ge]}],"backdrop-opacity":[{"backdrop-opacity":[ot,He,Ge]}],"backdrop-saturate":[{"backdrop-saturate":[ot,He,Ge]}],"backdrop-sepia":[{"backdrop-sepia":["",ot,He,Ge]}],"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",He,Ge]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[ot,"initial",He,Ge]}],ease:[{ease:["linear","initial",b,He,Ge]}],delay:[{delay:[ot,He,Ge]}],animate:[{animate:["none",y,He,Ge]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[g,He,Ge]}],"perspective-origin":[{"perspective-origin":T()}],rotate:[{rotate:K()}],"rotate-x":[{"rotate-x":K()}],"rotate-y":[{"rotate-y":K()}],"rotate-z":[{"rotate-z":K()}],scale:[{scale:ae()}],"scale-x":[{"scale-x":ae()}],"scale-y":[{"scale-y":ae()}],"scale-z":[{"scale-z":ae()}],"scale-3d":["scale-3d"],skew:[{skew:ve()}],"skew-x":[{"skew-x":ve()}],"skew-y":[{"skew-y":ve()}],transform:[{transform:[He,Ge,"","none","gpu","cpu"]}],"transform-origin":[{origin:T()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:we()}],"translate-x":[{"translate-x":we()}],"translate-y":[{"translate-y":we()}],"translate-z":[{"translate-z":we()}],"translate-none":["translate-none"],accent:[{accent:q()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:q()}],"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",He,Ge]}],"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",He,Ge]}],fill:[{fill:["none",...q()]}],"stroke-w":[{stroke:[ot,ii,Fn,el]}],stroke:[{stroke:["none",...q()]}],"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"]}},L_=f_(D_);function qe(...e){return L_(q4(e))}function M_(e){if(!e||typeof e!="string")return null;try{return JSON.parse(e)}catch{return null}}const P_=G4("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 jr({className:e,variant:t,...r}){return s.jsx("div",{className:qe(P_({variant:t}),e),...r})}const F_=G4("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",{variants:{variant:{default:"bg-primary text-primary-foreground shadow hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground shadow-sm hover:bg-destructive/90",outline:"border border-input bg-background shadow-sm hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground shadow-sm hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2",sm:"h-8 rounded-md px-3 text-xs",lg:"h-10 rounded-md px-8",icon:"h-9 w-9"}},defaultVariants:{variant:"default",size:"default"}}),Fe=x.forwardRef(({className:e,variant:t,size:r,...n},a)=>s.jsx("button",{className:qe(F_({variant:t,size:r,className:e})),ref:a,...n}));Fe.displayName="Button";function Zm({checked:e,onToggle:t,ariaLabel:r="Toggle dark mode"}){const{isDarkMode:n,toggleDarkMode:a}=zi(),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:"relative inline-flex h-8 w-14 items-center rounded-full bg-gray-200 transition-colors duration-200 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2 dark:bg-gray-700 dark:focus:ring-offset-gray-900",role:"switch","aria-checked":o,"aria-label":r,children:[s.jsx("span",{className:"sr-only",children:r}),s.jsx("span",{className:`${o?"translate-x-7":"translate-x-1"} flex h-6 w-6 transform items-center justify-center rounded-full bg-white shadow-lg transition-transform duration-200`,children:o?s.jsx(Hh,{className:"h-3.5 w-3.5 text-gray-700"}):s.jsx(Wh,{className:"h-3.5 w-3.5 text-yellow-500"})})]})}const wt=x.forwardRef(({className:e,type:t,...r},n)=>s.jsx("input",{type:t,className:qe("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}));wt.displayName="Input";const Xh=x.forwardRef(({className:e,children:t,...r},n)=>s.jsx("div",{className:qe(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})}));Xh.displayName="ScrollArea";function B_(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 z_(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 wn({children:e,content:t,position:r="top",className:n="",delay:a=500}){const[i,o]=x.useState(!1),l=x.useRef(null),c=()=>{l.current!==null&&(window.clearTimeout(l.current),l.current=null)},u=()=>{c(),l.current=window.setTimeout(()=>{o(!0)},a)},p=()=>{c(),o(!1)};return x.useEffect(()=>()=>{c()},[]),t?s.jsxs("div",{className:"relative inline-block",onMouseEnter:u,onMouseLeave:p,children:[e,i&&s.jsxs("div",{className:qe("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",B_(r),n),children:[t,s.jsx("div",{className:qe("absolute w-0 h-0 border-4 border-transparent",z_(r))})]})]}):s.jsx(s.Fragment,{children:e})}const Yg="https://discord.gg/buxwujPNRE";function Zg({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 U_({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(Tg,{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(Tg,{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:Yg,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(Zg,{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(gt,{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:Yg,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(Zg,{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(gt,{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 $_({isPWA:e,isMobile:t,isLoading:r,projectsCount:n,searchFilter:a,onSearchFilterChange:i,onClearSearchFilter:o,onRefresh:l,isRefreshing:c,onCreateProject:u,onCollapseSidebar:p,t:d}){const h=()=>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:d("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(h,{}),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:l,disabled:c,title:d("tooltips.refresh"),children:s.jsx(Er,{className:`h-3.5 w-3.5 ${c?"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:u,title:d("tooltips.createProject"),children:s.jsx(Ut,{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:p,title:d("tooltips.hideSidebar"),children:s.jsx(BA,{className:"h-3.5 w-3.5"})})]})]}),n>0&&!r&&s.jsxs("div",{className:"relative mt-2.5",children:[s.jsx(Xn,{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(wt,{type:"text",placeholder:d("projects.searchPlaceholder"),value:a,onChange:m=>i(m.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,className:"absolute right-2.5 top-1/2 -translate-y-1/2 rounded-md p-0.5 hover:bg-accent",children:s.jsx(ft,{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(h,{}),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:l,disabled:c,children:s.jsx(Er,{className:`h-4 w-4 text-muted-foreground ${c?"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:u,children:s.jsx(Zn,{className:"h-4 w-4"})})]})]}),n>0&&!r&&s.jsxs("div",{className:"relative mt-2.5",children:[s.jsx(Xn,{className:"pointer-events-none absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground/50"}),s.jsx(wt,{type:"text",placeholder:d("projects.searchPlaceholder"),value:a,onChange:m=>i(m.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,className:"absolute right-2.5 top-1/2 -translate-y-1/2 rounded-md p-1 hover:bg-accent",children:s.jsx(ft,{className:"h-3.5 w-3.5 text-muted-foreground"})})]})]}),s.jsx("div",{className:"nav-divider md:hidden"})]})}const Xg={xs:"w-3 h-3",sm:"w-4 h-4",md:"w-5 h-5",lg:"w-6 h-6"},q_={xs:"p-0.5",sm:"p-1",md:"p-1.5",lg:"p-2"},G_=e=>e==="fully-configured"?{icon:wo,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:gt,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:ko,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:ft,colorClassName:"text-gray-400 dark:text-gray-500",backgroundClassName:"bg-gray-50 dark:bg-gray-900",label:"No TaskMaster",title:"TaskMaster not configured"};function H_({status:e="not-configured",size:t="sm",className:r="",showLabel:n=!1}){const a=G_(e),i=a.icon;return n?s.jsxs("div",{className:qe("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:Xg[t]}),s.jsx("span",{className:"font-medium",children:a.label})]}):s.jsx("div",{className:qe("inline-flex items-center justify-center rounded-full transition-colors",a.backgroundClassName,q_[t],r),title:a.title,children:s.jsx(i,{className:qe(Xg[t],a.colorClassName)})})}const Jg=(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 W_({project:e,session:t,selectedSession:r,currentTime:n,editingSession:a,editingSessionName:i,onEditingSessionNameChange:o,onStartEditingSession:l,onCancelEditingSession:c,onSaveEditingSession:u,onProjectSelect:p,onSessionSelect:d,onDeleteSession:h,t:m}){const f=VI(t,n,m),g=r?.id===t.id,v=()=>{p(e),d(t,e.name)},b=()=>{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:qe("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:qe("w-5 h-5 rounded-md flex items-center justify-center flex-shrink-0",g?"bg-primary/10":"bg-muted/50"),children:s.jsx(gr,{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(Ii,{className:"h-2.5 w-2.5 text-muted-foreground"}),s.jsx("span",{className:"text-xs text-muted-foreground",children:Jg(f.sessionTime,n,m)}),f.messageCount>0&&s.jsx(jr,{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(gr,{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:k=>{k.stopPropagation(),y()},children:s.jsx(nr,{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:qe("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:()=>d(t,e.name),children:s.jsxs("div",{className:"flex w-full min-w-0 items-start gap-2",children:[s.jsx(gr,{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(Ii,{className:"h-2.5 w-2.5 text-muted-foreground"}),s.jsx("span",{className:"text-xs text-muted-foreground",children:Jg(f.sessionTime,n,m)}),f.messageCount>0&&s.jsx(jr,{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(gr,{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:k=>o(k.target.value),onKeyDown:k=>{k.stopPropagation(),k.key==="Enter"?b():k.key==="Escape"&&c()},onClick:k=>k.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:k=>{k.stopPropagation(),b()},title:m("tooltips.save"),children:s.jsx(rr,{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:k=>{k.stopPropagation(),c()},title:m("tooltips.cancel"),children:s.jsx(ft,{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:k=>{k.stopPropagation(),l(t.id,f.sessionName)},title:m("tooltips.editSessionName"),children:s.jsx(HA,{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:k=>{k.stopPropagation(),y()},title:m("tooltips.deleteSession"),children:s.jsx(nr,{className:"h-3 w-3 text-red-600 dark:text-red-400"})})]})})]})]})}function V_(){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 K_({project:e,isExpanded:t,sessions:r,selectedSession:n,initialSessionsLoaded:a,isLoadingSessions:i,currentTime:o,editingSession:l,editingSessionName:c,onEditingSessionNameChange:u,onStartEditingSession:p,onCancelEditingSession:d,onSaveEditingSession:h,onProjectSelect:m,onSessionSelect:f,onDeleteSession:g,onLoadMoreSessions:v,onNewSession:b,t:y}){if(!t)return null;const k=r.length>0,E=e.sessionMeta?.hasMore===!0;return s.jsxs("div",{className:"ml-3 space-y-1 border-l border-border pl-3",children:[a?!k&&!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(T=>s.jsx(W_,{project:e,session:T,selectedSession:n,currentTime:o,editingSession:l,editingSessionName:c,onEditingSessionNameChange:u,onStartEditingSession:p,onCancelEditingSession:d,onSaveEditingSession:h,onProjectSelect:m,onSessionSelect:f,onDeleteSession:g,t:y},T.id)):s.jsx(V_,{}),k&&E&&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(lr,{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),b(e)},children:[s.jsx(Ut,{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:()=>b(e),children:[s.jsx(Ut,{className:"h-3 w-3"}),y("sessions.newSession")]})]})}const Y_=(e,t)=>{const r=e.length;return t&&r>=5?`${r}+`:`${r}`};function Z_({project:e,selectedProject:t,selectedSession:r,isExpanded:n,isDeleting:a,isStarred:i,editingProject:o,editingName:l,sessions:c,initialSessionsLoaded:u,isLoadingSessions:p,currentTime:d,editingSession:h,editingSessionName:m,tasksEnabled:f,mcpServerStatus:g,onEditingNameChange:v,onToggleProject:b,onProjectSelect:y,onToggleStarProject:k,onStartEditingProject:E,onCancelEditingProject:T,onSaveProjectName:w,onDeleteProject:S,onSessionSelect:j,onDeleteSession:I,onLoadMoreSessions:A,onNewSession:L,onEditingSessionNameChange:R,onStartEditingSession:F,onCancelEditingSession:C,onSaveEditingSession:H,t:Y}){const W=t?.name===e.name,q=o===e.name,V=e.sessionMeta?.hasMore===!0,P=Y_(c,V),G=`${P} session${c.length===1?"":"s"}`,U=ZI(e,g),D=()=>b(e.name),ee=()=>k(e.name),re=()=>{w(e.name)},ge=()=>{t?.name!==e.name&&y(e),D()};return s.jsxs("div",{className:qe("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:qe("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:D,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:qe("w-8 h-8 rounded-lg flex items-center justify-center transition-colors",n?"bg-primary/10":"bg-muted"),children:n?s.jsx(Nn,{className:"h-4 w-4 text-primary"}):s.jsx(nn,{className:"h-4 w-4 text-muted-foreground"})}),s.jsx("div",{className:"min-w-0 flex-1",children:q?s.jsx("input",{type:"text",value:l,onChange:oe=>v(oe.target.value),className:"w-full rounded-lg border-2 border-primary/40 bg-background px-3 py-2 text-sm text-foreground shadow-sm transition-all duration-200 focus:border-primary focus:shadow-md focus:outline-none",placeholder:Y("projects.projectNamePlaceholder"),autoFocus:!0,autoComplete:"off",onClick:oe=>oe.stopPropagation(),onKeyDown:oe=>{oe.key==="Enter"&&re(),oe.key==="Escape"&&T()},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(H_,{status:U,size:"xs",className:"ml-2 hidden flex-shrink-0 md:inline-flex"})]}),s.jsx("p",{className:"text-xs text-muted-foreground",children:G})]})})]}),s.jsx("div",{className:"flex items-center gap-1",children:q?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:oe=>{oe.stopPropagation(),re()},children:s.jsx(rr,{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:oe=>{oe.stopPropagation(),T()},children:s.jsx(ft,{className:"h-4 w-4 text-white"})})]}):s.jsxs(s.Fragment,{children:[s.jsx("button",{className:qe("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:oe=>{oe.stopPropagation(),ee()},title:Y(i?"tooltips.removeFromFavorites":"tooltips.addToFavorites"),children:s.jsx(Rg,{className:qe("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:oe=>{oe.stopPropagation(),S(e)},children:s.jsx(nr,{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:oe=>{oe.stopPropagation(),E(e)},children:s.jsx(Ri,{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(lr,{className:"h-3 w-3 text-muted-foreground"}):s.jsx(Sr,{className:"h-3 w-3 text-muted-foreground"})})]})})]})})}),s.jsxs(Fe,{variant:"ghost",className:qe("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:ge,children:[s.jsxs("div",{className:"flex min-w-0 flex-1 items-center gap-3",children:[n?s.jsx(Nn,{className:"h-4 w-4 flex-shrink-0 text-primary"}):s.jsx(nn,{className:"h-4 w-4 flex-shrink-0 text-muted-foreground"}),s.jsx("div",{className:"min-w-0 flex-1 text-left",children:q?s.jsxs("div",{className:"space-y-1",children:[s.jsx("input",{type:"text",value:l,onChange:oe=>v(oe.target.value),className:"w-full rounded border border-border bg-background px-2 py-1 text-sm text-foreground focus:ring-2 focus:ring-primary/20",placeholder:Y("projects.projectNamePlaceholder"),autoFocus:!0,onKeyDown:oe=>{oe.key==="Enter"&&re(),oe.key==="Escape"&&T()}}),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:q?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:oe=>{oe.stopPropagation(),re()},children:s.jsx(rr,{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:oe=>{oe.stopPropagation(),T()},children:s.jsx(ft,{className:"h-3 w-3"})})]}):s.jsxs(s.Fragment,{children:[s.jsx("div",{className:qe("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:oe=>{oe.stopPropagation(),ee()},title:Y(i?"tooltips.removeFromFavorites":"tooltips.addToFavorites"),children:s.jsx(Rg,{className:qe("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:oe=>{oe.stopPropagation(),E(e)},title:Y("tooltips.renameProject"),children:s.jsx(Ri,{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:oe=>{oe.stopPropagation(),S(e)},title:Y("tooltips.deleteProject"),children:s.jsx(nr,{className:"h-3 w-3 text-red-600 dark:text-red-400"})}),n?s.jsx(lr,{className:"h-4 w-4 text-muted-foreground transition-colors group-hover:text-foreground"}):s.jsx(Sr,{className:"h-4 w-4 text-muted-foreground transition-colors group-hover:text-foreground"})]})})]})]}),s.jsx(K_,{project:e,isExpanded:n,sessions:c,selectedSession:r,initialSessionsLoaded:u,isLoadingSessions:p,currentTime:d,editingSession:h,editingSessionName:m,onEditingSessionNameChange:R,onStartEditingSession:F,onCancelEditingSession:C,onSaveEditingSession:H,onProjectSelect:y,onSessionSelect:j,onDeleteSession:I,onLoadMoreSessions:A,onNewSession:L,t:Y})]})}function X_({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(nn,{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(Xn,{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 J_({projects:e,filteredProjects:t,selectedProject:r,selectedSession:n,isLoading:a,loadingProgress:i,expandedProjects:o,editingProject:l,editingName:c,loadingSessions:u,initialSessionsLoaded:p,currentTime:d,editingSession:h,editingSessionName:m,deletingProjects:f,tasksEnabled:g,mcpServerStatus:v,getProjectSessions:b,isProjectStarred:y,onEditingNameChange:k,onToggleProject:E,onProjectSelect:T,onToggleStarProject:w,onStartEditingProject:S,onCancelEditingProject:j,onSaveProjectName:I,onDeleteProject:A,onSessionSelect:L,onDeleteSession:R,onLoadMoreSessions:F,onNewSession:C,onEditingSessionNameChange:H,onStartEditingSession:Y,onCancelEditingSession:W,onSaveEditingSession:q,t:V}){const P=s.jsx(X_,{isLoading:a,loadingProgress:i,projectsCount:e.length,filteredProjectsCount:t.length,t:V});x.useEffect(()=>{let U="CloudCLI UI";const D=r?.displayName?.trim();D&&(U=`${D} - ${U}`),document.title=U},[r]);const G=!a&&e.length>0&&t.length>0;return s.jsx("div",{className:"pb-safe-area-inset-bottom md:space-y-1",children:G?t.map(U=>s.jsx(Z_,{project:U,selectedProject:r,selectedSession:n,isExpanded:o.has(U.name),isDeleting:f.has(U.name),isStarred:y(U.name),editingProject:l,editingName:c,sessions:b(U),initialSessionsLoaded:p.has(U.name),isLoadingSessions:!!u[U.name],currentTime:d,editingSession:h,editingSessionName:m,tasksEnabled:g,mcpServerStatus:v,onEditingNameChange:k,onToggleProject:E,onProjectSelect:T,onToggleStarProject:w,onStartEditingProject:S,onCancelEditingProject:j,onSaveProjectName:I,onDeleteProject:A,onSessionSelect:L,onDeleteSession:R,onLoadMoreSessions:F,onNewSession:C,onEditingSessionNameChange:H,onStartEditingSession:Y,onCancelEditingSession:W,onSaveEditingSession:q,t:V},U.name)):P})}function Q_({isPWA:e,isMobile:t,isLoading:r,projects:n,searchFilter:a,onSearchFilterChange:i,onClearSearchFilter:o,onRefresh:l,isRefreshing:c,onCreateProject:u,onCollapseSidebar:p,updateAvailable:d,releaseInfo:h,latestVersion:m,onShowVersionModal:f,onShowSettings:g,projectListProps:v,t:b}){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($_,{isPWA:e,isMobile:t,isLoading:r,projectsCount:n.length,searchFilter:a,onSearchFilterChange:i,onClearSearchFilter:o,onRefresh:l,isRefreshing:c,onCreateProject:u,onCollapseSidebar:p,t:b}),s.jsx(Xh,{className:"flex-1 overflow-y-auto overscroll-contain md:px-1.5 md:py-2",children:s.jsx(J_,{...v})}),s.jsx(U_,{updateAvailable:d,releaseInfo:h,latestVersion:m,onShowVersionModal:f,onShowSettings:g,t:b})]})}const e8={fontSize:"14"},ns={authenticated:!1,email:null,loading:!0,error:null},Qg={name:"",type:"stdio",scope:"user",projectPath:"",config:{command:"",args:[],env:{},url:"",headers:{},timeout:3e4},importMode:"form",jsonInput:""},eb={name:"",type:"stdio",config:{command:"",args:[],env:{}}},t8={allowedCommands:[],disallowedCommands:[],skipPermissions:!1},r8={claude:"/api/cli/claude/status",cursor:"/api/cli/cursor/status",codex:"/api/cli/codex/status",gemini:"/api/cli/gemini/status"},tE=e=>e==="sse"||e==="http"?e:"stdio",n8=e=>e==="local"?"local":"user",a8=e=>e instanceof Error?e.message:"Unknown error",i8=e=>({name:e.name||"",type:tE(e.type),scope:n8(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 s8({isOpen:e,editingServer:t,projects:r,onClose:n,onSubmit:a}){const{t:i}=ze("settings"),[o,l]=x.useState(Qg),[c,u]=x.useState(""),[p,d]=x.useState(!1),h=!!t;x.useEffect(()=>{if(e){if(u(""),t){l(i8(t));return}l(Qg)}},[t,e]);const m=x.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=(b,y)=>{l(k=>({...k,config:{...k.config,[b]:y}}))},g=b=>{if(!b.trim()){u("");return}try{const y=JSON.parse(b);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 b=>{b.preventDefault(),d(!0);try{await a(o,t)}catch(y){alert(`Error: ${a8(y)}`)}finally{d(!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(ft,{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(b=>({...b,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(b=>({...b,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(_i,{className:"h-4 w-4"}):s.jsx(Nn,{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(b=>({...b,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(_i,{className:"h-4 w-4"}),s.jsx("span",{children:i("mcpForm.scope.userGlobal")})]})}),s.jsx("button",{type:"button",onClick:()=>l(b=>({...b,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(Nn,{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:b=>{l(y=>({...y,projectPath:b.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(b=>s.jsx("option",{value:b.path||b.fullPath,children:b.displayName||b.name},b.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(wt,{value:o.name,onChange:b=>l(y=>({...y,name:b.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:b=>{l(y=>({...y,type:tE(b.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:b=>{const y=b.target.value;l(k=>({...k,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:`{
604
+ `;function K7(){if(typeof document>"u"||document.getElementById(Dg))return;const e=document.createElement("style");e.id=Dg,e.type="text/css",e.innerText=V7,document.head.appendChild(e)}function Y7({terminalContainerRef:e,terminalRef:t,fitAddonRef:r,wsRef:n,selectedProject:a,minimal:i,isRestarting:o,initialCommandRef:l,isPlainShellRef:c,authUrlRef:u,copyAuthUrlToClipboard:p,closeSocket:d}){const[h,m]=x.useState(!1),f=x.useRef(null),g=a?.fullPath||a?.path||"",v=!!a;x.useEffect(()=>{K7()},[]);const b=x.useCallback(()=>{t.current&&(t.current.clear(),t.current.write("\x1B[2J\x1B[H"))},[t]),y=x.useCallback(()=>{t.current&&(t.current.dispose(),t.current=null),r.current=null,m(!1)},[r,t]);return x.useEffect(()=>{if(!e.current||!v||o||t.current)return;const k=new G7.Terminal(O7);t.current=k;const E=new z7.FitAddon;r.current=E,k.loadAddon(E),i||k.loadAddon(new $7.WebLinksAddon);try{k.loadAddon(new q7.WebglAddon)}catch{console.warn("[Shell] WebGL renderer unavailable, using Canvas fallback")}k.open(e.current),k.attachCustomKeyEventHandler(S=>{const j=_4(l.current)?A4:u.current;return S.type==="keydown"&&i&&c.current&&j&&!S.ctrlKey&&!S.metaKey&&!S.altKey&&S.key?.toLowerCase()==="c"?(S.preventDefault(),S.stopPropagation(),p(j),!1):S.type==="keydown"&&(S.ctrlKey||S.metaKey)&&S.key?.toLowerCase()==="c"&&k.hasSelection()?(S.preventDefault(),S.stopPropagation(),document.execCommand("copy"),!1):S.type==="keydown"&&(S.ctrlKey||S.metaKey)&&S.key?.toLowerCase()==="v"?(S.preventDefault(),S.stopPropagation(),typeof navigator<"u"&&navigator.clipboard?.readText&&navigator.clipboard.readText().then(I=>{Vn(n.current,{type:"input",data:I})}).catch(()=>{}),!1):!0}),window.setTimeout(()=>{const S=r.current,j=t.current;!S||!j||(S.fit(),Vn(n.current,{type:"resize",cols:j.cols,rows:j.rows}))},I4),m(!0);const T=k.onData(S=>{Vn(n.current,{type:"input",data:S})}),w=new ResizeObserver(()=>{f.current!==null&&window.clearTimeout(f.current),f.current=window.setTimeout(()=>{const S=r.current,j=t.current;!S||!j||(S.fit(),Vn(n.current,{type:"resize",cols:j.cols,rows:j.rows}))},T7)});return w.observe(e.current),()=>{w.disconnect(),f.current!==null&&(window.clearTimeout(f.current),f.current=null),T.dispose(),d(),y()}},[u,d,p,y,r,l,c,o,i,v,g,e,t,n]),{isInitialized:h,clearTerminalScreen:b,disposeTerminal:y}}function Z7({selectedProject:e,selectedSession:t,initialCommand:r,isPlainShell:n,minimal:a,autoConnect:i,isRestarting:o,onProcessComplete:l,onOutputRef:c}){const u=x.useRef(null),p=x.useRef(null),d=x.useRef(null),h=x.useRef(null),[m,f]=x.useState(""),[g,v]=x.useState(0),b=x.useRef(e),y=x.useRef(t),k=x.useRef(r),E=x.useRef(n),T=x.useRef(l),w=x.useRef(""),S=x.useRef(t?.id??null);x.useEffect(()=>{b.current=e,y.current=t,k.current=r,E.current=n,T.current=l},[e,t,r,n,l]);const j=x.useCallback(V=>{w.current=V,f(V),v(P=>P+1)},[]),I=x.useCallback(()=>{const V=h.current;V&&((V.readyState===WebSocket.OPEN||V.readyState===WebSocket.CONNECTING)&&V.close(),h.current=null)},[]),A=x.useCallback((V=w.current)=>{if(!V)return!1;const P=window.open(V,"_blank");if(P){try{P.opener=null}catch{}return!0}return!1},[]),L=x.useCallback(async(V=w.current)=>V?Rn(V):!1,[]),{isInitialized:R,clearTerminalScreen:F,disposeTerminal:C}=Y7({terminalContainerRef:u,terminalRef:p,fitAddonRef:d,wsRef:h,selectedProject:e,minimal:a,isRestarting:o,initialCommandRef:k,isPlainShellRef:E,authUrlRef:w,copyAuthUrlToClipboard:L,closeSocket:I}),{isConnected:H,isConnecting:Y,connectToShell:W,disconnectFromShell:q}=B7({wsRef:h,terminalRef:p,fitAddonRef:d,selectedProjectRef:b,selectedSessionRef:y,initialCommandRef:k,isPlainShellRef:E,onProcessCompleteRef:T,isInitialized:R,autoConnect:i,closeSocket:I,clearTerminalScreen:F,setAuthUrl:j,onOutputRef:c});return x.useEffect(()=>{o&&(q(),C())},[q,C,o]),x.useEffect(()=>{e||(q(),C())},[q,C,e]),x.useEffect(()=>{const V=t?.id??null;S.current!==V&&R&&q(),S.current=V},[q,R,t?.id]),{terminalContainerRef:u,terminalRef:p,wsRef:h,isConnected:H,isInitialized:R,isConnecting:Y,authUrl:m,authUrlVersion:g,connectToShell:W,disconnectFromShell:q,openAuthUrlInBrowser:A,copyAuthUrlToClipboard:L}}function X7({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 J7({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 Q7({isConnected:e,isInitialized:t,isRestarting:r,hasSession:n,sessionDisplayNameShort:a,onDisconnect:i,onRestart:o,statusNewSessionText:l,statusInitializingText:c,statusRestartingText:u,disconnectLabel:p,disconnectTitle:d,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:d,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:p})]}),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 eI({terminalContainerRef:e,authUrl:t,authUrlVersion:r,initialCommand:n,isConnected:a,openAuthUrlInBrowser:i,copyAuthUrlToClipboard:o}){const[l,c]=x.useState("idle"),[u,p]=x.useState(!1),d=x.useMemo(()=>H7(n,t),[t,n]);x.useEffect(()=>{c("idle"),p(!1)},[r,d,a]);const h=!!d,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:()=>p(!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:d,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(d)},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(d);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:()=>p(!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 tI=[{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:"↓"}],es=e=>e.preventDefault();function rI({wsRef:e,terminalRef:t,isConnected:r}){const{t:n}=ze("settings"),[a,i]=x.useState(!1),o=x.useRef(null);x.useEffect(()=>()=>{o.current&&clearTimeout(o.current)},[]);const l=x.useCallback(()=>{i(d=>!d)},[]),c=x.useCallback(d=>{d(),document.activeElement instanceof HTMLElement&&document.activeElement.blur(),o.current&&clearTimeout(o.current),o.current=setTimeout(()=>i(!1),50)},[]),u=x.useCallback(d=>{Vn(e.current,{type:"input",data:d})},[e]),p=x.useCallback(()=>{t.current?.scrollToBottom()},[t]);return s.jsxs(s.Fragment,{children:[s.jsx("button",{type:"button",onPointerDown:es,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(Sr,{className:"h-5 w-5 text-gray-600 dark:text-gray-400"}):s.jsx(vo,{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(xA,{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")}),tI.map(d=>s.jsxs("button",{type:"button",onPointerDown:es,onClick:()=>c(()=>u(d.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.${d.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:d.hint})]},d.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:es,onClick:()=>c(p),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(GT,{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:es,onClick:l})]})}function R4({selectedProject:e=null,selectedSession:t=null,initialCommand:r=null,isPlainShell:n=!1,onProcessComplete:a=null,minimal:i=!1,autoConnect:o=!1,isActive:l}){const{t:c}=ze("chat"),[u,p]=x.useState(!1),[d,h]=x.useState(null),m=x.useRef(null),f=x.useRef(null),{terminalContainerRef:g,terminalRef:v,wsRef:b,isConnected:y,isInitialized:k,isConnecting:E,authUrl:T,authUrlVersion:w,connectToShell:S,disconnectFromShell:j,openAuthUrlInBrowser:I,copyAuthUrlToClipboard:A}=Z7({selectedProject:e,selectedSession:t,initialCommand:r,isPlainShell:n,minimal:i,autoConnect:o,isRestarting:u,onProcessComplete:a,onOutputRef:f}),L=x.useCallback(()=>{const U=v.current;if(!U)return;const D=U.buffer.active,ee=D.baseY+D.cursorY,re=Math.min(D.baseY+D.length-1,ee+10),ge=Math.max(0,ee-I7),oe=[];for(let we=ge;we<=re;we++){const De=D.getLine(we);De&&oe.push(De.translateToString().trimEnd())}let fe=-1;for(let we=oe.length-1;we>=0;we--)if(/esc to cancel/i.test(oe[we])||/enter to select/i.test(oe[we])){fe=we;break}if(fe===-1){h(null);return}const K=new Map,ae=Math.max(0,fe-_7);for(let we=fe-1;we>=ae;we--){const De=oe[we].match(/^\s*[❯›>]?\s*(\d+)\.\s+(.+)/);if(De){const O=De[1],ce=De[2].trim();parseInt(O,10)<=R7&&ce.length>0&&!K.has(O)&&K.set(O,ce)}}const ve=[];for(let we=1;we<=K.size&&K.has(String(we));we++)ve.push({number:String(we),label:K.get(String(we))});h(ve.length>=j7?ve:null)},[v]),R=x.useCallback(()=>{m.current&&clearTimeout(m.current),m.current=setTimeout(L,A7)},[L]);x.useEffect(()=>{f.current=R},[R]),x.useEffect(()=>()=>{m.current&&clearTimeout(m.current)},[]),x.useEffect(()=>{y||(m.current&&(clearTimeout(m.current),m.current=null),h(null))},[y]);const F=x.useCallback(U=>{Vn(b.current,{type:"input",data:U})},[b]),C=x.useMemo(()=>W7(t),[t]),H=x.useMemo(()=>C?C.slice(0,30):null,[C]),Y=x.useMemo(()=>C?C.slice(0,50):null,[C]),W=x.useCallback(()=>{p(!0),window.setTimeout(()=>{p(!1)},C7)},[]);if(!e)return s.jsx(J7,{title:c("shell.selectProject.title"),description:c("shell.selectProject.description")});if(i)return s.jsx(eI,{terminalContainerRef:g,authUrl:T,authUrlVersion:w,initialCommand:r,isConnected:y,openAuthUrlInBrowser:I,copyAuthUrlToClipboard:A});const q=n?c("shell.runCommand",{command:r||c("shell.defaultCommand"),projectName:e.displayName}):t?c("shell.resumeSession",{displayName:Y}):c("shell.startSession"),V=n?c("shell.runCommand",{command:r||c("shell.defaultCommand"),projectName:e.displayName}):c("shell.startCli",{projectName:e.displayName}),P=k?E?"connecting":y?null:"connect":"loading",G=P==="connecting"?V:q;return s.jsxs("div",{className:"flex h-full w-full flex-col bg-gray-900",children:[s.jsx(Q7,{isConnected:y,isInitialized:k,isRestarting:u,hasSession:!!t,sessionDisplayNameShort:H,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(X7,{mode:P,description:G,loadingLabel:c("shell.loading"),connectLabel:c("shell.actions.connect"),connectTitle:c("shell.actions.connectTitle"),connectingLabel:c("shell.connecting"),onConnect:S}),d&&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:U=>U.preventDefault(),children:s.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[d.map(U=>s.jsxs("button",{type:"button",onClick:()=>{F(U.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:`${U.number}. ${U.label}`,children:[U.number,". ",U.label]},U.number)),s.jsx("button",{type:"button",onClick:()=>{F("\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(rI,{wsRef:b,terminalRef:v,isConnected:y})]})}function nI({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 aI({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 j4({project:e=null,session:t=null,command:r=null,isPlainShell:n=null,autoConnect:a=!0,onComplete:i=null,onClose:o=null,title:l=null,className:c="",showHeader:u=!0,compact:p=!1,minimal:d=!1}){const[h,m]=x.useState(!1),f=n!==null?n:r!==null,g=x.useCallback(v=>{m(!0),i?.(v)},[i]);return e?s.jsxs("div",{className:`flex h-full w-full flex-col ${c}`,children:[!d&&u&&l&&s.jsx(aI,{title:l,isCompleted:h,onClose:o}),s.jsx("div",{className:"min-h-0 w-full flex-1",children:s.jsx(R4,{selectedProject:e,selectedSession:t,initialCommand:r,isPlainShell:f,onProcessComplete:g,minimal:d,autoConnect:d?!0:a})})]}):s.jsx(nI,{className:c})}const iI=({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"),sI=e=>e==="claude"?"Claude CLI Login":e==="cursor"?"Cursor CLI Login":e==="codex"?"Codex CLI Login":"Gemini CLI Configuration",oI=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 O4({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=iI({provider:r,customCommand:i,isAuthenticated:o,isOnboarding:l}),u=sI(r),p=oI(n),d=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(ft,{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(fA,{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(So,{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(j4,{project:p,command:c,onComplete:d,minimal:!0})})]})})}const lI=({className:e="w-5 h-5"})=>s.jsx("img",{src:"/icons/claude-ai-icon.svg",alt:"Claude",className:e}),cI=({className:e="w-5 h-5"})=>{const{isDarkMode:t}=zi();return s.jsx("img",{src:t?"/icons/codex-white.svg":"/icons/codex.svg",alt:"Codex",className:e})},uI=({className:e="w-5 h-5"})=>{const{isDarkMode:t}=zi();return s.jsx("img",{src:t?"/icons/cursor-white.svg":"/icons/cursor.svg",alt:"Cursor",className:e})},dI=({className:e="w-5 h-5"})=>s.jsx("img",{src:"/icons/gemini-ai-icon.svg",alt:"Gemini",className:e});function gr({provider:e="claude",className:t="w-5 h-5"}){return e==="cursor"?s.jsx(uI,{className:t}):e==="codex"?s.jsx(cI,{className:t}):e==="gemini"?s.jsx(dI,{className:t}):s.jsx(lI,{className:t})}function pI({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(gr,{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(rr,{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 mI=[{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 hI({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:mI.map(r=>s.jsx(pI,{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 fI({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(Gr,{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(k7,{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(NA,{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 Lg=[{title:"Git Configuration",icon:Gr,required:!0},{title:"Connect Agents",icon:N4,required:!1}];function gI({currentStep:e}){return s.jsx("div",{className:"mb-8",children:s.jsx("div",{className:"flex items-center justify-between",children:Lg.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(rr,{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<Lg.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 bI=["claude","cursor","codex","gemini"],Mg=/^[^\s@]+@[^\s@]+\.[^\s@]+$/,xI={name:"default",displayName:"default",fullPath:"",path:""},yI=()=>({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}}),Pg=async(e,t)=>{try{return(await e.json()).error||t}catch{return t}};function vI({onComplete:e}){const[t,r]=x.useState(0),[n,a]=x.useState(""),[i,o]=x.useState(""),[l,c]=x.useState(!1),[u,p]=x.useState(""),[d,h]=x.useState(null),[m,f]=x.useState(yI),g=x.useRef(void 0),v=x.useCallback(async I=>{try{const A=await Le(`/api/cli/${I}/status`);if(!A.ok){f(R=>({...R,[I]:{authenticated:!1,email:null,loading:!1,error:"Failed to check authentication status"}}));return}const L=await A.json();f(R=>({...R,[I]:{authenticated:!!L.authenticated,email:L.email??null,loading:!1,error:L.error??null}}))}catch(A){console.error(`Error checking ${I} auth status:`,A),f(L=>({...L,[I]:{authenticated:!1,email:null,loading:!1,error:A instanceof Error?A.message:"Unknown error"}}))}},[]),b=x.useCallback(async()=>{await Promise.all(bI.map(I=>v(I)))},[v]),y=x.useCallback(async()=>{try{const I=await Le("/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)}},[]);x.useEffect(()=>{y(),b()},[y,b]),x.useEffect(()=>{const I=g.current;g.current=d,(I===void 0||I!==null&&d===null)&&b()},[d,b]);const k=I=>{h(I)},E=I=>{I===0&&d&&v(d)},T=async()=>{if(p(""),t!==0){r(I=>I+1);return}if(!n.trim()||!i.trim()){p("Both git name and email are required.");return}if(!Mg.test(i)){p("Please enter a valid email address.");return}c(!0);try{const I=await Le("/api/user/git-config",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({gitName:n,gitEmail:i})});if(!I.ok){const A=await Pg(I,"Failed to save git configuration");throw new Error(A)}r(A=>A+1)}catch(I){p(I instanceof Error?I.message:"Failed to save git configuration")}finally{c(!1)}},w=()=>{p(""),r(I=>I-1)},S=async()=>{c(!0),p("");try{const I=await Le("/api/user/complete-onboarding",{method:"POST"});if(!I.ok){const A=await Pg(I,"Failed to complete onboarding");throw new Error(A)}await e?.()}catch(I){p(I instanceof Error?I.message:"Failed to complete onboarding")}finally{c(!1)}},j=t===0?!!(n.trim()&&i.trim()&&Mg.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(gI,{currentStep:t}),s.jsxs("div",{className:"rounded-lg border border-border bg-card p-8 shadow-lg",children:[t===0?s.jsx(fI,{gitName:n,gitEmail:i,isSubmitting:l,onGitNameChange:a,onGitEmailChange:o}):s.jsx(hI,{providerStatuses:m,onOpenProviderLogin:k}),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:w,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(vo,{className:"h-4 w-4"}),"Previous"]}),s.jsx("div",{className:"flex items-center gap-3",children:t<1?s.jsx("button",{onClick:T,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(Cn,{className:"h-4 w-4 animate-spin"}),"Saving..."]}):s.jsxs(s.Fragment,{children:["Next",s.jsx(Sr,{className:"h-4 w-4"})]})}):s.jsx("button",{onClick:S,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(Cn,{className:"h-4 w-4 animate-spin"}),"Completing..."]}):s.jsxs(s.Fragment,{children:[s.jsx(rr,{className:"h-4 w-4"}),"Complete Setup"]})})})]})]})]})}),d&&s.jsx(O4,{isOpen:!!d,onClose:()=>h(null),provider:d,project:xI,onComplete:E,isOnboarding:!0})]})}const kI=["0s","0.1s","0.2s"];function wI(){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(Eo,{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:kI.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 D4({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 Si({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 L4({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(Eo,{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 SI={username:"",password:""};function EI(){const{t:e}=ze("auth"),{login:t}=Ui(),[r,n]=x.useState(SI),[a,i]=x.useState(""),[o,l]=x.useState(!1),c=x.useCallback((p,d)=>{n(h=>({...h,[p]:d}))},[]),u=x.useCallback(async p=>{if(p.preventDefault(),i(""),!r.username.trim()||!r.password){i(e("login.errors.requiredFields"));return}l(!0);const d=await t(r.username.trim(),r.password);d.success||i(d.error),l(!1)},[r.password,r.username,t,e]);return s.jsx(L4,{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(Si,{id:"username",label:e("login.username"),value:r.username,onChange:p=>c("username",p),placeholder:e("login.placeholders.username"),isDisabled:o}),s.jsx(Si,{id:"password",label:e("login.password"),value:r.password,onChange:p=>c("password",p),placeholder:e("login.placeholders.password"),isDisabled:o,type:"password"}),s.jsx(D4,{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 NI={username:"",password:"",confirmPassword:""};function CI(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 TI(){const{register:e}=Ui(),[t,r]=x.useState(NI),[n,a]=x.useState(""),[i,o]=x.useState(!1),l=x.useCallback((u,p)=>{r(d=>({...d,[u]:p}))},[]),c=x.useCallback(async u=>{u.preventDefault(),a("");const p=CI(t);if(p){a(p);return}o(!0);const d=await e(t.username.trim(),t.password);d.success||a(d.error),o(!1)},[t,e]);return s.jsx(L4,{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(Si,{id:"username",label:"Username",value:t.username,onChange:u=>l("username",u),placeholder:"Enter your username",isDisabled:i}),s.jsx(Si,{id:"password",label:"Password",value:t.password,onChange:u=>l("password",u),placeholder:"Enter your password",isDisabled:i,type:"password"}),s.jsx(Si,{id:"confirmPassword",label:"Confirm Password",value:t.confirmPassword,onChange:u=>l("confirmPassword",u),placeholder:"Confirm your password",isDisabled:i,type:"password"}),s.jsx(D4,{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 AI({children:e}){const{user:t,isLoading:r,needsSetup:n,hasCompletedOnboarding:a,refreshOnboardingStatus:i}=Ui();return r?s.jsx(wI,{}):n?s.jsx(TI,{}):t?a?s.jsx(s.Fragment,{children:e}):s.jsx(vI,{onComplete:i}):s.jsx(EI,{})}const M4=x.createContext(null),P4=()=>{const e=x.useContext(M4);if(!e)throw new Error("useWebSocket must be used within a WebSocketProvider");return e},II=e=>{const t=window.location.protocol==="https:"?"wss:":"ws:";return e?`${t}//${window.location.host}/ws?token=${encodeURIComponent(e)}`:null},_I=()=>{const e=x.useRef(null),t=x.useRef(!1),[r,n]=x.useState(null),[a,i]=x.useState(!1),o=x.useRef(null),{token:l}=Ui();x.useEffect(()=>(c(),()=>{t.current=!0,o.current&&clearTimeout(o.current),e.current&&e.current.close()}),[l]);const c=x.useCallback(()=>{if(!t.current)try{const d=II(l);if(!d)return console.warn("No authentication token found for WebSocket connection");const h=new WebSocket(d);h.onopen=()=>{i(!0),e.current=h},h.onmessage=m=>{try{const f=JSON.parse(m.data);n(f)}catch(f){console.error("Error parsing WebSocket message:",f)}},h.onclose=()=>{i(!1),e.current=null,o.current=setTimeout(()=>{t.current||c()},3e3)},h.onerror=m=>{console.error("WebSocket error:",m)}}catch(d){console.error("Error creating WebSocket connection:",d)}},[l]),u=x.useCallback(d=>{const h=e.current;h&&h.readyState===WebSocket.OPEN?h.send(JSON.stringify(d)):console.warn("WebSocket not connected")},[]);return x.useMemo(()=>({ws:e.current,sendMessage:u,latestMessage:r,isConnected:a}),[u,r,a])},RI=({children:e})=>{const t=_I();return s.jsx(M4.Provider,{value:t,children:e})},F4=x.createContext(null);function jI(e,t){return{message:t instanceof Error?t.message:`Failed to ${e}`,context:e,timestamp:new Date().toISOString()}}function Fg(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 OI(e){return e.find(t=>t.status==="pending"||t.status==="in-progress")??null}function DI(e){return e?.type?e.type.startsWith("taskmaster-"):!1}function Fa(){const e=x.useContext(F4);if(!e)throw new Error("useTaskMaster must be used within a TaskMasterProvider");return e}function LI({children:e}){const{latestMessage:t}=P4(),{user:r,token:n,isLoading:a}=Ui(),[i,o]=x.useState([]),[l,c]=x.useState(null),[u,p]=x.useState(null),[d,h]=x.useState(null),[m,f]=x.useState([]),[g,v]=x.useState(null),[b,y]=x.useState(!1),[k,E]=x.useState(!1),[T,w]=x.useState(!1),[S,j]=x.useState(null),I=x.useRef(null);x.useEffect(()=>{I.current=l?.name??null},[l?.name]);const A=x.useCallback(()=>{j(null)},[]),L=x.useCallback((W,q)=>{console.error(`TaskMaster ${W} error:`,q),j(jI(W,q))},[]),R=x.useCallback(W=>{const q=W?Fg(W):null;c(q),p(q?.taskmaster??null),f([]),v(null)},[]),F=x.useCallback(async()=>{if(!r||!n){o([]),c(null),p(null),f([]),v(null);return}try{y(!0),A();const W=await rt.get("/projects");if(!W.ok)throw new Error(`Failed to fetch projects: ${W.status}`);const q=await W.json(),P=(Array.isArray(q)?q:[]).map(D=>Fg(D));o(P);const G=I.current;if(!G)return;const U=P.find(D=>D.name===G)??null;c(U),p(U?.taskmaster??null)}catch(W){L("load projects",W)}finally{y(!1)}},[A,L,n,r]),C=x.useCallback(async()=>{const W=l?.name;if(!W||!r||!n){f([]),v(null);return}try{E(!0),A();const q=await rt.get(`/taskmaster/tasks/${encodeURIComponent(W)}`);if(!q.ok){const G=await q.json();throw new Error(G.message??"Failed to load tasks")}const V=await q.json(),P=Array.isArray(V.tasks)?V.tasks:[];f(P),v(OI(P))}catch(q){L("load tasks",q),f([]),v(null)}finally{E(!1)}},[A,l?.name,L,n,r]),H=x.useCallback(async()=>{if(!r||!n){h(null);return}try{w(!0),A();const W=await rt.get("/mcp-utils/taskmaster-server");if(!W.ok)throw new Error(`Failed to load MCP status: ${W.status}`);const q=await W.json();h(q)}catch(W){L("check MCP server status",W),h(null)}finally{w(!1)}},[A,L,n,r]);x.useEffect(()=>{!a&&r&&n&&(F(),H())},[a,H,F,n,r]),x.useEffect(()=>{l?.name&&r&&n&&C()},[l?.name,C,n,r]),x.useEffect(()=>{const W=t;if(DI(W)){if(W.type==="taskmaster-project-updated"&&W.projectName){F();return}if(W.type==="taskmaster-tasks-updated"&&W.projectName===l?.name){C();return}W.type==="taskmaster-mcp-status-changed"&&H()}},[l?.name,t,H,F,C]);const Y=x.useMemo(()=>({projects:i,currentProject:l,projectTaskMaster:u,mcpServerStatus:d,tasks:m,nextTask:g,isLoading:b,isLoadingTasks:k,isLoadingMCP:T,error:S,refreshProjects:F,setCurrentProject:R,refreshTasks:C,refreshMCPStatus:H,clearError:A}),[A,l,S,b,T,k,d,g,u,i,H,F,C,R,m]);return s.jsx(F4.Provider,{value:Y,children:e})}const B4=x.createContext({tasksEnabled:!0,setTasksEnabled:()=>{},toggleTasksEnabled:()=>{},isTaskMasterInstalled:null,isTaskMasterReady:null,installationStatus:null,isCheckingInstallation:!0}),$i=()=>{const e=x.useContext(B4);if(!e)throw new Error("useTasksSettings must be used within a TasksSettingsProvider");return e},MI=({children:e})=>{const[t,r]=x.useState(()=>{const m=localStorage.getItem("tasks-enabled");return m!==null?JSON.parse(m):!0}),[n,a]=x.useState(null),[i,o]=x.useState(null),[l,c]=x.useState(null),[u,p]=x.useState(!0);x.useEffect(()=>{localStorage.setItem("tasks-enabled",JSON.stringify(t))},[t]),x.useEffect(()=>{setTimeout(async()=>{try{const f=await rt.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{p(!1)}},0)},[]);const h={tasksEnabled:t,setTasksEnabled:r,toggleTasksEnabled:()=>{r(m=>!m)},isTaskMasterInstalled:n,isTaskMasterReady:i,installationStatus:l,isCheckingInstallation:u};return s.jsx(B4.Provider,{value:h,children:e})},Bg=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 Kh(e={}){const{mobileBreakpoint:t=768,trackMobile:r=!0,trackPWA:n=!0}=e,[a,i]=x.useState(()=>r?Bg(t):!1),[o,l]=x.useState(()=>n?zg():!1);return x.useEffect(()=>{if(!r||typeof window>"u")return;const c=()=>{i(Bg(t))};return c(),window.addEventListener("resize",c),()=>{window.removeEventListener("resize",c)}},[t,r]),x.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 Ug="1.23.2",PI=(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},z4=(e,t)=>{const[r,n]=x.useState(!1),[a,i]=x.useState(null),[o,l]=x.useState(null),[c,u]=x.useState("git");return x.useEffect(()=>{(async()=>{try{const h=await(await fetch("/health")).json();(h.installMode==="npm"||h.installMode==="git")&&u(h.installMode)}catch{}})()},[]),x.useEffect(()=>{const p=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(PI(f,Ug)>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)}};p();const d=setInterval(p,300*1e3);return()=>clearInterval(d)},[e,t]),{updateAvailable:r,latestVersion:a,currentVersion:Ug,releaseInfo:o,installMode:c}},Gn={autoExpandTools:!1,showRawParameters:!1,showThinking:!0,autoScrollToBottom:!0,sendByCtrlEnter:!1,sidebarVisible:!0},Ws=Object.keys(Gn),FI=new Set(Ws),Jo="ui-preferences:sync",Vs=(e,t)=>{if(typeof e=="boolean")return e;if(typeof e=="string"){if(e==="true")return!0;if(e==="false")return!1}return t},BI=(e,t)=>{try{const r=localStorage.getItem(e);if(r===null)return t;const n=JSON.parse(r);return Vs(n,t)}catch{return t}},zI=e=>{if(typeof window>"u")return Gn;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 Ws.reduce((a,i)=>(a[i]=Vs(n[i],Gn[i]),a),{...Gn})}}}catch{}return Ws.reduce((t,r)=>(t[r]=BI(r,Gn[r]),t),{...Gn})};function UI(e,t){switch(t.type){case"set":{const{key:r,value:n}=t;if(!FI.has(r))return e;const a=Vs(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 Ws){if(!(i in r))continue;const o=r[i],l=Vs(o,e[i]);a[i]!==l&&(a[i]=l,n=!0)}return n?a:e}case"reset":return{...Gn,...t.value||{}};default:return e}}function Yh(e="uiPreferences"){const t=x.useRef(`ui-preferences-${Math.random().toString(36).slice(2)}`),[r,n]=x.useReducer(UI,e,zI);return x.useEffect(()=>{typeof window>"u"||(localStorage.setItem(e,JSON.stringify(r)),window.dispatchEvent(new CustomEvent(Jo,{detail:{storageKey:e,sourceId:t.current,value:r}})))},[r,e]),x.useEffect(()=>{if(typeof window>"u")return;const l=p=>{!p||typeof p!="object"||Array.isArray(p)||n({type:"set_many",value:p})},c=p=>{if(!(p.key!==e||p.newValue===null))try{const d=JSON.parse(p.newValue);l(d)}catch{}},u=p=>{const h=p.detail;!h||h.storageKey!==e||h.sourceId===t.current||l(h.value)};return window.addEventListener("storage",c),window.addEventListener(Jo,u),()=>{window.removeEventListener("storage",c),window.removeEventListener(Jo,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 $I=()=>{try{const e=localStorage.getItem("claude-settings");return e&&JSON.parse(e).projectSortOrder==="date"?"date":"name"}catch{return"name"}},qI=()=>{try{const e=localStorage.getItem("starredProjects");return e?new Set(JSON.parse(e)):new Set}catch{return new Set}},GI=e=>{try{localStorage.setItem("starredProjects",JSON.stringify([...e]))}catch{}},Ks=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),HI=(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"),WI=e=>e.__provider==="cursor"?String(e.createdAt||""):e.__provider==="codex"?String(e.createdAt||e.lastActivity||""):String(e.lastActivity||e.createdAt||""),VI=(e,t,r)=>{const n=Ks(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:HI(e,r),sessionTime:WI(e),messageCount:Number(e.messageCount||0)}},U4=(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)=>Ks(l).getTime()-Ks(o).getTime())},$g=(e,t)=>{const r=U4(e,t);return r.length===0?new Date(0):r.reduce((n,a)=>{const i=Ks(a);return i>n?i:n},new Date(0))},KI=(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"?$g(o,n).getTime()-$g(i,n).getTime():(i.displayName||i.name).localeCompare(o.displayName||o.name)}),a},YI=(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},ZI=(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"},XI=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 JI({projects:e,selectedProject:t,selectedSession:r,isLoading:n,isMobile:a,t:i,onRefresh:o,onProjectSelect:l,onSessionSelect:c,onSessionDelete:u,onProjectDelete:p,setCurrentProject:d,setSidebarVisible:h,sidebarVisible:m}){const[f,g]=x.useState(new Set),[v,b]=x.useState(null),[y,k]=x.useState(!1),[E,T]=x.useState(""),[w,S]=x.useState({}),[j,I]=x.useState({}),[A,L]=x.useState(new Set),[R,F]=x.useState(new Date),[C,H]=x.useState("name"),[Y,W]=x.useState(!1),[q,V]=x.useState({}),[P,G]=x.useState(null),[U,D]=x.useState(""),[ee,re]=x.useState(""),[ge,oe]=x.useState(new Set),[fe,K]=x.useState(null),[ae,ve]=x.useState(null),[we,De]=x.useState(!1),[O,ce]=x.useState(()=>qI()),Z=!a&&!m;x.useEffect(()=>{const he=setInterval(()=>{F(new Date)},6e4);return()=>clearInterval(he)},[]),x.useEffect(()=>{I({}),L(new Set),V({})},[e]),x.useEffect(()=>{t&&g(he=>{if(he.has(t.name))return he;const Oe=new Set(he);return Oe.add(t.name),Oe})},[r,t]),x.useEffect(()=>{if(e.length>0&&!n){const he=new Set;e.forEach(Oe=>{Oe.sessions&&Oe.sessions.length>=0&&he.add(Oe.name)}),L(he)}},[e,n]),x.useEffect(()=>{const he=()=>{H($I())};he();const Oe=Be=>{Be.key==="claude-settings"&&he()};window.addEventListener("storage",Oe);const Me=setInterval(()=>{document.hasFocus()&&he()},1e3);return()=>{window.removeEventListener("storage",Oe),clearInterval(Me)}},[]);const z=x.useCallback(he=>{g(Oe=>{const Me=new Set;return Oe.has(he)||Me.add(he),Me})},[]),B=x.useCallback((he,Oe)=>{c({...he,__projectName:Oe})},[c]),J=x.useCallback(he=>{ce(Oe=>{const Me=new Set(Oe);return Me.has(he)?Me.delete(he):Me.add(he),GI(Me),Me})},[]),me=x.useCallback(he=>O.has(he),[O]),ye=x.useCallback(he=>U4(he,j),[j]),ie=x.useMemo(()=>e.map(he=>{const Oe=q[he.name];return Oe===void 0?he:{...he,sessionMeta:{...he.sessionMeta,hasMore:Oe}}}),[q,e]),xe=x.useMemo(()=>KI(ie,C,O,j),[j,C,ie,O]),le=x.useMemo(()=>YI(xe,ee),[ee,xe]),se=x.useCallback(he=>{b(he.name),T(he.displayName)},[]),te=x.useCallback(()=>{b(null),T("")},[]),de=x.useCallback(async he=>{try{(await rt.renameProject(he,E)).ok?window.refreshProjects?await window.refreshProjects():window.location.reload():console.error("Failed to rename project")}catch(Oe){console.error("Error renaming project:",Oe)}finally{b(null),T("")}},[E]),be=x.useCallback((he,Oe,Me,Be="claude")=>{ve({projectName:he,sessionId:Oe,sessionTitle:Me,provider:Be})},[]),_e=x.useCallback(async()=>{if(!ae)return;const{projectName:he,sessionId:Oe,provider:Me}=ae;ve(null);try{let Be;if(Me==="codex"?Be=await rt.deleteCodexSession(Oe):Me==="gemini"?Be=await rt.deleteGeminiSession(Oe):Be=await rt.deleteSession(he,Oe),Be.ok)u?.(Oe);else{const pt=await Be.text();console.error("[Sidebar] Failed to delete session:",{status:Be.status,error:pt}),alert(i("messages.deleteSessionFailed"))}}catch(Be){console.error("[Sidebar] Error deleting session:",Be),alert(i("messages.deleteSessionError"))}},[u,ae,i]),$e=x.useCallback(he=>{K({project:he,sessionCount:ye(he).length})},[ye]),Xe=x.useCallback(async()=>{if(!fe)return;const{project:he,sessionCount:Oe}=fe,Me=Oe===0;K(null),oe(Be=>new Set([...Be,he.name]));try{const Be=await rt.deleteProject(he.name,!Me);if(Be.ok)p?.(he.name);else{const pt=await Be.json();alert(pt.error||i("messages.deleteProjectFailed"))}}catch(Be){console.error("Error deleting project:",Be),alert(i("messages.deleteProjectError"))}finally{oe(Be=>{const pt=new Set(Be);return pt.delete(he.name),pt})}},[fe,p,i]),nt=x.useCallback(async he=>{const Oe=q[he.name];if(!(!(Oe!==void 0?Oe:he.sessionMeta?.hasMore===!0)||w[he.name])){S(Be=>({...Be,[he.name]:!0}));try{const Be=(he.sessions?.length||0)+(j[he.name]?.length||0),pt=await rt.sessions(he.name,5,Be);if(!pt.ok)return;const lt=await pt.json();I($t=>({...$t,[he.name]:[...$t[he.name]||[],...lt.sessions||[]]})),lt.hasMore===!1&&V($t=>({...$t,[he.name]:!1}))}catch(Be){console.error("Error loading more sessions:",Be)}finally{S(Be=>({...Be,[he.name]:!1}))}}},[j,w,q]),Ke=x.useCallback(he=>{l(he),d(he)},[l,d]),dt=x.useCallback(async()=>{W(!0);try{await o()}finally{W(!1)}},[o]),st=x.useCallback(async(he,Oe,Me,Be)=>{const pt=Me.trim();if(!pt){G(null),D("");return}try{const lt=await rt.renameSession(Oe,pt,Be);lt.ok?await o():(console.error("[Sidebar] Failed to rename session:",lt.status),alert(i("messages.renameSessionFailed")))}catch(lt){console.error("[Sidebar] Error renaming session:",lt),alert(i("messages.renameSessionError"))}finally{G(null),D("")}},[o,i]),Ae=x.useCallback(()=>{h(!1)},[h]),We=x.useCallback(()=>{h(!0)},[h]);return{isSidebarCollapsed:Z,expandedProjects:f,editingProject:v,showNewProject:y,editingName:E,loadingSessions:w,additionalSessions:j,initialSessionsLoaded:A,currentTime:R,projectSortOrder:C,isRefreshing:Y,editingSession:P,editingSessionName:U,searchFilter:ee,deletingProjects:ge,deleteConfirmation:fe,sessionDeleteConfirmation:ae,showVersionModal:we,starredProjects:O,filteredProjects:le,toggleProject:z,handleSessionClick:B,toggleStarProject:J,isProjectStarred:me,getProjectSessions:ye,startEditing:se,cancelEditing:te,saveProjectName:de,showDeleteSessionConfirmation:be,confirmDeleteSession:_e,requestProjectDelete:$e,confirmDeleteProject:Xe,loadMoreSessions:nt,handleProjectSelect:Ke,refreshProjects:dt,updateSessionSummary:st,collapseSidebar:Ae,expandSidebar:We,setShowNewProject:k,setEditingName:T,setEditingSession:G,setEditingSessionName:D,setSearchFilter:re,setDeleteConfirmation:K,setSessionDeleteConfirmation:ve,setShowVersionModal:De}}const QI="https://discord.gg/buxwujPNRE";function e_({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 t_({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(UA,{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(gt,{className:"h-4 w-4 text-muted-foreground transition-colors group-hover:text-foreground"})}),s.jsx("a",{href:QI,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(e_,{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(Tn,{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 $4(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=$4(e[t]))&&(n&&(n+=" "),n+=r)}else for(r in e)e[r]&&(n&&(n+=" "),n+=r);return n}function q4(){for(var e,t,r=0,n="",a=arguments.length;r<a;r++)(e=arguments[r])&&(t=$4(e))&&(n&&(n+=" "),n+=t);return n}const qg=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,Gg=q4,G4=(e,t)=>r=>{var n;if(t?.variants==null)return Gg(e,r?.class,r?.className);const{variants:a,defaultVariants:i}=t,o=Object.keys(a).map(u=>{const p=r?.[u],d=i?.[u];if(p===null)return null;const h=qg(p)||qg(d);return a[u][h]}),l=r&&Object.entries(r).reduce((u,p)=>{let[d,h]=p;return h===void 0||(u[d]=h),u},{}),c=t==null||(n=t.compoundVariants)===null||n===void 0?void 0:n.reduce((u,p)=>{let{class:d,className:h,...m}=p;return Object.entries(m).every(f=>{let[g,v]=f;return Array.isArray(v)?v.includes({...i,...l}[g]):{...i,...l}[g]===v})?[...u,d,h]:u},[]);return Gg(e,o,c,r?.class,r?.className)},Zh="-",r_=e=>{const t=a_(e),{conflictingClassGroups:r,conflictingClassGroupModifiers:n}=e;return{getClassGroupId:o=>{const l=o.split(Zh);return l[0]===""&&l.length!==1&&l.shift(),H4(l,t)||n_(o)},getConflictingClassGroupIds:(o,l)=>{const c=r[o]||[];return l&&n[o]?[...c,...n[o]]:c}}},H4=(e,t)=>{if(e.length===0)return t.classGroupId;const r=e[0],n=t.nextPart.get(r),a=n?H4(e.slice(1),n):void 0;if(a)return a;if(t.validators.length===0)return;const i=e.join(Zh);return t.validators.find(({validator:o})=>o(i))?.classGroupId},Hg=/^\[(.+)\]$/,n_=e=>{if(Hg.test(e)){const t=Hg.exec(e)[1],r=t?.substring(0,t.indexOf(":"));if(r)return"arbitrary.."+r}},a_=e=>{const{theme:t,classGroups:r}=e,n={nextPart:new Map,validators:[]};for(const a in r)Vm(r[a],n,a,t);return n},Vm=(e,t,r,n)=>{e.forEach(a=>{if(typeof a=="string"){const i=a===""?t:Wg(t,a);i.classGroupId=r;return}if(typeof a=="function"){if(i_(a)){Vm(a(n),t,r,n);return}t.validators.push({validator:a,classGroupId:r});return}Object.entries(a).forEach(([i,o])=>{Vm(o,Wg(t,i),r,n)})})},Wg=(e,t)=>{let r=e;return t.split(Zh).forEach(n=>{r.nextPart.has(n)||r.nextPart.set(n,{nextPart:new Map,validators:[]}),r=r.nextPart.get(n)}),r},i_=e=>e.isThemeGetter,s_=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)}}},Km="!",Ym=":",o_=Ym.length,l_=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===Ym){i.push(a.slice(c,f)),c=f+o_;continue}if(g==="/"){u=f;continue}}g==="["?o++:g==="]"?o--:g==="("?l++:g===")"&&l--}const p=i.length===0?a:a.substring(c),d=c_(p),h=d!==p,m=u&&u>c?u-c:void 0;return{modifiers:i,hasImportantModifier:h,baseClassName:d,maybePostfixModifierPosition:m}};if(t){const a=t+Ym,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},c_=e=>e.endsWith(Km)?e.substring(0,e.length-1):e.startsWith(Km)?e.substring(1):e,u_=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}},d_=e=>({cache:s_(e.cacheSize),parseClassName:l_(e),sortModifiers:u_(e),...r_(e)}),p_=/\s+/,m_=(e,t)=>{const{parseClassName:r,getClassGroupId:n,getConflictingClassGroupIds:a,sortModifiers:i}=t,o=[],l=e.trim().split(p_);let c="";for(let u=l.length-1;u>=0;u-=1){const p=l[u],{isExternal:d,modifiers:h,hasImportantModifier:m,baseClassName:f,maybePostfixModifierPosition:g}=r(p);if(d){c=p+(c.length>0?" "+c:c);continue}let v=!!g,b=n(v?f.substring(0,g):f);if(!b){if(!v){c=p+(c.length>0?" "+c:c);continue}if(b=n(f),!b){c=p+(c.length>0?" "+c:c);continue}v=!1}const y=i(h).join(":"),k=m?y+Km:y,E=k+b;if(o.includes(E))continue;o.push(E);const T=a(b,v);for(let w=0;w<T.length;++w){const S=T[w];o.push(k+S)}c=p+(c.length>0?" "+c:c)}return c};function h_(){let e=0,t,r,n="";for(;e<arguments.length;)(t=arguments[e++])&&(r=W4(t))&&(n&&(n+=" "),n+=r);return n}const W4=e=>{if(typeof e=="string")return e;let t,r="";for(let n=0;n<e.length;n++)e[n]&&(t=W4(e[n]))&&(r&&(r+=" "),r+=t);return r};function f_(e,...t){let r,n,a,i=o;function o(c){const u=t.reduce((p,d)=>d(p),e());return r=d_(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 p=m_(c,r);return a(c,p),p}return function(){return i(h_.apply(null,arguments))}}const Mt=e=>{const t=r=>r[e]||[];return t.isThemeGetter=!0,t},V4=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,K4=/^\((?:(\w[\w-]*):)?(.+)\)$/i,g_=/^\d+\/\d+$/,b_=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,x_=/\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$/,y_=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,v_=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,k_=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,ma=e=>g_.test(e),ot=e=>!!e&&!Number.isNaN(Number(e)),fn=e=>!!e&&Number.isInteger(Number(e)),Qo=e=>e.endsWith("%")&&ot(e.slice(0,-1)),Zr=e=>b_.test(e),w_=()=>!0,S_=e=>x_.test(e)&&!y_.test(e),Y4=()=>!1,E_=e=>v_.test(e),N_=e=>k_.test(e),C_=e=>!Ge(e)&&!He(e),T_=e=>Ba(e,J4,Y4),Ge=e=>V4.test(e),Fn=e=>Ba(e,Q4,S_),el=e=>Ba(e,j_,ot),Vg=e=>Ba(e,Z4,Y4),A_=e=>Ba(e,X4,N_),ts=e=>Ba(e,eE,E_),He=e=>K4.test(e),ii=e=>za(e,Q4),I_=e=>za(e,O_),Kg=e=>za(e,Z4),__=e=>za(e,J4),R_=e=>za(e,X4),rs=e=>za(e,eE,!0),Ba=(e,t,r)=>{const n=V4.exec(e);return n?n[1]?t(n[1]):r(n[2]):!1},za=(e,t,r=!1)=>{const n=K4.exec(e);return n?n[1]?t(n[1]):r:!1},Z4=e=>e==="position"||e==="percentage",X4=e=>e==="image"||e==="url",J4=e=>e==="length"||e==="size"||e==="bg-size",Q4=e=>e==="length",j_=e=>e==="number",O_=e=>e==="family-name",eE=e=>e==="shadow",D_=()=>{const e=Mt("color"),t=Mt("font"),r=Mt("text"),n=Mt("font-weight"),a=Mt("tracking"),i=Mt("leading"),o=Mt("breakpoint"),l=Mt("container"),c=Mt("spacing"),u=Mt("radius"),p=Mt("shadow"),d=Mt("inset-shadow"),h=Mt("text-shadow"),m=Mt("drop-shadow"),f=Mt("blur"),g=Mt("perspective"),v=Mt("aspect"),b=Mt("ease"),y=Mt("animate"),k=()=>["auto","avoid","all","avoid-page","page","left","right","column"],E=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],T=()=>[...E(),He,Ge],w=()=>["auto","hidden","clip","visible","scroll"],S=()=>["auto","contain","none"],j=()=>[He,Ge,c],I=()=>[ma,"full","auto",...j()],A=()=>[fn,"none","subgrid",He,Ge],L=()=>["auto",{span:["full",fn,He,Ge]},fn,He,Ge],R=()=>[fn,"auto",He,Ge],F=()=>["auto","min","max","fr",He,Ge],C=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],H=()=>["start","end","center","stretch","center-safe","end-safe"],Y=()=>["auto",...j()],W=()=>[ma,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...j()],q=()=>[e,He,Ge],V=()=>[...E(),Kg,Vg,{position:[He,Ge]}],P=()=>["no-repeat",{repeat:["","x","y","space","round"]}],G=()=>["auto","cover","contain",__,T_,{size:[He,Ge]}],U=()=>[Qo,ii,Fn],D=()=>["","none","full",u,He,Ge],ee=()=>["",ot,ii,Fn],re=()=>["solid","dashed","dotted","double"],ge=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],oe=()=>[ot,Qo,Kg,Vg],fe=()=>["","none",f,He,Ge],K=()=>["none",ot,He,Ge],ae=()=>["none",ot,He,Ge],ve=()=>[ot,He,Ge],we=()=>[ma,"full",...j()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[Zr],breakpoint:[Zr],color:[w_],container:[Zr],"drop-shadow":[Zr],ease:["in","out","in-out"],font:[C_],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[Zr],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[Zr],shadow:[Zr],spacing:["px",ot],text:[Zr],"text-shadow":[Zr],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",ma,Ge,He,v]}],container:["container"],columns:[{columns:[ot,Ge,He,l]}],"break-after":[{"break-after":k()}],"break-before":[{"break-before":k()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:T()}],overflow:[{overflow:w()}],"overflow-x":[{"overflow-x":w()}],"overflow-y":[{"overflow-y":w()}],overscroll:[{overscroll:S()}],"overscroll-x":[{"overscroll-x":S()}],"overscroll-y":[{"overscroll-y":S()}],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:[fn,"auto",He,Ge]}],basis:[{basis:[ma,"full","auto",l,...j()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[ot,ma,"auto","initial","none",Ge]}],grow:[{grow:["",ot,He,Ge]}],shrink:[{shrink:["",ot,He,Ge]}],order:[{order:[fn,"first","last","none",He,Ge]}],"grid-cols":[{"grid-cols":A()}],"col-start-end":[{col:L()}],"col-start":[{"col-start":R()}],"col-end":[{"col-end":R()}],"grid-rows":[{"grid-rows":A()}],"row-start-end":[{row:L()}],"row-start":[{"row-start":R()}],"row-end":[{"row-end":R()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":F()}],"auto-rows":[{"auto-rows":F()}],gap:[{gap:j()}],"gap-x":[{"gap-x":j()}],"gap-y":[{"gap-y":j()}],"justify-content":[{justify:[...C(),"normal"]}],"justify-items":[{"justify-items":[...H(),"normal"]}],"justify-self":[{"justify-self":["auto",...H()]}],"align-content":[{content:["normal",...C()]}],"align-items":[{items:[...H(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...H(),{baseline:["","last"]}]}],"place-content":[{"place-content":C()}],"place-items":[{"place-items":[...H(),"baseline"]}],"place-self":[{"place-self":["auto",...H()]}],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:Y()}],mx:[{mx:Y()}],my:[{my:Y()}],ms:[{ms:Y()}],me:[{me:Y()}],mt:[{mt:Y()}],mr:[{mr:Y()}],mb:[{mb:Y()}],ml:[{ml:Y()}],"space-x":[{"space-x":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,ii,Fn]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[n,He,el]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",Qo,Ge]}],"font-family":[{font:[I_,Ge,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,He,Ge]}],"line-clamp":[{"line-clamp":[ot,"none",He,el]}],leading:[{leading:[i,...j()]}],"list-image":[{"list-image":["none",He,Ge]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",He,Ge]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:q()}],"text-color":[{text:q()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...re(),"wavy"]}],"text-decoration-thickness":[{decoration:[ot,"from-font","auto",He,Fn]}],"text-decoration-color":[{decoration:q()}],"underline-offset":[{"underline-offset":[ot,"auto",He,Ge]}],"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",He,Ge]}],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",He,Ge]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:V()}],"bg-repeat":[{bg:P()}],"bg-size":[{bg:G()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},fn,He,Ge],radial:["",He,Ge],conic:[fn,He,Ge]},R_,A_]}],"bg-color":[{bg:q()}],"gradient-from-pos":[{from:U()}],"gradient-via-pos":[{via:U()}],"gradient-to-pos":[{to:U()}],"gradient-from":[{from:q()}],"gradient-via":[{via:q()}],"gradient-to":[{to:q()}],rounded:[{rounded:D()}],"rounded-s":[{"rounded-s":D()}],"rounded-e":[{"rounded-e":D()}],"rounded-t":[{"rounded-t":D()}],"rounded-r":[{"rounded-r":D()}],"rounded-b":[{"rounded-b":D()}],"rounded-l":[{"rounded-l":D()}],"rounded-ss":[{"rounded-ss":D()}],"rounded-se":[{"rounded-se":D()}],"rounded-ee":[{"rounded-ee":D()}],"rounded-es":[{"rounded-es":D()}],"rounded-tl":[{"rounded-tl":D()}],"rounded-tr":[{"rounded-tr":D()}],"rounded-br":[{"rounded-br":D()}],"rounded-bl":[{"rounded-bl":D()}],"border-w":[{border:ee()}],"border-w-x":[{"border-x":ee()}],"border-w-y":[{"border-y":ee()}],"border-w-s":[{"border-s":ee()}],"border-w-e":[{"border-e":ee()}],"border-w-t":[{"border-t":ee()}],"border-w-r":[{"border-r":ee()}],"border-w-b":[{"border-b":ee()}],"border-w-l":[{"border-l":ee()}],"divide-x":[{"divide-x":ee()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":ee()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...re(),"hidden","none"]}],"divide-style":[{divide:[...re(),"hidden","none"]}],"border-color":[{border:q()}],"border-color-x":[{"border-x":q()}],"border-color-y":[{"border-y":q()}],"border-color-s":[{"border-s":q()}],"border-color-e":[{"border-e":q()}],"border-color-t":[{"border-t":q()}],"border-color-r":[{"border-r":q()}],"border-color-b":[{"border-b":q()}],"border-color-l":[{"border-l":q()}],"divide-color":[{divide:q()}],"outline-style":[{outline:[...re(),"none","hidden"]}],"outline-offset":[{"outline-offset":[ot,He,Ge]}],"outline-w":[{outline:["",ot,ii,Fn]}],"outline-color":[{outline:q()}],shadow:[{shadow:["","none",p,rs,ts]}],"shadow-color":[{shadow:q()}],"inset-shadow":[{"inset-shadow":["none",d,rs,ts]}],"inset-shadow-color":[{"inset-shadow":q()}],"ring-w":[{ring:ee()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:q()}],"ring-offset-w":[{"ring-offset":[ot,Fn]}],"ring-offset-color":[{"ring-offset":q()}],"inset-ring-w":[{"inset-ring":ee()}],"inset-ring-color":[{"inset-ring":q()}],"text-shadow":[{"text-shadow":["none",h,rs,ts]}],"text-shadow-color":[{"text-shadow":q()}],opacity:[{opacity:[ot,He,Ge]}],"mix-blend":[{"mix-blend":[...ge(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":ge()}],"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":[ot]}],"mask-image-linear-from-pos":[{"mask-linear-from":oe()}],"mask-image-linear-to-pos":[{"mask-linear-to":oe()}],"mask-image-linear-from-color":[{"mask-linear-from":q()}],"mask-image-linear-to-color":[{"mask-linear-to":q()}],"mask-image-t-from-pos":[{"mask-t-from":oe()}],"mask-image-t-to-pos":[{"mask-t-to":oe()}],"mask-image-t-from-color":[{"mask-t-from":q()}],"mask-image-t-to-color":[{"mask-t-to":q()}],"mask-image-r-from-pos":[{"mask-r-from":oe()}],"mask-image-r-to-pos":[{"mask-r-to":oe()}],"mask-image-r-from-color":[{"mask-r-from":q()}],"mask-image-r-to-color":[{"mask-r-to":q()}],"mask-image-b-from-pos":[{"mask-b-from":oe()}],"mask-image-b-to-pos":[{"mask-b-to":oe()}],"mask-image-b-from-color":[{"mask-b-from":q()}],"mask-image-b-to-color":[{"mask-b-to":q()}],"mask-image-l-from-pos":[{"mask-l-from":oe()}],"mask-image-l-to-pos":[{"mask-l-to":oe()}],"mask-image-l-from-color":[{"mask-l-from":q()}],"mask-image-l-to-color":[{"mask-l-to":q()}],"mask-image-x-from-pos":[{"mask-x-from":oe()}],"mask-image-x-to-pos":[{"mask-x-to":oe()}],"mask-image-x-from-color":[{"mask-x-from":q()}],"mask-image-x-to-color":[{"mask-x-to":q()}],"mask-image-y-from-pos":[{"mask-y-from":oe()}],"mask-image-y-to-pos":[{"mask-y-to":oe()}],"mask-image-y-from-color":[{"mask-y-from":q()}],"mask-image-y-to-color":[{"mask-y-to":q()}],"mask-image-radial":[{"mask-radial":[He,Ge]}],"mask-image-radial-from-pos":[{"mask-radial-from":oe()}],"mask-image-radial-to-pos":[{"mask-radial-to":oe()}],"mask-image-radial-from-color":[{"mask-radial-from":q()}],"mask-image-radial-to-color":[{"mask-radial-to":q()}],"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":E()}],"mask-image-conic-pos":[{"mask-conic":[ot]}],"mask-image-conic-from-pos":[{"mask-conic-from":oe()}],"mask-image-conic-to-pos":[{"mask-conic-to":oe()}],"mask-image-conic-from-color":[{"mask-conic-from":q()}],"mask-image-conic-to-color":[{"mask-conic-to":q()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:V()}],"mask-repeat":[{mask:P()}],"mask-size":[{mask:G()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",He,Ge]}],filter:[{filter:["","none",He,Ge]}],blur:[{blur:fe()}],brightness:[{brightness:[ot,He,Ge]}],contrast:[{contrast:[ot,He,Ge]}],"drop-shadow":[{"drop-shadow":["","none",m,rs,ts]}],"drop-shadow-color":[{"drop-shadow":q()}],grayscale:[{grayscale:["",ot,He,Ge]}],"hue-rotate":[{"hue-rotate":[ot,He,Ge]}],invert:[{invert:["",ot,He,Ge]}],saturate:[{saturate:[ot,He,Ge]}],sepia:[{sepia:["",ot,He,Ge]}],"backdrop-filter":[{"backdrop-filter":["","none",He,Ge]}],"backdrop-blur":[{"backdrop-blur":fe()}],"backdrop-brightness":[{"backdrop-brightness":[ot,He,Ge]}],"backdrop-contrast":[{"backdrop-contrast":[ot,He,Ge]}],"backdrop-grayscale":[{"backdrop-grayscale":["",ot,He,Ge]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[ot,He,Ge]}],"backdrop-invert":[{"backdrop-invert":["",ot,He,Ge]}],"backdrop-opacity":[{"backdrop-opacity":[ot,He,Ge]}],"backdrop-saturate":[{"backdrop-saturate":[ot,He,Ge]}],"backdrop-sepia":[{"backdrop-sepia":["",ot,He,Ge]}],"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",He,Ge]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[ot,"initial",He,Ge]}],ease:[{ease:["linear","initial",b,He,Ge]}],delay:[{delay:[ot,He,Ge]}],animate:[{animate:["none",y,He,Ge]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[g,He,Ge]}],"perspective-origin":[{"perspective-origin":T()}],rotate:[{rotate:K()}],"rotate-x":[{"rotate-x":K()}],"rotate-y":[{"rotate-y":K()}],"rotate-z":[{"rotate-z":K()}],scale:[{scale:ae()}],"scale-x":[{"scale-x":ae()}],"scale-y":[{"scale-y":ae()}],"scale-z":[{"scale-z":ae()}],"scale-3d":["scale-3d"],skew:[{skew:ve()}],"skew-x":[{"skew-x":ve()}],"skew-y":[{"skew-y":ve()}],transform:[{transform:[He,Ge,"","none","gpu","cpu"]}],"transform-origin":[{origin:T()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:we()}],"translate-x":[{"translate-x":we()}],"translate-y":[{"translate-y":we()}],"translate-z":[{"translate-z":we()}],"translate-none":["translate-none"],accent:[{accent:q()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:q()}],"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",He,Ge]}],"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",He,Ge]}],fill:[{fill:["none",...q()]}],"stroke-w":[{stroke:[ot,ii,Fn,el]}],stroke:[{stroke:["none",...q()]}],"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"]}},L_=f_(D_);function qe(...e){return L_(q4(e))}function M_(e){if(!e||typeof e!="string")return null;try{return JSON.parse(e)}catch{return null}}const P_=G4("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 jr({className:e,variant:t,...r}){return s.jsx("div",{className:qe(P_({variant:t}),e),...r})}const F_=G4("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",{variants:{variant:{default:"bg-primary text-primary-foreground shadow hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground shadow-sm hover:bg-destructive/90",outline:"border border-input bg-background shadow-sm hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground shadow-sm hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2",sm:"h-8 rounded-md px-3 text-xs",lg:"h-10 rounded-md px-8",icon:"h-9 w-9"}},defaultVariants:{variant:"default",size:"default"}}),Fe=x.forwardRef(({className:e,variant:t,size:r,...n},a)=>s.jsx("button",{className:qe(F_({variant:t,size:r,className:e})),ref:a,...n}));Fe.displayName="Button";function Zm({checked:e,onToggle:t,ariaLabel:r="Toggle dark mode"}){const{isDarkMode:n,toggleDarkMode:a}=zi(),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:"relative inline-flex h-8 w-14 items-center rounded-full bg-gray-200 transition-colors duration-200 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2 dark:bg-gray-700 dark:focus:ring-offset-gray-900",role:"switch","aria-checked":o,"aria-label":r,children:[s.jsx("span",{className:"sr-only",children:r}),s.jsx("span",{className:`${o?"translate-x-7":"translate-x-1"} flex h-6 w-6 transform items-center justify-center rounded-full bg-white shadow-lg transition-transform duration-200`,children:o?s.jsx(Hh,{className:"h-3.5 w-3.5 text-gray-700"}):s.jsx(Wh,{className:"h-3.5 w-3.5 text-yellow-500"})})]})}const wt=x.forwardRef(({className:e,type:t,...r},n)=>s.jsx("input",{type:t,className:qe("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}));wt.displayName="Input";const Xh=x.forwardRef(({className:e,children:t,...r},n)=>s.jsx("div",{className:qe(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})}));Xh.displayName="ScrollArea";function B_(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 z_(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 wn({children:e,content:t,position:r="top",className:n="",delay:a=500}){const[i,o]=x.useState(!1),l=x.useRef(null),c=()=>{l.current!==null&&(window.clearTimeout(l.current),l.current=null)},u=()=>{c(),l.current=window.setTimeout(()=>{o(!0)},a)},p=()=>{c(),o(!1)};return x.useEffect(()=>()=>{c()},[]),t?s.jsxs("div",{className:"relative inline-block",onMouseEnter:u,onMouseLeave:p,children:[e,i&&s.jsxs("div",{className:qe("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",B_(r),n),children:[t,s.jsx("div",{className:qe("absolute w-0 h-0 border-4 border-transparent",z_(r))})]})]}):s.jsx(s.Fragment,{children:e})}const Yg="https://discord.gg/buxwujPNRE";function Zg({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 U_({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(Tg,{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(Tg,{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:Yg,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(Zg,{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(gt,{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:Yg,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(Zg,{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(gt,{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 $_({isPWA:e,isMobile:t,isLoading:r,projectsCount:n,searchFilter:a,onSearchFilterChange:i,onClearSearchFilter:o,onRefresh:l,isRefreshing:c,onCreateProject:u,onCollapseSidebar:p,t:d}){const h=()=>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:d("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(h,{}),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:l,disabled:c,title:d("tooltips.refresh"),children:s.jsx(Er,{className:`h-3.5 w-3.5 ${c?"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:u,title:d("tooltips.createProject"),children:s.jsx(Ut,{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:p,title:d("tooltips.hideSidebar"),children:s.jsx(BA,{className:"h-3.5 w-3.5"})})]})]}),n>0&&!r&&s.jsxs("div",{className:"relative mt-2.5",children:[s.jsx(Xn,{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(wt,{type:"text",placeholder:d("projects.searchPlaceholder"),value:a,onChange:m=>i(m.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,className:"absolute right-2.5 top-1/2 -translate-y-1/2 rounded-md p-0.5 hover:bg-accent",children:s.jsx(ft,{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(h,{}),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:l,disabled:c,children:s.jsx(Er,{className:`h-4 w-4 text-muted-foreground ${c?"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:u,children:s.jsx(Zn,{className:"h-4 w-4"})})]})]}),n>0&&!r&&s.jsxs("div",{className:"relative mt-2.5",children:[s.jsx(Xn,{className:"pointer-events-none absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground/50"}),s.jsx(wt,{type:"text",placeholder:d("projects.searchPlaceholder"),value:a,onChange:m=>i(m.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,className:"absolute right-2.5 top-1/2 -translate-y-1/2 rounded-md p-1 hover:bg-accent",children:s.jsx(ft,{className:"h-3.5 w-3.5 text-muted-foreground"})})]})]}),s.jsx("div",{className:"nav-divider md:hidden"})]})}const Xg={xs:"w-3 h-3",sm:"w-4 h-4",md:"w-5 h-5",lg:"w-6 h-6"},q_={xs:"p-0.5",sm:"p-1",md:"p-1.5",lg:"p-2"},G_=e=>e==="fully-configured"?{icon:wo,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:gt,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:ko,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:ft,colorClassName:"text-gray-400 dark:text-gray-500",backgroundClassName:"bg-gray-50 dark:bg-gray-900",label:"No TaskMaster",title:"TaskMaster not configured"};function H_({status:e="not-configured",size:t="sm",className:r="",showLabel:n=!1}){const a=G_(e),i=a.icon;return n?s.jsxs("div",{className:qe("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:Xg[t]}),s.jsx("span",{className:"font-medium",children:a.label})]}):s.jsx("div",{className:qe("inline-flex items-center justify-center rounded-full transition-colors",a.backgroundClassName,q_[t],r),title:a.title,children:s.jsx(i,{className:qe(Xg[t],a.colorClassName)})})}const Jg=(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 W_({project:e,session:t,selectedSession:r,currentTime:n,editingSession:a,editingSessionName:i,onEditingSessionNameChange:o,onStartEditingSession:l,onCancelEditingSession:c,onSaveEditingSession:u,onProjectSelect:p,onSessionSelect:d,onDeleteSession:h,t:m}){const f=VI(t,n,m),g=r?.id===t.id,v=()=>{p(e),d(t,e.name)},b=()=>{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:qe("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:qe("w-5 h-5 rounded-md flex items-center justify-center flex-shrink-0",g?"bg-primary/10":"bg-muted/50"),children:s.jsx(gr,{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(Ii,{className:"h-2.5 w-2.5 text-muted-foreground"}),s.jsx("span",{className:"text-xs text-muted-foreground",children:Jg(f.sessionTime,n,m)}),f.messageCount>0&&s.jsx(jr,{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(gr,{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:k=>{k.stopPropagation(),y()},children:s.jsx(nr,{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:qe("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:()=>d(t,e.name),children:s.jsxs("div",{className:"flex w-full min-w-0 items-start gap-2",children:[s.jsx(gr,{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(Ii,{className:"h-2.5 w-2.5 text-muted-foreground"}),s.jsx("span",{className:"text-xs text-muted-foreground",children:Jg(f.sessionTime,n,m)}),f.messageCount>0&&s.jsx(jr,{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(gr,{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:k=>o(k.target.value),onKeyDown:k=>{k.stopPropagation(),k.key==="Enter"?b():k.key==="Escape"&&c()},onClick:k=>k.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:k=>{k.stopPropagation(),b()},title:m("tooltips.save"),children:s.jsx(rr,{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:k=>{k.stopPropagation(),c()},title:m("tooltips.cancel"),children:s.jsx(ft,{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:k=>{k.stopPropagation(),l(t.id,f.sessionName)},title:m("tooltips.editSessionName"),children:s.jsx(HA,{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:k=>{k.stopPropagation(),y()},title:m("tooltips.deleteSession"),children:s.jsx(nr,{className:"h-3 w-3 text-red-600 dark:text-red-400"})})]})})]})]})}function V_(){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 K_({project:e,isExpanded:t,sessions:r,selectedSession:n,initialSessionsLoaded:a,isLoadingSessions:i,currentTime:o,editingSession:l,editingSessionName:c,onEditingSessionNameChange:u,onStartEditingSession:p,onCancelEditingSession:d,onSaveEditingSession:h,onProjectSelect:m,onSessionSelect:f,onDeleteSession:g,onLoadMoreSessions:v,onNewSession:b,t:y}){if(!t)return null;const k=r.length>0,E=e.sessionMeta?.hasMore===!0;return s.jsxs("div",{className:"ml-3 space-y-1 border-l border-border pl-3",children:[a?!k&&!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(T=>s.jsx(W_,{project:e,session:T,selectedSession:n,currentTime:o,editingSession:l,editingSessionName:c,onEditingSessionNameChange:u,onStartEditingSession:p,onCancelEditingSession:d,onSaveEditingSession:h,onProjectSelect:m,onSessionSelect:f,onDeleteSession:g,t:y},T.id)):s.jsx(V_,{}),k&&E&&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(lr,{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),b(e)},children:[s.jsx(Ut,{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:()=>b(e),children:[s.jsx(Ut,{className:"h-3 w-3"}),y("sessions.newSession")]})]})}const Y_=(e,t)=>{const r=e.length;return t&&r>=5?`${r}+`:`${r}`};function Z_({project:e,selectedProject:t,selectedSession:r,isExpanded:n,isDeleting:a,isStarred:i,editingProject:o,editingName:l,sessions:c,initialSessionsLoaded:u,isLoadingSessions:p,currentTime:d,editingSession:h,editingSessionName:m,tasksEnabled:f,mcpServerStatus:g,onEditingNameChange:v,onToggleProject:b,onProjectSelect:y,onToggleStarProject:k,onStartEditingProject:E,onCancelEditingProject:T,onSaveProjectName:w,onDeleteProject:S,onSessionSelect:j,onDeleteSession:I,onLoadMoreSessions:A,onNewSession:L,onEditingSessionNameChange:R,onStartEditingSession:F,onCancelEditingSession:C,onSaveEditingSession:H,t:Y}){const W=t?.name===e.name,q=o===e.name,V=e.sessionMeta?.hasMore===!0,P=Y_(c,V),G=`${P} session${c.length===1?"":"s"}`,U=ZI(e,g),D=()=>b(e.name),ee=()=>k(e.name),re=()=>{w(e.name)},ge=()=>{t?.name!==e.name&&y(e),D()};return s.jsxs("div",{className:qe("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:qe("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:D,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:qe("w-8 h-8 rounded-lg flex items-center justify-center transition-colors",n?"bg-primary/10":"bg-muted"),children:n?s.jsx(Nn,{className:"h-4 w-4 text-primary"}):s.jsx(nn,{className:"h-4 w-4 text-muted-foreground"})}),s.jsx("div",{className:"min-w-0 flex-1",children:q?s.jsx("input",{type:"text",value:l,onChange:oe=>v(oe.target.value),className:"w-full rounded-lg border-2 border-primary/40 bg-background px-3 py-2 text-sm text-foreground shadow-sm transition-all duration-200 focus:border-primary focus:shadow-md focus:outline-none",placeholder:Y("projects.projectNamePlaceholder"),autoFocus:!0,autoComplete:"off",onClick:oe=>oe.stopPropagation(),onKeyDown:oe=>{oe.key==="Enter"&&re(),oe.key==="Escape"&&T()},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(H_,{status:U,size:"xs",className:"ml-2 hidden flex-shrink-0 md:inline-flex"})]}),s.jsx("p",{className:"text-xs text-muted-foreground",children:G})]})})]}),s.jsx("div",{className:"flex items-center gap-1",children:q?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:oe=>{oe.stopPropagation(),re()},children:s.jsx(rr,{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:oe=>{oe.stopPropagation(),T()},children:s.jsx(ft,{className:"h-4 w-4 text-white"})})]}):s.jsxs(s.Fragment,{children:[s.jsx("button",{className:qe("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:oe=>{oe.stopPropagation(),ee()},title:Y(i?"tooltips.removeFromFavorites":"tooltips.addToFavorites"),children:s.jsx(Rg,{className:qe("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:oe=>{oe.stopPropagation(),S(e)},children:s.jsx(nr,{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:oe=>{oe.stopPropagation(),E(e)},children:s.jsx(Ri,{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(lr,{className:"h-3 w-3 text-muted-foreground"}):s.jsx(Sr,{className:"h-3 w-3 text-muted-foreground"})})]})})]})})}),s.jsxs(Fe,{variant:"ghost",className:qe("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:ge,children:[s.jsxs("div",{className:"flex min-w-0 flex-1 items-center gap-3",children:[n?s.jsx(Nn,{className:"h-4 w-4 flex-shrink-0 text-primary"}):s.jsx(nn,{className:"h-4 w-4 flex-shrink-0 text-muted-foreground"}),s.jsx("div",{className:"min-w-0 flex-1 text-left",children:q?s.jsxs("div",{className:"space-y-1",children:[s.jsx("input",{type:"text",value:l,onChange:oe=>v(oe.target.value),className:"w-full rounded border border-border bg-background px-2 py-1 text-sm text-foreground focus:ring-2 focus:ring-primary/20",placeholder:Y("projects.projectNamePlaceholder"),autoFocus:!0,onKeyDown:oe=>{oe.key==="Enter"&&re(),oe.key==="Escape"&&T()}}),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:q?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:oe=>{oe.stopPropagation(),re()},children:s.jsx(rr,{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:oe=>{oe.stopPropagation(),T()},children:s.jsx(ft,{className:"h-3 w-3"})})]}):s.jsxs(s.Fragment,{children:[s.jsx("div",{className:qe("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:oe=>{oe.stopPropagation(),ee()},title:Y(i?"tooltips.removeFromFavorites":"tooltips.addToFavorites"),children:s.jsx(Rg,{className:qe("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:oe=>{oe.stopPropagation(),E(e)},title:Y("tooltips.renameProject"),children:s.jsx(Ri,{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:oe=>{oe.stopPropagation(),S(e)},title:Y("tooltips.deleteProject"),children:s.jsx(nr,{className:"h-3 w-3 text-red-600 dark:text-red-400"})}),n?s.jsx(lr,{className:"h-4 w-4 text-muted-foreground transition-colors group-hover:text-foreground"}):s.jsx(Sr,{className:"h-4 w-4 text-muted-foreground transition-colors group-hover:text-foreground"})]})})]})]}),s.jsx(K_,{project:e,isExpanded:n,sessions:c,selectedSession:r,initialSessionsLoaded:u,isLoadingSessions:p,currentTime:d,editingSession:h,editingSessionName:m,onEditingSessionNameChange:R,onStartEditingSession:F,onCancelEditingSession:C,onSaveEditingSession:H,onProjectSelect:y,onSessionSelect:j,onDeleteSession:I,onLoadMoreSessions:A,onNewSession:L,t:Y})]})}function X_({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(nn,{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(Xn,{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 J_({projects:e,filteredProjects:t,selectedProject:r,selectedSession:n,isLoading:a,loadingProgress:i,expandedProjects:o,editingProject:l,editingName:c,loadingSessions:u,initialSessionsLoaded:p,currentTime:d,editingSession:h,editingSessionName:m,deletingProjects:f,tasksEnabled:g,mcpServerStatus:v,getProjectSessions:b,isProjectStarred:y,onEditingNameChange:k,onToggleProject:E,onProjectSelect:T,onToggleStarProject:w,onStartEditingProject:S,onCancelEditingProject:j,onSaveProjectName:I,onDeleteProject:A,onSessionSelect:L,onDeleteSession:R,onLoadMoreSessions:F,onNewSession:C,onEditingSessionNameChange:H,onStartEditingSession:Y,onCancelEditingSession:W,onSaveEditingSession:q,t:V}){const P=s.jsx(X_,{isLoading:a,loadingProgress:i,projectsCount:e.length,filteredProjectsCount:t.length,t:V});x.useEffect(()=>{let U="CloudCLI UI";const D=r?.displayName?.trim();D&&(U=`${D} - ${U}`),document.title=U},[r]);const G=!a&&e.length>0&&t.length>0;return s.jsx("div",{className:"pb-safe-area-inset-bottom md:space-y-1",children:G?t.map(U=>s.jsx(Z_,{project:U,selectedProject:r,selectedSession:n,isExpanded:o.has(U.name),isDeleting:f.has(U.name),isStarred:y(U.name),editingProject:l,editingName:c,sessions:b(U),initialSessionsLoaded:p.has(U.name),isLoadingSessions:!!u[U.name],currentTime:d,editingSession:h,editingSessionName:m,tasksEnabled:g,mcpServerStatus:v,onEditingNameChange:k,onToggleProject:E,onProjectSelect:T,onToggleStarProject:w,onStartEditingProject:S,onCancelEditingProject:j,onSaveProjectName:I,onDeleteProject:A,onSessionSelect:L,onDeleteSession:R,onLoadMoreSessions:F,onNewSession:C,onEditingSessionNameChange:H,onStartEditingSession:Y,onCancelEditingSession:W,onSaveEditingSession:q,t:V},U.name)):P})}function Q_({isPWA:e,isMobile:t,isLoading:r,projects:n,searchFilter:a,onSearchFilterChange:i,onClearSearchFilter:o,onRefresh:l,isRefreshing:c,onCreateProject:u,onCollapseSidebar:p,updateAvailable:d,releaseInfo:h,latestVersion:m,onShowVersionModal:f,onShowSettings:g,projectListProps:v,t:b}){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($_,{isPWA:e,isMobile:t,isLoading:r,projectsCount:n.length,searchFilter:a,onSearchFilterChange:i,onClearSearchFilter:o,onRefresh:l,isRefreshing:c,onCreateProject:u,onCollapseSidebar:p,t:b}),s.jsx(Xh,{className:"flex-1 overflow-y-auto overscroll-contain md:px-1.5 md:py-2",children:s.jsx(J_,{...v})}),s.jsx(U_,{updateAvailable:d,releaseInfo:h,latestVersion:m,onShowVersionModal:f,onShowSettings:g,t:b})]})}const e8={fontSize:"14"},ns={authenticated:!1,email:null,loading:!0,error:null},Qg={name:"",type:"stdio",scope:"user",projectPath:"",config:{command:"",args:[],env:{},url:"",headers:{},timeout:3e4},importMode:"form",jsonInput:""},eb={name:"",type:"stdio",config:{command:"",args:[],env:{}}},t8={allowedCommands:[],disallowedCommands:[],skipPermissions:!1},r8={claude:"/api/cli/claude/status",cursor:"/api/cli/cursor/status",codex:"/api/cli/codex/status",gemini:"/api/cli/gemini/status"},tE=e=>e==="sse"||e==="http"?e:"stdio",n8=e=>e==="local"?"local":"user",a8=e=>e instanceof Error?e.message:"Unknown error",i8=e=>({name:e.name||"",type:tE(e.type),scope:n8(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 s8({isOpen:e,editingServer:t,projects:r,onClose:n,onSubmit:a}){const{t:i}=ze("settings"),[o,l]=x.useState(Qg),[c,u]=x.useState(""),[p,d]=x.useState(!1),h=!!t;x.useEffect(()=>{if(e){if(u(""),t){l(i8(t));return}l(Qg)}},[t,e]);const m=x.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=(b,y)=>{l(k=>({...k,config:{...k.config,[b]:y}}))},g=b=>{if(!b.trim()){u("");return}try{const y=JSON.parse(b);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 b=>{b.preventDefault(),d(!0);try{await a(o,t)}catch(y){alert(`Error: ${a8(y)}`)}finally{d(!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(ft,{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(b=>({...b,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(b=>({...b,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(_i,{className:"h-4 w-4"}):s.jsx(Nn,{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(b=>({...b,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(_i,{className:"h-4 w-4"}),s.jsx("span",{children:i("mcpForm.scope.userGlobal")})]})}),s.jsx("button",{type:"button",onClick:()=>l(b=>({...b,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(Nn,{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:b=>{l(y=>({...y,projectPath:b.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(b=>s.jsx("option",{value:b.path||b.fullPath,children:b.displayName||b.name},b.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(wt,{value:o.name,onChange:b=>l(y=>({...y,name:b.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:b=>{l(y=>({...y,type:tE(b.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:b=>{const y=b.target.value;l(k=>({...k,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:`{
605
605
  "type": "stdio",
606
606
  "command": "/path/to/server",
607
607
  "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-7_J3n3lH.js"></script>
28
+ <script type="module" crossorigin src="/assets/index-C6ZomNnQ.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.23.0",
3
+ "version": "1.23.2",
4
4
  "description": "A web-based UI for Claude Code CLI",
5
5
  "type": "module",
6
6
  "main": "server/index.js",