@cloudcli-ai/cloudcli 1.31.3 → 1.31.4
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.
|
@@ -701,7 +701,7 @@ import{j as s,_ as aj,a as ij,m as dN,E as Mr,R as pN,o as mN,T as hN,P as fN,S
|
|
|
701
701
|
.xterm-screen:focus {
|
|
702
702
|
outline: none !important;
|
|
703
703
|
}
|
|
704
|
-
`;function DD(){if(typeof document>"u"||document.getElementById(oy))return;const e=document.createElement("style");e.id=oy,e.type="text/css",e.innerText=_D,document.head.appendChild(e)}function MD({terminalContainerRef:e,terminalRef:t,fitAddonRef:r,wsRef:n,selectedProject:a,minimal:i,isRestarting:o,initialCommandRef:l,isPlainShellRef:c,authUrlRef:u,copyAuthUrlToClipboard:d,closeSocket:p}){const[h,m]=f.useState(!1),g=f.useRef(null),b=a?.fullPath||a?.path||"",x=!!a;f.useEffect(()=>{DD()},[]);const y=f.useCallback(()=>{t.current&&(t.current.clear(),t.current.write("\x1B[2J\x1B[H"))},[t]),v=f.useCallback(()=>{t.current&&(t.current.dispose(),t.current=null),r.current=null,m(!1)},[r,t]);return f.useEffect(()=>{if(!e.current||!x||o||t.current)return;const k=new ID.Terminal(xD);t.current=k;const S=new CD.FitAddon;r.current=S,k.loadAddon(S),i||k.loadAddon(new TD.WebLinksAddon);try{k.loadAddon(new AD.WebglAddon)}catch{console.warn("[Shell] WebGL renderer unavailable, using Canvas fallback")}k.open(e.current);const E=async()=>{const T=k.getSelection();return T?sn(T):!1},w=T=>{if(!k.hasSelection())return;const j=k.getSelection();if(j){if(T.preventDefault(),T.clipboardData){T.clipboardData.setData("text/plain",j);return}sn(j)}};e.current.addEventListener("copy",w),k.attachCustomKeyEventHandler(T=>{const j=XN(l.current)?YN:u.current;return T.type==="keydown"&&i&&c.current&&j&&!T.ctrlKey&&!T.metaKey&&!T.altKey&&T.key?.toLowerCase()==="c"?(T.preventDefault(),T.stopPropagation(),d(j),!1):T.type==="keydown"&&(T.ctrlKey||T.metaKey)&&T.key?.toLowerCase()==="c"&&k.hasSelection()?(T.preventDefault(),T.stopPropagation(),E(),!1):T.type==="keydown"&&(T.ctrlKey||T.metaKey)&&T.key?.toLowerCase()==="v"?(T.preventDefault(),T.stopPropagation(),typeof navigator<"u"&&navigator.clipboard?.readText&&navigator.clipboard.readText().then(D=>{xa(n.current,{type:"input",data:D})}).catch(()=>{}),!1):!0}),window.setTimeout(()=>{const T=r.current,j=t.current;!T||!j||(T.fit(),xa(n.current,{type:"resize",cols:j.cols,rows:j.rows}))},ZN),m(!0);const N=k.onData(T=>{xa(n.current,{type:"input",data:T})}),R=new ResizeObserver(()=>{g.current!==null&&window.clearTimeout(g.current),g.current=window.setTimeout(()=>{const T=r.current,j=t.current;!T||!j||(T.fit(),xa(n.current,{type:"resize",cols:j.cols,rows:j.rows}))},pD)});return R.observe(e.current),()=>{e.current?.removeEventListener("copy",w),R.disconnect(),g.current!==null&&(window.clearTimeout(g.current),g.current=null),N.dispose(),p(),v()}},[u,p,d,v,r,l,c,o,i,x,b,e,t,n]),{isInitialized:h,clearTerminalScreen:y,disposeTerminal:v}}function OD({selectedProject:e,selectedSession:t,initialCommand:r,isPlainShell:n,minimal:a,autoConnect:i,isRestarting:o,onProcessComplete:l,onOutputRef:c}){const u=f.useRef(null),d=f.useRef(null),p=f.useRef(null),h=f.useRef(null),[m,g]=f.useState(""),[b,x]=f.useState(0),y=f.useRef(e),v=f.useRef(t),k=f.useRef(r),S=f.useRef(n),E=f.useRef(l),w=f.useRef(""),N=f.useRef(t?.id??null);f.useEffect(()=>{y.current=e,v.current=t,k.current=r,S.current=n,E.current=l},[e,t,r,n,l]);const R=f.useCallback(H=>{w.current=H,g(H),x(M=>M+1)},[]),T=f.useCallback(()=>{const H=h.current;H&&((H.readyState===WebSocket.OPEN||H.readyState===WebSocket.CONNECTING)&&H.close(),h.current=null)},[]),j=f.useCallback((H=w.current)=>{if(!H)return!1;const M=window.open(H,"_blank");if(M){try{M.opener=null}catch{}return!0}return!1},[]),D=f.useCallback(async(H=w.current)=>H?sn(H):!1,[]),{isInitialized:A,clearTerminalScreen:F,disposeTerminal:C}=MD({terminalContainerRef:u,terminalRef:d,fitAddonRef:p,wsRef:h,selectedProject:e,minimal:a,isRestarting:o,initialCommandRef:k,isPlainShellRef:S,authUrlRef:w,copyAuthUrlToClipboard:D,closeSocket:T}),{isConnected:$,isConnecting:Y,connectToShell:V,disconnectFromShell:K}=ED({wsRef:h,terminalRef:d,fitAddonRef:p,selectedProjectRef:y,selectedSessionRef:v,initialCommandRef:k,isPlainShellRef:S,onProcessCompleteRef:E,isInitialized:A,autoConnect:i,closeSocket:T,clearTerminalScreen:F,setAuthUrl:R,onOutputRef:c});return f.useEffect(()=>{o&&(K(),C())},[K,C,o]),f.useEffect(()=>{e||(K(),C())},[K,C,e]),f.useEffect(()=>{const H=t?.id??null;N.current!==H&&A&&K(),N.current=H},[K,A,t?.id]),{terminalContainerRef:u,terminalRef:d,wsRef:h,isConnected:$,isInitialized:A,isConnecting:Y,authUrl:m,authUrlVersion:b,connectToShell:V,disconnectFromShell:K,openAuthUrlInBrowser:j,copyAuthUrlToClipboard:D}}function LD({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 PD({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 FD({isConnected:e,isInitialized:t,isRestarting:r,hasSession:n,sessionDisplayNameShort:a,onDisconnect:i,onRestart:o,statusNewSessionText:l,statusInitializingText:c,statusRestartingText:u,disconnectLabel:d,disconnectTitle:p,restartLabel:h,restartTitle:m,disableRestart:g}){return s.jsx("div",{className:"flex-shrink-0 border-b border-gray-700 bg-gray-800 px-4 py-2",children:s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("div",{className:"flex items-center space-x-2",children:[s.jsx("div",{className:`h-2 w-2 rounded-full ${e?"bg-green-500":"bg-red-500"}`}),n&&a&&s.jsxs("span",{className:"text-xs text-blue-300",children:["(",a,"...)"]}),!n&&s.jsx("span",{className:"text-xs text-gray-400",children:l}),!t&&s.jsx("span",{className:"text-xs text-yellow-400",children:c}),r&&s.jsx("span",{className:"text-xs text-blue-400",children:u})]}),s.jsxs("div",{className:"flex items-center space-x-3",children:[e&&s.jsxs("button",{onClick:i,className:"flex items-center space-x-1 rounded bg-red-600 px-3 py-1 text-xs text-white hover:bg-red-700",title:p,children:[s.jsx("svg",{className:"h-3 w-3",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})}),s.jsx("span",{children:d})]}),s.jsxs("button",{onClick:o,disabled:g,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 zD({terminalContainerRef:e,authUrl:t,authUrlVersion:r,initialCommand:n,isConnected:a,openAuthUrlInBrowser:i,copyAuthUrlToClipboard:o}){const[l,c]=f.useState("idle"),[u,d]=f.useState(!1),p=f.useMemo(()=>jD(n,t),[t,n]);f.useEffect(()=>{c("idle"),d(!1)},[r,p,a]);const h=!!p,m=h&&!u,g=h&&u;return s.jsxs("div",{className:"relative h-full w-full bg-gray-900",children:[s.jsx("div",{ref:e,className:"h-full w-full focus:outline-none",style:{outline:"none"}}),m&&s.jsx("div",{className:"absolute inset-x-0 bottom-14 z-20 border-t border-gray-700/80 bg-gray-900/95 p-3 backdrop-blur-sm md:hidden",children:s.jsxs("div",{className:"flex flex-col gap-2",children:[s.jsxs("div",{className:"flex items-center justify-between gap-2",children:[s.jsx("p",{className:"text-xs text-gray-300",children:"Open or copy the login URL:"}),s.jsx("button",{type:"button",onClick:()=>d(!0),className:"rounded bg-gray-700 px-2 py-1 text-[10px] font-medium uppercase tracking-wide text-gray-100 hover:bg-gray-600",children:"Hide"})]}),s.jsx("input",{type:"text",value:p,readOnly:!0,onClick:b=>b.currentTarget.select(),className:"w-full rounded border border-gray-600 bg-gray-800 px-2 py-1 text-xs text-gray-100 focus:outline-none focus:ring-1 focus:ring-blue-500","aria-label":"Authentication URL"}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("button",{type:"button",onClick:()=>{i(p)},className:"flex-1 rounded bg-blue-600 px-3 py-2 text-xs font-medium text-white hover:bg-blue-700",children:"Open URL"}),s.jsx("button",{type:"button",onClick:async()=>{const b=await o(p);c(b?"copied":"failed")},className:"flex-1 rounded bg-gray-700 px-3 py-2 text-xs font-medium text-white hover:bg-gray-600",children:l==="copied"?"Copied":"Copy URL"})]})]})}),g&&s.jsx("div",{className:"absolute bottom-14 right-3 z-20 md:hidden",children:s.jsx("button",{type:"button",onClick:()=>d(!1),className:"rounded bg-gray-800/95 px-3 py-2 text-xs font-medium text-gray-100 shadow-lg backdrop-blur-sm hover:bg-gray-700",children:"Show login URL"})})]})}const BD=[{type:"key",id:"esc",label:"Esc",sequence:"\x1B"},{type:"key",id:"tab",label:"Tab",sequence:" "},{type:"key",id:"shift-tab",label:"⇧Tab",sequence:"\x1B[Z"},{type:"modifier",id:"ctrl",label:"CTRL",modifier:"ctrl"},{type:"modifier",id:"alt",label:"ALT",modifier:"alt"},{type:"arrow",id:"arrow-up",sequence:"\x1B[A",icon:"up"},{type:"arrow",id:"arrow-down",sequence:"\x1B[B",icon:"down"},{type:"arrow",id:"arrow-left",sequence:"\x1B[D",icon:"left"},{type:"arrow",id:"arrow-right",sequence:"\x1B[C",icon:"right"}],$D={up:DN,down:Il,left:K7,right:$g},Fi=e=>e.preventDefault(),ly="shrink-0 rounded-md border border-gray-600 bg-gray-700 px-2.5 py-1.5 text-xs font-medium text-gray-100 transition-colors select-none active:bg-blue-600 active:text-white active:border-blue-600 disabled:cursor-not-allowed disabled:opacity-40",UD="shrink-0 rounded-md border border-blue-500 bg-blue-600 px-2.5 py-1.5 text-xs font-medium text-white transition-colors select-none disabled:cursor-not-allowed disabled:opacity-40",xc="shrink-0 rounded-md border border-gray-600 bg-gray-700 p-1.5 text-gray-100 transition-colors select-none active:bg-blue-600 active:text-white active:border-blue-600 disabled:cursor-not-allowed disabled:opacity-40";function cy({wsRef:e,terminalRef:t,isConnected:r,bottomOffset:n="bottom-0"}){const{t:a}=Le("settings"),[i,o]=f.useState(!1),[l,c]=f.useState(!1),u=f.useCallback(m=>{xa(e.current,{type:"input",data:m})},[e]),d=f.useCallback(()=>{t.current?.scrollToBottom()},[t]),p=f.useCallback(async()=>{if(!(typeof navigator>"u"||!navigator.clipboard?.readText))try{const m=await navigator.clipboard.readText();m.length>0&&u(m)}catch{}},[u]),h=f.useCallback(m=>{let g=m;if(i&&m.length===1){const b=m.toLowerCase().charCodeAt(0);b>=97&&b<=122&&(g=String.fromCharCode(b-96)),o(!1)}l&&m.length===1&&(g="\x1B"+g,c(!1)),u(g)},[i,l,u]);return s.jsx("div",{className:`pointer-events-none fixed inset-x-0 ${n} z-20 px-2 md:hidden`,children:s.jsxs("div",{className:"pointer-events-auto flex items-center gap-1 overflow-x-auto rounded-lg border border-gray-700/80 bg-gray-900/95 px-1.5 py-1.5 shadow-lg backdrop-blur-sm [-webkit-overflow-scrolling:touch] [scrollbar-width:none] [&::-webkit-scrollbar]:hidden",children:[s.jsx("button",{type:"button",onPointerDown:Fi,onClick:()=>{p()},disabled:!r,className:xc,title:a("terminalShortcuts.paste",{defaultValue:"Paste"}),"aria-label":a("terminalShortcuts.paste",{defaultValue:"Paste"}),children:s.jsx(LR,{className:"h-4 w-4"})}),BD.map(m=>{if(m.type==="modifier"){const g=m.modifier==="ctrl"?i:l,b=m.modifier==="ctrl"?()=>o(x=>!x):()=>c(x=>!x);return s.jsx("button",{type:"button",onPointerDown:Fi,onClick:b,disabled:!r,className:g?UD:ly,children:m.label},m.id)}if(m.type==="arrow"){const g=$D[m.icon];return s.jsx("button",{type:"button",onPointerDown:Fi,onClick:()=>u(m.sequence),disabled:!r,className:xc,children:s.jsx(g,{className:"h-4 w-4"})},m.id)}return s.jsx("button",{type:"button",onPointerDown:Fi,onClick:()=>h(m.sequence),disabled:!r,className:ly,children:m.label},m.id)}),s.jsx("button",{type:"button",onPointerDown:Fi,onClick:d,disabled:!r,className:xc,title:a("terminalShortcuts.scrollDown"),"aria-label":a("terminalShortcuts.scrollDown"),children:s.jsx(_N,{className:"h-4 w-4"})})]})})}function JN({selectedProject:e=null,selectedSession:t=null,initialCommand:r=null,isPlainShell:n=!1,onProcessComplete:a=null,minimal:i=!1,autoConnect:o=!1,isActive:l=!0}){const{t:c}=Le("chat"),[u,d]=f.useState(!1),[p,h]=f.useState(null),m=f.useRef(null),g=f.useRef(null),{terminalContainerRef:b,terminalRef:x,wsRef:y,isConnected:v,isInitialized:k,isConnecting:S,authUrl:E,authUrlVersion:w,connectToShell:N,disconnectFromShell:R,openAuthUrlInBrowser:T,copyAuthUrlToClipboard:j}=OD({selectedProject:e,selectedSession:t,initialCommand:r,isPlainShell:n,minimal:i,autoConnect:o,isRestarting:u,onProcessComplete:a,onOutputRef:g}),D=f.useCallback(()=>{const P=x.current;if(!P)return;const O=P.buffer.active,Z=O.baseY+O.cursorY,G=Math.min(O.baseY+O.length-1,Z+10),ne=Math.max(0,Z-hD),re=[];for(let Te=ne;Te<=G;Te++){const Ie=O.getLine(Te);Ie&&re.push(Ie.translateToString().trimEnd())}let pe=-1;for(let Te=re.length-1;Te>=0;Te--)if(/esc to cancel/i.test(re[Te])||/enter to select/i.test(re[Te])){pe=Te;break}if(pe===-1){h(null);return}const me=new Map,ye=Math.max(0,pe-fD);for(let Te=pe-1;Te>=ye;Te--){const Ie=re[Te].match(/^\s*[❯›>]?\s*(\d+)\.\s+(.+)/);if(Ie){const L=Ie[1],ce=Ie[2].trim();parseInt(L,10)<=gD&&ce.length>0&&!me.has(L)&&me.set(L,ce)}}const ve=[];for(let Te=1;Te<=me.size&&me.has(String(Te));Te++)ve.push({number:String(Te),label:me.get(String(Te))});h(ve.length>=bD?ve:null)},[x]),A=f.useCallback(()=>{m.current&&clearTimeout(m.current),m.current=setTimeout(D,mD)},[D]);f.useEffect(()=>{g.current=A},[A]),f.useEffect(()=>()=>{m.current&&clearTimeout(m.current)},[]),f.useEffect(()=>{v||(m.current&&(clearTimeout(m.current),m.current=null),h(null))},[v]),f.useEffect(()=>{if(!l||!k||!v)return;const P=()=>{x.current?.focus()},O=window.requestAnimationFrame(P),Z=window.setTimeout(P,0);return()=>{window.cancelAnimationFrame(O),window.clearTimeout(Z)}},[l,v,k,x]);const F=f.useCallback(P=>{xa(y.current,{type:"input",data:P})},[y]),C=f.useMemo(()=>RD(t),[t]),$=f.useMemo(()=>C?C.slice(0,30):null,[C]),Y=f.useMemo(()=>C?C.slice(0,50):null,[C]),V=f.useCallback(()=>{d(!0),window.setTimeout(()=>{d(!1)},dD)},[]);if(!e)return s.jsx(PD,{title:c("shell.selectProject.title"),description:c("shell.selectProject.description")});if(i)return s.jsxs(s.Fragment,{children:[s.jsx(zD,{terminalContainerRef:b,authUrl:E,authUrlVersion:w,initialCommand:r,isConnected:v,openAuthUrlInBrowser:T,copyAuthUrlToClipboard:j}),s.jsx(cy,{wsRef:y,terminalRef:x,isConnected:v,bottomOffset:"bottom-0"})]});const K=n?c("shell.runCommand",{command:r||c("shell.defaultCommand"),projectName:e.displayName}):t?c("shell.resumeSession",{displayName:Y}):c("shell.startSession"),H=n?c("shell.runCommand",{command:r||c("shell.defaultCommand"),projectName:e.displayName}):c("shell.startCli",{projectName:e.displayName}),M=k?S?"connecting":v?null:"connect":"loading",z=M==="connecting"?H:K;return s.jsxs("div",{className:"flex h-full w-full flex-col bg-gray-900",children:[s.jsx(FD,{isConnected:v,isInitialized:k,isRestarting:u,hasSession:!!t,sessionDisplayNameShort:$,onDisconnect:R,onRestart:V,statusNewSessionText:c("shell.status.newSession"),statusInitializingText:c("shell.status.initializing"),statusRestartingText:c("shell.status.restarting"),disconnectLabel:c("shell.actions.disconnect"),disconnectTitle:c("shell.actions.disconnectTitle"),restartLabel:c("shell.actions.restart"),restartTitle:c("shell.actions.restartTitle"),disableRestart:u||v}),s.jsxs("div",{className:"relative flex-1 overflow-hidden p-2",children:[s.jsx("div",{ref:b,className:"h-full w-full focus:outline-none",style:{outline:"none"}}),M&&s.jsx(LD,{mode:M,description:z,loadingLabel:c("shell.loading"),connectLabel:c("shell.actions.connect"),connectTitle:c("shell.actions.connectTitle"),connectingLabel:c("shell.connecting"),onConnect:N}),p&&v&&s.jsx("div",{className:"absolute inset-x-0 bottom-0 z-10 border-t border-gray-700/80 bg-gray-800/95 px-3 py-2 backdrop-blur-sm",onMouseDown:P=>P.preventDefault(),children:s.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[p.map(P=>s.jsxs("button",{type:"button",onClick:()=>{F(P.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:`${P.number}. ${P.label}`,children:[P.number,". ",P.label]},P.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(cy,{wsRef:y,terminalRef:x,isConnected:v})]})}function GD({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 qD({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 QN({project:e=null,session:t=null,command:r=null,isPlainShell:n=null,isActive:a=!0,autoConnect:i=!0,onComplete:o=null,onClose:l=null,title:c=null,className:u="",showHeader:d=!0,compact:p=!1,minimal:h=!1}){const[m,g]=f.useState(!1),b=n!==null?n:r!==null,x=f.useCallback(y=>{g(!0),o?.(y)},[o]);return e?s.jsxs("div",{className:`flex h-full w-full flex-col ${u}`,children:[!h&&d&&c&&s.jsx(qD,{title:c,isCompleted:m,onClose:l}),s.jsx("div",{className:"min-h-0 w-full flex-1",children:s.jsx(JN,{selectedProject:e,selectedSession:t,initialCommand:r,isPlainShell:b,isActive:a,onProcessComplete:x,minimal:h,autoConnect:h?!0:i})})]}):s.jsx(GD,{className:u})}const HD=({provider:e,customCommand:t,isAuthenticated:r})=>t||(e==="claude"?"claude --dangerously-skip-permissions /login":e==="cursor"?"cursor-agent login":e==="codex"?"codex login":"gemini status"),VD=e=>e==="claude"?"Claude CLI Login":e==="cursor"?"Cursor CLI Login":e==="codex"?"Codex CLI Login":"Gemini CLI Configuration";function e5({isOpen:e,onClose:t,provider:r="claude",onComplete:n,customCommand:a,isAuthenticated:i=!1}){if(!e)return null;const o=HD({provider:r,customCommand:a,isAuthenticated:i}),l=VD(r),c=u=>{n?.(u)};return s.jsx("div",{className:"fixed inset-0 z-[9999] flex items-center justify-center bg-black bg-opacity-50 max-md:items-stretch max-md:justify-stretch",children:s.jsxs("div",{className:"flex h-3/4 w-full max-w-4xl flex-col rounded-lg bg-white shadow-xl dark:bg-gray-800 max-md:m-0 max-md:h-full max-md:max-w-none max-md:rounded-none md:m-4 md:h-3/4 md:max-w-4xl md:rounded-lg",children:[s.jsxs("div",{className:"flex items-center justify-between border-b border-gray-200 p-4 dark:border-gray-700",children:[s.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white",children:l}),s.jsx("button",{onClick:t,className:"text-gray-400 transition-colors hover:text-gray-600 dark:hover:text-gray-300","aria-label":"Close login modal",children:s.jsx(gt,{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(FN,{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(Ur,{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(QN,{project:M7,command:o,onComplete:c,minimal:!0})})]})})}const WD=({className:e="w-5 h-5"})=>s.jsx("img",{src:"/icons/claude-ai-icon.svg",alt:"Claude",className:e}),KD=({className:e="w-5 h-5"})=>{const{isDarkMode:t}=Aa();return s.jsx("img",{src:t?"/icons/codex-white.svg":"/icons/codex.svg",alt:"Codex",className:e})},YD=({className:e="w-5 h-5"})=>{const{isDarkMode:t}=Aa();return s.jsx("img",{src:t?"/icons/cursor-white.svg":"/icons/cursor.svg",alt:"Cursor",className:e})},ZD=({className:e="w-5 h-5"})=>s.jsx("img",{src:"/icons/gemini-ai-icon.svg",alt:"Gemini",className:e});function on({provider:e="claude",className:t="w-5 h-5"}){return e==="cursor"?s.jsx(YD,{className:t}):e==="codex"?s.jsx(KD,{className:t}):e==="gemini"?s.jsx(ZD,{className:t}):s.jsx(WD,{className:t})}function XD({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(on,{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(Yt,{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 JD=[{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 QD({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:JD.map(r=>s.jsx(XD,{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 eM({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(sr,{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(J8,{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(U_,{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 uy=[{title:"Git Configuration",icon:sr,required:!0},{title:"Connect Agents",icon:$N,required:!1}];function tM({currentStep:e}){return s.jsx("div",{className:"mb-8",children:s.jsx("div",{className:"flex items-center justify-between",children:uy.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(Yt,{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<uy.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 dy=/^[^\s@]+@[^\s@]+\.[^\s@]+$/,py=async(e,t)=>{try{return(await e.json()).error||t}catch{return t}};function rM({onComplete:e}){const[t,r]=f.useState(0),[n,a]=f.useState(""),[i,o]=f.useState(""),[l,c]=f.useState(!1),[u,d]=f.useState(""),[p,h]=f.useState(null),{providerAuthStatus:m,checkProviderAuthStatus:g,refreshProviderAuthStatuses:b}=KN(),x=f.useRef(void 0),y=f.useCallback(async()=>{try{const R=await Ae("/api/user/git-config");if(!R.ok)return;const T=await R.json();T.gitName&&a(T.gitName),T.gitEmail&&o(T.gitEmail)}catch(R){console.error("Error loading git config:",R)}},[]);f.useEffect(()=>{y(),b()},[y,b]),f.useEffect(()=>{const R=x.current;x.current=p,R!=null&&p===null&&b()},[p,b]);const v=R=>{h(R)},k=R=>{R===0&&p&&g(p)},S=async()=>{if(d(""),t!==0){r(R=>R+1);return}if(!n.trim()||!i.trim()){d("Both git name and email are required.");return}if(!dy.test(i)){d("Please enter a valid email address.");return}c(!0);try{const R=await Ae("/api/user/git-config",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({gitName:n,gitEmail:i})});if(!R.ok){const T=await py(R,"Failed to save git configuration");throw new Error(T)}r(T=>T+1)}catch(R){d(R instanceof Error?R.message:"Failed to save git configuration")}finally{c(!1)}},E=()=>{d(""),r(R=>R-1)},w=async()=>{c(!0),d("");try{const R=await Ae("/api/user/complete-onboarding",{method:"POST"});if(!R.ok){const T=await py(R,"Failed to complete onboarding");throw new Error(T)}await e?.()}catch(R){d(R instanceof Error?R.message:"Failed to complete onboarding")}finally{c(!1)}},N=t===0?!!(n.trim()&&i.trim()&&dy.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(tM,{currentStep:t}),s.jsxs("div",{className:"rounded-lg border border-border bg-card p-8 shadow-lg",children:[t===0?s.jsx(eM,{gitName:n,gitEmail:i,isSubmitting:l,onGitNameChange:a,onGitEmailChange:o}):s.jsx(QD,{providerStatuses:m,onOpenProviderLogin:v}),u&&s.jsx("div",{className:"mt-6 rounded-lg border border-red-300 bg-red-100 p-4 dark:border-red-800 dark:bg-red-900/20",children:s.jsx("p",{className:"text-sm text-red-700 dark:text-red-400",children:u})}),s.jsxs("div",{className:"mt-8 flex items-center justify-between border-t border-border pt-6",children:[s.jsxs("button",{onClick:E,disabled:t===0||l,className:"flex items-center gap-2 px-4 py-2 text-sm font-medium text-muted-foreground transition-colors duration-200 hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50",children:[s.jsx(Gg,{className:"h-4 w-4"}),"Previous"]}),s.jsx("div",{className:"flex items-center gap-3",children:t<1?s.jsx("button",{onClick:S,disabled:!N||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(Ar,{className:"h-4 w-4 animate-spin"}),"Saving..."]}):s.jsxs(s.Fragment,{children:["Next",s.jsx(Or,{className:"h-4 w-4"})]})}):s.jsx("button",{onClick:w,disabled:l,className:"flex items-center gap-2 rounded-lg bg-green-600 px-6 py-3 font-medium text-white transition-colors duration-200 hover:bg-green-700 disabled:cursor-not-allowed disabled:bg-green-400",children:l?s.jsxs(s.Fragment,{children:[s.jsx(Ar,{className:"h-4 w-4 animate-spin"}),"Completing..."]}):s.jsxs(s.Fragment,{children:[s.jsx(Yt,{className:"h-4 w-4"}),"Complete Setup"]})})})]})]})]})}),p&&s.jsx(e5,{isOpen:!!p,onClose:()=>h(null),provider:p,onComplete:k})]})}const nM=["0s","0.1s","0.2s"];function aM(){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(Sn,{className:"h-8 w-8 text-primary-foreground"})})}),s.jsx("h1",{className:"mb-2 text-2xl font-bold text-foreground",children:"CloudCLI"}),s.jsx("div",{className:"flex items-center justify-center space-x-2",children:nM.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 t5({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 os({id:e,label:t,value:r,onChange:n,placeholder:a,isDisabled:i,type:o="text",name:l,autoComplete:c}){return s.jsxs("div",{children:[s.jsx("label",{htmlFor:e,className:"mb-1 block text-sm font-medium text-foreground",children:t}),s.jsx("input",{id:e,type:o,name:l??e,autoComplete:c,value:r,onChange:u=>n(u.target.value),className:"w-full rounded-md border border-border bg-background px-3 py-2 text-foreground focus:border-transparent focus:outline-none focus:ring-2 focus:ring-blue-500",placeholder:a,required:!0,disabled:i})]})}function r5({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(Sn,{className:"h-8 w-8 text-primary-foreground"})})}),s.jsx("h1",{className:"text-2xl font-bold text-foreground",children:e}),s.jsx("p",{className:"mt-2 text-muted-foreground",children:t})]}),r,s.jsx("div",{className:"text-center",children:s.jsx("p",{className:"text-sm text-muted-foreground",children:n})}),s.jsxs("div",{className:"flex items-center justify-center gap-1.5 pt-2",children:[s.jsx("svg",{className:"h-3.5 w-3.5 text-muted-foreground/50",fill:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:s.jsx("path",{d:"M12 2C6.477 2 2 6.484 2 12.017c0 4.425 2.865 8.18 6.839 9.504.5.092.682-.217.682-.483 0-.237-.008-.868-.013-1.703-2.782.605-3.369-1.343-3.369-1.343-.454-1.158-1.11-1.466-1.11-1.466-.908-.62.069-.608.069-.608 1.003.07 1.531 1.032 1.531 1.032.892 1.53 2.341 1.088 2.91.832.092-.647.35-1.088.636-1.338-2.22-.253-4.555-1.113-4.555-4.951 0-1.093.39-1.988 1.029-2.688-.103-.253-.446-1.272.098-2.65 0 0 .84-.27 2.75 1.026A9.564 9.564 0 0112 6.844c.85.004 1.705.115 2.504.337 1.909-1.296 2.747-1.027 2.747-1.027.546 1.379.202 2.398.1 2.651.64.7 1.028 1.595 1.028 2.688 0 3.848-2.339 4.695-4.566 4.943.359.309.678.92.678 1.855 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.019 10.019 0 0022 12.017C22 6.484 17.522 2 12 2z"})}),s.jsx("a",{href:"https://github.com/siteboon/claudecodeui",target:"_blank",rel:"noopener noreferrer",className:"text-xs text-muted-foreground/50 transition-colors hover:text-muted-foreground",children:"CloudCLI is open source"})]})]})})})}const iM={username:"",password:""};function sM(){const{t:e}=Le("auth"),{login:t}=Cs(),[r,n]=f.useState(iM),[a,i]=f.useState(""),[o,l]=f.useState(!1),c=f.useCallback((d,p)=>{n(h=>({...h,[d]:p}))},[]),u=f.useCallback(async d=>{if(d.preventDefault(),i(""),!r.username.trim()||!r.password){i(e("login.errors.requiredFields"));return}l(!0);const p=await t(r.username.trim(),r.password);p.success||i(p.error),l(!1)},[r.password,r.username,t,e]);return s.jsx(r5,{title:e("login.title"),description:e("login.description"),footerText:"Enter your credentials to access CloudCLI",children:s.jsxs("form",{onSubmit:u,className:"space-y-4",children:[s.jsx(os,{id:"username",label:e("login.username"),value:r.username,onChange:d=>c("username",d),placeholder:e("login.placeholders.username"),isDisabled:o,autoComplete:"username"}),s.jsx(os,{id:"password",label:e("login.password"),value:r.password,onChange:d=>c("password",d),placeholder:e("login.placeholders.password"),isDisabled:o,type:"password",autoComplete:"current-password"}),s.jsx(t5,{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 oM={username:"",password:"",confirmPassword:""};function lM(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 cM(){const{register:e}=Cs(),[t,r]=f.useState(oM),[n,a]=f.useState(""),[i,o]=f.useState(!1),l=f.useCallback((u,d)=>{r(p=>({...p,[u]:d}))},[]),c=f.useCallback(async u=>{u.preventDefault(),a("");const d=lM(t);if(d){a(d);return}o(!0);const p=await e(t.username.trim(),t.password);p.success||a(p.error),o(!1)},[t,e]);return s.jsx(r5,{title:"Welcome to CloudCLI",description:"Set up your account to get started",footerText:"This is a single-user system. Only one account can be created.",logo:s.jsx("img",{src:"/logo.svg",alt:"CloudCLI",className:"h-16 w-16"}),children:s.jsxs("form",{onSubmit:c,className:"space-y-4",children:[s.jsx(os,{id:"username",name:"username",label:"Username",value:t.username,onChange:u=>l("username",u),placeholder:"Enter your username",isDisabled:i,autoComplete:"username"}),s.jsx(os,{id:"password",name:"password",label:"Password",value:t.password,onChange:u=>l("password",u),placeholder:"Enter your password",isDisabled:i,type:"password",autoComplete:"new-password"}),s.jsx(os,{id:"confirmPassword",name:"confirmPassword",label:"Confirm Password",value:t.confirmPassword,onChange:u=>l("confirmPassword",u),placeholder:"Confirm your password",isDisabled:i,type:"password",autoComplete:"new-password"}),s.jsx(t5,{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 uM({children:e}){const{user:t,isLoading:r,needsSetup:n,hasCompletedOnboarding:a,refreshOnboardingStatus:i}=Cs();return r?s.jsx(aM,{}):n?s.jsx(cM,{}):t?a?s.jsx(s.Fragment,{children:e}):s.jsx(rM,{onComplete:i}):s.jsx(sM,{})}const n5=f.createContext(null),a5=()=>{const e=f.useContext(n5);if(!e)throw new Error("useWebSocket must be used within a WebSocketProvider");return e},dM=e=>{const t=window.location.protocol==="https:"?"wss:":"ws:";return e?`${t}//${window.location.host}/ws?token=${encodeURIComponent(e)}`:null},pM=()=>{const e=f.useRef(null),t=f.useRef(!1),r=f.useRef(!1),[n,a]=f.useState(null),[i,o]=f.useState(!1),l=f.useRef(null),{token:c}=Cs();f.useEffect(()=>(u(),()=>{t.current=!0,l.current&&clearTimeout(l.current),e.current&&e.current.close()}),[c]);const u=f.useCallback(()=>{if(!t.current)try{const h=dM(c);if(!h)return console.warn("No authentication token found for WebSocket connection");const m=new WebSocket(h);m.onopen=()=>{o(!0),e.current=m,r.current&&a({type:"websocket-reconnected",timestamp:Date.now()}),r.current=!0},m.onmessage=g=>{try{const b=JSON.parse(g.data);a(b)}catch(b){console.error("Error parsing WebSocket message:",b)}},m.onclose=()=>{o(!1),e.current=null,l.current=setTimeout(()=>{t.current||u()},3e3)},m.onerror=g=>{console.error("WebSocket error:",g)}}catch(h){console.error("Error creating WebSocket connection:",h)}},[c]),d=f.useCallback(h=>{const m=e.current;m&&m.readyState===WebSocket.OPEN?m.send(JSON.stringify(h)):console.warn("WebSocket not connected")},[]);return f.useMemo(()=>({ws:e.current,sendMessage:d,latestMessage:n,isConnected:i}),[d,n,i])},mM=({children:e})=>{const t=pM();return s.jsx(n5.Provider,{value:t,children:e})},i5=f.createContext(null);function hM(e,t){return{message:t instanceof Error?t.message:`Failed to ${e}`,context:e,timestamp:new Date().toISOString()}}function Ua(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 fM(e){return e.find(t=>t.status==="pending"||t.status==="in-progress")??null}function gM(e){return e?.type?e.type.startsWith("taskmaster-"):!1}function Si(){const e=f.useContext(i5);if(!e)throw new Error("useTaskMaster must be used within a TaskMasterProvider");return e}function bM({children:e}){const{latestMessage:t}=a5(),{user:r,token:n,isLoading:a}=Cs(),[i,o]=f.useState([]),[l,c]=f.useState(null),[u,d]=f.useState(null),[p,h]=f.useState(null),[m,g]=f.useState([]),[b,x]=f.useState(null),[y,v]=f.useState(!1),[k,S]=f.useState(!1),[E,w]=f.useState(!1),[N,R]=f.useState(null),T=f.useRef(null),j=f.useRef(null),D=f.useRef(0);f.useEffect(()=>{T.current=l?.projectId??null},[l?.projectId]),f.useEffect(()=>{j.current=u},[u]);const A=f.useCallback(()=>{R(null)},[]),F=f.useCallback((z,P)=>{console.error(`TaskMaster ${z} error:`,P),R(hM(z,P))},[]),C=f.useCallback((z,P)=>{d(P),o(O=>O.map(Z=>Z.projectId!==z?Z:Ua({...Z,taskmaster:P??void 0}))),c(O=>!O||O.projectId!==z?O:Ua({...O,taskmaster:P??void 0}))},[]),$=f.useCallback(async z=>{if(!z||!r||!n)return;const P=++D.current;try{const O=await tt.projectTaskmaster(z);if(!O.ok)throw new Error(`Failed to fetch TaskMaster details: ${O.status}`);const G=(await O.json()).taskmaster??null;if(P!==D.current||T.current!==z)return;C(z,G)}catch(O){if(P!==D.current||T.current!==z)return;F("load selected project TaskMaster info",O)}},[C,F,n,r]),Y=f.useCallback(z=>{const P=z?Ua(z):null;if(c(P),d(P?.taskmaster??null),g([]),x(null),!P?.projectId){D.current+=1;return}$(P.projectId)},[$]),V=f.useCallback(async()=>{if(!r||!n){o([]),c(null),d(null),g([]),x(null);return}try{v(!0),A();const z=await tt.get("/projects");if(!z.ok)throw new Error(`Failed to fetch projects: ${z.status}`);const P=await z.json(),Z=(Array.isArray(P)?P:[]).map(pe=>Ua(pe));o(pe=>{const me=new Map(pe.filter(ye=>!!ye.taskmaster).map(ye=>[ye.projectId,ye.taskmaster]));return Z.map(ye=>{const ve=me.get(ye.projectId);return ve?Ua({...ye,taskmaster:ve}):ye})});const G=T.current;if(!G)return;const ne=Z.find(pe=>pe.projectId===G)??null;if(!ne){D.current+=1,c(null),d(null),g([]),x(null);return}const re=ne.taskmaster??j.current??null;c(re?Ua({...ne,taskmaster:re}):ne),d(re),$(G)}catch(z){F("load projects",z)}finally{v(!1)}},[A,F,$,n,r]),K=f.useCallback(async()=>{const z=l?.projectId;if(!z||!r||!n){g([]),x(null);return}try{S(!0),A();const P=await tt.get(`/taskmaster/tasks/${encodeURIComponent(z)}`);if(!P.ok){const G=await P.json();throw new Error(G.message??"Failed to load tasks")}const O=await P.json(),Z=Array.isArray(O.tasks)?O.tasks:[];g(Z),x(fM(Z))}catch(P){F("load tasks",P),g([]),x(null)}finally{S(!1)}},[A,l?.projectId,F,n,r]),H=f.useCallback(async()=>{if(!r||!n){h(null);return}try{w(!0),A();const z=await tt.get("/mcp-utils/taskmaster-server");if(!z.ok)throw new Error(`Failed to load MCP status: ${z.status}`);const P=await z.json();h(P)}catch(z){F("check MCP server status",z),h(null)}finally{w(!1)}},[A,F,n,r]);f.useEffect(()=>{!a&&r&&n&&(V(),H())},[a,H,V,n,r]),f.useEffect(()=>{l?.projectId&&r&&n&&K()},[l?.projectId,K,n,r]),f.useEffect(()=>{const z=t;if(gM(z)){if(z.type==="taskmaster-project-updated"&&z.projectId){z.projectId===T.current&&$(z.projectId),V();return}if(z.type==="taskmaster-tasks-updated"&&z.projectId===l?.projectId){K();return}z.type==="taskmaster-mcp-status-changed"&&H()}},[l?.projectId,t,$,H,V,K]);const M=f.useMemo(()=>({projects:i,currentProject:l,projectTaskMaster:u,mcpServerStatus:p,tasks:m,nextTask:b,isLoading:y,isLoadingTasks:k,isLoadingMCP:E,error:N,refreshProjects:V,setCurrentProject:Y,refreshTasks:K,refreshMCPStatus:H,clearError:A}),[A,l,N,y,E,k,p,b,u,i,H,V,K,Y,m]);return s.jsx(i5.Provider,{value:M,children:e})}const s5=f.createContext({tasksEnabled:!0,setTasksEnabled:()=>{},toggleTasksEnabled:()=>{},isTaskMasterInstalled:null,isTaskMasterReady:null,installationStatus:null,isCheckingInstallation:!0}),Dl=()=>{const e=f.useContext(s5);if(!e)throw new Error("useTasksSettings must be used within a TasksSettingsProvider");return e},xM=({children:e})=>{const[t,r]=f.useState(()=>{const m=localStorage.getItem("tasks-enabled");return m!==null?JSON.parse(m):!0}),[n,a]=f.useState(null),[i,o]=f.useState(null),[l,c]=f.useState(null),[u,d]=f.useState(!0);f.useEffect(()=>{localStorage.setItem("tasks-enabled",JSON.stringify(t))},[t]),f.useEffect(()=>{setTimeout(async()=>{try{const g=await tt.get("/taskmaster/installation-status");if(g.ok){const b=await g.json();c(b),a(b.installation?.isInstalled||!1),o(b.isReady||!1);const x=localStorage.getItem("tasks-enabled");!b.installation?.isInstalled&&!x&&r(!1)}else console.error("Failed to check TaskMaster installation status"),a(!1),o(!1)}catch(g){console.error("Error checking TaskMaster installation:",g),a(!1),o(!1)}finally{d(!1)}},0)},[]);const h={tasksEnabled:t,setTasksEnabled:r,toggleTasksEnabled:()=>{r(m=>!m)},isTaskMasterInstalled:n,isTaskMasterReady:i,installationStatus:l,isCheckingInstallation:u};return s.jsx(s5.Provider,{value:h,children:e})},o5=f.createContext(null);function Ml(){const e=f.useContext(o5);if(!e)throw new Error("usePlugins must be used within a PluginsProvider");return e}function yM({children:e}){const[t,r]=f.useState([]),[n,a]=f.useState(!0),[i,o]=f.useState(null),l=f.useCallback(async()=>{try{const h=await Ae("/api/plugins");if(h.ok){const m=await h.json();r(m.plugins||[]),o(null)}else{let m=`Failed to fetch plugins (${h.status})`;try{const g=await h.json();m=g.details||g.error||m}catch{m=h.statusText||m}o(m)}}catch(h){const m=h instanceof Error?h.message:"Failed to fetch plugins";o(m),console.error("[Plugins] Failed to fetch plugins:",h)}finally{a(!1)}},[]);f.useEffect(()=>{l()},[l]);const c=f.useCallback(async h=>{try{const m=await Ae("/api/plugins/install",{method:"POST",body:JSON.stringify({url:h})}),g=await m.json();return m.ok?(await l(),{success:!0}):{success:!1,error:g.details||g.error||"Install failed"}}catch(m){return{success:!1,error:m instanceof Error?m.message:"Install failed"}}},[l]),u=f.useCallback(async h=>{try{const m=await Ae(`/api/plugins/${encodeURIComponent(h)}`,{method:"DELETE"}),g=await m.json();return m.ok?(await l(),{success:!0}):{success:!1,error:g.details||g.error||"Uninstall failed"}}catch(m){return{success:!1,error:m instanceof Error?m.message:"Uninstall failed"}}},[l]),d=f.useCallback(async h=>{try{const m=await Ae(`/api/plugins/${encodeURIComponent(h)}/update`,{method:"POST"}),g=await m.json();return m.ok?(await l(),{success:!0}):{success:!1,error:g.details||g.error||"Update failed"}}catch(m){return{success:!1,error:m instanceof Error?m.message:"Update failed"}}},[l]),p=f.useCallback(async(h,m)=>{try{const g=await Ae(`/api/plugins/${encodeURIComponent(h)}/enable`,{method:"PUT",body:JSON.stringify({enabled:m})});if(!g.ok){let b=`Toggle failed (${g.status})`;try{const x=await g.json();b=x.details||x.error||b}catch{b=g.statusText||b}return{success:!1,error:b}}return await l(),{success:!0,error:null}}catch(g){return{success:!1,error:g instanceof Error?g.message:"Toggle failed"}}},[l]);return s.jsx(o5.Provider,{value:{plugins:t,loading:n,pluginsError:i,refreshPlugins:l,installPlugin:c,uninstallPlugin:u,updatePlugin:d,togglePlugin:p},children:e})}const my=e=>typeof window>"u"?!1:window.innerWidth<e,hy=()=>{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 Jg(e={}){const{mobileBreakpoint:t=768,trackMobile:r=!0,trackPWA:n=!0}=e,[a,i]=f.useState(()=>r?my(t):!1),[o,l]=f.useState(()=>n?hy():!1);return f.useEffect(()=>{if(!r||typeof window>"u")return;const c=()=>{i(my(t))};return c(),window.addEventListener("resize",c),()=>{window.removeEventListener("resize",c)}},[t,r]),f.useEffect(()=>{if(!n||typeof window>"u")return;const c=window.matchMedia("(display-mode: standalone)"),u=()=>{l(hy())};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 fy="1.31.3",vM=(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},l5=(e,t)=>{const[r,n]=f.useState(!1),[a,i]=f.useState(null),[o,l]=f.useState(null),[c,u]=f.useState("git");return f.useEffect(()=>{(async()=>{try{const h=await(await fetch("/health")).json();(h.installMode==="npm"||h.installMode==="git")&&u(h.installMode)}catch{}})()},[]),f.useEffect(()=>{const d=async()=>{try{const m=await(await fetch(`https://api.github.com/repos/${e}/${t}/releases/latest`)).json();if(m.tag_name){const g=m.tag_name.replace(/^v/,"");i(g),n(vM(g,fy)>0),l({title:m.name||m.tag_name,body:m.body||"",htmlUrl:m.html_url||`https://github.com/${e}/${t}/releases/latest`,publishedAt:m.published_at})}else n(!1),i(null),l(null)}catch(h){console.error("Version check failed:",h),n(!1),i(null),l(null)}};d();const p=setInterval(d,300*1e3);return()=>clearInterval(p)},[e,t]),{updateAvailable:r,latestVersion:a,currentVersion:fy,releaseInfo:o,installMode:c}},ha={autoExpandTools:!1,showRawParameters:!1,showThinking:!0,autoScrollToBottom:!0,sendByCtrlEnter:!1,sidebarVisible:!0},el=Object.keys(ha),kM=new Set(el),yc="ui-preferences:sync",tl=(e,t)=>{if(typeof e=="boolean")return e;if(typeof e=="string"){if(e==="true")return!0;if(e==="false")return!1}return t},wM=(e,t)=>{try{const r=localStorage.getItem(e);if(r===null)return t;const n=JSON.parse(r);return tl(n,t)}catch{return t}},SM=e=>{if(typeof window>"u")return ha;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 el.reduce((a,i)=>(a[i]=tl(n[i],ha[i]),a),{...ha})}}}catch{}return el.reduce((t,r)=>(t[r]=wM(r,ha[r]),t),{...ha})};function EM(e,t){switch(t.type){case"set":{const{key:r,value:n}=t;if(!kM.has(r))return e;const a=tl(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 el){if(!(i in r))continue;const o=r[i],l=tl(o,e[i]);a[i]!==l&&(a[i]=l,n=!0)}return n?a:e}case"reset":return{...ha,...t.value||{}};default:return e}}function Qg(e="uiPreferences"){const t=f.useRef(`ui-preferences-${Math.random().toString(36).slice(2)}`),[r,n]=f.useReducer(EM,e,SM);return f.useEffect(()=>{typeof window>"u"||(localStorage.setItem(e,JSON.stringify(r)),window.dispatchEvent(new CustomEvent(yc,{detail:{storageKey:e,sourceId:t.current,value:r}})))},[r,e]),f.useEffect(()=>{if(typeof window>"u")return;const l=d=>{!d||typeof d!="object"||Array.isArray(d)||n({type:"set_many",value:d})},c=d=>{if(!(d.key!==e||d.newValue===null))try{const p=JSON.parse(d.newValue);l(p)}catch{}},u=d=>{const h=d.detail;!h||h.storageKey!==e||h.sourceId===t.current||l(h.value)};return window.addEventListener("storage",c),window.addEventListener(yc,u),()=>{window.removeEventListener("storage",c),window.removeEventListener(yc,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 eb=f.createContext(null),vc={openFile:()=>{},openSettings:()=>{},refreshProjects:()=>{}};function CM({children:e}){const t=f.useRef({});return s.jsx(eb.Provider,{value:t,children:e})}function Ts(){const e=f.useContext(eb);return f.useMemo(()=>({openFile:t=>(e?.current.openFile??vc.openFile)(t),openSettings:t=>(e?.current.openSettings??vc.openSettings)(t),refreshProjects:()=>(e?.current.refreshProjects??vc.refreshProjects)()}),[e])}function c5(e){const t=f.useContext(eb),{openFile:r,openSettings:n,refreshProjects:a}=e;f.useEffect(()=>{if(!t)return;const i={...t.current};return r&&(t.current.openFile=r),n&&(t.current.openSettings=n),a&&(t.current.refreshProjects=a),()=>{r&&t.current.openFile===r&&(t.current.openFile=i.openFile),n&&t.current.openSettings===n&&(t.current.openSettings=i.openSettings),a&&t.current.refreshProjects===a&&(t.current.refreshProjects=i.refreshProjects)}},[t,r,n,a])}const NM=()=>{try{const e=localStorage.getItem("claude-settings");return e&&JSON.parse(e).projectSortOrder==="date"?"date":"name"}catch{return"name"}},u5="starredProjects",TM=()=>{try{const e=localStorage.getItem(u5);if(!e)return[];const t=JSON.parse(e);return Array.isArray(t)?t.map(r=>String(r).trim()).filter(r=>r.length>0):[]}catch{return[]}},AM=()=>{try{localStorage.removeItem(u5)}catch{}},rl=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),IM=(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"),jM=e=>e.__provider==="cursor"?String(e.createdAt||""):e.__provider==="codex"?String(e.createdAt||e.lastActivity||""):String(e.lastActivity||e.createdAt||""),RM=(e,t,r)=>{const n=rl(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:IM(e,r),sessionTime:jM(e),messageCount:Number(e.messageCount||0)}},d5=e=>{const t=[...e.sessions||[]].map(i=>({...i,__provider:"claude"})),r=(e.cursorSessions||[]).map(i=>({...i,__provider:"cursor"})),n=(e.codexSessions||[]).map(i=>({...i,__provider:"codex"})),a=(e.geminiSessions||[]).map(i=>({...i,__provider:"gemini"}));return[...t,...r,...n,...a].sort((i,o)=>rl(o).getTime()-rl(i).getTime())},gy=e=>{const t=d5(e);return t.length===0?new Date(0):t.reduce((r,n)=>{const a=rl(n);return a>r?a:r},new Date(0))},_M=(e,t)=>{const r=[...e];return r.sort((n,a)=>{const i=!!n.isStarred,o=!!a.isStarred;return i&&!o?-1:!i&&o?1:t==="date"?gy(a).getTime()-gy(n).getTime():(n.displayName||n.projectId).localeCompare(a.displayName||a.projectId)}),r},DM=(e,t)=>{const r=t.trim().toLowerCase();return r?e.filter(n=>{const a=(n.displayName||n.projectId).toLowerCase(),i=(n.path||n.fullPath||"").toLowerCase();return a.includes(r)||i.includes(r)}):e},MM=(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"},OM=e=>{const t=typeof e.fullPath=="string"&&e.fullPath.length>0?e.fullPath:typeof e.path=="string"?e.path:"";return{name:e.projectId,displayName:typeof e.displayName=="string"&&e.displayName.trim().length>0?e.displayName:e.projectId,fullPath:t,path:typeof e.path=="string"&&e.path.length>0?e.path:t}};function LM({projects:e,selectedProject:t,selectedSession:r,isLoading:n,isMobile:a,t:i,onRefresh:o,onProjectSelect:l,onSessionSelect:c,onSessionDelete:u,onLoadMoreSessions:d,onProjectDelete:p,setCurrentProject:h,setSidebarVisible:m,sidebarVisible:g}){const b=Ts(),[x,y]=f.useState(new Set),[v,k]=f.useState(null),[S,E]=f.useState(!1),[w,N]=f.useState(""),[R,T]=f.useState(new Set),[j,D]=f.useState(new Date),[A,F]=f.useState("name"),[C,$]=f.useState(!1),[Y,V]=f.useState(null),[K,H]=f.useState(""),[M,z]=f.useState(""),[P,O]=f.useState(new Set),[Z,G]=f.useState(null),[ne,re]=f.useState(null),[pe,me]=f.useState(!1),[ye,ve]=f.useState("projects"),[Te,Ie]=f.useState(null),[L,ce]=f.useState(!1),[le,W]=f.useState(null),[q,ae]=f.useState(""),[he,ue]=f.useState(new Map),[se,we]=f.useState(new Set),ee=f.useRef(0),J=f.useRef(null),X=f.useRef(new Map),oe=f.useRef(!1),fe=f.useRef(o),De=!a&&!g;f.useEffect(()=>{const ge=setInterval(()=>{D(new Date)},6e4);return()=>clearInterval(ge)},[]),f.useEffect(()=>{T(new Set)},[e]),f.useEffect(()=>{const ge=t?.projectId;ge&&y(xe=>{if(xe.has(ge))return xe;const _e=new Set(xe);return _e.add(ge),_e})},[t?.projectId]),f.useEffect(()=>{if(e.length>0&&!n){const ge=new Set;e.forEach(xe=>{xe.sessions&&xe.sessions.length>=0&&ge.add(xe.projectId)}),T(ge)}},[e,n]),f.useEffect(()=>{const ge=()=>{F(NM())};ge();const xe=Ge=>{Ge.key==="claude-settings"&&ge()};window.addEventListener("storage",xe);const _e=setInterval(()=>{document.hasFocus()&&ge()},1e3);return()=>{window.removeEventListener("storage",xe),clearInterval(_e)}},[]),f.useEffect(()=>{fe.current=o},[o]),f.useEffect(()=>{if(oe.current)return;const ge=TM();if(ge.length===0)return;oe.current=!0,(async()=>{try{await tt.migrateLegacyProjectStars(ge),await fe.current()}catch(_e){console.error("[Sidebar] Failed to migrate legacy starred projects:",_e)}finally{AM()}})()},[o]),f.useEffect(()=>{ue(ge=>{if(ge.size===0)return ge;const xe=new Map(ge);let _e=!1;for(const[Ge,pt]of ge.entries()){const Ye=e.find(Ot=>Ot.projectId===Ge);if(!Ye){xe.delete(Ge),_e=!0;continue}!!Ye.isStarred===pt&&(xe.delete(Ge),_e=!0)}return _e?xe:ge})},[e]),f.useEffect(()=>{const ge=setTimeout(()=>{ae(M.trim())},300);return()=>{clearTimeout(ge)}},[M]),f.useEffect(()=>{J.current&&(J.current.close(),J.current=null);const ge=q;if(ye!=="conversations"||ge.length<2){ee.current+=1,Ie(null),W(null),ce(!1);return}ce(!0);const xe=++ee.current;if(xe!==ee.current)return;const _e=tt.searchConversationsUrl(ge),Ge=new EventSource(_e);J.current=Ge;const pt=[];let Ye=0;return Ge.addEventListener("result",Ot=>{if(xe!==ee.current){Ge.close();return}try{const Ut=JSON.parse(Ot.data);pt.push(Ut.projectResult),Ye=Ut.totalMatches,Ie({results:[...pt],totalMatches:Ye,query:ge}),W({scannedProjects:Ut.scannedProjects,totalProjects:Ut.totalProjects})}catch{}}),Ge.addEventListener("progress",Ot=>{if(xe!==ee.current){Ge.close();return}try{const Ut=JSON.parse(Ot.data);Ye=Ut.totalMatches,W({scannedProjects:Ut.scannedProjects,totalProjects:Ut.totalProjects})}catch{}}),Ge.addEventListener("done",()=>{if(xe!==ee.current){Ge.close();return}Ge.close(),J.current=null,ce(!1),W(null),pt.length===0&&Ie({results:[],totalMatches:0,query:ge})}),Ge.addEventListener("error",()=>{if(xe!==ee.current){Ge.close();return}Ge.close(),J.current=null,ce(!1),W(null),pt.length===0&&Ie({results:[],totalMatches:0,query:ge})}),()=>{J.current&&(J.current.close(),J.current=null)}},[q,ye]);const $e=f.useCallback(ge=>{y(xe=>{const _e=new Set;return xe.has(ge)||_e.add(ge),_e})},[]),nt=f.useCallback((ge,xe)=>{c({...ge,__projectId:xe})},[c]),Ze=f.useCallback(ge=>he.has(ge)?!!he.get(ge):e.some(xe=>xe.projectId===ge&&!!xe.isStarred),[he,e]),qe=f.useCallback(ge=>{const xe=Ze(ge),_e=!xe,Ge=(X.current.get(ge)??0)+1;X.current.set(ge,Ge),ue(Ye=>{const Ot=new Map(Ye);return Ot.set(ge,_e),Ot}),(async()=>{try{const Ye=await tt.toggleProjectStar(ge);if(!Ye.ok){const Wt=(await Ye.json()).error,jr=typeof Wt=="string"?Wt:Wt&&typeof Wt=="object"&&Wt.message?Wt.message:i("messages.updateProjectError");throw new Error(jr)}const Ot=await Ye.json();if(!(X.current.get(ge)===Ge))return;ue(zr=>{const Wt=new Map(zr);return Wt.set(ge,!!Ot.isStarred),Wt})}catch(Ye){if(!(X.current.get(ge)===Ge))return;ue(Ut=>{const zr=new Map(Ut);return zr.set(ge,xe),zr}),console.error("[Sidebar] Failed to toggle project star:",Ye),alert(i("messages.updateProjectError"))}})()},[Ze,i]),lt=f.useCallback(ge=>Ze(ge),[Ze]),ut=f.useCallback(ge=>d5(ge),[]),et=f.useCallback(async ge=>{if(!d)return;let xe=!1;if(we(_e=>{if(_e.has(ge))return _e;xe=!0;const Ge=new Set(_e);return Ge.add(ge),Ge}),!!xe)try{await d(ge)}catch(_e){console.error("[Sidebar] Failed to load more sessions:",_e),alert(i("messages.refreshError"))}finally{we(_e=>{const Ge=new Set(_e);return Ge.delete(ge),Ge})}},[d,i]),yt=f.useMemo(()=>he.size===0?e:e.map(ge=>{const xe=he.get(ge.projectId);return xe===void 0||!!ge.isStarred===xe?ge:{...ge,isStarred:xe}}),[he,e]),mt=f.useMemo(()=>_M(yt,A),[A,yt]),bt=f.useMemo(()=>DM(mt,q),[q,mt]),xt=f.useCallback(ge=>{k(ge.projectId),N(ge.displayName)},[]),Re=f.useCallback(()=>{k(null),N("")},[]),Ke=f.useCallback(async ge=>{try{(await tt.renameProject(ge,w)).ok?await b.refreshProjects():console.error("Failed to rename project")}catch(xe){console.error("Error renaming project:",xe)}finally{k(null),N("")}},[w,b]),We=f.useCallback((ge,xe,_e,Ge="claude")=>{re({projectId:ge,sessionId:xe,sessionTitle:_e,provider:Ge})},[]),dt=f.useCallback(async()=>{if(!ne)return;const{sessionId:ge}=ne;re(null);try{const xe=await tt.deleteSession(ge);if(xe.ok)u?.(ge);else{const _e=await xe.text();console.error("[Sidebar] Failed to delete session:",{status:xe.status,error:_e}),alert(i("messages.deleteSessionFailed"))}}catch(xe){console.error("[Sidebar] Error deleting session:",xe),alert(i("messages.deleteSessionError"))}},[u,ne,i]),vt=f.useCallback(ge=>{G({project:ge,sessionCount:ut(ge).length})},[ut]),rt=f.useCallback(async(ge=!1)=>{if(!Z)return;const{project:xe}=Z;G(null),O(_e=>new Set([..._e,xe.projectId]));try{const _e=await tt.deleteProject(xe.projectId,ge);if(_e.ok)p?.(xe.projectId);else{const pt=(await _e.json()).error,Ye=typeof pt=="string"?pt:pt&&typeof pt=="object"&&pt.message?pt.message:i("messages.deleteProjectFailed");alert(Ye)}}catch(_e){console.error("Error deleting project:",_e),alert(i("messages.deleteProjectError"))}finally{O(_e=>{const Ge=new Set(_e);return Ge.delete(xe.projectId),Ge})}},[Z,p,i]),Xt=f.useCallback(ge=>{l(ge),h(ge)},[l,h]),lr=f.useCallback(async()=>{$(!0);try{await o()}finally{$(!1)}},[o]),cr=f.useCallback(async(ge,xe,_e,Ge)=>{const pt=_e.trim();if(!pt){V(null),H("");return}try{const Ye=await tt.renameSession(xe,pt);Ye.ok?await o():(console.error("[Sidebar] Failed to rename session:",Ye.status),alert(i("messages.renameSessionFailed")))}catch(Ye){console.error("[Sidebar] Error renaming session:",Ye),alert(i("messages.renameSessionError"))}finally{V(null),H("")}},[o,i]),yr=f.useCallback(()=>{m(!1)},[m]),Oe=f.useCallback(()=>{m(!0)},[m]);return{isSidebarCollapsed:De,expandedProjects:x,editingProject:v,showNewProject:S,editingName:w,initialSessionsLoaded:R,currentTime:j,projectSortOrder:A,isRefreshing:C,editingSession:Y,editingSessionName:K,searchFilter:M,deletingProjects:P,loadingMoreProjects:se,deleteConfirmation:Z,sessionDeleteConfirmation:ne,showVersionModal:pe,filteredProjects:bt,toggleProject:$e,handleSessionClick:nt,toggleStarProject:qe,isProjectStarred:lt,getProjectSessions:ut,loadMoreSessionsForProject:et,startEditing:xt,cancelEditing:Re,saveProjectName:Ke,showDeleteSessionConfirmation:We,confirmDeleteSession:dt,requestProjectDelete:vt,confirmDeleteProject:rt,handleProjectSelect:Xt,refreshProjects:lr,updateSessionSummary:cr,collapseSidebar:yr,expandSidebar:Oe,setShowNewProject:E,setEditingName:N,setEditingSession:V,setEditingSessionName:H,searchMode:ye,setSearchMode:ve,conversationResults:Te,isSearching:L,searchProgress:le,clearConversationResults:f.useCallback(()=>{ee.current+=1,J.current&&(J.current.close(),J.current=null),ce(!1),W(null),Ie(null)},[]),setSearchFilter:z,setDeleteConfirmation:G,setSessionDeleteConfirmation:re,setShowVersionModal:me}}const PM="https://discord.gg/buxwujPNRE",FM="https://github.com/siteboon/claudecodeui/issues/new";function zM({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 BM({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(a8,{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(kt,{className:"h-4 w-4 text-muted-foreground transition-colors group-hover:text-foreground"})}),s.jsx("a",{href:FM,target:"_blank",rel:"noopener noreferrer",className:"group flex h-8 w-8 items-center justify-center rounded-lg transition-colors hover:bg-accent/80","aria-label":a("actions.reportIssue"),title:a("actions.reportIssue"),children:s.jsx(A0,{className:"h-4 w-4 text-muted-foreground transition-colors group-hover:text-foreground"})}),s.jsx("a",{href:PM,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(zM,{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(ka,{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 p5(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=p5(e[t]))&&(n&&(n+=" "),n+=r)}else for(r in e)e[r]&&(n&&(n+=" "),n+=r);return n}function m5(){for(var e,t,r=0,n="",a=arguments.length;r<a;r++)(e=arguments[r])&&(t=p5(e))&&(n&&(n+=" "),n+=t);return n}const by=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,xy=m5,tb=(e,t)=>r=>{var n;if(t?.variants==null)return xy(e,r?.class,r?.className);const{variants:a,defaultVariants:i}=t,o=Object.keys(a).map(u=>{const d=r?.[u],p=i?.[u];if(d===null)return null;const h=by(d)||by(p);return a[u][h]}),l=r&&Object.entries(r).reduce((u,d)=>{let[p,h]=d;return h===void 0||(u[p]=h),u},{}),c=t==null||(n=t.compoundVariants)===null||n===void 0?void 0:n.reduce((u,d)=>{let{class:p,className:h,...m}=d;return Object.entries(m).every(g=>{let[b,x]=g;return Array.isArray(x)?x.includes({...i,...l}[b]):{...i,...l}[b]===x})?[...u,p,h]:u},[]);return xy(e,o,c,r?.class,r?.className)},rb="-",$M=e=>{const t=GM(e),{conflictingClassGroups:r,conflictingClassGroupModifiers:n}=e;return{getClassGroupId:o=>{const l=o.split(rb);return l[0]===""&&l.length!==1&&l.shift(),h5(l,t)||UM(o)},getConflictingClassGroupIds:(o,l)=>{const c=r[o]||[];return l&&n[o]?[...c,...n[o]]:c}}},h5=(e,t)=>{if(e.length===0)return t.classGroupId;const r=e[0],n=t.nextPart.get(r),a=n?h5(e.slice(1),n):void 0;if(a)return a;if(t.validators.length===0)return;const i=e.join(rb);return t.validators.find(({validator:o})=>o(i))?.classGroupId},yy=/^\[(.+)\]$/,UM=e=>{if(yy.test(e)){const t=yy.exec(e)[1],r=t?.substring(0,t.indexOf(":"));if(r)return"arbitrary.."+r}},GM=e=>{const{theme:t,classGroups:r}=e,n={nextPart:new Map,validators:[]};for(const a in r)M0(r[a],n,a,t);return n},M0=(e,t,r,n)=>{e.forEach(a=>{if(typeof a=="string"){const i=a===""?t:vy(t,a);i.classGroupId=r;return}if(typeof a=="function"){if(qM(a)){M0(a(n),t,r,n);return}t.validators.push({validator:a,classGroupId:r});return}Object.entries(a).forEach(([i,o])=>{M0(o,vy(t,i),r,n)})})},vy=(e,t)=>{let r=e;return t.split(rb).forEach(n=>{r.nextPart.has(n)||r.nextPart.set(n,{nextPart:new Map,validators:[]}),r=r.nextPart.get(n)}),r},qM=e=>e.isThemeGetter,HM=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)}}},O0="!",L0=":",VM=L0.length,WM=e=>{const{prefix:t,experimentalParseClassName:r}=e;let n=a=>{const i=[];let o=0,l=0,c=0,u;for(let g=0;g<a.length;g++){let b=a[g];if(o===0&&l===0){if(b===L0){i.push(a.slice(c,g)),c=g+VM;continue}if(b==="/"){u=g;continue}}b==="["?o++:b==="]"?o--:b==="("?l++:b===")"&&l--}const d=i.length===0?a:a.substring(c),p=KM(d),h=p!==d,m=u&&u>c?u-c:void 0;return{modifiers:i,hasImportantModifier:h,baseClassName:p,maybePostfixModifierPosition:m}};if(t){const a=t+L0,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},KM=e=>e.endsWith(O0)?e.substring(0,e.length-1):e.startsWith(O0)?e.substring(1):e,YM=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}},ZM=e=>({cache:HM(e.cacheSize),parseClassName:WM(e),sortModifiers:YM(e),...$M(e)}),XM=/\s+/,JM=(e,t)=>{const{parseClassName:r,getClassGroupId:n,getConflictingClassGroupIds:a,sortModifiers:i}=t,o=[],l=e.trim().split(XM);let c="";for(let u=l.length-1;u>=0;u-=1){const d=l[u],{isExternal:p,modifiers:h,hasImportantModifier:m,baseClassName:g,maybePostfixModifierPosition:b}=r(d);if(p){c=d+(c.length>0?" "+c:c);continue}let x=!!b,y=n(x?g.substring(0,b):g);if(!y){if(!x){c=d+(c.length>0?" "+c:c);continue}if(y=n(g),!y){c=d+(c.length>0?" "+c:c);continue}x=!1}const v=i(h).join(":"),k=m?v+O0:v,S=k+y;if(o.includes(S))continue;o.push(S);const E=a(y,x);for(let w=0;w<E.length;++w){const N=E[w];o.push(k+N)}c=d+(c.length>0?" "+c:c)}return c};function QM(){let e=0,t,r,n="";for(;e<arguments.length;)(t=arguments[e++])&&(r=f5(t))&&(n&&(n+=" "),n+=r);return n}const f5=e=>{if(typeof e=="string")return e;let t,r="";for(let n=0;n<e.length;n++)e[n]&&(t=f5(e[n]))&&(r&&(r+=" "),r+=t);return r};function eO(e,...t){let r,n,a,i=o;function o(c){const u=t.reduce((d,p)=>p(d),e());return r=ZM(u),n=r.cache.get,a=r.cache.set,i=l,l(c)}function l(c){const u=n(c);if(u)return u;const d=JM(c,r);return a(c,d),d}return function(){return i(QM.apply(null,arguments))}}const zt=e=>{const t=r=>r[e]||[];return t.isThemeGetter=!0,t},g5=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,b5=/^\((?:(\w[\w-]*):)?(.+)\)$/i,tO=/^\d+\/\d+$/,rO=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,nO=/\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$/,aO=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,iO=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,sO=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Ga=e=>tO.test(e),st=e=>!!e&&!Number.isNaN(Number(e)),Dn=e=>!!e&&Number.isInteger(Number(e)),kc=e=>e.endsWith("%")&&st(e.slice(0,-1)),pn=e=>rO.test(e),oO=()=>!0,lO=e=>nO.test(e)&&!aO.test(e),x5=()=>!1,cO=e=>iO.test(e),uO=e=>sO.test(e),dO=e=>!ze(e)&&!Be(e),pO=e=>Ei(e,k5,x5),ze=e=>g5.test(e),ca=e=>Ei(e,w5,lO),wc=e=>Ei(e,bO,st),ky=e=>Ei(e,y5,x5),mO=e=>Ei(e,v5,uO),$s=e=>Ei(e,S5,cO),Be=e=>b5.test(e),zi=e=>Ci(e,w5),hO=e=>Ci(e,xO),wy=e=>Ci(e,y5),fO=e=>Ci(e,k5),gO=e=>Ci(e,v5),Us=e=>Ci(e,S5,!0),Ei=(e,t,r)=>{const n=g5.exec(e);return n?n[1]?t(n[1]):r(n[2]):!1},Ci=(e,t,r=!1)=>{const n=b5.exec(e);return n?n[1]?t(n[1]):r:!1},y5=e=>e==="position"||e==="percentage",v5=e=>e==="image"||e==="url",k5=e=>e==="length"||e==="size"||e==="bg-size",w5=e=>e==="length",bO=e=>e==="number",xO=e=>e==="family-name",S5=e=>e==="shadow",yO=()=>{const e=zt("color"),t=zt("font"),r=zt("text"),n=zt("font-weight"),a=zt("tracking"),i=zt("leading"),o=zt("breakpoint"),l=zt("container"),c=zt("spacing"),u=zt("radius"),d=zt("shadow"),p=zt("inset-shadow"),h=zt("text-shadow"),m=zt("drop-shadow"),g=zt("blur"),b=zt("perspective"),x=zt("aspect"),y=zt("ease"),v=zt("animate"),k=()=>["auto","avoid","all","avoid-page","page","left","right","column"],S=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],E=()=>[...S(),Be,ze],w=()=>["auto","hidden","clip","visible","scroll"],N=()=>["auto","contain","none"],R=()=>[Be,ze,c],T=()=>[Ga,"full","auto",...R()],j=()=>[Dn,"none","subgrid",Be,ze],D=()=>["auto",{span:["full",Dn,Be,ze]},Dn,Be,ze],A=()=>[Dn,"auto",Be,ze],F=()=>["auto","min","max","fr",Be,ze],C=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],$=()=>["start","end","center","stretch","center-safe","end-safe"],Y=()=>["auto",...R()],V=()=>[Ga,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...R()],K=()=>[e,Be,ze],H=()=>[...S(),wy,ky,{position:[Be,ze]}],M=()=>["no-repeat",{repeat:["","x","y","space","round"]}],z=()=>["auto","cover","contain",fO,pO,{size:[Be,ze]}],P=()=>[kc,zi,ca],O=()=>["","none","full",u,Be,ze],Z=()=>["",st,zi,ca],G=()=>["solid","dashed","dotted","double"],ne=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],re=()=>[st,kc,wy,ky],pe=()=>["","none",g,Be,ze],me=()=>["none",st,Be,ze],ye=()=>["none",st,Be,ze],ve=()=>[st,Be,ze],Te=()=>[Ga,"full",...R()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[pn],breakpoint:[pn],color:[oO],container:[pn],"drop-shadow":[pn],ease:["in","out","in-out"],font:[dO],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[pn],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[pn],shadow:[pn],spacing:["px",st],text:[pn],"text-shadow":[pn],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",Ga,ze,Be,x]}],container:["container"],columns:[{columns:[st,ze,Be,l]}],"break-after":[{"break-after":k()}],"break-before":[{"break-before":k()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:E()}],overflow:[{overflow:w()}],"overflow-x":[{"overflow-x":w()}],"overflow-y":[{"overflow-y":w()}],overscroll:[{overscroll:N()}],"overscroll-x":[{"overscroll-x":N()}],"overscroll-y":[{"overscroll-y":N()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:T()}],"inset-x":[{"inset-x":T()}],"inset-y":[{"inset-y":T()}],start:[{start:T()}],end:[{end:T()}],top:[{top:T()}],right:[{right:T()}],bottom:[{bottom:T()}],left:[{left:T()}],visibility:["visible","invisible","collapse"],z:[{z:[Dn,"auto",Be,ze]}],basis:[{basis:[Ga,"full","auto",l,...R()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[st,Ga,"auto","initial","none",ze]}],grow:[{grow:["",st,Be,ze]}],shrink:[{shrink:["",st,Be,ze]}],order:[{order:[Dn,"first","last","none",Be,ze]}],"grid-cols":[{"grid-cols":j()}],"col-start-end":[{col:D()}],"col-start":[{"col-start":A()}],"col-end":[{"col-end":A()}],"grid-rows":[{"grid-rows":j()}],"row-start-end":[{row:D()}],"row-start":[{"row-start":A()}],"row-end":[{"row-end":A()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":F()}],"auto-rows":[{"auto-rows":F()}],gap:[{gap:R()}],"gap-x":[{"gap-x":R()}],"gap-y":[{"gap-y":R()}],"justify-content":[{justify:[...C(),"normal"]}],"justify-items":[{"justify-items":[...$(),"normal"]}],"justify-self":[{"justify-self":["auto",...$()]}],"align-content":[{content:["normal",...C()]}],"align-items":[{items:[...$(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...$(),{baseline:["","last"]}]}],"place-content":[{"place-content":C()}],"place-items":[{"place-items":[...$(),"baseline"]}],"place-self":[{"place-self":["auto",...$()]}],p:[{p:R()}],px:[{px:R()}],py:[{py:R()}],ps:[{ps:R()}],pe:[{pe:R()}],pt:[{pt:R()}],pr:[{pr:R()}],pb:[{pb:R()}],pl:[{pl:R()}],m:[{m: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":R()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":R()}],"space-y-reverse":["space-y-reverse"],size:[{size:V()}],w:[{w:[l,"screen",...V()]}],"min-w":[{"min-w":[l,"screen","none",...V()]}],"max-w":[{"max-w":[l,"screen","none","prose",{screen:[o]},...V()]}],h:[{h:["screen","lh",...V()]}],"min-h":[{"min-h":["screen","lh","none",...V()]}],"max-h":[{"max-h":["screen","lh",...V()]}],"font-size":[{text:["base",r,zi,ca]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[n,Be,wc]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",kc,ze]}],"font-family":[{font:[hO,ze,t]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[a,Be,ze]}],"line-clamp":[{"line-clamp":[st,"none",Be,wc]}],leading:[{leading:[i,...R()]}],"list-image":[{"list-image":["none",Be,ze]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",Be,ze]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:K()}],"text-color":[{text:K()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...G(),"wavy"]}],"text-decoration-thickness":[{decoration:[st,"from-font","auto",Be,ca]}],"text-decoration-color":[{decoration:K()}],"underline-offset":[{"underline-offset":[st,"auto",Be,ze]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:R()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",Be,ze]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",Be,ze]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:H()}],"bg-repeat":[{bg:M()}],"bg-size":[{bg:z()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},Dn,Be,ze],radial:["",Be,ze],conic:[Dn,Be,ze]},gO,mO]}],"bg-color":[{bg:K()}],"gradient-from-pos":[{from:P()}],"gradient-via-pos":[{via:P()}],"gradient-to-pos":[{to:P()}],"gradient-from":[{from:K()}],"gradient-via":[{via:K()}],"gradient-to":[{to:K()}],rounded:[{rounded:O()}],"rounded-s":[{"rounded-s":O()}],"rounded-e":[{"rounded-e":O()}],"rounded-t":[{"rounded-t":O()}],"rounded-r":[{"rounded-r":O()}],"rounded-b":[{"rounded-b":O()}],"rounded-l":[{"rounded-l":O()}],"rounded-ss":[{"rounded-ss":O()}],"rounded-se":[{"rounded-se":O()}],"rounded-ee":[{"rounded-ee":O()}],"rounded-es":[{"rounded-es":O()}],"rounded-tl":[{"rounded-tl":O()}],"rounded-tr":[{"rounded-tr":O()}],"rounded-br":[{"rounded-br":O()}],"rounded-bl":[{"rounded-bl":O()}],"border-w":[{border:Z()}],"border-w-x":[{"border-x":Z()}],"border-w-y":[{"border-y":Z()}],"border-w-s":[{"border-s":Z()}],"border-w-e":[{"border-e":Z()}],"border-w-t":[{"border-t":Z()}],"border-w-r":[{"border-r":Z()}],"border-w-b":[{"border-b":Z()}],"border-w-l":[{"border-l":Z()}],"divide-x":[{"divide-x":Z()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":Z()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...G(),"hidden","none"]}],"divide-style":[{divide:[...G(),"hidden","none"]}],"border-color":[{border:K()}],"border-color-x":[{"border-x":K()}],"border-color-y":[{"border-y":K()}],"border-color-s":[{"border-s":K()}],"border-color-e":[{"border-e":K()}],"border-color-t":[{"border-t":K()}],"border-color-r":[{"border-r":K()}],"border-color-b":[{"border-b":K()}],"border-color-l":[{"border-l":K()}],"divide-color":[{divide:K()}],"outline-style":[{outline:[...G(),"none","hidden"]}],"outline-offset":[{"outline-offset":[st,Be,ze]}],"outline-w":[{outline:["",st,zi,ca]}],"outline-color":[{outline:K()}],shadow:[{shadow:["","none",d,Us,$s]}],"shadow-color":[{shadow:K()}],"inset-shadow":[{"inset-shadow":["none",p,Us,$s]}],"inset-shadow-color":[{"inset-shadow":K()}],"ring-w":[{ring:Z()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:K()}],"ring-offset-w":[{"ring-offset":[st,ca]}],"ring-offset-color":[{"ring-offset":K()}],"inset-ring-w":[{"inset-ring":Z()}],"inset-ring-color":[{"inset-ring":K()}],"text-shadow":[{"text-shadow":["none",h,Us,$s]}],"text-shadow-color":[{"text-shadow":K()}],opacity:[{opacity:[st,Be,ze]}],"mix-blend":[{"mix-blend":[...ne(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":ne()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[st]}],"mask-image-linear-from-pos":[{"mask-linear-from":re()}],"mask-image-linear-to-pos":[{"mask-linear-to":re()}],"mask-image-linear-from-color":[{"mask-linear-from":K()}],"mask-image-linear-to-color":[{"mask-linear-to":K()}],"mask-image-t-from-pos":[{"mask-t-from":re()}],"mask-image-t-to-pos":[{"mask-t-to":re()}],"mask-image-t-from-color":[{"mask-t-from":K()}],"mask-image-t-to-color":[{"mask-t-to":K()}],"mask-image-r-from-pos":[{"mask-r-from":re()}],"mask-image-r-to-pos":[{"mask-r-to":re()}],"mask-image-r-from-color":[{"mask-r-from":K()}],"mask-image-r-to-color":[{"mask-r-to":K()}],"mask-image-b-from-pos":[{"mask-b-from":re()}],"mask-image-b-to-pos":[{"mask-b-to":re()}],"mask-image-b-from-color":[{"mask-b-from":K()}],"mask-image-b-to-color":[{"mask-b-to":K()}],"mask-image-l-from-pos":[{"mask-l-from":re()}],"mask-image-l-to-pos":[{"mask-l-to":re()}],"mask-image-l-from-color":[{"mask-l-from":K()}],"mask-image-l-to-color":[{"mask-l-to":K()}],"mask-image-x-from-pos":[{"mask-x-from":re()}],"mask-image-x-to-pos":[{"mask-x-to":re()}],"mask-image-x-from-color":[{"mask-x-from":K()}],"mask-image-x-to-color":[{"mask-x-to":K()}],"mask-image-y-from-pos":[{"mask-y-from":re()}],"mask-image-y-to-pos":[{"mask-y-to":re()}],"mask-image-y-from-color":[{"mask-y-from":K()}],"mask-image-y-to-color":[{"mask-y-to":K()}],"mask-image-radial":[{"mask-radial":[Be,ze]}],"mask-image-radial-from-pos":[{"mask-radial-from":re()}],"mask-image-radial-to-pos":[{"mask-radial-to":re()}],"mask-image-radial-from-color":[{"mask-radial-from":K()}],"mask-image-radial-to-color":[{"mask-radial-to":K()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":S()}],"mask-image-conic-pos":[{"mask-conic":[st]}],"mask-image-conic-from-pos":[{"mask-conic-from":re()}],"mask-image-conic-to-pos":[{"mask-conic-to":re()}],"mask-image-conic-from-color":[{"mask-conic-from":K()}],"mask-image-conic-to-color":[{"mask-conic-to":K()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:H()}],"mask-repeat":[{mask:M()}],"mask-size":[{mask:z()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",Be,ze]}],filter:[{filter:["","none",Be,ze]}],blur:[{blur:pe()}],brightness:[{brightness:[st,Be,ze]}],contrast:[{contrast:[st,Be,ze]}],"drop-shadow":[{"drop-shadow":["","none",m,Us,$s]}],"drop-shadow-color":[{"drop-shadow":K()}],grayscale:[{grayscale:["",st,Be,ze]}],"hue-rotate":[{"hue-rotate":[st,Be,ze]}],invert:[{invert:["",st,Be,ze]}],saturate:[{saturate:[st,Be,ze]}],sepia:[{sepia:["",st,Be,ze]}],"backdrop-filter":[{"backdrop-filter":["","none",Be,ze]}],"backdrop-blur":[{"backdrop-blur":pe()}],"backdrop-brightness":[{"backdrop-brightness":[st,Be,ze]}],"backdrop-contrast":[{"backdrop-contrast":[st,Be,ze]}],"backdrop-grayscale":[{"backdrop-grayscale":["",st,Be,ze]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[st,Be,ze]}],"backdrop-invert":[{"backdrop-invert":["",st,Be,ze]}],"backdrop-opacity":[{"backdrop-opacity":[st,Be,ze]}],"backdrop-saturate":[{"backdrop-saturate":[st,Be,ze]}],"backdrop-sepia":[{"backdrop-sepia":["",st,Be,ze]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":R()}],"border-spacing-x":[{"border-spacing-x":R()}],"border-spacing-y":[{"border-spacing-y":R()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",Be,ze]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[st,"initial",Be,ze]}],ease:[{ease:["linear","initial",y,Be,ze]}],delay:[{delay:[st,Be,ze]}],animate:[{animate:["none",v,Be,ze]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[b,Be,ze]}],"perspective-origin":[{"perspective-origin":E()}],rotate:[{rotate:me()}],"rotate-x":[{"rotate-x":me()}],"rotate-y":[{"rotate-y":me()}],"rotate-z":[{"rotate-z":me()}],scale:[{scale:ye()}],"scale-x":[{"scale-x":ye()}],"scale-y":[{"scale-y":ye()}],"scale-z":[{"scale-z":ye()}],"scale-3d":["scale-3d"],skew:[{skew:ve()}],"skew-x":[{"skew-x":ve()}],"skew-y":[{"skew-y":ve()}],transform:[{transform:[Be,ze,"","none","gpu","cpu"]}],"transform-origin":[{origin:E()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:Te()}],"translate-x":[{"translate-x":Te()}],"translate-y":[{"translate-y":Te()}],"translate-z":[{"translate-z":Te()}],"translate-none":["translate-none"],accent:[{accent:K()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:K()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",Be,ze]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":R()}],"scroll-mx":[{"scroll-mx":R()}],"scroll-my":[{"scroll-my":R()}],"scroll-ms":[{"scroll-ms":R()}],"scroll-me":[{"scroll-me":R()}],"scroll-mt":[{"scroll-mt":R()}],"scroll-mr":[{"scroll-mr":R()}],"scroll-mb":[{"scroll-mb":R()}],"scroll-ml":[{"scroll-ml":R()}],"scroll-p":[{"scroll-p":R()}],"scroll-px":[{"scroll-px":R()}],"scroll-py":[{"scroll-py":R()}],"scroll-ps":[{"scroll-ps":R()}],"scroll-pe":[{"scroll-pe":R()}],"scroll-pt":[{"scroll-pt":R()}],"scroll-pr":[{"scroll-pr":R()}],"scroll-pb":[{"scroll-pb":R()}],"scroll-pl":[{"scroll-pl":R()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",Be,ze]}],fill:[{fill:["none",...K()]}],"stroke-w":[{stroke:[st,zi,ca,wc]}],stroke:[{stroke:["none",...K()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}},vO=eO(yO);function ke(...e){return vO(m5(e))}function kO(e){if(!e||typeof e!="string")return null;try{return JSON.parse(e)}catch{return null}}const wO=tb("relative w-full rounded-lg border px-4 py-3 text-sm grid has-[>svg]:grid-cols-[calc(var(--spacing)*4)_1fr] grid-cols-[0_1fr] has-[>svg]:gap-x-3 gap-y-0.5 items-start [&>svg]:size-4 [&>svg]:translate-y-0.5 [&>svg]:text-current",{variants:{variant:{default:"bg-card text-card-foreground",destructive:"text-destructive bg-card [&>svg]:text-current *:data-[slot=alert-description]:text-destructive/90"}},defaultVariants:{variant:"default"}}),E5=f.forwardRef(({className:e,variant:t,...r},n)=>s.jsx("div",{ref:n,role:"alert","data-slot":"alert",className:ke(wO({variant:t}),e),...r}));E5.displayName="Alert";const SO=f.forwardRef(({className:e,...t},r)=>s.jsx("div",{ref:r,"data-slot":"alert-title",className:ke("col-start-2 line-clamp-1 min-h-4 font-medium tracking-tight",e),...t}));SO.displayName="AlertTitle";const EO=f.forwardRef(({className:e,...t},r)=>s.jsx("div",{ref:r,"data-slot":"alert-description",className:ke("text-muted-foreground col-start-2 grid justify-items-start gap-1 text-sm [&_p]:leading-relaxed",e),...t}));EO.displayName="AlertDescription";const CO=tb("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 Vn({className:e,variant:t,...r}){return s.jsx("div",{className:ke(CO({variant:t}),e),...r})}const NO=tb("inline-flex touch-manipulation items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",{variants:{variant:{default:"bg-primary text-primary-foreground shadow hover:bg-primary/90 active:bg-primary/80",destructive:"bg-destructive text-destructive-foreground shadow-sm hover:bg-destructive/90 active:bg-destructive/80",outline:"border border-input bg-background shadow-sm hover:bg-accent hover:text-accent-foreground active:bg-accent/80",secondary:"bg-secondary text-secondary-foreground shadow-sm hover:bg-secondary/80 active:bg-secondary/70",ghost:"hover:bg-accent hover:text-accent-foreground active:bg-accent/80",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-10 px-4 py-2",sm:"h-9 rounded-md px-3 text-sm",lg:"h-11 rounded-md px-8",icon:"h-10 w-10"}},defaultVariants:{variant:"default",size:"default"}}),Fe=f.forwardRef(({className:e,variant:t,size:r,...n},a)=>s.jsx("button",{className:ke(NO({variant:t,size:r,className:e})),ref:a,...n}));Fe.displayName="Button";const C5=f.createContext(null),N5=()=>{const e=f.useContext(C5);if(!e)throw new Error("Confirmation components must be used within Confirmation");return e},T5=({className:e,approval:t="pending",children:r,...n})=>{const a=f.useMemo(()=>({approval:t}),[t]);return s.jsx(C5.Provider,{value:a,children:s.jsx(E5,{className:ke("flex flex-col gap-2",e),...n,children:r})})};T5.displayName="Confirmation";const A5=({className:e,...t})=>s.jsx("div",{"data-slot":"confirmation-title",className:ke("text-muted-foreground inline text-sm",e),...t});A5.displayName="ConfirmationTitle";const I5=({children:e})=>{const{approval:t}=N5();return t!=="pending"?null:s.jsx(s.Fragment,{children:e})};I5.displayName="ConfirmationRequest";const j5=({className:e,...t})=>{const{approval:r}=N5();return r!=="pending"?null:s.jsx("div",{"data-slot":"confirmation-actions",className:ke("flex items-center justify-end gap-2 self-end",e),...t})};j5.displayName="ConfirmationActions";const Ro=({variant:e="default",...t})=>s.jsx(Fe,{className:"h-8 px-3 text-sm",variant:e,type:"button",...t});Ro.displayName="ConfirmationAction";const nb=f.forwardRef(({className:e,...t},r)=>s.jsx("div",{ref:r,className:ke("rounded-xl border bg-card text-card-foreground shadow-sm",e),...t}));nb.displayName="Card";const R5=f.forwardRef(({className:e,...t},r)=>s.jsx("div",{ref:r,className:ke("flex flex-col space-y-1.5 p-4",e),...t}));R5.displayName="CardHeader";const _5=f.forwardRef(({className:e,...t},r)=>s.jsx("h3",{ref:r,className:ke("font-semibold leading-none tracking-tight",e),...t}));_5.displayName="CardTitle";const TO=f.forwardRef(({className:e,...t},r)=>s.jsx("p",{ref:r,className:ke("text-sm text-muted-foreground",e),...t}));TO.displayName="CardDescription";const D5=f.forwardRef(({className:e,...t},r)=>s.jsx("div",{ref:r,className:ke("p-4 pt-0",e),...t}));D5.displayName="CardContent";const M5=f.forwardRef(({className:e,...t},r)=>s.jsx("div",{ref:r,className:ke("flex items-center p-4 pt-0",e),...t}));M5.displayName="CardFooter";const AO=f.forwardRef(({className:e,...t},r)=>s.jsx("div",{ref:r,className:ke("ml-auto shrink-0",e),...t}));AO.displayName="CardAction";const O5=f.createContext(null);function L5(){const e=f.useContext(O5);if(!e)throw new Error("Collapsible components must be used within <Collapsible>");return e}const wa=f.forwardRef(({defaultOpen:e=!1,open:t,onOpenChange:r,className:n,children:a,...i},o)=>{const[l,c]=f.useState(e),u=t!==void 0,d=u?t:l,p=f.useCallback(m=>{u||c(m),r?.(m)},[u,r]),h=f.useMemo(()=>({open:d,onOpenChange:p}),[d,p]);return s.jsx(O5.Provider,{value:h,children:s.jsx("div",{ref:o,"data-state":d?"open":"closed",className:n,...i,children:a})})});wa.displayName="Collapsible";const Zn=f.forwardRef(({onClick:e,children:t,className:r,...n},a)=>{const{open:i,onOpenChange:o}=L5(),l=f.useCallback(c=>{o(!i),e?.(c)},[i,o,e]);return s.jsx("button",{ref:a,type:"button","aria-expanded":i,"data-state":i?"open":"closed",onClick:l,className:r,...n,children:t})});Zn.displayName="CollapsibleTrigger";const Sa=f.forwardRef(({className:e,children:t,...r},n)=>{const{open:a}=L5();return s.jsx("div",{ref:n,"data-state":a?"open":"closed",className:ke("grid transition-[grid-template-rows] duration-200 ease-out",a?"grid-rows-[1fr]":"grid-rows-[0fr]",e),...r,children:s.jsx("div",{className:"overflow-hidden",children:t})})});Sa.displayName="CollapsibleContent";var Sy=1,IO=.9,jO=.8,RO=.17,Sc=.1,Ec=.999,_O=.9999,DO=.99,MO=/[\\\/_+.#"@\[\(\{&]/,OO=/[\\\/_+.#"@\[\(\{&]/g,LO=/[\s-]/,P5=/[\s-]/g;function P0(e,t,r,n,a,i,o){if(i===t.length)return a===e.length?Sy:DO;var l=`${a},${i}`;if(o[l]!==void 0)return o[l];for(var c=n.charAt(i),u=r.indexOf(c,a),d=0,p,h,m,g;u>=0;)p=P0(e,t,r,n,u+1,i+1,o),p>d&&(u===a?p*=Sy:MO.test(e.charAt(u-1))?(p*=jO,m=e.slice(a,u-1).match(OO),m&&a>0&&(p*=Math.pow(Ec,m.length))):LO.test(e.charAt(u-1))?(p*=IO,g=e.slice(a,u-1).match(P5),g&&a>0&&(p*=Math.pow(Ec,g.length))):(p*=RO,a>0&&(p*=Math.pow(Ec,u-a))),e.charAt(u)!==t.charAt(i)&&(p*=_O)),(p<Sc&&r.charAt(u-1)===n.charAt(i+1)||n.charAt(i+1)===n.charAt(i)&&r.charAt(u-1)!==n.charAt(i))&&(h=P0(e,t,r,n,u+1,i+2,o),h*Sc>p&&(p=h*Sc)),p>d&&(d=p),u=r.indexOf(c,u+1);return o[l]=d,d}function Ey(e){return e.toLowerCase().replace(P5," ")}function PO(e,t,r){return e=r&&r.length>0?`${e+" "+r.join(" ")}`:e,P0(e,t,Ey(e),Ey(t),0,0,{})}function Wn(e,t,{checkForDefaultPrevented:r=!0}={}){return function(a){if(e?.(a),r===!1||!a.defaultPrevented)return t?.(a)}}function Cy(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function Xn(...e){return t=>{let r=!1;const n=e.map(a=>{const i=Cy(a,t);return!r&&typeof i=="function"&&(r=!0),i});if(r)return()=>{for(let a=0;a<n.length;a++){const i=n[a];typeof i=="function"?i():Cy(e[a],null)}}}}function ja(...e){return f.useCallback(Xn(...e),e)}function FO(e,t){const r=f.createContext(t),n=i=>{const{children:o,...l}=i,c=f.useMemo(()=>l,Object.values(l));return s.jsx(r.Provider,{value:c,children:o})};n.displayName=e+"Provider";function a(i){const o=f.useContext(r);if(o)return o;if(t!==void 0)return t;throw new Error(`\`${i}\` must be used within \`${e}\``)}return[n,a]}function zO(e,t=[]){let r=[];function n(i,o){const l=f.createContext(o),c=r.length;r=[...r,o];const u=p=>{const{scope:h,children:m,...g}=p,b=h?.[e]?.[c]||l,x=f.useMemo(()=>g,Object.values(g));return s.jsx(b.Provider,{value:x,children:m})};u.displayName=i+"Provider";function d(p,h){const m=h?.[e]?.[c]||l,g=f.useContext(m);if(g)return g;if(o!==void 0)return o;throw new Error(`\`${p}\` must be used within \`${i}\``)}return[u,d]}const a=()=>{const i=r.map(o=>f.createContext(o));return function(l){const c=l?.[e]||i;return f.useMemo(()=>({[`__scope${e}`]:{...l,[e]:c}}),[l,c])}};return a.scopeName=e,[n,BO(a,...t)]}function BO(...e){const t=e[0];if(e.length===1)return t;const r=()=>{const n=e.map(a=>({useScope:a(),scopeName:a.scopeName}));return function(i){const o=n.reduce((l,{useScope:c,scopeName:u})=>{const p=c(i)[`__scope${u}`];return{...l,...p}},{});return f.useMemo(()=>({[`__scope${t.scopeName}`]:o}),[o])}};return r.scopeName=t.scopeName,r}var hs=globalThis?.document?f.useLayoutEffect:()=>{},$O=Lg[" useId ".trim().toString()]||(()=>{}),UO=0;function vn(e){const[t,r]=f.useState($O());return hs(()=>{r(n=>n??String(UO++))},[e]),t?`radix-${t}`:""}var GO=Lg[" useInsertionEffect ".trim().toString()]||hs;function qO({prop:e,defaultProp:t,onChange:r=()=>{},caller:n}){const[a,i,o]=HO({defaultProp:t,onChange:r}),l=e!==void 0,c=l?e:a;{const d=f.useRef(e!==void 0);f.useEffect(()=>{const p=d.current;p!==l&&console.warn(`${n} is changing from ${p?"controlled":"uncontrolled"} to ${l?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),d.current=l},[l,n])}const u=f.useCallback(d=>{if(l){const p=VO(d)?d(e):d;p!==e&&o.current?.(p)}else i(d)},[l,e,i,o]);return[c,u]}function HO({defaultProp:e,onChange:t}){const[r,n]=f.useState(e),a=f.useRef(r),i=f.useRef(t);return GO(()=>{i.current=t},[t]),f.useEffect(()=>{a.current!==r&&(i.current?.(r),a.current=r)},[r,a]),[r,n,i]}function VO(e){return typeof e=="function"}function As(e){const t=WO(e),r=f.forwardRef((n,a)=>{const{children:i,...o}=n,l=f.Children.toArray(i),c=l.find(YO);if(c){const u=c.props.children,d=l.map(p=>p===c?f.Children.count(u)>1?f.Children.only(null):f.isValidElement(u)?u.props.children:null:p);return s.jsx(t,{...o,ref:a,children:f.isValidElement(u)?f.cloneElement(u,void 0,d):null})}return s.jsx(t,{...o,ref:a,children:i})});return r.displayName=`${e}.Slot`,r}function WO(e){const t=f.forwardRef((r,n)=>{const{children:a,...i}=r;if(f.isValidElement(a)){const o=XO(a),l=ZO(i,a.props);return a.type!==f.Fragment&&(l.ref=n?Xn(n,o):o),f.cloneElement(a,l)}return f.Children.count(a)>1?f.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var KO=Symbol("radix.slottable");function YO(e){return f.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===KO}function ZO(e,t){const r={...t};for(const n in t){const a=e[n],i=t[n];/^on[A-Z]/.test(n)?a&&i?r[n]=(...l)=>{const c=i(...l);return a(...l),c}:a&&(r[n]=a):n==="style"?r[n]={...a,...i}:n==="className"&&(r[n]=[a,i].filter(Boolean).join(" "))}return{...e,...r}}function XO(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning;return r?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning,r?e.props.ref:e.props.ref||e.ref)}var JO=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],F5=JO.reduce((e,t)=>{const r=As(`Primitive.${t}`),n=f.forwardRef((a,i)=>{const{asChild:o,...l}=a,c=o?r:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),s.jsx(c,{...l,ref:i})});return n.displayName=`Primitive.${t}`,{...e,[t]:n}},{});function QO(e,t){e&&Nl.flushSync(()=>e.dispatchEvent(t))}function fs(e){const t=f.useRef(e);return f.useEffect(()=>{t.current=e}),f.useMemo(()=>(...r)=>t.current?.(...r),[])}function e9(e,t=globalThis?.document){const r=fs(e);f.useEffect(()=>{const n=a=>{a.key==="Escape"&&r(a)};return t.addEventListener("keydown",n,{capture:!0}),()=>t.removeEventListener("keydown",n,{capture:!0})},[r,t])}var t9="DismissableLayer",F0="dismissableLayer.update",r9="dismissableLayer.pointerDownOutside",n9="dismissableLayer.focusOutside",Ny,z5=f.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),B5=f.forwardRef((e,t)=>{const{disableOutsidePointerEvents:r=!1,onEscapeKeyDown:n,onPointerDownOutside:a,onFocusOutside:i,onInteractOutside:o,onDismiss:l,...c}=e,u=f.useContext(z5),[d,p]=f.useState(null),h=d?.ownerDocument??globalThis?.document,[,m]=f.useState({}),g=ja(t,N=>p(N)),b=Array.from(u.layers),[x]=[...u.layersWithOutsidePointerEventsDisabled].slice(-1),y=b.indexOf(x),v=d?b.indexOf(d):-1,k=u.layersWithOutsidePointerEventsDisabled.size>0,S=v>=y,E=s9(N=>{const R=N.target,T=[...u.branches].some(j=>j.contains(R));!S||T||(a?.(N),o?.(N),N.defaultPrevented||l?.())},h),w=o9(N=>{const R=N.target;[...u.branches].some(j=>j.contains(R))||(i?.(N),o?.(N),N.defaultPrevented||l?.())},h);return e9(N=>{v===u.layers.size-1&&(n?.(N),!N.defaultPrevented&&l&&(N.preventDefault(),l()))},h),f.useEffect(()=>{if(d)return r&&(u.layersWithOutsidePointerEventsDisabled.size===0&&(Ny=h.body.style.pointerEvents,h.body.style.pointerEvents="none"),u.layersWithOutsidePointerEventsDisabled.add(d)),u.layers.add(d),Ty(),()=>{r&&u.layersWithOutsidePointerEventsDisabled.size===1&&(h.body.style.pointerEvents=Ny)}},[d,h,r,u]),f.useEffect(()=>()=>{d&&(u.layers.delete(d),u.layersWithOutsidePointerEventsDisabled.delete(d),Ty())},[d,u]),f.useEffect(()=>{const N=()=>m({});return document.addEventListener(F0,N),()=>document.removeEventListener(F0,N)},[]),s.jsx(F5.div,{...c,ref:g,style:{pointerEvents:k?S?"auto":"none":void 0,...e.style},onFocusCapture:Wn(e.onFocusCapture,w.onFocusCapture),onBlurCapture:Wn(e.onBlurCapture,w.onBlurCapture),onPointerDownCapture:Wn(e.onPointerDownCapture,E.onPointerDownCapture)})});B5.displayName=t9;var a9="DismissableLayerBranch",i9=f.forwardRef((e,t)=>{const r=f.useContext(z5),n=f.useRef(null),a=ja(t,n);return f.useEffect(()=>{const i=n.current;if(i)return r.branches.add(i),()=>{r.branches.delete(i)}},[r.branches]),s.jsx(F5.div,{...e,ref:a})});i9.displayName=a9;function s9(e,t=globalThis?.document){const r=fs(e),n=f.useRef(!1),a=f.useRef(()=>{});return f.useEffect(()=>{const i=l=>{if(l.target&&!n.current){let c=function(){$5(r9,r,u,{discrete:!0})};const u={originalEvent:l};l.pointerType==="touch"?(t.removeEventListener("click",a.current),a.current=c,t.addEventListener("click",a.current,{once:!0})):c()}else t.removeEventListener("click",a.current);n.current=!1},o=window.setTimeout(()=>{t.addEventListener("pointerdown",i)},0);return()=>{window.clearTimeout(o),t.removeEventListener("pointerdown",i),t.removeEventListener("click",a.current)}},[t,r]),{onPointerDownCapture:()=>n.current=!0}}function o9(e,t=globalThis?.document){const r=fs(e),n=f.useRef(!1);return f.useEffect(()=>{const a=i=>{i.target&&!n.current&&$5(n9,r,{originalEvent:i},{discrete:!1})};return t.addEventListener("focusin",a),()=>t.removeEventListener("focusin",a)},[t,r]),{onFocusCapture:()=>n.current=!0,onBlurCapture:()=>n.current=!1}}function Ty(){const e=new CustomEvent(F0);document.dispatchEvent(e)}function $5(e,t,r,{discrete:n}){const a=r.originalEvent.target,i=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:r});t&&a.addEventListener(e,t,{once:!0}),n?QO(a,i):a.dispatchEvent(i)}var l9=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],c9=l9.reduce((e,t)=>{const r=As(`Primitive.${t}`),n=f.forwardRef((a,i)=>{const{asChild:o,...l}=a,c=o?r:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),s.jsx(c,{...l,ref:i})});return n.displayName=`Primitive.${t}`,{...e,[t]:n}},{}),Cc="focusScope.autoFocusOnMount",Nc="focusScope.autoFocusOnUnmount",Ay={bubbles:!1,cancelable:!0},u9="FocusScope",U5=f.forwardRef((e,t)=>{const{loop:r=!1,trapped:n=!1,onMountAutoFocus:a,onUnmountAutoFocus:i,...o}=e,[l,c]=f.useState(null),u=fs(a),d=fs(i),p=f.useRef(null),h=ja(t,b=>c(b)),m=f.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;f.useEffect(()=>{if(n){let b=function(k){if(m.paused||!l)return;const S=k.target;l.contains(S)?p.current=S:Bn(p.current,{select:!0})},x=function(k){if(m.paused||!l)return;const S=k.relatedTarget;S!==null&&(l.contains(S)||Bn(p.current,{select:!0}))},y=function(k){if(document.activeElement===document.body)for(const E of k)E.removedNodes.length>0&&Bn(l)};document.addEventListener("focusin",b),document.addEventListener("focusout",x);const v=new MutationObserver(y);return l&&v.observe(l,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",b),document.removeEventListener("focusout",x),v.disconnect()}}},[n,l,m.paused]),f.useEffect(()=>{if(l){jy.add(m);const b=document.activeElement;if(!l.contains(b)){const y=new CustomEvent(Cc,Ay);l.addEventListener(Cc,u),l.dispatchEvent(y),y.defaultPrevented||(d9(g9(G5(l)),{select:!0}),document.activeElement===b&&Bn(l))}return()=>{l.removeEventListener(Cc,u),setTimeout(()=>{const y=new CustomEvent(Nc,Ay);l.addEventListener(Nc,d),l.dispatchEvent(y),y.defaultPrevented||Bn(b??document.body,{select:!0}),l.removeEventListener(Nc,d),jy.remove(m)},0)}}},[l,u,d,m]);const g=f.useCallback(b=>{if(!r&&!n||m.paused)return;const x=b.key==="Tab"&&!b.altKey&&!b.ctrlKey&&!b.metaKey,y=document.activeElement;if(x&&y){const v=b.currentTarget,[k,S]=p9(v);k&&S?!b.shiftKey&&y===S?(b.preventDefault(),r&&Bn(k,{select:!0})):b.shiftKey&&y===k&&(b.preventDefault(),r&&Bn(S,{select:!0})):y===v&&b.preventDefault()}},[r,n,m.paused]);return s.jsx(c9.div,{tabIndex:-1,...o,ref:h,onKeyDown:g})});U5.displayName=u9;function d9(e,{select:t=!1}={}){const r=document.activeElement;for(const n of e)if(Bn(n,{select:t}),document.activeElement!==r)return}function p9(e){const t=G5(e),r=Iy(t,e),n=Iy(t.reverse(),e);return[r,n]}function G5(e){const t=[],r=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:n=>{const a=n.tagName==="INPUT"&&n.type==="hidden";return n.disabled||n.hidden||a?NodeFilter.FILTER_SKIP:n.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;r.nextNode();)t.push(r.currentNode);return t}function Iy(e,t){for(const r of e)if(!m9(r,{upTo:t}))return r}function m9(e,{upTo:t}){if(getComputedStyle(e).visibility==="hidden")return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display==="none")return!0;e=e.parentElement}return!1}function h9(e){return e instanceof HTMLInputElement&&"select"in e}function Bn(e,{select:t=!1}={}){if(e&&e.focus){const r=document.activeElement;e.focus({preventScroll:!0}),e!==r&&h9(e)&&t&&e.select()}}var jy=f9();function f9(){let e=[];return{add(t){const r=e[0];t!==r&&r?.pause(),e=Ry(e,t),e.unshift(t)},remove(t){e=Ry(e,t),e[0]?.resume()}}}function Ry(e,t){const r=[...e],n=r.indexOf(t);return n!==-1&&r.splice(n,1),r}function g9(e){return e.filter(t=>t.tagName!=="A")}var b9=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],x9=b9.reduce((e,t)=>{const r=As(`Primitive.${t}`),n=f.forwardRef((a,i)=>{const{asChild:o,...l}=a,c=o?r:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),s.jsx(c,{...l,ref:i})});return n.displayName=`Primitive.${t}`,{...e,[t]:n}},{}),y9="Portal",q5=f.forwardRef((e,t)=>{const{container:r,...n}=e,[a,i]=f.useState(!1);hs(()=>i(!0),[]);const o=r||a&&globalThis?.document?.body;return o?Ki.createPortal(s.jsx(x9.div,{...n,ref:t}),o):null});q5.displayName=y9;function v9(e,t){return f.useReducer((r,n)=>t[r][n]??r,e)}var Ol=e=>{const{present:t,children:r}=e,n=k9(t),a=typeof r=="function"?r({present:n.isPresent}):f.Children.only(r),i=ja(n.ref,w9(a));return typeof r=="function"||n.isPresent?f.cloneElement(a,{ref:i}):null};Ol.displayName="Presence";function k9(e){const[t,r]=f.useState(),n=f.useRef(null),a=f.useRef(e),i=f.useRef("none"),o=e?"mounted":"unmounted",[l,c]=v9(o,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return f.useEffect(()=>{const u=Gs(n.current);i.current=l==="mounted"?u:"none"},[l]),hs(()=>{const u=n.current,d=a.current;if(d!==e){const h=i.current,m=Gs(u);e?c("MOUNT"):m==="none"||u?.display==="none"?c("UNMOUNT"):c(d&&h!==m?"ANIMATION_OUT":"UNMOUNT"),a.current=e}},[e,c]),hs(()=>{if(t){let u;const d=t.ownerDocument.defaultView??window,p=m=>{const b=Gs(n.current).includes(CSS.escape(m.animationName));if(m.target===t&&b&&(c("ANIMATION_END"),!a.current)){const x=t.style.animationFillMode;t.style.animationFillMode="forwards",u=d.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=x)})}},h=m=>{m.target===t&&(i.current=Gs(n.current))};return t.addEventListener("animationstart",h),t.addEventListener("animationcancel",p),t.addEventListener("animationend",p),()=>{d.clearTimeout(u),t.removeEventListener("animationstart",h),t.removeEventListener("animationcancel",p),t.removeEventListener("animationend",p)}}else c("ANIMATION_END")},[t,c]),{isPresent:["mounted","unmountSuspended"].includes(l),ref:f.useCallback(u=>{n.current=u?getComputedStyle(u):null,r(u)},[])}}function Gs(e){return e?.animationName||"none"}function w9(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning;return r?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning,r?e.props.ref:e.props.ref||e.ref)}var S9=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Is=S9.reduce((e,t)=>{const r=As(`Primitive.${t}`),n=f.forwardRef((a,i)=>{const{asChild:o,...l}=a,c=o?r:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),s.jsx(c,{...l,ref:i})});return n.displayName=`Primitive.${t}`,{...e,[t]:n}},{}),Tc=0;function E9(){f.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??_y()),document.body.insertAdjacentElement("beforeend",e[1]??_y()),Tc++,()=>{Tc===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(t=>t.remove()),Tc--}},[])}function _y(){const e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.outline="none",e.style.opacity="0",e.style.position="fixed",e.style.pointerEvents="none",e}var Qr=function(){return Qr=Object.assign||function(t){for(var r,n=1,a=arguments.length;n<a;n++){r=arguments[n];for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(t[i]=r[i])}return t},Qr.apply(this,arguments)};function H5(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var a=0,n=Object.getOwnPropertySymbols(e);a<n.length;a++)t.indexOf(n[a])<0&&Object.prototype.propertyIsEnumerable.call(e,n[a])&&(r[n[a]]=e[n[a]]);return r}function Ra(e,t,r,n){function a(i){return i instanceof r?i:new r(function(o){o(i)})}return new(r||(r=Promise))(function(i,o){function l(d){try{u(n.next(d))}catch(p){o(p)}}function c(d){try{u(n.throw(d))}catch(p){o(p)}}function u(d){d.done?i(d.value):a(d.value).then(l,c)}u((n=n.apply(e,t||[])).next())})}function C9(e,t,r){if(r||arguments.length===2)for(var n=0,a=t.length,i;n<a;n++)(i||!(n in t))&&(i||(i=Array.prototype.slice.call(t,0,n)),i[n]=t[n]);return e.concat(i||Array.prototype.slice.call(t))}var _o="right-scroll-bar-position",Do="width-before-scroll-bar",N9="with-scroll-bars-hidden",T9="--removed-body-scroll-bar-size";function Ac(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function A9(e,t){var r=f.useState(function(){return{value:e,callback:t,facade:{get current(){return r.value},set current(n){var a=r.value;a!==n&&(r.value=n,r.callback(n,a))}}}})[0];return r.callback=t,r.facade}var I9=typeof window<"u"?f.useLayoutEffect:f.useEffect,Dy=new WeakMap;function j9(e,t){var r=A9(null,function(n){return e.forEach(function(a){return Ac(a,n)})});return I9(function(){var n=Dy.get(r);if(n){var a=new Set(n),i=new Set(e),o=r.current;a.forEach(function(l){i.has(l)||Ac(l,null)}),i.forEach(function(l){a.has(l)||Ac(l,o)})}Dy.set(r,e)},[e]),r}function R9(e){return e}function _9(e,t){t===void 0&&(t=R9);var r=[],n=!1,a={read:function(){if(n)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return r.length?r[r.length-1]:e},useMedium:function(i){var o=t(i,n);return r.push(o),function(){r=r.filter(function(l){return l!==o})}},assignSyncMedium:function(i){for(n=!0;r.length;){var o=r;r=[],o.forEach(i)}r={push:function(l){return i(l)},filter:function(){return r}}},assignMedium:function(i){n=!0;var o=[];if(r.length){var l=r;r=[],l.forEach(i),o=r}var c=function(){var d=o;o=[],d.forEach(i)},u=function(){return Promise.resolve().then(c)};u(),r={push:function(d){o.push(d),u()},filter:function(d){return o=o.filter(d),r}}}};return a}function D9(e){e===void 0&&(e={});var t=_9(null);return t.options=Qr({async:!0,ssr:!1},e),t}var V5=function(e){var t=e.sideCar,r=H5(e,["sideCar"]);if(!t)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var n=t.read();if(!n)throw new Error("Sidecar medium not found");return f.createElement(n,Qr({},r))};V5.isSideCarExport=!0;function M9(e,t){return e.useMedium(t),V5}var W5=D9(),Ic=function(){},Ll=f.forwardRef(function(e,t){var r=f.useRef(null),n=f.useState({onScrollCapture:Ic,onWheelCapture:Ic,onTouchMoveCapture:Ic}),a=n[0],i=n[1],o=e.forwardProps,l=e.children,c=e.className,u=e.removeScrollBar,d=e.enabled,p=e.shards,h=e.sideCar,m=e.noRelative,g=e.noIsolation,b=e.inert,x=e.allowPinchZoom,y=e.as,v=y===void 0?"div":y,k=e.gapMode,S=H5(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),E=h,w=j9([r,t]),N=Qr(Qr({},S),a);return f.createElement(f.Fragment,null,d&&f.createElement(E,{sideCar:W5,removeScrollBar:u,shards:p,noRelative:m,noIsolation:g,inert:b,setCallbacks:i,allowPinchZoom:!!x,lockRef:r,gapMode:k}),o?f.cloneElement(f.Children.only(l),Qr(Qr({},N),{ref:w})):f.createElement(v,Qr({},N,{className:c,ref:w}),l))});Ll.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};Ll.classNames={fullWidth:Do,zeroRight:_o};var O9=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function L9(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=O9();return t&&e.setAttribute("nonce",t),e}function P9(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function F9(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var z9=function(){var e=0,t=null;return{add:function(r){e==0&&(t=L9())&&(P9(t,r),F9(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},B9=function(){var e=z9();return function(t,r){f.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&r])}},K5=function(){var e=B9(),t=function(r){var n=r.styles,a=r.dynamic;return e(n,a),null};return t},$9={left:0,top:0,right:0,gap:0},jc=function(e){return parseInt(e||"",10)||0},U9=function(e){var t=window.getComputedStyle(document.body),r=t[e==="padding"?"paddingLeft":"marginLeft"],n=t[e==="padding"?"paddingTop":"marginTop"],a=t[e==="padding"?"paddingRight":"marginRight"];return[jc(r),jc(n),jc(a)]},G9=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return $9;var t=U9(e),r=document.documentElement.clientWidth,n=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,n-r+t[2]-t[0])}},q9=K5(),ci="data-scroll-locked",H9=function(e,t,r,n){var a=e.left,i=e.top,o=e.right,l=e.gap;return r===void 0&&(r="margin"),`
|
|
704
|
+
`;function DD(){if(typeof document>"u"||document.getElementById(oy))return;const e=document.createElement("style");e.id=oy,e.type="text/css",e.innerText=_D,document.head.appendChild(e)}function MD({terminalContainerRef:e,terminalRef:t,fitAddonRef:r,wsRef:n,selectedProject:a,minimal:i,isRestarting:o,initialCommandRef:l,isPlainShellRef:c,authUrlRef:u,copyAuthUrlToClipboard:d,closeSocket:p}){const[h,m]=f.useState(!1),g=f.useRef(null),b=a?.fullPath||a?.path||"",x=!!a;f.useEffect(()=>{DD()},[]);const y=f.useCallback(()=>{t.current&&(t.current.clear(),t.current.write("\x1B[2J\x1B[H"))},[t]),v=f.useCallback(()=>{t.current&&(t.current.dispose(),t.current=null),r.current=null,m(!1)},[r,t]);return f.useEffect(()=>{if(!e.current||!x||o||t.current)return;const k=new ID.Terminal(xD);t.current=k;const S=new CD.FitAddon;r.current=S,k.loadAddon(S),i||k.loadAddon(new TD.WebLinksAddon);try{k.loadAddon(new AD.WebglAddon)}catch{console.warn("[Shell] WebGL renderer unavailable, using Canvas fallback")}k.open(e.current);const E=async()=>{const T=k.getSelection();return T?sn(T):!1},w=T=>{if(!k.hasSelection())return;const j=k.getSelection();if(j){if(T.preventDefault(),T.clipboardData){T.clipboardData.setData("text/plain",j);return}sn(j)}};e.current.addEventListener("copy",w),k.attachCustomKeyEventHandler(T=>{const j=XN(l.current)?YN:u.current;return T.type==="keydown"&&i&&c.current&&j&&!T.ctrlKey&&!T.metaKey&&!T.altKey&&T.key?.toLowerCase()==="c"?(T.preventDefault(),T.stopPropagation(),d(j),!1):T.type==="keydown"&&(T.ctrlKey||T.metaKey)&&T.key?.toLowerCase()==="c"&&k.hasSelection()?(T.preventDefault(),T.stopPropagation(),E(),!1):T.type==="keydown"&&(T.ctrlKey||T.metaKey)&&T.key?.toLowerCase()==="v"?(T.preventDefault(),T.stopPropagation(),typeof navigator<"u"&&navigator.clipboard?.readText&&navigator.clipboard.readText().then(D=>{xa(n.current,{type:"input",data:D})}).catch(()=>{}),!1):!0}),window.setTimeout(()=>{const T=r.current,j=t.current;!T||!j||(T.fit(),xa(n.current,{type:"resize",cols:j.cols,rows:j.rows}))},ZN),m(!0);const N=k.onData(T=>{xa(n.current,{type:"input",data:T})}),R=new ResizeObserver(()=>{g.current!==null&&window.clearTimeout(g.current),g.current=window.setTimeout(()=>{const T=r.current,j=t.current;!T||!j||(T.fit(),xa(n.current,{type:"resize",cols:j.cols,rows:j.rows}))},pD)});return R.observe(e.current),()=>{e.current?.removeEventListener("copy",w),R.disconnect(),g.current!==null&&(window.clearTimeout(g.current),g.current=null),N.dispose(),p(),v()}},[u,p,d,v,r,l,c,o,i,x,b,e,t,n]),{isInitialized:h,clearTerminalScreen:y,disposeTerminal:v}}function OD({selectedProject:e,selectedSession:t,initialCommand:r,isPlainShell:n,minimal:a,autoConnect:i,isRestarting:o,onProcessComplete:l,onOutputRef:c}){const u=f.useRef(null),d=f.useRef(null),p=f.useRef(null),h=f.useRef(null),[m,g]=f.useState(""),[b,x]=f.useState(0),y=f.useRef(e),v=f.useRef(t),k=f.useRef(r),S=f.useRef(n),E=f.useRef(l),w=f.useRef(""),N=f.useRef(t?.id??null);f.useEffect(()=>{y.current=e,v.current=t,k.current=r,S.current=n,E.current=l},[e,t,r,n,l]);const R=f.useCallback(H=>{w.current=H,g(H),x(M=>M+1)},[]),T=f.useCallback(()=>{const H=h.current;H&&((H.readyState===WebSocket.OPEN||H.readyState===WebSocket.CONNECTING)&&H.close(),h.current=null)},[]),j=f.useCallback((H=w.current)=>{if(!H)return!1;const M=window.open(H,"_blank");if(M){try{M.opener=null}catch{}return!0}return!1},[]),D=f.useCallback(async(H=w.current)=>H?sn(H):!1,[]),{isInitialized:A,clearTerminalScreen:F,disposeTerminal:C}=MD({terminalContainerRef:u,terminalRef:d,fitAddonRef:p,wsRef:h,selectedProject:e,minimal:a,isRestarting:o,initialCommandRef:k,isPlainShellRef:S,authUrlRef:w,copyAuthUrlToClipboard:D,closeSocket:T}),{isConnected:$,isConnecting:Y,connectToShell:V,disconnectFromShell:K}=ED({wsRef:h,terminalRef:d,fitAddonRef:p,selectedProjectRef:y,selectedSessionRef:v,initialCommandRef:k,isPlainShellRef:S,onProcessCompleteRef:E,isInitialized:A,autoConnect:i,closeSocket:T,clearTerminalScreen:F,setAuthUrl:R,onOutputRef:c});return f.useEffect(()=>{o&&(K(),C())},[K,C,o]),f.useEffect(()=>{e||(K(),C())},[K,C,e]),f.useEffect(()=>{const H=t?.id??null;N.current!==H&&A&&K(),N.current=H},[K,A,t?.id]),{terminalContainerRef:u,terminalRef:d,wsRef:h,isConnected:$,isInitialized:A,isConnecting:Y,authUrl:m,authUrlVersion:b,connectToShell:V,disconnectFromShell:K,openAuthUrlInBrowser:j,copyAuthUrlToClipboard:D}}function LD({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 PD({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 FD({isConnected:e,isInitialized:t,isRestarting:r,hasSession:n,sessionDisplayNameShort:a,onDisconnect:i,onRestart:o,statusNewSessionText:l,statusInitializingText:c,statusRestartingText:u,disconnectLabel:d,disconnectTitle:p,restartLabel:h,restartTitle:m,disableRestart:g}){return s.jsx("div",{className:"flex-shrink-0 border-b border-gray-700 bg-gray-800 px-4 py-2",children:s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("div",{className:"flex items-center space-x-2",children:[s.jsx("div",{className:`h-2 w-2 rounded-full ${e?"bg-green-500":"bg-red-500"}`}),n&&a&&s.jsxs("span",{className:"text-xs text-blue-300",children:["(",a,"...)"]}),!n&&s.jsx("span",{className:"text-xs text-gray-400",children:l}),!t&&s.jsx("span",{className:"text-xs text-yellow-400",children:c}),r&&s.jsx("span",{className:"text-xs text-blue-400",children:u})]}),s.jsxs("div",{className:"flex items-center space-x-3",children:[e&&s.jsxs("button",{onClick:i,className:"flex items-center space-x-1 rounded bg-red-600 px-3 py-1 text-xs text-white hover:bg-red-700",title:p,children:[s.jsx("svg",{className:"h-3 w-3",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})}),s.jsx("span",{children:d})]}),s.jsxs("button",{onClick:o,disabled:g,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 zD({terminalContainerRef:e,authUrl:t,authUrlVersion:r,initialCommand:n,isConnected:a,openAuthUrlInBrowser:i,copyAuthUrlToClipboard:o}){const[l,c]=f.useState("idle"),[u,d]=f.useState(!1),p=f.useMemo(()=>jD(n,t),[t,n]);f.useEffect(()=>{c("idle"),d(!1)},[r,p,a]);const h=!!p,m=h&&!u,g=h&&u;return s.jsxs("div",{className:"relative h-full w-full bg-gray-900",children:[s.jsx("div",{ref:e,className:"h-full w-full focus:outline-none",style:{outline:"none"}}),m&&s.jsx("div",{className:"absolute inset-x-0 bottom-14 z-20 border-t border-gray-700/80 bg-gray-900/95 p-3 backdrop-blur-sm md:hidden",children:s.jsxs("div",{className:"flex flex-col gap-2",children:[s.jsxs("div",{className:"flex items-center justify-between gap-2",children:[s.jsx("p",{className:"text-xs text-gray-300",children:"Open or copy the login URL:"}),s.jsx("button",{type:"button",onClick:()=>d(!0),className:"rounded bg-gray-700 px-2 py-1 text-[10px] font-medium uppercase tracking-wide text-gray-100 hover:bg-gray-600",children:"Hide"})]}),s.jsx("input",{type:"text",value:p,readOnly:!0,onClick:b=>b.currentTarget.select(),className:"w-full rounded border border-gray-600 bg-gray-800 px-2 py-1 text-xs text-gray-100 focus:outline-none focus:ring-1 focus:ring-blue-500","aria-label":"Authentication URL"}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("button",{type:"button",onClick:()=>{i(p)},className:"flex-1 rounded bg-blue-600 px-3 py-2 text-xs font-medium text-white hover:bg-blue-700",children:"Open URL"}),s.jsx("button",{type:"button",onClick:async()=>{const b=await o(p);c(b?"copied":"failed")},className:"flex-1 rounded bg-gray-700 px-3 py-2 text-xs font-medium text-white hover:bg-gray-600",children:l==="copied"?"Copied":"Copy URL"})]})]})}),g&&s.jsx("div",{className:"absolute bottom-14 right-3 z-20 md:hidden",children:s.jsx("button",{type:"button",onClick:()=>d(!1),className:"rounded bg-gray-800/95 px-3 py-2 text-xs font-medium text-gray-100 shadow-lg backdrop-blur-sm hover:bg-gray-700",children:"Show login URL"})})]})}const BD=[{type:"key",id:"esc",label:"Esc",sequence:"\x1B"},{type:"key",id:"tab",label:"Tab",sequence:" "},{type:"key",id:"shift-tab",label:"⇧Tab",sequence:"\x1B[Z"},{type:"modifier",id:"ctrl",label:"CTRL",modifier:"ctrl"},{type:"modifier",id:"alt",label:"ALT",modifier:"alt"},{type:"arrow",id:"arrow-up",sequence:"\x1B[A",icon:"up"},{type:"arrow",id:"arrow-down",sequence:"\x1B[B",icon:"down"},{type:"arrow",id:"arrow-left",sequence:"\x1B[D",icon:"left"},{type:"arrow",id:"arrow-right",sequence:"\x1B[C",icon:"right"}],$D={up:DN,down:Il,left:K7,right:$g},Fi=e=>e.preventDefault(),ly="shrink-0 rounded-md border border-gray-600 bg-gray-700 px-2.5 py-1.5 text-xs font-medium text-gray-100 transition-colors select-none active:bg-blue-600 active:text-white active:border-blue-600 disabled:cursor-not-allowed disabled:opacity-40",UD="shrink-0 rounded-md border border-blue-500 bg-blue-600 px-2.5 py-1.5 text-xs font-medium text-white transition-colors select-none disabled:cursor-not-allowed disabled:opacity-40",xc="shrink-0 rounded-md border border-gray-600 bg-gray-700 p-1.5 text-gray-100 transition-colors select-none active:bg-blue-600 active:text-white active:border-blue-600 disabled:cursor-not-allowed disabled:opacity-40";function cy({wsRef:e,terminalRef:t,isConnected:r,bottomOffset:n="bottom-0"}){const{t:a}=Le("settings"),[i,o]=f.useState(!1),[l,c]=f.useState(!1),u=f.useCallback(m=>{xa(e.current,{type:"input",data:m})},[e]),d=f.useCallback(()=>{t.current?.scrollToBottom()},[t]),p=f.useCallback(async()=>{if(!(typeof navigator>"u"||!navigator.clipboard?.readText))try{const m=await navigator.clipboard.readText();m.length>0&&u(m)}catch{}},[u]),h=f.useCallback(m=>{let g=m;if(i&&m.length===1){const b=m.toLowerCase().charCodeAt(0);b>=97&&b<=122&&(g=String.fromCharCode(b-96)),o(!1)}l&&m.length===1&&(g="\x1B"+g,c(!1)),u(g)},[i,l,u]);return s.jsx("div",{className:`pointer-events-none fixed inset-x-0 ${n} z-20 px-2 md:hidden`,children:s.jsxs("div",{className:"pointer-events-auto flex items-center gap-1 overflow-x-auto rounded-lg border border-gray-700/80 bg-gray-900/95 px-1.5 py-1.5 shadow-lg backdrop-blur-sm [-webkit-overflow-scrolling:touch] [scrollbar-width:none] [&::-webkit-scrollbar]:hidden",children:[s.jsx("button",{type:"button",onPointerDown:Fi,onClick:()=>{p()},disabled:!r,className:xc,title:a("terminalShortcuts.paste",{defaultValue:"Paste"}),"aria-label":a("terminalShortcuts.paste",{defaultValue:"Paste"}),children:s.jsx(LR,{className:"h-4 w-4"})}),BD.map(m=>{if(m.type==="modifier"){const g=m.modifier==="ctrl"?i:l,b=m.modifier==="ctrl"?()=>o(x=>!x):()=>c(x=>!x);return s.jsx("button",{type:"button",onPointerDown:Fi,onClick:b,disabled:!r,className:g?UD:ly,children:m.label},m.id)}if(m.type==="arrow"){const g=$D[m.icon];return s.jsx("button",{type:"button",onPointerDown:Fi,onClick:()=>u(m.sequence),disabled:!r,className:xc,children:s.jsx(g,{className:"h-4 w-4"})},m.id)}return s.jsx("button",{type:"button",onPointerDown:Fi,onClick:()=>h(m.sequence),disabled:!r,className:ly,children:m.label},m.id)}),s.jsx("button",{type:"button",onPointerDown:Fi,onClick:d,disabled:!r,className:xc,title:a("terminalShortcuts.scrollDown"),"aria-label":a("terminalShortcuts.scrollDown"),children:s.jsx(_N,{className:"h-4 w-4"})})]})})}function JN({selectedProject:e=null,selectedSession:t=null,initialCommand:r=null,isPlainShell:n=!1,onProcessComplete:a=null,minimal:i=!1,autoConnect:o=!1,isActive:l=!0}){const{t:c}=Le("chat"),[u,d]=f.useState(!1),[p,h]=f.useState(null),m=f.useRef(null),g=f.useRef(null),{terminalContainerRef:b,terminalRef:x,wsRef:y,isConnected:v,isInitialized:k,isConnecting:S,authUrl:E,authUrlVersion:w,connectToShell:N,disconnectFromShell:R,openAuthUrlInBrowser:T,copyAuthUrlToClipboard:j}=OD({selectedProject:e,selectedSession:t,initialCommand:r,isPlainShell:n,minimal:i,autoConnect:o,isRestarting:u,onProcessComplete:a,onOutputRef:g}),D=f.useCallback(()=>{const P=x.current;if(!P)return;const O=P.buffer.active,Z=O.baseY+O.cursorY,G=Math.min(O.baseY+O.length-1,Z+10),ne=Math.max(0,Z-hD),re=[];for(let Te=ne;Te<=G;Te++){const Ie=O.getLine(Te);Ie&&re.push(Ie.translateToString().trimEnd())}let pe=-1;for(let Te=re.length-1;Te>=0;Te--)if(/esc to cancel/i.test(re[Te])||/enter to select/i.test(re[Te])){pe=Te;break}if(pe===-1){h(null);return}const me=new Map,ye=Math.max(0,pe-fD);for(let Te=pe-1;Te>=ye;Te--){const Ie=re[Te].match(/^\s*[❯›>]?\s*(\d+)\.\s+(.+)/);if(Ie){const L=Ie[1],ce=Ie[2].trim();parseInt(L,10)<=gD&&ce.length>0&&!me.has(L)&&me.set(L,ce)}}const ve=[];for(let Te=1;Te<=me.size&&me.has(String(Te));Te++)ve.push({number:String(Te),label:me.get(String(Te))});h(ve.length>=bD?ve:null)},[x]),A=f.useCallback(()=>{m.current&&clearTimeout(m.current),m.current=setTimeout(D,mD)},[D]);f.useEffect(()=>{g.current=A},[A]),f.useEffect(()=>()=>{m.current&&clearTimeout(m.current)},[]),f.useEffect(()=>{v||(m.current&&(clearTimeout(m.current),m.current=null),h(null))},[v]),f.useEffect(()=>{if(!l||!k||!v)return;const P=()=>{x.current?.focus()},O=window.requestAnimationFrame(P),Z=window.setTimeout(P,0);return()=>{window.cancelAnimationFrame(O),window.clearTimeout(Z)}},[l,v,k,x]);const F=f.useCallback(P=>{xa(y.current,{type:"input",data:P})},[y]),C=f.useMemo(()=>RD(t),[t]),$=f.useMemo(()=>C?C.slice(0,30):null,[C]),Y=f.useMemo(()=>C?C.slice(0,50):null,[C]),V=f.useCallback(()=>{d(!0),window.setTimeout(()=>{d(!1)},dD)},[]);if(!e)return s.jsx(PD,{title:c("shell.selectProject.title"),description:c("shell.selectProject.description")});if(i)return s.jsxs(s.Fragment,{children:[s.jsx(zD,{terminalContainerRef:b,authUrl:E,authUrlVersion:w,initialCommand:r,isConnected:v,openAuthUrlInBrowser:T,copyAuthUrlToClipboard:j}),s.jsx(cy,{wsRef:y,terminalRef:x,isConnected:v,bottomOffset:"bottom-0"})]});const K=n?c("shell.runCommand",{command:r||c("shell.defaultCommand"),projectName:e.displayName}):t?c("shell.resumeSession",{displayName:Y}):c("shell.startSession"),H=n?c("shell.runCommand",{command:r||c("shell.defaultCommand"),projectName:e.displayName}):c("shell.startCli",{projectName:e.displayName}),M=k?S?"connecting":v?null:"connect":"loading",z=M==="connecting"?H:K;return s.jsxs("div",{className:"flex h-full w-full flex-col bg-gray-900",children:[s.jsx(FD,{isConnected:v,isInitialized:k,isRestarting:u,hasSession:!!t,sessionDisplayNameShort:$,onDisconnect:R,onRestart:V,statusNewSessionText:c("shell.status.newSession"),statusInitializingText:c("shell.status.initializing"),statusRestartingText:c("shell.status.restarting"),disconnectLabel:c("shell.actions.disconnect"),disconnectTitle:c("shell.actions.disconnectTitle"),restartLabel:c("shell.actions.restart"),restartTitle:c("shell.actions.restartTitle"),disableRestart:u||v}),s.jsxs("div",{className:"relative flex-1 overflow-hidden p-2",children:[s.jsx("div",{ref:b,className:"h-full w-full focus:outline-none",style:{outline:"none"}}),M&&s.jsx(LD,{mode:M,description:z,loadingLabel:c("shell.loading"),connectLabel:c("shell.actions.connect"),connectTitle:c("shell.actions.connectTitle"),connectingLabel:c("shell.connecting"),onConnect:N}),p&&v&&s.jsx("div",{className:"absolute inset-x-0 bottom-0 z-10 border-t border-gray-700/80 bg-gray-800/95 px-3 py-2 backdrop-blur-sm",onMouseDown:P=>P.preventDefault(),children:s.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[p.map(P=>s.jsxs("button",{type:"button",onClick:()=>{F(P.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:`${P.number}. ${P.label}`,children:[P.number,". ",P.label]},P.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(cy,{wsRef:y,terminalRef:x,isConnected:v})]})}function GD({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 qD({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 QN({project:e=null,session:t=null,command:r=null,isPlainShell:n=null,isActive:a=!0,autoConnect:i=!0,onComplete:o=null,onClose:l=null,title:c=null,className:u="",showHeader:d=!0,compact:p=!1,minimal:h=!1}){const[m,g]=f.useState(!1),b=n!==null?n:r!==null,x=f.useCallback(y=>{g(!0),o?.(y)},[o]);return e?s.jsxs("div",{className:`flex h-full w-full flex-col ${u}`,children:[!h&&d&&c&&s.jsx(qD,{title:c,isCompleted:m,onClose:l}),s.jsx("div",{className:"min-h-0 w-full flex-1",children:s.jsx(JN,{selectedProject:e,selectedSession:t,initialCommand:r,isPlainShell:b,isActive:a,onProcessComplete:x,minimal:h,autoConnect:h?!0:i})})]}):s.jsx(GD,{className:u})}const HD=({provider:e,customCommand:t,isAuthenticated:r})=>t||(e==="claude"?"claude --dangerously-skip-permissions /login":e==="cursor"?"cursor-agent login":e==="codex"?"codex login":"gemini status"),VD=e=>e==="claude"?"Claude CLI Login":e==="cursor"?"Cursor CLI Login":e==="codex"?"Codex CLI Login":"Gemini CLI Configuration";function e5({isOpen:e,onClose:t,provider:r="claude",onComplete:n,customCommand:a,isAuthenticated:i=!1}){if(!e)return null;const o=HD({provider:r,customCommand:a,isAuthenticated:i}),l=VD(r),c=u=>{n?.(u)};return s.jsx("div",{className:"fixed inset-0 z-[9999] flex items-center justify-center bg-black bg-opacity-50 max-md:items-stretch max-md:justify-stretch",children:s.jsxs("div",{className:"flex h-3/4 w-full max-w-4xl flex-col rounded-lg bg-white shadow-xl dark:bg-gray-800 max-md:m-0 max-md:h-full max-md:max-w-none max-md:rounded-none md:m-4 md:h-3/4 md:max-w-4xl md:rounded-lg",children:[s.jsxs("div",{className:"flex items-center justify-between border-b border-gray-200 p-4 dark:border-gray-700",children:[s.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white",children:l}),s.jsx("button",{onClick:t,className:"text-gray-400 transition-colors hover:text-gray-600 dark:hover:text-gray-300","aria-label":"Close login modal",children:s.jsx(gt,{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(FN,{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(Ur,{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(QN,{project:M7,command:o,onComplete:c,minimal:!0})})]})})}const WD=({className:e="w-5 h-5"})=>s.jsx("img",{src:"/icons/claude-ai-icon.svg",alt:"Claude",className:e}),KD=({className:e="w-5 h-5"})=>{const{isDarkMode:t}=Aa();return s.jsx("img",{src:t?"/icons/codex-white.svg":"/icons/codex.svg",alt:"Codex",className:e})},YD=({className:e="w-5 h-5"})=>{const{isDarkMode:t}=Aa();return s.jsx("img",{src:t?"/icons/cursor-white.svg":"/icons/cursor.svg",alt:"Cursor",className:e})},ZD=({className:e="w-5 h-5"})=>s.jsx("img",{src:"/icons/gemini-ai-icon.svg",alt:"Gemini",className:e});function on({provider:e="claude",className:t="w-5 h-5"}){return e==="cursor"?s.jsx(YD,{className:t}):e==="codex"?s.jsx(KD,{className:t}):e==="gemini"?s.jsx(ZD,{className:t}):s.jsx(WD,{className:t})}function XD({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(on,{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(Yt,{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 JD=[{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 QD({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:JD.map(r=>s.jsx(XD,{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 eM({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(sr,{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(J8,{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(U_,{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 uy=[{title:"Git Configuration",icon:sr,required:!0},{title:"Connect Agents",icon:$N,required:!1}];function tM({currentStep:e}){return s.jsx("div",{className:"mb-8",children:s.jsx("div",{className:"flex items-center justify-between",children:uy.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(Yt,{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<uy.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 dy=/^[^\s@]+@[^\s@]+\.[^\s@]+$/,py=async(e,t)=>{try{return(await e.json()).error||t}catch{return t}};function rM({onComplete:e}){const[t,r]=f.useState(0),[n,a]=f.useState(""),[i,o]=f.useState(""),[l,c]=f.useState(!1),[u,d]=f.useState(""),[p,h]=f.useState(null),{providerAuthStatus:m,checkProviderAuthStatus:g,refreshProviderAuthStatuses:b}=KN(),x=f.useRef(void 0),y=f.useCallback(async()=>{try{const R=await Ae("/api/user/git-config");if(!R.ok)return;const T=await R.json();T.gitName&&a(T.gitName),T.gitEmail&&o(T.gitEmail)}catch(R){console.error("Error loading git config:",R)}},[]);f.useEffect(()=>{y(),b()},[y,b]),f.useEffect(()=>{const R=x.current;x.current=p,R!=null&&p===null&&b()},[p,b]);const v=R=>{h(R)},k=R=>{R===0&&p&&g(p)},S=async()=>{if(d(""),t!==0){r(R=>R+1);return}if(!n.trim()||!i.trim()){d("Both git name and email are required.");return}if(!dy.test(i)){d("Please enter a valid email address.");return}c(!0);try{const R=await Ae("/api/user/git-config",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({gitName:n,gitEmail:i})});if(!R.ok){const T=await py(R,"Failed to save git configuration");throw new Error(T)}r(T=>T+1)}catch(R){d(R instanceof Error?R.message:"Failed to save git configuration")}finally{c(!1)}},E=()=>{d(""),r(R=>R-1)},w=async()=>{c(!0),d("");try{const R=await Ae("/api/user/complete-onboarding",{method:"POST"});if(!R.ok){const T=await py(R,"Failed to complete onboarding");throw new Error(T)}await e?.()}catch(R){d(R instanceof Error?R.message:"Failed to complete onboarding")}finally{c(!1)}},N=t===0?!!(n.trim()&&i.trim()&&dy.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(tM,{currentStep:t}),s.jsxs("div",{className:"rounded-lg border border-border bg-card p-8 shadow-lg",children:[t===0?s.jsx(eM,{gitName:n,gitEmail:i,isSubmitting:l,onGitNameChange:a,onGitEmailChange:o}):s.jsx(QD,{providerStatuses:m,onOpenProviderLogin:v}),u&&s.jsx("div",{className:"mt-6 rounded-lg border border-red-300 bg-red-100 p-4 dark:border-red-800 dark:bg-red-900/20",children:s.jsx("p",{className:"text-sm text-red-700 dark:text-red-400",children:u})}),s.jsxs("div",{className:"mt-8 flex items-center justify-between border-t border-border pt-6",children:[s.jsxs("button",{onClick:E,disabled:t===0||l,className:"flex items-center gap-2 px-4 py-2 text-sm font-medium text-muted-foreground transition-colors duration-200 hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50",children:[s.jsx(Gg,{className:"h-4 w-4"}),"Previous"]}),s.jsx("div",{className:"flex items-center gap-3",children:t<1?s.jsx("button",{onClick:S,disabled:!N||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(Ar,{className:"h-4 w-4 animate-spin"}),"Saving..."]}):s.jsxs(s.Fragment,{children:["Next",s.jsx(Or,{className:"h-4 w-4"})]})}):s.jsx("button",{onClick:w,disabled:l,className:"flex items-center gap-2 rounded-lg bg-green-600 px-6 py-3 font-medium text-white transition-colors duration-200 hover:bg-green-700 disabled:cursor-not-allowed disabled:bg-green-400",children:l?s.jsxs(s.Fragment,{children:[s.jsx(Ar,{className:"h-4 w-4 animate-spin"}),"Completing..."]}):s.jsxs(s.Fragment,{children:[s.jsx(Yt,{className:"h-4 w-4"}),"Complete Setup"]})})})]})]})]})}),p&&s.jsx(e5,{isOpen:!!p,onClose:()=>h(null),provider:p,onComplete:k})]})}const nM=["0s","0.1s","0.2s"];function aM(){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(Sn,{className:"h-8 w-8 text-primary-foreground"})})}),s.jsx("h1",{className:"mb-2 text-2xl font-bold text-foreground",children:"CloudCLI"}),s.jsx("div",{className:"flex items-center justify-center space-x-2",children:nM.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 t5({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 os({id:e,label:t,value:r,onChange:n,placeholder:a,isDisabled:i,type:o="text",name:l,autoComplete:c}){return s.jsxs("div",{children:[s.jsx("label",{htmlFor:e,className:"mb-1 block text-sm font-medium text-foreground",children:t}),s.jsx("input",{id:e,type:o,name:l??e,autoComplete:c,value:r,onChange:u=>n(u.target.value),className:"w-full rounded-md border border-border bg-background px-3 py-2 text-foreground focus:border-transparent focus:outline-none focus:ring-2 focus:ring-blue-500",placeholder:a,required:!0,disabled:i})]})}function r5({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(Sn,{className:"h-8 w-8 text-primary-foreground"})})}),s.jsx("h1",{className:"text-2xl font-bold text-foreground",children:e}),s.jsx("p",{className:"mt-2 text-muted-foreground",children:t})]}),r,s.jsx("div",{className:"text-center",children:s.jsx("p",{className:"text-sm text-muted-foreground",children:n})}),s.jsxs("div",{className:"flex items-center justify-center gap-1.5 pt-2",children:[s.jsx("svg",{className:"h-3.5 w-3.5 text-muted-foreground/50",fill:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:s.jsx("path",{d:"M12 2C6.477 2 2 6.484 2 12.017c0 4.425 2.865 8.18 6.839 9.504.5.092.682-.217.682-.483 0-.237-.008-.868-.013-1.703-2.782.605-3.369-1.343-3.369-1.343-.454-1.158-1.11-1.466-1.11-1.466-.908-.62.069-.608.069-.608 1.003.07 1.531 1.032 1.531 1.032.892 1.53 2.341 1.088 2.91.832.092-.647.35-1.088.636-1.338-2.22-.253-4.555-1.113-4.555-4.951 0-1.093.39-1.988 1.029-2.688-.103-.253-.446-1.272.098-2.65 0 0 .84-.27 2.75 1.026A9.564 9.564 0 0112 6.844c.85.004 1.705.115 2.504.337 1.909-1.296 2.747-1.027 2.747-1.027.546 1.379.202 2.398.1 2.651.64.7 1.028 1.595 1.028 2.688 0 3.848-2.339 4.695-4.566 4.943.359.309.678.92.678 1.855 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.019 10.019 0 0022 12.017C22 6.484 17.522 2 12 2z"})}),s.jsx("a",{href:"https://github.com/siteboon/claudecodeui",target:"_blank",rel:"noopener noreferrer",className:"text-xs text-muted-foreground/50 transition-colors hover:text-muted-foreground",children:"CloudCLI is open source"})]})]})})})}const iM={username:"",password:""};function sM(){const{t:e}=Le("auth"),{login:t}=Cs(),[r,n]=f.useState(iM),[a,i]=f.useState(""),[o,l]=f.useState(!1),c=f.useCallback((d,p)=>{n(h=>({...h,[d]:p}))},[]),u=f.useCallback(async d=>{if(d.preventDefault(),i(""),!r.username.trim()||!r.password){i(e("login.errors.requiredFields"));return}l(!0);const p=await t(r.username.trim(),r.password);p.success||i(p.error),l(!1)},[r.password,r.username,t,e]);return s.jsx(r5,{title:e("login.title"),description:e("login.description"),footerText:"Enter your credentials to access CloudCLI",children:s.jsxs("form",{onSubmit:u,className:"space-y-4",children:[s.jsx(os,{id:"username",label:e("login.username"),value:r.username,onChange:d=>c("username",d),placeholder:e("login.placeholders.username"),isDisabled:o,autoComplete:"username"}),s.jsx(os,{id:"password",label:e("login.password"),value:r.password,onChange:d=>c("password",d),placeholder:e("login.placeholders.password"),isDisabled:o,type:"password",autoComplete:"current-password"}),s.jsx(t5,{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 oM={username:"",password:"",confirmPassword:""};function lM(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 cM(){const{register:e}=Cs(),[t,r]=f.useState(oM),[n,a]=f.useState(""),[i,o]=f.useState(!1),l=f.useCallback((u,d)=>{r(p=>({...p,[u]:d}))},[]),c=f.useCallback(async u=>{u.preventDefault(),a("");const d=lM(t);if(d){a(d);return}o(!0);const p=await e(t.username.trim(),t.password);p.success||a(p.error),o(!1)},[t,e]);return s.jsx(r5,{title:"Welcome to CloudCLI",description:"Set up your account to get started",footerText:"This is a single-user system. Only one account can be created.",logo:s.jsx("img",{src:"/logo.svg",alt:"CloudCLI",className:"h-16 w-16"}),children:s.jsxs("form",{onSubmit:c,className:"space-y-4",children:[s.jsx(os,{id:"username",name:"username",label:"Username",value:t.username,onChange:u=>l("username",u),placeholder:"Enter your username",isDisabled:i,autoComplete:"username"}),s.jsx(os,{id:"password",name:"password",label:"Password",value:t.password,onChange:u=>l("password",u),placeholder:"Enter your password",isDisabled:i,type:"password",autoComplete:"new-password"}),s.jsx(os,{id:"confirmPassword",name:"confirmPassword",label:"Confirm Password",value:t.confirmPassword,onChange:u=>l("confirmPassword",u),placeholder:"Confirm your password",isDisabled:i,type:"password",autoComplete:"new-password"}),s.jsx(t5,{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 uM({children:e}){const{user:t,isLoading:r,needsSetup:n,hasCompletedOnboarding:a,refreshOnboardingStatus:i}=Cs();return r?s.jsx(aM,{}):n?s.jsx(cM,{}):t?a?s.jsx(s.Fragment,{children:e}):s.jsx(rM,{onComplete:i}):s.jsx(sM,{})}const n5=f.createContext(null),a5=()=>{const e=f.useContext(n5);if(!e)throw new Error("useWebSocket must be used within a WebSocketProvider");return e},dM=e=>{const t=window.location.protocol==="https:"?"wss:":"ws:";return e?`${t}//${window.location.host}/ws?token=${encodeURIComponent(e)}`:null},pM=()=>{const e=f.useRef(null),t=f.useRef(!1),r=f.useRef(!1),[n,a]=f.useState(null),[i,o]=f.useState(!1),l=f.useRef(null),{token:c}=Cs();f.useEffect(()=>(u(),()=>{t.current=!0,l.current&&clearTimeout(l.current),e.current&&e.current.close()}),[c]);const u=f.useCallback(()=>{if(!t.current)try{const h=dM(c);if(!h)return console.warn("No authentication token found for WebSocket connection");const m=new WebSocket(h);m.onopen=()=>{o(!0),e.current=m,r.current&&a({type:"websocket-reconnected",timestamp:Date.now()}),r.current=!0},m.onmessage=g=>{try{const b=JSON.parse(g.data);a(b)}catch(b){console.error("Error parsing WebSocket message:",b)}},m.onclose=()=>{o(!1),e.current=null,l.current=setTimeout(()=>{t.current||u()},3e3)},m.onerror=g=>{console.error("WebSocket error:",g)}}catch(h){console.error("Error creating WebSocket connection:",h)}},[c]),d=f.useCallback(h=>{const m=e.current;m&&m.readyState===WebSocket.OPEN?m.send(JSON.stringify(h)):console.warn("WebSocket not connected")},[]);return f.useMemo(()=>({ws:e.current,sendMessage:d,latestMessage:n,isConnected:i}),[d,n,i])},mM=({children:e})=>{const t=pM();return s.jsx(n5.Provider,{value:t,children:e})},i5=f.createContext(null);function hM(e,t){return{message:t instanceof Error?t.message:`Failed to ${e}`,context:e,timestamp:new Date().toISOString()}}function Ua(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 fM(e){return e.find(t=>t.status==="pending"||t.status==="in-progress")??null}function gM(e){return e?.type?e.type.startsWith("taskmaster-"):!1}function Si(){const e=f.useContext(i5);if(!e)throw new Error("useTaskMaster must be used within a TaskMasterProvider");return e}function bM({children:e}){const{latestMessage:t}=a5(),{user:r,token:n,isLoading:a}=Cs(),[i,o]=f.useState([]),[l,c]=f.useState(null),[u,d]=f.useState(null),[p,h]=f.useState(null),[m,g]=f.useState([]),[b,x]=f.useState(null),[y,v]=f.useState(!1),[k,S]=f.useState(!1),[E,w]=f.useState(!1),[N,R]=f.useState(null),T=f.useRef(null),j=f.useRef(null),D=f.useRef(0);f.useEffect(()=>{T.current=l?.projectId??null},[l?.projectId]),f.useEffect(()=>{j.current=u},[u]);const A=f.useCallback(()=>{R(null)},[]),F=f.useCallback((z,P)=>{console.error(`TaskMaster ${z} error:`,P),R(hM(z,P))},[]),C=f.useCallback((z,P)=>{d(P),o(O=>O.map(Z=>Z.projectId!==z?Z:Ua({...Z,taskmaster:P??void 0}))),c(O=>!O||O.projectId!==z?O:Ua({...O,taskmaster:P??void 0}))},[]),$=f.useCallback(async z=>{if(!z||!r||!n)return;const P=++D.current;try{const O=await tt.projectTaskmaster(z);if(!O.ok)throw new Error(`Failed to fetch TaskMaster details: ${O.status}`);const G=(await O.json()).taskmaster??null;if(P!==D.current||T.current!==z)return;C(z,G)}catch(O){if(P!==D.current||T.current!==z)return;F("load selected project TaskMaster info",O)}},[C,F,n,r]),Y=f.useCallback(z=>{const P=z?Ua(z):null;if(c(P),d(P?.taskmaster??null),g([]),x(null),!P?.projectId){D.current+=1;return}$(P.projectId)},[$]),V=f.useCallback(async()=>{if(!r||!n){o([]),c(null),d(null),g([]),x(null);return}try{v(!0),A();const z=await tt.get("/projects");if(!z.ok)throw new Error(`Failed to fetch projects: ${z.status}`);const P=await z.json(),Z=(Array.isArray(P)?P:[]).map(pe=>Ua(pe));o(pe=>{const me=new Map(pe.filter(ye=>!!ye.taskmaster).map(ye=>[ye.projectId,ye.taskmaster]));return Z.map(ye=>{const ve=me.get(ye.projectId);return ve?Ua({...ye,taskmaster:ve}):ye})});const G=T.current;if(!G)return;const ne=Z.find(pe=>pe.projectId===G)??null;if(!ne){D.current+=1,c(null),d(null),g([]),x(null);return}const re=ne.taskmaster??j.current??null;c(re?Ua({...ne,taskmaster:re}):ne),d(re),$(G)}catch(z){F("load projects",z)}finally{v(!1)}},[A,F,$,n,r]),K=f.useCallback(async()=>{const z=l?.projectId;if(!z||!r||!n){g([]),x(null);return}try{S(!0),A();const P=await tt.get(`/taskmaster/tasks/${encodeURIComponent(z)}`);if(!P.ok){const G=await P.json();throw new Error(G.message??"Failed to load tasks")}const O=await P.json(),Z=Array.isArray(O.tasks)?O.tasks:[];g(Z),x(fM(Z))}catch(P){F("load tasks",P),g([]),x(null)}finally{S(!1)}},[A,l?.projectId,F,n,r]),H=f.useCallback(async()=>{if(!r||!n){h(null);return}try{w(!0),A();const z=await tt.get("/mcp-utils/taskmaster-server");if(!z.ok)throw new Error(`Failed to load MCP status: ${z.status}`);const P=await z.json();h(P)}catch(z){F("check MCP server status",z),h(null)}finally{w(!1)}},[A,F,n,r]);f.useEffect(()=>{!a&&r&&n&&(V(),H())},[a,H,V,n,r]),f.useEffect(()=>{l?.projectId&&r&&n&&K()},[l?.projectId,K,n,r]),f.useEffect(()=>{const z=t;if(gM(z)){if(z.type==="taskmaster-project-updated"&&z.projectId){z.projectId===T.current&&$(z.projectId),V();return}if(z.type==="taskmaster-tasks-updated"&&z.projectId===l?.projectId){K();return}z.type==="taskmaster-mcp-status-changed"&&H()}},[l?.projectId,t,$,H,V,K]);const M=f.useMemo(()=>({projects:i,currentProject:l,projectTaskMaster:u,mcpServerStatus:p,tasks:m,nextTask:b,isLoading:y,isLoadingTasks:k,isLoadingMCP:E,error:N,refreshProjects:V,setCurrentProject:Y,refreshTasks:K,refreshMCPStatus:H,clearError:A}),[A,l,N,y,E,k,p,b,u,i,H,V,K,Y,m]);return s.jsx(i5.Provider,{value:M,children:e})}const s5=f.createContext({tasksEnabled:!0,setTasksEnabled:()=>{},toggleTasksEnabled:()=>{},isTaskMasterInstalled:null,isTaskMasterReady:null,installationStatus:null,isCheckingInstallation:!0}),Dl=()=>{const e=f.useContext(s5);if(!e)throw new Error("useTasksSettings must be used within a TasksSettingsProvider");return e},xM=({children:e})=>{const[t,r]=f.useState(()=>{const m=localStorage.getItem("tasks-enabled");return m!==null?JSON.parse(m):!0}),[n,a]=f.useState(null),[i,o]=f.useState(null),[l,c]=f.useState(null),[u,d]=f.useState(!0);f.useEffect(()=>{localStorage.setItem("tasks-enabled",JSON.stringify(t))},[t]),f.useEffect(()=>{setTimeout(async()=>{try{const g=await tt.get("/taskmaster/installation-status");if(g.ok){const b=await g.json();c(b),a(b.installation?.isInstalled||!1),o(b.isReady||!1);const x=localStorage.getItem("tasks-enabled");!b.installation?.isInstalled&&!x&&r(!1)}else console.error("Failed to check TaskMaster installation status"),a(!1),o(!1)}catch(g){console.error("Error checking TaskMaster installation:",g),a(!1),o(!1)}finally{d(!1)}},0)},[]);const h={tasksEnabled:t,setTasksEnabled:r,toggleTasksEnabled:()=>{r(m=>!m)},isTaskMasterInstalled:n,isTaskMasterReady:i,installationStatus:l,isCheckingInstallation:u};return s.jsx(s5.Provider,{value:h,children:e})},o5=f.createContext(null);function Ml(){const e=f.useContext(o5);if(!e)throw new Error("usePlugins must be used within a PluginsProvider");return e}function yM({children:e}){const[t,r]=f.useState([]),[n,a]=f.useState(!0),[i,o]=f.useState(null),l=f.useCallback(async()=>{try{const h=await Ae("/api/plugins");if(h.ok){const m=await h.json();r(m.plugins||[]),o(null)}else{let m=`Failed to fetch plugins (${h.status})`;try{const g=await h.json();m=g.details||g.error||m}catch{m=h.statusText||m}o(m)}}catch(h){const m=h instanceof Error?h.message:"Failed to fetch plugins";o(m),console.error("[Plugins] Failed to fetch plugins:",h)}finally{a(!1)}},[]);f.useEffect(()=>{l()},[l]);const c=f.useCallback(async h=>{try{const m=await Ae("/api/plugins/install",{method:"POST",body:JSON.stringify({url:h})}),g=await m.json();return m.ok?(await l(),{success:!0}):{success:!1,error:g.details||g.error||"Install failed"}}catch(m){return{success:!1,error:m instanceof Error?m.message:"Install failed"}}},[l]),u=f.useCallback(async h=>{try{const m=await Ae(`/api/plugins/${encodeURIComponent(h)}`,{method:"DELETE"}),g=await m.json();return m.ok?(await l(),{success:!0}):{success:!1,error:g.details||g.error||"Uninstall failed"}}catch(m){return{success:!1,error:m instanceof Error?m.message:"Uninstall failed"}}},[l]),d=f.useCallback(async h=>{try{const m=await Ae(`/api/plugins/${encodeURIComponent(h)}/update`,{method:"POST"}),g=await m.json();return m.ok?(await l(),{success:!0}):{success:!1,error:g.details||g.error||"Update failed"}}catch(m){return{success:!1,error:m instanceof Error?m.message:"Update failed"}}},[l]),p=f.useCallback(async(h,m)=>{try{const g=await Ae(`/api/plugins/${encodeURIComponent(h)}/enable`,{method:"PUT",body:JSON.stringify({enabled:m})});if(!g.ok){let b=`Toggle failed (${g.status})`;try{const x=await g.json();b=x.details||x.error||b}catch{b=g.statusText||b}return{success:!1,error:b}}return await l(),{success:!0,error:null}}catch(g){return{success:!1,error:g instanceof Error?g.message:"Toggle failed"}}},[l]);return s.jsx(o5.Provider,{value:{plugins:t,loading:n,pluginsError:i,refreshPlugins:l,installPlugin:c,uninstallPlugin:u,updatePlugin:d,togglePlugin:p},children:e})}const my=e=>typeof window>"u"?!1:window.innerWidth<e,hy=()=>{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 Jg(e={}){const{mobileBreakpoint:t=768,trackMobile:r=!0,trackPWA:n=!0}=e,[a,i]=f.useState(()=>r?my(t):!1),[o,l]=f.useState(()=>n?hy():!1);return f.useEffect(()=>{if(!r||typeof window>"u")return;const c=()=>{i(my(t))};return c(),window.addEventListener("resize",c),()=>{window.removeEventListener("resize",c)}},[t,r]),f.useEffect(()=>{if(!n||typeof window>"u")return;const c=window.matchMedia("(display-mode: standalone)"),u=()=>{l(hy())};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 fy="1.31.4",vM=(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},l5=(e,t)=>{const[r,n]=f.useState(!1),[a,i]=f.useState(null),[o,l]=f.useState(null),[c,u]=f.useState("git");return f.useEffect(()=>{(async()=>{try{const h=await(await fetch("/health")).json();(h.installMode==="npm"||h.installMode==="git")&&u(h.installMode)}catch{}})()},[]),f.useEffect(()=>{const d=async()=>{try{const m=await(await fetch(`https://api.github.com/repos/${e}/${t}/releases/latest`)).json();if(m.tag_name){const g=m.tag_name.replace(/^v/,"");i(g),n(vM(g,fy)>0),l({title:m.name||m.tag_name,body:m.body||"",htmlUrl:m.html_url||`https://github.com/${e}/${t}/releases/latest`,publishedAt:m.published_at})}else n(!1),i(null),l(null)}catch(h){console.error("Version check failed:",h),n(!1),i(null),l(null)}};d();const p=setInterval(d,300*1e3);return()=>clearInterval(p)},[e,t]),{updateAvailable:r,latestVersion:a,currentVersion:fy,releaseInfo:o,installMode:c}},ha={autoExpandTools:!1,showRawParameters:!1,showThinking:!0,autoScrollToBottom:!0,sendByCtrlEnter:!1,sidebarVisible:!0},el=Object.keys(ha),kM=new Set(el),yc="ui-preferences:sync",tl=(e,t)=>{if(typeof e=="boolean")return e;if(typeof e=="string"){if(e==="true")return!0;if(e==="false")return!1}return t},wM=(e,t)=>{try{const r=localStorage.getItem(e);if(r===null)return t;const n=JSON.parse(r);return tl(n,t)}catch{return t}},SM=e=>{if(typeof window>"u")return ha;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 el.reduce((a,i)=>(a[i]=tl(n[i],ha[i]),a),{...ha})}}}catch{}return el.reduce((t,r)=>(t[r]=wM(r,ha[r]),t),{...ha})};function EM(e,t){switch(t.type){case"set":{const{key:r,value:n}=t;if(!kM.has(r))return e;const a=tl(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 el){if(!(i in r))continue;const o=r[i],l=tl(o,e[i]);a[i]!==l&&(a[i]=l,n=!0)}return n?a:e}case"reset":return{...ha,...t.value||{}};default:return e}}function Qg(e="uiPreferences"){const t=f.useRef(`ui-preferences-${Math.random().toString(36).slice(2)}`),[r,n]=f.useReducer(EM,e,SM);return f.useEffect(()=>{typeof window>"u"||(localStorage.setItem(e,JSON.stringify(r)),window.dispatchEvent(new CustomEvent(yc,{detail:{storageKey:e,sourceId:t.current,value:r}})))},[r,e]),f.useEffect(()=>{if(typeof window>"u")return;const l=d=>{!d||typeof d!="object"||Array.isArray(d)||n({type:"set_many",value:d})},c=d=>{if(!(d.key!==e||d.newValue===null))try{const p=JSON.parse(d.newValue);l(p)}catch{}},u=d=>{const h=d.detail;!h||h.storageKey!==e||h.sourceId===t.current||l(h.value)};return window.addEventListener("storage",c),window.addEventListener(yc,u),()=>{window.removeEventListener("storage",c),window.removeEventListener(yc,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 eb=f.createContext(null),vc={openFile:()=>{},openSettings:()=>{},refreshProjects:()=>{}};function CM({children:e}){const t=f.useRef({});return s.jsx(eb.Provider,{value:t,children:e})}function Ts(){const e=f.useContext(eb);return f.useMemo(()=>({openFile:t=>(e?.current.openFile??vc.openFile)(t),openSettings:t=>(e?.current.openSettings??vc.openSettings)(t),refreshProjects:()=>(e?.current.refreshProjects??vc.refreshProjects)()}),[e])}function c5(e){const t=f.useContext(eb),{openFile:r,openSettings:n,refreshProjects:a}=e;f.useEffect(()=>{if(!t)return;const i={...t.current};return r&&(t.current.openFile=r),n&&(t.current.openSettings=n),a&&(t.current.refreshProjects=a),()=>{r&&t.current.openFile===r&&(t.current.openFile=i.openFile),n&&t.current.openSettings===n&&(t.current.openSettings=i.openSettings),a&&t.current.refreshProjects===a&&(t.current.refreshProjects=i.refreshProjects)}},[t,r,n,a])}const NM=()=>{try{const e=localStorage.getItem("claude-settings");return e&&JSON.parse(e).projectSortOrder==="date"?"date":"name"}catch{return"name"}},u5="starredProjects",TM=()=>{try{const e=localStorage.getItem(u5);if(!e)return[];const t=JSON.parse(e);return Array.isArray(t)?t.map(r=>String(r).trim()).filter(r=>r.length>0):[]}catch{return[]}},AM=()=>{try{localStorage.removeItem(u5)}catch{}},rl=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),IM=(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"),jM=e=>e.__provider==="cursor"?String(e.createdAt||""):e.__provider==="codex"?String(e.createdAt||e.lastActivity||""):String(e.lastActivity||e.createdAt||""),RM=(e,t,r)=>{const n=rl(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:IM(e,r),sessionTime:jM(e),messageCount:Number(e.messageCount||0)}},d5=e=>{const t=[...e.sessions||[]].map(i=>({...i,__provider:"claude"})),r=(e.cursorSessions||[]).map(i=>({...i,__provider:"cursor"})),n=(e.codexSessions||[]).map(i=>({...i,__provider:"codex"})),a=(e.geminiSessions||[]).map(i=>({...i,__provider:"gemini"}));return[...t,...r,...n,...a].sort((i,o)=>rl(o).getTime()-rl(i).getTime())},gy=e=>{const t=d5(e);return t.length===0?new Date(0):t.reduce((r,n)=>{const a=rl(n);return a>r?a:r},new Date(0))},_M=(e,t)=>{const r=[...e];return r.sort((n,a)=>{const i=!!n.isStarred,o=!!a.isStarred;return i&&!o?-1:!i&&o?1:t==="date"?gy(a).getTime()-gy(n).getTime():(n.displayName||n.projectId).localeCompare(a.displayName||a.projectId)}),r},DM=(e,t)=>{const r=t.trim().toLowerCase();return r?e.filter(n=>{const a=(n.displayName||n.projectId).toLowerCase(),i=(n.path||n.fullPath||"").toLowerCase();return a.includes(r)||i.includes(r)}):e},MM=(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"},OM=e=>{const t=typeof e.fullPath=="string"&&e.fullPath.length>0?e.fullPath:typeof e.path=="string"?e.path:"";return{name:e.projectId,displayName:typeof e.displayName=="string"&&e.displayName.trim().length>0?e.displayName:e.projectId,fullPath:t,path:typeof e.path=="string"&&e.path.length>0?e.path:t}};function LM({projects:e,selectedProject:t,selectedSession:r,isLoading:n,isMobile:a,t:i,onRefresh:o,onProjectSelect:l,onSessionSelect:c,onSessionDelete:u,onLoadMoreSessions:d,onProjectDelete:p,setCurrentProject:h,setSidebarVisible:m,sidebarVisible:g}){const b=Ts(),[x,y]=f.useState(new Set),[v,k]=f.useState(null),[S,E]=f.useState(!1),[w,N]=f.useState(""),[R,T]=f.useState(new Set),[j,D]=f.useState(new Date),[A,F]=f.useState("name"),[C,$]=f.useState(!1),[Y,V]=f.useState(null),[K,H]=f.useState(""),[M,z]=f.useState(""),[P,O]=f.useState(new Set),[Z,G]=f.useState(null),[ne,re]=f.useState(null),[pe,me]=f.useState(!1),[ye,ve]=f.useState("projects"),[Te,Ie]=f.useState(null),[L,ce]=f.useState(!1),[le,W]=f.useState(null),[q,ae]=f.useState(""),[he,ue]=f.useState(new Map),[se,we]=f.useState(new Set),ee=f.useRef(0),J=f.useRef(null),X=f.useRef(new Map),oe=f.useRef(!1),fe=f.useRef(o),De=!a&&!g;f.useEffect(()=>{const ge=setInterval(()=>{D(new Date)},6e4);return()=>clearInterval(ge)},[]),f.useEffect(()=>{T(new Set)},[e]),f.useEffect(()=>{const ge=t?.projectId;ge&&y(xe=>{if(xe.has(ge))return xe;const _e=new Set(xe);return _e.add(ge),_e})},[t?.projectId]),f.useEffect(()=>{if(e.length>0&&!n){const ge=new Set;e.forEach(xe=>{xe.sessions&&xe.sessions.length>=0&&ge.add(xe.projectId)}),T(ge)}},[e,n]),f.useEffect(()=>{const ge=()=>{F(NM())};ge();const xe=Ge=>{Ge.key==="claude-settings"&&ge()};window.addEventListener("storage",xe);const _e=setInterval(()=>{document.hasFocus()&&ge()},1e3);return()=>{window.removeEventListener("storage",xe),clearInterval(_e)}},[]),f.useEffect(()=>{fe.current=o},[o]),f.useEffect(()=>{if(oe.current)return;const ge=TM();if(ge.length===0)return;oe.current=!0,(async()=>{try{await tt.migrateLegacyProjectStars(ge),await fe.current()}catch(_e){console.error("[Sidebar] Failed to migrate legacy starred projects:",_e)}finally{AM()}})()},[o]),f.useEffect(()=>{ue(ge=>{if(ge.size===0)return ge;const xe=new Map(ge);let _e=!1;for(const[Ge,pt]of ge.entries()){const Ye=e.find(Ot=>Ot.projectId===Ge);if(!Ye){xe.delete(Ge),_e=!0;continue}!!Ye.isStarred===pt&&(xe.delete(Ge),_e=!0)}return _e?xe:ge})},[e]),f.useEffect(()=>{const ge=setTimeout(()=>{ae(M.trim())},300);return()=>{clearTimeout(ge)}},[M]),f.useEffect(()=>{J.current&&(J.current.close(),J.current=null);const ge=q;if(ye!=="conversations"||ge.length<2){ee.current+=1,Ie(null),W(null),ce(!1);return}ce(!0);const xe=++ee.current;if(xe!==ee.current)return;const _e=tt.searchConversationsUrl(ge),Ge=new EventSource(_e);J.current=Ge;const pt=[];let Ye=0;return Ge.addEventListener("result",Ot=>{if(xe!==ee.current){Ge.close();return}try{const Ut=JSON.parse(Ot.data);pt.push(Ut.projectResult),Ye=Ut.totalMatches,Ie({results:[...pt],totalMatches:Ye,query:ge}),W({scannedProjects:Ut.scannedProjects,totalProjects:Ut.totalProjects})}catch{}}),Ge.addEventListener("progress",Ot=>{if(xe!==ee.current){Ge.close();return}try{const Ut=JSON.parse(Ot.data);Ye=Ut.totalMatches,W({scannedProjects:Ut.scannedProjects,totalProjects:Ut.totalProjects})}catch{}}),Ge.addEventListener("done",()=>{if(xe!==ee.current){Ge.close();return}Ge.close(),J.current=null,ce(!1),W(null),pt.length===0&&Ie({results:[],totalMatches:0,query:ge})}),Ge.addEventListener("error",()=>{if(xe!==ee.current){Ge.close();return}Ge.close(),J.current=null,ce(!1),W(null),pt.length===0&&Ie({results:[],totalMatches:0,query:ge})}),()=>{J.current&&(J.current.close(),J.current=null)}},[q,ye]);const $e=f.useCallback(ge=>{y(xe=>{const _e=new Set;return xe.has(ge)||_e.add(ge),_e})},[]),nt=f.useCallback((ge,xe)=>{c({...ge,__projectId:xe})},[c]),Ze=f.useCallback(ge=>he.has(ge)?!!he.get(ge):e.some(xe=>xe.projectId===ge&&!!xe.isStarred),[he,e]),qe=f.useCallback(ge=>{const xe=Ze(ge),_e=!xe,Ge=(X.current.get(ge)??0)+1;X.current.set(ge,Ge),ue(Ye=>{const Ot=new Map(Ye);return Ot.set(ge,_e),Ot}),(async()=>{try{const Ye=await tt.toggleProjectStar(ge);if(!Ye.ok){const Wt=(await Ye.json()).error,jr=typeof Wt=="string"?Wt:Wt&&typeof Wt=="object"&&Wt.message?Wt.message:i("messages.updateProjectError");throw new Error(jr)}const Ot=await Ye.json();if(!(X.current.get(ge)===Ge))return;ue(zr=>{const Wt=new Map(zr);return Wt.set(ge,!!Ot.isStarred),Wt})}catch(Ye){if(!(X.current.get(ge)===Ge))return;ue(Ut=>{const zr=new Map(Ut);return zr.set(ge,xe),zr}),console.error("[Sidebar] Failed to toggle project star:",Ye),alert(i("messages.updateProjectError"))}})()},[Ze,i]),lt=f.useCallback(ge=>Ze(ge),[Ze]),ut=f.useCallback(ge=>d5(ge),[]),et=f.useCallback(async ge=>{if(!d)return;let xe=!1;if(we(_e=>{if(_e.has(ge))return _e;xe=!0;const Ge=new Set(_e);return Ge.add(ge),Ge}),!!xe)try{await d(ge)}catch(_e){console.error("[Sidebar] Failed to load more sessions:",_e),alert(i("messages.refreshError"))}finally{we(_e=>{const Ge=new Set(_e);return Ge.delete(ge),Ge})}},[d,i]),yt=f.useMemo(()=>he.size===0?e:e.map(ge=>{const xe=he.get(ge.projectId);return xe===void 0||!!ge.isStarred===xe?ge:{...ge,isStarred:xe}}),[he,e]),mt=f.useMemo(()=>_M(yt,A),[A,yt]),bt=f.useMemo(()=>DM(mt,q),[q,mt]),xt=f.useCallback(ge=>{k(ge.projectId),N(ge.displayName)},[]),Re=f.useCallback(()=>{k(null),N("")},[]),Ke=f.useCallback(async ge=>{try{(await tt.renameProject(ge,w)).ok?await b.refreshProjects():console.error("Failed to rename project")}catch(xe){console.error("Error renaming project:",xe)}finally{k(null),N("")}},[w,b]),We=f.useCallback((ge,xe,_e,Ge="claude")=>{re({projectId:ge,sessionId:xe,sessionTitle:_e,provider:Ge})},[]),dt=f.useCallback(async()=>{if(!ne)return;const{sessionId:ge}=ne;re(null);try{const xe=await tt.deleteSession(ge);if(xe.ok)u?.(ge);else{const _e=await xe.text();console.error("[Sidebar] Failed to delete session:",{status:xe.status,error:_e}),alert(i("messages.deleteSessionFailed"))}}catch(xe){console.error("[Sidebar] Error deleting session:",xe),alert(i("messages.deleteSessionError"))}},[u,ne,i]),vt=f.useCallback(ge=>{G({project:ge,sessionCount:ut(ge).length})},[ut]),rt=f.useCallback(async(ge=!1)=>{if(!Z)return;const{project:xe}=Z;G(null),O(_e=>new Set([..._e,xe.projectId]));try{const _e=await tt.deleteProject(xe.projectId,ge);if(_e.ok)p?.(xe.projectId);else{const pt=(await _e.json()).error,Ye=typeof pt=="string"?pt:pt&&typeof pt=="object"&&pt.message?pt.message:i("messages.deleteProjectFailed");alert(Ye)}}catch(_e){console.error("Error deleting project:",_e),alert(i("messages.deleteProjectError"))}finally{O(_e=>{const Ge=new Set(_e);return Ge.delete(xe.projectId),Ge})}},[Z,p,i]),Xt=f.useCallback(ge=>{l(ge),h(ge)},[l,h]),lr=f.useCallback(async()=>{$(!0);try{await o()}finally{$(!1)}},[o]),cr=f.useCallback(async(ge,xe,_e,Ge)=>{const pt=_e.trim();if(!pt){V(null),H("");return}try{const Ye=await tt.renameSession(xe,pt);Ye.ok?await o():(console.error("[Sidebar] Failed to rename session:",Ye.status),alert(i("messages.renameSessionFailed")))}catch(Ye){console.error("[Sidebar] Error renaming session:",Ye),alert(i("messages.renameSessionError"))}finally{V(null),H("")}},[o,i]),yr=f.useCallback(()=>{m(!1)},[m]),Oe=f.useCallback(()=>{m(!0)},[m]);return{isSidebarCollapsed:De,expandedProjects:x,editingProject:v,showNewProject:S,editingName:w,initialSessionsLoaded:R,currentTime:j,projectSortOrder:A,isRefreshing:C,editingSession:Y,editingSessionName:K,searchFilter:M,deletingProjects:P,loadingMoreProjects:se,deleteConfirmation:Z,sessionDeleteConfirmation:ne,showVersionModal:pe,filteredProjects:bt,toggleProject:$e,handleSessionClick:nt,toggleStarProject:qe,isProjectStarred:lt,getProjectSessions:ut,loadMoreSessionsForProject:et,startEditing:xt,cancelEditing:Re,saveProjectName:Ke,showDeleteSessionConfirmation:We,confirmDeleteSession:dt,requestProjectDelete:vt,confirmDeleteProject:rt,handleProjectSelect:Xt,refreshProjects:lr,updateSessionSummary:cr,collapseSidebar:yr,expandSidebar:Oe,setShowNewProject:E,setEditingName:N,setEditingSession:V,setEditingSessionName:H,searchMode:ye,setSearchMode:ve,conversationResults:Te,isSearching:L,searchProgress:le,clearConversationResults:f.useCallback(()=>{ee.current+=1,J.current&&(J.current.close(),J.current=null),ce(!1),W(null),Ie(null)},[]),setSearchFilter:z,setDeleteConfirmation:G,setSessionDeleteConfirmation:re,setShowVersionModal:me}}const PM="https://discord.gg/buxwujPNRE",FM="https://github.com/siteboon/claudecodeui/issues/new";function zM({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 BM({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(a8,{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(kt,{className:"h-4 w-4 text-muted-foreground transition-colors group-hover:text-foreground"})}),s.jsx("a",{href:FM,target:"_blank",rel:"noopener noreferrer",className:"group flex h-8 w-8 items-center justify-center rounded-lg transition-colors hover:bg-accent/80","aria-label":a("actions.reportIssue"),title:a("actions.reportIssue"),children:s.jsx(A0,{className:"h-4 w-4 text-muted-foreground transition-colors group-hover:text-foreground"})}),s.jsx("a",{href:PM,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(zM,{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(ka,{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 p5(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=p5(e[t]))&&(n&&(n+=" "),n+=r)}else for(r in e)e[r]&&(n&&(n+=" "),n+=r);return n}function m5(){for(var e,t,r=0,n="",a=arguments.length;r<a;r++)(e=arguments[r])&&(t=p5(e))&&(n&&(n+=" "),n+=t);return n}const by=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,xy=m5,tb=(e,t)=>r=>{var n;if(t?.variants==null)return xy(e,r?.class,r?.className);const{variants:a,defaultVariants:i}=t,o=Object.keys(a).map(u=>{const d=r?.[u],p=i?.[u];if(d===null)return null;const h=by(d)||by(p);return a[u][h]}),l=r&&Object.entries(r).reduce((u,d)=>{let[p,h]=d;return h===void 0||(u[p]=h),u},{}),c=t==null||(n=t.compoundVariants)===null||n===void 0?void 0:n.reduce((u,d)=>{let{class:p,className:h,...m}=d;return Object.entries(m).every(g=>{let[b,x]=g;return Array.isArray(x)?x.includes({...i,...l}[b]):{...i,...l}[b]===x})?[...u,p,h]:u},[]);return xy(e,o,c,r?.class,r?.className)},rb="-",$M=e=>{const t=GM(e),{conflictingClassGroups:r,conflictingClassGroupModifiers:n}=e;return{getClassGroupId:o=>{const l=o.split(rb);return l[0]===""&&l.length!==1&&l.shift(),h5(l,t)||UM(o)},getConflictingClassGroupIds:(o,l)=>{const c=r[o]||[];return l&&n[o]?[...c,...n[o]]:c}}},h5=(e,t)=>{if(e.length===0)return t.classGroupId;const r=e[0],n=t.nextPart.get(r),a=n?h5(e.slice(1),n):void 0;if(a)return a;if(t.validators.length===0)return;const i=e.join(rb);return t.validators.find(({validator:o})=>o(i))?.classGroupId},yy=/^\[(.+)\]$/,UM=e=>{if(yy.test(e)){const t=yy.exec(e)[1],r=t?.substring(0,t.indexOf(":"));if(r)return"arbitrary.."+r}},GM=e=>{const{theme:t,classGroups:r}=e,n={nextPart:new Map,validators:[]};for(const a in r)M0(r[a],n,a,t);return n},M0=(e,t,r,n)=>{e.forEach(a=>{if(typeof a=="string"){const i=a===""?t:vy(t,a);i.classGroupId=r;return}if(typeof a=="function"){if(qM(a)){M0(a(n),t,r,n);return}t.validators.push({validator:a,classGroupId:r});return}Object.entries(a).forEach(([i,o])=>{M0(o,vy(t,i),r,n)})})},vy=(e,t)=>{let r=e;return t.split(rb).forEach(n=>{r.nextPart.has(n)||r.nextPart.set(n,{nextPart:new Map,validators:[]}),r=r.nextPart.get(n)}),r},qM=e=>e.isThemeGetter,HM=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)}}},O0="!",L0=":",VM=L0.length,WM=e=>{const{prefix:t,experimentalParseClassName:r}=e;let n=a=>{const i=[];let o=0,l=0,c=0,u;for(let g=0;g<a.length;g++){let b=a[g];if(o===0&&l===0){if(b===L0){i.push(a.slice(c,g)),c=g+VM;continue}if(b==="/"){u=g;continue}}b==="["?o++:b==="]"?o--:b==="("?l++:b===")"&&l--}const d=i.length===0?a:a.substring(c),p=KM(d),h=p!==d,m=u&&u>c?u-c:void 0;return{modifiers:i,hasImportantModifier:h,baseClassName:p,maybePostfixModifierPosition:m}};if(t){const a=t+L0,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},KM=e=>e.endsWith(O0)?e.substring(0,e.length-1):e.startsWith(O0)?e.substring(1):e,YM=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}},ZM=e=>({cache:HM(e.cacheSize),parseClassName:WM(e),sortModifiers:YM(e),...$M(e)}),XM=/\s+/,JM=(e,t)=>{const{parseClassName:r,getClassGroupId:n,getConflictingClassGroupIds:a,sortModifiers:i}=t,o=[],l=e.trim().split(XM);let c="";for(let u=l.length-1;u>=0;u-=1){const d=l[u],{isExternal:p,modifiers:h,hasImportantModifier:m,baseClassName:g,maybePostfixModifierPosition:b}=r(d);if(p){c=d+(c.length>0?" "+c:c);continue}let x=!!b,y=n(x?g.substring(0,b):g);if(!y){if(!x){c=d+(c.length>0?" "+c:c);continue}if(y=n(g),!y){c=d+(c.length>0?" "+c:c);continue}x=!1}const v=i(h).join(":"),k=m?v+O0:v,S=k+y;if(o.includes(S))continue;o.push(S);const E=a(y,x);for(let w=0;w<E.length;++w){const N=E[w];o.push(k+N)}c=d+(c.length>0?" "+c:c)}return c};function QM(){let e=0,t,r,n="";for(;e<arguments.length;)(t=arguments[e++])&&(r=f5(t))&&(n&&(n+=" "),n+=r);return n}const f5=e=>{if(typeof e=="string")return e;let t,r="";for(let n=0;n<e.length;n++)e[n]&&(t=f5(e[n]))&&(r&&(r+=" "),r+=t);return r};function eO(e,...t){let r,n,a,i=o;function o(c){const u=t.reduce((d,p)=>p(d),e());return r=ZM(u),n=r.cache.get,a=r.cache.set,i=l,l(c)}function l(c){const u=n(c);if(u)return u;const d=JM(c,r);return a(c,d),d}return function(){return i(QM.apply(null,arguments))}}const zt=e=>{const t=r=>r[e]||[];return t.isThemeGetter=!0,t},g5=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,b5=/^\((?:(\w[\w-]*):)?(.+)\)$/i,tO=/^\d+\/\d+$/,rO=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,nO=/\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$/,aO=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,iO=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,sO=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Ga=e=>tO.test(e),st=e=>!!e&&!Number.isNaN(Number(e)),Dn=e=>!!e&&Number.isInteger(Number(e)),kc=e=>e.endsWith("%")&&st(e.slice(0,-1)),pn=e=>rO.test(e),oO=()=>!0,lO=e=>nO.test(e)&&!aO.test(e),x5=()=>!1,cO=e=>iO.test(e),uO=e=>sO.test(e),dO=e=>!ze(e)&&!Be(e),pO=e=>Ei(e,k5,x5),ze=e=>g5.test(e),ca=e=>Ei(e,w5,lO),wc=e=>Ei(e,bO,st),ky=e=>Ei(e,y5,x5),mO=e=>Ei(e,v5,uO),$s=e=>Ei(e,S5,cO),Be=e=>b5.test(e),zi=e=>Ci(e,w5),hO=e=>Ci(e,xO),wy=e=>Ci(e,y5),fO=e=>Ci(e,k5),gO=e=>Ci(e,v5),Us=e=>Ci(e,S5,!0),Ei=(e,t,r)=>{const n=g5.exec(e);return n?n[1]?t(n[1]):r(n[2]):!1},Ci=(e,t,r=!1)=>{const n=b5.exec(e);return n?n[1]?t(n[1]):r:!1},y5=e=>e==="position"||e==="percentage",v5=e=>e==="image"||e==="url",k5=e=>e==="length"||e==="size"||e==="bg-size",w5=e=>e==="length",bO=e=>e==="number",xO=e=>e==="family-name",S5=e=>e==="shadow",yO=()=>{const e=zt("color"),t=zt("font"),r=zt("text"),n=zt("font-weight"),a=zt("tracking"),i=zt("leading"),o=zt("breakpoint"),l=zt("container"),c=zt("spacing"),u=zt("radius"),d=zt("shadow"),p=zt("inset-shadow"),h=zt("text-shadow"),m=zt("drop-shadow"),g=zt("blur"),b=zt("perspective"),x=zt("aspect"),y=zt("ease"),v=zt("animate"),k=()=>["auto","avoid","all","avoid-page","page","left","right","column"],S=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],E=()=>[...S(),Be,ze],w=()=>["auto","hidden","clip","visible","scroll"],N=()=>["auto","contain","none"],R=()=>[Be,ze,c],T=()=>[Ga,"full","auto",...R()],j=()=>[Dn,"none","subgrid",Be,ze],D=()=>["auto",{span:["full",Dn,Be,ze]},Dn,Be,ze],A=()=>[Dn,"auto",Be,ze],F=()=>["auto","min","max","fr",Be,ze],C=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],$=()=>["start","end","center","stretch","center-safe","end-safe"],Y=()=>["auto",...R()],V=()=>[Ga,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...R()],K=()=>[e,Be,ze],H=()=>[...S(),wy,ky,{position:[Be,ze]}],M=()=>["no-repeat",{repeat:["","x","y","space","round"]}],z=()=>["auto","cover","contain",fO,pO,{size:[Be,ze]}],P=()=>[kc,zi,ca],O=()=>["","none","full",u,Be,ze],Z=()=>["",st,zi,ca],G=()=>["solid","dashed","dotted","double"],ne=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],re=()=>[st,kc,wy,ky],pe=()=>["","none",g,Be,ze],me=()=>["none",st,Be,ze],ye=()=>["none",st,Be,ze],ve=()=>[st,Be,ze],Te=()=>[Ga,"full",...R()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[pn],breakpoint:[pn],color:[oO],container:[pn],"drop-shadow":[pn],ease:["in","out","in-out"],font:[dO],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[pn],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[pn],shadow:[pn],spacing:["px",st],text:[pn],"text-shadow":[pn],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",Ga,ze,Be,x]}],container:["container"],columns:[{columns:[st,ze,Be,l]}],"break-after":[{"break-after":k()}],"break-before":[{"break-before":k()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:E()}],overflow:[{overflow:w()}],"overflow-x":[{"overflow-x":w()}],"overflow-y":[{"overflow-y":w()}],overscroll:[{overscroll:N()}],"overscroll-x":[{"overscroll-x":N()}],"overscroll-y":[{"overscroll-y":N()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:T()}],"inset-x":[{"inset-x":T()}],"inset-y":[{"inset-y":T()}],start:[{start:T()}],end:[{end:T()}],top:[{top:T()}],right:[{right:T()}],bottom:[{bottom:T()}],left:[{left:T()}],visibility:["visible","invisible","collapse"],z:[{z:[Dn,"auto",Be,ze]}],basis:[{basis:[Ga,"full","auto",l,...R()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[st,Ga,"auto","initial","none",ze]}],grow:[{grow:["",st,Be,ze]}],shrink:[{shrink:["",st,Be,ze]}],order:[{order:[Dn,"first","last","none",Be,ze]}],"grid-cols":[{"grid-cols":j()}],"col-start-end":[{col:D()}],"col-start":[{"col-start":A()}],"col-end":[{"col-end":A()}],"grid-rows":[{"grid-rows":j()}],"row-start-end":[{row:D()}],"row-start":[{"row-start":A()}],"row-end":[{"row-end":A()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":F()}],"auto-rows":[{"auto-rows":F()}],gap:[{gap:R()}],"gap-x":[{"gap-x":R()}],"gap-y":[{"gap-y":R()}],"justify-content":[{justify:[...C(),"normal"]}],"justify-items":[{"justify-items":[...$(),"normal"]}],"justify-self":[{"justify-self":["auto",...$()]}],"align-content":[{content:["normal",...C()]}],"align-items":[{items:[...$(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...$(),{baseline:["","last"]}]}],"place-content":[{"place-content":C()}],"place-items":[{"place-items":[...$(),"baseline"]}],"place-self":[{"place-self":["auto",...$()]}],p:[{p:R()}],px:[{px:R()}],py:[{py:R()}],ps:[{ps:R()}],pe:[{pe:R()}],pt:[{pt:R()}],pr:[{pr:R()}],pb:[{pb:R()}],pl:[{pl:R()}],m:[{m: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":R()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":R()}],"space-y-reverse":["space-y-reverse"],size:[{size:V()}],w:[{w:[l,"screen",...V()]}],"min-w":[{"min-w":[l,"screen","none",...V()]}],"max-w":[{"max-w":[l,"screen","none","prose",{screen:[o]},...V()]}],h:[{h:["screen","lh",...V()]}],"min-h":[{"min-h":["screen","lh","none",...V()]}],"max-h":[{"max-h":["screen","lh",...V()]}],"font-size":[{text:["base",r,zi,ca]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[n,Be,wc]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",kc,ze]}],"font-family":[{font:[hO,ze,t]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[a,Be,ze]}],"line-clamp":[{"line-clamp":[st,"none",Be,wc]}],leading:[{leading:[i,...R()]}],"list-image":[{"list-image":["none",Be,ze]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",Be,ze]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:K()}],"text-color":[{text:K()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...G(),"wavy"]}],"text-decoration-thickness":[{decoration:[st,"from-font","auto",Be,ca]}],"text-decoration-color":[{decoration:K()}],"underline-offset":[{"underline-offset":[st,"auto",Be,ze]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:R()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",Be,ze]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",Be,ze]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:H()}],"bg-repeat":[{bg:M()}],"bg-size":[{bg:z()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},Dn,Be,ze],radial:["",Be,ze],conic:[Dn,Be,ze]},gO,mO]}],"bg-color":[{bg:K()}],"gradient-from-pos":[{from:P()}],"gradient-via-pos":[{via:P()}],"gradient-to-pos":[{to:P()}],"gradient-from":[{from:K()}],"gradient-via":[{via:K()}],"gradient-to":[{to:K()}],rounded:[{rounded:O()}],"rounded-s":[{"rounded-s":O()}],"rounded-e":[{"rounded-e":O()}],"rounded-t":[{"rounded-t":O()}],"rounded-r":[{"rounded-r":O()}],"rounded-b":[{"rounded-b":O()}],"rounded-l":[{"rounded-l":O()}],"rounded-ss":[{"rounded-ss":O()}],"rounded-se":[{"rounded-se":O()}],"rounded-ee":[{"rounded-ee":O()}],"rounded-es":[{"rounded-es":O()}],"rounded-tl":[{"rounded-tl":O()}],"rounded-tr":[{"rounded-tr":O()}],"rounded-br":[{"rounded-br":O()}],"rounded-bl":[{"rounded-bl":O()}],"border-w":[{border:Z()}],"border-w-x":[{"border-x":Z()}],"border-w-y":[{"border-y":Z()}],"border-w-s":[{"border-s":Z()}],"border-w-e":[{"border-e":Z()}],"border-w-t":[{"border-t":Z()}],"border-w-r":[{"border-r":Z()}],"border-w-b":[{"border-b":Z()}],"border-w-l":[{"border-l":Z()}],"divide-x":[{"divide-x":Z()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":Z()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...G(),"hidden","none"]}],"divide-style":[{divide:[...G(),"hidden","none"]}],"border-color":[{border:K()}],"border-color-x":[{"border-x":K()}],"border-color-y":[{"border-y":K()}],"border-color-s":[{"border-s":K()}],"border-color-e":[{"border-e":K()}],"border-color-t":[{"border-t":K()}],"border-color-r":[{"border-r":K()}],"border-color-b":[{"border-b":K()}],"border-color-l":[{"border-l":K()}],"divide-color":[{divide:K()}],"outline-style":[{outline:[...G(),"none","hidden"]}],"outline-offset":[{"outline-offset":[st,Be,ze]}],"outline-w":[{outline:["",st,zi,ca]}],"outline-color":[{outline:K()}],shadow:[{shadow:["","none",d,Us,$s]}],"shadow-color":[{shadow:K()}],"inset-shadow":[{"inset-shadow":["none",p,Us,$s]}],"inset-shadow-color":[{"inset-shadow":K()}],"ring-w":[{ring:Z()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:K()}],"ring-offset-w":[{"ring-offset":[st,ca]}],"ring-offset-color":[{"ring-offset":K()}],"inset-ring-w":[{"inset-ring":Z()}],"inset-ring-color":[{"inset-ring":K()}],"text-shadow":[{"text-shadow":["none",h,Us,$s]}],"text-shadow-color":[{"text-shadow":K()}],opacity:[{opacity:[st,Be,ze]}],"mix-blend":[{"mix-blend":[...ne(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":ne()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[st]}],"mask-image-linear-from-pos":[{"mask-linear-from":re()}],"mask-image-linear-to-pos":[{"mask-linear-to":re()}],"mask-image-linear-from-color":[{"mask-linear-from":K()}],"mask-image-linear-to-color":[{"mask-linear-to":K()}],"mask-image-t-from-pos":[{"mask-t-from":re()}],"mask-image-t-to-pos":[{"mask-t-to":re()}],"mask-image-t-from-color":[{"mask-t-from":K()}],"mask-image-t-to-color":[{"mask-t-to":K()}],"mask-image-r-from-pos":[{"mask-r-from":re()}],"mask-image-r-to-pos":[{"mask-r-to":re()}],"mask-image-r-from-color":[{"mask-r-from":K()}],"mask-image-r-to-color":[{"mask-r-to":K()}],"mask-image-b-from-pos":[{"mask-b-from":re()}],"mask-image-b-to-pos":[{"mask-b-to":re()}],"mask-image-b-from-color":[{"mask-b-from":K()}],"mask-image-b-to-color":[{"mask-b-to":K()}],"mask-image-l-from-pos":[{"mask-l-from":re()}],"mask-image-l-to-pos":[{"mask-l-to":re()}],"mask-image-l-from-color":[{"mask-l-from":K()}],"mask-image-l-to-color":[{"mask-l-to":K()}],"mask-image-x-from-pos":[{"mask-x-from":re()}],"mask-image-x-to-pos":[{"mask-x-to":re()}],"mask-image-x-from-color":[{"mask-x-from":K()}],"mask-image-x-to-color":[{"mask-x-to":K()}],"mask-image-y-from-pos":[{"mask-y-from":re()}],"mask-image-y-to-pos":[{"mask-y-to":re()}],"mask-image-y-from-color":[{"mask-y-from":K()}],"mask-image-y-to-color":[{"mask-y-to":K()}],"mask-image-radial":[{"mask-radial":[Be,ze]}],"mask-image-radial-from-pos":[{"mask-radial-from":re()}],"mask-image-radial-to-pos":[{"mask-radial-to":re()}],"mask-image-radial-from-color":[{"mask-radial-from":K()}],"mask-image-radial-to-color":[{"mask-radial-to":K()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":S()}],"mask-image-conic-pos":[{"mask-conic":[st]}],"mask-image-conic-from-pos":[{"mask-conic-from":re()}],"mask-image-conic-to-pos":[{"mask-conic-to":re()}],"mask-image-conic-from-color":[{"mask-conic-from":K()}],"mask-image-conic-to-color":[{"mask-conic-to":K()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:H()}],"mask-repeat":[{mask:M()}],"mask-size":[{mask:z()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",Be,ze]}],filter:[{filter:["","none",Be,ze]}],blur:[{blur:pe()}],brightness:[{brightness:[st,Be,ze]}],contrast:[{contrast:[st,Be,ze]}],"drop-shadow":[{"drop-shadow":["","none",m,Us,$s]}],"drop-shadow-color":[{"drop-shadow":K()}],grayscale:[{grayscale:["",st,Be,ze]}],"hue-rotate":[{"hue-rotate":[st,Be,ze]}],invert:[{invert:["",st,Be,ze]}],saturate:[{saturate:[st,Be,ze]}],sepia:[{sepia:["",st,Be,ze]}],"backdrop-filter":[{"backdrop-filter":["","none",Be,ze]}],"backdrop-blur":[{"backdrop-blur":pe()}],"backdrop-brightness":[{"backdrop-brightness":[st,Be,ze]}],"backdrop-contrast":[{"backdrop-contrast":[st,Be,ze]}],"backdrop-grayscale":[{"backdrop-grayscale":["",st,Be,ze]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[st,Be,ze]}],"backdrop-invert":[{"backdrop-invert":["",st,Be,ze]}],"backdrop-opacity":[{"backdrop-opacity":[st,Be,ze]}],"backdrop-saturate":[{"backdrop-saturate":[st,Be,ze]}],"backdrop-sepia":[{"backdrop-sepia":["",st,Be,ze]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":R()}],"border-spacing-x":[{"border-spacing-x":R()}],"border-spacing-y":[{"border-spacing-y":R()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",Be,ze]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[st,"initial",Be,ze]}],ease:[{ease:["linear","initial",y,Be,ze]}],delay:[{delay:[st,Be,ze]}],animate:[{animate:["none",v,Be,ze]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[b,Be,ze]}],"perspective-origin":[{"perspective-origin":E()}],rotate:[{rotate:me()}],"rotate-x":[{"rotate-x":me()}],"rotate-y":[{"rotate-y":me()}],"rotate-z":[{"rotate-z":me()}],scale:[{scale:ye()}],"scale-x":[{"scale-x":ye()}],"scale-y":[{"scale-y":ye()}],"scale-z":[{"scale-z":ye()}],"scale-3d":["scale-3d"],skew:[{skew:ve()}],"skew-x":[{"skew-x":ve()}],"skew-y":[{"skew-y":ve()}],transform:[{transform:[Be,ze,"","none","gpu","cpu"]}],"transform-origin":[{origin:E()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:Te()}],"translate-x":[{"translate-x":Te()}],"translate-y":[{"translate-y":Te()}],"translate-z":[{"translate-z":Te()}],"translate-none":["translate-none"],accent:[{accent:K()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:K()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",Be,ze]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":R()}],"scroll-mx":[{"scroll-mx":R()}],"scroll-my":[{"scroll-my":R()}],"scroll-ms":[{"scroll-ms":R()}],"scroll-me":[{"scroll-me":R()}],"scroll-mt":[{"scroll-mt":R()}],"scroll-mr":[{"scroll-mr":R()}],"scroll-mb":[{"scroll-mb":R()}],"scroll-ml":[{"scroll-ml":R()}],"scroll-p":[{"scroll-p":R()}],"scroll-px":[{"scroll-px":R()}],"scroll-py":[{"scroll-py":R()}],"scroll-ps":[{"scroll-ps":R()}],"scroll-pe":[{"scroll-pe":R()}],"scroll-pt":[{"scroll-pt":R()}],"scroll-pr":[{"scroll-pr":R()}],"scroll-pb":[{"scroll-pb":R()}],"scroll-pl":[{"scroll-pl":R()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",Be,ze]}],fill:[{fill:["none",...K()]}],"stroke-w":[{stroke:[st,zi,ca,wc]}],stroke:[{stroke:["none",...K()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}},vO=eO(yO);function ke(...e){return vO(m5(e))}function kO(e){if(!e||typeof e!="string")return null;try{return JSON.parse(e)}catch{return null}}const wO=tb("relative w-full rounded-lg border px-4 py-3 text-sm grid has-[>svg]:grid-cols-[calc(var(--spacing)*4)_1fr] grid-cols-[0_1fr] has-[>svg]:gap-x-3 gap-y-0.5 items-start [&>svg]:size-4 [&>svg]:translate-y-0.5 [&>svg]:text-current",{variants:{variant:{default:"bg-card text-card-foreground",destructive:"text-destructive bg-card [&>svg]:text-current *:data-[slot=alert-description]:text-destructive/90"}},defaultVariants:{variant:"default"}}),E5=f.forwardRef(({className:e,variant:t,...r},n)=>s.jsx("div",{ref:n,role:"alert","data-slot":"alert",className:ke(wO({variant:t}),e),...r}));E5.displayName="Alert";const SO=f.forwardRef(({className:e,...t},r)=>s.jsx("div",{ref:r,"data-slot":"alert-title",className:ke("col-start-2 line-clamp-1 min-h-4 font-medium tracking-tight",e),...t}));SO.displayName="AlertTitle";const EO=f.forwardRef(({className:e,...t},r)=>s.jsx("div",{ref:r,"data-slot":"alert-description",className:ke("text-muted-foreground col-start-2 grid justify-items-start gap-1 text-sm [&_p]:leading-relaxed",e),...t}));EO.displayName="AlertDescription";const CO=tb("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 Vn({className:e,variant:t,...r}){return s.jsx("div",{className:ke(CO({variant:t}),e),...r})}const NO=tb("inline-flex touch-manipulation items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",{variants:{variant:{default:"bg-primary text-primary-foreground shadow hover:bg-primary/90 active:bg-primary/80",destructive:"bg-destructive text-destructive-foreground shadow-sm hover:bg-destructive/90 active:bg-destructive/80",outline:"border border-input bg-background shadow-sm hover:bg-accent hover:text-accent-foreground active:bg-accent/80",secondary:"bg-secondary text-secondary-foreground shadow-sm hover:bg-secondary/80 active:bg-secondary/70",ghost:"hover:bg-accent hover:text-accent-foreground active:bg-accent/80",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-10 px-4 py-2",sm:"h-9 rounded-md px-3 text-sm",lg:"h-11 rounded-md px-8",icon:"h-10 w-10"}},defaultVariants:{variant:"default",size:"default"}}),Fe=f.forwardRef(({className:e,variant:t,size:r,...n},a)=>s.jsx("button",{className:ke(NO({variant:t,size:r,className:e})),ref:a,...n}));Fe.displayName="Button";const C5=f.createContext(null),N5=()=>{const e=f.useContext(C5);if(!e)throw new Error("Confirmation components must be used within Confirmation");return e},T5=({className:e,approval:t="pending",children:r,...n})=>{const a=f.useMemo(()=>({approval:t}),[t]);return s.jsx(C5.Provider,{value:a,children:s.jsx(E5,{className:ke("flex flex-col gap-2",e),...n,children:r})})};T5.displayName="Confirmation";const A5=({className:e,...t})=>s.jsx("div",{"data-slot":"confirmation-title",className:ke("text-muted-foreground inline text-sm",e),...t});A5.displayName="ConfirmationTitle";const I5=({children:e})=>{const{approval:t}=N5();return t!=="pending"?null:s.jsx(s.Fragment,{children:e})};I5.displayName="ConfirmationRequest";const j5=({className:e,...t})=>{const{approval:r}=N5();return r!=="pending"?null:s.jsx("div",{"data-slot":"confirmation-actions",className:ke("flex items-center justify-end gap-2 self-end",e),...t})};j5.displayName="ConfirmationActions";const Ro=({variant:e="default",...t})=>s.jsx(Fe,{className:"h-8 px-3 text-sm",variant:e,type:"button",...t});Ro.displayName="ConfirmationAction";const nb=f.forwardRef(({className:e,...t},r)=>s.jsx("div",{ref:r,className:ke("rounded-xl border bg-card text-card-foreground shadow-sm",e),...t}));nb.displayName="Card";const R5=f.forwardRef(({className:e,...t},r)=>s.jsx("div",{ref:r,className:ke("flex flex-col space-y-1.5 p-4",e),...t}));R5.displayName="CardHeader";const _5=f.forwardRef(({className:e,...t},r)=>s.jsx("h3",{ref:r,className:ke("font-semibold leading-none tracking-tight",e),...t}));_5.displayName="CardTitle";const TO=f.forwardRef(({className:e,...t},r)=>s.jsx("p",{ref:r,className:ke("text-sm text-muted-foreground",e),...t}));TO.displayName="CardDescription";const D5=f.forwardRef(({className:e,...t},r)=>s.jsx("div",{ref:r,className:ke("p-4 pt-0",e),...t}));D5.displayName="CardContent";const M5=f.forwardRef(({className:e,...t},r)=>s.jsx("div",{ref:r,className:ke("flex items-center p-4 pt-0",e),...t}));M5.displayName="CardFooter";const AO=f.forwardRef(({className:e,...t},r)=>s.jsx("div",{ref:r,className:ke("ml-auto shrink-0",e),...t}));AO.displayName="CardAction";const O5=f.createContext(null);function L5(){const e=f.useContext(O5);if(!e)throw new Error("Collapsible components must be used within <Collapsible>");return e}const wa=f.forwardRef(({defaultOpen:e=!1,open:t,onOpenChange:r,className:n,children:a,...i},o)=>{const[l,c]=f.useState(e),u=t!==void 0,d=u?t:l,p=f.useCallback(m=>{u||c(m),r?.(m)},[u,r]),h=f.useMemo(()=>({open:d,onOpenChange:p}),[d,p]);return s.jsx(O5.Provider,{value:h,children:s.jsx("div",{ref:o,"data-state":d?"open":"closed",className:n,...i,children:a})})});wa.displayName="Collapsible";const Zn=f.forwardRef(({onClick:e,children:t,className:r,...n},a)=>{const{open:i,onOpenChange:o}=L5(),l=f.useCallback(c=>{o(!i),e?.(c)},[i,o,e]);return s.jsx("button",{ref:a,type:"button","aria-expanded":i,"data-state":i?"open":"closed",onClick:l,className:r,...n,children:t})});Zn.displayName="CollapsibleTrigger";const Sa=f.forwardRef(({className:e,children:t,...r},n)=>{const{open:a}=L5();return s.jsx("div",{ref:n,"data-state":a?"open":"closed",className:ke("grid transition-[grid-template-rows] duration-200 ease-out",a?"grid-rows-[1fr]":"grid-rows-[0fr]",e),...r,children:s.jsx("div",{className:"overflow-hidden",children:t})})});Sa.displayName="CollapsibleContent";var Sy=1,IO=.9,jO=.8,RO=.17,Sc=.1,Ec=.999,_O=.9999,DO=.99,MO=/[\\\/_+.#"@\[\(\{&]/,OO=/[\\\/_+.#"@\[\(\{&]/g,LO=/[\s-]/,P5=/[\s-]/g;function P0(e,t,r,n,a,i,o){if(i===t.length)return a===e.length?Sy:DO;var l=`${a},${i}`;if(o[l]!==void 0)return o[l];for(var c=n.charAt(i),u=r.indexOf(c,a),d=0,p,h,m,g;u>=0;)p=P0(e,t,r,n,u+1,i+1,o),p>d&&(u===a?p*=Sy:MO.test(e.charAt(u-1))?(p*=jO,m=e.slice(a,u-1).match(OO),m&&a>0&&(p*=Math.pow(Ec,m.length))):LO.test(e.charAt(u-1))?(p*=IO,g=e.slice(a,u-1).match(P5),g&&a>0&&(p*=Math.pow(Ec,g.length))):(p*=RO,a>0&&(p*=Math.pow(Ec,u-a))),e.charAt(u)!==t.charAt(i)&&(p*=_O)),(p<Sc&&r.charAt(u-1)===n.charAt(i+1)||n.charAt(i+1)===n.charAt(i)&&r.charAt(u-1)!==n.charAt(i))&&(h=P0(e,t,r,n,u+1,i+2,o),h*Sc>p&&(p=h*Sc)),p>d&&(d=p),u=r.indexOf(c,u+1);return o[l]=d,d}function Ey(e){return e.toLowerCase().replace(P5," ")}function PO(e,t,r){return e=r&&r.length>0?`${e+" "+r.join(" ")}`:e,P0(e,t,Ey(e),Ey(t),0,0,{})}function Wn(e,t,{checkForDefaultPrevented:r=!0}={}){return function(a){if(e?.(a),r===!1||!a.defaultPrevented)return t?.(a)}}function Cy(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function Xn(...e){return t=>{let r=!1;const n=e.map(a=>{const i=Cy(a,t);return!r&&typeof i=="function"&&(r=!0),i});if(r)return()=>{for(let a=0;a<n.length;a++){const i=n[a];typeof i=="function"?i():Cy(e[a],null)}}}}function ja(...e){return f.useCallback(Xn(...e),e)}function FO(e,t){const r=f.createContext(t),n=i=>{const{children:o,...l}=i,c=f.useMemo(()=>l,Object.values(l));return s.jsx(r.Provider,{value:c,children:o})};n.displayName=e+"Provider";function a(i){const o=f.useContext(r);if(o)return o;if(t!==void 0)return t;throw new Error(`\`${i}\` must be used within \`${e}\``)}return[n,a]}function zO(e,t=[]){let r=[];function n(i,o){const l=f.createContext(o),c=r.length;r=[...r,o];const u=p=>{const{scope:h,children:m,...g}=p,b=h?.[e]?.[c]||l,x=f.useMemo(()=>g,Object.values(g));return s.jsx(b.Provider,{value:x,children:m})};u.displayName=i+"Provider";function d(p,h){const m=h?.[e]?.[c]||l,g=f.useContext(m);if(g)return g;if(o!==void 0)return o;throw new Error(`\`${p}\` must be used within \`${i}\``)}return[u,d]}const a=()=>{const i=r.map(o=>f.createContext(o));return function(l){const c=l?.[e]||i;return f.useMemo(()=>({[`__scope${e}`]:{...l,[e]:c}}),[l,c])}};return a.scopeName=e,[n,BO(a,...t)]}function BO(...e){const t=e[0];if(e.length===1)return t;const r=()=>{const n=e.map(a=>({useScope:a(),scopeName:a.scopeName}));return function(i){const o=n.reduce((l,{useScope:c,scopeName:u})=>{const p=c(i)[`__scope${u}`];return{...l,...p}},{});return f.useMemo(()=>({[`__scope${t.scopeName}`]:o}),[o])}};return r.scopeName=t.scopeName,r}var hs=globalThis?.document?f.useLayoutEffect:()=>{},$O=Lg[" useId ".trim().toString()]||(()=>{}),UO=0;function vn(e){const[t,r]=f.useState($O());return hs(()=>{r(n=>n??String(UO++))},[e]),t?`radix-${t}`:""}var GO=Lg[" useInsertionEffect ".trim().toString()]||hs;function qO({prop:e,defaultProp:t,onChange:r=()=>{},caller:n}){const[a,i,o]=HO({defaultProp:t,onChange:r}),l=e!==void 0,c=l?e:a;{const d=f.useRef(e!==void 0);f.useEffect(()=>{const p=d.current;p!==l&&console.warn(`${n} is changing from ${p?"controlled":"uncontrolled"} to ${l?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),d.current=l},[l,n])}const u=f.useCallback(d=>{if(l){const p=VO(d)?d(e):d;p!==e&&o.current?.(p)}else i(d)},[l,e,i,o]);return[c,u]}function HO({defaultProp:e,onChange:t}){const[r,n]=f.useState(e),a=f.useRef(r),i=f.useRef(t);return GO(()=>{i.current=t},[t]),f.useEffect(()=>{a.current!==r&&(i.current?.(r),a.current=r)},[r,a]),[r,n,i]}function VO(e){return typeof e=="function"}function As(e){const t=WO(e),r=f.forwardRef((n,a)=>{const{children:i,...o}=n,l=f.Children.toArray(i),c=l.find(YO);if(c){const u=c.props.children,d=l.map(p=>p===c?f.Children.count(u)>1?f.Children.only(null):f.isValidElement(u)?u.props.children:null:p);return s.jsx(t,{...o,ref:a,children:f.isValidElement(u)?f.cloneElement(u,void 0,d):null})}return s.jsx(t,{...o,ref:a,children:i})});return r.displayName=`${e}.Slot`,r}function WO(e){const t=f.forwardRef((r,n)=>{const{children:a,...i}=r;if(f.isValidElement(a)){const o=XO(a),l=ZO(i,a.props);return a.type!==f.Fragment&&(l.ref=n?Xn(n,o):o),f.cloneElement(a,l)}return f.Children.count(a)>1?f.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var KO=Symbol("radix.slottable");function YO(e){return f.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===KO}function ZO(e,t){const r={...t};for(const n in t){const a=e[n],i=t[n];/^on[A-Z]/.test(n)?a&&i?r[n]=(...l)=>{const c=i(...l);return a(...l),c}:a&&(r[n]=a):n==="style"?r[n]={...a,...i}:n==="className"&&(r[n]=[a,i].filter(Boolean).join(" "))}return{...e,...r}}function XO(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning;return r?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning,r?e.props.ref:e.props.ref||e.ref)}var JO=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],F5=JO.reduce((e,t)=>{const r=As(`Primitive.${t}`),n=f.forwardRef((a,i)=>{const{asChild:o,...l}=a,c=o?r:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),s.jsx(c,{...l,ref:i})});return n.displayName=`Primitive.${t}`,{...e,[t]:n}},{});function QO(e,t){e&&Nl.flushSync(()=>e.dispatchEvent(t))}function fs(e){const t=f.useRef(e);return f.useEffect(()=>{t.current=e}),f.useMemo(()=>(...r)=>t.current?.(...r),[])}function e9(e,t=globalThis?.document){const r=fs(e);f.useEffect(()=>{const n=a=>{a.key==="Escape"&&r(a)};return t.addEventListener("keydown",n,{capture:!0}),()=>t.removeEventListener("keydown",n,{capture:!0})},[r,t])}var t9="DismissableLayer",F0="dismissableLayer.update",r9="dismissableLayer.pointerDownOutside",n9="dismissableLayer.focusOutside",Ny,z5=f.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),B5=f.forwardRef((e,t)=>{const{disableOutsidePointerEvents:r=!1,onEscapeKeyDown:n,onPointerDownOutside:a,onFocusOutside:i,onInteractOutside:o,onDismiss:l,...c}=e,u=f.useContext(z5),[d,p]=f.useState(null),h=d?.ownerDocument??globalThis?.document,[,m]=f.useState({}),g=ja(t,N=>p(N)),b=Array.from(u.layers),[x]=[...u.layersWithOutsidePointerEventsDisabled].slice(-1),y=b.indexOf(x),v=d?b.indexOf(d):-1,k=u.layersWithOutsidePointerEventsDisabled.size>0,S=v>=y,E=s9(N=>{const R=N.target,T=[...u.branches].some(j=>j.contains(R));!S||T||(a?.(N),o?.(N),N.defaultPrevented||l?.())},h),w=o9(N=>{const R=N.target;[...u.branches].some(j=>j.contains(R))||(i?.(N),o?.(N),N.defaultPrevented||l?.())},h);return e9(N=>{v===u.layers.size-1&&(n?.(N),!N.defaultPrevented&&l&&(N.preventDefault(),l()))},h),f.useEffect(()=>{if(d)return r&&(u.layersWithOutsidePointerEventsDisabled.size===0&&(Ny=h.body.style.pointerEvents,h.body.style.pointerEvents="none"),u.layersWithOutsidePointerEventsDisabled.add(d)),u.layers.add(d),Ty(),()=>{r&&u.layersWithOutsidePointerEventsDisabled.size===1&&(h.body.style.pointerEvents=Ny)}},[d,h,r,u]),f.useEffect(()=>()=>{d&&(u.layers.delete(d),u.layersWithOutsidePointerEventsDisabled.delete(d),Ty())},[d,u]),f.useEffect(()=>{const N=()=>m({});return document.addEventListener(F0,N),()=>document.removeEventListener(F0,N)},[]),s.jsx(F5.div,{...c,ref:g,style:{pointerEvents:k?S?"auto":"none":void 0,...e.style},onFocusCapture:Wn(e.onFocusCapture,w.onFocusCapture),onBlurCapture:Wn(e.onBlurCapture,w.onBlurCapture),onPointerDownCapture:Wn(e.onPointerDownCapture,E.onPointerDownCapture)})});B5.displayName=t9;var a9="DismissableLayerBranch",i9=f.forwardRef((e,t)=>{const r=f.useContext(z5),n=f.useRef(null),a=ja(t,n);return f.useEffect(()=>{const i=n.current;if(i)return r.branches.add(i),()=>{r.branches.delete(i)}},[r.branches]),s.jsx(F5.div,{...e,ref:a})});i9.displayName=a9;function s9(e,t=globalThis?.document){const r=fs(e),n=f.useRef(!1),a=f.useRef(()=>{});return f.useEffect(()=>{const i=l=>{if(l.target&&!n.current){let c=function(){$5(r9,r,u,{discrete:!0})};const u={originalEvent:l};l.pointerType==="touch"?(t.removeEventListener("click",a.current),a.current=c,t.addEventListener("click",a.current,{once:!0})):c()}else t.removeEventListener("click",a.current);n.current=!1},o=window.setTimeout(()=>{t.addEventListener("pointerdown",i)},0);return()=>{window.clearTimeout(o),t.removeEventListener("pointerdown",i),t.removeEventListener("click",a.current)}},[t,r]),{onPointerDownCapture:()=>n.current=!0}}function o9(e,t=globalThis?.document){const r=fs(e),n=f.useRef(!1);return f.useEffect(()=>{const a=i=>{i.target&&!n.current&&$5(n9,r,{originalEvent:i},{discrete:!1})};return t.addEventListener("focusin",a),()=>t.removeEventListener("focusin",a)},[t,r]),{onFocusCapture:()=>n.current=!0,onBlurCapture:()=>n.current=!1}}function Ty(){const e=new CustomEvent(F0);document.dispatchEvent(e)}function $5(e,t,r,{discrete:n}){const a=r.originalEvent.target,i=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:r});t&&a.addEventListener(e,t,{once:!0}),n?QO(a,i):a.dispatchEvent(i)}var l9=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],c9=l9.reduce((e,t)=>{const r=As(`Primitive.${t}`),n=f.forwardRef((a,i)=>{const{asChild:o,...l}=a,c=o?r:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),s.jsx(c,{...l,ref:i})});return n.displayName=`Primitive.${t}`,{...e,[t]:n}},{}),Cc="focusScope.autoFocusOnMount",Nc="focusScope.autoFocusOnUnmount",Ay={bubbles:!1,cancelable:!0},u9="FocusScope",U5=f.forwardRef((e,t)=>{const{loop:r=!1,trapped:n=!1,onMountAutoFocus:a,onUnmountAutoFocus:i,...o}=e,[l,c]=f.useState(null),u=fs(a),d=fs(i),p=f.useRef(null),h=ja(t,b=>c(b)),m=f.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;f.useEffect(()=>{if(n){let b=function(k){if(m.paused||!l)return;const S=k.target;l.contains(S)?p.current=S:Bn(p.current,{select:!0})},x=function(k){if(m.paused||!l)return;const S=k.relatedTarget;S!==null&&(l.contains(S)||Bn(p.current,{select:!0}))},y=function(k){if(document.activeElement===document.body)for(const E of k)E.removedNodes.length>0&&Bn(l)};document.addEventListener("focusin",b),document.addEventListener("focusout",x);const v=new MutationObserver(y);return l&&v.observe(l,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",b),document.removeEventListener("focusout",x),v.disconnect()}}},[n,l,m.paused]),f.useEffect(()=>{if(l){jy.add(m);const b=document.activeElement;if(!l.contains(b)){const y=new CustomEvent(Cc,Ay);l.addEventListener(Cc,u),l.dispatchEvent(y),y.defaultPrevented||(d9(g9(G5(l)),{select:!0}),document.activeElement===b&&Bn(l))}return()=>{l.removeEventListener(Cc,u),setTimeout(()=>{const y=new CustomEvent(Nc,Ay);l.addEventListener(Nc,d),l.dispatchEvent(y),y.defaultPrevented||Bn(b??document.body,{select:!0}),l.removeEventListener(Nc,d),jy.remove(m)},0)}}},[l,u,d,m]);const g=f.useCallback(b=>{if(!r&&!n||m.paused)return;const x=b.key==="Tab"&&!b.altKey&&!b.ctrlKey&&!b.metaKey,y=document.activeElement;if(x&&y){const v=b.currentTarget,[k,S]=p9(v);k&&S?!b.shiftKey&&y===S?(b.preventDefault(),r&&Bn(k,{select:!0})):b.shiftKey&&y===k&&(b.preventDefault(),r&&Bn(S,{select:!0})):y===v&&b.preventDefault()}},[r,n,m.paused]);return s.jsx(c9.div,{tabIndex:-1,...o,ref:h,onKeyDown:g})});U5.displayName=u9;function d9(e,{select:t=!1}={}){const r=document.activeElement;for(const n of e)if(Bn(n,{select:t}),document.activeElement!==r)return}function p9(e){const t=G5(e),r=Iy(t,e),n=Iy(t.reverse(),e);return[r,n]}function G5(e){const t=[],r=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:n=>{const a=n.tagName==="INPUT"&&n.type==="hidden";return n.disabled||n.hidden||a?NodeFilter.FILTER_SKIP:n.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;r.nextNode();)t.push(r.currentNode);return t}function Iy(e,t){for(const r of e)if(!m9(r,{upTo:t}))return r}function m9(e,{upTo:t}){if(getComputedStyle(e).visibility==="hidden")return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display==="none")return!0;e=e.parentElement}return!1}function h9(e){return e instanceof HTMLInputElement&&"select"in e}function Bn(e,{select:t=!1}={}){if(e&&e.focus){const r=document.activeElement;e.focus({preventScroll:!0}),e!==r&&h9(e)&&t&&e.select()}}var jy=f9();function f9(){let e=[];return{add(t){const r=e[0];t!==r&&r?.pause(),e=Ry(e,t),e.unshift(t)},remove(t){e=Ry(e,t),e[0]?.resume()}}}function Ry(e,t){const r=[...e],n=r.indexOf(t);return n!==-1&&r.splice(n,1),r}function g9(e){return e.filter(t=>t.tagName!=="A")}var b9=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],x9=b9.reduce((e,t)=>{const r=As(`Primitive.${t}`),n=f.forwardRef((a,i)=>{const{asChild:o,...l}=a,c=o?r:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),s.jsx(c,{...l,ref:i})});return n.displayName=`Primitive.${t}`,{...e,[t]:n}},{}),y9="Portal",q5=f.forwardRef((e,t)=>{const{container:r,...n}=e,[a,i]=f.useState(!1);hs(()=>i(!0),[]);const o=r||a&&globalThis?.document?.body;return o?Ki.createPortal(s.jsx(x9.div,{...n,ref:t}),o):null});q5.displayName=y9;function v9(e,t){return f.useReducer((r,n)=>t[r][n]??r,e)}var Ol=e=>{const{present:t,children:r}=e,n=k9(t),a=typeof r=="function"?r({present:n.isPresent}):f.Children.only(r),i=ja(n.ref,w9(a));return typeof r=="function"||n.isPresent?f.cloneElement(a,{ref:i}):null};Ol.displayName="Presence";function k9(e){const[t,r]=f.useState(),n=f.useRef(null),a=f.useRef(e),i=f.useRef("none"),o=e?"mounted":"unmounted",[l,c]=v9(o,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return f.useEffect(()=>{const u=Gs(n.current);i.current=l==="mounted"?u:"none"},[l]),hs(()=>{const u=n.current,d=a.current;if(d!==e){const h=i.current,m=Gs(u);e?c("MOUNT"):m==="none"||u?.display==="none"?c("UNMOUNT"):c(d&&h!==m?"ANIMATION_OUT":"UNMOUNT"),a.current=e}},[e,c]),hs(()=>{if(t){let u;const d=t.ownerDocument.defaultView??window,p=m=>{const b=Gs(n.current).includes(CSS.escape(m.animationName));if(m.target===t&&b&&(c("ANIMATION_END"),!a.current)){const x=t.style.animationFillMode;t.style.animationFillMode="forwards",u=d.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=x)})}},h=m=>{m.target===t&&(i.current=Gs(n.current))};return t.addEventListener("animationstart",h),t.addEventListener("animationcancel",p),t.addEventListener("animationend",p),()=>{d.clearTimeout(u),t.removeEventListener("animationstart",h),t.removeEventListener("animationcancel",p),t.removeEventListener("animationend",p)}}else c("ANIMATION_END")},[t,c]),{isPresent:["mounted","unmountSuspended"].includes(l),ref:f.useCallback(u=>{n.current=u?getComputedStyle(u):null,r(u)},[])}}function Gs(e){return e?.animationName||"none"}function w9(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning;return r?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning,r?e.props.ref:e.props.ref||e.ref)}var S9=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Is=S9.reduce((e,t)=>{const r=As(`Primitive.${t}`),n=f.forwardRef((a,i)=>{const{asChild:o,...l}=a,c=o?r:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),s.jsx(c,{...l,ref:i})});return n.displayName=`Primitive.${t}`,{...e,[t]:n}},{}),Tc=0;function E9(){f.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??_y()),document.body.insertAdjacentElement("beforeend",e[1]??_y()),Tc++,()=>{Tc===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(t=>t.remove()),Tc--}},[])}function _y(){const e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.outline="none",e.style.opacity="0",e.style.position="fixed",e.style.pointerEvents="none",e}var Qr=function(){return Qr=Object.assign||function(t){for(var r,n=1,a=arguments.length;n<a;n++){r=arguments[n];for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(t[i]=r[i])}return t},Qr.apply(this,arguments)};function H5(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var a=0,n=Object.getOwnPropertySymbols(e);a<n.length;a++)t.indexOf(n[a])<0&&Object.prototype.propertyIsEnumerable.call(e,n[a])&&(r[n[a]]=e[n[a]]);return r}function Ra(e,t,r,n){function a(i){return i instanceof r?i:new r(function(o){o(i)})}return new(r||(r=Promise))(function(i,o){function l(d){try{u(n.next(d))}catch(p){o(p)}}function c(d){try{u(n.throw(d))}catch(p){o(p)}}function u(d){d.done?i(d.value):a(d.value).then(l,c)}u((n=n.apply(e,t||[])).next())})}function C9(e,t,r){if(r||arguments.length===2)for(var n=0,a=t.length,i;n<a;n++)(i||!(n in t))&&(i||(i=Array.prototype.slice.call(t,0,n)),i[n]=t[n]);return e.concat(i||Array.prototype.slice.call(t))}var _o="right-scroll-bar-position",Do="width-before-scroll-bar",N9="with-scroll-bars-hidden",T9="--removed-body-scroll-bar-size";function Ac(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function A9(e,t){var r=f.useState(function(){return{value:e,callback:t,facade:{get current(){return r.value},set current(n){var a=r.value;a!==n&&(r.value=n,r.callback(n,a))}}}})[0];return r.callback=t,r.facade}var I9=typeof window<"u"?f.useLayoutEffect:f.useEffect,Dy=new WeakMap;function j9(e,t){var r=A9(null,function(n){return e.forEach(function(a){return Ac(a,n)})});return I9(function(){var n=Dy.get(r);if(n){var a=new Set(n),i=new Set(e),o=r.current;a.forEach(function(l){i.has(l)||Ac(l,null)}),i.forEach(function(l){a.has(l)||Ac(l,o)})}Dy.set(r,e)},[e]),r}function R9(e){return e}function _9(e,t){t===void 0&&(t=R9);var r=[],n=!1,a={read:function(){if(n)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return r.length?r[r.length-1]:e},useMedium:function(i){var o=t(i,n);return r.push(o),function(){r=r.filter(function(l){return l!==o})}},assignSyncMedium:function(i){for(n=!0;r.length;){var o=r;r=[],o.forEach(i)}r={push:function(l){return i(l)},filter:function(){return r}}},assignMedium:function(i){n=!0;var o=[];if(r.length){var l=r;r=[],l.forEach(i),o=r}var c=function(){var d=o;o=[],d.forEach(i)},u=function(){return Promise.resolve().then(c)};u(),r={push:function(d){o.push(d),u()},filter:function(d){return o=o.filter(d),r}}}};return a}function D9(e){e===void 0&&(e={});var t=_9(null);return t.options=Qr({async:!0,ssr:!1},e),t}var V5=function(e){var t=e.sideCar,r=H5(e,["sideCar"]);if(!t)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var n=t.read();if(!n)throw new Error("Sidecar medium not found");return f.createElement(n,Qr({},r))};V5.isSideCarExport=!0;function M9(e,t){return e.useMedium(t),V5}var W5=D9(),Ic=function(){},Ll=f.forwardRef(function(e,t){var r=f.useRef(null),n=f.useState({onScrollCapture:Ic,onWheelCapture:Ic,onTouchMoveCapture:Ic}),a=n[0],i=n[1],o=e.forwardProps,l=e.children,c=e.className,u=e.removeScrollBar,d=e.enabled,p=e.shards,h=e.sideCar,m=e.noRelative,g=e.noIsolation,b=e.inert,x=e.allowPinchZoom,y=e.as,v=y===void 0?"div":y,k=e.gapMode,S=H5(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),E=h,w=j9([r,t]),N=Qr(Qr({},S),a);return f.createElement(f.Fragment,null,d&&f.createElement(E,{sideCar:W5,removeScrollBar:u,shards:p,noRelative:m,noIsolation:g,inert:b,setCallbacks:i,allowPinchZoom:!!x,lockRef:r,gapMode:k}),o?f.cloneElement(f.Children.only(l),Qr(Qr({},N),{ref:w})):f.createElement(v,Qr({},N,{className:c,ref:w}),l))});Ll.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};Ll.classNames={fullWidth:Do,zeroRight:_o};var O9=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function L9(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=O9();return t&&e.setAttribute("nonce",t),e}function P9(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function F9(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var z9=function(){var e=0,t=null;return{add:function(r){e==0&&(t=L9())&&(P9(t,r),F9(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},B9=function(){var e=z9();return function(t,r){f.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&r])}},K5=function(){var e=B9(),t=function(r){var n=r.styles,a=r.dynamic;return e(n,a),null};return t},$9={left:0,top:0,right:0,gap:0},jc=function(e){return parseInt(e||"",10)||0},U9=function(e){var t=window.getComputedStyle(document.body),r=t[e==="padding"?"paddingLeft":"marginLeft"],n=t[e==="padding"?"paddingTop":"marginTop"],a=t[e==="padding"?"paddingRight":"marginRight"];return[jc(r),jc(n),jc(a)]},G9=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return $9;var t=U9(e),r=document.documentElement.clientWidth,n=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,n-r+t[2]-t[0])}},q9=K5(),ci="data-scroll-locked",H9=function(e,t,r,n){var a=e.left,i=e.top,o=e.right,l=e.gap;return r===void 0&&(r="margin"),`
|
|
705
705
|
.`.concat(N9,` {
|
|
706
706
|
overflow: hidden `).concat(n,`;
|
|
707
707
|
padding-right: `).concat(l,"px ").concat(n,`;
|
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-
|
|
28
|
+
<script type="module" crossorigin src="/assets/index-K8yoDFvk.js"></script>
|
|
29
29
|
<link rel="modulepreload" crossorigin href="/assets/vendor-react-BGZc9oRE.js">
|
|
30
30
|
<link rel="modulepreload" crossorigin href="/assets/vendor-codemirror-OwyKSvPE.js">
|
|
31
31
|
<link rel="modulepreload" crossorigin href="/assets/vendor-xterm-CJZjLICi.js">
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cloudcli-ai/cloudcli",
|
|
3
|
-
"version": "1.31.
|
|
3
|
+
"version": "1.31.4",
|
|
4
4
|
"description": "A web-based UI for Claude Code CLI",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist-server/server/index.js",
|
|
@@ -76,7 +76,7 @@
|
|
|
76
76
|
"@codemirror/theme-one-dark": "^6.1.2",
|
|
77
77
|
"@iarna/toml": "^2.2.5",
|
|
78
78
|
"@octokit/rest": "^22.0.0",
|
|
79
|
-
"@openai/codex-sdk": "^0.
|
|
79
|
+
"@openai/codex-sdk": "^0.125.0",
|
|
80
80
|
"@replit/codemirror-minimap": "^0.5.2",
|
|
81
81
|
"@tailwindcss/typography": "^0.5.16",
|
|
82
82
|
"@uiw/react-codemirror": "^4.23.13",
|