@pixelbyte-software/pixcode 1.40.8 → 1.40.9

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.
@@ -226,7 +226,7 @@ import{j as i,a as T4,R as hf,o as ff,_ as bj,b as xj,m as j4,E as Nn,T as _4,P
226
226
  *
227
227
  * This source code is licensed under the ISC license.
228
228
  * See the LICENSE file in the root directory of this source tree.
229
- */const dD=[["rect",{width:"8",height:"8",x:"3",y:"3",rx:"2",key:"by2w9f"}],["path",{d:"M7 11v4a2 2 0 0 0 2 2h4",key:"xkn7yn"}],["rect",{width:"8",height:"8",x:"13",y:"13",rx:"2",key:"1cgmvn"}]],uD=gt("workflow",dD),wf=rE,mE=XI,Vv=WI,pD=i7,mD=FI,kf=GI,hD=tE,Pr=iE,fD=z7,Sf=L7,An=O7,gD=P7,Kr=VI,ta=tE,nd=YI,hE=$I,bD=T7,xD=_7,fE=QI,ht=nE,Ot=nE,Gd=n7,gE=t7,yD=Y8,En=p8,Tr=h8,rr=C7,ra=E7,bE=D8,ln=xR,vD=lE,wD=lE,ad=b7,Hd=G7,xE=$7,Vd=sE,Qo=K7,Bs=a8,$t=s8,Pn=C8,Sa=k8,ai=E8,kD=rR,SD=R8,pl=z8,Ef=pR,ED=o7,Ll=y7,ND=LR,CD=vf,AD=vf,Um=Q8,TD=T8,jD=v8,_D=SR,ID=dR,RD=V8,yE=X8,Gm=vf,Nf=aR,Ut=sR,kr=OR,LD=l8,Ea=G8,xt=cE,Hm=cE,qd=AR,Cf=m7,DD=u7,Vm=c7,OD=d8,na=aE,MD=aE,PD=PR,vE=zR,ml=w7,wE=q7,Yi=x8,Af=g8,Fn=_8,kE=sE,Wd=oE,FD=oE,SE=P8,yn=$8,Tf=W8,EE=e8,NE=IR,zD=lR,jf=gR,BD=hR,Lt=Z7,$D=DI,CE=r8,Na=wR,Is=NR,_f=jR,Gr=J7,If=f7,UD=YR,Dl=tL,Rf=uE,GD=uE,Qr=FL,Pc=BL,HD=UL,ss=WR,os=XR,VD=QR,zo=nL,Rs=iL,qv=dL,Bo=pL,Eo=gL,qD=xL,AE=_L,qm=vL,_i=EL,No=kL,Wv=CL,Co=TL,Wm=RL,WD=DL,Km=ML,Ns=qL,$o=KL,Ba=ZL,ls=JL,KD=eD,Ym=rD,YD=iD,Ao=cD,aa=uD,hl=lL,TE=hL,ZD=HL,XD=oD,JD=[{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"}],QD={up:mE,down:wf,left:mD,right:kf},To=e=>e.preventDefault(),Kv="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",eO="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",Bu="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 Yv({wsRef:e,terminalRef:t,isConnected:r,bottomOffset:n="bottom-0"}){const{t:a}=Me("settings"),[s,o]=h.useState(!1),[l,c]=h.useState(!1),d=h.useCallback(m=>{Mi(e.current,{type:"input",data:m})},[e]),u=h.useCallback(()=>{t.current?.scrollToBottom()},[t]),p=h.useCallback(async()=>{if(!(typeof navigator>"u"||!navigator.clipboard?.readText))try{const m=await navigator.clipboard.readText();m.length>0&&d(m)}catch{}},[d]),f=h.useCallback(m=>{let g=m;if(s&&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)),d(g)},[s,l,d]);return i.jsx("div",{className:`pointer-events-none fixed inset-x-0 ${n} z-20 px-2 md:hidden`,children:i.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:[i.jsx("button",{type:"button",onPointerDown:To,onClick:()=>{p()},disabled:!r,className:Bu,title:a("terminalShortcuts.paste",{defaultValue:"Paste"}),"aria-label":a("terminalShortcuts.paste",{defaultValue:"Paste"}),children:i.jsx(Hd,{className:"h-4 w-4"})}),JD.map(m=>{if(m.type==="modifier"){const g=m.modifier==="ctrl"?s:l,b=m.modifier==="ctrl"?()=>o(x=>!x):()=>c(x=>!x);return i.jsx("button",{type:"button",onPointerDown:To,onClick:b,disabled:!r,className:g?eO:Kv,children:m.label},m.id)}if(m.type==="arrow"){const g=QD[m.icon];return i.jsx("button",{type:"button",onPointerDown:To,onClick:()=>d(m.sequence),disabled:!r,className:Bu,children:i.jsx(g,{className:"h-4 w-4"})},m.id)}return i.jsx("button",{type:"button",onPointerDown:To,onClick:()=>f(m.sequence),disabled:!r,className:Kv,children:m.label},m.id)}),i.jsx("button",{type:"button",onPointerDown:To,onClick:u,disabled:!r,className:Bu,title:a("terminalShortcuts.scrollDown"),"aria-label":a("terminalShortcuts.scrollDown"),children:i.jsx(hD,{className:"h-4 w-4"})})]})})}function jE({selectedProject:e=null,selectedSession:t=null,initialCommand:r=null,isPlainShell:n=!1,onProcessComplete:a=null,minimal:s=!1,autoConnect:o=!1,isActive:l=!0}){const{t:c}=Me("chat"),[d,u]=h.useState(!1),[p,f]=h.useState(null),m=h.useRef(null),g=h.useRef(null),{terminalContainerRef:b,terminalRef:x,wsRef:y,isConnected:v,isInitialized:w,isConnecting:k,authUrl:E,authUrlVersion:S,connectToShell:j,disconnectFromShell:_,openAuthUrlInBrowser:T,copyAuthUrlToClipboard:C}=TI({selectedProject:e,selectedSession:t,initialCommand:r,isPlainShell:n,minimal:s,autoConnect:o,isRestarting:d,onProcessComplete:a,onOutputRef:g}),L=h.useCallback(()=>{const $=x.current;if(!$)return;const F=$.buffer.active,te=F.baseY+F.cursorY,Q=Math.min(F.baseY+F.length-1,te+10),ge=Math.max(0,te-oI),ae=[];for(let xe=ge;xe<=Q;xe++){const Be=F.getLine(xe);Be&&ae.push(Be.translateToString().trimEnd())}let me=-1;for(let xe=ae.length-1;xe>=0;xe--)if(/esc to cancel/i.test(ae[xe])||/enter to select/i.test(ae[xe])){me=xe;break}if(me===-1){f(null);return}const pe=new Map,be=Math.max(0,me-lI);for(let xe=me-1;xe>=be;xe--){const Be=ae[xe].match(/^\s*[❯›>]?\s*(\d+)\.\s+(.+)/);if(Be){const M=Be[1],de=Be[2].trim();parseInt(M,10)<=cI&&de.length>0&&!pe.has(M)&&pe.set(M,de)}}const Ne=[];for(let xe=1;xe<=pe.size&&pe.has(String(xe));xe++)Ne.push({number:String(xe),label:pe.get(String(xe))});f(Ne.length>=dI?Ne:null)},[x]),A=h.useCallback(()=>{m.current&&clearTimeout(m.current),m.current=setTimeout(L,sI)},[L]);h.useEffect(()=>{g.current=A},[A]),h.useEffect(()=>()=>{m.current&&clearTimeout(m.current)},[]),h.useEffect(()=>{v||(m.current&&(clearTimeout(m.current),m.current=null),f(null))},[v]),h.useEffect(()=>{if(!l||!w||!v)return;const $=()=>{x.current?.focus()},F=window.requestAnimationFrame($),te=window.setTimeout($,0);return()=>{window.cancelAnimationFrame(F),window.clearTimeout(te)}},[l,v,w,x]);const I=h.useCallback($=>{Mi(y.current,{type:"input",data:$})},[y]),N=h.useMemo(()=>EI(t),[t]),P=h.useMemo(()=>N?N.slice(0,30):null,[N]),H=h.useMemo(()=>N?N.slice(0,50):null,[N]),z=h.useCallback(()=>{u(!0),window.setTimeout(()=>{u(!1)},aI)},[]);if(!e)return i.jsx(_I,{title:c("shell.selectProject.title"),description:c("shell.selectProject.description")});if(s)return i.jsxs(i.Fragment,{children:[i.jsx(RI,{terminalContainerRef:b,authUrl:E,authUrlVersion:S,initialCommand:r,isConnected:v,openAuthUrlInBrowser:T,copyAuthUrlToClipboard:C}),i.jsx(Yv,{wsRef:y,terminalRef:x,isConnected:v,bottomOffset:"bottom-0"})]});const U=n?c("shell.runCommand",{command:r||c("shell.defaultCommand"),projectName:e.displayName}):t?c("shell.resumeSession",{displayName:H}):c("shell.startSession"),V=n?c("shell.runCommand",{command:r||c("shell.defaultCommand"),projectName:e.displayName}):c("shell.startCli",{projectName:e.displayName}),O=w?k?"connecting":v?null:"connect":"loading",G=O==="connecting"?V:U;return i.jsxs("div",{className:"flex h-full w-full flex-col bg-gray-900",children:[i.jsx(II,{isConnected:v,isInitialized:w,isRestarting:d,hasSession:!!t,sessionDisplayNameShort:P,onDisconnect:_,onRestart:z,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:d||v}),i.jsxs("div",{className:"relative flex-1 overflow-hidden p-2",children:[i.jsx("div",{ref:b,className:"h-full w-full focus:outline-none",style:{outline:"none"}}),O&&i.jsx(jI,{mode:O,description:G,loadingLabel:c("shell.loading"),connectLabel:c("shell.actions.connect"),connectTitle:c("shell.actions.connectTitle"),connectingLabel:c("shell.connecting"),onConnect:j}),p&&v&&i.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:$=>$.preventDefault(),children:i.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[p.map($=>i.jsxs("button",{type:"button",onClick:()=>{I($.number),f(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:`${$.number}. ${$.label}`,children:[$.number,". ",$.label]},$.number)),i.jsx("button",{type:"button",onClick:()=>{I("\x1B"),f(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"})]})})]}),i.jsx(Yv,{wsRef:y,terminalRef:x,isConnected:v})]})}function tO({className:e}){return i.jsx("div",{className:`flex h-full items-center justify-center ${e}`,children:i.jsxs("div",{className:"text-center text-gray-500 dark:text-gray-400",children:[i.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:i.jsx("svg",{className:"h-8 w-8 text-gray-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:i.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"})})}),i.jsx("h3",{className:"mb-2 text-lg font-semibold",children:"No Project Selected"}),i.jsx("p",{children:"A project is required to open a shell"})]})})}function rO({title:e,isCompleted:t,onClose:r=null}){return i.jsx("div",{className:"flex-shrink-0 border-b border-gray-700 bg-gray-800 px-4 py-2",children:i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsxs("div",{className:"flex items-center space-x-2",children:[i.jsx("h3",{className:"text-sm font-medium text-gray-200",children:e}),t&&i.jsx("span",{className:"text-xs text-green-400",children:"(Completed)"})]}),r&&i.jsx("button",{onClick:r,className:"text-gray-400 hover:text-white",title:"Close",children:i.jsx("svg",{className:"h-4 w-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]})})}function _E({project:e=null,session:t=null,command:r=null,isPlainShell:n=null,isActive:a=!0,autoConnect:s=!0,onComplete:o=null,onClose:l=null,title:c=null,className:d="",showHeader:u=!0,compact:p=!1,minimal:f=!1}){const[m,g]=h.useState(!1),b=n!==null?n:r!==null,x=h.useCallback(y=>{g(!0),o?.(y)},[o]);return e?i.jsxs("div",{className:`flex h-full w-full flex-col ${d}`,children:[!f&&u&&c&&i.jsx(rO,{title:c,isCompleted:m,onClose:l}),i.jsx("div",{className:"min-h-0 w-full flex-1",children:i.jsx(jE,{selectedProject:e,selectedSession:t,initialCommand:r,isPlainShell:b,isActive:a,onProcessComplete:x,minimal:f,autoConnect:f?!0:s})})]}):i.jsx(tO,{className:d})}const nO=(e,t)=>t||(e==="claude"?"claude --dangerously-skip-permissions /login":e==="cursor"?"cursor-agent login":e==="codex"?"codex login":e==="qwen"?"qwen auth":e==="opencode"?"opencode auth login":"gemini"),aO={claude:{keyLabel:"Anthropic API Key",keyExample:"sk-ant-...",supportsBaseUrl:!0,baseUrlExample:"https://api.anthropic.com",keyConsoleUrl:"https://console.anthropic.com/settings/keys",keyConsoleLabel:"Anthropic Console"},codex:{keyLabel:"OpenAI API Key",keyExample:"sk-...",supportsBaseUrl:!0,baseUrlExample:"https://api.openai.com/v1",keyConsoleUrl:"https://platform.openai.com/api-keys",keyConsoleLabel:"OpenAI Platform"},gemini:{keyLabel:"Gemini API Key",keyExample:"AI...",supportsBaseUrl:!1,keyConsoleUrl:"https://aistudio.google.com/app/apikey",keyConsoleLabel:"Google AI Studio"},qwen:{keyLabel:"OpenAI-Compatible API Key",keyExample:"sk-... or sk-sp-...",supportsBaseUrl:!0,baseUrlExample:"https://dashscope-intl.aliyuncs.com/compatible-mode/v1",keyConsoleUrl:"https://github.com/QwenLM/qwen-code",keyConsoleLabel:"Qwen Code Docs",notes:"Accepts any OpenAI-compatible endpoint — Alibaba Cloud, ModelScope, OpenRouter, self-hosted, etc."},opencode:{keyLabel:"Anthropic API Key (default backend)",keyExample:"sk-ant-...",supportsBaseUrl:!0,baseUrlExample:"https://api.anthropic.com",keyConsoleUrl:"https://console.anthropic.com/settings/keys",keyConsoleLabel:"Anthropic Console",notes:"OpenCode is multi-provider — this sets the Anthropic credentials. Switch providers via `opencode auth login` or opencode.json."}};function Zv({active:e,children:t,onClick:r}){return i.jsx("button",{onClick:r,className:`flex-1 border-b-2 px-4 py-2.5 text-sm font-medium transition-colors ${e?"border-primary text-foreground":"border-transparent text-muted-foreground hover:text-foreground"}`,children:t})}function iO({provider:e}){const[t,r]=h.useState(""),[n,a]=h.useState(!1),[s,o]=h.useState("idle"),[l,c]=h.useState(null),d=async()=>{const u=t.trim();if(u){a(!0),c(null),o("idle");try{const p=await ve(`/api/providers/${e}/oauth-paste`,{method:"POST",body:JSON.stringify({callbackUrl:u})}),f=await p.json().catch(()=>({}));if(!p.ok||!f?.success)throw new Error(f?.error||`Request failed (${p.status})`);o("ok"),r("")}catch(p){c(p?.message||"Forward failed"),o("error")}finally{a(!1)}}};return i.jsxs("div",{className:"mt-3 rounded-lg border border-border/60 bg-muted/30 p-3 text-sm",children:[i.jsx("div",{className:"mb-2 font-medium text-foreground",children:"Remote login? Paste the callback URL here"}),i.jsxs("p",{className:"mb-3 text-xs text-muted-foreground",children:["When the CLI shows ",i.jsx("code",{className:"rounded bg-background px-1 font-mono text-[11px]",children:"http://127.0.0.1:PORT/…"})," and your browser can't reach it (VPS setups), copy the failing URL from your address bar and paste it below. Pixcode forwards the token exchange to the CLI process on this host."]}),i.jsxs("div",{className:"flex gap-2",children:[i.jsx("input",{type:"url",value:t,onChange:u=>r(u.target.value),placeholder:"http://127.0.0.1:49312/callback?code=...",className:"flex-1 rounded-md border border-border bg-background px-3 py-2 font-mono text-xs text-foreground focus:border-primary focus:outline-none",onKeyDown:u=>{u.key==="Enter"&&d()}}),i.jsx("button",{onClick:()=>void d(),disabled:n||!t.trim(),className:"flex items-center gap-1.5 rounded-md bg-foreground px-3 py-2 text-xs font-medium text-background transition-opacity hover:opacity-90 disabled:opacity-40",children:n?i.jsx(Ot,{className:"h-3.5 w-3.5 animate-spin"}):"Forward"})]}),s==="ok"&&i.jsxs("div",{className:"mt-2 flex items-center gap-1.5 text-xs text-emerald-600 dark:text-emerald-400",children:[i.jsx(rr,{className:"h-3.5 w-3.5"})," Forwarded — check the terminal above for the completion message."]}),s==="error"&&l&&i.jsx("div",{className:"mt-2 text-xs text-red-600 dark:text-red-400",children:l})]})}function sO({provider:e,onSaved:t}){const r=aO[e],[n,a]=h.useState(""),[s,o]=h.useState(""),[l,c]=h.useState(!1),[d,u]=h.useState("idle"),[p,f]=h.useState(null);h.useEffect(()=>{let g=!1;return(async()=>{try{const x=await(await ve("/api/providers/credentials")).json().catch(()=>({}));if(g||!x?.success)return;const y=x.data?.[e];y?.baseUrl&&o(y.baseUrl)}catch{}})(),()=>{g=!0}},[e]);const m=async()=>{const g=n.trim();if(g){c(!0),f(null),u("idle");try{const b=await ve(`/api/providers/${e}/auth/api-key`,{method:"POST",body:JSON.stringify({apiKey:g,baseUrl:r.supportsBaseUrl&&s.trim()?s.trim():""})}),x=await b.json().catch(()=>({}));if(!b.ok||!x?.success)throw new Error(x?.error||`Request failed (${b.status})`);u("ok"),a(""),t()}catch(b){f(b?.message||"Save failed"),u("error")}finally{c(!1)}}};return r?i.jsx("div",{className:"flex h-full flex-col overflow-y-auto p-6",children:i.jsxs("div",{className:"mx-auto w-full max-w-lg space-y-5",children:[i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsx("div",{className:"flex h-10 w-10 items-center justify-center rounded-full bg-muted",children:i.jsx(FD,{className:"h-5 w-5 text-foreground"})}),i.jsxs("div",{children:[i.jsx("h4",{className:"text-base font-semibold text-foreground",children:r.keyLabel}),i.jsxs("a",{href:r.keyConsoleUrl,target:"_blank",rel:"noreferrer",className:"inline-flex items-center gap-1 text-xs text-muted-foreground hover:text-foreground",children:["Get a key from ",r.keyConsoleLabel,i.jsx(Kr,{className:"h-3 w-3"})]})]})]}),r.notes&&i.jsx("div",{className:"rounded-md border border-border/60 bg-muted/40 p-3 text-xs text-muted-foreground",children:r.notes}),i.jsxs("div",{className:"space-y-1.5",children:[i.jsx("label",{className:"text-xs font-medium text-foreground",children:"API Key"}),i.jsx("input",{type:"password",value:n,onChange:g=>a(g.target.value),placeholder:r.keyExample,className:"w-full rounded-md border border-border bg-background px-3 py-2 font-mono text-sm text-foreground focus:border-primary focus:outline-none",autoComplete:"off",spellCheck:!1}),i.jsxs("p",{className:"text-[11px] text-muted-foreground",children:["Stored locally at ",i.jsx("code",{className:"rounded bg-muted px-1 font-mono text-[10px]",children:"~/.pixcode/provider-credentials.json"})," with 0600 permissions."]})]}),r.supportsBaseUrl&&i.jsxs("div",{className:"space-y-1.5",children:[i.jsxs("label",{className:"text-xs font-medium text-foreground",children:["Base URL ",i.jsx("span",{className:"font-normal text-muted-foreground",children:"(optional — use a custom endpoint)"})]}),i.jsx("input",{type:"url",value:s,onChange:g=>o(g.target.value),placeholder:r.baseUrlExample,className:"w-full rounded-md border border-border bg-background px-3 py-2 font-mono text-sm text-foreground focus:border-primary focus:outline-none",autoComplete:"off",spellCheck:!1}),i.jsx("p",{className:"text-[11px] text-muted-foreground",children:"Point at any OpenAI-compatible proxy (OpenRouter, local LLM, self-hosted, budget provider) to cut costs or hit different models."})]}),i.jsxs("div",{className:"flex items-center gap-3 pt-2",children:[i.jsxs("button",{onClick:()=>void m(),disabled:l||!n.trim(),className:"inline-flex items-center gap-2 rounded-md bg-foreground px-4 py-2 text-sm font-medium text-background transition-opacity hover:opacity-90 disabled:opacity-40",children:[l?i.jsx(Ot,{className:"h-4 w-4 animate-spin"}):i.jsx(rr,{className:"h-4 w-4"}),"Save API Key"]}),d==="ok"&&i.jsx("span",{className:"text-xs text-emerald-600 dark:text-emerald-400",children:"Saved — reconnect to pick it up."}),d==="error"&&p&&i.jsx("span",{className:"text-xs text-red-600 dark:text-red-400",children:p})]})]})}):i.jsx("div",{className:"p-6 text-sm text-muted-foreground",children:"This provider uses OAuth only — use the Browser tab to log in."})}function IE({isOpen:e,onClose:t,provider:r="claude",onComplete:n,customCommand:a,isAuthenticated:s=!1}){const{t:o}=Me("common"),l=r!=="cursor",[c,d]=h.useState(l?"apiKey":"browser");h.useEffect(()=>{e&&d(l?"apiKey":"browser")},[e,r,l]);const u=h.useMemo(()=>`${ul[r]??r} Login`,[r]);if(!e)return null;const p=nO(r,a),f=m=>n?.(m);return i.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:i.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:[i.jsxs("div",{className:"flex items-center justify-between border-b border-gray-200 p-4 dark:border-gray-700",children:[i.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white",children:u}),i.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:i.jsx(xt,{className:"h-6 w-6"})})]}),i.jsxs("div",{className:"flex border-b border-gray-200 dark:border-gray-700",children:[i.jsx(Zv,{active:c==="browser",onClick:()=>d("browser"),children:"Browser / OAuth"}),l&&i.jsx(Zv,{active:c==="apiKey",onClick:()=>d("apiKey"),children:"API Key"})]}),i.jsx("div",{className:"flex flex-1 flex-col overflow-hidden",children:c==="browser"?i.jsxs("div",{className:"flex flex-1 flex-col overflow-hidden",children:[i.jsx("div",{className:"min-h-0 flex-1",children:i.jsx(_E,{project:G_,command:p,onComplete:f,minimal:!0})}),i.jsx("div",{className:"border-t border-border/40 bg-background/50 px-4 py-3",children:i.jsx(iO,{provider:r})})]}):i.jsx(sO,{provider:r,onSaved:()=>f(0)})})]})})}const oO=({className:e="w-5 h-5"})=>i.jsx("img",{src:"/icons/claude-ai-icon.svg",alt:"Claude",className:e}),lO=({className:e="w-5 h-5"})=>{const{isDarkMode:t}=Oa();return i.jsx("img",{src:t?"/icons/codex-white.svg":"/icons/codex.svg",alt:"Codex",className:e})},cO=({className:e="w-5 h-5"})=>{const{isDarkMode:t}=Oa();return i.jsx("img",{src:t?"/icons/cursor-white.svg":"/icons/cursor.svg",alt:"Cursor",className:e})},dO=({className:e="w-5 h-5"})=>i.jsx("img",{src:"/icons/gemini-ai-icon.svg",alt:"Gemini",className:e}),uO=({className:e="w-5 h-5"})=>{const{isDarkMode:t}=Oa(),r=t?"/icons/opencode-logo-dark.svg":"/icons/opencode-logo-light.svg";return i.jsx("img",{src:r,alt:"OpenCode",className:e})},pO=({className:e="w-5 h-5"})=>i.jsx("img",{src:"/icons/qwen-logo.svg",alt:"Qwen Code",className:e});function dr({provider:e="claude",className:t="w-5 h-5"}){return e==="cursor"?i.jsx(cO,{className:t}):e==="codex"?i.jsx(lO,{className:t}):e==="gemini"?i.jsx(dO,{className:t}):e==="qwen"?i.jsx(pO,{className:t}):e==="opencode"?i.jsx(uO,{className:t}):i.jsx(oO,{className:t})}function mO({provider:e,title:t,status:r,connectedClassName:n,iconContainerClassName:a,loginButtonClassName:s,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 i.jsx("div",{className:`rounded-lg border p-4 transition-colors ${l}`,children:i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsx("div",{className:`flex h-10 w-10 items-center justify-center rounded-full ${a}`,children:i.jsx(dr,{provider:e,className:"h-5 w-5"})}),i.jsxs("div",{children:[i.jsxs("div",{className:"flex items-center gap-2 font-medium text-foreground",children:[t,r.authenticated&&i.jsx(rr,{className:"h-4 w-4 text-green-500"})]}),i.jsx("div",{className:"text-xs text-muted-foreground",children:c})]})]}),!r.authenticated&&!r.loading&&i.jsx("button",{onClick:o,className:`${s} rounded-lg px-4 py-2 text-sm font-medium text-white transition-colors`,children:"Login"})]})})}const hO=[{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"},{provider:"qwen",title:"Qwen Code",connectedClassName:"bg-orange-50 dark:bg-orange-900/20 border-orange-200 dark:border-orange-800",iconContainerClassName:"bg-orange-100 dark:bg-orange-900/30",loginButtonClassName:"bg-orange-600 hover:bg-orange-700"}];function fO({providerStatuses:e,onOpenProviderLogin:t}){return i.jsxs("div",{className:"space-y-6",children:[i.jsxs("div",{className:"mb-6 text-center",children:[i.jsx("h2",{className:"mb-2 text-2xl font-bold text-foreground",children:"Connect Your AI Agents"}),i.jsx("p",{className:"text-muted-foreground",children:"Login to one or more AI coding assistants. All are optional."})]}),i.jsx("div",{className:"space-y-3",children:hO.map(r=>i.jsx(mO,{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))}),i.jsx("div",{className:"pt-2 text-center text-sm text-muted-foreground",children:i.jsx("p",{children:"You can configure these later in Settings."})})]})}function gO({gitName:e,gitEmail:t,isSubmitting:r,onGitNameChange:n,onGitEmailChange:a}){return i.jsxs("div",{className:"space-y-6",children:[i.jsxs("div",{className:"mb-8 text-center",children:[i.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:i.jsx(Qr,{className:"h-8 w-8 text-blue-600 dark:text-blue-400"})}),i.jsx("h2",{className:"mb-2 text-2xl font-bold text-foreground",children:"Git Configuration"}),i.jsx("p",{className:"text-muted-foreground",children:"Configure your git identity to ensure proper attribution for commits."})]}),i.jsxs("div",{className:"space-y-4",children:[i.jsxs("div",{children:[i.jsxs("label",{htmlFor:"gitName",className:"mb-2 flex items-center gap-2 text-sm font-medium text-foreground",children:[i.jsx(PD,{className:"h-4 w-4"}),"Git Name ",i.jsx("span",{className:"text-red-500",children:"*"})]}),i.jsx("input",{type:"text",id:"gitName",value:e,onChange:s=>n(s.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}),i.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:"Saved as `git config --global user.name`."})]}),i.jsxs("div",{children:[i.jsxs("label",{htmlFor:"gitEmail",className:"mb-2 flex items-center gap-2 text-sm font-medium text-foreground",children:[i.jsx(OD,{className:"h-4 w-4"}),"Git Email ",i.jsx("span",{className:"text-red-500",children:"*"})]}),i.jsx("input",{type:"email",id:"gitEmail",value:t,onChange:s=>a(s.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}),i.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:"Saved as `git config --global user.email`."})]})]})]})}const Xv=[{title:"Git Configuration",icon:Qr,required:!0},{title:"Connect Agents",icon:hE,required:!1},{title:"Task System",icon:Ef,required:!1}];function bO({currentStep:e}){return i.jsx("div",{className:"mb-8",children:i.jsx("div",{className:"flex items-center justify-between",children:Xv.map((t,r)=>{const n=r<e,a=r===e,s=t.icon;return i.jsxs("div",{className:"contents",children:[i.jsxs("div",{className:"flex flex-1 flex-col items-center",children:[i.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?i.jsx(rr,{className:"h-6 w-6"}):i.jsx(s,{className:"h-6 w-6"})}),i.jsxs("div",{className:"mt-2 text-center",children:[i.jsx("p",{className:`text-sm font-medium ${a?"text-foreground":"text-muted-foreground"}`,children:t.title}),t.required&&i.jsx("span",{className:"text-xs text-red-500",children:"Required"})]})]}),r<Xv.length-1&&i.jsx("div",{className:`mx-2 h-0.5 flex-1 transition-colors duration-200 ${n?"bg-green-500":"bg-border"}`})]},t.title)})})})}const xO=e=>e?e.installation?.isInstalled?e.installation.version?`TaskMaster CLI installed (${e.installation.version}).`:"TaskMaster CLI installed.":e.installation?.reason||"TaskMaster CLI is not installed yet.":"Checking TaskMaster installation...";function yO({enabled:e,onEnabledChange:t,onReadyChange:r}){const[n,a]=h.useState(null),[s,o]=h.useState(!0),[l,c]=h.useState(!1),[d,u]=h.useState([]),[p,f]=h.useState(""),m=h.useRef(null),g=!!n?.installation?.isInstalled,b=!!n?.mcpServer?.hasMCPServer,x=h.useMemo(()=>!e||g,[e,g]);h.useEffect(()=>{r(x)},[r,x]);const y=h.useCallback(async()=>{o(!0),f("");try{const w=await ve("/api/taskmaster/installation-status"),k=await w.json();a(k),w.ok||f(k.installation?.reason||"TaskMaster status check failed.")}catch(w){a(null),f(w instanceof Error?w.message:"TaskMaster status check failed.")}finally{o(!1)}},[]);h.useEffect(()=>(y(),()=>{m.current?.close(),m.current=null}),[y]);const v=h.useCallback(async()=>{c(!0),f(""),u([]);try{const w=await ve("/api/taskmaster/install",{method:"POST"}),k=await w.json();if(!w.ok||!k.success||!k.jobId)throw new Error(k.error||k.message||"TaskMaster install could not start.");const E=localStorage.getItem(Ud),S=E?`?token=${encodeURIComponent(E)}`:"",j=new EventSource(`/api/taskmaster/install/${encodeURIComponent(k.jobId)}/stream${S}`);m.current=j,j.addEventListener("log",_=>{const T=JSON.parse(_.data);u(C=>[...C,T].slice(-80))}),j.addEventListener("done",_=>{const T=JSON.parse(_.data);if(j.close(),m.current=null,c(!1),!T.success){f(T.error||T.message||"TaskMaster install failed.");return}y()}),j.onerror=()=>{j.close(),m.current=null,c(!1),f("TaskMaster install stream disconnected.")}}catch(w){c(!1),f(w instanceof Error?w.message:"TaskMaster install could not start.")}},[y]);return i.jsxs("div",{className:"space-y-6",children:[i.jsxs("div",{className:"space-y-2",children:[i.jsx("h2",{className:"text-2xl font-semibold text-foreground",children:"Task System"}),i.jsx("p",{className:"text-sm text-muted-foreground",children:"Decide whether Pixcode should enable TaskMaster-backed planning, kanban tasks, PRD parsing, and agent task execution from the start."})]}),i.jsxs("label",{className:"flex cursor-pointer items-start gap-3 rounded-lg border border-border bg-background p-4 transition-colors hover:bg-muted/40",children:[i.jsx("input",{type:"checkbox",checked:e,onChange:w=>t(w.target.checked),className:"mt-1 h-4 w-4"}),i.jsxs("span",{className:"min-w-0 space-y-1",children:[i.jsx("span",{className:"block text-sm font-medium text-foreground",children:"Enable TaskMaster features"}),i.jsx("span",{className:"block text-sm leading-6 text-muted-foreground",children:"This keeps the Tasks panel, PRD tools, and orchestration task sync available. You can change it later in Settings."})]})]}),e&&i.jsxs("div",{className:"space-y-4 rounded-lg border border-border bg-card p-4",children:[i.jsxs("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-start sm:justify-between",children:[i.jsxs("div",{className:"space-y-1",children:[i.jsxs("div",{className:"flex items-center gap-2",children:[g?i.jsx(ra,{className:"h-5 w-5 text-green-600"}):i.jsx(Gr,{className:"h-5 w-5 text-primary"}),i.jsx("h3",{className:"font-medium text-foreground",children:"TaskMaster CLI"})]}),i.jsx("p",{className:"text-sm text-muted-foreground",children:xO(n)}),g&&!b&&i.jsx("p",{className:"text-xs text-amber-600 dark:text-amber-400",children:"MCP server is not configured yet. Core task files work now; MCP can be connected later from Settings."})]}),i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("button",{type:"button",onClick:()=>void y(),disabled:s||l,className:"rounded-md border border-border px-3 py-2 text-sm text-foreground transition-colors hover:bg-muted disabled:cursor-not-allowed disabled:opacity-50",children:s?"Checking...":"Refresh"}),!g&&i.jsxs("button",{type:"button",onClick:()=>void v(),disabled:l,className:"inline-flex items-center gap-2 rounded-md bg-primary px-3 py-2 text-sm font-medium text-primary-foreground transition-colors hover:bg-primary/90 disabled:cursor-not-allowed disabled:opacity-60",children:[l&&i.jsx(Ot,{className:"h-4 w-4 animate-spin"}),l?"Installing...":"Install"]})]})]}),p&&i.jsx("div",{className:"rounded-md border border-red-300 bg-red-50 p-3 text-sm text-red-700 dark:border-red-800 dark:bg-red-950/30 dark:text-red-300",children:p}),d.length>0&&i.jsx("pre",{className:"max-h-48 overflow-auto rounded-md bg-black p-3 text-xs leading-5 text-green-200",children:d.map(w=>`${w.stream}> ${w.chunk}`).join("")})]})]})}const Jv=/^[^\s@]+@[^\s@]+\.[^\s@]+$/,Qv=async(e,t)=>{try{return(await e.json()).error||t}catch{return t}};function vO({onComplete:e}){const[t,r]=h.useState(0),[n,a]=h.useState(""),[s,o]=h.useState(""),[l,c]=h.useState(!1),[d,u]=h.useState(""),[p,f]=h.useState(null),[m,g]=h.useState(()=>{try{const A=localStorage.getItem("tasks-enabled");return A===null?!0:JSON.parse(A)!==!1}catch{return!0}}),[b,x]=h.useState(!1),{providerAuthStatus:y,checkProviderAuthStatus:v,refreshProviderAuthStatuses:w}=yf(),k=h.useRef(void 0),E=h.useCallback(async()=>{try{const A=await ve("/api/user/git-config");if(!A.ok)return;const I=await A.json();I.gitName&&a(I.gitName),I.gitEmail&&o(I.gitEmail)}catch(A){console.error("Error loading git config:",A)}},[]);h.useEffect(()=>{E(),w()},[E,w]),h.useEffect(()=>{const A=k.current;k.current=p,A!=null&&p===null&&w()},[p,w]);const S=A=>{f(A)},j=A=>{A===0&&p&&v(p)},_=async()=>{if(u(""),t!==0){r(A=>A+1);return}if(!n.trim()||!s.trim()){u("Both git name and email are required.");return}if(!Jv.test(s)){u("Please enter a valid email address.");return}c(!0);try{const A=await ve("/api/user/git-config",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({gitName:n,gitEmail:s})});if(!A.ok){const I=await Qv(A,"Failed to save git configuration");throw new Error(I)}r(I=>I+1)}catch(A){u(A instanceof Error?A.message:"Failed to save git configuration")}finally{c(!1)}},T=()=>{u(""),r(A=>A-1)},C=async()=>{if(m&&!b){u("Install TaskMaster or disable TaskMaster features to finish setup.");return}c(!0),u("");try{localStorage.setItem("tasks-enabled",JSON.stringify(m));const A=await ve("/api/user/complete-onboarding",{method:"POST"});if(!A.ok){const I=await Qv(A,"Failed to complete onboarding");throw new Error(I)}await e?.()}catch(A){u(A instanceof Error?A.message:"Failed to complete onboarding")}finally{c(!1)}},L=t===0?!!(n.trim()&&s.trim()&&Jv.test(s)):t===2?!m||b:!0;return i.jsxs(i.Fragment,{children:[i.jsx("div",{className:"flex min-h-screen items-center justify-center bg-background p-4",children:i.jsxs("div",{className:"w-full max-w-2xl",children:[i.jsx(bO,{currentStep:t}),i.jsxs("div",{className:"rounded-lg border border-border bg-card p-8 shadow-lg",children:[t===0?i.jsx(gO,{gitName:n,gitEmail:s,isSubmitting:l,onGitNameChange:a,onGitEmailChange:o}):t===1?i.jsx(fO,{providerStatuses:y,onOpenProviderLogin:S}):i.jsx(yO,{enabled:m,onEnabledChange:g,onReadyChange:x}),d&&i.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:i.jsx("p",{className:"text-sm text-red-700 dark:text-red-400",children:d})}),i.jsxs("div",{className:"mt-8 flex items-center justify-between border-t border-border pt-6",children:[i.jsxs("button",{onClick:T,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:[i.jsx(Sf,{className:"h-4 w-4"}),"Previous"]}),i.jsx("div",{className:"flex items-center gap-3",children:t<2?i.jsx("button",{onClick:_,disabled:!L||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?i.jsxs(i.Fragment,{children:[i.jsx(Ot,{className:"h-4 w-4 animate-spin"}),"Saving..."]}):i.jsxs(i.Fragment,{children:["Next",i.jsx(An,{className:"h-4 w-4"})]})}):i.jsx("button",{onClick:C,disabled:l,className:"flex items-center gap-2 rounded-lg bg-green-600 px-6 py-3 font-medium text-white transition-colors duration-200 hover:bg-green-700 disabled:cursor-not-allowed disabled:bg-green-400",children:l?i.jsxs(i.Fragment,{children:[i.jsx(Ot,{className:"h-4 w-4 animate-spin"}),"Completing..."]}):i.jsxs(i.Fragment,{children:[i.jsx(rr,{className:"h-4 w-4"}),"Complete Setup"]})})})]})]})]})}),p&&i.jsx(IE,{isOpen:!!p,onClose:()=>f(null),provider:p,onComplete:j})]})}const wO=["0s","0.1s","0.2s"];function kO(){return i.jsx("div",{className:"flex min-h-screen items-center justify-center bg-background p-4",children:i.jsxs("div",{className:"text-center",children:[i.jsx("div",{className:"mb-4 flex justify-center",children:i.jsx("div",{className:"flex h-16 w-16 items-center justify-center rounded-lg bg-primary shadow-sm",children:i.jsx(na,{className:"h-8 w-8 text-primary-foreground"})})}),i.jsx("h1",{className:"mb-2 text-2xl font-bold text-foreground",children:"Pixcode"}),i.jsx("div",{className:"flex items-center justify-center space-x-2",children:wO.map(e=>i.jsx("div",{className:"h-2 w-2 animate-bounce rounded-full bg-blue-500",style:{animationDelay:e}},e))}),i.jsx("p",{className:"mt-2 text-muted-foreground",children:"Loading..."})]})})}function RE({errorMessage:e}){return e?i.jsx("div",{className:"rounded-md border border-red-300 bg-red-100 p-3 dark:border-red-800 dark:bg-red-900/20",children:i.jsx("p",{className:"text-sm text-red-700 dark:text-red-400",children:e})}):null}function Ii({id:e,label:t,value:r,onChange:n,placeholder:a,isDisabled:s,type:o="text",name:l,autoComplete:c}){return i.jsxs("div",{children:[i.jsx("label",{htmlFor:e,className:"mb-1 block text-sm font-medium text-foreground",children:t}),i.jsx("input",{id:e,type:o,name:l??e,autoComplete:c,value:r,onChange:d=>n(d.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:s})]})}function LE({title:e,description:t,children:r,footerText:n,logo:a}){return i.jsx("div",{className:"flex min-h-screen items-center justify-center bg-background p-4",children:i.jsx("div",{className:"w-full max-w-md",children:i.jsxs("div",{className:"space-y-6 rounded-lg border border-border bg-card p-8 shadow-lg",children:[i.jsxs("div",{className:"text-center",children:[i.jsx("div",{className:"mb-4 flex justify-center",children:a??i.jsx("div",{className:"flex h-16 w-16 items-center justify-center rounded-lg bg-primary shadow-sm",children:i.jsx(na,{className:"h-8 w-8 text-primary-foreground"})})}),i.jsx("h1",{className:"text-2xl font-bold text-foreground",children:e}),i.jsx("p",{className:"mt-2 text-muted-foreground",children:t})]}),r,i.jsx("div",{className:"text-center",children:i.jsx("p",{className:"text-sm text-muted-foreground",children:n})}),i.jsxs("div",{className:"flex items-center justify-center gap-1.5 pt-2",children:[i.jsx("svg",{className:"h-3.5 w-3.5 text-muted-foreground/50",fill:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:i.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"})}),i.jsx("a",{href:"https://github.com/alicomert/pixcode",target:"_blank",rel:"noopener noreferrer",className:"text-xs text-muted-foreground/50 transition-colors hover:text-muted-foreground",children:"Pixcode is open source"})]})]})})})}const SO={username:"",password:""};function EO(){const{t:e}=Me("auth"),{login:t}=Ki(),[r,n]=h.useState(SO),[a,s]=h.useState(""),[o,l]=h.useState(!1),c=h.useCallback((u,p)=>{n(f=>({...f,[u]:p}))},[]),d=h.useCallback(async u=>{if(u.preventDefault(),s(""),!r.username.trim()||!r.password){s(e("login.errors.requiredFields"));return}l(!0);const p=await t(r.username.trim(),r.password);p.success||s(p.error),l(!1)},[r.password,r.username,t,e]);return i.jsx(LE,{title:e("login.title"),description:e("login.description"),footerText:"Enter your credentials to access Pixcode",children:i.jsxs("form",{onSubmit:d,className:"space-y-4",children:[i.jsx(Ii,{id:"username",label:e("login.username"),value:r.username,onChange:u=>c("username",u),placeholder:e("login.placeholders.username"),isDisabled:o,autoComplete:"username"}),i.jsx(Ii,{id:"password",label:e("login.password"),value:r.password,onChange:u=>c("password",u),placeholder:e("login.placeholders.password"),isDisabled:o,type:"password",autoComplete:"current-password"}),i.jsx(RE,{errorMessage:a}),i.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 NO={username:"",password:"",confirmPassword:"",connectionMode:"local",remoteUrl:"",remoteApiKey:""};function CO(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.":e.connectionMode==="remote"&&!e.remoteUrl.trim()?"Remote Pixcode server URL is required.":null}function AO(){const{register:e}=Ki(),[t,r]=h.useState(NO),[n,a]=h.useState(""),[s,o]=h.useState(!1),l=h.useCallback((d,u)=>{r(p=>({...p,[d]:u}))},[]),c=h.useCallback(async d=>{d.preventDefault(),a("");const u=CO(t);if(u){a(u);return}o(!0);const p=await fetch("/api/auth/connection-mode",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({mode:t.connectionMode,remoteUrl:t.connectionMode==="remote"?t.remoteUrl.trim():null,apiKey:t.connectionMode==="remote"?t.remoteApiKey.trim():null})});if(!p.ok){const m=await p.json().catch(()=>null);a(m?.error||"Could not save connection mode."),o(!1);return}const f=await e(t.username.trim(),t.password);f.success||a(f.error),o(!1)},[t,e]);return i.jsx(LE,{title:"Welcome to Pixcode",description:"Set up your account to get started",footerText:"This is a single-user system. Only one account can be created.",logo:i.jsx("img",{src:"/logo.svg",alt:"Pixcode",className:"h-16 w-16"}),children:i.jsxs("form",{onSubmit:c,className:"space-y-4",children:[i.jsxs("div",{className:"grid gap-2 rounded-lg border border-border/70 bg-muted/30 p-2 sm:grid-cols-2",children:[i.jsxs("button",{type:"button",onClick:()=>l("connectionMode","local"),disabled:s,className:`rounded-md px-3 py-2 text-left text-sm transition-colors ${t.connectionMode==="local"?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:bg-background/60 hover:text-foreground"}`,children:[i.jsx("span",{className:"block font-medium",children:"Use this computer directly"}),i.jsx("span",{className:"block text-xs opacity-80",children:"Run Pixcode and CLIs on this machine."})]}),i.jsxs("button",{type:"button",onClick:()=>l("connectionMode","remote"),disabled:s,className:`rounded-md px-3 py-2 text-left text-sm transition-colors ${t.connectionMode==="remote"?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:bg-background/60 hover:text-foreground"}`,children:[i.jsx("span",{className:"block font-medium",children:"Connect to a remote Pixcode server"}),i.jsx("span",{className:"block text-xs opacity-80",children:"Control another always-on Pixcode host by API."})]})]}),t.connectionMode==="remote"&&i.jsxs("div",{className:"space-y-3 rounded-lg border border-border/70 bg-muted/20 p-3",children:[i.jsx(Ii,{id:"remoteUrl",name:"remoteUrl",label:"Remote API URL",value:t.remoteUrl,onChange:d=>l("remoteUrl",d),placeholder:"https://your-server.example.com",isDisabled:s,autoComplete:"url"}),i.jsx(Ii,{id:"remoteApiKey",name:"remoteApiKey",label:"Remote API Key",value:t.remoteApiKey,onChange:d=>l("remoteApiKey",d),placeholder:"px_...",isDisabled:s,type:"password",autoComplete:"off"})]}),i.jsx(Ii,{id:"username",name:"username",label:"Username",value:t.username,onChange:d=>l("username",d),placeholder:"Enter your username",isDisabled:s,autoComplete:"username"}),i.jsx(Ii,{id:"password",name:"password",label:"Password",value:t.password,onChange:d=>l("password",d),placeholder:"Enter your password",isDisabled:s,type:"password",autoComplete:"new-password"}),i.jsx(Ii,{id:"confirmPassword",name:"confirmPassword",label:"Confirm Password",value:t.confirmPassword,onChange:d=>l("confirmPassword",d),placeholder:"Confirm your password",isDisabled:s,type:"password",autoComplete:"new-password"}),i.jsx(RE,{errorMessage:n}),i.jsx("button",{type:"submit",disabled:s,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:s?"Setting up...":"Create Account"})]})})}function TO({children:e}){const{user:t,isLoading:r,needsSetup:n,hasCompletedOnboarding:a,refreshOnboardingStatus:s}=Ki();return r?i.jsx(kO,{}):n?i.jsx(AO,{}):t?a?i.jsx(i.Fragment,{children:e}):i.jsx(vO,{onComplete:s}):i.jsx(EO,{})}const DE=h.createContext(null),OE=()=>{const e=h.useContext(DE);if(!e)throw new Error("useWebSocket must be used within a WebSocketProvider");return e},jO=e=>{const t=window.location.protocol==="https:"?"wss:":"ws:";return e?`${t}//${window.location.host}/ws?token=${encodeURIComponent(e)}`:null},_O=()=>{const e=h.useRef(null),t=h.useRef(!1),r=h.useRef(!1),[n,a]=h.useState(null),[s,o]=h.useState(!1),l=h.useRef(null),{token:c}=Ki(),d=h.useCallback(()=>{if(!t.current)try{const f=jO(c);if(!f)return console.warn("No authentication token found for WebSocket connection");const m=new WebSocket(f);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||d()},3e3)},m.onerror=g=>{console.error("WebSocket error:",g)}}catch(f){console.error("Error creating WebSocket connection:",f)}},[c]);h.useEffect(()=>(d(),()=>{t.current=!0,l.current&&clearTimeout(l.current),e.current&&e.current.close()}),[d]);const u=h.useCallback(f=>{const m=e.current;m&&m.readyState===WebSocket.OPEN?m.send(JSON.stringify(f)):console.warn("WebSocket not connected")},[]);return h.useMemo(()=>({ws:e.current,sendMessage:u,latestMessage:n,isConnected:s}),[u,n,s])},IO=({children:e})=>{const t=_O();return i.jsx(DE.Provider,{value:t,children:e})},ME=h.createContext(null);function RO(e,t){return{message:t instanceof Error?t.message:`Failed to ${e}`,context:e,timestamp:new Date().toISOString()}}function ew(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 LO(e){return e.find(t=>t.status==="pending"||t.status==="in-progress")??null}function DO(e){return e?.type?e.type.startsWith("taskmaster-"):!1}function eo(){const e=h.useContext(ME);if(!e)throw new Error("useTaskMaster must be used within a TaskMasterProvider");return e}function OO({children:e}){const{latestMessage:t}=OE(),{user:r,token:n,isLoading:a}=Ki(),[s,o]=h.useState([]),[l,c]=h.useState(null),[d,u]=h.useState(null),[p,f]=h.useState(null),[m,g]=h.useState([]),[b,x]=h.useState(null),[y,v]=h.useState(!1),[w,k]=h.useState(!1),[E,S]=h.useState(!1),[j,_]=h.useState(null),T=h.useRef(null);h.useEffect(()=>{T.current=l?.name??null},[l?.name]);const C=h.useCallback(()=>{_(null)},[]),L=h.useCallback((z,U)=>{console.error(`TaskMaster ${z} error:`,U),_(RO(z,U))},[]),A=h.useCallback(z=>{const U=z?ew(z):null;c(U),u(U?.taskmaster??null),g([]),x(null)},[]),I=h.useCallback(async()=>{if(!r||!n){o([]),c(null),u(null),g([]),x(null);return}try{v(!0),C();const z=await ot.get("/projects");if(!z.ok)throw new Error(`Failed to fetch projects: ${z.status}`);const U=await z.json(),O=(Array.isArray(U)?U:[]).map(F=>ew(F));o(O);const G=T.current;if(!G)return;const $=O.find(F=>F.name===G)??null;c($),u($?.taskmaster??null)}catch(z){L("load projects",z)}finally{v(!1)}},[C,L,n,r]),N=h.useCallback(async()=>{const z=l?.name;if(!z||!r||!n){g([]),x(null);return}try{k(!0),C();const U=await ot.get(`/taskmaster/tasks/${encodeURIComponent(z)}`);if(!U.ok){const G=await U.json();throw new Error(G.message??"Failed to load tasks")}const V=await U.json(),O=Array.isArray(V.tasks)?V.tasks:[];g(O),x(LO(O))}catch(U){L("load tasks",U),g([]),x(null)}finally{k(!1)}},[C,l?.name,L,n,r]),P=h.useCallback(async()=>{if(!r||!n){f(null);return}try{S(!0),C();const z=await ot.get("/mcp-utils/taskmaster-server");if(!z.ok)throw new Error(`Failed to load MCP status: ${z.status}`);const U=await z.json();f(U)}catch(z){L("check MCP server status",z),f(null)}finally{S(!1)}},[C,L,n,r]);h.useEffect(()=>{!a&&r&&n&&(I(),P())},[a,P,I,n,r]),h.useEffect(()=>{l?.name&&r&&n&&N()},[l?.name,N,n,r]),h.useEffect(()=>{const z=t;if(DO(z)){if(z.type==="taskmaster-project-updated"&&z.projectName){I();return}if(z.type==="taskmaster-tasks-updated"&&z.projectName===l?.name){N();return}z.type==="taskmaster-mcp-status-changed"&&P()}},[l?.name,t,P,I,N]);const H=h.useMemo(()=>({projects:s,currentProject:l,projectTaskMaster:d,mcpServerStatus:p,tasks:m,nextTask:b,isLoading:y,isLoadingTasks:w,isLoadingMCP:E,error:j,refreshProjects:I,setCurrentProject:A,refreshTasks:N,refreshMCPStatus:P,clearError:C}),[C,l,j,y,E,w,p,b,d,s,P,I,N,A,m]);return i.jsx(ME.Provider,{value:H,children:e})}const PE=h.createContext({tasksEnabled:!0,setTasksEnabled:()=>{},toggleTasksEnabled:()=>{},isTaskMasterInstalled:null,isTaskMasterReady:null,installationStatus:null,isCheckingInstallation:!0,refreshTaskMasterInstallation:async()=>{}}),Kd=()=>{const e=h.useContext(PE);if(!e)throw new Error("useTasksSettings must be used within a TasksSettingsProvider");return e},MO=({children:e})=>{const{user:t,token:r,isLoading:n}=Ki(),[a,s]=h.useState(()=>{const v=localStorage.getItem("tasks-enabled");return v!==null?JSON.parse(v):!0}),[o,l]=h.useState(null),[c,d]=h.useState(null),[u,p]=h.useState(null),[f,m]=h.useState(!0),g=!!(t&&r);h.useEffect(()=>{localStorage.setItem("tasks-enabled",JSON.stringify(a))},[a]);const b=h.useCallback(async({signal:v}={})=>{if(!n){if(!g){p(null),l(null),d(null),m(!1);return}m(!0);try{const w=await ot.get("/taskmaster/installation-status");if(v?.aborted)return;if(w.ok){const k=await w.json();if(v?.aborted)return;p(k),l(k.installation?.isInstalled||!1),d(k.isReady||!1);const E=localStorage.getItem("tasks-enabled");!k.installation?.isInstalled&&!E&&s(!1)}else console.error("Failed to check TaskMaster installation status"),l(!1),d(!1)}catch(w){if(v?.aborted)return;console.error("Error checking TaskMaster installation:",w),l(!1),d(!1)}finally{v?.aborted||m(!1)}}},[g,n]);h.useEffect(()=>{const v=new AbortController,w=setTimeout(()=>{b({signal:v.signal})},0);return()=>{v.abort(),clearTimeout(w)}},[b]);const y={tasksEnabled:a,setTasksEnabled:s,toggleTasksEnabled:()=>{s(v=>!v)},isTaskMasterInstalled:o,isTaskMasterReady:c,installationStatus:u,isCheckingInstallation:f,refreshTaskMasterInstallation:b};return i.jsx(PE.Provider,{value:y,children:e})},FE=h.createContext(null);function Yd(){const e=h.useContext(FE);if(!e)throw new Error("usePlugins must be used within a PluginsProvider");return e}function PO({children:e}){const{user:t,token:r,isLoading:n}=Ki(),[a,s]=h.useState([]),[o,l]=h.useState(!0),[c,d]=h.useState(null),u=!!(t&&r),p=h.useCallback(async()=>{if(!u){s([]),d(null),l(!1);return}l(!0);try{const x=await ve("/api/plugins");if(x.ok){const y=await x.json();s(y.plugins||[]),d(null)}else{let y=`Failed to fetch plugins (${x.status})`;try{const v=await x.json();y=v.details||v.error||y}catch{y=x.statusText||y}d(y)}}catch(x){const y=x instanceof Error?x.message:"Failed to fetch plugins";d(y),console.error("[Plugins] Failed to fetch plugins:",x)}finally{l(!1)}},[u]);h.useEffect(()=>{n||p()},[n,p]);const f=h.useCallback(async x=>{try{const y=await ve("/api/plugins/install",{method:"POST",body:JSON.stringify({url:x})}),v=await y.json();return y.ok?(await p(),{success:!0}):{success:!1,error:v.details||v.error||"Install failed"}}catch(y){return{success:!1,error:y instanceof Error?y.message:"Install failed"}}},[p]),m=h.useCallback(async x=>{try{const y=await ve(`/api/plugins/${encodeURIComponent(x)}`,{method:"DELETE"}),v=await y.json();return y.ok?(await p(),{success:!0}):{success:!1,error:v.details||v.error||"Uninstall failed"}}catch(y){return{success:!1,error:y instanceof Error?y.message:"Uninstall failed"}}},[p]),g=h.useCallback(async x=>{try{const y=await ve(`/api/plugins/${encodeURIComponent(x)}/update`,{method:"POST"}),v=await y.json();return y.ok?(await p(),{success:!0}):{success:!1,error:v.details||v.error||"Update failed"}}catch(y){return{success:!1,error:y instanceof Error?y.message:"Update failed"}}},[p]),b=h.useCallback(async(x,y)=>{try{const v=await ve(`/api/plugins/${encodeURIComponent(x)}/enable`,{method:"PUT",body:JSON.stringify({enabled:y})});if(!v.ok){let w=`Toggle failed (${v.status})`;try{const k=await v.json();w=k.details||k.error||w}catch{w=v.statusText||w}return{success:!1,error:w}}return await p(),{success:!0,error:null}}catch(v){return{success:!1,error:v instanceof Error?v.message:"Toggle failed"}}},[p]);return i.jsx(FE.Provider,{value:{plugins:a,loading:o,pluginsError:c,refreshPlugins:p,installPlugin:f,uninstallPlugin:m,updatePlugin:g,togglePlugin:b},children:e})}const tw=e=>typeof window>"u"?!1:window.innerWidth<e,rw=()=>{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 Lf(e={}){const{mobileBreakpoint:t=768,trackMobile:r=!0,trackPWA:n=!0}=e,[a,s]=h.useState(()=>r?tw(t):!1),[o,l]=h.useState(()=>n?rw():!1);return h.useEffect(()=>{if(!r||typeof window>"u")return;const c=()=>{s(tw(t))};return c(),window.addEventListener("resize",c),()=>{window.removeEventListener("resize",c)}},[t,r]),h.useEffect(()=>{if(!n||typeof window>"u")return;const c=window.matchMedia("(display-mode: standalone)"),d=()=>{l(rw())};return d(),typeof c.addEventListener=="function"?(c.addEventListener("change",d),()=>{c.removeEventListener("change",d)}):(c.addListener(d),()=>{c.removeListener(d)})},[n]),{isMobile:a,isPWA:o}}const Df="pixcode.updateCheck.preferences",Zm="pixcode:update-check-settings-changed",Of=[{value:"30m",label:"Every 30 minutes",intervalMs:1800*1e3},{value:"24h",label:"Daily",intervalMs:1440*60*1e3},{value:"12h",label:"Every 12 hours",intervalMs:720*60*1e3},{value:"6h",label:"Every 6 hours",intervalMs:360*60*1e3},{value:"7d",label:"Weekly",intervalMs:10080*60*1e3},{value:"off",label:"Manual only",intervalMs:null}],Xm={frequency:"30m"};function nw(e){return Of.find(t=>t.value===e.frequency)?.intervalMs??null}function zE(e){if(!e||typeof e!="object")return Xm;const t=e.frequency;return Of.some(r=>r.value===t)?{frequency:t}:Xm}function aw(){try{const e=localStorage.getItem(Df);return zE(e?JSON.parse(e):null)}catch{return Xm}}function FO(e){const t=zE(e);localStorage.setItem(Df,JSON.stringify(t)),window.dispatchEvent(new CustomEvent(Zm,{detail:t}))}const $u=(e,t)=>{const r=e.split(".").map(Number),n=t.split(".").map(Number);for(let a=0;a<Math.max(r.length,n.length);a++){const s=r[a]||0,o=n[a]||0;if(s!==o)return s-o}return 0},zO="1.40.8",Jm="pixcode:update-available",BO=360*60*1e3,Uu=new Map;function BE(e,t){return`pixcode.updateCheck.cache.${e}.${t}`}function $O(e,t){try{const r=localStorage.getItem(BE(e,t));if(!r)return null;const n=JSON.parse(r);return{fetchedAt:typeof n.fetchedAt=="number"?n.fetchedAt:null,latestVersion:typeof n.latestVersion=="string"?n.latestVersion:null,releaseInfo:n.releaseInfo??null,rateLimitedUntil:typeof n.rateLimitedUntil=="number"?n.rateLimitedUntil:void 0}}catch{return null}}function iw(e,t,r){localStorage.setItem(BE(e,t),JSON.stringify(r))}function UO(e,t){const r=`${e}/${t}`,n=Uu.get(r);if(n)return n;const a=fetch(`https://api.github.com/repos/${e}/${t}/releases/latest`,{cache:"no-store",headers:{Accept:"application/vnd.github+json"}}).then(async s=>({status:s.status,ok:s.ok,data:await s.json().catch(()=>({}))})).finally(()=>{Uu.delete(r)});return Uu.set(r,a),a}const $E=(e,t)=>{const[r,n]=h.useState(!1),[a,s]=h.useState(null),[o,l]=h.useState(null),[c,d]=h.useState("git"),[u,p]=h.useState("idle"),[f,m]=h.useState(null),[g,b]=h.useState(()=>aw()),[x,y]=h.useState(zO),v=h.useRef(null),w=h.useCallback(E=>{FO(E),b(E)},[]);h.useEffect(()=>{const E=()=>b(aw()),S=j=>{j.key===Df&&E()};return window.addEventListener("storage",S),window.addEventListener(Zm,E),()=>{window.removeEventListener("storage",S),window.removeEventListener(Zm,E)}},[]),h.useEffect(()=>{let E=!1;const S=async()=>{try{const T=await(await fetch("/health",{cache:"no-store"})).json();if(E)return;(T.installMode==="npm"||T.installMode==="git")&&d(T.installMode),typeof T.version=="string"&&/^\d+\.\d+\.\d+/.test(T.version)&&y(T.version)}catch{}};S();const j=()=>{S()};return window.addEventListener("focus",j),()=>{E=!0,window.removeEventListener("focus",j)}},[]),h.useEffect(()=>{if(!x)return;let E=!1;const S=(A,I,N,P)=>({updateAvailable:!!(A&&$u(A,x)>0),latestVersion:A,releaseInfo:I,currentVersion:x,checkedAt:N,status:P}),j=A=>{!A.updateAvailable||!A.latestVersion||!A.releaseInfo||window.dispatchEvent(new CustomEvent(Jm,{detail:A}))},_=(A,I,N,P="success")=>{if(!A||!I)return n(!1),s(null),l(null),m(N),S(null,null,N,P);s(A),n($u(A,x)>0),l(I),m(N);const H=S(A,I,N,P);return j(H),H},T=async({force:A=!1}={})=>{const I=nw(g),N=$O(e,t),P=Date.now();if(!A&&I===null)return p("idle"),_(N?.latestVersion??null,N?.releaseInfo??null,N?.fetchedAt??null,"idle");if(!A&&N?.fetchedAt&&I!==null&&P-N.fetchedAt<I)return p("success"),_(N.latestVersion,N.releaseInfo,N.fetchedAt,"success");if(!A&&N?.rateLimitedUntil&&N.rateLimitedUntil>P)return p("error"),_(N.latestVersion,N.releaseInfo,N.fetchedAt,"error");try{p("checking");const H=await UO(e,t);if(E)return S(N?.latestVersion??null,N?.releaseInfo??null,N?.fetchedAt??null,"idle");const z=H.data;if(!H.ok)return H.status===403&&iw(e,t,{fetchedAt:N?.fetchedAt??null,latestVersion:N?.latestVersion??null,releaseInfo:N?.releaseInfo??null,rateLimitedUntil:P+Math.max(I??0,BO)}),p("error"),_(N?.latestVersion??null,N?.releaseInfo??null,N?.fetchedAt??null,"error");if(z.tag_name){const U=z.tag_name.replace(/^v/,""),V=$u(U,x)>0,O={title:z.name||z.tag_name,body:z.body||"",htmlUrl:z.html_url||`https://github.com/${e}/${t}/releases/latest`,publishedAt:z.published_at||""};iw(e,t,{fetchedAt:P,latestVersion:U,releaseInfo:O}),s(U),n(V),V&&W4({key:`app-update:${U}`,title:"Pixcode update available",body:`Pixcode ${x} can update to ${U}.`,tag:"pixcode-app-update",data:{type:"app-update",latestVersion:U,installMode:c}}),l(O),p("success"),m(P);const G=S(U,O,P,"success");return j(G),G}else return n(!1),s(null),l(null),p("error"),S(null,null,null,"error")}catch(H){return console.error("Version check failed:",H),n(!1),s(null),l(null),p("error"),S(null,null,null,"error")}};v.current=T,T();const C=nw(g),L=C===null?null:window.setInterval(()=>{T()},C);return()=>{E=!0,L!==null&&window.clearInterval(L)}},[e,t,x,c,g]);const k=h.useCallback(async()=>v.current?await v.current({force:!0}):null,[]);return{updateAvailable:r,latestVersion:a,currentVersion:x,releaseInfo:o,installMode:c,checkStatus:u,lastCheckedAt:f,manualCheck:k,updateCheckPreferences:g,updatePreferences:w}},Ri={autoExpandTools:!1,showRawParameters:!1,showThinking:!0,autoScrollToBottom:!0,sendByCtrlEnter:!1,changeAwareness:!1,sidebarVisible:!0,historyView:"flat"},GO=["flat","grouped"],HO=e=>typeof e=="string"&&GO.includes(e),id=Object.keys(Ri),VO=new Set(id),Gu="ui-preferences:sync",qO=(e,t)=>{if(typeof e=="boolean")return e;if(typeof e=="string"){if(e==="true")return!0;if(e==="false")return!1}return t},sd=(e,t,r)=>e==="historyView"?HO(t)?t:r:qO(t,r),WO=(e,t)=>{try{const r=localStorage.getItem(e);if(r===null)return t;const n=JSON.parse(r);return sd(e,n,t)}catch{return t}},KO=e=>{if(typeof window>"u")return Ri;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 id.reduce((a,s)=>(a[s]=sd(s,n[s],Ri[s]),a),{...Ri})}}}catch{}return id.reduce((t,r)=>(t[r]=WO(r,Ri[r]),t),{...Ri})};function YO(e,t){switch(t.type){case"set":{const{key:r,value:n}=t;if(!VO.has(r))return e;const a=sd(r,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 s of id){if(!(s in r))continue;const o=r[s],l=sd(s,o,e[s]);a[s]!==l&&(a[s]=l,n=!0)}return n?a:e}case"reset":return{...Ri,...t.value||{}};default:return e}}function Mf(e="uiPreferences"){const t=h.useRef(`ui-preferences-${Math.random().toString(36).slice(2)}`),[r,n]=h.useReducer(YO,e,KO);return h.useEffect(()=>{typeof window>"u"||(localStorage.setItem(e,JSON.stringify(r)),window.dispatchEvent(new CustomEvent(Gu,{detail:{storageKey:e,sourceId:t.current,value:r}})))},[r,e]),h.useEffect(()=>{if(typeof window>"u")return;const l=u=>{!u||typeof u!="object"||Array.isArray(u)||n({type:"set_many",value:u})},c=u=>{if(!(u.key!==e||u.newValue===null))try{const p=JSON.parse(u.newValue);l(p)}catch{}},d=u=>{const f=u.detail;!f||f.storageKey!==e||f.sourceId===t.current||l(f.value)};return window.addEventListener("storage",c),window.addEventListener(Gu,d),()=>{window.removeEventListener("storage",c),window.removeEventListener(Gu,d)}},[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 ZO=()=>{try{const e=localStorage.getItem("claude-settings");return e&&JSON.parse(e).projectSortOrder==="date"?"date":"name"}catch{return"name"}},XO=()=>{try{const e=localStorage.getItem("starredProjects");return e?new Set(JSON.parse(e)):new Set}catch{return new Set}},JO=e=>{try{localStorage.setItem("starredProjects",JSON.stringify([...e]))}catch{}},sw=(e,t)=>`${e}::${t}`,QO=()=>{try{const e=localStorage.getItem("starredSessions");return e?new Set(JSON.parse(e)):new Set}catch{return new Set}},e9=e=>{try{localStorage.setItem("starredSessions",JSON.stringify([...e]))}catch{}},t9=/(?:^|[\s/\\(\[`"'])([\w./-]+?\.(?:ts|tsx|js|jsx|mjs|cjs|py|rb|go|rs|java|kt|swift|c|cc|cpp|h|hpp|cs|php|sh|bash|zsh|json|ya?ml|toml|md|mdx|html?|css|scss|less|sql|prisma|graphql|gql|vue|svelte|astro|dart|lua|r|pl|ps1|tf|dockerfile|env))(?:$|[\s:,)\]`"'])/i,r9=e=>{if(!e)return[];const t=new Set,r=new RegExp(t9.source,"gi");let n;for(;(n=r.exec(e))!==null;){const a=n[1],s=a.lastIndexOf(".");if(s>-1){const o=a.slice(s+1).toLowerCase();o&&o.length<=10&&t.add(o)}if(t.size>=3)break}return[...t]},Fi=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),n9=(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.__provider==="qwen"||e.__provider==="opencode"?e.summary||e.name||t("projects.newSession"):e.summary||t("projects.newSession"),a9=e=>e.__provider==="cursor"?String(e.createdAt||""):e.__provider==="codex"?String(e.createdAt||e.lastActivity||""):String(e.lastActivity||e.createdAt||""),i9=(e,t,r)=>{const n=Fi(e),a=Math.floor((t.getTime()-n.getTime())/(1e3*60));return{isCursorSession:e.__provider==="cursor",isCodexSession:e.__provider==="codex",isGeminiSession:e.__provider==="gemini",isQwenSession:e.__provider==="qwen",isOpencodeSession:e.__provider==="opencode",isActive:a<10,sessionName:n9(e,r),sessionTime:a9(e),messageCount:Number(e.messageCount||0)}},UE=(e,t)=>{const r=[...e.sessions||[],...t[e.name]||[]].map(g=>({...g,__provider:"claude"})),n=(e.cursorSessions||[]).map(g=>({...g,__provider:"cursor"})),a=(e.codexSessions||[]).map(g=>({...g,__provider:"codex"})),s=g=>typeof g.id=="string"&&g.id.startsWith("qwen_")||g.provider==="qwen",o=g=>typeof g.id=="string"&&g.id.startsWith("opencode_")||g.provider==="opencode",l=e.geminiSessions||[],c=l.filter(g=>!s(g)&&!o(g)).map(g=>({...g,__provider:"gemini"})),d=l.filter(g=>s(g)).map(g=>({...g,__provider:"qwen"})),u=l.filter(g=>o(g)).map(g=>({...g,__provider:"opencode"})),p=[...(e.qwenSessions||[]).map(g=>({...g,__provider:"qwen"})),...d],f=[...(e.opencodeSessions||[]).map(g=>({...g,__provider:"opencode"})),...u],m=new Map;for(const g of[...r,...n,...a,...c,...p,...f])m.has(g.id)||m.set(g.id,g);return[...m.values()].sort((g,b)=>Fi(b).getTime()-Fi(g).getTime())},ow=(e,t)=>{const r=UE(e,t);return r.length===0?new Date(0):r.reduce((n,a)=>{const s=Fi(a);return s>n?s:n},new Date(0))},s9=(e,t,r,n)=>{const a=[...e];return a.sort((s,o)=>{const l=r.has(s.name),c=r.has(o.name);return l&&!c?-1:!l&&c?1:t==="date"?ow(o,n).getTime()-ow(s,n).getTime():(s.displayName||s.name).localeCompare(o.displayName||o.name)}),a},o9=(e,t)=>{const r=t.trim().toLowerCase();return r?e.filter(n=>{const a=(n.displayName||n.name).toLowerCase(),s=n.name.toLowerCase();return a.includes(r)||s.includes(r)}):e},l9=(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"},c9=e=>{const t=typeof e.fullPath=="string"&&e.fullPath.length>0?e.fullPath:typeof e.path=="string"?e.path:"";return{name:e.name,displayName:typeof e.displayName=="string"&&e.displayName.trim().length>0?e.displayName:e.name,fullPath:t,path:typeof e.path=="string"&&e.path.length>0?e.path:t}};function d9({projects:e,selectedProject:t,selectedSession:r,isLoading:n,isMobile:a,t:s,onRefresh:o,onProjectSelect:l,onSessionSelect:c,onSessionDelete:d,onProjectDelete:u,setCurrentProject:p,setSidebarVisible:f,sidebarVisible:m}){const[g,b]=h.useState(new Set),[x,y]=h.useState(null),[v,w]=h.useState(!1),[k,E]=h.useState(""),[S,j]=h.useState({}),[_,T]=h.useState({}),[C,L]=h.useState(new Set),[A,I]=h.useState(new Date),[N,P]=h.useState("name"),[H,z]=h.useState(!1),[U,V]=h.useState({}),[O,G]=h.useState(null),[$,F]=h.useState(""),[te,Q]=h.useState(""),[ge,ae]=h.useState(new Set),[me,pe]=h.useState(null),[be,Ne]=h.useState(null),[xe,Be]=h.useState(!1),[M,de]=h.useState(()=>XO()),[ce,Y]=h.useState(()=>QO()),[W,ne]=h.useState("projects"),[fe,ye]=h.useState(null),[se,Se]=h.useState(!1),[re,X]=h.useState(null),Z=h.useRef(null),le=h.useRef(0),Ee=h.useRef(null),Te=!a&&!m;h.useEffect(()=>{const Ce=setInterval(()=>{I(new Date)},6e4);return()=>clearInterval(Ce)},[]),h.useEffect(()=>{T({}),L(new Set),V({})},[e]),h.useEffect(()=>{t&&b(Ce=>{if(Ce.has(t.name))return Ce;const Oe=new Set(Ce);return Oe.add(t.name),Oe})},[r,t]),h.useEffect(()=>{if(e.length>0&&!n){const Ce=new Set;e.forEach(Oe=>{Oe.sessions&&Oe.sessions.length>=0&&Ce.add(Oe.name)}),L(Ce)}},[e,n]),h.useEffect(()=>{const Ce=()=>{P(ZO())};Ce();const Oe=Ge=>{Ge.key==="claude-settings"&&Ce()},ct=()=>Ce();return window.addEventListener("storage",Oe),window.addEventListener("pixcode:settings-changed",ct),()=>{window.removeEventListener("storage",Oe),window.removeEventListener("pixcode:settings-changed",ct)}},[]),h.useEffect(()=>{Z.current&&clearTimeout(Z.current),Ee.current&&(Ee.current.close(),Ee.current=null);const Ce=te.trim();if(W!=="conversations"||Ce.length<2){le.current+=1,ye(null),X(null),Se(!1);return}Se(!0);const Oe=++le.current;return Z.current=setTimeout(()=>{if(Oe!==le.current)return;const ct=ot.searchConversationsUrl(Ce),Ge=new EventSource(ct);Ee.current=Ge;const He=[];let je=0;Ge.addEventListener("result",Ue=>{if(Oe!==le.current){Ge.close();return}try{const Fe=JSON.parse(Ue.data);He.push(Fe.projectResult),je=Fe.totalMatches,ye({results:[...He],totalMatches:je,query:Ce}),X({scannedProjects:Fe.scannedProjects,totalProjects:Fe.totalProjects})}catch{}}),Ge.addEventListener("progress",Ue=>{if(Oe!==le.current){Ge.close();return}try{const Fe=JSON.parse(Ue.data);je=Fe.totalMatches,X({scannedProjects:Fe.scannedProjects,totalProjects:Fe.totalProjects})}catch{}}),Ge.addEventListener("done",()=>{if(Oe!==le.current){Ge.close();return}Ge.close(),Ee.current=null,Se(!1),X(null),He.length===0&&ye({results:[],totalMatches:0,query:Ce})}),Ge.addEventListener("error",()=>{if(Oe!==le.current){Ge.close();return}Ge.close(),Ee.current=null,Se(!1),X(null),He.length===0&&ye({results:[],totalMatches:0,query:Ce})})},400),()=>{Z.current&&clearTimeout(Z.current),Ee.current&&(Ee.current.close(),Ee.current=null)}},[te,W]);const Ke=h.useCallback(Ce=>{b(Oe=>{const ct=new Set;return Oe.has(Ce)||ct.add(Ce),ct})},[]),Ze=h.useCallback((Ce,Oe)=>{c({...Ce,__projectName:Oe})},[c]),vt=h.useCallback(Ce=>{de(Oe=>{const ct=new Set(Oe);return ct.has(Ce)?ct.delete(Ce):ct.add(Ce),JO(ct),ct})},[]),Qe=h.useCallback(Ce=>M.has(Ce),[M]),jt=h.useCallback((Ce,Oe)=>{Y(ct=>{const Ge=sw(Ce,Oe),He=new Set(ct);return He.has(Ge)?He.delete(Ge):He.add(Ge),e9(He),He})},[]),wt=h.useCallback((Ce,Oe)=>ce.has(sw(Ce,Oe)),[ce]),st=h.useCallback(Ce=>UE(Ce,_),[_]),lt=h.useMemo(()=>e.map(Ce=>{const Oe=U[Ce.name];return Oe===void 0?Ce:{...Ce,sessionMeta:{...Ce.sessionMeta,hasMore:Oe}}}),[U,e]),kt=h.useMemo(()=>s9(lt,N,M,_),[_,N,lt,M]),_t=h.useMemo(()=>o9(kt,te),[te,kt]),At=h.useCallback(Ce=>{y(Ce.name),E(Ce.displayName)},[]),pr=h.useCallback(()=>{y(null),E("")},[]),nr=h.useCallback(async Ce=>{try{(await ot.renameProject(Ce,k)).ok?window.refreshProjects?await window.refreshProjects():window.location.reload():console.error("Failed to rename project")}catch(Oe){console.error("Error renaming project:",Oe)}finally{y(null),E("")}},[k]),Xt=h.useCallback((Ce,Oe,ct,Ge="claude")=>{Ne({projectName:Ce,sessionId:Oe,sessionTitle:ct,provider:Ge})},[]),zr=h.useCallback(async()=>{if(!be)return;const{projectName:Ce,sessionId:Oe,provider:ct}=be;Ne(null);try{let Ge;if(ct==="codex"?Ge=await ot.deleteCodexSession(Oe):ct==="gemini"?Ge=await ot.deleteGeminiSession(Oe):ct==="qwen"?Ge=await ot.deleteQwenSession(Oe):Ge=await ot.deleteSession(Ce,Oe),Ge.ok)d?.(Oe);else{const He=await Ge.text();console.error("[Sidebar] Failed to delete session:",{status:Ge.status,error:He}),alert(s("messages.deleteSessionFailed"))}}catch(Ge){console.error("[Sidebar] Error deleting session:",Ge),alert(s("messages.deleteSessionError"))}},[d,be,s]),De=h.useCallback(Ce=>{pe({project:Ce,sessionCount:st(Ce).length})},[st]),Xe=h.useCallback(async(Ce=!1)=>{if(!me)return;const{project:Oe,sessionCount:ct}=me,Ge=ct===0;pe(null),ae(He=>new Set([...He,Oe.name]));try{const He=await ot.deleteProject(Oe.name,!Ge,Ce);if(He.ok)u?.(Oe.name);else{const je=await He.json();alert(je.error||s("messages.deleteProjectFailed"))}}catch(He){console.error("Error deleting project:",He),alert(s("messages.deleteProjectError"))}finally{ae(He=>{const je=new Set(He);return je.delete(Oe.name),je})}},[me,u,s]),Je=h.useCallback(async Ce=>{const Oe=U[Ce.name];if(!(!(Oe!==void 0?Oe:Ce.sessionMeta?.hasMore===!0)||S[Ce.name])){j(Ge=>({...Ge,[Ce.name]:!0}));try{const Ge=(Ce.sessions?.length||0)+(_[Ce.name]?.length||0),He=await ot.sessions(Ce.name,5,Ge);if(!He.ok)return;const je=await He.json();T(Ue=>({...Ue,[Ce.name]:[...Ue[Ce.name]||[],...je.sessions||[]]})),je.hasMore===!1&&V(Ue=>({...Ue,[Ce.name]:!1}))}catch(Ge){console.error("Error loading more sessions:",Ge)}finally{j(Ge=>({...Ge,[Ce.name]:!1}))}}},[_,S,U]),ie=h.useCallback(Ce=>{l(Ce),p(Ce)},[l,p]),ke=h.useCallback(async()=>{z(!0);try{await o()}finally{z(!1)}},[o]),we=h.useCallback(async(Ce,Oe,ct,Ge)=>{const He=ct.trim();if(!He){G(null),F("");return}try{const je=await ot.renameSession(Oe,He,Ge);je.ok?await o():(console.error("[Sidebar] Failed to rename session:",je.status),alert(s("messages.renameSessionFailed")))}catch(je){console.error("[Sidebar] Error renaming session:",je),alert(s("messages.renameSessionError"))}finally{G(null),F("")}},[o,s]),Ve=h.useCallback(()=>{f(!1)},[f]),et=h.useCallback(()=>{f(!0)},[f]);return{isSidebarCollapsed:Te,expandedProjects:g,editingProject:x,showNewProject:v,editingName:k,loadingSessions:S,additionalSessions:_,initialSessionsLoaded:C,currentTime:A,projectSortOrder:N,isRefreshing:H,editingSession:O,editingSessionName:$,searchFilter:te,deletingProjects:ge,deleteConfirmation:me,sessionDeleteConfirmation:be,showVersionModal:xe,starredProjects:M,starredSessions:ce,filteredProjects:_t,toggleProject:Ke,handleSessionClick:Ze,toggleStarProject:vt,isProjectStarred:Qe,toggleStarSession:jt,isSessionStarred:wt,getProjectSessions:st,startEditing:At,cancelEditing:pr,saveProjectName:nr,showDeleteSessionConfirmation:Xt,confirmDeleteSession:zr,requestProjectDelete:De,confirmDeleteProject:Xe,loadMoreSessions:Je,handleProjectSelect:ie,refreshProjects:ke,updateSessionSummary:we,collapseSidebar:Ve,expandSidebar:et,setShowNewProject:w,setEditingName:E,setEditingSession:G,setEditingSessionName:F,searchMode:W,setSearchMode:ne,conversationResults:fe,isSearching:se,searchProgress:re,clearConversationResults:h.useCallback(()=>{le.current+=1,Ee.current&&(Ee.current.close(),Ee.current=null),Se(!1),X(null),ye(null)},[]),setSearchFilter:Q,setDeleteConfirmation:pe,setSessionDeleteConfirmation:Ne,setShowVersionModal:Be}}const u9="https://discord.gg/buxwujPNRE",p9="https://github.com/alicomert/pixcode/issues/new";function m9({className:e}){return i.jsx("svg",{className:e,fill:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:i.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 h9({onExpand:e,onShowSettings:t,updateAvailable:r,onShowVersionModal:n,t:a}){return i.jsxs("div",{className:"flex h-full w-12 flex-col items-center gap-1 bg-background/80 py-3 backdrop-blur-sm",children:[i.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:i.jsx(xD,{className:"h-4 w-4 text-muted-foreground transition-colors group-hover:text-foreground"})}),i.jsx("div",{className:"nav-divider my-1 w-6"}),i.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:i.jsx(Lt,{className:"h-4 w-4 text-muted-foreground transition-colors group-hover:text-foreground"})}),i.jsx("a",{href:p9,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:i.jsx(ml,{className:"h-4 w-4 text-muted-foreground transition-colors group-hover:text-foreground"})}),i.jsx("a",{href:u9,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:i.jsx(m9,{className:"h-4 w-4 text-muted-foreground transition-colors group-hover:text-foreground"})}),r&&i.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:[i.jsx(Na,{className:"h-4 w-4 text-blue-500"}),i.jsx("span",{className:"absolute right-1.5 top-1.5 h-1.5 w-1.5 animate-pulse rounded-full bg-blue-500"})]})]})}function GE(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=GE(e[t]))&&(n&&(n+=" "),n+=r)}else for(r in e)e[r]&&(n&&(n+=" "),n+=r);return n}function HE(){for(var e,t,r=0,n="",a=arguments.length;r<a;r++)(e=arguments[r])&&(t=GE(e))&&(n&&(n+=" "),n+=t);return n}const lw=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,cw=HE,Pf=(e,t)=>r=>{var n;if(t?.variants==null)return cw(e,r?.class,r?.className);const{variants:a,defaultVariants:s}=t,o=Object.keys(a).map(d=>{const u=r?.[d],p=s?.[d];if(u===null)return null;const f=lw(u)||lw(p);return a[d][f]}),l=r&&Object.entries(r).reduce((d,u)=>{let[p,f]=u;return f===void 0||(d[p]=f),d},{}),c=t==null||(n=t.compoundVariants)===null||n===void 0?void 0:n.reduce((d,u)=>{let{class:p,className:f,...m}=u;return Object.entries(m).every(g=>{let[b,x]=g;return Array.isArray(x)?x.includes({...s,...l}[b]):{...s,...l}[b]===x})?[...d,p,f]:d},[]);return cw(e,o,c,r?.class,r?.className)},Ff="-",f9=e=>{const t=b9(e),{conflictingClassGroups:r,conflictingClassGroupModifiers:n}=e;return{getClassGroupId:o=>{const l=o.split(Ff);return l[0]===""&&l.length!==1&&l.shift(),VE(l,t)||g9(o)},getConflictingClassGroupIds:(o,l)=>{const c=r[o]||[];return l&&n[o]?[...c,...n[o]]:c}}},VE=(e,t)=>{if(e.length===0)return t.classGroupId;const r=e[0],n=t.nextPart.get(r),a=n?VE(e.slice(1),n):void 0;if(a)return a;if(t.validators.length===0)return;const s=e.join(Ff);return t.validators.find(({validator:o})=>o(s))?.classGroupId},dw=/^\[(.+)\]$/,g9=e=>{if(dw.test(e)){const t=dw.exec(e)[1],r=t?.substring(0,t.indexOf(":"));if(r)return"arbitrary.."+r}},b9=e=>{const{theme:t,classGroups:r}=e,n={nextPart:new Map,validators:[]};for(const a in r)Qm(r[a],n,a,t);return n},Qm=(e,t,r,n)=>{e.forEach(a=>{if(typeof a=="string"){const s=a===""?t:uw(t,a);s.classGroupId=r;return}if(typeof a=="function"){if(x9(a)){Qm(a(n),t,r,n);return}t.validators.push({validator:a,classGroupId:r});return}Object.entries(a).forEach(([s,o])=>{Qm(o,uw(t,s),r,n)})})},uw=(e,t)=>{let r=e;return t.split(Ff).forEach(n=>{r.nextPart.has(n)||r.nextPart.set(n,{nextPart:new Map,validators:[]}),r=r.nextPart.get(n)}),r},x9=e=>e.isThemeGetter,y9=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,r=new Map,n=new Map;const a=(s,o)=>{r.set(s,o),t++,t>e&&(t=0,n=r,r=new Map)};return{get(s){let o=r.get(s);if(o!==void 0)return o;if((o=n.get(s))!==void 0)return a(s,o),o},set(s,o){r.has(s)?r.set(s,o):a(s,o)}}},eh="!",th=":",v9=th.length,w9=e=>{const{prefix:t,experimentalParseClassName:r}=e;let n=a=>{const s=[];let o=0,l=0,c=0,d;for(let g=0;g<a.length;g++){let b=a[g];if(o===0&&l===0){if(b===th){s.push(a.slice(c,g)),c=g+v9;continue}if(b==="/"){d=g;continue}}b==="["?o++:b==="]"?o--:b==="("?l++:b===")"&&l--}const u=s.length===0?a:a.substring(c),p=k9(u),f=p!==u,m=d&&d>c?d-c:void 0;return{modifiers:s,hasImportantModifier:f,baseClassName:p,maybePostfixModifierPosition:m}};if(t){const a=t+th,s=n;n=o=>o.startsWith(a)?s(o.substring(a.length)):{isExternal:!0,modifiers:[],hasImportantModifier:!1,baseClassName:o,maybePostfixModifierPosition:void 0}}if(r){const a=n;n=s=>r({className:s,parseClassName:a})}return n},k9=e=>e.endsWith(eh)?e.substring(0,e.length-1):e.startsWith(eh)?e.substring(1):e,S9=e=>{const t=Object.fromEntries(e.orderSensitiveModifiers.map(n=>[n,!0]));return n=>{if(n.length<=1)return n;const a=[];let s=[];return n.forEach(o=>{o[0]==="["||t[o]?(a.push(...s.sort(),o),s=[]):s.push(o)}),a.push(...s.sort()),a}},E9=e=>({cache:y9(e.cacheSize),parseClassName:w9(e),sortModifiers:S9(e),...f9(e)}),N9=/\s+/,C9=(e,t)=>{const{parseClassName:r,getClassGroupId:n,getConflictingClassGroupIds:a,sortModifiers:s}=t,o=[],l=e.trim().split(N9);let c="";for(let d=l.length-1;d>=0;d-=1){const u=l[d],{isExternal:p,modifiers:f,hasImportantModifier:m,baseClassName:g,maybePostfixModifierPosition:b}=r(u);if(p){c=u+(c.length>0?" "+c:c);continue}let x=!!b,y=n(x?g.substring(0,b):g);if(!y){if(!x){c=u+(c.length>0?" "+c:c);continue}if(y=n(g),!y){c=u+(c.length>0?" "+c:c);continue}x=!1}const v=s(f).join(":"),w=m?v+eh:v,k=w+y;if(o.includes(k))continue;o.push(k);const E=a(y,x);for(let S=0;S<E.length;++S){const j=E[S];o.push(w+j)}c=u+(c.length>0?" "+c:c)}return c};function A9(){let e=0,t,r,n="";for(;e<arguments.length;)(t=arguments[e++])&&(r=qE(t))&&(n&&(n+=" "),n+=r);return n}const qE=e=>{if(typeof e=="string")return e;let t,r="";for(let n=0;n<e.length;n++)e[n]&&(t=qE(e[n]))&&(r&&(r+=" "),r+=t);return r};function T9(e,...t){let r,n,a,s=o;function o(c){const d=t.reduce((u,p)=>p(u),e());return r=E9(d),n=r.cache.get,a=r.cache.set,s=l,l(c)}function l(c){const d=n(c);if(d)return d;const u=C9(c,r);return a(c,u),u}return function(){return s(A9.apply(null,arguments))}}const mr=e=>{const t=r=>r[e]||[];return t.isThemeGetter=!0,t},WE=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,KE=/^\((?:(\w[\w-]*):)?(.+)\)$/i,j9=/^\d+\/\d+$/,_9=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,I9=/\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$/,R9=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,L9=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,D9=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,cs=e=>j9.test(e),mt=e=>!!e&&!Number.isNaN(Number(e)),$a=e=>!!e&&Number.isInteger(Number(e)),Hu=e=>e.endsWith("%")&&mt(e.slice(0,-1)),ma=e=>_9.test(e),O9=()=>!0,M9=e=>I9.test(e)&&!R9.test(e),YE=()=>!1,P9=e=>L9.test(e),F9=e=>D9.test(e),z9=e=>!qe(e)&&!We(e),B9=e=>to(e,JE,YE),qe=e=>WE.test(e),vi=e=>to(e,QE,M9),Vu=e=>to(e,V9,mt),pw=e=>to(e,ZE,YE),$9=e=>to(e,XE,F9),tc=e=>to(e,eN,P9),We=e=>KE.test(e),jo=e=>ro(e,QE),U9=e=>ro(e,q9),mw=e=>ro(e,ZE),G9=e=>ro(e,JE),H9=e=>ro(e,XE),rc=e=>ro(e,eN,!0),to=(e,t,r)=>{const n=WE.exec(e);return n?n[1]?t(n[1]):r(n[2]):!1},ro=(e,t,r=!1)=>{const n=KE.exec(e);return n?n[1]?t(n[1]):r:!1},ZE=e=>e==="position"||e==="percentage",XE=e=>e==="image"||e==="url",JE=e=>e==="length"||e==="size"||e==="bg-size",QE=e=>e==="length",V9=e=>e==="number",q9=e=>e==="family-name",eN=e=>e==="shadow",W9=()=>{const e=mr("color"),t=mr("font"),r=mr("text"),n=mr("font-weight"),a=mr("tracking"),s=mr("leading"),o=mr("breakpoint"),l=mr("container"),c=mr("spacing"),d=mr("radius"),u=mr("shadow"),p=mr("inset-shadow"),f=mr("text-shadow"),m=mr("drop-shadow"),g=mr("blur"),b=mr("perspective"),x=mr("aspect"),y=mr("ease"),v=mr("animate"),w=()=>["auto","avoid","all","avoid-page","page","left","right","column"],k=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],E=()=>[...k(),We,qe],S=()=>["auto","hidden","clip","visible","scroll"],j=()=>["auto","contain","none"],_=()=>[We,qe,c],T=()=>[cs,"full","auto",..._()],C=()=>[$a,"none","subgrid",We,qe],L=()=>["auto",{span:["full",$a,We,qe]},$a,We,qe],A=()=>[$a,"auto",We,qe],I=()=>["auto","min","max","fr",We,qe],N=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],P=()=>["start","end","center","stretch","center-safe","end-safe"],H=()=>["auto",..._()],z=()=>[cs,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",..._()],U=()=>[e,We,qe],V=()=>[...k(),mw,pw,{position:[We,qe]}],O=()=>["no-repeat",{repeat:["","x","y","space","round"]}],G=()=>["auto","cover","contain",G9,B9,{size:[We,qe]}],$=()=>[Hu,jo,vi],F=()=>["","none","full",d,We,qe],te=()=>["",mt,jo,vi],Q=()=>["solid","dashed","dotted","double"],ge=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],ae=()=>[mt,Hu,mw,pw],me=()=>["","none",g,We,qe],pe=()=>["none",mt,We,qe],be=()=>["none",mt,We,qe],Ne=()=>[mt,We,qe],xe=()=>[cs,"full",..._()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[ma],breakpoint:[ma],color:[O9],container:[ma],"drop-shadow":[ma],ease:["in","out","in-out"],font:[z9],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[ma],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[ma],shadow:[ma],spacing:["px",mt],text:[ma],"text-shadow":[ma],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",cs,qe,We,x]}],container:["container"],columns:[{columns:[mt,qe,We,l]}],"break-after":[{"break-after":w()}],"break-before":[{"break-before":w()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:E()}],overflow:[{overflow:S()}],"overflow-x":[{"overflow-x":S()}],"overflow-y":[{"overflow-y":S()}],overscroll:[{overscroll:j()}],"overscroll-x":[{"overscroll-x":j()}],"overscroll-y":[{"overscroll-y":j()}],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:[$a,"auto",We,qe]}],basis:[{basis:[cs,"full","auto",l,..._()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[mt,cs,"auto","initial","none",qe]}],grow:[{grow:["",mt,We,qe]}],shrink:[{shrink:["",mt,We,qe]}],order:[{order:[$a,"first","last","none",We,qe]}],"grid-cols":[{"grid-cols":C()}],"col-start-end":[{col:L()}],"col-start":[{"col-start":A()}],"col-end":[{"col-end":A()}],"grid-rows":[{"grid-rows":C()}],"row-start-end":[{row:L()}],"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":I()}],"auto-rows":[{"auto-rows":I()}],gap:[{gap:_()}],"gap-x":[{"gap-x":_()}],"gap-y":[{"gap-y":_()}],"justify-content":[{justify:[...N(),"normal"]}],"justify-items":[{"justify-items":[...P(),"normal"]}],"justify-self":[{"justify-self":["auto",...P()]}],"align-content":[{content:["normal",...N()]}],"align-items":[{items:[...P(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...P(),{baseline:["","last"]}]}],"place-content":[{"place-content":N()}],"place-items":[{"place-items":[...P(),"baseline"]}],"place-self":[{"place-self":["auto",...P()]}],p:[{p:_()}],px:[{px:_()}],py:[{py:_()}],ps:[{ps:_()}],pe:[{pe:_()}],pt:[{pt:_()}],pr:[{pr:_()}],pb:[{pb:_()}],pl:[{pl:_()}],m:[{m:H()}],mx:[{mx:H()}],my:[{my:H()}],ms:[{ms:H()}],me:[{me:H()}],mt:[{mt:H()}],mr:[{mr:H()}],mb:[{mb:H()}],ml:[{ml:H()}],"space-x":[{"space-x":_()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":_()}],"space-y-reverse":["space-y-reverse"],size:[{size:z()}],w:[{w:[l,"screen",...z()]}],"min-w":[{"min-w":[l,"screen","none",...z()]}],"max-w":[{"max-w":[l,"screen","none","prose",{screen:[o]},...z()]}],h:[{h:["screen","lh",...z()]}],"min-h":[{"min-h":["screen","lh","none",...z()]}],"max-h":[{"max-h":["screen","lh",...z()]}],"font-size":[{text:["base",r,jo,vi]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[n,We,Vu]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",Hu,qe]}],"font-family":[{font:[U9,qe,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,We,qe]}],"line-clamp":[{"line-clamp":[mt,"none",We,Vu]}],leading:[{leading:[s,..._()]}],"list-image":[{"list-image":["none",We,qe]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",We,qe]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:U()}],"text-color":[{text:U()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...Q(),"wavy"]}],"text-decoration-thickness":[{decoration:[mt,"from-font","auto",We,vi]}],"text-decoration-color":[{decoration:U()}],"underline-offset":[{"underline-offset":[mt,"auto",We,qe]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:_()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",We,qe]}],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",We,qe]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:V()}],"bg-repeat":[{bg:O()}],"bg-size":[{bg:G()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},$a,We,qe],radial:["",We,qe],conic:[$a,We,qe]},H9,$9]}],"bg-color":[{bg:U()}],"gradient-from-pos":[{from:$()}],"gradient-via-pos":[{via:$()}],"gradient-to-pos":[{to:$()}],"gradient-from":[{from:U()}],"gradient-via":[{via:U()}],"gradient-to":[{to:U()}],rounded:[{rounded:F()}],"rounded-s":[{"rounded-s":F()}],"rounded-e":[{"rounded-e":F()}],"rounded-t":[{"rounded-t":F()}],"rounded-r":[{"rounded-r":F()}],"rounded-b":[{"rounded-b":F()}],"rounded-l":[{"rounded-l":F()}],"rounded-ss":[{"rounded-ss":F()}],"rounded-se":[{"rounded-se":F()}],"rounded-ee":[{"rounded-ee":F()}],"rounded-es":[{"rounded-es":F()}],"rounded-tl":[{"rounded-tl":F()}],"rounded-tr":[{"rounded-tr":F()}],"rounded-br":[{"rounded-br":F()}],"rounded-bl":[{"rounded-bl":F()}],"border-w":[{border:te()}],"border-w-x":[{"border-x":te()}],"border-w-y":[{"border-y":te()}],"border-w-s":[{"border-s":te()}],"border-w-e":[{"border-e":te()}],"border-w-t":[{"border-t":te()}],"border-w-r":[{"border-r":te()}],"border-w-b":[{"border-b":te()}],"border-w-l":[{"border-l":te()}],"divide-x":[{"divide-x":te()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":te()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...Q(),"hidden","none"]}],"divide-style":[{divide:[...Q(),"hidden","none"]}],"border-color":[{border:U()}],"border-color-x":[{"border-x":U()}],"border-color-y":[{"border-y":U()}],"border-color-s":[{"border-s":U()}],"border-color-e":[{"border-e":U()}],"border-color-t":[{"border-t":U()}],"border-color-r":[{"border-r":U()}],"border-color-b":[{"border-b":U()}],"border-color-l":[{"border-l":U()}],"divide-color":[{divide:U()}],"outline-style":[{outline:[...Q(),"none","hidden"]}],"outline-offset":[{"outline-offset":[mt,We,qe]}],"outline-w":[{outline:["",mt,jo,vi]}],"outline-color":[{outline:U()}],shadow:[{shadow:["","none",u,rc,tc]}],"shadow-color":[{shadow:U()}],"inset-shadow":[{"inset-shadow":["none",p,rc,tc]}],"inset-shadow-color":[{"inset-shadow":U()}],"ring-w":[{ring:te()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:U()}],"ring-offset-w":[{"ring-offset":[mt,vi]}],"ring-offset-color":[{"ring-offset":U()}],"inset-ring-w":[{"inset-ring":te()}],"inset-ring-color":[{"inset-ring":U()}],"text-shadow":[{"text-shadow":["none",f,rc,tc]}],"text-shadow-color":[{"text-shadow":U()}],opacity:[{opacity:[mt,We,qe]}],"mix-blend":[{"mix-blend":[...ge(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":ge()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[mt]}],"mask-image-linear-from-pos":[{"mask-linear-from":ae()}],"mask-image-linear-to-pos":[{"mask-linear-to":ae()}],"mask-image-linear-from-color":[{"mask-linear-from":U()}],"mask-image-linear-to-color":[{"mask-linear-to":U()}],"mask-image-t-from-pos":[{"mask-t-from":ae()}],"mask-image-t-to-pos":[{"mask-t-to":ae()}],"mask-image-t-from-color":[{"mask-t-from":U()}],"mask-image-t-to-color":[{"mask-t-to":U()}],"mask-image-r-from-pos":[{"mask-r-from":ae()}],"mask-image-r-to-pos":[{"mask-r-to":ae()}],"mask-image-r-from-color":[{"mask-r-from":U()}],"mask-image-r-to-color":[{"mask-r-to":U()}],"mask-image-b-from-pos":[{"mask-b-from":ae()}],"mask-image-b-to-pos":[{"mask-b-to":ae()}],"mask-image-b-from-color":[{"mask-b-from":U()}],"mask-image-b-to-color":[{"mask-b-to":U()}],"mask-image-l-from-pos":[{"mask-l-from":ae()}],"mask-image-l-to-pos":[{"mask-l-to":ae()}],"mask-image-l-from-color":[{"mask-l-from":U()}],"mask-image-l-to-color":[{"mask-l-to":U()}],"mask-image-x-from-pos":[{"mask-x-from":ae()}],"mask-image-x-to-pos":[{"mask-x-to":ae()}],"mask-image-x-from-color":[{"mask-x-from":U()}],"mask-image-x-to-color":[{"mask-x-to":U()}],"mask-image-y-from-pos":[{"mask-y-from":ae()}],"mask-image-y-to-pos":[{"mask-y-to":ae()}],"mask-image-y-from-color":[{"mask-y-from":U()}],"mask-image-y-to-color":[{"mask-y-to":U()}],"mask-image-radial":[{"mask-radial":[We,qe]}],"mask-image-radial-from-pos":[{"mask-radial-from":ae()}],"mask-image-radial-to-pos":[{"mask-radial-to":ae()}],"mask-image-radial-from-color":[{"mask-radial-from":U()}],"mask-image-radial-to-color":[{"mask-radial-to":U()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":k()}],"mask-image-conic-pos":[{"mask-conic":[mt]}],"mask-image-conic-from-pos":[{"mask-conic-from":ae()}],"mask-image-conic-to-pos":[{"mask-conic-to":ae()}],"mask-image-conic-from-color":[{"mask-conic-from":U()}],"mask-image-conic-to-color":[{"mask-conic-to":U()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:V()}],"mask-repeat":[{mask:O()}],"mask-size":[{mask:G()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",We,qe]}],filter:[{filter:["","none",We,qe]}],blur:[{blur:me()}],brightness:[{brightness:[mt,We,qe]}],contrast:[{contrast:[mt,We,qe]}],"drop-shadow":[{"drop-shadow":["","none",m,rc,tc]}],"drop-shadow-color":[{"drop-shadow":U()}],grayscale:[{grayscale:["",mt,We,qe]}],"hue-rotate":[{"hue-rotate":[mt,We,qe]}],invert:[{invert:["",mt,We,qe]}],saturate:[{saturate:[mt,We,qe]}],sepia:[{sepia:["",mt,We,qe]}],"backdrop-filter":[{"backdrop-filter":["","none",We,qe]}],"backdrop-blur":[{"backdrop-blur":me()}],"backdrop-brightness":[{"backdrop-brightness":[mt,We,qe]}],"backdrop-contrast":[{"backdrop-contrast":[mt,We,qe]}],"backdrop-grayscale":[{"backdrop-grayscale":["",mt,We,qe]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[mt,We,qe]}],"backdrop-invert":[{"backdrop-invert":["",mt,We,qe]}],"backdrop-opacity":[{"backdrop-opacity":[mt,We,qe]}],"backdrop-saturate":[{"backdrop-saturate":[mt,We,qe]}],"backdrop-sepia":[{"backdrop-sepia":["",mt,We,qe]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":_()}],"border-spacing-x":[{"border-spacing-x":_()}],"border-spacing-y":[{"border-spacing-y":_()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",We,qe]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[mt,"initial",We,qe]}],ease:[{ease:["linear","initial",y,We,qe]}],delay:[{delay:[mt,We,qe]}],animate:[{animate:["none",v,We,qe]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[b,We,qe]}],"perspective-origin":[{"perspective-origin":E()}],rotate:[{rotate:pe()}],"rotate-x":[{"rotate-x":pe()}],"rotate-y":[{"rotate-y":pe()}],"rotate-z":[{"rotate-z":pe()}],scale:[{scale:be()}],"scale-x":[{"scale-x":be()}],"scale-y":[{"scale-y":be()}],"scale-z":[{"scale-z":be()}],"scale-3d":["scale-3d"],skew:[{skew:Ne()}],"skew-x":[{"skew-x":Ne()}],"skew-y":[{"skew-y":Ne()}],transform:[{transform:[We,qe,"","none","gpu","cpu"]}],"transform-origin":[{origin:E()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:xe()}],"translate-x":[{"translate-x":xe()}],"translate-y":[{"translate-y":xe()}],"translate-z":[{"translate-z":xe()}],"translate-none":["translate-none"],accent:[{accent:U()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:U()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",We,qe]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":_()}],"scroll-mx":[{"scroll-mx":_()}],"scroll-my":[{"scroll-my":_()}],"scroll-ms":[{"scroll-ms":_()}],"scroll-me":[{"scroll-me":_()}],"scroll-mt":[{"scroll-mt":_()}],"scroll-mr":[{"scroll-mr":_()}],"scroll-mb":[{"scroll-mb":_()}],"scroll-ml":[{"scroll-ml":_()}],"scroll-p":[{"scroll-p":_()}],"scroll-px":[{"scroll-px":_()}],"scroll-py":[{"scroll-py":_()}],"scroll-ps":[{"scroll-ps":_()}],"scroll-pe":[{"scroll-pe":_()}],"scroll-pt":[{"scroll-pt":_()}],"scroll-pr":[{"scroll-pr":_()}],"scroll-pb":[{"scroll-pb":_()}],"scroll-pl":[{"scroll-pl":_()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",We,qe]}],fill:[{fill:["none",...U()]}],"stroke-w":[{stroke:[mt,jo,vi,Vu]}],stroke:[{stroke:["none",...U()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}},K9=T9(W9);function ue(...e){return K9(HE(e))}function Y9(e){if(!e||typeof e!="string")return null;try{return JSON.parse(e)}catch{return null}}const Z9=Pf("relative grid w-full grid-cols-[0_1fr] items-start gap-y-0.5 rounded-lg border px-4 py-3 text-sm has-[>svg]:grid-cols-[calc(var(--spacing)*4)_1fr] has-[>svg]:gap-x-3 [&>svg]:size-4 [&>svg]:translate-y-0.5 [&>svg]:text-current",{variants:{variant:{default:"bg-card text-card-foreground",destructive:"bg-card text-destructive *:data-[slot=alert-description]:text-destructive/90 [&>svg]:text-current"}},defaultVariants:{variant:"default"}}),tN=h.forwardRef(({className:e,variant:t,...r},n)=>i.jsx("div",{ref:n,role:"alert","data-slot":"alert",className:ue(Z9({variant:t}),e),...r}));tN.displayName="Alert";const X9=h.forwardRef(({className:e,...t},r)=>i.jsx("div",{ref:r,"data-slot":"alert-title",className:ue("col-start-2 line-clamp-1 min-h-4 font-medium tracking-tight",e),...t}));X9.displayName="AlertTitle";const J9=h.forwardRef(({className:e,...t},r)=>i.jsx("div",{ref:r,"data-slot":"alert-description",className:ue("text-muted-foreground col-start-2 grid justify-items-start gap-1 text-sm [&_p]:leading-relaxed",e),...t}));J9.displayName="AlertDescription";const Q9=Pf("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 er({className:e,variant:t,...r}){return i.jsx("div",{className:ue(Q9({variant:t}),e),...r})}const eM=Pf("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"}}),_e=h.forwardRef(({className:e,variant:t,size:r,...n},a)=>i.jsx("button",{className:ue(eM({variant:t,size:r,className:e})),ref:a,...n}));_e.displayName="Button";const rN=h.createContext(null),nN=()=>{const e=h.useContext(rN);if(!e)throw new Error("Confirmation components must be used within Confirmation");return e},aN=({className:e,approval:t="pending",children:r,...n})=>{const a=h.useMemo(()=>({approval:t}),[t]);return i.jsx(rN.Provider,{value:a,children:i.jsx(tN,{className:ue("flex flex-col gap-2",e),...n,children:r})})};aN.displayName="Confirmation";const iN=({className:e,...t})=>i.jsx("div",{"data-slot":"confirmation-title",className:ue("text-muted-foreground inline text-sm",e),...t});iN.displayName="ConfirmationTitle";const sN=({children:e})=>{const{approval:t}=nN();return t!=="pending"?null:i.jsx(i.Fragment,{children:e})};sN.displayName="ConfirmationRequest";const oN=({className:e,...t})=>{const{approval:r}=nN();return r!=="pending"?null:i.jsx("div",{"data-slot":"confirmation-actions",className:ue("flex items-center justify-end gap-2 self-end",e),...t})};oN.displayName="ConfirmationActions";const Fc=({variant:e="default",...t})=>i.jsx(_e,{className:"h-8 px-3 text-sm",variant:e,type:"button",...t});Fc.displayName="ConfirmationAction";const lN=h.forwardRef(({className:e,...t},r)=>i.jsx("div",{ref:r,className:ue("rounded-xl border bg-card text-card-foreground shadow-sm",e),...t}));lN.displayName="Card";const cN=h.forwardRef(({className:e,...t},r)=>i.jsx("div",{ref:r,className:ue("flex flex-col space-y-1.5 p-4",e),...t}));cN.displayName="CardHeader";const dN=h.forwardRef(({className:e,...t},r)=>i.jsx("h3",{ref:r,className:ue("font-semibold leading-none tracking-tight",e),...t}));dN.displayName="CardTitle";const tM=h.forwardRef(({className:e,...t},r)=>i.jsx("p",{ref:r,className:ue("text-sm text-muted-foreground",e),...t}));tM.displayName="CardDescription";const uN=h.forwardRef(({className:e,...t},r)=>i.jsx("div",{ref:r,className:ue("p-4 pt-0",e),...t}));uN.displayName="CardContent";const pN=h.forwardRef(({className:e,...t},r)=>i.jsx("div",{ref:r,className:ue("flex items-center p-4 pt-0",e),...t}));pN.displayName="CardFooter";const rM=h.forwardRef(({className:e,...t},r)=>i.jsx("div",{ref:r,className:ue("ml-auto shrink-0",e),...t}));rM.displayName="CardAction";const mN=h.createContext(null);function hN(){const e=h.useContext(mN);if(!e)throw new Error("Collapsible components must be used within <Collapsible>");return e}const ii=h.forwardRef(({defaultOpen:e=!1,open:t,onOpenChange:r,className:n,children:a,...s},o)=>{const[l,c]=h.useState(e),d=t!==void 0,u=d?t:l,p=h.useCallback(m=>{d||c(m),r?.(m)},[d,r]),f=h.useMemo(()=>({open:u,onOpenChange:p}),[u,p]);return i.jsx(mN.Provider,{value:f,children:i.jsx("div",{ref:o,"data-state":u?"open":"closed",className:n,...s,children:a})})});ii.displayName="Collapsible";const Ca=h.forwardRef(({onClick:e,children:t,className:r,...n},a)=>{const{open:s,onOpenChange:o}=hN(),l=h.useCallback(c=>{o(!s),e?.(c)},[s,o,e]);return i.jsx("button",{ref:a,type:"button","aria-expanded":s,"data-state":s?"open":"closed",onClick:l,className:r,...n,children:t})});Ca.displayName="CollapsibleTrigger";const si=h.forwardRef(({className:e,children:t,...r},n)=>{const{open:a}=hN();return i.jsx("div",{ref:n,"data-state":a?"open":"closed",className:ue("grid transition-[grid-template-rows] duration-200 ease-out",a?"grid-rows-[1fr]":"grid-rows-[0fr]",e),...r,children:i.jsx("div",{className:"overflow-hidden",children:t})})});si.displayName="CollapsibleContent";const fN=h.createContext(null);function zf(){const e=h.useContext(fN);if(!e)throw new Error("Command components must be used within <Command>");return e}const gN=h.forwardRef(({className:e,children:t,...r},n)=>{const[a,s]=h.useState(""),o=h.useRef(new Map),[l,c]=h.useState(0),d=h.useCallback(v=>{o.current.set(v.id,v),c(w=>w+1)},[]),u=h.useCallback(v=>{o.current.delete(v),c(w=>w+1)},[]),p=h.useCallback((v,w)=>{const k=o.current.get(v);k&&Object.assign(k,w)},[]),f=h.useMemo(()=>{const v=a.toLowerCase(),w=new Set;for(const[k,E]of o.current)(!v||E.value.includes(v))&&w.add(k);return w},[a,l]),m=h.useMemo(()=>{const v=[];for(const[,w]of o.current)f.has(w.id)&&v.push(w);return v},[f]),[g,b]=h.useState(null);h.useEffect(()=>{b(m.length>0?m[0].id:null)},[m]);const x=h.useCallback(v=>{if(v.key==="ArrowDown"||v.key==="ArrowUp"||v.key==="Enter")v.preventDefault();else return;const w=m;if(w.length===0)return;if(v.key==="Enter"){w.find(T=>T.id===g)?.onSelect();return}const k=w.findIndex(_=>_.id===g);let E;v.key==="ArrowDown"?E=k<w.length-1?k+1:0:E=k>0?k-1:w.length-1;const S=w[E].id;b(S),w[E].element?.scrollIntoView({block:"nearest"})},[m,g]),y=h.useMemo(()=>({search:a,setSearch:s,visibleIds:f,activeId:g,setActiveId:b,register:d,unregister:u,updateEntry:p}),[a,f,g,d,u,p]);return i.jsx(fN.Provider,{value:y,children:i.jsx("div",{ref:n,role:"combobox","aria-expanded":"true","aria-haspopup":"listbox",className:ue("flex flex-col",e),onKeyDown:x,...r,children:t})})});gN.displayName="Command";const bN=h.forwardRef(({className:e,placeholder:t="Search...",...r},n)=>{const{search:a,setSearch:s}=zf();return i.jsxs("div",{className:"flex items-center border-b px-3",role:"presentation",children:[i.jsx(Ea,{className:"mr-2 h-4 w-4 shrink-0 text-muted-foreground","aria-hidden":!0}),i.jsx("input",{ref:n,type:"text",role:"searchbox","aria-autocomplete":"list",autoComplete:"off",autoCorrect:"off",spellCheck:!1,value:a,onChange:o=>s(o.target.value),placeholder:t,className:ue("flex h-11 w-full rounded-md bg-transparent py-3 text-sm outline-none","placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50",e),...r})]})});bN.displayName="CommandInput";const xN=h.forwardRef(({className:e,...t},r)=>i.jsx("div",{ref:r,role:"listbox",className:ue("max-h-[300px] overflow-y-auto overflow-x-hidden",e),...t}));xN.displayName="CommandList";const yN=h.forwardRef(({className:e,...t},r)=>{const{search:n,visibleIds:a}=zf();return!n||a.size>0?null:i.jsx("div",{ref:r,className:ue("py-6 text-center text-sm text-muted-foreground",e),...t})});yN.displayName="CommandEmpty";const vN=h.forwardRef(({className:e,heading:t,children:r,...n},a)=>i.jsxs("div",{ref:a,className:ue("overflow-hidden p-1",e),role:"group","aria-label":typeof t=="string"?t:void 0,...n,children:[t&&i.jsx("div",{className:"px-2 py-1.5 text-xs font-medium text-muted-foreground",role:"presentation",children:t}),r]}));vN.displayName="CommandGroup";const wN=h.forwardRef(({className:e,value:t,onSelect:r,disabled:n,children:a,...s},o)=>{const{visibleIds:l,activeId:c,setActiveId:d,register:u,unregister:p,updateEntry:f}=zf(),m=h.useId(),g=h.useRef(null),b=t||(typeof a=="string"?a:"");h.useEffect(()=>(u({id:m,value:b.toLowerCase(),onSelect:r||(()=>{}),element:g.current}),()=>p(m)),[m,b,u,p]),h.useEffect(()=>{f(m,{onSelect:r||(()=>{})})},[m,r,f]);const x=h.useCallback(v=>{g.current=v,f(m,{element:v}),typeof o=="function"?o(v):o&&(o.current=v)},[m,f,o]);if(!l.has(m))return null;const y=c===m;return i.jsx("div",{ref:x,role:"option","aria-selected":y,"aria-disabled":n||void 0,"data-active":y||void 0,className:ue("relative flex cursor-pointer select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none",y&&"bg-accent text-accent-foreground",n&&"pointer-events-none opacity-50",e),onPointerMove:()=>{!n&&c!==m&&d(m)},onClick:()=>!n&&r?.(),...s,children:a})});wN.displayName="CommandItem";const nM=h.forwardRef(({className:e,...t},r)=>i.jsx("div",{ref:r,className:ue("-mx-1 h-px bg-border",e),...t}));nM.displayName="CommandSeparator";function rh({checked:e,onToggle:t,ariaLabel:r="Toggle dark mode"}){const{isDarkMode:n,toggleDarkMode:a}=Oa(),s=typeof e=="boolean"&&typeof t=="function",o=s?e:n,l=()=>{if(s&&t){t(!o);return}a()};return i.jsxs("button",{onClick:l,className:ue("relative inline-flex h-7 w-12 flex-shrink-0 touch-manipulation cursor-pointer items-center rounded-full border-2 transition-colors duration-200","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background",o?"border-primary bg-primary":"border-border bg-muted"),role:"switch","aria-checked":o,"aria-label":r,children:[i.jsx("span",{className:"sr-only",children:r}),i.jsx("span",{className:ue("flex h-5 w-5 transform items-center justify-center rounded-full shadow-sm transition-transform duration-200",o?"translate-x-[22px] bg-white":"translate-x-[2px] bg-foreground/60 dark:bg-foreground/80"),children:o?i.jsx(Tf,{className:"h-3 w-3 text-primary"}):i.jsx(_f,{className:"h-3 w-3 text-white dark:text-background"})})]})}const kN=h.createContext(null);function SN(){const e=h.useContext(kN);if(!e)throw new Error("Dialog components must be used within <Dialog>");return e}const EN=({open:e,onOpenChange:t,defaultOpen:r=!1,children:n})=>{const[a,s]=h.useState(r),o=h.useRef(null),l=e!==void 0,c=l?e:a,d=h.useCallback(p=>{l||s(p),t?.(p)},[l,t]),u=h.useMemo(()=>({open:c,onOpenChange:d,triggerRef:o}),[c,d]);return i.jsx(kN.Provider,{value:u,children:n})},aM=h.forwardRef(({onClick:e,children:t,asChild:r,...n},a)=>{const{onOpenChange:s,triggerRef:o}=SN(),l=h.useCallback(c=>{s(!0),e?.(c)},[s,e]);if(r&&h.isValidElement(t)){const c=t;return h.cloneElement(c,{onClick:d=>{s(!0),c.props.onClick?.(d)},ref:d=>{o.current=d,typeof a=="function"?a(d):a&&(a.current=d)}})}return i.jsx("button",{ref:c=>{o.current=c,typeof a=="function"?a(c):a&&(a.current=c)},type:"button",onClick:l,...n,children:t})});aM.displayName="DialogTrigger";const hw='a[href], button:not([disabled]), input:not([disabled]), textarea:not([disabled]), select:not([disabled]), [tabindex]:not([tabindex="-1"])',Bf=h.forwardRef(({className:e,children:t,onEscapeKeyDown:r,onPointerDownOutside:n,...a},s)=>{const{open:o,onOpenChange:l,triggerRef:c}=SN(),d=h.useRef(null),u=h.useRef(null);return h.useEffect(()=>{o?u.current=document.activeElement:u.current&&((c.current||u.current)?.focus(),u.current=null)},[o,c]),h.useEffect(()=>{if(!o)return;const p=m=>{if(m.key==="Escape"){m.stopPropagation(),r?.(),l(!1);return}if(m.key==="Tab"&&d.current){const g=Array.from(d.current.querySelectorAll(hw));if(g.length===0)return;const b=g[0],x=g[g.length-1];m.shiftKey&&document.activeElement===b?(m.preventDefault(),x.focus()):!m.shiftKey&&document.activeElement===x&&(m.preventDefault(),b.focus())}};document.addEventListener("keydown",p,!0);const f=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.removeEventListener("keydown",p,!0),document.body.style.overflow=f}},[o,l,r]),h.useEffect(()=>{o&&d.current&&requestAnimationFrame(()=>{d.current?.querySelector(hw)?.focus()})},[o]),o?Bd.createPortal(i.jsxs("div",{className:"fixed inset-0 z-50",children:[i.jsx("div",{className:"fixed inset-0 animate-dialog-overlay-show bg-black/50 backdrop-blur-sm",onClick:()=>{n?.(),l(!1)},"aria-hidden":!0}),i.jsx("div",{ref:p=>{d.current=p,typeof s=="function"?s(p):s&&(s.current=p)},role:"dialog","aria-modal":"true",className:ue("fixed left-1/2 top-1/2 z-50 w-full max-w-lg -translate-x-1/2 -translate-y-1/2","rounded-xl border bg-popover text-popover-foreground shadow-lg","animate-dialog-content-show",e),...a,children:t})]}),document.body):null});Bf.displayName="DialogContent";const $f=h.forwardRef(({className:e,...t},r)=>i.jsx("h2",{ref:r,className:ue("sr-only",e),...t}));$f.displayName="DialogTitle";const Nt=h.forwardRef(({className:e,type:t,...r},n)=>i.jsx("input",{type:t,className:ue("flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-sm shadow-sm transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50",e),ref:n,...r}));Nt.displayName="Input";const Uf=h.forwardRef(({className:e,contentClassName:t,children:r,...n},a)=>i.jsx("div",{className:ue("relative overflow-hidden",e),...n,children:i.jsx("div",{ref:a,className:ue("h-full w-full overflow-auto rounded-[inherit]",t),style:{WebkitOverflowScrolling:"touch",touchAction:"pan-y"},children:r})}));Uf.displayName="ScrollArea";const od=h.memo(({children:e,className:t,as:r="span"})=>i.jsx(r,{className:ue("animate-shimmer inline-block bg-[length:250%_100%] bg-clip-text text-transparent","bg-[linear-gradient(90deg,transparent_33%,hsl(var(--foreground))_50%,transparent_67%),linear-gradient(hsl(var(--muted-foreground)),hsl(var(--muted-foreground)))]",t),children:e}));od.displayName="Shimmer";const NN=h.createContext(null),iM=()=>{const e=h.useContext(NN);if(!e)throw new Error("Reasoning components must be used within Reasoning");return e},sM=1e3,oM=1e3,nh=h.memo(({className:e,isStreaming:t=!1,open:r,defaultOpen:n,onOpenChange:a,duration:s,children:o,...l})=>{const c=n??t,d=n===!1,[u,p]=h.useState(c),f=r!==void 0,m=f?r:u,g=h.useCallback(S=>{f||p(S),a?.(S)},[f,a]),[b,x]=h.useState(s),y=h.useRef(t),[v,w]=h.useState(!1),k=h.useRef(null);h.useEffect(()=>{s!==void 0&&x(s)},[s]),h.useEffect(()=>{t?(y.current=!0,k.current===null&&(k.current=Date.now())):k.current!==null&&(x(Math.ceil((Date.now()-k.current)/oM)),k.current=null)},[t]),h.useEffect(()=>{t&&!m&&!d&&g(!0)},[t,m,g,d]),h.useEffect(()=>{if(y.current&&!t&&m&&!v){const S=setTimeout(()=>{g(!1),w(!0)},sM);return()=>clearTimeout(S)}},[t,m,g,v]);const E=h.useMemo(()=>({duration:b,isOpen:m,isStreaming:t,setIsOpen:g}),[b,m,t,g]);return i.jsx(NN.Provider,{value:E,children:i.jsx(ii,{open:m,onOpenChange:g,className:ue("not-prose",e),...l,children:o})})});nh.displayName="Reasoning";const lM=(e,t)=>e||t===0?i.jsx(od,{children:"Thinking..."}):t===void 0?i.jsx("p",{children:"Thought for a few seconds"}):i.jsxs("p",{children:["Thought for ",t," seconds"]}),ah=h.memo(({className:e,children:t,getThinkingMessage:r=lM,...n})=>{const{isStreaming:a,isOpen:s,duration:o}=iM();return i.jsx(Ca,{className:ue("flex w-full items-center gap-2 text-sm text-muted-foreground transition-colors hover:text-foreground",e),...n,children:t??i.jsxs(i.Fragment,{children:[i.jsx(GD,{className:"h-4 w-4"}),r(a,o),i.jsx(iE,{className:ue("h-4 w-4 transition-transform",s?"rotate-180":"rotate-0")})]})})});ah.displayName="ReasoningTrigger";const ih=h.memo(({className:e,children:t,...r})=>i.jsx(si,{className:ue("mt-4 text-sm text-muted-foreground",e),...r,children:t}));ih.displayName="ReasoningContent";function cM(e){switch(e){case"top":return"top-full left-1/2 transform -translate-x-1/2 border-t-gray-900 dark:border-t-gray-100";case"bottom":return"bottom-full left-1/2 transform -translate-x-1/2 border-b-gray-900 dark:border-b-gray-100";case"left":return"left-full top-1/2 transform -translate-y-1/2 border-l-gray-900 dark:border-l-gray-100";case"right":return"right-full top-1/2 transform -translate-y-1/2 border-r-gray-900 dark:border-r-gray-100";default:return"top-full left-1/2 transform -translate-x-1/2 border-t-gray-900 dark:border-t-gray-100"}}function Yn({children:e,content:t,position:r="top",className:n="",delay:a=350}){const[s,o]=h.useState(!1),l=h.useRef(null),c=h.useRef(!1),d=h.useRef(null),u=h.useRef(null),[p,f]=h.useState(null),m=h.useCallback(()=>{const w=d.current;if(!w)return;const k=w.getBoundingClientRect(),E=8,S={position:"fixed",zIndex:9999};switch(r){case"bottom":S.left=k.left+k.width/2,S.top=k.bottom+E,S.transform="translateX(-50%)";break;case"left":S.left=k.left-E,S.top=k.top+k.height/2,S.transform="translate(-100%, -50%)";break;case"right":S.left=k.right+E,S.top=k.top+k.height/2,S.transform="translateY(-50%)";break;case"top":default:S.left=k.left+k.width/2,S.top=k.top-E,S.transform="translate(-50%, -100%)";break}f(S)},[r]),g=()=>{l.current!==null&&(window.clearTimeout(l.current),l.current=null)},b=()=>{g(),l.current=window.setTimeout(()=>{o(!0)},a)},x=()=>{g(),o(!1)},y=()=>{g(),c.current=!1,l.current=window.setTimeout(()=>{c.current=!0,o(!0)},a)},v=()=>{g(),!c.current&&o(!1)};return h.useEffect(()=>()=>{g()},[]),h.useEffect(()=>{if(!s||typeof document>"u")return;const w=k=>{const E=k.target;E instanceof Node&&d.current?.contains(E)||(o(!1),c.current=!1)};return document.addEventListener("pointerdown",w,!0),()=>document.removeEventListener("pointerdown",w,!0)},[s]),h.useEffect(()=>{if(!s){f(null);return}const w=window.requestAnimationFrame(m),k=()=>m();return window.addEventListener("resize",k),window.addEventListener("scroll",k,!0),()=>{window.cancelAnimationFrame(w),window.removeEventListener("resize",k),window.removeEventListener("scroll",k,!0)}},[s,m]),t?i.jsxs("div",{ref:d,className:"relative inline-block",onMouseEnter:b,onMouseLeave:x,onTouchStart:y,onTouchEnd:v,onTouchCancel:v,children:[e,s&&typeof document<"u"&&Bd.createPortal(i.jsxs("div",{ref:u,style:p||{position:"fixed",top:"-9999px",left:"-9999px",opacity:0},className:ue("px-2 py-1 text-xs font-medium text-white bg-gray-900 dark:bg-gray-100 dark:text-gray-900 rounded shadow-lg whitespace-nowrap pointer-events-none","animate-in fade-in-0 zoom-in-95 duration-200",n),children:[t,i.jsx("div",{className:ue("absolute w-0 h-0 border-4 border-transparent",cM(r))})]}),document.body)]}):i.jsx(i.Fragment,{children:e})}const CN=h.createContext(null),AN=h.forwardRef(({className:e,status:t="ready",children:r,...n},a)=>{const s=h.useMemo(()=>({status:t}),[t]);return i.jsx(CN.Provider,{value:s,children:i.jsx("form",{ref:a,"data-slot":"prompt-input",className:ue("relative overflow-hidden rounded-xl border border-border/70 bg-zinc-50/95 shadow-sm shadow-zinc-950/5 backdrop-blur-sm transition-all duration-200 focus-within:border-primary/40 focus-within:shadow-md focus-within:ring-1 focus-within:ring-primary/20 dark:bg-zinc-950/90",e),...n,children:r})})});AN.displayName="PromptInput";const TN=h.forwardRef(({className:e,...t},r)=>i.jsx("div",{ref:r,"data-slot":"prompt-input-header",className:ue("px-3 pt-3",e),...t}));TN.displayName="PromptInputHeader";const jN=h.forwardRef(({className:e,...t},r)=>i.jsx("div",{ref:r,"data-slot":"prompt-input-body",className:ue("relative",e),...t}));jN.displayName="PromptInputBody";const _N=h.forwardRef(({className:e,...t},r)=>i.jsx("textarea",{ref:r,"data-slot":"prompt-input-textarea",className:ue("chat-input-placeholder block max-h-[40vh] w-full resize-none overflow-y-auto bg-transparent px-4 py-2 font-mono text-sm leading-6 text-foreground placeholder-muted-foreground/50 focus:outline-none sm:max-h-[300px]",e),...t}));_N.displayName="PromptInputTextarea";const IN=h.forwardRef(({className:e,...t},r)=>i.jsx("div",{ref:r,"data-slot":"prompt-input-footer",className:ue("flex items-center justify-between border-t border-border/30 px-3 py-2",e),...t}));IN.displayName="PromptInputFooter";const RN=h.forwardRef(({className:e,...t},r)=>i.jsx("div",{ref:r,"data-slot":"prompt-input-tools",className:ue("flex items-center gap-1",e),...t}));RN.displayName="PromptInputTools";const zc=h.forwardRef(({className:e,tooltip:t,children:r,...n},a)=>{const s=i.jsx(_e,{ref:a,type:"button",variant:"ghost",size:"icon",className:ue("h-8 w-8 [&_svg]:size-4",e),...n,children:r});return t?i.jsx(Yn,{content:t.shortcut?i.jsxs("span",{className:"flex items-center gap-1.5",children:[t.content,i.jsx("kbd",{className:"rounded bg-white/20 px-1 text-[10px]",children:t.shortcut})]}):t.content,position:t.side??"top",children:s}):s});zc.displayName="PromptInputButton";const LN=h.forwardRef(({className:e,status:t,children:r,...n},a)=>{const s=h.useContext(CN),o=t??s?.status??"ready",l=o==="submitted"||o==="streaming";return i.jsx(_e,{ref:a,type:l?"button":"submit",variant:"default",size:"icon",className:ue("h-8 w-8 rounded-lg",e),...n,children:r??(l?i.jsx(qd,{className:"h-3.5 w-3.5 fill-current"}):i.jsx(yD,{className:"h-4 w-4"}))})});LN.displayName="PromptInputSubmit";function Gf({children:e,className:t}){return i.jsx("div",{className:ue("inline-flex items-center gap-[2px] rounded-lg bg-muted/60 p-[3px]",t),children:e})}function Hf({isActive:e,onClick:t,children:r,className:n}){return i.jsx("button",{onClick:t,className:ue("flex touch-manipulation items-center gap-1.5 rounded-md px-3 py-2 text-sm font-medium transition-all duration-150",e?"bg-background text-foreground shadow-sm":"text-muted-foreground active:bg-background/50",n),children:r})}const DN=h.createContext(null);function ON(){const e=h.useContext(DN);if(!e)throw new Error("QueueItem sub-components must be used within <QueueItem>");return e}const MN=h.forwardRef(({className:e,...t},r)=>i.jsx("div",{ref:r,"data-slot":"queue",role:"list",className:ue("space-y-0.5",e),...t}));MN.displayName="Queue";const PN=h.forwardRef(({status:e="pending",className:t,children:r,...n},a)=>{const s=h.useMemo(()=>({status:e}),[e]);return i.jsx(DN.Provider,{value:s,children:i.jsx("div",{ref:a,"data-slot":"queue-item","data-status":e,role:"listitem",className:ue("flex items-start gap-2 py-0.5",t),...n,children:r})})});PN.displayName="QueueItem";const FN=h.forwardRef(({className:e,...t},r)=>{const{status:n}=ON();return i.jsxs("div",{ref:r,"data-slot":"queue-item-indicator","aria-hidden":"true",className:ue("mt-0.5 flex h-3.5 w-3.5 flex-shrink-0 items-center justify-center",e),...t,children:[n==="completed"&&i.jsx("svg",{className:"h-3.5 w-3.5 text-green-500 dark:text-green-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z"})}),n==="in_progress"&&i.jsx("span",{className:"h-2 w-2 animate-pulse rounded-full bg-blue-500 dark:bg-blue-400"}),n==="pending"&&i.jsx("svg",{className:"h-3.5 w-3.5 text-muted-foreground/50",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:i.jsx("circle",{cx:"12",cy:"12",r:"9",strokeWidth:2})})]})});FN.displayName="QueueItemIndicator";const zN=h.forwardRef(({className:e,children:t,...r},n)=>{const{status:a}=ON();return i.jsx("div",{ref:n,"data-slot":"queue-item-content",className:ue("min-w-0 flex-1 text-xs",a==="completed"&&"text-muted-foreground line-through",a==="in_progress"&&"font-medium text-foreground",a==="pending"&&"text-foreground",e),...r,children:t})});zN.displayName="QueueItemContent";const fw="https://github.com/alicomert/pixcode/issues/new",dM="https://github.com/alicomert/pixcode",gw="https://discord.gg/buxwujPNRE";function bw({className:e}){return i.jsx("svg",{className:e,fill:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:i.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 uM({updateAvailable:e,releaseInfo:t,latestVersion:r,currentVersion:n,onShowVersionModal:a,onShowSettings:s,t:o}){return i.jsxs("div",{className:"flex-shrink-0",style:{paddingBottom:"env(safe-area-inset-bottom, 0)"},children:[e&&i.jsxs(i.Fragment,{children:[i.jsx("div",{className:"nav-divider"}),i.jsx("div",{className:"hidden px-2 py-1.5 md:block",children:i.jsxs("button",{className:"group flex w-full items-center gap-2.5 rounded-lg px-2.5 py-2 text-left transition-colors hover:bg-blue-50/80 dark:hover:bg-blue-900/15",onClick:a,children:[i.jsxs("div",{className:"relative flex-shrink-0",children:[i.jsx(Vv,{className:"h-4 w-4 text-blue-500 dark:text-blue-400"}),i.jsx("span",{className:"absolute -right-0.5 -top-0.5 h-1.5 w-1.5 animate-pulse rounded-full bg-blue-500"})]}),i.jsxs("div",{className:"min-w-0 flex-1",children:[i.jsx("span",{className:"block truncate text-sm font-medium text-blue-600 dark:text-blue-300",children:t?.title||`v${r}`}),i.jsx("span",{className:"text-[10px] text-blue-500/70 dark:text-blue-400/60",children:o("version.updateAvailable")})]})]})}),i.jsx("div",{className:"px-3 py-2 md:hidden",children:i.jsxs("button",{className:"flex h-11 w-full items-center gap-3 rounded-xl border border-blue-200/60 bg-blue-50/80 px-3.5 transition-all active:scale-[0.98] dark:border-blue-700/40 dark:bg-blue-900/15",onClick:a,children:[i.jsxs("div",{className:"relative flex-shrink-0",children:[i.jsx(Vv,{className:"w-4.5 h-4.5 text-blue-500 dark:text-blue-400"}),i.jsx("span",{className:"absolute -right-0.5 -top-0.5 h-1.5 w-1.5 animate-pulse rounded-full bg-blue-500"})]}),i.jsxs("div",{className:"min-w-0 flex-1 text-left",children:[i.jsx("span",{className:"block truncate text-sm font-medium text-blue-600 dark:text-blue-300",children:t?.title||`v${r}`}),i.jsx("span",{className:"text-xs text-blue-500/70 dark:text-blue-400/60",children:o("version.updateAvailable")})]})]})})]}),i.jsx("div",{className:"nav-divider"}),i.jsx("div",{className:"hidden px-2 pt-1.5 md:block",children:i.jsxs("a",{href:fw,target:"_blank",rel:"noopener noreferrer",className:"flex w-full items-center gap-2 rounded-lg px-2.5 py-1.5 text-muted-foreground transition-colors hover:bg-accent/60 hover:text-foreground",children:[i.jsx(ml,{className:"h-3.5 w-3.5"}),i.jsx("span",{className:"text-sm",children:o("actions.reportIssue")})]})}),i.jsx("div",{className:"hidden px-2 md:block",children:i.jsxs("a",{href:gw,target:"_blank",rel:"noopener noreferrer",className:"flex w-full items-center gap-2 rounded-lg px-2.5 py-1.5 text-muted-foreground transition-colors hover:bg-accent/60 hover:text-foreground",children:[i.jsx(bw,{className:"h-3.5 w-3.5"}),i.jsx("span",{className:"text-sm",children:o("actions.joinCommunity")})]})}),i.jsx("div",{className:"hidden px-2 py-1.5 md:block",children:i.jsxs("button",{className:"flex w-full items-center gap-2 rounded-lg px-2.5 py-1.5 text-muted-foreground transition-colors hover:bg-accent/60 hover:text-foreground",onClick:s,children:[i.jsx(Lt,{className:"h-3.5 w-3.5"}),i.jsx("span",{className:"text-sm",children:o("actions.settings")})]})}),i.jsx("div",{className:"hidden px-3 py-2 text-center md:block",children:i.jsxs("a",{href:dM,target:"_blank",rel:"noopener noreferrer",className:"text-[10px] text-muted-foreground/40 transition-colors hover:text-muted-foreground",children:["Pixcode v",n," – ",o("branding.openSource")]})}),i.jsx("div",{className:"px-3 pt-3 md:hidden",children:i.jsxs("a",{href:fw,target:"_blank",rel:"noopener noreferrer",className:"flex h-12 w-full items-center gap-3.5 rounded-xl bg-muted/40 px-4 transition-all hover:bg-muted/60 active:scale-[0.98]",children:[i.jsx("div",{className:"flex h-8 w-8 items-center justify-center rounded-xl bg-background/80",children:i.jsx(ml,{className:"w-4.5 h-4.5 text-muted-foreground"})}),i.jsx("span",{className:"text-base font-medium text-foreground",children:o("actions.reportIssue")})]})}),i.jsx("div",{className:"px-3 pt-2 md:hidden",children:i.jsxs("a",{href:gw,target:"_blank",rel:"noopener noreferrer",className:"flex h-12 w-full items-center gap-3.5 rounded-xl bg-muted/40 px-4 transition-all hover:bg-muted/60 active:scale-[0.98]",children:[i.jsx("div",{className:"flex h-8 w-8 items-center justify-center rounded-xl bg-background/80",children:i.jsx(bw,{className:"w-4.5 h-4.5 text-muted-foreground"})}),i.jsx("span",{className:"text-base font-medium text-foreground",children:o("actions.joinCommunity")})]})}),i.jsx("div",{className:"px-3 pb-3 pt-2 md:hidden",children:i.jsxs("button",{className:"flex h-12 w-full items-center gap-3.5 rounded-xl bg-muted/40 px-4 transition-all hover:bg-muted/60 active:scale-[0.98]",onClick:s,children:[i.jsx("div",{className:"flex h-8 w-8 items-center justify-center rounded-xl bg-background/80",children:i.jsx(Lt,{className:"w-4.5 h-4.5 text-muted-foreground"})}),i.jsx("span",{className:"text-base font-medium text-foreground",children:o("actions.settings")})]})})]})}const xw="PIXCODE_GITHUB_STARS",yw="PIXCODE_HIDE_GITHUB_STAR",pM=3600*1e3,mM=(e,t)=>{const[r,n]=h.useState(null),[a,s]=h.useState(()=>{try{return localStorage.getItem(yw)==="true"}catch{return!1}});h.useEffect(()=>{if(a)return;try{const d=localStorage.getItem(xw);if(d){const u=JSON.parse(d);if(Date.now()-u.timestamp<pM){n(u.count);return}}}catch{}(async()=>{try{const d=await fetch(`https://api.github.com/repos/${e}/${t}`);if(!d.ok)return;const p=(await d.json()).stargazers_count;if(typeof p=="number"){n(p);try{localStorage.setItem(xw,JSON.stringify({count:p,timestamp:Date.now()}))}catch{}}}catch{}})()},[e,t,a]);const o=h.useCallback(()=>{s(!0);try{localStorage.setItem(yw,"true")}catch{}},[]),l=r!==null?r>=1e3?`${(r/1e3).toFixed(1)}k`:`${r}`:null;return{starCount:r,formattedCount:l,isDismissed:a,dismiss:o}},hM="https://github.com/alicomert/pixcode";function fM({className:e}){return i.jsx("svg",{className:e,fill:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:i.jsx("path",{d:"M12 2C6.477 2 2 6.484 2 12.017c0 4.425 2.865 8.18 6.839 9.504.5.092.682-.217.682-.483 0-.237-.008-.868-.013-1.703-2.782.605-3.369-1.343-3.369-1.343-.454-1.158-1.11-1.466-1.11-1.466-.908-.62.069-.608.069-.608 1.003.07 1.531 1.032 1.531 1.032.892 1.53 2.341 1.088 2.91.832.092-.647.35-1.088.636-1.338-2.22-.253-4.555-1.113-4.555-4.951 0-1.093.39-1.988 1.029-2.688-.103-.253-.446-1.272.098-2.65 0 0 .84-.27 2.75 1.026A9.564 9.564 0 0112 6.844c.85.004 1.705.115 2.504.337 1.909-1.296 2.747-1.027 2.747-1.027.546 1.379.202 2.398.1 2.651.64.7 1.028 1.595 1.028 2.688 0 3.848-2.339 4.695-4.566 4.943.359.309.678.92.678 1.855 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.019 10.019 0 0022 12.017C22 6.484 17.522 2 12 2z"})})}function gM(){const{formattedCount:e,isDismissed:t,dismiss:r}=mM("alicomert","pixcode");return t?null:i.jsxs("div",{className:"group/star relative hidden md:block",children:[i.jsxs("a",{href:hM,target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-1.5 rounded-lg border border-border/50 bg-muted/30 px-2.5 py-1 text-xs text-muted-foreground transition-colors hover:bg-muted/50 hover:text-foreground",children:[i.jsx(fM,{className:"h-3.5 w-3.5"}),i.jsx(Is,{className:"h-3 w-3"}),i.jsx("span",{className:"font-medium",children:"Star"}),e&&i.jsx("span",{className:"border-l border-border/50 pl-1.5 tabular-nums",children:e})]}),i.jsx("button",{onClick:n=>{n.preventDefault(),n.stopPropagation(),r()},className:"absolute -right-1.5 -top-1.5 hidden h-4 w-4 items-center justify-center rounded-full border border-border/50 bg-muted text-muted-foreground transition-colors hover:text-foreground group-hover/star:flex","aria-label":"Dismiss",children:i.jsx(xt,{className:"h-2.5 w-2.5"})})]})}function vw({value:e,onChange:t,t:r}){const n="flex flex-1 items-center justify-center gap-1 rounded-md px-2 py-1 text-[11px] font-medium transition-all";return i.jsxs("div",{role:"tablist","aria-label":r("tooltips.historyView",{defaultValue:"History view"}),className:"flex rounded-lg bg-muted/40 p-0.5",children:[i.jsxs("button",{type:"button",role:"tab","aria-selected":e==="flat",onClick:()=>t("flat"),className:ue(n,e==="flat"?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),title:r("tooltips.historyViewFlat",{defaultValue:"Recent conversations"}),children:[i.jsx(pl,{className:"h-3 w-3"}),r("historyView.flat",{defaultValue:"Recent"})]}),i.jsxs("button",{type:"button",role:"tab","aria-selected":e==="grouped",onClick:()=>t("grouped"),className:ue(n,e==="grouped"?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),title:r("tooltips.historyViewGrouped",{defaultValue:"Grouped by project"}),children:[i.jsx(ED,{className:"h-3 w-3"}),r("historyView.grouped",{defaultValue:"By project"})]})]})}function bM({isPWA:e,isMobile:t,isLoading:r,projectsCount:n,searchFilter:a,onSearchFilterChange:s,onClearSearchFilter:o,searchMode:l,onSearchModeChange:c,onRefresh:d,isRefreshing:u,onCreateProject:p,onQuickStartSession:f,onCollapseSidebar:m,historyView:g,onHistoryViewChange:b,t:x}){const y=()=>i.jsxs("div",{className:"flex min-w-0 items-center gap-2.5",children:[i.jsx("svg",{className:"h-6 w-6 flex-shrink-0",viewBox:"0 0 500 500","aria-hidden":"true",children:i.jsx("g",{transform:"translate(250 250) scale(1.25) translate(-250 -250)",children:i.jsxs("g",{transform:"translate(0 500) scale(0.1 -0.1)",fill:"#5C3FFC",children:[i.jsx("path",{d:"M2037 3800 c-104 -40 -191 -134 -231 -250 -23 -67 -20 -82 22 -109 31 -20 287 -177 1009 -618 40 -24 82 -56 93 -70 27 -34 27 -102 0 -136 -11 -13 -106 -78 -212 -143 -106 -64 -201 -124 -210 -132 -16 -14 -18 -41 -18 -302 0 -291 2 -310 38 -310 16 0 267 148 610 359 180 111 270 173 310 213 216 217 215 574 -3 793 -37 38 -107 89 -185 136 -69 42 -253 154 -410 249 -434 264 -509 307 -563 326 -57 20 -191 17 -250 -6z"}),i.jsx("path",{d:"M1803 2994 c-10 -5 -13 -156 -13 -709 0 -671 1 -706 20 -767 27 -89 93 -184 167 -240 89 -67 157 -90 281 -96 92 -4 105 -2 117 14 12 16 14 134 15 735 0 669 -1 718 -17 737 -20 23 -514 322 -541 327 -9 2 -23 2 -29 -1z"})]})})}),i.jsx("h1",{className:"truncate text-sm font-semibold tracking-tight text-foreground",children:x("app.title")})]});return i.jsxs("div",{className:"flex-shrink-0",children:[i.jsxs("div",{className:"hidden px-4 pb-3 pt-4 md:block",style:{},children:[i.jsxs("div",{className:"flex items-center justify-between gap-2",children:[i.jsx(y,{}),i.jsxs("div",{className:"flex flex-shrink-0 items-center gap-0.5",children:[i.jsx(_e,{variant:"ghost",size:"sm",className:"h-8 w-8 rounded-lg p-0 text-muted-foreground hover:bg-accent/80 hover:text-foreground",onClick:d,disabled:u,title:x("tooltips.refresh"),children:i.jsx(ht,{className:`h-4 w-4 ${u?"animate-spin":""}`})}),i.jsx(_e,{variant:"ghost",size:"sm",className:"h-8 w-8 rounded-lg p-0 text-muted-foreground hover:bg-accent/80 hover:text-foreground",onClick:p,title:x("tooltips.createProject"),children:i.jsx(Ut,{className:"h-4 w-4"})}),i.jsx(_e,{variant:"ghost",size:"sm",className:"h-8 w-8 rounded-lg p-0 text-muted-foreground hover:bg-accent/80 hover:text-foreground",onClick:m,title:x("tooltips.hideSidebar"),children:i.jsx(bD,{className:"h-4 w-4"})})]})]}),i.jsx(gM,{}),f&&i.jsxs("button",{type:"button",onClick:()=>{f()},className:"mt-2.5 flex w-full items-center justify-center gap-2 rounded-lg border border-primary/20 bg-primary/5 px-3 py-2 text-sm font-medium text-primary transition-colors hover:bg-primary/10",children:[i.jsx(Na,{className:"h-4 w-4"}),x("sidebar.newChat",{defaultValue:"New chat"})]}),n>0&&!r&&i.jsxs("div",{className:"mt-2.5 space-y-2",children:[i.jsx(vw,{value:g,onChange:b,t:x}),i.jsxs("div",{className:"flex rounded-lg bg-muted/50 p-0.5",children:[i.jsxs("button",{onClick:()=>c("projects"),"aria-pressed":l==="projects",className:ue("flex-1 flex items-center justify-center gap-1.5 rounded-md px-2 py-1.5 text-xs font-medium transition-all",l==="projects"?"bg-background shadow-sm text-foreground":"text-muted-foreground hover:text-foreground"),children:[i.jsx(Pn,{className:"h-3 w-3"}),x("search.modeProjects")]}),i.jsxs("button",{onClick:()=>c("conversations"),"aria-pressed":l==="conversations",className:ue("flex-1 flex items-center justify-center gap-1.5 rounded-md px-2 py-1.5 text-xs font-medium transition-all",l==="conversations"?"bg-background shadow-sm text-foreground":"text-muted-foreground hover:text-foreground"),children:[i.jsx(na,{className:"h-3 w-3"}),x("search.modeConversations")]})]}),i.jsxs("div",{className:"relative",children:[i.jsx(Ea,{className:"pointer-events-none absolute left-3 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-muted-foreground/50"}),i.jsx(Nt,{type:"text",placeholder:x(l==="conversations"?"search.conversationsPlaceholder":"projects.searchPlaceholder"),value:a,onChange:v=>s(v.target.value),className:"nav-search-input h-9 rounded-xl border-0 pl-9 pr-8 text-sm transition-all duration-200 placeholder:text-muted-foreground/40 focus-visible:ring-0 focus-visible:ring-offset-0"}),a&&i.jsx("button",{onClick:o,"aria-label":x("tooltips.clearSearch"),className:"absolute right-2.5 top-1/2 -translate-y-1/2 rounded-md p-0.5 hover:bg-accent",children:i.jsx(xt,{className:"h-3 w-3 text-muted-foreground"})})]})]})]}),i.jsx("div",{className:"nav-divider hidden md:block"}),i.jsxs("div",{className:"p-3 pb-2 md:hidden",style:e&&t?{paddingTop:"16px"}:{},children:[i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsx(y,{}),i.jsxs("div",{className:"flex flex-shrink-0 gap-1.5",children:[i.jsx("button",{className:"flex h-8 w-8 items-center justify-center rounded-lg bg-muted/50 transition-all active:scale-95",onClick:d,disabled:u,children:i.jsx(ht,{className:`h-4 w-4 text-muted-foreground ${u?"animate-spin":""}`})}),i.jsx("button",{className:"flex h-8 w-8 items-center justify-center rounded-lg bg-primary/90 text-primary-foreground transition-all active:scale-95",onClick:p,children:i.jsx(ai,{className:"h-4 w-4"})})]})]}),n>0&&!r&&i.jsxs("div",{className:"mt-2.5 space-y-2",children:[l==="projects"&&i.jsx(vw,{value:g,onChange:b,t:x}),i.jsxs("div",{className:"flex rounded-lg bg-muted/50 p-0.5",children:[i.jsxs("button",{onClick:()=>c("projects"),"aria-pressed":l==="projects",className:ue("flex-1 flex items-center justify-center gap-1.5 rounded-md px-2 py-1.5 text-xs font-medium transition-all",l==="projects"?"bg-background shadow-sm text-foreground":"text-muted-foreground hover:text-foreground"),children:[i.jsx(Pn,{className:"h-3 w-3"}),x("search.modeProjects")]}),i.jsxs("button",{onClick:()=>c("conversations"),"aria-pressed":l==="conversations",className:ue("flex-1 flex items-center justify-center gap-1.5 rounded-md px-2 py-1.5 text-xs font-medium transition-all",l==="conversations"?"bg-background shadow-sm text-foreground":"text-muted-foreground hover:text-foreground"),children:[i.jsx(na,{className:"h-3 w-3"}),x("search.modeConversations")]})]}),i.jsxs("div",{className:"relative",children:[i.jsx(Ea,{className:"pointer-events-none absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground/50"}),i.jsx(Nt,{type:"text",placeholder:x(l==="conversations"?"search.conversationsPlaceholder":"projects.searchPlaceholder"),value:a,onChange:v=>s(v.target.value),className:"nav-search-input h-10 rounded-xl border-0 pl-10 pr-9 text-sm transition-all duration-200 placeholder:text-muted-foreground/40 focus-visible:ring-0 focus-visible:ring-offset-0"}),a&&i.jsx("button",{onClick:o,"aria-label":x("tooltips.clearSearch"),className:"absolute right-2.5 top-1/2 -translate-y-1/2 rounded-md p-1 hover:bg-accent",children:i.jsx(xt,{className:"h-3.5 w-3.5 text-muted-foreground"})})]})]})]}),i.jsx("div",{className:"nav-divider md:hidden"})]})}const xM=160,ww=180;function BN({actions:e,className:t,triggerLabel:r}){const[n,a]=h.useState(!1),[s,o]=h.useState(null),l=h.useRef(null),c=h.useRef(null);h.useLayoutEffect(()=>{if(!n||!l.current)return;const u=l.current.getBoundingClientRect();let p=u.right-xM;p<8&&(p=8);let f=u.bottom+4;f+ww>window.innerHeight&&(f=Math.max(8,u.top-4-ww)),o({top:f,left:p})},[n]),h.useEffect(()=>{if(!n)return;const u=m=>{const g=m.target;l.current?.contains(g)||c.current?.contains(g)||a(!1)},p=m=>{m.key==="Escape"&&a(!1)},f=()=>a(!1);return document.addEventListener("mousedown",u),document.addEventListener("keydown",p),window.addEventListener("scroll",f,!0),window.addEventListener("resize",f),()=>{document.removeEventListener("mousedown",u),document.removeEventListener("keydown",p),window.removeEventListener("scroll",f,!0),window.removeEventListener("resize",f)}},[n]);const d=u=>p=>{p.stopPropagation(),p.preventDefault(),a(!1),u.onClick()};return i.jsxs(i.Fragment,{children:[i.jsx("button",{ref:l,type:"button","aria-haspopup":"menu","aria-expanded":n,"aria-label":r||"Actions",title:r||"Actions",onClick:u=>{u.stopPropagation(),u.preventDefault(),a(p=>!p)},className:ue("flex h-6 w-6 items-center justify-center rounded-md text-muted-foreground","opacity-0 transition-all duration-150 hover:bg-accent hover:text-foreground","group-hover:opacity-100 focus-visible:opacity-100 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-primary","touch:opacity-100",n&&"bg-accent text-foreground opacity-100",t),children:i.jsx(LD,{className:"h-3.5 w-3.5"})}),n&&s&&Bd.createPortal(i.jsx("div",{ref:c,role:"menu",style:{position:"fixed",top:s.top,left:s.left,zIndex:9999},className:ue("w-40 rounded-xl border border-border/60 bg-popover p-1 shadow-lg","animate-in fade-in-0 zoom-in-95 duration-100"),onClick:u=>u.stopPropagation(),onMouseDown:u=>u.stopPropagation(),children:e.map((u,p)=>{const f=u.icon,m=e[p-1],g=p>0&&u.danger&&!m?.danger;return i.jsxs("div",{children:[g&&i.jsx("div",{className:"my-1 h-px bg-border/60"}),i.jsxs("button",{type:"button",role:"menuitem",onClick:d(u),className:ue("flex w-full items-center gap-2 rounded-md px-2 py-1.5 text-left text-xs",u.danger?"text-red-600 hover:bg-red-50 dark:text-red-400 dark:hover:bg-red-900/20":"text-foreground hover:bg-accent"),children:[i.jsx(f,{className:"h-3 w-3"}),u.label]})]},u.id)})}),document.body)]})}const kw={xs:"w-3 h-3",sm:"w-4 h-4",md:"w-5 h-5",lg:"w-6 h-6"},yM={xs:"p-0.5",sm:"p-1",md:"p-1.5",lg:"p-2"},vM=e=>e==="fully-configured"?{icon:ra,colorClassName:"text-green-500 dark:text-green-400",backgroundClassName:"bg-green-50 dark:bg-green-950",label:"TaskMaster Ready",title:"TaskMaster fully configured with MCP server"}:e==="taskmaster-only"?{icon:Lt,colorClassName:"text-blue-500 dark:text-blue-400",backgroundClassName:"bg-blue-50 dark:bg-blue-950",label:"TaskMaster Init",title:"TaskMaster initialized, MCP server needs setup"}:e==="mcp-only"?{icon:En,colorClassName:"text-amber-500 dark:text-amber-400",backgroundClassName:"bg-amber-50 dark:bg-amber-950",label:"MCP Ready",title:"MCP server configured, TaskMaster needs initialization"}:{icon:xt,colorClassName:"text-gray-400 dark:text-gray-500",backgroundClassName:"bg-gray-50 dark:bg-gray-900",label:"No TaskMaster",title:"TaskMaster not configured"};function wM({status:e="not-configured",size:t="sm",className:r="",showLabel:n=!1}){const a=vM(e),s=a.icon;return n?i.jsxs("div",{className:ue("inline-flex items-center gap-1.5 text-xs rounded-md px-2 py-1 transition-colors",a.backgroundClassName,a.colorClassName,r),title:a.title,children:[i.jsx(s,{className:kw[t]}),i.jsx("span",{className:"font-medium",children:a.label})]}):i.jsx("div",{className:ue("inline-flex items-center justify-center rounded-full transition-colors",a.backgroundClassName,yM[t],r),title:a.title,children:i.jsx(s,{className:ue(kw[t],a.colorClassName)})})}const kM=(e,t,r)=>{const n=new Date(e),a=t;if(isNaN(n.getTime()))return r?r("status.unknown"):"Unknown";const s=a.getTime()-n.getTime(),o=Math.floor(s/1e3),l=Math.floor(s/(1e3*60)),c=Math.floor(s/(1e3*60*60)),d=Math.floor(s/(1e3*60*60*24));return o<60?r?r("time.justNow"):"Just now":l===1?r?r("time.oneMinuteAgo"):"1 min ago":l<60?r?r("time.minutesAgo",{count:l}):`${l} mins ago`:c===1?r?r("time.oneHourAgo"):"1 hour ago":c<24?r?r("time.hoursAgo",{count:c}):`${c} hours ago`:d===1?r?r("time.oneDayAgo"):"1 day ago":d<7?r?r("time.daysAgo",{count:d}):`${d} days ago`:n.toLocaleDateString()};function Sw({isStarred:e,canDelete:t,onRename:r,onToggleStar:n,onDelete:a,t:s,className:o}){const l=d=>i.jsx(Is,{className:`${d.className??""} ${e?"fill-yellow-400 text-yellow-500":""}`}),c=[{id:"rename",label:s("actions.rename"),icon:AD,onClick:r},{id:"star",label:e?s("actions.unstarSession",{defaultValue:"Remove star"}):s("actions.starSession",{defaultValue:"Star"}),icon:l,onClick:n}];return t&&c.push({id:"delete",label:s("actions.delete"),icon:kr,onClick:a,danger:!0}),i.jsx(BN,{actions:c,className:o,triggerLabel:s("tooltips.sessionActions",{defaultValue:"Session actions"})})}const SM={claude:"Claude",cursor:"Cursor",codex:"Codex",gemini:"Gemini",qwen:"Qwen Code",opencode:"OpenCode"},Ew={claude:"bg-orange-500/10 text-orange-600 dark:bg-orange-400/10 dark:text-orange-300 ring-1 ring-orange-500/15",cursor:"bg-sky-500/10 text-sky-600 dark:bg-sky-400/10 dark:text-sky-300 ring-1 ring-sky-500/15",codex:"bg-violet-500/10 text-violet-600 dark:bg-violet-400/10 dark:text-violet-300 ring-1 ring-violet-500/15",gemini:"bg-emerald-500/10 text-emerald-600 dark:bg-emerald-400/10 dark:text-emerald-300 ring-1 ring-emerald-500/15",qwen:"bg-amber-500/10 text-amber-600 dark:bg-amber-400/10 dark:text-amber-300 ring-1 ring-amber-500/15",opencode:"bg-teal-500/10 text-teal-600 dark:bg-teal-400/10 dark:text-teal-300 ring-1 ring-teal-500/15"};function $N({project:e,session:t,selectedSession:r,currentTime:n,editingSession:a,editingSessionName:s,isStarred:o,compact:l=!1,onEditingSessionNameChange:c,onStartEditingSession:d,onCancelEditingSession:u,onSaveEditingSession:p,onToggleStarSession:f,onProjectSelect:m,onSessionSelect:g,onDeleteSession:b,t:x}){const y=i9(t,n,x),v=r?.id===t.id,w=a===t.id,k=t.__provider,E=SM[k]??k,S=Ew[k]??Ew.claude,j=r9(y.sessionName),_=()=>{m(e),g(t,e.name)},T=()=>{p(e.name,t.id,s,k)},C=()=>{b(e.name,t.id,y.sessionName,k)},L=()=>d(t.id,y.sessionName),A=()=>f(e.name,t.id),I=i.jsxs("div",{className:"mt-0.5 flex min-w-0 flex-wrap items-center gap-1 text-[10px] leading-tight",children:[i.jsxs("span",{className:ue("inline-flex items-center gap-1 rounded-full px-1.5 py-px font-medium",S),children:[i.jsx(dr,{provider:k,className:"h-2.5 w-2.5"}),E]}),i.jsx("span",{className:"text-muted-foreground/80",children:kM(y.sessionTime,n,x)}),y.isActive&&i.jsxs("span",{className:"inline-flex items-center gap-1 text-green-600 dark:text-green-400",children:[i.jsx("span",{className:"h-1.5 w-1.5 animate-pulse rounded-full bg-green-500"}),x("status.active",{defaultValue:"Active"})]}),j.slice(0,3).map(z=>i.jsxs("span",{className:"rounded-md bg-muted/60 px-1 py-px font-mono text-[9px] uppercase tracking-wide text-muted-foreground ring-1 ring-border/40",children:[".",z]},z))]}),N=i.jsxs(i.Fragment,{children:[i.jsx("input",{type:"text",value:s,onChange:z=>c(z.target.value),onKeyDown:z=>{z.stopPropagation(),z.key==="Enter"?T():z.key==="Escape"&&u()},onClick:z=>z.stopPropagation(),className:"w-full rounded-md border border-primary/40 bg-background px-2 py-1 text-xs focus:outline-none focus:ring-1 focus:ring-primary",autoFocus:!0}),i.jsx("button",{className:"flex h-6 w-6 items-center justify-center rounded-md bg-green-50 hover:bg-green-100 dark:bg-green-900/20 dark:hover:bg-green-900/40",onClick:z=>{z.stopPropagation(),T()},title:x("tooltips.save"),children:i.jsx(rr,{className:"h-3 w-3 text-green-600 dark:text-green-400"})}),i.jsx("button",{className:"flex h-6 w-6 items-center justify-center rounded-md bg-gray-50 hover:bg-gray-100 dark:bg-gray-900/20 dark:hover:bg-gray-900/40",onClick:z=>{z.stopPropagation(),u()},title:x("tooltips.cancel"),children:i.jsx(xt,{className:"h-3 w-3 text-gray-600 dark:text-gray-400"})})]}),P=i.jsx("div",{className:"md:hidden",children:i.jsx("div",{className:ue("relative mx-3 my-0.5 rounded-lg border border-border/30 bg-card p-2 transition-all duration-150 active:scale-[0.98]",v&&"border-primary/30 bg-primary/5 shadow-sm",!v&&y.isActive&&"border-green-500/25 bg-green-50/5 dark:bg-green-900/5",o&&!v&&"ring-1 ring-yellow-300/50 dark:ring-yellow-500/30"),onClick:w?void 0:_,children:w?i.jsx("div",{className:"flex items-center gap-1",children:N}):i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("div",{className:ue("flex h-6 w-6 flex-shrink-0 items-center justify-center rounded-md",v?"bg-primary/10":"bg-muted/60"),children:i.jsx(dr,{provider:k,className:"h-3 w-3"})}),i.jsxs("div",{className:"min-w-0 flex-1",children:[i.jsxs("div",{className:"flex items-center gap-1",children:[o&&i.jsx("span",{className:"text-yellow-500","aria-hidden":!0,children:"★"}),i.jsx("span",{className:"truncate text-xs font-medium text-foreground",children:y.sessionName})]}),I]}),i.jsx("div",{className:"flex-shrink-0",onClick:z=>z.stopPropagation(),children:i.jsx(Sw,{isStarred:o,canDelete:!y.isCursorSession,onRename:L,onToggleStar:A,onDelete:C,t:x,className:"!opacity-100"})})]})})}),H=i.jsxs("div",{className:ue("group/item relative hidden md:block"),children:[i.jsxs(_e,{variant:"ghost",className:ue("relative h-auto w-full justify-start overflow-hidden p-0 text-left font-normal transition-colors duration-150","hover:bg-accent/60",v&&"bg-accent text-accent-foreground",o&&!v&&"bg-yellow-50/40 hover:bg-yellow-100/40 dark:bg-yellow-900/10 dark:hover:bg-yellow-900/20",l?"rounded-xl px-3 py-2.5":"rounded-lg px-3 py-2"),onClick:w?void 0:()=>g(t,e.name),children:[v&&i.jsx("span",{"aria-hidden":!0,className:"absolute left-0 top-1/2 h-5 w-0.5 -translate-y-1/2 rounded-r bg-primary"}),!v&&!w&&i.jsx("span",{"aria-hidden":!0,className:"session-item-accent"}),i.jsxs("div",{className:"flex w-full min-w-0 items-start gap-2 pr-6",children:[i.jsx("div",{className:ue("mt-0.5 flex h-5 w-5 flex-shrink-0 items-center justify-center rounded-md",v?"bg-primary/10":"bg-muted/50 group-hover/item:bg-muted/80"),children:i.jsx(dr,{provider:k,className:"h-3 w-3"})}),i.jsx("div",{className:"min-w-0 flex-1",children:w?i.jsx("div",{className:"flex items-center gap-1",children:N}):i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:"flex min-w-0 items-center gap-1",children:[o&&i.jsx("span",{className:"flex-shrink-0 text-yellow-500","aria-hidden":!0,children:"★"}),i.jsx("span",{className:"truncate text-xs font-medium text-foreground",children:y.sessionName})]}),I]})})]})]}),!w&&i.jsx("div",{className:"absolute right-1.5 top-1/2 -translate-y-1/2",onClick:z=>z.stopPropagation(),children:i.jsx(Sw,{isStarred:o,canDelete:!y.isCursorSession,onRename:L,onToggleStar:A,onDelete:C,t:x,className:"opacity-0 focus-visible:opacity-100 group-hover/item:opacity-100"})})]});return i.jsxs("div",{className:"group relative",children:[P,H]})}const EM=e=>e==="claude-code"?"claude":e==="codex"?"codex":e==="gemini"?"gemini":e==="qwen"?"qwen":e==="opencode"?"opencode":null;function NM(){return i.jsx(i.Fragment,{children:Array.from({length:3}).map((e,t)=>i.jsx("div",{className:"rounded-md p-2",children:i.jsxs("div",{className:"flex items-start gap-2",children:[i.jsx("div",{className:"mt-0.5 h-3 w-3 animate-pulse rounded-full bg-muted"}),i.jsxs("div",{className:"flex-1 space-y-1",children:[i.jsx("div",{className:"h-3 animate-pulse rounded bg-muted",style:{width:`${60+t*15}%`}}),i.jsx("div",{className:"h-2 w-1/2 animate-pulse rounded bg-muted"})]})]})},t))})}function CM({project:e,isExpanded:t,sessions:r,selectedSession:n,initialSessionsLoaded:a,isLoadingSessions:s,currentTime:o,editingSession:l,editingSessionName:c,isSessionStarred:d,onEditingSessionNameChange:u,onStartEditingSession:p,onCancelEditingSession:f,onSaveEditingSession:m,onToggleStarSession:g,onProjectSelect:b,onSessionSelect:x,onDeleteSession:y,onLoadMoreSessions:v,onNewSession:w,onOpenOrchestration:k,t:E}){const[S,j]=h.useState([]);if(h.useEffect(()=>{if(!t)return;let C=!1;const L=async()=>{const I=await ve(`/api/orchestration/workflows/runs?projectId=${encodeURIComponent(e.name)}`);if(!I.ok)return;const N=await I.json();C||j((N.runs??[]).slice(0,5))};L();const A=window.setInterval(()=>{L()},15e3);return()=>{C=!0,window.clearInterval(A)}},[t,e.name]),!t)return null;const _=r.length>0,T=e.sessionMeta?.hasMore===!0;return i.jsxs("div",{className:"ml-3 space-y-1 border-l border-border pl-3",children:[i.jsx("div",{className:"px-3 pb-1 pt-1 md:hidden",children:i.jsxs("button",{className:"flex h-8 w-full items-center justify-center gap-2 rounded-md bg-primary text-xs font-medium text-primary-foreground transition-all duration-150 hover:bg-primary/90 active:scale-[0.98]",onClick:()=>{b(e),w(e)},children:[i.jsx(Ut,{className:"h-3 w-3"}),E("sessions.newSession")]})}),i.jsxs(_e,{variant:"default",size:"sm",className:"hidden h-8 w-full justify-start gap-2 bg-primary text-xs font-medium text-primary-foreground transition-colors hover:bg-primary/90 md:flex",onClick:()=>w(e),children:[i.jsx(Ut,{className:"h-3 w-3"}),E("sessions.newSession")]}),S.length>0&&i.jsxs("div",{className:"space-y-1",children:[i.jsxs("div",{className:"flex items-center gap-1 px-3 pt-2 text-[10px] font-semibold uppercase tracking-wide text-muted-foreground",children:[i.jsx(aa,{className:"h-3 w-3"}),E("orchestration.section")]}),S.map(C=>{const L=[...new Set(C.nodeRuns.map(A=>EM(A.adapterId)).filter(Boolean))];return i.jsx("button",{type:"button",onClick:()=>k?.(e,C.id),className:"w-full rounded-lg px-3 py-2 text-left transition-colors hover:bg-accent/60",children:i.jsxs("div",{className:"flex min-w-0 items-start gap-2",children:[i.jsx(aa,{className:"mt-0.5 h-4 w-4 flex-shrink-0 text-primary"}),i.jsxs("div",{className:"min-w-0 flex-1",children:[i.jsx("div",{className:"truncate text-xs font-medium text-foreground",children:C.input||E("orchestration.fallbackTitle")}),i.jsxs("div",{className:"mt-1 flex items-center gap-1",children:[L.slice(0,4).map(A=>i.jsx("span",{className:"flex h-4 w-4 items-center justify-center rounded bg-muted",children:i.jsx(dr,{provider:A,className:"h-3 w-3"})},A)),i.jsx("span",{className:"text-[10px] text-muted-foreground",children:E(`common:orchestration.status.${C.status}`,{defaultValue:C.status})})]})]})]})},C.id)})]}),a?!_&&!s?i.jsx("div",{className:"px-3 py-2 text-left",children:i.jsx("p",{className:"text-xs text-muted-foreground",children:E("sessions.noSessions")})}):r.map(C=>i.jsx($N,{project:e,session:C,selectedSession:n,currentTime:o,editingSession:l,editingSessionName:c,isStarred:d(e.name,C.id),onEditingSessionNameChange:u,onStartEditingSession:p,onCancelEditingSession:f,onSaveEditingSession:m,onToggleStarSession:g,onProjectSelect:b,onSessionSelect:x,onDeleteSession:y,t:E},C.id)):i.jsx(NM,{}),_&&T&&i.jsx(_e,{variant:"ghost",size:"sm",className:"mt-2 w-full justify-center gap-2 text-muted-foreground",onClick:()=>v(e),disabled:s,children:s?i.jsxs(i.Fragment,{children:[i.jsx("div",{className:"h-3 w-3 animate-spin rounded-full border border-muted-foreground border-t-transparent"}),E("sessions.loading")]}):i.jsxs(i.Fragment,{children:[i.jsx(Pr,{className:"h-3 w-3"}),E("sessions.showMore")]})})]})}const AM=(e,t)=>{const r=e.length;return t&&r>=5?`${r}+`:`${r}`};function TM({project:e,selectedProject:t,selectedSession:r,isExpanded:n,isDeleting:a,isStarred:s,editingProject:o,editingName:l,sessions:c,initialSessionsLoaded:d,isLoadingSessions:u,currentTime:p,editingSession:f,editingSessionName:m,tasksEnabled:g,mcpServerStatus:b,isSessionStarred:x,onEditingNameChange:y,onToggleProject:v,onProjectSelect:w,onToggleStarProject:k,onToggleStarSession:E,onStartEditingProject:S,onCancelEditingProject:j,onSaveProjectName:_,onDeleteProject:T,onSessionSelect:C,onDeleteSession:L,onLoadMoreSessions:A,onNewSession:I,onOpenOrchestration:N,onEditingSessionNameChange:P,onStartEditingSession:H,onCancelEditingSession:z,onSaveEditingSession:U,t:V}){const O=t?.name===e.name,G=o===e.name,$=e.sessionMeta?.hasMore===!0,F=AM(c,$),te=`${F} session${c.length===1?"":"s"}`,Q=l9(e,b),ge=()=>v(e.name),ae=()=>k(e.name),me=()=>{_(e.name)},pe=()=>{t?.name!==e.name&&w(e),ge()};return i.jsxs("div",{className:ue("md:space-y-1",a&&"opacity-50 pointer-events-none"),children:[i.jsxs("div",{className:"md:group group",children:[i.jsx("div",{className:"md:hidden",children:i.jsx("div",{className:ue("p-3 mx-3 my-1 rounded-lg bg-card border border-border/50 active:scale-[0.98] transition-all duration-150",O&&"bg-primary/5 border-primary/20",s&&!O&&"bg-yellow-50/50 dark:bg-yellow-900/5 border-yellow-200/30 dark:border-yellow-800/30"),onClick:ge,children:i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsxs("div",{className:"flex min-w-0 flex-1 items-center gap-3",children:[i.jsx("div",{className:ue("w-8 h-8 rounded-lg flex items-center justify-center transition-colors",n?"bg-primary/10":"bg-muted"),children:n?i.jsx(Sa,{className:"h-4 w-4 text-primary"}):i.jsx(Pn,{className:"h-4 w-4 text-muted-foreground"})}),i.jsx("div",{className:"min-w-0 flex-1",children:G?i.jsx("input",{type:"text",value:l,onChange:be=>y(be.target.value),className:"w-full rounded-lg border-2 border-primary/40 bg-background px-3 py-2 text-sm text-foreground shadow-sm transition-all duration-200 focus:border-primary focus:shadow-md focus:outline-none",placeholder:V("projects.projectNamePlaceholder"),autoFocus:!0,autoComplete:"off",onClick:be=>be.stopPropagation(),onKeyDown:be=>{be.key==="Enter"&&me(),be.key==="Escape"&&j()},style:{fontSize:"16px",WebkitAppearance:"none",borderRadius:"8px"}}):i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:"flex min-w-0 flex-1 items-center justify-between",children:[i.jsx("h3",{className:"truncate text-sm font-medium text-foreground",children:e.displayName}),g&&i.jsx(wM,{status:Q,size:"xs",className:"ml-2 hidden flex-shrink-0 md:inline-flex"})]}),i.jsx("p",{className:"text-xs text-muted-foreground",children:te})]})})]}),i.jsx("div",{className:"flex items-center gap-1",children:G?i.jsxs(i.Fragment,{children:[i.jsx("button",{className:"flex h-8 w-8 items-center justify-center rounded-lg bg-green-500 shadow-sm transition-all duration-150 active:scale-90 active:shadow-none dark:bg-green-600",onClick:be=>{be.stopPropagation(),me()},children:i.jsx(rr,{className:"h-4 w-4 text-white"})}),i.jsx("button",{className:"flex h-8 w-8 items-center justify-center rounded-lg bg-gray-500 shadow-sm transition-all duration-150 active:scale-90 active:shadow-none dark:bg-gray-600",onClick:be=>{be.stopPropagation(),j()},children:i.jsx(xt,{className:"h-4 w-4 text-white"})})]}):i.jsxs(i.Fragment,{children:[i.jsx("button",{className:ue("w-8 h-8 rounded-lg flex items-center justify-center active:scale-90 transition-all duration-150 border",s?"bg-yellow-500/10 dark:bg-yellow-900/30 border-yellow-200 dark:border-yellow-800":"bg-gray-500/10 dark:bg-gray-900/30 border-gray-200 dark:border-gray-800"),onClick:be=>{be.stopPropagation(),ae()},title:V(s?"tooltips.removeFromFavorites":"tooltips.addToFavorites"),children:i.jsx(Is,{className:ue("w-4 h-4 transition-colors",s?"text-yellow-600 dark:text-yellow-400 fill-current":"text-gray-600 dark:text-gray-400")})}),i.jsx("button",{className:"flex h-8 w-8 items-center justify-center rounded-lg border border-red-200 bg-red-500/10 active:scale-90 dark:border-red-800 dark:bg-red-900/30",onClick:be=>{be.stopPropagation(),T(e)},children:i.jsx(kr,{className:"h-4 w-4 text-red-600 dark:text-red-400"})}),i.jsx("button",{className:"flex h-8 w-8 items-center justify-center rounded-lg border border-primary/20 bg-primary/10 active:scale-90 dark:border-primary/30 dark:bg-primary/20",onClick:be=>{be.stopPropagation(),S(e)},children:i.jsx(Um,{className:"h-4 w-4 text-primary"})}),i.jsx("div",{className:"flex h-6 w-6 items-center justify-center rounded-md bg-muted/30",children:n?i.jsx(Pr,{className:"h-3 w-3 text-muted-foreground"}):i.jsx(An,{className:"h-3 w-3 text-muted-foreground"})})]})})]})})}),i.jsxs(_e,{variant:"ghost",className:ue("hidden md:flex w-full justify-between p-2 h-auto font-normal hover:bg-accent/50",O&&"bg-accent text-accent-foreground",s&&!O&&"bg-yellow-50/50 dark:bg-yellow-900/10 hover:bg-yellow-100/50 dark:hover:bg-yellow-900/20"),onClick:pe,children:[i.jsxs("div",{className:"flex min-w-0 flex-1 items-center gap-3",children:[n?i.jsx(Sa,{className:"h-4 w-4 flex-shrink-0 text-primary"}):i.jsx(Pn,{className:"h-4 w-4 flex-shrink-0 text-muted-foreground"}),i.jsx("div",{className:"min-w-0 flex-1 text-left",children:G?i.jsxs("div",{className:"space-y-1",children:[i.jsx("input",{type:"text",value:l,onChange:be=>y(be.target.value),className:"w-full rounded border border-border bg-background px-2 py-1 text-sm text-foreground focus:ring-2 focus:ring-primary/20",placeholder:V("projects.projectNamePlaceholder"),autoFocus:!0,onKeyDown:be=>{be.key==="Enter"&&me(),be.key==="Escape"&&j()}}),i.jsx("div",{className:"truncate text-xs text-muted-foreground",title:e.fullPath,children:e.fullPath})]}):i.jsxs("div",{children:[i.jsx("div",{className:"truncate text-sm font-semibold text-foreground",title:e.displayName,children:e.displayName}),i.jsxs("div",{className:"text-xs text-muted-foreground",children:[F,e.fullPath!==e.displayName&&i.jsxs("span",{className:"ml-1 opacity-60",title:e.fullPath,children:[" - ",e.fullPath.length>25?`...${e.fullPath.slice(-22)}`:e.fullPath]})]})]})})]}),i.jsx("div",{className:"flex flex-shrink-0 items-center gap-1",children:G?i.jsxs(i.Fragment,{children:[i.jsx("div",{className:"flex h-6 w-6 cursor-pointer items-center justify-center rounded text-green-600 transition-colors hover:bg-green-50 hover:text-green-700 dark:hover:bg-green-900/20",onClick:be=>{be.stopPropagation(),me()},children:i.jsx(rr,{className:"h-3 w-3"})}),i.jsx("div",{className:"flex h-6 w-6 cursor-pointer items-center justify-center rounded text-gray-500 transition-colors hover:bg-gray-50 hover:text-gray-700 dark:hover:bg-gray-800",onClick:be=>{be.stopPropagation(),j()},children:i.jsx(xt,{className:"h-3 w-3"})})]}):i.jsxs(i.Fragment,{children:[s&&i.jsx("div",{className:"flex h-6 w-6 cursor-pointer items-center justify-center rounded hover:bg-yellow-50 dark:hover:bg-yellow-900/20",onClick:be=>{be.stopPropagation(),ae()},title:V("tooltips.removeFromFavorites"),children:i.jsx(Is,{className:"h-3 w-3 fill-current text-yellow-600 dark:text-yellow-400"})}),i.jsx(BN,{triggerLabel:V("tooltips.projectActions",{defaultValue:"Project actions"}),actions:[{id:"rename",label:V("actions.rename"),icon:Um,onClick:()=>S(e)},{id:"star",label:V(s?"tooltips.removeFromFavorites":"tooltips.addToFavorites"),icon:Is,onClick:ae},{id:"delete",label:V("actions.delete",{defaultValue:"Delete"}),icon:kr,onClick:()=>T(e),danger:!0}]}),n?i.jsx(Pr,{className:"h-4 w-4 text-muted-foreground transition-colors group-hover:text-foreground"}):i.jsx(An,{className:"h-4 w-4 text-muted-foreground transition-colors group-hover:text-foreground"})]})})]})]}),i.jsx(CM,{project:e,isExpanded:n,sessions:c,selectedSession:r,initialSessionsLoaded:d,isLoadingSessions:u,currentTime:p,editingSession:f,editingSessionName:m,isSessionStarred:x,onEditingSessionNameChange:P,onStartEditingSession:H,onCancelEditingSession:z,onSaveEditingSession:U,onToggleStarSession:E,onProjectSelect:w,onSessionSelect:C,onDeleteSession:L,onLoadMoreSessions:A,onNewSession:I,onOpenOrchestration:N,t:V})]})}function UN({isLoading:e,loadingProgress:t,projectsCount:r,filteredProjectsCount:n,t:a}){return e?i.jsxs("div",{className:"px-4 py-12 text-center md:py-8",children:[i.jsx("div",{className:"mx-auto mb-4 flex h-12 w-12 items-center justify-center rounded-lg bg-muted md:mb-3",children:i.jsx("div",{className:"h-6 w-6 animate-spin rounded-full border-2 border-muted-foreground border-t-transparent"})}),i.jsx("h3",{className:"mb-2 text-base font-medium text-foreground md:mb-1",children:a("projects.loadingProjects")}),t&&t.total>0?i.jsxs("div",{className:"space-y-2",children:[i.jsx("div",{className:"h-2 w-full overflow-hidden rounded-full bg-muted",children:i.jsx("div",{className:"h-full bg-primary transition-all duration-300 ease-out",style:{width:`${t.current/t.total*100}%`}})}),i.jsxs("p",{className:"text-sm text-muted-foreground",children:[t.current,"/",t.total," ",a("projects.projects")]}),t.currentProject&&i.jsx("p",{className:"mx-auto max-w-[200px] truncate text-xs text-muted-foreground/70",title:t.currentProject,children:t.currentProject.split("-").slice(-2).join("/")})]}):i.jsx("p",{className:"text-sm text-muted-foreground",children:a("projects.fetchingProjects")})]}):r===0?i.jsxs("div",{className:"px-4 py-12 text-center md:py-8",children:[i.jsx("div",{className:"mx-auto mb-4 flex h-12 w-12 items-center justify-center rounded-lg bg-muted md:mb-3",children:i.jsx(Pn,{className:"h-6 w-6 text-muted-foreground"})}),i.jsx("h3",{className:"mb-2 text-base font-medium text-foreground md:mb-1",children:a("projects.noProjects")}),i.jsx("p",{className:"text-sm text-muted-foreground",children:a("projects.runClaudeCli")})]}):n===0?i.jsxs("div",{className:"px-4 py-12 text-center md:py-8",children:[i.jsx("div",{className:"mx-auto mb-4 flex h-12 w-12 items-center justify-center rounded-lg bg-muted md:mb-3",children:i.jsx(Ea,{className:"h-6 w-6 text-muted-foreground"})}),i.jsx("h3",{className:"mb-2 text-base font-medium text-foreground md:mb-1",children:a("projects.noMatchingProjects")}),i.jsx("p",{className:"text-sm text-muted-foreground",children:a("projects.tryDifferentSearch")})]}):null}function jM({projects:e,filteredProjects:t,selectedProject:r,selectedSession:n,isLoading:a,loadingProgress:s,expandedProjects:o,editingProject:l,editingName:c,loadingSessions:d,initialSessionsLoaded:u,currentTime:p,editingSession:f,editingSessionName:m,deletingProjects:g,tasksEnabled:b,mcpServerStatus:x,getProjectSessions:y,isProjectStarred:v,isSessionStarred:w,onEditingNameChange:k,onToggleProject:E,onProjectSelect:S,onToggleStarProject:j,onToggleStarSession:_,onStartEditingProject:T,onCancelEditingProject:C,onSaveProjectName:L,onDeleteProject:A,onSessionSelect:I,onDeleteSession:N,onLoadMoreSessions:P,onNewSession:H,onOpenOrchestration:z,onEditingSessionNameChange:U,onStartEditingSession:V,onCancelEditingSession:O,onSaveEditingSession:G,t:$}){const F=i.jsx(UN,{isLoading:a,loadingProgress:s,projectsCount:e.length,filteredProjectsCount:t.length,t:$});h.useEffect(()=>{let pe="Pixcode";const be=r?.displayName?.trim();be&&(pe=`${be} - ${pe}`),document.title=pe},[r]);const te=!a&&e.length>0&&t.length>0,Q=pe=>pe.source==="history"||pe.autoDiscovered===!0&&pe.isManuallyAdded!==!0,ge=t.filter(pe=>!Q(pe)),ae=t.filter(pe=>Q(pe)),me=pe=>i.jsx(TM,{project:pe,selectedProject:r,selectedSession:n,isExpanded:o.has(pe.name),isDeleting:g.has(pe.name),isStarred:v(pe.name),editingProject:l,editingName:c,sessions:y(pe),initialSessionsLoaded:u.has(pe.name),isLoadingSessions:!!d[pe.name],currentTime:p,editingSession:f,editingSessionName:m,tasksEnabled:b,mcpServerStatus:x,isSessionStarred:w,onEditingNameChange:k,onToggleProject:E,onProjectSelect:S,onToggleStarProject:j,onToggleStarSession:_,onStartEditingProject:T,onCancelEditingProject:C,onSaveProjectName:L,onDeleteProject:A,onSessionSelect:I,onDeleteSession:N,onLoadMoreSessions:P,onNewSession:H,onOpenOrchestration:z,onEditingSessionNameChange:U,onStartEditingSession:V,onCancelEditingSession:O,onSaveEditingSession:G,t:$},pe.name);return i.jsx("div",{className:"pb-safe-area-inset-bottom md:space-y-1",children:te?i.jsxs(i.Fragment,{children:[ge.map(pe=>me(pe)),ae.length>0&&i.jsxs(i.Fragment,{children:[i.jsx("div",{className:"px-3 pb-1 pt-3 text-[11px] font-semibold uppercase tracking-wide text-gray-500 dark:text-gray-400",children:$("projects.detectedFromHistory")}),ae.map(pe=>me(pe))]})]}):F})}function fa(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function GN(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,e.__proto__=t}/*!
229
+ */const dD=[["rect",{width:"8",height:"8",x:"3",y:"3",rx:"2",key:"by2w9f"}],["path",{d:"M7 11v4a2 2 0 0 0 2 2h4",key:"xkn7yn"}],["rect",{width:"8",height:"8",x:"13",y:"13",rx:"2",key:"1cgmvn"}]],uD=gt("workflow",dD),wf=rE,mE=XI,Vv=WI,pD=i7,mD=FI,kf=GI,hD=tE,Pr=iE,fD=z7,Sf=L7,An=O7,gD=P7,Kr=VI,ta=tE,nd=YI,hE=$I,bD=T7,xD=_7,fE=QI,ht=nE,Ot=nE,Gd=n7,gE=t7,yD=Y8,En=p8,Tr=h8,rr=C7,ra=E7,bE=D8,ln=xR,vD=lE,wD=lE,ad=b7,Hd=G7,xE=$7,Vd=sE,Qo=K7,Bs=a8,$t=s8,Pn=C8,Sa=k8,ai=E8,kD=rR,SD=R8,pl=z8,Ef=pR,ED=o7,Ll=y7,ND=LR,CD=vf,AD=vf,Um=Q8,TD=T8,jD=v8,_D=SR,ID=dR,RD=V8,yE=X8,Gm=vf,Nf=aR,Ut=sR,kr=OR,LD=l8,Ea=G8,xt=cE,Hm=cE,qd=AR,Cf=m7,DD=u7,Vm=c7,OD=d8,na=aE,MD=aE,PD=PR,vE=zR,ml=w7,wE=q7,Yi=x8,Af=g8,Fn=_8,kE=sE,Wd=oE,FD=oE,SE=P8,yn=$8,Tf=W8,EE=e8,NE=IR,zD=lR,jf=gR,BD=hR,Lt=Z7,$D=DI,CE=r8,Na=wR,Is=NR,_f=jR,Gr=J7,If=f7,UD=YR,Dl=tL,Rf=uE,GD=uE,Qr=FL,Pc=BL,HD=UL,ss=WR,os=XR,VD=QR,zo=nL,Rs=iL,qv=dL,Bo=pL,Eo=gL,qD=xL,AE=_L,qm=vL,_i=EL,No=kL,Wv=CL,Co=TL,Wm=RL,WD=DL,Km=ML,Ns=qL,$o=KL,Ba=ZL,ls=JL,KD=eD,Ym=rD,YD=iD,Ao=cD,aa=uD,hl=lL,TE=hL,ZD=HL,XD=oD,JD=[{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"}],QD={up:mE,down:wf,left:mD,right:kf},To=e=>e.preventDefault(),Kv="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",e9="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",Bu="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 Yv({wsRef:e,terminalRef:t,isConnected:r,bottomOffset:n="bottom-0"}){const{t:a}=Me("settings"),[s,o]=h.useState(!1),[l,c]=h.useState(!1),d=h.useCallback(m=>{Mi(e.current,{type:"input",data:m})},[e]),u=h.useCallback(()=>{t.current?.scrollToBottom()},[t]),p=h.useCallback(async()=>{if(!(typeof navigator>"u"||!navigator.clipboard?.readText))try{const m=await navigator.clipboard.readText();m.length>0&&d(m)}catch{}},[d]),f=h.useCallback(m=>{let g=m;if(s&&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)),d(g)},[s,l,d]);return i.jsx("div",{className:`pointer-events-none fixed inset-x-0 ${n} z-20 px-2 md:hidden`,children:i.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:[i.jsx("button",{type:"button",onPointerDown:To,onClick:()=>{p()},disabled:!r,className:Bu,title:a("terminalShortcuts.paste",{defaultValue:"Paste"}),"aria-label":a("terminalShortcuts.paste",{defaultValue:"Paste"}),children:i.jsx(Hd,{className:"h-4 w-4"})}),JD.map(m=>{if(m.type==="modifier"){const g=m.modifier==="ctrl"?s:l,b=m.modifier==="ctrl"?()=>o(x=>!x):()=>c(x=>!x);return i.jsx("button",{type:"button",onPointerDown:To,onClick:b,disabled:!r,className:g?e9:Kv,children:m.label},m.id)}if(m.type==="arrow"){const g=QD[m.icon];return i.jsx("button",{type:"button",onPointerDown:To,onClick:()=>d(m.sequence),disabled:!r,className:Bu,children:i.jsx(g,{className:"h-4 w-4"})},m.id)}return i.jsx("button",{type:"button",onPointerDown:To,onClick:()=>f(m.sequence),disabled:!r,className:Kv,children:m.label},m.id)}),i.jsx("button",{type:"button",onPointerDown:To,onClick:u,disabled:!r,className:Bu,title:a("terminalShortcuts.scrollDown"),"aria-label":a("terminalShortcuts.scrollDown"),children:i.jsx(hD,{className:"h-4 w-4"})})]})})}function jE({selectedProject:e=null,selectedSession:t=null,initialCommand:r=null,isPlainShell:n=!1,onProcessComplete:a=null,minimal:s=!1,autoConnect:o=!1,isActive:l=!0}){const{t:c}=Me("chat"),[d,u]=h.useState(!1),[p,f]=h.useState(null),m=h.useRef(null),g=h.useRef(null),{terminalContainerRef:b,terminalRef:x,wsRef:y,isConnected:v,isInitialized:w,isConnecting:k,authUrl:E,authUrlVersion:S,connectToShell:j,disconnectFromShell:_,openAuthUrlInBrowser:T,copyAuthUrlToClipboard:C}=TI({selectedProject:e,selectedSession:t,initialCommand:r,isPlainShell:n,minimal:s,autoConnect:o,isRestarting:d,onProcessComplete:a,onOutputRef:g}),L=h.useCallback(()=>{const $=x.current;if(!$)return;const F=$.buffer.active,te=F.baseY+F.cursorY,Q=Math.min(F.baseY+F.length-1,te+10),ge=Math.max(0,te-oI),ae=[];for(let xe=ge;xe<=Q;xe++){const Be=F.getLine(xe);Be&&ae.push(Be.translateToString().trimEnd())}let me=-1;for(let xe=ae.length-1;xe>=0;xe--)if(/esc to cancel/i.test(ae[xe])||/enter to select/i.test(ae[xe])){me=xe;break}if(me===-1){f(null);return}const pe=new Map,be=Math.max(0,me-lI);for(let xe=me-1;xe>=be;xe--){const Be=ae[xe].match(/^\s*[❯›>]?\s*(\d+)\.\s+(.+)/);if(Be){const M=Be[1],de=Be[2].trim();parseInt(M,10)<=cI&&de.length>0&&!pe.has(M)&&pe.set(M,de)}}const Ne=[];for(let xe=1;xe<=pe.size&&pe.has(String(xe));xe++)Ne.push({number:String(xe),label:pe.get(String(xe))});f(Ne.length>=dI?Ne:null)},[x]),A=h.useCallback(()=>{m.current&&clearTimeout(m.current),m.current=setTimeout(L,sI)},[L]);h.useEffect(()=>{g.current=A},[A]),h.useEffect(()=>()=>{m.current&&clearTimeout(m.current)},[]),h.useEffect(()=>{v||(m.current&&(clearTimeout(m.current),m.current=null),f(null))},[v]),h.useEffect(()=>{if(!l||!w||!v)return;const $=()=>{x.current?.focus()},F=window.requestAnimationFrame($),te=window.setTimeout($,0);return()=>{window.cancelAnimationFrame(F),window.clearTimeout(te)}},[l,v,w,x]);const I=h.useCallback($=>{Mi(y.current,{type:"input",data:$})},[y]),N=h.useMemo(()=>EI(t),[t]),P=h.useMemo(()=>N?N.slice(0,30):null,[N]),H=h.useMemo(()=>N?N.slice(0,50):null,[N]),z=h.useCallback(()=>{u(!0),window.setTimeout(()=>{u(!1)},aI)},[]);if(!e)return i.jsx(_I,{title:c("shell.selectProject.title"),description:c("shell.selectProject.description")});if(s)return i.jsxs(i.Fragment,{children:[i.jsx(RI,{terminalContainerRef:b,authUrl:E,authUrlVersion:S,initialCommand:r,isConnected:v,openAuthUrlInBrowser:T,copyAuthUrlToClipboard:C}),i.jsx(Yv,{wsRef:y,terminalRef:x,isConnected:v,bottomOffset:"bottom-0"})]});const U=n?c("shell.runCommand",{command:r||c("shell.defaultCommand"),projectName:e.displayName}):t?c("shell.resumeSession",{displayName:H}):c("shell.startSession"),V=n?c("shell.runCommand",{command:r||c("shell.defaultCommand"),projectName:e.displayName}):c("shell.startCli",{projectName:e.displayName}),O=w?k?"connecting":v?null:"connect":"loading",G=O==="connecting"?V:U;return i.jsxs("div",{className:"flex h-full w-full flex-col bg-gray-900",children:[i.jsx(II,{isConnected:v,isInitialized:w,isRestarting:d,hasSession:!!t,sessionDisplayNameShort:P,onDisconnect:_,onRestart:z,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:d||v}),i.jsxs("div",{className:"relative flex-1 overflow-hidden p-2",children:[i.jsx("div",{ref:b,className:"h-full w-full focus:outline-none",style:{outline:"none"}}),O&&i.jsx(jI,{mode:O,description:G,loadingLabel:c("shell.loading"),connectLabel:c("shell.actions.connect"),connectTitle:c("shell.actions.connectTitle"),connectingLabel:c("shell.connecting"),onConnect:j}),p&&v&&i.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:$=>$.preventDefault(),children:i.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[p.map($=>i.jsxs("button",{type:"button",onClick:()=>{I($.number),f(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:`${$.number}. ${$.label}`,children:[$.number,". ",$.label]},$.number)),i.jsx("button",{type:"button",onClick:()=>{I("\x1B"),f(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"})]})})]}),i.jsx(Yv,{wsRef:y,terminalRef:x,isConnected:v})]})}function t9({className:e}){return i.jsx("div",{className:`flex h-full items-center justify-center ${e}`,children:i.jsxs("div",{className:"text-center text-gray-500 dark:text-gray-400",children:[i.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:i.jsx("svg",{className:"h-8 w-8 text-gray-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:i.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"})})}),i.jsx("h3",{className:"mb-2 text-lg font-semibold",children:"No Project Selected"}),i.jsx("p",{children:"A project is required to open a shell"})]})})}function r9({title:e,isCompleted:t,onClose:r=null}){return i.jsx("div",{className:"flex-shrink-0 border-b border-gray-700 bg-gray-800 px-4 py-2",children:i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsxs("div",{className:"flex items-center space-x-2",children:[i.jsx("h3",{className:"text-sm font-medium text-gray-200",children:e}),t&&i.jsx("span",{className:"text-xs text-green-400",children:"(Completed)"})]}),r&&i.jsx("button",{onClick:r,className:"text-gray-400 hover:text-white",title:"Close",children:i.jsx("svg",{className:"h-4 w-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]})})}function _E({project:e=null,session:t=null,command:r=null,isPlainShell:n=null,isActive:a=!0,autoConnect:s=!0,onComplete:o=null,onClose:l=null,title:c=null,className:d="",showHeader:u=!0,compact:p=!1,minimal:f=!1}){const[m,g]=h.useState(!1),b=n!==null?n:r!==null,x=h.useCallback(y=>{g(!0),o?.(y)},[o]);return e?i.jsxs("div",{className:`flex h-full w-full flex-col ${d}`,children:[!f&&u&&c&&i.jsx(r9,{title:c,isCompleted:m,onClose:l}),i.jsx("div",{className:"min-h-0 w-full flex-1",children:i.jsx(jE,{selectedProject:e,selectedSession:t,initialCommand:r,isPlainShell:b,isActive:a,onProcessComplete:x,minimal:f,autoConnect:f?!0:s})})]}):i.jsx(t9,{className:d})}const n9=(e,t)=>t||(e==="claude"?"claude --dangerously-skip-permissions /login":e==="cursor"?"cursor-agent login":e==="codex"?"codex login":e==="qwen"?"qwen auth":e==="opencode"?"opencode auth login":"gemini"),a9={claude:{keyLabel:"Anthropic API Key",keyExample:"sk-ant-...",supportsBaseUrl:!0,baseUrlExample:"https://api.anthropic.com",keyConsoleUrl:"https://console.anthropic.com/settings/keys",keyConsoleLabel:"Anthropic Console"},codex:{keyLabel:"OpenAI API Key",keyExample:"sk-...",supportsBaseUrl:!0,baseUrlExample:"https://api.openai.com/v1",keyConsoleUrl:"https://platform.openai.com/api-keys",keyConsoleLabel:"OpenAI Platform"},gemini:{keyLabel:"Gemini API Key",keyExample:"AI...",supportsBaseUrl:!1,keyConsoleUrl:"https://aistudio.google.com/app/apikey",keyConsoleLabel:"Google AI Studio"},qwen:{keyLabel:"OpenAI-Compatible API Key",keyExample:"sk-... or sk-sp-...",supportsBaseUrl:!0,baseUrlExample:"https://dashscope-intl.aliyuncs.com/compatible-mode/v1",keyConsoleUrl:"https://github.com/QwenLM/qwen-code",keyConsoleLabel:"Qwen Code Docs",notes:"Accepts any OpenAI-compatible endpoint — Alibaba Cloud, ModelScope, OpenRouter, self-hosted, etc."},opencode:{keyLabel:"Anthropic API Key (default backend)",keyExample:"sk-ant-...",supportsBaseUrl:!0,baseUrlExample:"https://api.anthropic.com",keyConsoleUrl:"https://console.anthropic.com/settings/keys",keyConsoleLabel:"Anthropic Console",notes:"OpenCode is multi-provider — this sets the Anthropic credentials. Switch providers via `opencode auth login` or opencode.json."}};function Zv({active:e,children:t,onClick:r}){return i.jsx("button",{onClick:r,className:`flex-1 border-b-2 px-4 py-2.5 text-sm font-medium transition-colors ${e?"border-primary text-foreground":"border-transparent text-muted-foreground hover:text-foreground"}`,children:t})}function i9({provider:e}){const[t,r]=h.useState(""),[n,a]=h.useState(!1),[s,o]=h.useState("idle"),[l,c]=h.useState(null),d=async()=>{const u=t.trim();if(u){a(!0),c(null),o("idle");try{const p=await ve(`/api/providers/${e}/oauth-paste`,{method:"POST",body:JSON.stringify({callbackUrl:u})}),f=await p.json().catch(()=>({}));if(!p.ok||!f?.success)throw new Error(f?.error||`Request failed (${p.status})`);o("ok"),r("")}catch(p){c(p?.message||"Forward failed"),o("error")}finally{a(!1)}}};return i.jsxs("div",{className:"mt-3 rounded-lg border border-border/60 bg-muted/30 p-3 text-sm",children:[i.jsx("div",{className:"mb-2 font-medium text-foreground",children:"Remote login? Paste the callback URL here"}),i.jsxs("p",{className:"mb-3 text-xs text-muted-foreground",children:["When the CLI shows ",i.jsx("code",{className:"rounded bg-background px-1 font-mono text-[11px]",children:"http://127.0.0.1:PORT/…"})," and your browser can't reach it (VPS setups), copy the failing URL from your address bar and paste it below. Pixcode forwards the token exchange to the CLI process on this host."]}),i.jsxs("div",{className:"flex gap-2",children:[i.jsx("input",{type:"url",value:t,onChange:u=>r(u.target.value),placeholder:"http://127.0.0.1:49312/callback?code=...",className:"flex-1 rounded-md border border-border bg-background px-3 py-2 font-mono text-xs text-foreground focus:border-primary focus:outline-none",onKeyDown:u=>{u.key==="Enter"&&d()}}),i.jsx("button",{onClick:()=>void d(),disabled:n||!t.trim(),className:"flex items-center gap-1.5 rounded-md bg-foreground px-3 py-2 text-xs font-medium text-background transition-opacity hover:opacity-90 disabled:opacity-40",children:n?i.jsx(Ot,{className:"h-3.5 w-3.5 animate-spin"}):"Forward"})]}),s==="ok"&&i.jsxs("div",{className:"mt-2 flex items-center gap-1.5 text-xs text-emerald-600 dark:text-emerald-400",children:[i.jsx(rr,{className:"h-3.5 w-3.5"})," Forwarded — check the terminal above for the completion message."]}),s==="error"&&l&&i.jsx("div",{className:"mt-2 text-xs text-red-600 dark:text-red-400",children:l})]})}function s9({provider:e,onSaved:t}){const r=a9[e],[n,a]=h.useState(""),[s,o]=h.useState(""),[l,c]=h.useState(!1),[d,u]=h.useState("idle"),[p,f]=h.useState(null);h.useEffect(()=>{let g=!1;return(async()=>{try{const x=await(await ve("/api/providers/credentials")).json().catch(()=>({}));if(g||!x?.success)return;const y=x.data?.[e];y?.baseUrl&&o(y.baseUrl)}catch{}})(),()=>{g=!0}},[e]);const m=async()=>{const g=n.trim();if(g){c(!0),f(null),u("idle");try{const b=await ve(`/api/providers/${e}/auth/api-key`,{method:"POST",body:JSON.stringify({apiKey:g,baseUrl:r.supportsBaseUrl&&s.trim()?s.trim():""})}),x=await b.json().catch(()=>({}));if(!b.ok||!x?.success)throw new Error(x?.error||`Request failed (${b.status})`);u("ok"),a(""),t()}catch(b){f(b?.message||"Save failed"),u("error")}finally{c(!1)}}};return r?i.jsx("div",{className:"flex h-full flex-col overflow-y-auto p-6",children:i.jsxs("div",{className:"mx-auto w-full max-w-lg space-y-5",children:[i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsx("div",{className:"flex h-10 w-10 items-center justify-center rounded-full bg-muted",children:i.jsx(FD,{className:"h-5 w-5 text-foreground"})}),i.jsxs("div",{children:[i.jsx("h4",{className:"text-base font-semibold text-foreground",children:r.keyLabel}),i.jsxs("a",{href:r.keyConsoleUrl,target:"_blank",rel:"noreferrer",className:"inline-flex items-center gap-1 text-xs text-muted-foreground hover:text-foreground",children:["Get a key from ",r.keyConsoleLabel,i.jsx(Kr,{className:"h-3 w-3"})]})]})]}),r.notes&&i.jsx("div",{className:"rounded-md border border-border/60 bg-muted/40 p-3 text-xs text-muted-foreground",children:r.notes}),i.jsxs("div",{className:"space-y-1.5",children:[i.jsx("label",{className:"text-xs font-medium text-foreground",children:"API Key"}),i.jsx("input",{type:"password",value:n,onChange:g=>a(g.target.value),placeholder:r.keyExample,className:"w-full rounded-md border border-border bg-background px-3 py-2 font-mono text-sm text-foreground focus:border-primary focus:outline-none",autoComplete:"off",spellCheck:!1}),i.jsxs("p",{className:"text-[11px] text-muted-foreground",children:["Stored locally at ",i.jsx("code",{className:"rounded bg-muted px-1 font-mono text-[10px]",children:"~/.pixcode/provider-credentials.json"})," with 0600 permissions."]})]}),r.supportsBaseUrl&&i.jsxs("div",{className:"space-y-1.5",children:[i.jsxs("label",{className:"text-xs font-medium text-foreground",children:["Base URL ",i.jsx("span",{className:"font-normal text-muted-foreground",children:"(optional — use a custom endpoint)"})]}),i.jsx("input",{type:"url",value:s,onChange:g=>o(g.target.value),placeholder:r.baseUrlExample,className:"w-full rounded-md border border-border bg-background px-3 py-2 font-mono text-sm text-foreground focus:border-primary focus:outline-none",autoComplete:"off",spellCheck:!1}),i.jsx("p",{className:"text-[11px] text-muted-foreground",children:"Point at any OpenAI-compatible proxy (OpenRouter, local LLM, self-hosted, budget provider) to cut costs or hit different models."})]}),i.jsxs("div",{className:"flex items-center gap-3 pt-2",children:[i.jsxs("button",{onClick:()=>void m(),disabled:l||!n.trim(),className:"inline-flex items-center gap-2 rounded-md bg-foreground px-4 py-2 text-sm font-medium text-background transition-opacity hover:opacity-90 disabled:opacity-40",children:[l?i.jsx(Ot,{className:"h-4 w-4 animate-spin"}):i.jsx(rr,{className:"h-4 w-4"}),"Save API Key"]}),d==="ok"&&i.jsx("span",{className:"text-xs text-emerald-600 dark:text-emerald-400",children:"Saved — reconnect to pick it up."}),d==="error"&&p&&i.jsx("span",{className:"text-xs text-red-600 dark:text-red-400",children:p})]})]})}):i.jsx("div",{className:"p-6 text-sm text-muted-foreground",children:"This provider uses OAuth only — use the Browser tab to log in."})}function IE({isOpen:e,onClose:t,provider:r="claude",onComplete:n,customCommand:a,isAuthenticated:s=!1}){const{t:o}=Me("common"),l=r!=="cursor",[c,d]=h.useState(l?"apiKey":"browser");h.useEffect(()=>{e&&d(l?"apiKey":"browser")},[e,r,l]);const u=h.useMemo(()=>`${ul[r]??r} Login`,[r]);if(!e)return null;const p=n9(r,a),f=m=>n?.(m);return i.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:i.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:[i.jsxs("div",{className:"flex items-center justify-between border-b border-gray-200 p-4 dark:border-gray-700",children:[i.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white",children:u}),i.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:i.jsx(xt,{className:"h-6 w-6"})})]}),i.jsxs("div",{className:"flex border-b border-gray-200 dark:border-gray-700",children:[i.jsx(Zv,{active:c==="browser",onClick:()=>d("browser"),children:"Browser / OAuth"}),l&&i.jsx(Zv,{active:c==="apiKey",onClick:()=>d("apiKey"),children:"API Key"})]}),i.jsx("div",{className:"flex flex-1 flex-col overflow-hidden",children:c==="browser"?i.jsxs("div",{className:"flex flex-1 flex-col overflow-hidden",children:[i.jsx("div",{className:"min-h-0 flex-1",children:i.jsx(_E,{project:G_,command:p,onComplete:f,minimal:!0})}),i.jsx("div",{className:"border-t border-border/40 bg-background/50 px-4 py-3",children:i.jsx(i9,{provider:r})})]}):i.jsx(s9,{provider:r,onSaved:()=>f(0)})})]})})}const o9=({className:e="w-5 h-5"})=>i.jsx("img",{src:"/icons/claude-ai-icon.svg",alt:"Claude",className:e}),l9=({className:e="w-5 h-5"})=>{const{isDarkMode:t}=Oa();return i.jsx("img",{src:t?"/icons/codex-white.svg":"/icons/codex.svg",alt:"Codex",className:e})},c9=({className:e="w-5 h-5"})=>{const{isDarkMode:t}=Oa();return i.jsx("img",{src:t?"/icons/cursor-white.svg":"/icons/cursor.svg",alt:"Cursor",className:e})},d9=({className:e="w-5 h-5"})=>i.jsx("img",{src:"/icons/gemini-ai-icon.svg",alt:"Gemini",className:e}),u9=({className:e="w-5 h-5"})=>{const{isDarkMode:t}=Oa(),r=t?"/icons/opencode-logo-dark.svg":"/icons/opencode-logo-light.svg";return i.jsx("img",{src:r,alt:"OpenCode",className:e})},p9=({className:e="w-5 h-5"})=>i.jsx("img",{src:"/icons/qwen-logo.svg",alt:"Qwen Code",className:e});function dr({provider:e="claude",className:t="w-5 h-5"}){return e==="cursor"?i.jsx(c9,{className:t}):e==="codex"?i.jsx(l9,{className:t}):e==="gemini"?i.jsx(d9,{className:t}):e==="qwen"?i.jsx(p9,{className:t}):e==="opencode"?i.jsx(u9,{className:t}):i.jsx(o9,{className:t})}function m9({provider:e,title:t,status:r,connectedClassName:n,iconContainerClassName:a,loginButtonClassName:s,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 i.jsx("div",{className:`rounded-lg border p-4 transition-colors ${l}`,children:i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsx("div",{className:`flex h-10 w-10 items-center justify-center rounded-full ${a}`,children:i.jsx(dr,{provider:e,className:"h-5 w-5"})}),i.jsxs("div",{children:[i.jsxs("div",{className:"flex items-center gap-2 font-medium text-foreground",children:[t,r.authenticated&&i.jsx(rr,{className:"h-4 w-4 text-green-500"})]}),i.jsx("div",{className:"text-xs text-muted-foreground",children:c})]})]}),!r.authenticated&&!r.loading&&i.jsx("button",{onClick:o,className:`${s} rounded-lg px-4 py-2 text-sm font-medium text-white transition-colors`,children:"Login"})]})})}const h9=[{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"},{provider:"qwen",title:"Qwen Code",connectedClassName:"bg-orange-50 dark:bg-orange-900/20 border-orange-200 dark:border-orange-800",iconContainerClassName:"bg-orange-100 dark:bg-orange-900/30",loginButtonClassName:"bg-orange-600 hover:bg-orange-700"}];function f9({providerStatuses:e,onOpenProviderLogin:t}){return i.jsxs("div",{className:"space-y-6",children:[i.jsxs("div",{className:"mb-6 text-center",children:[i.jsx("h2",{className:"mb-2 text-2xl font-bold text-foreground",children:"Connect Your AI Agents"}),i.jsx("p",{className:"text-muted-foreground",children:"Login to one or more AI coding assistants. All are optional."})]}),i.jsx("div",{className:"space-y-3",children:h9.map(r=>i.jsx(m9,{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))}),i.jsx("div",{className:"pt-2 text-center text-sm text-muted-foreground",children:i.jsx("p",{children:"You can configure these later in Settings."})})]})}function g9({gitName:e,gitEmail:t,isSubmitting:r,onGitNameChange:n,onGitEmailChange:a}){return i.jsxs("div",{className:"space-y-6",children:[i.jsxs("div",{className:"mb-8 text-center",children:[i.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:i.jsx(Qr,{className:"h-8 w-8 text-blue-600 dark:text-blue-400"})}),i.jsx("h2",{className:"mb-2 text-2xl font-bold text-foreground",children:"Git Configuration"}),i.jsx("p",{className:"text-muted-foreground",children:"Configure your git identity to ensure proper attribution for commits."})]}),i.jsxs("div",{className:"space-y-4",children:[i.jsxs("div",{children:[i.jsxs("label",{htmlFor:"gitName",className:"mb-2 flex items-center gap-2 text-sm font-medium text-foreground",children:[i.jsx(PD,{className:"h-4 w-4"}),"Git Name ",i.jsx("span",{className:"text-red-500",children:"*"})]}),i.jsx("input",{type:"text",id:"gitName",value:e,onChange:s=>n(s.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}),i.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:"Saved as `git config --global user.name`."})]}),i.jsxs("div",{children:[i.jsxs("label",{htmlFor:"gitEmail",className:"mb-2 flex items-center gap-2 text-sm font-medium text-foreground",children:[i.jsx(OD,{className:"h-4 w-4"}),"Git Email ",i.jsx("span",{className:"text-red-500",children:"*"})]}),i.jsx("input",{type:"email",id:"gitEmail",value:t,onChange:s=>a(s.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}),i.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:"Saved as `git config --global user.email`."})]})]})]})}const Xv=[{title:"Git Configuration",icon:Qr,required:!0},{title:"Connect Agents",icon:hE,required:!1},{title:"Task System",icon:Ef,required:!1}];function b9({currentStep:e}){return i.jsx("div",{className:"mb-8",children:i.jsx("div",{className:"flex items-center justify-between",children:Xv.map((t,r)=>{const n=r<e,a=r===e,s=t.icon;return i.jsxs("div",{className:"contents",children:[i.jsxs("div",{className:"flex flex-1 flex-col items-center",children:[i.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?i.jsx(rr,{className:"h-6 w-6"}):i.jsx(s,{className:"h-6 w-6"})}),i.jsxs("div",{className:"mt-2 text-center",children:[i.jsx("p",{className:`text-sm font-medium ${a?"text-foreground":"text-muted-foreground"}`,children:t.title}),t.required&&i.jsx("span",{className:"text-xs text-red-500",children:"Required"})]})]}),r<Xv.length-1&&i.jsx("div",{className:`mx-2 h-0.5 flex-1 transition-colors duration-200 ${n?"bg-green-500":"bg-border"}`})]},t.title)})})})}const x9=e=>e?e.installation?.isInstalled?e.installation.version?`TaskMaster CLI installed (${e.installation.version}).`:"TaskMaster CLI installed.":e.installation?.reason||"TaskMaster CLI is not installed yet.":"Checking TaskMaster installation...";function y9({enabled:e,onEnabledChange:t,onReadyChange:r}){const[n,a]=h.useState(null),[s,o]=h.useState(!0),[l,c]=h.useState(!1),[d,u]=h.useState([]),[p,f]=h.useState(""),m=h.useRef(null),g=!!n?.installation?.isInstalled,b=!!n?.mcpServer?.hasMCPServer,x=h.useMemo(()=>!e||g,[e,g]);h.useEffect(()=>{r(x)},[r,x]);const y=h.useCallback(async()=>{o(!0),f("");try{const w=await ve("/api/taskmaster/installation-status"),k=await w.json();a(k),w.ok||f(k.installation?.reason||"TaskMaster status check failed.")}catch(w){a(null),f(w instanceof Error?w.message:"TaskMaster status check failed.")}finally{o(!1)}},[]);h.useEffect(()=>(y(),()=>{m.current?.close(),m.current=null}),[y]);const v=h.useCallback(async()=>{c(!0),f(""),u([]);try{const w=await ve("/api/taskmaster/install",{method:"POST"}),k=await w.json();if(!w.ok||!k.success||!k.jobId)throw new Error(k.error||k.message||"TaskMaster install could not start.");const E=localStorage.getItem(Ud),S=E?`?token=${encodeURIComponent(E)}`:"",j=new EventSource(`/api/taskmaster/install/${encodeURIComponent(k.jobId)}/stream${S}`);m.current=j,j.addEventListener("log",_=>{const T=JSON.parse(_.data);u(C=>[...C,T].slice(-80))}),j.addEventListener("done",_=>{const T=JSON.parse(_.data);if(j.close(),m.current=null,c(!1),!T.success){f(T.error||T.message||"TaskMaster install failed.");return}y()}),j.onerror=()=>{j.close(),m.current=null,c(!1),f("TaskMaster install stream disconnected.")}}catch(w){c(!1),f(w instanceof Error?w.message:"TaskMaster install could not start.")}},[y]);return i.jsxs("div",{className:"space-y-6",children:[i.jsxs("div",{className:"space-y-2",children:[i.jsx("h2",{className:"text-2xl font-semibold text-foreground",children:"Task System"}),i.jsx("p",{className:"text-sm text-muted-foreground",children:"Decide whether Pixcode should enable TaskMaster-backed planning, kanban tasks, PRD parsing, and agent task execution from the start."})]}),i.jsxs("label",{className:"flex cursor-pointer items-start gap-3 rounded-lg border border-border bg-background p-4 transition-colors hover:bg-muted/40",children:[i.jsx("input",{type:"checkbox",checked:e,onChange:w=>t(w.target.checked),className:"mt-1 h-4 w-4"}),i.jsxs("span",{className:"min-w-0 space-y-1",children:[i.jsx("span",{className:"block text-sm font-medium text-foreground",children:"Enable TaskMaster features"}),i.jsx("span",{className:"block text-sm leading-6 text-muted-foreground",children:"This keeps the Tasks panel, PRD tools, and orchestration task sync available. You can change it later in Settings."})]})]}),e&&i.jsxs("div",{className:"space-y-4 rounded-lg border border-border bg-card p-4",children:[i.jsxs("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-start sm:justify-between",children:[i.jsxs("div",{className:"space-y-1",children:[i.jsxs("div",{className:"flex items-center gap-2",children:[g?i.jsx(ra,{className:"h-5 w-5 text-green-600"}):i.jsx(Gr,{className:"h-5 w-5 text-primary"}),i.jsx("h3",{className:"font-medium text-foreground",children:"TaskMaster CLI"})]}),i.jsx("p",{className:"text-sm text-muted-foreground",children:x9(n)}),g&&!b&&i.jsx("p",{className:"text-xs text-amber-600 dark:text-amber-400",children:"MCP server is not configured yet. Core task files work now; MCP can be connected later from Settings."})]}),i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("button",{type:"button",onClick:()=>void y(),disabled:s||l,className:"rounded-md border border-border px-3 py-2 text-sm text-foreground transition-colors hover:bg-muted disabled:cursor-not-allowed disabled:opacity-50",children:s?"Checking...":"Refresh"}),!g&&i.jsxs("button",{type:"button",onClick:()=>void v(),disabled:l,className:"inline-flex items-center gap-2 rounded-md bg-primary px-3 py-2 text-sm font-medium text-primary-foreground transition-colors hover:bg-primary/90 disabled:cursor-not-allowed disabled:opacity-60",children:[l&&i.jsx(Ot,{className:"h-4 w-4 animate-spin"}),l?"Installing...":"Install"]})]})]}),p&&i.jsx("div",{className:"rounded-md border border-red-300 bg-red-50 p-3 text-sm text-red-700 dark:border-red-800 dark:bg-red-950/30 dark:text-red-300",children:p}),d.length>0&&i.jsx("pre",{className:"max-h-48 overflow-auto rounded-md bg-black p-3 text-xs leading-5 text-green-200",children:d.map(w=>`${w.stream}> ${w.chunk}`).join("")})]})]})}const Jv=/^[^\s@]+@[^\s@]+\.[^\s@]+$/,Qv=async(e,t)=>{try{return(await e.json()).error||t}catch{return t}};function v9({onComplete:e}){const[t,r]=h.useState(0),[n,a]=h.useState(""),[s,o]=h.useState(""),[l,c]=h.useState(!1),[d,u]=h.useState(""),[p,f]=h.useState(null),[m,g]=h.useState(()=>{try{const A=localStorage.getItem("tasks-enabled");return A===null?!0:JSON.parse(A)!==!1}catch{return!0}}),[b,x]=h.useState(!1),{providerAuthStatus:y,checkProviderAuthStatus:v,refreshProviderAuthStatuses:w}=yf(),k=h.useRef(void 0),E=h.useCallback(async()=>{try{const A=await ve("/api/user/git-config");if(!A.ok)return;const I=await A.json();I.gitName&&a(I.gitName),I.gitEmail&&o(I.gitEmail)}catch(A){console.error("Error loading git config:",A)}},[]);h.useEffect(()=>{E(),w()},[E,w]),h.useEffect(()=>{const A=k.current;k.current=p,A!=null&&p===null&&w()},[p,w]);const S=A=>{f(A)},j=A=>{A===0&&p&&v(p)},_=async()=>{if(u(""),t!==0){r(A=>A+1);return}if(!n.trim()||!s.trim()){u("Both git name and email are required.");return}if(!Jv.test(s)){u("Please enter a valid email address.");return}c(!0);try{const A=await ve("/api/user/git-config",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({gitName:n,gitEmail:s})});if(!A.ok){const I=await Qv(A,"Failed to save git configuration");throw new Error(I)}r(I=>I+1)}catch(A){u(A instanceof Error?A.message:"Failed to save git configuration")}finally{c(!1)}},T=()=>{u(""),r(A=>A-1)},C=async()=>{if(m&&!b){u("Install TaskMaster or disable TaskMaster features to finish setup.");return}c(!0),u("");try{localStorage.setItem("tasks-enabled",JSON.stringify(m));const A=await ve("/api/user/complete-onboarding",{method:"POST"});if(!A.ok){const I=await Qv(A,"Failed to complete onboarding");throw new Error(I)}await e?.()}catch(A){u(A instanceof Error?A.message:"Failed to complete onboarding")}finally{c(!1)}},L=t===0?!!(n.trim()&&s.trim()&&Jv.test(s)):t===2?!m||b:!0;return i.jsxs(i.Fragment,{children:[i.jsx("div",{className:"flex min-h-screen items-center justify-center bg-background p-4",children:i.jsxs("div",{className:"w-full max-w-2xl",children:[i.jsx(b9,{currentStep:t}),i.jsxs("div",{className:"rounded-lg border border-border bg-card p-8 shadow-lg",children:[t===0?i.jsx(g9,{gitName:n,gitEmail:s,isSubmitting:l,onGitNameChange:a,onGitEmailChange:o}):t===1?i.jsx(f9,{providerStatuses:y,onOpenProviderLogin:S}):i.jsx(y9,{enabled:m,onEnabledChange:g,onReadyChange:x}),d&&i.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:i.jsx("p",{className:"text-sm text-red-700 dark:text-red-400",children:d})}),i.jsxs("div",{className:"mt-8 flex items-center justify-between border-t border-border pt-6",children:[i.jsxs("button",{onClick:T,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:[i.jsx(Sf,{className:"h-4 w-4"}),"Previous"]}),i.jsx("div",{className:"flex items-center gap-3",children:t<2?i.jsx("button",{onClick:_,disabled:!L||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?i.jsxs(i.Fragment,{children:[i.jsx(Ot,{className:"h-4 w-4 animate-spin"}),"Saving..."]}):i.jsxs(i.Fragment,{children:["Next",i.jsx(An,{className:"h-4 w-4"})]})}):i.jsx("button",{onClick:C,disabled:l,className:"flex items-center gap-2 rounded-lg bg-green-600 px-6 py-3 font-medium text-white transition-colors duration-200 hover:bg-green-700 disabled:cursor-not-allowed disabled:bg-green-400",children:l?i.jsxs(i.Fragment,{children:[i.jsx(Ot,{className:"h-4 w-4 animate-spin"}),"Completing..."]}):i.jsxs(i.Fragment,{children:[i.jsx(rr,{className:"h-4 w-4"}),"Complete Setup"]})})})]})]})]})}),p&&i.jsx(IE,{isOpen:!!p,onClose:()=>f(null),provider:p,onComplete:j})]})}const w9=["0s","0.1s","0.2s"];function k9(){return i.jsx("div",{className:"flex min-h-screen items-center justify-center bg-background p-4",children:i.jsxs("div",{className:"text-center",children:[i.jsx("div",{className:"mb-4 flex justify-center",children:i.jsx("div",{className:"flex h-16 w-16 items-center justify-center rounded-lg bg-primary shadow-sm",children:i.jsx(na,{className:"h-8 w-8 text-primary-foreground"})})}),i.jsx("h1",{className:"mb-2 text-2xl font-bold text-foreground",children:"Pixcode"}),i.jsx("div",{className:"flex items-center justify-center space-x-2",children:w9.map(e=>i.jsx("div",{className:"h-2 w-2 animate-bounce rounded-full bg-blue-500",style:{animationDelay:e}},e))}),i.jsx("p",{className:"mt-2 text-muted-foreground",children:"Loading..."})]})})}function RE({errorMessage:e}){return e?i.jsx("div",{className:"rounded-md border border-red-300 bg-red-100 p-3 dark:border-red-800 dark:bg-red-900/20",children:i.jsx("p",{className:"text-sm text-red-700 dark:text-red-400",children:e})}):null}function Ii({id:e,label:t,value:r,onChange:n,placeholder:a,isDisabled:s,type:o="text",name:l,autoComplete:c}){return i.jsxs("div",{children:[i.jsx("label",{htmlFor:e,className:"mb-1 block text-sm font-medium text-foreground",children:t}),i.jsx("input",{id:e,type:o,name:l??e,autoComplete:c,value:r,onChange:d=>n(d.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:s})]})}function LE({title:e,description:t,children:r,footerText:n,logo:a}){return i.jsx("div",{className:"flex min-h-screen items-center justify-center bg-background p-4",children:i.jsx("div",{className:"w-full max-w-md",children:i.jsxs("div",{className:"space-y-6 rounded-lg border border-border bg-card p-8 shadow-lg",children:[i.jsxs("div",{className:"text-center",children:[i.jsx("div",{className:"mb-4 flex justify-center",children:a??i.jsx("div",{className:"flex h-16 w-16 items-center justify-center rounded-lg bg-primary shadow-sm",children:i.jsx(na,{className:"h-8 w-8 text-primary-foreground"})})}),i.jsx("h1",{className:"text-2xl font-bold text-foreground",children:e}),i.jsx("p",{className:"mt-2 text-muted-foreground",children:t})]}),r,i.jsx("div",{className:"text-center",children:i.jsx("p",{className:"text-sm text-muted-foreground",children:n})}),i.jsxs("div",{className:"flex items-center justify-center gap-1.5 pt-2",children:[i.jsx("svg",{className:"h-3.5 w-3.5 text-muted-foreground/50",fill:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:i.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"})}),i.jsx("a",{href:"https://github.com/alicomert/pixcode",target:"_blank",rel:"noopener noreferrer",className:"text-xs text-muted-foreground/50 transition-colors hover:text-muted-foreground",children:"Pixcode is open source"})]})]})})})}const S9={username:"",password:""};function E9(){const{t:e}=Me("auth"),{login:t}=Ki(),[r,n]=h.useState(S9),[a,s]=h.useState(""),[o,l]=h.useState(!1),c=h.useCallback((u,p)=>{n(f=>({...f,[u]:p}))},[]),d=h.useCallback(async u=>{if(u.preventDefault(),s(""),!r.username.trim()||!r.password){s(e("login.errors.requiredFields"));return}l(!0);const p=await t(r.username.trim(),r.password);p.success||s(p.error),l(!1)},[r.password,r.username,t,e]);return i.jsx(LE,{title:e("login.title"),description:e("login.description"),footerText:"Enter your credentials to access Pixcode",children:i.jsxs("form",{onSubmit:d,className:"space-y-4",children:[i.jsx(Ii,{id:"username",label:e("login.username"),value:r.username,onChange:u=>c("username",u),placeholder:e("login.placeholders.username"),isDisabled:o,autoComplete:"username"}),i.jsx(Ii,{id:"password",label:e("login.password"),value:r.password,onChange:u=>c("password",u),placeholder:e("login.placeholders.password"),isDisabled:o,type:"password",autoComplete:"current-password"}),i.jsx(RE,{errorMessage:a}),i.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 N9={username:"",password:"",confirmPassword:"",connectionMode:"local",remoteUrl:"",remoteApiKey:""};function C9(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.":e.connectionMode==="remote"&&!e.remoteUrl.trim()?"Remote Pixcode server URL is required.":null}function A9(){const{register:e}=Ki(),[t,r]=h.useState(N9),[n,a]=h.useState(""),[s,o]=h.useState(!1),l=h.useCallback((d,u)=>{r(p=>({...p,[d]:u}))},[]),c=h.useCallback(async d=>{d.preventDefault(),a("");const u=C9(t);if(u){a(u);return}o(!0);const p=await fetch("/api/auth/connection-mode",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({mode:t.connectionMode,remoteUrl:t.connectionMode==="remote"?t.remoteUrl.trim():null,apiKey:t.connectionMode==="remote"?t.remoteApiKey.trim():null})});if(!p.ok){const m=await p.json().catch(()=>null);a(m?.error||"Could not save connection mode."),o(!1);return}const f=await e(t.username.trim(),t.password);f.success||a(f.error),o(!1)},[t,e]);return i.jsx(LE,{title:"Welcome to Pixcode",description:"Set up your account to get started",footerText:"This is a single-user system. Only one account can be created.",logo:i.jsx("img",{src:"/logo.svg",alt:"Pixcode",className:"h-16 w-16"}),children:i.jsxs("form",{onSubmit:c,className:"space-y-4",children:[i.jsxs("div",{className:"grid gap-2 rounded-lg border border-border/70 bg-muted/30 p-2 sm:grid-cols-2",children:[i.jsxs("button",{type:"button",onClick:()=>l("connectionMode","local"),disabled:s,className:`rounded-md px-3 py-2 text-left text-sm transition-colors ${t.connectionMode==="local"?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:bg-background/60 hover:text-foreground"}`,children:[i.jsx("span",{className:"block font-medium",children:"Use this computer directly"}),i.jsx("span",{className:"block text-xs opacity-80",children:"Run Pixcode and CLIs on this machine."})]}),i.jsxs("button",{type:"button",onClick:()=>l("connectionMode","remote"),disabled:s,className:`rounded-md px-3 py-2 text-left text-sm transition-colors ${t.connectionMode==="remote"?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:bg-background/60 hover:text-foreground"}`,children:[i.jsx("span",{className:"block font-medium",children:"Connect to a remote Pixcode server"}),i.jsx("span",{className:"block text-xs opacity-80",children:"Control another always-on Pixcode host by API."})]})]}),t.connectionMode==="remote"&&i.jsxs("div",{className:"space-y-3 rounded-lg border border-border/70 bg-muted/20 p-3",children:[i.jsx(Ii,{id:"remoteUrl",name:"remoteUrl",label:"Remote API URL",value:t.remoteUrl,onChange:d=>l("remoteUrl",d),placeholder:"https://your-server.example.com",isDisabled:s,autoComplete:"url"}),i.jsx(Ii,{id:"remoteApiKey",name:"remoteApiKey",label:"Remote API Key",value:t.remoteApiKey,onChange:d=>l("remoteApiKey",d),placeholder:"px_...",isDisabled:s,type:"password",autoComplete:"off"})]}),i.jsx(Ii,{id:"username",name:"username",label:"Username",value:t.username,onChange:d=>l("username",d),placeholder:"Enter your username",isDisabled:s,autoComplete:"username"}),i.jsx(Ii,{id:"password",name:"password",label:"Password",value:t.password,onChange:d=>l("password",d),placeholder:"Enter your password",isDisabled:s,type:"password",autoComplete:"new-password"}),i.jsx(Ii,{id:"confirmPassword",name:"confirmPassword",label:"Confirm Password",value:t.confirmPassword,onChange:d=>l("confirmPassword",d),placeholder:"Confirm your password",isDisabled:s,type:"password",autoComplete:"new-password"}),i.jsx(RE,{errorMessage:n}),i.jsx("button",{type:"submit",disabled:s,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:s?"Setting up...":"Create Account"})]})})}function T9({children:e}){const{user:t,isLoading:r,needsSetup:n,hasCompletedOnboarding:a,refreshOnboardingStatus:s}=Ki();return r?i.jsx(k9,{}):n?i.jsx(A9,{}):t?a?i.jsx(i.Fragment,{children:e}):i.jsx(v9,{onComplete:s}):i.jsx(E9,{})}const DE=h.createContext(null),OE=()=>{const e=h.useContext(DE);if(!e)throw new Error("useWebSocket must be used within a WebSocketProvider");return e},j9=e=>{const t=window.location.protocol==="https:"?"wss:":"ws:";return e?`${t}//${window.location.host}/ws?token=${encodeURIComponent(e)}`:null},_9=()=>{const e=h.useRef(null),t=h.useRef(!1),r=h.useRef(!1),[n,a]=h.useState(null),[s,o]=h.useState(!1),l=h.useRef(null),{token:c}=Ki(),d=h.useCallback(()=>{if(!t.current)try{const f=j9(c);if(!f)return console.warn("No authentication token found for WebSocket connection");const m=new WebSocket(f);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||d()},3e3)},m.onerror=g=>{console.error("WebSocket error:",g)}}catch(f){console.error("Error creating WebSocket connection:",f)}},[c]);h.useEffect(()=>(d(),()=>{t.current=!0,l.current&&clearTimeout(l.current),e.current&&e.current.close()}),[d]);const u=h.useCallback(f=>{const m=e.current;m&&m.readyState===WebSocket.OPEN?m.send(JSON.stringify(f)):console.warn("WebSocket not connected")},[]);return h.useMemo(()=>({ws:e.current,sendMessage:u,latestMessage:n,isConnected:s}),[u,n,s])},I9=({children:e})=>{const t=_9();return i.jsx(DE.Provider,{value:t,children:e})},ME=h.createContext(null);function R9(e,t){return{message:t instanceof Error?t.message:`Failed to ${e}`,context:e,timestamp:new Date().toISOString()}}function ew(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 L9(e){return e.find(t=>t.status==="pending"||t.status==="in-progress")??null}function D9(e){return e?.type?e.type.startsWith("taskmaster-"):!1}function eo(){const e=h.useContext(ME);if(!e)throw new Error("useTaskMaster must be used within a TaskMasterProvider");return e}function O9({children:e}){const{latestMessage:t}=OE(),{user:r,token:n,isLoading:a}=Ki(),[s,o]=h.useState([]),[l,c]=h.useState(null),[d,u]=h.useState(null),[p,f]=h.useState(null),[m,g]=h.useState([]),[b,x]=h.useState(null),[y,v]=h.useState(!1),[w,k]=h.useState(!1),[E,S]=h.useState(!1),[j,_]=h.useState(null),T=h.useRef(null);h.useEffect(()=>{T.current=l?.name??null},[l?.name]);const C=h.useCallback(()=>{_(null)},[]),L=h.useCallback((z,U)=>{console.error(`TaskMaster ${z} error:`,U),_(R9(z,U))},[]),A=h.useCallback(z=>{const U=z?ew(z):null;c(U),u(U?.taskmaster??null),g([]),x(null)},[]),I=h.useCallback(async()=>{if(!r||!n){o([]),c(null),u(null),g([]),x(null);return}try{v(!0),C();const z=await ot.get("/projects");if(!z.ok)throw new Error(`Failed to fetch projects: ${z.status}`);const U=await z.json(),O=(Array.isArray(U)?U:[]).map(F=>ew(F));o(O);const G=T.current;if(!G)return;const $=O.find(F=>F.name===G)??null;c($),u($?.taskmaster??null)}catch(z){L("load projects",z)}finally{v(!1)}},[C,L,n,r]),N=h.useCallback(async()=>{const z=l?.name;if(!z||!r||!n){g([]),x(null);return}try{k(!0),C();const U=await ot.get(`/taskmaster/tasks/${encodeURIComponent(z)}`);if(!U.ok){const G=await U.json();throw new Error(G.message??"Failed to load tasks")}const V=await U.json(),O=Array.isArray(V.tasks)?V.tasks:[];g(O),x(L9(O))}catch(U){L("load tasks",U),g([]),x(null)}finally{k(!1)}},[C,l?.name,L,n,r]),P=h.useCallback(async()=>{if(!r||!n){f(null);return}try{S(!0),C();const z=await ot.get("/mcp-utils/taskmaster-server");if(!z.ok)throw new Error(`Failed to load MCP status: ${z.status}`);const U=await z.json();f(U)}catch(z){L("check MCP server status",z),f(null)}finally{S(!1)}},[C,L,n,r]);h.useEffect(()=>{!a&&r&&n&&(I(),P())},[a,P,I,n,r]),h.useEffect(()=>{l?.name&&r&&n&&N()},[l?.name,N,n,r]),h.useEffect(()=>{const z=t;if(D9(z)){if(z.type==="taskmaster-project-updated"&&z.projectName){I();return}if(z.type==="taskmaster-tasks-updated"&&z.projectName===l?.name){N();return}z.type==="taskmaster-mcp-status-changed"&&P()}},[l?.name,t,P,I,N]);const H=h.useMemo(()=>({projects:s,currentProject:l,projectTaskMaster:d,mcpServerStatus:p,tasks:m,nextTask:b,isLoading:y,isLoadingTasks:w,isLoadingMCP:E,error:j,refreshProjects:I,setCurrentProject:A,refreshTasks:N,refreshMCPStatus:P,clearError:C}),[C,l,j,y,E,w,p,b,d,s,P,I,N,A,m]);return i.jsx(ME.Provider,{value:H,children:e})}const PE=h.createContext({tasksEnabled:!0,setTasksEnabled:()=>{},toggleTasksEnabled:()=>{},isTaskMasterInstalled:null,isTaskMasterReady:null,installationStatus:null,isCheckingInstallation:!0,refreshTaskMasterInstallation:async()=>{}}),Kd=()=>{const e=h.useContext(PE);if(!e)throw new Error("useTasksSettings must be used within a TasksSettingsProvider");return e},M9=({children:e})=>{const{user:t,token:r,isLoading:n}=Ki(),[a,s]=h.useState(()=>{const v=localStorage.getItem("tasks-enabled");return v!==null?JSON.parse(v):!0}),[o,l]=h.useState(null),[c,d]=h.useState(null),[u,p]=h.useState(null),[f,m]=h.useState(!0),g=!!(t&&r);h.useEffect(()=>{localStorage.setItem("tasks-enabled",JSON.stringify(a))},[a]);const b=h.useCallback(async({signal:v}={})=>{if(!n){if(!g){p(null),l(null),d(null),m(!1);return}m(!0);try{const w=await ot.get("/taskmaster/installation-status");if(v?.aborted)return;if(w.ok){const k=await w.json();if(v?.aborted)return;p(k),l(k.installation?.isInstalled||!1),d(k.isReady||!1);const E=localStorage.getItem("tasks-enabled");!k.installation?.isInstalled&&!E&&s(!1)}else console.error("Failed to check TaskMaster installation status"),l(!1),d(!1)}catch(w){if(v?.aborted)return;console.error("Error checking TaskMaster installation:",w),l(!1),d(!1)}finally{v?.aborted||m(!1)}}},[g,n]);h.useEffect(()=>{const v=new AbortController,w=setTimeout(()=>{b({signal:v.signal})},0);return()=>{v.abort(),clearTimeout(w)}},[b]);const y={tasksEnabled:a,setTasksEnabled:s,toggleTasksEnabled:()=>{s(v=>!v)},isTaskMasterInstalled:o,isTaskMasterReady:c,installationStatus:u,isCheckingInstallation:f,refreshTaskMasterInstallation:b};return i.jsx(PE.Provider,{value:y,children:e})},FE=h.createContext(null);function Yd(){const e=h.useContext(FE);if(!e)throw new Error("usePlugins must be used within a PluginsProvider");return e}function P9({children:e}){const{user:t,token:r,isLoading:n}=Ki(),[a,s]=h.useState([]),[o,l]=h.useState(!0),[c,d]=h.useState(null),u=!!(t&&r),p=h.useCallback(async()=>{if(!u){s([]),d(null),l(!1);return}l(!0);try{const x=await ve("/api/plugins");if(x.ok){const y=await x.json();s(y.plugins||[]),d(null)}else{let y=`Failed to fetch plugins (${x.status})`;try{const v=await x.json();y=v.details||v.error||y}catch{y=x.statusText||y}d(y)}}catch(x){const y=x instanceof Error?x.message:"Failed to fetch plugins";d(y),console.error("[Plugins] Failed to fetch plugins:",x)}finally{l(!1)}},[u]);h.useEffect(()=>{n||p()},[n,p]);const f=h.useCallback(async x=>{try{const y=await ve("/api/plugins/install",{method:"POST",body:JSON.stringify({url:x})}),v=await y.json();return y.ok?(await p(),{success:!0}):{success:!1,error:v.details||v.error||"Install failed"}}catch(y){return{success:!1,error:y instanceof Error?y.message:"Install failed"}}},[p]),m=h.useCallback(async x=>{try{const y=await ve(`/api/plugins/${encodeURIComponent(x)}`,{method:"DELETE"}),v=await y.json();return y.ok?(await p(),{success:!0}):{success:!1,error:v.details||v.error||"Uninstall failed"}}catch(y){return{success:!1,error:y instanceof Error?y.message:"Uninstall failed"}}},[p]),g=h.useCallback(async x=>{try{const y=await ve(`/api/plugins/${encodeURIComponent(x)}/update`,{method:"POST"}),v=await y.json();return y.ok?(await p(),{success:!0}):{success:!1,error:v.details||v.error||"Update failed"}}catch(y){return{success:!1,error:y instanceof Error?y.message:"Update failed"}}},[p]),b=h.useCallback(async(x,y)=>{try{const v=await ve(`/api/plugins/${encodeURIComponent(x)}/enable`,{method:"PUT",body:JSON.stringify({enabled:y})});if(!v.ok){let w=`Toggle failed (${v.status})`;try{const k=await v.json();w=k.details||k.error||w}catch{w=v.statusText||w}return{success:!1,error:w}}return await p(),{success:!0,error:null}}catch(v){return{success:!1,error:v instanceof Error?v.message:"Toggle failed"}}},[p]);return i.jsx(FE.Provider,{value:{plugins:a,loading:o,pluginsError:c,refreshPlugins:p,installPlugin:f,uninstallPlugin:m,updatePlugin:g,togglePlugin:b},children:e})}const tw=e=>typeof window>"u"?!1:window.innerWidth<e,rw=()=>{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 Lf(e={}){const{mobileBreakpoint:t=768,trackMobile:r=!0,trackPWA:n=!0}=e,[a,s]=h.useState(()=>r?tw(t):!1),[o,l]=h.useState(()=>n?rw():!1);return h.useEffect(()=>{if(!r||typeof window>"u")return;const c=()=>{s(tw(t))};return c(),window.addEventListener("resize",c),()=>{window.removeEventListener("resize",c)}},[t,r]),h.useEffect(()=>{if(!n||typeof window>"u")return;const c=window.matchMedia("(display-mode: standalone)"),d=()=>{l(rw())};return d(),typeof c.addEventListener=="function"?(c.addEventListener("change",d),()=>{c.removeEventListener("change",d)}):(c.addListener(d),()=>{c.removeListener(d)})},[n]),{isMobile:a,isPWA:o}}const Df="pixcode.updateCheck.preferences",Zm="pixcode:update-check-settings-changed",Of=[{value:"30m",label:"Every 30 minutes",intervalMs:1800*1e3},{value:"24h",label:"Daily",intervalMs:1440*60*1e3},{value:"12h",label:"Every 12 hours",intervalMs:720*60*1e3},{value:"6h",label:"Every 6 hours",intervalMs:360*60*1e3},{value:"7d",label:"Weekly",intervalMs:10080*60*1e3},{value:"off",label:"Manual only",intervalMs:null}],Xm={frequency:"30m"};function nw(e){return Of.find(t=>t.value===e.frequency)?.intervalMs??null}function zE(e){if(!e||typeof e!="object")return Xm;const t=e.frequency;return Of.some(r=>r.value===t)?{frequency:t}:Xm}function aw(){try{const e=localStorage.getItem(Df);return zE(e?JSON.parse(e):null)}catch{return Xm}}function F9(e){const t=zE(e);localStorage.setItem(Df,JSON.stringify(t)),window.dispatchEvent(new CustomEvent(Zm,{detail:t}))}const $u=(e,t)=>{const r=e.split(".").map(Number),n=t.split(".").map(Number);for(let a=0;a<Math.max(r.length,n.length);a++){const s=r[a]||0,o=n[a]||0;if(s!==o)return s-o}return 0},z9="1.40.9",Jm="pixcode:update-available",B9=360*60*1e3,Uu=new Map;function BE(e,t){return`pixcode.updateCheck.cache.${e}.${t}`}function $9(e,t){try{const r=localStorage.getItem(BE(e,t));if(!r)return null;const n=JSON.parse(r);return{fetchedAt:typeof n.fetchedAt=="number"?n.fetchedAt:null,latestVersion:typeof n.latestVersion=="string"?n.latestVersion:null,releaseInfo:n.releaseInfo??null,rateLimitedUntil:typeof n.rateLimitedUntil=="number"?n.rateLimitedUntil:void 0}}catch{return null}}function iw(e,t,r){localStorage.setItem(BE(e,t),JSON.stringify(r))}function U9(e,t){const r=`${e}/${t}`,n=Uu.get(r);if(n)return n;const a=fetch(`https://api.github.com/repos/${e}/${t}/releases/latest`,{cache:"no-store",headers:{Accept:"application/vnd.github+json"}}).then(async s=>({status:s.status,ok:s.ok,data:await s.json().catch(()=>({}))})).finally(()=>{Uu.delete(r)});return Uu.set(r,a),a}const $E=(e,t)=>{const[r,n]=h.useState(!1),[a,s]=h.useState(null),[o,l]=h.useState(null),[c,d]=h.useState("git"),[u,p]=h.useState("idle"),[f,m]=h.useState(null),[g,b]=h.useState(()=>aw()),[x,y]=h.useState(z9),v=h.useRef(null),w=h.useCallback(E=>{F9(E),b(E)},[]);h.useEffect(()=>{const E=()=>b(aw()),S=j=>{j.key===Df&&E()};return window.addEventListener("storage",S),window.addEventListener(Zm,E),()=>{window.removeEventListener("storage",S),window.removeEventListener(Zm,E)}},[]),h.useEffect(()=>{let E=!1;const S=async()=>{try{const T=await(await fetch("/health",{cache:"no-store"})).json();if(E)return;(T.installMode==="npm"||T.installMode==="git")&&d(T.installMode),typeof T.version=="string"&&/^\d+\.\d+\.\d+/.test(T.version)&&y(T.version)}catch{}};S();const j=()=>{S()};return window.addEventListener("focus",j),()=>{E=!0,window.removeEventListener("focus",j)}},[]),h.useEffect(()=>{if(!x)return;let E=!1;const S=(A,I,N,P)=>({updateAvailable:!!(A&&$u(A,x)>0),latestVersion:A,releaseInfo:I,currentVersion:x,checkedAt:N,status:P}),j=A=>{!A.updateAvailable||!A.latestVersion||!A.releaseInfo||window.dispatchEvent(new CustomEvent(Jm,{detail:A}))},_=(A,I,N,P="success")=>{if(!A||!I)return n(!1),s(null),l(null),m(N),S(null,null,N,P);s(A),n($u(A,x)>0),l(I),m(N);const H=S(A,I,N,P);return j(H),H},T=async({force:A=!1}={})=>{const I=nw(g),N=$9(e,t),P=Date.now();if(!A&&I===null)return p("idle"),_(N?.latestVersion??null,N?.releaseInfo??null,N?.fetchedAt??null,"idle");if(!A&&N?.fetchedAt&&I!==null&&P-N.fetchedAt<I)return p("success"),_(N.latestVersion,N.releaseInfo,N.fetchedAt,"success");if(!A&&N?.rateLimitedUntil&&N.rateLimitedUntil>P)return p("error"),_(N.latestVersion,N.releaseInfo,N.fetchedAt,"error");try{p("checking");const H=await U9(e,t);if(E)return S(N?.latestVersion??null,N?.releaseInfo??null,N?.fetchedAt??null,"idle");const z=H.data;if(!H.ok)return H.status===403&&iw(e,t,{fetchedAt:N?.fetchedAt??null,latestVersion:N?.latestVersion??null,releaseInfo:N?.releaseInfo??null,rateLimitedUntil:P+Math.max(I??0,B9)}),p("error"),_(N?.latestVersion??null,N?.releaseInfo??null,N?.fetchedAt??null,"error");if(z.tag_name){const U=z.tag_name.replace(/^v/,""),V=$u(U,x)>0,O={title:z.name||z.tag_name,body:z.body||"",htmlUrl:z.html_url||`https://github.com/${e}/${t}/releases/latest`,publishedAt:z.published_at||""};iw(e,t,{fetchedAt:P,latestVersion:U,releaseInfo:O}),s(U),n(V),V&&W4({key:`app-update:${U}`,title:"Pixcode update available",body:`Pixcode ${x} can update to ${U}.`,tag:"pixcode-app-update",data:{type:"app-update",latestVersion:U,installMode:c}}),l(O),p("success"),m(P);const G=S(U,O,P,"success");return j(G),G}else return n(!1),s(null),l(null),p("error"),S(null,null,null,"error")}catch(H){return console.error("Version check failed:",H),n(!1),s(null),l(null),p("error"),S(null,null,null,"error")}};v.current=T,T();const C=nw(g),L=C===null?null:window.setInterval(()=>{T()},C);return()=>{E=!0,L!==null&&window.clearInterval(L)}},[e,t,x,c,g]);const k=h.useCallback(async()=>v.current?await v.current({force:!0}):null,[]);return{updateAvailable:r,latestVersion:a,currentVersion:x,releaseInfo:o,installMode:c,checkStatus:u,lastCheckedAt:f,manualCheck:k,updateCheckPreferences:g,updatePreferences:w}},Ri={autoExpandTools:!1,showRawParameters:!1,showThinking:!0,autoScrollToBottom:!0,sendByCtrlEnter:!1,changeAwareness:!1,sidebarVisible:!0,historyView:"flat"},G9=["flat","grouped"],H9=e=>typeof e=="string"&&G9.includes(e),id=Object.keys(Ri),V9=new Set(id),Gu="ui-preferences:sync",q9=(e,t)=>{if(typeof e=="boolean")return e;if(typeof e=="string"){if(e==="true")return!0;if(e==="false")return!1}return t},sd=(e,t,r)=>e==="historyView"?H9(t)?t:r:q9(t,r),W9=(e,t)=>{try{const r=localStorage.getItem(e);if(r===null)return t;const n=JSON.parse(r);return sd(e,n,t)}catch{return t}},K9=e=>{if(typeof window>"u")return Ri;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 id.reduce((a,s)=>(a[s]=sd(s,n[s],Ri[s]),a),{...Ri})}}}catch{}return id.reduce((t,r)=>(t[r]=W9(r,Ri[r]),t),{...Ri})};function Y9(e,t){switch(t.type){case"set":{const{key:r,value:n}=t;if(!V9.has(r))return e;const a=sd(r,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 s of id){if(!(s in r))continue;const o=r[s],l=sd(s,o,e[s]);a[s]!==l&&(a[s]=l,n=!0)}return n?a:e}case"reset":return{...Ri,...t.value||{}};default:return e}}function Mf(e="uiPreferences"){const t=h.useRef(`ui-preferences-${Math.random().toString(36).slice(2)}`),[r,n]=h.useReducer(Y9,e,K9);return h.useEffect(()=>{typeof window>"u"||(localStorage.setItem(e,JSON.stringify(r)),window.dispatchEvent(new CustomEvent(Gu,{detail:{storageKey:e,sourceId:t.current,value:r}})))},[r,e]),h.useEffect(()=>{if(typeof window>"u")return;const l=u=>{!u||typeof u!="object"||Array.isArray(u)||n({type:"set_many",value:u})},c=u=>{if(!(u.key!==e||u.newValue===null))try{const p=JSON.parse(u.newValue);l(p)}catch{}},d=u=>{const f=u.detail;!f||f.storageKey!==e||f.sourceId===t.current||l(f.value)};return window.addEventListener("storage",c),window.addEventListener(Gu,d),()=>{window.removeEventListener("storage",c),window.removeEventListener(Gu,d)}},[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 Z9=()=>{try{const e=localStorage.getItem("claude-settings");return e&&JSON.parse(e).projectSortOrder==="date"?"date":"name"}catch{return"name"}},X9=()=>{try{const e=localStorage.getItem("starredProjects");return e?new Set(JSON.parse(e)):new Set}catch{return new Set}},J9=e=>{try{localStorage.setItem("starredProjects",JSON.stringify([...e]))}catch{}},sw=(e,t)=>`${e}::${t}`,Q9=()=>{try{const e=localStorage.getItem("starredSessions");return e?new Set(JSON.parse(e)):new Set}catch{return new Set}},eO=e=>{try{localStorage.setItem("starredSessions",JSON.stringify([...e]))}catch{}},tO=/(?:^|[\s/\\(\[`"'])([\w./-]+?\.(?:ts|tsx|js|jsx|mjs|cjs|py|rb|go|rs|java|kt|swift|c|cc|cpp|h|hpp|cs|php|sh|bash|zsh|json|ya?ml|toml|md|mdx|html?|css|scss|less|sql|prisma|graphql|gql|vue|svelte|astro|dart|lua|r|pl|ps1|tf|dockerfile|env))(?:$|[\s:,)\]`"'])/i,rO=e=>{if(!e)return[];const t=new Set,r=new RegExp(tO.source,"gi");let n;for(;(n=r.exec(e))!==null;){const a=n[1],s=a.lastIndexOf(".");if(s>-1){const o=a.slice(s+1).toLowerCase();o&&o.length<=10&&t.add(o)}if(t.size>=3)break}return[...t]},Fi=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),nO=(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.__provider==="qwen"||e.__provider==="opencode"?e.summary||e.name||t("projects.newSession"):e.summary||t("projects.newSession"),aO=e=>e.__provider==="cursor"?String(e.createdAt||""):e.__provider==="codex"?String(e.createdAt||e.lastActivity||""):String(e.lastActivity||e.createdAt||""),iO=(e,t,r)=>{const n=Fi(e),a=Math.floor((t.getTime()-n.getTime())/(1e3*60));return{isCursorSession:e.__provider==="cursor",isCodexSession:e.__provider==="codex",isGeminiSession:e.__provider==="gemini",isQwenSession:e.__provider==="qwen",isOpencodeSession:e.__provider==="opencode",isActive:a<10,sessionName:nO(e,r),sessionTime:aO(e),messageCount:Number(e.messageCount||0)}},UE=(e,t)=>{const r=[...e.sessions||[],...t[e.name]||[]].map(g=>({...g,__provider:"claude"})),n=(e.cursorSessions||[]).map(g=>({...g,__provider:"cursor"})),a=(e.codexSessions||[]).map(g=>({...g,__provider:"codex"})),s=g=>typeof g.id=="string"&&g.id.startsWith("qwen_")||g.provider==="qwen",o=g=>typeof g.id=="string"&&g.id.startsWith("opencode_")||g.provider==="opencode",l=e.geminiSessions||[],c=l.filter(g=>!s(g)&&!o(g)).map(g=>({...g,__provider:"gemini"})),d=l.filter(g=>s(g)).map(g=>({...g,__provider:"qwen"})),u=l.filter(g=>o(g)).map(g=>({...g,__provider:"opencode"})),p=[...(e.qwenSessions||[]).map(g=>({...g,__provider:"qwen"})),...d],f=[...(e.opencodeSessions||[]).map(g=>({...g,__provider:"opencode"})),...u],m=new Map;for(const g of[...r,...n,...a,...c,...p,...f])m.has(g.id)||m.set(g.id,g);return[...m.values()].sort((g,b)=>Fi(b).getTime()-Fi(g).getTime())},ow=(e,t)=>{const r=UE(e,t);return r.length===0?new Date(0):r.reduce((n,a)=>{const s=Fi(a);return s>n?s:n},new Date(0))},sO=(e,t,r,n)=>{const a=[...e];return a.sort((s,o)=>{const l=r.has(s.name),c=r.has(o.name);return l&&!c?-1:!l&&c?1:t==="date"?ow(o,n).getTime()-ow(s,n).getTime():(s.displayName||s.name).localeCompare(o.displayName||o.name)}),a},oO=(e,t)=>{const r=t.trim().toLowerCase();return r?e.filter(n=>{const a=(n.displayName||n.name).toLowerCase(),s=n.name.toLowerCase();return a.includes(r)||s.includes(r)}):e},lO=(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"},cO=e=>{const t=typeof e.fullPath=="string"&&e.fullPath.length>0?e.fullPath:typeof e.path=="string"?e.path:"";return{name:e.name,displayName:typeof e.displayName=="string"&&e.displayName.trim().length>0?e.displayName:e.name,fullPath:t,path:typeof e.path=="string"&&e.path.length>0?e.path:t}};function dO({projects:e,selectedProject:t,selectedSession:r,isLoading:n,isMobile:a,t:s,onRefresh:o,onProjectSelect:l,onSessionSelect:c,onSessionDelete:d,onProjectDelete:u,setCurrentProject:p,setSidebarVisible:f,sidebarVisible:m}){const[g,b]=h.useState(new Set),[x,y]=h.useState(null),[v,w]=h.useState(!1),[k,E]=h.useState(""),[S,j]=h.useState({}),[_,T]=h.useState({}),[C,L]=h.useState(new Set),[A,I]=h.useState(new Date),[N,P]=h.useState("name"),[H,z]=h.useState(!1),[U,V]=h.useState({}),[O,G]=h.useState(null),[$,F]=h.useState(""),[te,Q]=h.useState(""),[ge,ae]=h.useState(new Set),[me,pe]=h.useState(null),[be,Ne]=h.useState(null),[xe,Be]=h.useState(!1),[M,de]=h.useState(()=>X9()),[ce,Y]=h.useState(()=>Q9()),[W,ne]=h.useState("projects"),[fe,ye]=h.useState(null),[se,Se]=h.useState(!1),[re,X]=h.useState(null),Z=h.useRef(null),le=h.useRef(0),Ee=h.useRef(null),Te=!a&&!m;h.useEffect(()=>{const Ce=setInterval(()=>{I(new Date)},6e4);return()=>clearInterval(Ce)},[]),h.useEffect(()=>{T({}),L(new Set),V({})},[e]),h.useEffect(()=>{t&&b(Ce=>{if(Ce.has(t.name))return Ce;const Oe=new Set(Ce);return Oe.add(t.name),Oe})},[r,t]),h.useEffect(()=>{if(e.length>0&&!n){const Ce=new Set;e.forEach(Oe=>{Oe.sessions&&Oe.sessions.length>=0&&Ce.add(Oe.name)}),L(Ce)}},[e,n]),h.useEffect(()=>{const Ce=()=>{P(Z9())};Ce();const Oe=Ge=>{Ge.key==="claude-settings"&&Ce()},ct=()=>Ce();return window.addEventListener("storage",Oe),window.addEventListener("pixcode:settings-changed",ct),()=>{window.removeEventListener("storage",Oe),window.removeEventListener("pixcode:settings-changed",ct)}},[]),h.useEffect(()=>{Z.current&&clearTimeout(Z.current),Ee.current&&(Ee.current.close(),Ee.current=null);const Ce=te.trim();if(W!=="conversations"||Ce.length<2){le.current+=1,ye(null),X(null),Se(!1);return}Se(!0);const Oe=++le.current;return Z.current=setTimeout(()=>{if(Oe!==le.current)return;const ct=ot.searchConversationsUrl(Ce),Ge=new EventSource(ct);Ee.current=Ge;const He=[];let je=0;Ge.addEventListener("result",Ue=>{if(Oe!==le.current){Ge.close();return}try{const Fe=JSON.parse(Ue.data);He.push(Fe.projectResult),je=Fe.totalMatches,ye({results:[...He],totalMatches:je,query:Ce}),X({scannedProjects:Fe.scannedProjects,totalProjects:Fe.totalProjects})}catch{}}),Ge.addEventListener("progress",Ue=>{if(Oe!==le.current){Ge.close();return}try{const Fe=JSON.parse(Ue.data);je=Fe.totalMatches,X({scannedProjects:Fe.scannedProjects,totalProjects:Fe.totalProjects})}catch{}}),Ge.addEventListener("done",()=>{if(Oe!==le.current){Ge.close();return}Ge.close(),Ee.current=null,Se(!1),X(null),He.length===0&&ye({results:[],totalMatches:0,query:Ce})}),Ge.addEventListener("error",()=>{if(Oe!==le.current){Ge.close();return}Ge.close(),Ee.current=null,Se(!1),X(null),He.length===0&&ye({results:[],totalMatches:0,query:Ce})})},400),()=>{Z.current&&clearTimeout(Z.current),Ee.current&&(Ee.current.close(),Ee.current=null)}},[te,W]);const Ke=h.useCallback(Ce=>{b(Oe=>{const ct=new Set;return Oe.has(Ce)||ct.add(Ce),ct})},[]),Ze=h.useCallback((Ce,Oe)=>{c({...Ce,__projectName:Oe})},[c]),vt=h.useCallback(Ce=>{de(Oe=>{const ct=new Set(Oe);return ct.has(Ce)?ct.delete(Ce):ct.add(Ce),J9(ct),ct})},[]),Qe=h.useCallback(Ce=>M.has(Ce),[M]),jt=h.useCallback((Ce,Oe)=>{Y(ct=>{const Ge=sw(Ce,Oe),He=new Set(ct);return He.has(Ge)?He.delete(Ge):He.add(Ge),eO(He),He})},[]),wt=h.useCallback((Ce,Oe)=>ce.has(sw(Ce,Oe)),[ce]),st=h.useCallback(Ce=>UE(Ce,_),[_]),lt=h.useMemo(()=>e.map(Ce=>{const Oe=U[Ce.name];return Oe===void 0?Ce:{...Ce,sessionMeta:{...Ce.sessionMeta,hasMore:Oe}}}),[U,e]),kt=h.useMemo(()=>sO(lt,N,M,_),[_,N,lt,M]),_t=h.useMemo(()=>oO(kt,te),[te,kt]),At=h.useCallback(Ce=>{y(Ce.name),E(Ce.displayName)},[]),pr=h.useCallback(()=>{y(null),E("")},[]),nr=h.useCallback(async Ce=>{try{(await ot.renameProject(Ce,k)).ok?window.refreshProjects?await window.refreshProjects():window.location.reload():console.error("Failed to rename project")}catch(Oe){console.error("Error renaming project:",Oe)}finally{y(null),E("")}},[k]),Xt=h.useCallback((Ce,Oe,ct,Ge="claude")=>{Ne({projectName:Ce,sessionId:Oe,sessionTitle:ct,provider:Ge})},[]),zr=h.useCallback(async()=>{if(!be)return;const{projectName:Ce,sessionId:Oe,provider:ct}=be;Ne(null);try{let Ge;if(ct==="codex"?Ge=await ot.deleteCodexSession(Oe):ct==="gemini"?Ge=await ot.deleteGeminiSession(Oe):ct==="qwen"?Ge=await ot.deleteQwenSession(Oe):Ge=await ot.deleteSession(Ce,Oe),Ge.ok)d?.(Oe);else{const He=await Ge.text();console.error("[Sidebar] Failed to delete session:",{status:Ge.status,error:He}),alert(s("messages.deleteSessionFailed"))}}catch(Ge){console.error("[Sidebar] Error deleting session:",Ge),alert(s("messages.deleteSessionError"))}},[d,be,s]),De=h.useCallback(Ce=>{pe({project:Ce,sessionCount:st(Ce).length})},[st]),Xe=h.useCallback(async(Ce=!1)=>{if(!me)return;const{project:Oe,sessionCount:ct}=me,Ge=ct===0;pe(null),ae(He=>new Set([...He,Oe.name]));try{const He=await ot.deleteProject(Oe.name,!Ge,Ce);if(He.ok)u?.(Oe.name);else{const je=await He.json();alert(je.error||s("messages.deleteProjectFailed"))}}catch(He){console.error("Error deleting project:",He),alert(s("messages.deleteProjectError"))}finally{ae(He=>{const je=new Set(He);return je.delete(Oe.name),je})}},[me,u,s]),Je=h.useCallback(async Ce=>{const Oe=U[Ce.name];if(!(!(Oe!==void 0?Oe:Ce.sessionMeta?.hasMore===!0)||S[Ce.name])){j(Ge=>({...Ge,[Ce.name]:!0}));try{const Ge=(Ce.sessions?.length||0)+(_[Ce.name]?.length||0),He=await ot.sessions(Ce.name,5,Ge);if(!He.ok)return;const je=await He.json();T(Ue=>({...Ue,[Ce.name]:[...Ue[Ce.name]||[],...je.sessions||[]]})),je.hasMore===!1&&V(Ue=>({...Ue,[Ce.name]:!1}))}catch(Ge){console.error("Error loading more sessions:",Ge)}finally{j(Ge=>({...Ge,[Ce.name]:!1}))}}},[_,S,U]),ie=h.useCallback(Ce=>{l(Ce),p(Ce)},[l,p]),ke=h.useCallback(async()=>{z(!0);try{await o()}finally{z(!1)}},[o]),we=h.useCallback(async(Ce,Oe,ct,Ge)=>{const He=ct.trim();if(!He){G(null),F("");return}try{const je=await ot.renameSession(Oe,He,Ge);je.ok?await o():(console.error("[Sidebar] Failed to rename session:",je.status),alert(s("messages.renameSessionFailed")))}catch(je){console.error("[Sidebar] Error renaming session:",je),alert(s("messages.renameSessionError"))}finally{G(null),F("")}},[o,s]),Ve=h.useCallback(()=>{f(!1)},[f]),et=h.useCallback(()=>{f(!0)},[f]);return{isSidebarCollapsed:Te,expandedProjects:g,editingProject:x,showNewProject:v,editingName:k,loadingSessions:S,additionalSessions:_,initialSessionsLoaded:C,currentTime:A,projectSortOrder:N,isRefreshing:H,editingSession:O,editingSessionName:$,searchFilter:te,deletingProjects:ge,deleteConfirmation:me,sessionDeleteConfirmation:be,showVersionModal:xe,starredProjects:M,starredSessions:ce,filteredProjects:_t,toggleProject:Ke,handleSessionClick:Ze,toggleStarProject:vt,isProjectStarred:Qe,toggleStarSession:jt,isSessionStarred:wt,getProjectSessions:st,startEditing:At,cancelEditing:pr,saveProjectName:nr,showDeleteSessionConfirmation:Xt,confirmDeleteSession:zr,requestProjectDelete:De,confirmDeleteProject:Xe,loadMoreSessions:Je,handleProjectSelect:ie,refreshProjects:ke,updateSessionSummary:we,collapseSidebar:Ve,expandSidebar:et,setShowNewProject:w,setEditingName:E,setEditingSession:G,setEditingSessionName:F,searchMode:W,setSearchMode:ne,conversationResults:fe,isSearching:se,searchProgress:re,clearConversationResults:h.useCallback(()=>{le.current+=1,Ee.current&&(Ee.current.close(),Ee.current=null),Se(!1),X(null),ye(null)},[]),setSearchFilter:Q,setDeleteConfirmation:pe,setSessionDeleteConfirmation:Ne,setShowVersionModal:Be}}const uO="https://discord.gg/buxwujPNRE",pO="https://github.com/alicomert/pixcode/issues/new";function mO({className:e}){return i.jsx("svg",{className:e,fill:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:i.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 hO({onExpand:e,onShowSettings:t,updateAvailable:r,onShowVersionModal:n,t:a}){return i.jsxs("div",{className:"flex h-full w-12 flex-col items-center gap-1 bg-background/80 py-3 backdrop-blur-sm",children:[i.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:i.jsx(xD,{className:"h-4 w-4 text-muted-foreground transition-colors group-hover:text-foreground"})}),i.jsx("div",{className:"nav-divider my-1 w-6"}),i.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:i.jsx(Lt,{className:"h-4 w-4 text-muted-foreground transition-colors group-hover:text-foreground"})}),i.jsx("a",{href:pO,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:i.jsx(ml,{className:"h-4 w-4 text-muted-foreground transition-colors group-hover:text-foreground"})}),i.jsx("a",{href:uO,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:i.jsx(mO,{className:"h-4 w-4 text-muted-foreground transition-colors group-hover:text-foreground"})}),r&&i.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:[i.jsx(Na,{className:"h-4 w-4 text-blue-500"}),i.jsx("span",{className:"absolute right-1.5 top-1.5 h-1.5 w-1.5 animate-pulse rounded-full bg-blue-500"})]})]})}function GE(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=GE(e[t]))&&(n&&(n+=" "),n+=r)}else for(r in e)e[r]&&(n&&(n+=" "),n+=r);return n}function HE(){for(var e,t,r=0,n="",a=arguments.length;r<a;r++)(e=arguments[r])&&(t=GE(e))&&(n&&(n+=" "),n+=t);return n}const lw=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,cw=HE,Pf=(e,t)=>r=>{var n;if(t?.variants==null)return cw(e,r?.class,r?.className);const{variants:a,defaultVariants:s}=t,o=Object.keys(a).map(d=>{const u=r?.[d],p=s?.[d];if(u===null)return null;const f=lw(u)||lw(p);return a[d][f]}),l=r&&Object.entries(r).reduce((d,u)=>{let[p,f]=u;return f===void 0||(d[p]=f),d},{}),c=t==null||(n=t.compoundVariants)===null||n===void 0?void 0:n.reduce((d,u)=>{let{class:p,className:f,...m}=u;return Object.entries(m).every(g=>{let[b,x]=g;return Array.isArray(x)?x.includes({...s,...l}[b]):{...s,...l}[b]===x})?[...d,p,f]:d},[]);return cw(e,o,c,r?.class,r?.className)},Ff="-",fO=e=>{const t=bO(e),{conflictingClassGroups:r,conflictingClassGroupModifiers:n}=e;return{getClassGroupId:o=>{const l=o.split(Ff);return l[0]===""&&l.length!==1&&l.shift(),VE(l,t)||gO(o)},getConflictingClassGroupIds:(o,l)=>{const c=r[o]||[];return l&&n[o]?[...c,...n[o]]:c}}},VE=(e,t)=>{if(e.length===0)return t.classGroupId;const r=e[0],n=t.nextPart.get(r),a=n?VE(e.slice(1),n):void 0;if(a)return a;if(t.validators.length===0)return;const s=e.join(Ff);return t.validators.find(({validator:o})=>o(s))?.classGroupId},dw=/^\[(.+)\]$/,gO=e=>{if(dw.test(e)){const t=dw.exec(e)[1],r=t?.substring(0,t.indexOf(":"));if(r)return"arbitrary.."+r}},bO=e=>{const{theme:t,classGroups:r}=e,n={nextPart:new Map,validators:[]};for(const a in r)Qm(r[a],n,a,t);return n},Qm=(e,t,r,n)=>{e.forEach(a=>{if(typeof a=="string"){const s=a===""?t:uw(t,a);s.classGroupId=r;return}if(typeof a=="function"){if(xO(a)){Qm(a(n),t,r,n);return}t.validators.push({validator:a,classGroupId:r});return}Object.entries(a).forEach(([s,o])=>{Qm(o,uw(t,s),r,n)})})},uw=(e,t)=>{let r=e;return t.split(Ff).forEach(n=>{r.nextPart.has(n)||r.nextPart.set(n,{nextPart:new Map,validators:[]}),r=r.nextPart.get(n)}),r},xO=e=>e.isThemeGetter,yO=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,r=new Map,n=new Map;const a=(s,o)=>{r.set(s,o),t++,t>e&&(t=0,n=r,r=new Map)};return{get(s){let o=r.get(s);if(o!==void 0)return o;if((o=n.get(s))!==void 0)return a(s,o),o},set(s,o){r.has(s)?r.set(s,o):a(s,o)}}},eh="!",th=":",vO=th.length,wO=e=>{const{prefix:t,experimentalParseClassName:r}=e;let n=a=>{const s=[];let o=0,l=0,c=0,d;for(let g=0;g<a.length;g++){let b=a[g];if(o===0&&l===0){if(b===th){s.push(a.slice(c,g)),c=g+vO;continue}if(b==="/"){d=g;continue}}b==="["?o++:b==="]"?o--:b==="("?l++:b===")"&&l--}const u=s.length===0?a:a.substring(c),p=kO(u),f=p!==u,m=d&&d>c?d-c:void 0;return{modifiers:s,hasImportantModifier:f,baseClassName:p,maybePostfixModifierPosition:m}};if(t){const a=t+th,s=n;n=o=>o.startsWith(a)?s(o.substring(a.length)):{isExternal:!0,modifiers:[],hasImportantModifier:!1,baseClassName:o,maybePostfixModifierPosition:void 0}}if(r){const a=n;n=s=>r({className:s,parseClassName:a})}return n},kO=e=>e.endsWith(eh)?e.substring(0,e.length-1):e.startsWith(eh)?e.substring(1):e,SO=e=>{const t=Object.fromEntries(e.orderSensitiveModifiers.map(n=>[n,!0]));return n=>{if(n.length<=1)return n;const a=[];let s=[];return n.forEach(o=>{o[0]==="["||t[o]?(a.push(...s.sort(),o),s=[]):s.push(o)}),a.push(...s.sort()),a}},EO=e=>({cache:yO(e.cacheSize),parseClassName:wO(e),sortModifiers:SO(e),...fO(e)}),NO=/\s+/,CO=(e,t)=>{const{parseClassName:r,getClassGroupId:n,getConflictingClassGroupIds:a,sortModifiers:s}=t,o=[],l=e.trim().split(NO);let c="";for(let d=l.length-1;d>=0;d-=1){const u=l[d],{isExternal:p,modifiers:f,hasImportantModifier:m,baseClassName:g,maybePostfixModifierPosition:b}=r(u);if(p){c=u+(c.length>0?" "+c:c);continue}let x=!!b,y=n(x?g.substring(0,b):g);if(!y){if(!x){c=u+(c.length>0?" "+c:c);continue}if(y=n(g),!y){c=u+(c.length>0?" "+c:c);continue}x=!1}const v=s(f).join(":"),w=m?v+eh:v,k=w+y;if(o.includes(k))continue;o.push(k);const E=a(y,x);for(let S=0;S<E.length;++S){const j=E[S];o.push(w+j)}c=u+(c.length>0?" "+c:c)}return c};function AO(){let e=0,t,r,n="";for(;e<arguments.length;)(t=arguments[e++])&&(r=qE(t))&&(n&&(n+=" "),n+=r);return n}const qE=e=>{if(typeof e=="string")return e;let t,r="";for(let n=0;n<e.length;n++)e[n]&&(t=qE(e[n]))&&(r&&(r+=" "),r+=t);return r};function TO(e,...t){let r,n,a,s=o;function o(c){const d=t.reduce((u,p)=>p(u),e());return r=EO(d),n=r.cache.get,a=r.cache.set,s=l,l(c)}function l(c){const d=n(c);if(d)return d;const u=CO(c,r);return a(c,u),u}return function(){return s(AO.apply(null,arguments))}}const mr=e=>{const t=r=>r[e]||[];return t.isThemeGetter=!0,t},WE=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,KE=/^\((?:(\w[\w-]*):)?(.+)\)$/i,jO=/^\d+\/\d+$/,_O=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,IO=/\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$/,RO=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,LO=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,DO=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,cs=e=>jO.test(e),mt=e=>!!e&&!Number.isNaN(Number(e)),$a=e=>!!e&&Number.isInteger(Number(e)),Hu=e=>e.endsWith("%")&&mt(e.slice(0,-1)),ma=e=>_O.test(e),OO=()=>!0,MO=e=>IO.test(e)&&!RO.test(e),YE=()=>!1,PO=e=>LO.test(e),FO=e=>DO.test(e),zO=e=>!qe(e)&&!We(e),BO=e=>to(e,JE,YE),qe=e=>WE.test(e),vi=e=>to(e,QE,MO),Vu=e=>to(e,VO,mt),pw=e=>to(e,ZE,YE),$O=e=>to(e,XE,FO),tc=e=>to(e,eN,PO),We=e=>KE.test(e),jo=e=>ro(e,QE),UO=e=>ro(e,qO),mw=e=>ro(e,ZE),GO=e=>ro(e,JE),HO=e=>ro(e,XE),rc=e=>ro(e,eN,!0),to=(e,t,r)=>{const n=WE.exec(e);return n?n[1]?t(n[1]):r(n[2]):!1},ro=(e,t,r=!1)=>{const n=KE.exec(e);return n?n[1]?t(n[1]):r:!1},ZE=e=>e==="position"||e==="percentage",XE=e=>e==="image"||e==="url",JE=e=>e==="length"||e==="size"||e==="bg-size",QE=e=>e==="length",VO=e=>e==="number",qO=e=>e==="family-name",eN=e=>e==="shadow",WO=()=>{const e=mr("color"),t=mr("font"),r=mr("text"),n=mr("font-weight"),a=mr("tracking"),s=mr("leading"),o=mr("breakpoint"),l=mr("container"),c=mr("spacing"),d=mr("radius"),u=mr("shadow"),p=mr("inset-shadow"),f=mr("text-shadow"),m=mr("drop-shadow"),g=mr("blur"),b=mr("perspective"),x=mr("aspect"),y=mr("ease"),v=mr("animate"),w=()=>["auto","avoid","all","avoid-page","page","left","right","column"],k=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],E=()=>[...k(),We,qe],S=()=>["auto","hidden","clip","visible","scroll"],j=()=>["auto","contain","none"],_=()=>[We,qe,c],T=()=>[cs,"full","auto",..._()],C=()=>[$a,"none","subgrid",We,qe],L=()=>["auto",{span:["full",$a,We,qe]},$a,We,qe],A=()=>[$a,"auto",We,qe],I=()=>["auto","min","max","fr",We,qe],N=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],P=()=>["start","end","center","stretch","center-safe","end-safe"],H=()=>["auto",..._()],z=()=>[cs,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",..._()],U=()=>[e,We,qe],V=()=>[...k(),mw,pw,{position:[We,qe]}],O=()=>["no-repeat",{repeat:["","x","y","space","round"]}],G=()=>["auto","cover","contain",GO,BO,{size:[We,qe]}],$=()=>[Hu,jo,vi],F=()=>["","none","full",d,We,qe],te=()=>["",mt,jo,vi],Q=()=>["solid","dashed","dotted","double"],ge=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],ae=()=>[mt,Hu,mw,pw],me=()=>["","none",g,We,qe],pe=()=>["none",mt,We,qe],be=()=>["none",mt,We,qe],Ne=()=>[mt,We,qe],xe=()=>[cs,"full",..._()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[ma],breakpoint:[ma],color:[OO],container:[ma],"drop-shadow":[ma],ease:["in","out","in-out"],font:[zO],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[ma],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[ma],shadow:[ma],spacing:["px",mt],text:[ma],"text-shadow":[ma],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",cs,qe,We,x]}],container:["container"],columns:[{columns:[mt,qe,We,l]}],"break-after":[{"break-after":w()}],"break-before":[{"break-before":w()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:E()}],overflow:[{overflow:S()}],"overflow-x":[{"overflow-x":S()}],"overflow-y":[{"overflow-y":S()}],overscroll:[{overscroll:j()}],"overscroll-x":[{"overscroll-x":j()}],"overscroll-y":[{"overscroll-y":j()}],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:[$a,"auto",We,qe]}],basis:[{basis:[cs,"full","auto",l,..._()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[mt,cs,"auto","initial","none",qe]}],grow:[{grow:["",mt,We,qe]}],shrink:[{shrink:["",mt,We,qe]}],order:[{order:[$a,"first","last","none",We,qe]}],"grid-cols":[{"grid-cols":C()}],"col-start-end":[{col:L()}],"col-start":[{"col-start":A()}],"col-end":[{"col-end":A()}],"grid-rows":[{"grid-rows":C()}],"row-start-end":[{row:L()}],"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":I()}],"auto-rows":[{"auto-rows":I()}],gap:[{gap:_()}],"gap-x":[{"gap-x":_()}],"gap-y":[{"gap-y":_()}],"justify-content":[{justify:[...N(),"normal"]}],"justify-items":[{"justify-items":[...P(),"normal"]}],"justify-self":[{"justify-self":["auto",...P()]}],"align-content":[{content:["normal",...N()]}],"align-items":[{items:[...P(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...P(),{baseline:["","last"]}]}],"place-content":[{"place-content":N()}],"place-items":[{"place-items":[...P(),"baseline"]}],"place-self":[{"place-self":["auto",...P()]}],p:[{p:_()}],px:[{px:_()}],py:[{py:_()}],ps:[{ps:_()}],pe:[{pe:_()}],pt:[{pt:_()}],pr:[{pr:_()}],pb:[{pb:_()}],pl:[{pl:_()}],m:[{m:H()}],mx:[{mx:H()}],my:[{my:H()}],ms:[{ms:H()}],me:[{me:H()}],mt:[{mt:H()}],mr:[{mr:H()}],mb:[{mb:H()}],ml:[{ml:H()}],"space-x":[{"space-x":_()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":_()}],"space-y-reverse":["space-y-reverse"],size:[{size:z()}],w:[{w:[l,"screen",...z()]}],"min-w":[{"min-w":[l,"screen","none",...z()]}],"max-w":[{"max-w":[l,"screen","none","prose",{screen:[o]},...z()]}],h:[{h:["screen","lh",...z()]}],"min-h":[{"min-h":["screen","lh","none",...z()]}],"max-h":[{"max-h":["screen","lh",...z()]}],"font-size":[{text:["base",r,jo,vi]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[n,We,Vu]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",Hu,qe]}],"font-family":[{font:[UO,qe,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,We,qe]}],"line-clamp":[{"line-clamp":[mt,"none",We,Vu]}],leading:[{leading:[s,..._()]}],"list-image":[{"list-image":["none",We,qe]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",We,qe]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:U()}],"text-color":[{text:U()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...Q(),"wavy"]}],"text-decoration-thickness":[{decoration:[mt,"from-font","auto",We,vi]}],"text-decoration-color":[{decoration:U()}],"underline-offset":[{"underline-offset":[mt,"auto",We,qe]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:_()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",We,qe]}],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",We,qe]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:V()}],"bg-repeat":[{bg:O()}],"bg-size":[{bg:G()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},$a,We,qe],radial:["",We,qe],conic:[$a,We,qe]},HO,$O]}],"bg-color":[{bg:U()}],"gradient-from-pos":[{from:$()}],"gradient-via-pos":[{via:$()}],"gradient-to-pos":[{to:$()}],"gradient-from":[{from:U()}],"gradient-via":[{via:U()}],"gradient-to":[{to:U()}],rounded:[{rounded:F()}],"rounded-s":[{"rounded-s":F()}],"rounded-e":[{"rounded-e":F()}],"rounded-t":[{"rounded-t":F()}],"rounded-r":[{"rounded-r":F()}],"rounded-b":[{"rounded-b":F()}],"rounded-l":[{"rounded-l":F()}],"rounded-ss":[{"rounded-ss":F()}],"rounded-se":[{"rounded-se":F()}],"rounded-ee":[{"rounded-ee":F()}],"rounded-es":[{"rounded-es":F()}],"rounded-tl":[{"rounded-tl":F()}],"rounded-tr":[{"rounded-tr":F()}],"rounded-br":[{"rounded-br":F()}],"rounded-bl":[{"rounded-bl":F()}],"border-w":[{border:te()}],"border-w-x":[{"border-x":te()}],"border-w-y":[{"border-y":te()}],"border-w-s":[{"border-s":te()}],"border-w-e":[{"border-e":te()}],"border-w-t":[{"border-t":te()}],"border-w-r":[{"border-r":te()}],"border-w-b":[{"border-b":te()}],"border-w-l":[{"border-l":te()}],"divide-x":[{"divide-x":te()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":te()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...Q(),"hidden","none"]}],"divide-style":[{divide:[...Q(),"hidden","none"]}],"border-color":[{border:U()}],"border-color-x":[{"border-x":U()}],"border-color-y":[{"border-y":U()}],"border-color-s":[{"border-s":U()}],"border-color-e":[{"border-e":U()}],"border-color-t":[{"border-t":U()}],"border-color-r":[{"border-r":U()}],"border-color-b":[{"border-b":U()}],"border-color-l":[{"border-l":U()}],"divide-color":[{divide:U()}],"outline-style":[{outline:[...Q(),"none","hidden"]}],"outline-offset":[{"outline-offset":[mt,We,qe]}],"outline-w":[{outline:["",mt,jo,vi]}],"outline-color":[{outline:U()}],shadow:[{shadow:["","none",u,rc,tc]}],"shadow-color":[{shadow:U()}],"inset-shadow":[{"inset-shadow":["none",p,rc,tc]}],"inset-shadow-color":[{"inset-shadow":U()}],"ring-w":[{ring:te()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:U()}],"ring-offset-w":[{"ring-offset":[mt,vi]}],"ring-offset-color":[{"ring-offset":U()}],"inset-ring-w":[{"inset-ring":te()}],"inset-ring-color":[{"inset-ring":U()}],"text-shadow":[{"text-shadow":["none",f,rc,tc]}],"text-shadow-color":[{"text-shadow":U()}],opacity:[{opacity:[mt,We,qe]}],"mix-blend":[{"mix-blend":[...ge(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":ge()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[mt]}],"mask-image-linear-from-pos":[{"mask-linear-from":ae()}],"mask-image-linear-to-pos":[{"mask-linear-to":ae()}],"mask-image-linear-from-color":[{"mask-linear-from":U()}],"mask-image-linear-to-color":[{"mask-linear-to":U()}],"mask-image-t-from-pos":[{"mask-t-from":ae()}],"mask-image-t-to-pos":[{"mask-t-to":ae()}],"mask-image-t-from-color":[{"mask-t-from":U()}],"mask-image-t-to-color":[{"mask-t-to":U()}],"mask-image-r-from-pos":[{"mask-r-from":ae()}],"mask-image-r-to-pos":[{"mask-r-to":ae()}],"mask-image-r-from-color":[{"mask-r-from":U()}],"mask-image-r-to-color":[{"mask-r-to":U()}],"mask-image-b-from-pos":[{"mask-b-from":ae()}],"mask-image-b-to-pos":[{"mask-b-to":ae()}],"mask-image-b-from-color":[{"mask-b-from":U()}],"mask-image-b-to-color":[{"mask-b-to":U()}],"mask-image-l-from-pos":[{"mask-l-from":ae()}],"mask-image-l-to-pos":[{"mask-l-to":ae()}],"mask-image-l-from-color":[{"mask-l-from":U()}],"mask-image-l-to-color":[{"mask-l-to":U()}],"mask-image-x-from-pos":[{"mask-x-from":ae()}],"mask-image-x-to-pos":[{"mask-x-to":ae()}],"mask-image-x-from-color":[{"mask-x-from":U()}],"mask-image-x-to-color":[{"mask-x-to":U()}],"mask-image-y-from-pos":[{"mask-y-from":ae()}],"mask-image-y-to-pos":[{"mask-y-to":ae()}],"mask-image-y-from-color":[{"mask-y-from":U()}],"mask-image-y-to-color":[{"mask-y-to":U()}],"mask-image-radial":[{"mask-radial":[We,qe]}],"mask-image-radial-from-pos":[{"mask-radial-from":ae()}],"mask-image-radial-to-pos":[{"mask-radial-to":ae()}],"mask-image-radial-from-color":[{"mask-radial-from":U()}],"mask-image-radial-to-color":[{"mask-radial-to":U()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":k()}],"mask-image-conic-pos":[{"mask-conic":[mt]}],"mask-image-conic-from-pos":[{"mask-conic-from":ae()}],"mask-image-conic-to-pos":[{"mask-conic-to":ae()}],"mask-image-conic-from-color":[{"mask-conic-from":U()}],"mask-image-conic-to-color":[{"mask-conic-to":U()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:V()}],"mask-repeat":[{mask:O()}],"mask-size":[{mask:G()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",We,qe]}],filter:[{filter:["","none",We,qe]}],blur:[{blur:me()}],brightness:[{brightness:[mt,We,qe]}],contrast:[{contrast:[mt,We,qe]}],"drop-shadow":[{"drop-shadow":["","none",m,rc,tc]}],"drop-shadow-color":[{"drop-shadow":U()}],grayscale:[{grayscale:["",mt,We,qe]}],"hue-rotate":[{"hue-rotate":[mt,We,qe]}],invert:[{invert:["",mt,We,qe]}],saturate:[{saturate:[mt,We,qe]}],sepia:[{sepia:["",mt,We,qe]}],"backdrop-filter":[{"backdrop-filter":["","none",We,qe]}],"backdrop-blur":[{"backdrop-blur":me()}],"backdrop-brightness":[{"backdrop-brightness":[mt,We,qe]}],"backdrop-contrast":[{"backdrop-contrast":[mt,We,qe]}],"backdrop-grayscale":[{"backdrop-grayscale":["",mt,We,qe]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[mt,We,qe]}],"backdrop-invert":[{"backdrop-invert":["",mt,We,qe]}],"backdrop-opacity":[{"backdrop-opacity":[mt,We,qe]}],"backdrop-saturate":[{"backdrop-saturate":[mt,We,qe]}],"backdrop-sepia":[{"backdrop-sepia":["",mt,We,qe]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":_()}],"border-spacing-x":[{"border-spacing-x":_()}],"border-spacing-y":[{"border-spacing-y":_()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",We,qe]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[mt,"initial",We,qe]}],ease:[{ease:["linear","initial",y,We,qe]}],delay:[{delay:[mt,We,qe]}],animate:[{animate:["none",v,We,qe]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[b,We,qe]}],"perspective-origin":[{"perspective-origin":E()}],rotate:[{rotate:pe()}],"rotate-x":[{"rotate-x":pe()}],"rotate-y":[{"rotate-y":pe()}],"rotate-z":[{"rotate-z":pe()}],scale:[{scale:be()}],"scale-x":[{"scale-x":be()}],"scale-y":[{"scale-y":be()}],"scale-z":[{"scale-z":be()}],"scale-3d":["scale-3d"],skew:[{skew:Ne()}],"skew-x":[{"skew-x":Ne()}],"skew-y":[{"skew-y":Ne()}],transform:[{transform:[We,qe,"","none","gpu","cpu"]}],"transform-origin":[{origin:E()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:xe()}],"translate-x":[{"translate-x":xe()}],"translate-y":[{"translate-y":xe()}],"translate-z":[{"translate-z":xe()}],"translate-none":["translate-none"],accent:[{accent:U()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:U()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",We,qe]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":_()}],"scroll-mx":[{"scroll-mx":_()}],"scroll-my":[{"scroll-my":_()}],"scroll-ms":[{"scroll-ms":_()}],"scroll-me":[{"scroll-me":_()}],"scroll-mt":[{"scroll-mt":_()}],"scroll-mr":[{"scroll-mr":_()}],"scroll-mb":[{"scroll-mb":_()}],"scroll-ml":[{"scroll-ml":_()}],"scroll-p":[{"scroll-p":_()}],"scroll-px":[{"scroll-px":_()}],"scroll-py":[{"scroll-py":_()}],"scroll-ps":[{"scroll-ps":_()}],"scroll-pe":[{"scroll-pe":_()}],"scroll-pt":[{"scroll-pt":_()}],"scroll-pr":[{"scroll-pr":_()}],"scroll-pb":[{"scroll-pb":_()}],"scroll-pl":[{"scroll-pl":_()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",We,qe]}],fill:[{fill:["none",...U()]}],"stroke-w":[{stroke:[mt,jo,vi,Vu]}],stroke:[{stroke:["none",...U()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}},KO=TO(WO);function ue(...e){return KO(HE(e))}function YO(e){if(!e||typeof e!="string")return null;try{return JSON.parse(e)}catch{return null}}const ZO=Pf("relative grid w-full grid-cols-[0_1fr] items-start gap-y-0.5 rounded-lg border px-4 py-3 text-sm has-[>svg]:grid-cols-[calc(var(--spacing)*4)_1fr] has-[>svg]:gap-x-3 [&>svg]:size-4 [&>svg]:translate-y-0.5 [&>svg]:text-current",{variants:{variant:{default:"bg-card text-card-foreground",destructive:"bg-card text-destructive *:data-[slot=alert-description]:text-destructive/90 [&>svg]:text-current"}},defaultVariants:{variant:"default"}}),tN=h.forwardRef(({className:e,variant:t,...r},n)=>i.jsx("div",{ref:n,role:"alert","data-slot":"alert",className:ue(ZO({variant:t}),e),...r}));tN.displayName="Alert";const XO=h.forwardRef(({className:e,...t},r)=>i.jsx("div",{ref:r,"data-slot":"alert-title",className:ue("col-start-2 line-clamp-1 min-h-4 font-medium tracking-tight",e),...t}));XO.displayName="AlertTitle";const JO=h.forwardRef(({className:e,...t},r)=>i.jsx("div",{ref:r,"data-slot":"alert-description",className:ue("text-muted-foreground col-start-2 grid justify-items-start gap-1 text-sm [&_p]:leading-relaxed",e),...t}));JO.displayName="AlertDescription";const QO=Pf("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 er({className:e,variant:t,...r}){return i.jsx("div",{className:ue(QO({variant:t}),e),...r})}const eM=Pf("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"}}),_e=h.forwardRef(({className:e,variant:t,size:r,...n},a)=>i.jsx("button",{className:ue(eM({variant:t,size:r,className:e})),ref:a,...n}));_e.displayName="Button";const rN=h.createContext(null),nN=()=>{const e=h.useContext(rN);if(!e)throw new Error("Confirmation components must be used within Confirmation");return e},aN=({className:e,approval:t="pending",children:r,...n})=>{const a=h.useMemo(()=>({approval:t}),[t]);return i.jsx(rN.Provider,{value:a,children:i.jsx(tN,{className:ue("flex flex-col gap-2",e),...n,children:r})})};aN.displayName="Confirmation";const iN=({className:e,...t})=>i.jsx("div",{"data-slot":"confirmation-title",className:ue("text-muted-foreground inline text-sm",e),...t});iN.displayName="ConfirmationTitle";const sN=({children:e})=>{const{approval:t}=nN();return t!=="pending"?null:i.jsx(i.Fragment,{children:e})};sN.displayName="ConfirmationRequest";const oN=({className:e,...t})=>{const{approval:r}=nN();return r!=="pending"?null:i.jsx("div",{"data-slot":"confirmation-actions",className:ue("flex items-center justify-end gap-2 self-end",e),...t})};oN.displayName="ConfirmationActions";const Fc=({variant:e="default",...t})=>i.jsx(_e,{className:"h-8 px-3 text-sm",variant:e,type:"button",...t});Fc.displayName="ConfirmationAction";const lN=h.forwardRef(({className:e,...t},r)=>i.jsx("div",{ref:r,className:ue("rounded-xl border bg-card text-card-foreground shadow-sm",e),...t}));lN.displayName="Card";const cN=h.forwardRef(({className:e,...t},r)=>i.jsx("div",{ref:r,className:ue("flex flex-col space-y-1.5 p-4",e),...t}));cN.displayName="CardHeader";const dN=h.forwardRef(({className:e,...t},r)=>i.jsx("h3",{ref:r,className:ue("font-semibold leading-none tracking-tight",e),...t}));dN.displayName="CardTitle";const tM=h.forwardRef(({className:e,...t},r)=>i.jsx("p",{ref:r,className:ue("text-sm text-muted-foreground",e),...t}));tM.displayName="CardDescription";const uN=h.forwardRef(({className:e,...t},r)=>i.jsx("div",{ref:r,className:ue("p-4 pt-0",e),...t}));uN.displayName="CardContent";const pN=h.forwardRef(({className:e,...t},r)=>i.jsx("div",{ref:r,className:ue("flex items-center p-4 pt-0",e),...t}));pN.displayName="CardFooter";const rM=h.forwardRef(({className:e,...t},r)=>i.jsx("div",{ref:r,className:ue("ml-auto shrink-0",e),...t}));rM.displayName="CardAction";const mN=h.createContext(null);function hN(){const e=h.useContext(mN);if(!e)throw new Error("Collapsible components must be used within <Collapsible>");return e}const ii=h.forwardRef(({defaultOpen:e=!1,open:t,onOpenChange:r,className:n,children:a,...s},o)=>{const[l,c]=h.useState(e),d=t!==void 0,u=d?t:l,p=h.useCallback(m=>{d||c(m),r?.(m)},[d,r]),f=h.useMemo(()=>({open:u,onOpenChange:p}),[u,p]);return i.jsx(mN.Provider,{value:f,children:i.jsx("div",{ref:o,"data-state":u?"open":"closed",className:n,...s,children:a})})});ii.displayName="Collapsible";const Ca=h.forwardRef(({onClick:e,children:t,className:r,...n},a)=>{const{open:s,onOpenChange:o}=hN(),l=h.useCallback(c=>{o(!s),e?.(c)},[s,o,e]);return i.jsx("button",{ref:a,type:"button","aria-expanded":s,"data-state":s?"open":"closed",onClick:l,className:r,...n,children:t})});Ca.displayName="CollapsibleTrigger";const si=h.forwardRef(({className:e,children:t,...r},n)=>{const{open:a}=hN();return i.jsx("div",{ref:n,"data-state":a?"open":"closed",className:ue("grid transition-[grid-template-rows] duration-200 ease-out",a?"grid-rows-[1fr]":"grid-rows-[0fr]",e),...r,children:i.jsx("div",{className:"overflow-hidden",children:t})})});si.displayName="CollapsibleContent";const fN=h.createContext(null);function zf(){const e=h.useContext(fN);if(!e)throw new Error("Command components must be used within <Command>");return e}const gN=h.forwardRef(({className:e,children:t,...r},n)=>{const[a,s]=h.useState(""),o=h.useRef(new Map),[l,c]=h.useState(0),d=h.useCallback(v=>{o.current.set(v.id,v),c(w=>w+1)},[]),u=h.useCallback(v=>{o.current.delete(v),c(w=>w+1)},[]),p=h.useCallback((v,w)=>{const k=o.current.get(v);k&&Object.assign(k,w)},[]),f=h.useMemo(()=>{const v=a.toLowerCase(),w=new Set;for(const[k,E]of o.current)(!v||E.value.includes(v))&&w.add(k);return w},[a,l]),m=h.useMemo(()=>{const v=[];for(const[,w]of o.current)f.has(w.id)&&v.push(w);return v},[f]),[g,b]=h.useState(null);h.useEffect(()=>{b(m.length>0?m[0].id:null)},[m]);const x=h.useCallback(v=>{if(v.key==="ArrowDown"||v.key==="ArrowUp"||v.key==="Enter")v.preventDefault();else return;const w=m;if(w.length===0)return;if(v.key==="Enter"){w.find(T=>T.id===g)?.onSelect();return}const k=w.findIndex(_=>_.id===g);let E;v.key==="ArrowDown"?E=k<w.length-1?k+1:0:E=k>0?k-1:w.length-1;const S=w[E].id;b(S),w[E].element?.scrollIntoView({block:"nearest"})},[m,g]),y=h.useMemo(()=>({search:a,setSearch:s,visibleIds:f,activeId:g,setActiveId:b,register:d,unregister:u,updateEntry:p}),[a,f,g,d,u,p]);return i.jsx(fN.Provider,{value:y,children:i.jsx("div",{ref:n,role:"combobox","aria-expanded":"true","aria-haspopup":"listbox",className:ue("flex flex-col",e),onKeyDown:x,...r,children:t})})});gN.displayName="Command";const bN=h.forwardRef(({className:e,placeholder:t="Search...",...r},n)=>{const{search:a,setSearch:s}=zf();return i.jsxs("div",{className:"flex items-center border-b px-3",role:"presentation",children:[i.jsx(Ea,{className:"mr-2 h-4 w-4 shrink-0 text-muted-foreground","aria-hidden":!0}),i.jsx("input",{ref:n,type:"text",role:"searchbox","aria-autocomplete":"list",autoComplete:"off",autoCorrect:"off",spellCheck:!1,value:a,onChange:o=>s(o.target.value),placeholder:t,className:ue("flex h-11 w-full rounded-md bg-transparent py-3 text-sm outline-none","placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50",e),...r})]})});bN.displayName="CommandInput";const xN=h.forwardRef(({className:e,...t},r)=>i.jsx("div",{ref:r,role:"listbox",className:ue("max-h-[300px] overflow-y-auto overflow-x-hidden",e),...t}));xN.displayName="CommandList";const yN=h.forwardRef(({className:e,...t},r)=>{const{search:n,visibleIds:a}=zf();return!n||a.size>0?null:i.jsx("div",{ref:r,className:ue("py-6 text-center text-sm text-muted-foreground",e),...t})});yN.displayName="CommandEmpty";const vN=h.forwardRef(({className:e,heading:t,children:r,...n},a)=>i.jsxs("div",{ref:a,className:ue("overflow-hidden p-1",e),role:"group","aria-label":typeof t=="string"?t:void 0,...n,children:[t&&i.jsx("div",{className:"px-2 py-1.5 text-xs font-medium text-muted-foreground",role:"presentation",children:t}),r]}));vN.displayName="CommandGroup";const wN=h.forwardRef(({className:e,value:t,onSelect:r,disabled:n,children:a,...s},o)=>{const{visibleIds:l,activeId:c,setActiveId:d,register:u,unregister:p,updateEntry:f}=zf(),m=h.useId(),g=h.useRef(null),b=t||(typeof a=="string"?a:"");h.useEffect(()=>(u({id:m,value:b.toLowerCase(),onSelect:r||(()=>{}),element:g.current}),()=>p(m)),[m,b,u,p]),h.useEffect(()=>{f(m,{onSelect:r||(()=>{})})},[m,r,f]);const x=h.useCallback(v=>{g.current=v,f(m,{element:v}),typeof o=="function"?o(v):o&&(o.current=v)},[m,f,o]);if(!l.has(m))return null;const y=c===m;return i.jsx("div",{ref:x,role:"option","aria-selected":y,"aria-disabled":n||void 0,"data-active":y||void 0,className:ue("relative flex cursor-pointer select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none",y&&"bg-accent text-accent-foreground",n&&"pointer-events-none opacity-50",e),onPointerMove:()=>{!n&&c!==m&&d(m)},onClick:()=>!n&&r?.(),...s,children:a})});wN.displayName="CommandItem";const nM=h.forwardRef(({className:e,...t},r)=>i.jsx("div",{ref:r,className:ue("-mx-1 h-px bg-border",e),...t}));nM.displayName="CommandSeparator";function rh({checked:e,onToggle:t,ariaLabel:r="Toggle dark mode"}){const{isDarkMode:n,toggleDarkMode:a}=Oa(),s=typeof e=="boolean"&&typeof t=="function",o=s?e:n,l=()=>{if(s&&t){t(!o);return}a()};return i.jsxs("button",{onClick:l,className:ue("relative inline-flex h-7 w-12 flex-shrink-0 touch-manipulation cursor-pointer items-center rounded-full border-2 transition-colors duration-200","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background",o?"border-primary bg-primary":"border-border bg-muted"),role:"switch","aria-checked":o,"aria-label":r,children:[i.jsx("span",{className:"sr-only",children:r}),i.jsx("span",{className:ue("flex h-5 w-5 transform items-center justify-center rounded-full shadow-sm transition-transform duration-200",o?"translate-x-[22px] bg-white":"translate-x-[2px] bg-foreground/60 dark:bg-foreground/80"),children:o?i.jsx(Tf,{className:"h-3 w-3 text-primary"}):i.jsx(_f,{className:"h-3 w-3 text-white dark:text-background"})})]})}const kN=h.createContext(null);function SN(){const e=h.useContext(kN);if(!e)throw new Error("Dialog components must be used within <Dialog>");return e}const EN=({open:e,onOpenChange:t,defaultOpen:r=!1,children:n})=>{const[a,s]=h.useState(r),o=h.useRef(null),l=e!==void 0,c=l?e:a,d=h.useCallback(p=>{l||s(p),t?.(p)},[l,t]),u=h.useMemo(()=>({open:c,onOpenChange:d,triggerRef:o}),[c,d]);return i.jsx(kN.Provider,{value:u,children:n})},aM=h.forwardRef(({onClick:e,children:t,asChild:r,...n},a)=>{const{onOpenChange:s,triggerRef:o}=SN(),l=h.useCallback(c=>{s(!0),e?.(c)},[s,e]);if(r&&h.isValidElement(t)){const c=t;return h.cloneElement(c,{onClick:d=>{s(!0),c.props.onClick?.(d)},ref:d=>{o.current=d,typeof a=="function"?a(d):a&&(a.current=d)}})}return i.jsx("button",{ref:c=>{o.current=c,typeof a=="function"?a(c):a&&(a.current=c)},type:"button",onClick:l,...n,children:t})});aM.displayName="DialogTrigger";const hw='a[href], button:not([disabled]), input:not([disabled]), textarea:not([disabled]), select:not([disabled]), [tabindex]:not([tabindex="-1"])',Bf=h.forwardRef(({className:e,children:t,onEscapeKeyDown:r,onPointerDownOutside:n,...a},s)=>{const{open:o,onOpenChange:l,triggerRef:c}=SN(),d=h.useRef(null),u=h.useRef(null);return h.useEffect(()=>{o?u.current=document.activeElement:u.current&&((c.current||u.current)?.focus(),u.current=null)},[o,c]),h.useEffect(()=>{if(!o)return;const p=m=>{if(m.key==="Escape"){m.stopPropagation(),r?.(),l(!1);return}if(m.key==="Tab"&&d.current){const g=Array.from(d.current.querySelectorAll(hw));if(g.length===0)return;const b=g[0],x=g[g.length-1];m.shiftKey&&document.activeElement===b?(m.preventDefault(),x.focus()):!m.shiftKey&&document.activeElement===x&&(m.preventDefault(),b.focus())}};document.addEventListener("keydown",p,!0);const f=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.removeEventListener("keydown",p,!0),document.body.style.overflow=f}},[o,l,r]),h.useEffect(()=>{o&&d.current&&requestAnimationFrame(()=>{d.current?.querySelector(hw)?.focus()})},[o]),o?Bd.createPortal(i.jsxs("div",{className:"fixed inset-0 z-50",children:[i.jsx("div",{className:"fixed inset-0 animate-dialog-overlay-show bg-black/50 backdrop-blur-sm",onClick:()=>{n?.(),l(!1)},"aria-hidden":!0}),i.jsx("div",{ref:p=>{d.current=p,typeof s=="function"?s(p):s&&(s.current=p)},role:"dialog","aria-modal":"true",className:ue("fixed left-1/2 top-1/2 z-50 w-full max-w-lg -translate-x-1/2 -translate-y-1/2","rounded-xl border bg-popover text-popover-foreground shadow-lg","animate-dialog-content-show",e),...a,children:t})]}),document.body):null});Bf.displayName="DialogContent";const $f=h.forwardRef(({className:e,...t},r)=>i.jsx("h2",{ref:r,className:ue("sr-only",e),...t}));$f.displayName="DialogTitle";const Nt=h.forwardRef(({className:e,type:t,...r},n)=>i.jsx("input",{type:t,className:ue("flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-sm shadow-sm transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50",e),ref:n,...r}));Nt.displayName="Input";const Uf=h.forwardRef(({className:e,contentClassName:t,children:r,...n},a)=>i.jsx("div",{className:ue("relative overflow-hidden",e),...n,children:i.jsx("div",{ref:a,className:ue("h-full w-full overflow-auto rounded-[inherit]",t),style:{WebkitOverflowScrolling:"touch",touchAction:"pan-y"},children:r})}));Uf.displayName="ScrollArea";const od=h.memo(({children:e,className:t,as:r="span"})=>i.jsx(r,{className:ue("animate-shimmer inline-block bg-[length:250%_100%] bg-clip-text text-transparent","bg-[linear-gradient(90deg,transparent_33%,hsl(var(--foreground))_50%,transparent_67%),linear-gradient(hsl(var(--muted-foreground)),hsl(var(--muted-foreground)))]",t),children:e}));od.displayName="Shimmer";const NN=h.createContext(null),iM=()=>{const e=h.useContext(NN);if(!e)throw new Error("Reasoning components must be used within Reasoning");return e},sM=1e3,oM=1e3,nh=h.memo(({className:e,isStreaming:t=!1,open:r,defaultOpen:n,onOpenChange:a,duration:s,children:o,...l})=>{const c=n??t,d=n===!1,[u,p]=h.useState(c),f=r!==void 0,m=f?r:u,g=h.useCallback(S=>{f||p(S),a?.(S)},[f,a]),[b,x]=h.useState(s),y=h.useRef(t),[v,w]=h.useState(!1),k=h.useRef(null);h.useEffect(()=>{s!==void 0&&x(s)},[s]),h.useEffect(()=>{t?(y.current=!0,k.current===null&&(k.current=Date.now())):k.current!==null&&(x(Math.ceil((Date.now()-k.current)/oM)),k.current=null)},[t]),h.useEffect(()=>{t&&!m&&!d&&g(!0)},[t,m,g,d]),h.useEffect(()=>{if(y.current&&!t&&m&&!v){const S=setTimeout(()=>{g(!1),w(!0)},sM);return()=>clearTimeout(S)}},[t,m,g,v]);const E=h.useMemo(()=>({duration:b,isOpen:m,isStreaming:t,setIsOpen:g}),[b,m,t,g]);return i.jsx(NN.Provider,{value:E,children:i.jsx(ii,{open:m,onOpenChange:g,className:ue("not-prose",e),...l,children:o})})});nh.displayName="Reasoning";const lM=(e,t)=>e||t===0?i.jsx(od,{children:"Thinking..."}):t===void 0?i.jsx("p",{children:"Thought for a few seconds"}):i.jsxs("p",{children:["Thought for ",t," seconds"]}),ah=h.memo(({className:e,children:t,getThinkingMessage:r=lM,...n})=>{const{isStreaming:a,isOpen:s,duration:o}=iM();return i.jsx(Ca,{className:ue("flex w-full items-center gap-2 text-sm text-muted-foreground transition-colors hover:text-foreground",e),...n,children:t??i.jsxs(i.Fragment,{children:[i.jsx(GD,{className:"h-4 w-4"}),r(a,o),i.jsx(iE,{className:ue("h-4 w-4 transition-transform",s?"rotate-180":"rotate-0")})]})})});ah.displayName="ReasoningTrigger";const ih=h.memo(({className:e,children:t,...r})=>i.jsx(si,{className:ue("mt-4 text-sm text-muted-foreground",e),...r,children:t}));ih.displayName="ReasoningContent";function cM(e){switch(e){case"top":return"top-full left-1/2 transform -translate-x-1/2 border-t-gray-900 dark:border-t-gray-100";case"bottom":return"bottom-full left-1/2 transform -translate-x-1/2 border-b-gray-900 dark:border-b-gray-100";case"left":return"left-full top-1/2 transform -translate-y-1/2 border-l-gray-900 dark:border-l-gray-100";case"right":return"right-full top-1/2 transform -translate-y-1/2 border-r-gray-900 dark:border-r-gray-100";default:return"top-full left-1/2 transform -translate-x-1/2 border-t-gray-900 dark:border-t-gray-100"}}function Yn({children:e,content:t,position:r="top",className:n="",delay:a=350}){const[s,o]=h.useState(!1),l=h.useRef(null),c=h.useRef(!1),d=h.useRef(null),u=h.useRef(null),[p,f]=h.useState(null),m=h.useCallback(()=>{const w=d.current;if(!w)return;const k=w.getBoundingClientRect(),E=8,S={position:"fixed",zIndex:9999};switch(r){case"bottom":S.left=k.left+k.width/2,S.top=k.bottom+E,S.transform="translateX(-50%)";break;case"left":S.left=k.left-E,S.top=k.top+k.height/2,S.transform="translate(-100%, -50%)";break;case"right":S.left=k.right+E,S.top=k.top+k.height/2,S.transform="translateY(-50%)";break;case"top":default:S.left=k.left+k.width/2,S.top=k.top-E,S.transform="translate(-50%, -100%)";break}f(S)},[r]),g=()=>{l.current!==null&&(window.clearTimeout(l.current),l.current=null)},b=()=>{g(),l.current=window.setTimeout(()=>{o(!0)},a)},x=()=>{g(),o(!1)},y=()=>{g(),c.current=!1,l.current=window.setTimeout(()=>{c.current=!0,o(!0)},a)},v=()=>{g(),!c.current&&o(!1)};return h.useEffect(()=>()=>{g()},[]),h.useEffect(()=>{if(!s||typeof document>"u")return;const w=k=>{const E=k.target;E instanceof Node&&d.current?.contains(E)||(o(!1),c.current=!1)};return document.addEventListener("pointerdown",w,!0),()=>document.removeEventListener("pointerdown",w,!0)},[s]),h.useEffect(()=>{if(!s){f(null);return}const w=window.requestAnimationFrame(m),k=()=>m();return window.addEventListener("resize",k),window.addEventListener("scroll",k,!0),()=>{window.cancelAnimationFrame(w),window.removeEventListener("resize",k),window.removeEventListener("scroll",k,!0)}},[s,m]),t?i.jsxs("div",{ref:d,className:"relative inline-block",onMouseEnter:b,onMouseLeave:x,onTouchStart:y,onTouchEnd:v,onTouchCancel:v,children:[e,s&&typeof document<"u"&&Bd.createPortal(i.jsxs("div",{ref:u,style:p||{position:"fixed",top:"-9999px",left:"-9999px",opacity:0},className:ue("px-2 py-1 text-xs font-medium text-white bg-gray-900 dark:bg-gray-100 dark:text-gray-900 rounded shadow-lg whitespace-nowrap pointer-events-none","animate-in fade-in-0 zoom-in-95 duration-200",n),children:[t,i.jsx("div",{className:ue("absolute w-0 h-0 border-4 border-transparent",cM(r))})]}),document.body)]}):i.jsx(i.Fragment,{children:e})}const CN=h.createContext(null),AN=h.forwardRef(({className:e,status:t="ready",children:r,...n},a)=>{const s=h.useMemo(()=>({status:t}),[t]);return i.jsx(CN.Provider,{value:s,children:i.jsx("form",{ref:a,"data-slot":"prompt-input",className:ue("relative overflow-hidden rounded-xl border border-border/70 bg-zinc-50/95 shadow-sm shadow-zinc-950/5 backdrop-blur-sm transition-all duration-200 focus-within:border-primary/40 focus-within:shadow-md focus-within:ring-1 focus-within:ring-primary/20 dark:bg-zinc-950/90",e),...n,children:r})})});AN.displayName="PromptInput";const TN=h.forwardRef(({className:e,...t},r)=>i.jsx("div",{ref:r,"data-slot":"prompt-input-header",className:ue("px-3 pt-3",e),...t}));TN.displayName="PromptInputHeader";const jN=h.forwardRef(({className:e,...t},r)=>i.jsx("div",{ref:r,"data-slot":"prompt-input-body",className:ue("relative",e),...t}));jN.displayName="PromptInputBody";const _N=h.forwardRef(({className:e,...t},r)=>i.jsx("textarea",{ref:r,"data-slot":"prompt-input-textarea",className:ue("chat-input-placeholder block max-h-[40vh] w-full resize-none overflow-y-auto bg-transparent px-4 py-2 font-mono text-sm leading-6 text-foreground placeholder-muted-foreground/50 focus:outline-none sm:max-h-[300px]",e),...t}));_N.displayName="PromptInputTextarea";const IN=h.forwardRef(({className:e,...t},r)=>i.jsx("div",{ref:r,"data-slot":"prompt-input-footer",className:ue("flex items-center justify-between border-t border-border/30 px-3 py-2",e),...t}));IN.displayName="PromptInputFooter";const RN=h.forwardRef(({className:e,...t},r)=>i.jsx("div",{ref:r,"data-slot":"prompt-input-tools",className:ue("flex items-center gap-1",e),...t}));RN.displayName="PromptInputTools";const zc=h.forwardRef(({className:e,tooltip:t,children:r,...n},a)=>{const s=i.jsx(_e,{ref:a,type:"button",variant:"ghost",size:"icon",className:ue("h-8 w-8 [&_svg]:size-4",e),...n,children:r});return t?i.jsx(Yn,{content:t.shortcut?i.jsxs("span",{className:"flex items-center gap-1.5",children:[t.content,i.jsx("kbd",{className:"rounded bg-white/20 px-1 text-[10px]",children:t.shortcut})]}):t.content,position:t.side??"top",children:s}):s});zc.displayName="PromptInputButton";const LN=h.forwardRef(({className:e,status:t,children:r,...n},a)=>{const s=h.useContext(CN),o=t??s?.status??"ready",l=o==="submitted"||o==="streaming";return i.jsx(_e,{ref:a,type:l?"button":"submit",variant:"default",size:"icon",className:ue("h-8 w-8 rounded-lg",e),...n,children:r??(l?i.jsx(qd,{className:"h-3.5 w-3.5 fill-current"}):i.jsx(yD,{className:"h-4 w-4"}))})});LN.displayName="PromptInputSubmit";function Gf({children:e,className:t}){return i.jsx("div",{className:ue("inline-flex items-center gap-[2px] rounded-lg bg-muted/60 p-[3px]",t),children:e})}function Hf({isActive:e,onClick:t,children:r,className:n}){return i.jsx("button",{onClick:t,className:ue("flex touch-manipulation items-center gap-1.5 rounded-md px-3 py-2 text-sm font-medium transition-all duration-150",e?"bg-background text-foreground shadow-sm":"text-muted-foreground active:bg-background/50",n),children:r})}const DN=h.createContext(null);function ON(){const e=h.useContext(DN);if(!e)throw new Error("QueueItem sub-components must be used within <QueueItem>");return e}const MN=h.forwardRef(({className:e,...t},r)=>i.jsx("div",{ref:r,"data-slot":"queue",role:"list",className:ue("space-y-0.5",e),...t}));MN.displayName="Queue";const PN=h.forwardRef(({status:e="pending",className:t,children:r,...n},a)=>{const s=h.useMemo(()=>({status:e}),[e]);return i.jsx(DN.Provider,{value:s,children:i.jsx("div",{ref:a,"data-slot":"queue-item","data-status":e,role:"listitem",className:ue("flex items-start gap-2 py-0.5",t),...n,children:r})})});PN.displayName="QueueItem";const FN=h.forwardRef(({className:e,...t},r)=>{const{status:n}=ON();return i.jsxs("div",{ref:r,"data-slot":"queue-item-indicator","aria-hidden":"true",className:ue("mt-0.5 flex h-3.5 w-3.5 flex-shrink-0 items-center justify-center",e),...t,children:[n==="completed"&&i.jsx("svg",{className:"h-3.5 w-3.5 text-green-500 dark:text-green-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z"})}),n==="in_progress"&&i.jsx("span",{className:"h-2 w-2 animate-pulse rounded-full bg-blue-500 dark:bg-blue-400"}),n==="pending"&&i.jsx("svg",{className:"h-3.5 w-3.5 text-muted-foreground/50",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:i.jsx("circle",{cx:"12",cy:"12",r:"9",strokeWidth:2})})]})});FN.displayName="QueueItemIndicator";const zN=h.forwardRef(({className:e,children:t,...r},n)=>{const{status:a}=ON();return i.jsx("div",{ref:n,"data-slot":"queue-item-content",className:ue("min-w-0 flex-1 text-xs",a==="completed"&&"text-muted-foreground line-through",a==="in_progress"&&"font-medium text-foreground",a==="pending"&&"text-foreground",e),...r,children:t})});zN.displayName="QueueItemContent";const fw="https://github.com/alicomert/pixcode/issues/new",dM="https://github.com/alicomert/pixcode",gw="https://discord.gg/buxwujPNRE";function bw({className:e}){return i.jsx("svg",{className:e,fill:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:i.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 uM({updateAvailable:e,releaseInfo:t,latestVersion:r,currentVersion:n,onShowVersionModal:a,onShowSettings:s,t:o}){return i.jsxs("div",{className:"flex-shrink-0",style:{paddingBottom:"env(safe-area-inset-bottom, 0)"},children:[e&&i.jsxs(i.Fragment,{children:[i.jsx("div",{className:"nav-divider"}),i.jsx("div",{className:"hidden px-2 py-1.5 md:block",children:i.jsxs("button",{className:"group flex w-full items-center gap-2.5 rounded-lg px-2.5 py-2 text-left transition-colors hover:bg-blue-50/80 dark:hover:bg-blue-900/15",onClick:a,children:[i.jsxs("div",{className:"relative flex-shrink-0",children:[i.jsx(Vv,{className:"h-4 w-4 text-blue-500 dark:text-blue-400"}),i.jsx("span",{className:"absolute -right-0.5 -top-0.5 h-1.5 w-1.5 animate-pulse rounded-full bg-blue-500"})]}),i.jsxs("div",{className:"min-w-0 flex-1",children:[i.jsx("span",{className:"block truncate text-sm font-medium text-blue-600 dark:text-blue-300",children:t?.title||`v${r}`}),i.jsx("span",{className:"text-[10px] text-blue-500/70 dark:text-blue-400/60",children:o("version.updateAvailable")})]})]})}),i.jsx("div",{className:"px-3 py-2 md:hidden",children:i.jsxs("button",{className:"flex h-11 w-full items-center gap-3 rounded-xl border border-blue-200/60 bg-blue-50/80 px-3.5 transition-all active:scale-[0.98] dark:border-blue-700/40 dark:bg-blue-900/15",onClick:a,children:[i.jsxs("div",{className:"relative flex-shrink-0",children:[i.jsx(Vv,{className:"w-4.5 h-4.5 text-blue-500 dark:text-blue-400"}),i.jsx("span",{className:"absolute -right-0.5 -top-0.5 h-1.5 w-1.5 animate-pulse rounded-full bg-blue-500"})]}),i.jsxs("div",{className:"min-w-0 flex-1 text-left",children:[i.jsx("span",{className:"block truncate text-sm font-medium text-blue-600 dark:text-blue-300",children:t?.title||`v${r}`}),i.jsx("span",{className:"text-xs text-blue-500/70 dark:text-blue-400/60",children:o("version.updateAvailable")})]})]})})]}),i.jsx("div",{className:"nav-divider"}),i.jsx("div",{className:"hidden px-2 pt-1.5 md:block",children:i.jsxs("a",{href:fw,target:"_blank",rel:"noopener noreferrer",className:"flex w-full items-center gap-2 rounded-lg px-2.5 py-1.5 text-muted-foreground transition-colors hover:bg-accent/60 hover:text-foreground",children:[i.jsx(ml,{className:"h-3.5 w-3.5"}),i.jsx("span",{className:"text-sm",children:o("actions.reportIssue")})]})}),i.jsx("div",{className:"hidden px-2 md:block",children:i.jsxs("a",{href:gw,target:"_blank",rel:"noopener noreferrer",className:"flex w-full items-center gap-2 rounded-lg px-2.5 py-1.5 text-muted-foreground transition-colors hover:bg-accent/60 hover:text-foreground",children:[i.jsx(bw,{className:"h-3.5 w-3.5"}),i.jsx("span",{className:"text-sm",children:o("actions.joinCommunity")})]})}),i.jsx("div",{className:"hidden px-2 py-1.5 md:block",children:i.jsxs("button",{className:"flex w-full items-center gap-2 rounded-lg px-2.5 py-1.5 text-muted-foreground transition-colors hover:bg-accent/60 hover:text-foreground",onClick:s,children:[i.jsx(Lt,{className:"h-3.5 w-3.5"}),i.jsx("span",{className:"text-sm",children:o("actions.settings")})]})}),i.jsx("div",{className:"hidden px-3 py-2 text-center md:block",children:i.jsxs("a",{href:dM,target:"_blank",rel:"noopener noreferrer",className:"text-[10px] text-muted-foreground/40 transition-colors hover:text-muted-foreground",children:["Pixcode v",n," – ",o("branding.openSource")]})}),i.jsx("div",{className:"px-3 pt-3 md:hidden",children:i.jsxs("a",{href:fw,target:"_blank",rel:"noopener noreferrer",className:"flex h-12 w-full items-center gap-3.5 rounded-xl bg-muted/40 px-4 transition-all hover:bg-muted/60 active:scale-[0.98]",children:[i.jsx("div",{className:"flex h-8 w-8 items-center justify-center rounded-xl bg-background/80",children:i.jsx(ml,{className:"w-4.5 h-4.5 text-muted-foreground"})}),i.jsx("span",{className:"text-base font-medium text-foreground",children:o("actions.reportIssue")})]})}),i.jsx("div",{className:"px-3 pt-2 md:hidden",children:i.jsxs("a",{href:gw,target:"_blank",rel:"noopener noreferrer",className:"flex h-12 w-full items-center gap-3.5 rounded-xl bg-muted/40 px-4 transition-all hover:bg-muted/60 active:scale-[0.98]",children:[i.jsx("div",{className:"flex h-8 w-8 items-center justify-center rounded-xl bg-background/80",children:i.jsx(bw,{className:"w-4.5 h-4.5 text-muted-foreground"})}),i.jsx("span",{className:"text-base font-medium text-foreground",children:o("actions.joinCommunity")})]})}),i.jsx("div",{className:"px-3 pb-3 pt-2 md:hidden",children:i.jsxs("button",{className:"flex h-12 w-full items-center gap-3.5 rounded-xl bg-muted/40 px-4 transition-all hover:bg-muted/60 active:scale-[0.98]",onClick:s,children:[i.jsx("div",{className:"flex h-8 w-8 items-center justify-center rounded-xl bg-background/80",children:i.jsx(Lt,{className:"w-4.5 h-4.5 text-muted-foreground"})}),i.jsx("span",{className:"text-base font-medium text-foreground",children:o("actions.settings")})]})})]})}const xw="PIXCODE_GITHUB_STARS",yw="PIXCODE_HIDE_GITHUB_STAR",pM=3600*1e3,mM=(e,t)=>{const[r,n]=h.useState(null),[a,s]=h.useState(()=>{try{return localStorage.getItem(yw)==="true"}catch{return!1}});h.useEffect(()=>{if(a)return;try{const d=localStorage.getItem(xw);if(d){const u=JSON.parse(d);if(Date.now()-u.timestamp<pM){n(u.count);return}}}catch{}(async()=>{try{const d=await fetch(`https://api.github.com/repos/${e}/${t}`);if(!d.ok)return;const p=(await d.json()).stargazers_count;if(typeof p=="number"){n(p);try{localStorage.setItem(xw,JSON.stringify({count:p,timestamp:Date.now()}))}catch{}}}catch{}})()},[e,t,a]);const o=h.useCallback(()=>{s(!0);try{localStorage.setItem(yw,"true")}catch{}},[]),l=r!==null?r>=1e3?`${(r/1e3).toFixed(1)}k`:`${r}`:null;return{starCount:r,formattedCount:l,isDismissed:a,dismiss:o}},hM="https://github.com/alicomert/pixcode";function fM({className:e}){return i.jsx("svg",{className:e,fill:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:i.jsx("path",{d:"M12 2C6.477 2 2 6.484 2 12.017c0 4.425 2.865 8.18 6.839 9.504.5.092.682-.217.682-.483 0-.237-.008-.868-.013-1.703-2.782.605-3.369-1.343-3.369-1.343-.454-1.158-1.11-1.466-1.11-1.466-.908-.62.069-.608.069-.608 1.003.07 1.531 1.032 1.531 1.032.892 1.53 2.341 1.088 2.91.832.092-.647.35-1.088.636-1.338-2.22-.253-4.555-1.113-4.555-4.951 0-1.093.39-1.988 1.029-2.688-.103-.253-.446-1.272.098-2.65 0 0 .84-.27 2.75 1.026A9.564 9.564 0 0112 6.844c.85.004 1.705.115 2.504.337 1.909-1.296 2.747-1.027 2.747-1.027.546 1.379.202 2.398.1 2.651.64.7 1.028 1.595 1.028 2.688 0 3.848-2.339 4.695-4.566 4.943.359.309.678.92.678 1.855 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.019 10.019 0 0022 12.017C22 6.484 17.522 2 12 2z"})})}function gM(){const{formattedCount:e,isDismissed:t,dismiss:r}=mM("alicomert","pixcode");return t?null:i.jsxs("div",{className:"group/star relative hidden md:block",children:[i.jsxs("a",{href:hM,target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-1.5 rounded-lg border border-border/50 bg-muted/30 px-2.5 py-1 text-xs text-muted-foreground transition-colors hover:bg-muted/50 hover:text-foreground",children:[i.jsx(fM,{className:"h-3.5 w-3.5"}),i.jsx(Is,{className:"h-3 w-3"}),i.jsx("span",{className:"font-medium",children:"Star"}),e&&i.jsx("span",{className:"border-l border-border/50 pl-1.5 tabular-nums",children:e})]}),i.jsx("button",{onClick:n=>{n.preventDefault(),n.stopPropagation(),r()},className:"absolute -right-1.5 -top-1.5 hidden h-4 w-4 items-center justify-center rounded-full border border-border/50 bg-muted text-muted-foreground transition-colors hover:text-foreground group-hover/star:flex","aria-label":"Dismiss",children:i.jsx(xt,{className:"h-2.5 w-2.5"})})]})}function vw({value:e,onChange:t,t:r}){const n="flex flex-1 items-center justify-center gap-1 rounded-md px-2 py-1 text-[11px] font-medium transition-all";return i.jsxs("div",{role:"tablist","aria-label":r("tooltips.historyView",{defaultValue:"History view"}),className:"flex rounded-lg bg-muted/40 p-0.5",children:[i.jsxs("button",{type:"button",role:"tab","aria-selected":e==="flat",onClick:()=>t("flat"),className:ue(n,e==="flat"?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),title:r("tooltips.historyViewFlat",{defaultValue:"Recent conversations"}),children:[i.jsx(pl,{className:"h-3 w-3"}),r("historyView.flat",{defaultValue:"Recent"})]}),i.jsxs("button",{type:"button",role:"tab","aria-selected":e==="grouped",onClick:()=>t("grouped"),className:ue(n,e==="grouped"?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),title:r("tooltips.historyViewGrouped",{defaultValue:"Grouped by project"}),children:[i.jsx(ED,{className:"h-3 w-3"}),r("historyView.grouped",{defaultValue:"By project"})]})]})}function bM({isPWA:e,isMobile:t,isLoading:r,projectsCount:n,searchFilter:a,onSearchFilterChange:s,onClearSearchFilter:o,searchMode:l,onSearchModeChange:c,onRefresh:d,isRefreshing:u,onCreateProject:p,onQuickStartSession:f,onCollapseSidebar:m,historyView:g,onHistoryViewChange:b,t:x}){const y=()=>i.jsxs("div",{className:"flex min-w-0 items-center gap-2.5",children:[i.jsx("svg",{className:"h-6 w-6 flex-shrink-0",viewBox:"0 0 500 500","aria-hidden":"true",children:i.jsx("g",{transform:"translate(250 250) scale(1.25) translate(-250 -250)",children:i.jsxs("g",{transform:"translate(0 500) scale(0.1 -0.1)",fill:"#5C3FFC",children:[i.jsx("path",{d:"M2037 3800 c-104 -40 -191 -134 -231 -250 -23 -67 -20 -82 22 -109 31 -20 287 -177 1009 -618 40 -24 82 -56 93 -70 27 -34 27 -102 0 -136 -11 -13 -106 -78 -212 -143 -106 -64 -201 -124 -210 -132 -16 -14 -18 -41 -18 -302 0 -291 2 -310 38 -310 16 0 267 148 610 359 180 111 270 173 310 213 216 217 215 574 -3 793 -37 38 -107 89 -185 136 -69 42 -253 154 -410 249 -434 264 -509 307 -563 326 -57 20 -191 17 -250 -6z"}),i.jsx("path",{d:"M1803 2994 c-10 -5 -13 -156 -13 -709 0 -671 1 -706 20 -767 27 -89 93 -184 167 -240 89 -67 157 -90 281 -96 92 -4 105 -2 117 14 12 16 14 134 15 735 0 669 -1 718 -17 737 -20 23 -514 322 -541 327 -9 2 -23 2 -29 -1z"})]})})}),i.jsx("h1",{className:"truncate text-sm font-semibold tracking-tight text-foreground",children:x("app.title")})]});return i.jsxs("div",{className:"flex-shrink-0",children:[i.jsxs("div",{className:"hidden px-4 pb-3 pt-4 md:block",style:{},children:[i.jsxs("div",{className:"flex items-center justify-between gap-2",children:[i.jsx(y,{}),i.jsxs("div",{className:"flex flex-shrink-0 items-center gap-0.5",children:[i.jsx(_e,{variant:"ghost",size:"sm",className:"h-8 w-8 rounded-lg p-0 text-muted-foreground hover:bg-accent/80 hover:text-foreground",onClick:d,disabled:u,title:x("tooltips.refresh"),children:i.jsx(ht,{className:`h-4 w-4 ${u?"animate-spin":""}`})}),i.jsx(_e,{variant:"ghost",size:"sm",className:"h-8 w-8 rounded-lg p-0 text-muted-foreground hover:bg-accent/80 hover:text-foreground",onClick:p,title:x("tooltips.createProject"),children:i.jsx(Ut,{className:"h-4 w-4"})}),i.jsx(_e,{variant:"ghost",size:"sm",className:"h-8 w-8 rounded-lg p-0 text-muted-foreground hover:bg-accent/80 hover:text-foreground",onClick:m,title:x("tooltips.hideSidebar"),children:i.jsx(bD,{className:"h-4 w-4"})})]})]}),i.jsx(gM,{}),f&&i.jsxs("button",{type:"button",onClick:()=>{f()},className:"mt-2.5 flex w-full items-center justify-center gap-2 rounded-lg border border-primary/20 bg-primary/5 px-3 py-2 text-sm font-medium text-primary transition-colors hover:bg-primary/10",children:[i.jsx(Na,{className:"h-4 w-4"}),x("sidebar.newChat",{defaultValue:"New chat"})]}),n>0&&!r&&i.jsxs("div",{className:"mt-2.5 space-y-2",children:[i.jsx(vw,{value:g,onChange:b,t:x}),i.jsxs("div",{className:"flex rounded-lg bg-muted/50 p-0.5",children:[i.jsxs("button",{onClick:()=>c("projects"),"aria-pressed":l==="projects",className:ue("flex-1 flex items-center justify-center gap-1.5 rounded-md px-2 py-1.5 text-xs font-medium transition-all",l==="projects"?"bg-background shadow-sm text-foreground":"text-muted-foreground hover:text-foreground"),children:[i.jsx(Pn,{className:"h-3 w-3"}),x("search.modeProjects")]}),i.jsxs("button",{onClick:()=>c("conversations"),"aria-pressed":l==="conversations",className:ue("flex-1 flex items-center justify-center gap-1.5 rounded-md px-2 py-1.5 text-xs font-medium transition-all",l==="conversations"?"bg-background shadow-sm text-foreground":"text-muted-foreground hover:text-foreground"),children:[i.jsx(na,{className:"h-3 w-3"}),x("search.modeConversations")]})]}),i.jsxs("div",{className:"relative",children:[i.jsx(Ea,{className:"pointer-events-none absolute left-3 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-muted-foreground/50"}),i.jsx(Nt,{type:"text",placeholder:x(l==="conversations"?"search.conversationsPlaceholder":"projects.searchPlaceholder"),value:a,onChange:v=>s(v.target.value),className:"nav-search-input h-9 rounded-xl border-0 pl-9 pr-8 text-sm transition-all duration-200 placeholder:text-muted-foreground/40 focus-visible:ring-0 focus-visible:ring-offset-0"}),a&&i.jsx("button",{onClick:o,"aria-label":x("tooltips.clearSearch"),className:"absolute right-2.5 top-1/2 -translate-y-1/2 rounded-md p-0.5 hover:bg-accent",children:i.jsx(xt,{className:"h-3 w-3 text-muted-foreground"})})]})]})]}),i.jsx("div",{className:"nav-divider hidden md:block"}),i.jsxs("div",{className:"p-3 pb-2 md:hidden",style:e&&t?{paddingTop:"16px"}:{},children:[i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsx(y,{}),i.jsxs("div",{className:"flex flex-shrink-0 gap-1.5",children:[i.jsx("button",{className:"flex h-8 w-8 items-center justify-center rounded-lg bg-muted/50 transition-all active:scale-95",onClick:d,disabled:u,children:i.jsx(ht,{className:`h-4 w-4 text-muted-foreground ${u?"animate-spin":""}`})}),i.jsx("button",{className:"flex h-8 w-8 items-center justify-center rounded-lg bg-primary/90 text-primary-foreground transition-all active:scale-95",onClick:p,children:i.jsx(ai,{className:"h-4 w-4"})})]})]}),n>0&&!r&&i.jsxs("div",{className:"mt-2.5 space-y-2",children:[l==="projects"&&i.jsx(vw,{value:g,onChange:b,t:x}),i.jsxs("div",{className:"flex rounded-lg bg-muted/50 p-0.5",children:[i.jsxs("button",{onClick:()=>c("projects"),"aria-pressed":l==="projects",className:ue("flex-1 flex items-center justify-center gap-1.5 rounded-md px-2 py-1.5 text-xs font-medium transition-all",l==="projects"?"bg-background shadow-sm text-foreground":"text-muted-foreground hover:text-foreground"),children:[i.jsx(Pn,{className:"h-3 w-3"}),x("search.modeProjects")]}),i.jsxs("button",{onClick:()=>c("conversations"),"aria-pressed":l==="conversations",className:ue("flex-1 flex items-center justify-center gap-1.5 rounded-md px-2 py-1.5 text-xs font-medium transition-all",l==="conversations"?"bg-background shadow-sm text-foreground":"text-muted-foreground hover:text-foreground"),children:[i.jsx(na,{className:"h-3 w-3"}),x("search.modeConversations")]})]}),i.jsxs("div",{className:"relative",children:[i.jsx(Ea,{className:"pointer-events-none absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground/50"}),i.jsx(Nt,{type:"text",placeholder:x(l==="conversations"?"search.conversationsPlaceholder":"projects.searchPlaceholder"),value:a,onChange:v=>s(v.target.value),className:"nav-search-input h-10 rounded-xl border-0 pl-10 pr-9 text-sm transition-all duration-200 placeholder:text-muted-foreground/40 focus-visible:ring-0 focus-visible:ring-offset-0"}),a&&i.jsx("button",{onClick:o,"aria-label":x("tooltips.clearSearch"),className:"absolute right-2.5 top-1/2 -translate-y-1/2 rounded-md p-1 hover:bg-accent",children:i.jsx(xt,{className:"h-3.5 w-3.5 text-muted-foreground"})})]})]})]}),i.jsx("div",{className:"nav-divider md:hidden"})]})}const xM=160,ww=180;function BN({actions:e,className:t,triggerLabel:r}){const[n,a]=h.useState(!1),[s,o]=h.useState(null),l=h.useRef(null),c=h.useRef(null);h.useLayoutEffect(()=>{if(!n||!l.current)return;const u=l.current.getBoundingClientRect();let p=u.right-xM;p<8&&(p=8);let f=u.bottom+4;f+ww>window.innerHeight&&(f=Math.max(8,u.top-4-ww)),o({top:f,left:p})},[n]),h.useEffect(()=>{if(!n)return;const u=m=>{const g=m.target;l.current?.contains(g)||c.current?.contains(g)||a(!1)},p=m=>{m.key==="Escape"&&a(!1)},f=()=>a(!1);return document.addEventListener("mousedown",u),document.addEventListener("keydown",p),window.addEventListener("scroll",f,!0),window.addEventListener("resize",f),()=>{document.removeEventListener("mousedown",u),document.removeEventListener("keydown",p),window.removeEventListener("scroll",f,!0),window.removeEventListener("resize",f)}},[n]);const d=u=>p=>{p.stopPropagation(),p.preventDefault(),a(!1),u.onClick()};return i.jsxs(i.Fragment,{children:[i.jsx("button",{ref:l,type:"button","aria-haspopup":"menu","aria-expanded":n,"aria-label":r||"Actions",title:r||"Actions",onClick:u=>{u.stopPropagation(),u.preventDefault(),a(p=>!p)},className:ue("flex h-6 w-6 items-center justify-center rounded-md text-muted-foreground","opacity-0 transition-all duration-150 hover:bg-accent hover:text-foreground","group-hover:opacity-100 focus-visible:opacity-100 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-primary","touch:opacity-100",n&&"bg-accent text-foreground opacity-100",t),children:i.jsx(LD,{className:"h-3.5 w-3.5"})}),n&&s&&Bd.createPortal(i.jsx("div",{ref:c,role:"menu",style:{position:"fixed",top:s.top,left:s.left,zIndex:9999},className:ue("w-40 rounded-xl border border-border/60 bg-popover p-1 shadow-lg","animate-in fade-in-0 zoom-in-95 duration-100"),onClick:u=>u.stopPropagation(),onMouseDown:u=>u.stopPropagation(),children:e.map((u,p)=>{const f=u.icon,m=e[p-1],g=p>0&&u.danger&&!m?.danger;return i.jsxs("div",{children:[g&&i.jsx("div",{className:"my-1 h-px bg-border/60"}),i.jsxs("button",{type:"button",role:"menuitem",onClick:d(u),className:ue("flex w-full items-center gap-2 rounded-md px-2 py-1.5 text-left text-xs",u.danger?"text-red-600 hover:bg-red-50 dark:text-red-400 dark:hover:bg-red-900/20":"text-foreground hover:bg-accent"),children:[i.jsx(f,{className:"h-3 w-3"}),u.label]})]},u.id)})}),document.body)]})}const kw={xs:"w-3 h-3",sm:"w-4 h-4",md:"w-5 h-5",lg:"w-6 h-6"},yM={xs:"p-0.5",sm:"p-1",md:"p-1.5",lg:"p-2"},vM=e=>e==="fully-configured"?{icon:ra,colorClassName:"text-green-500 dark:text-green-400",backgroundClassName:"bg-green-50 dark:bg-green-950",label:"TaskMaster Ready",title:"TaskMaster fully configured with MCP server"}:e==="taskmaster-only"?{icon:Lt,colorClassName:"text-blue-500 dark:text-blue-400",backgroundClassName:"bg-blue-50 dark:bg-blue-950",label:"TaskMaster Init",title:"TaskMaster initialized, MCP server needs setup"}:e==="mcp-only"?{icon:En,colorClassName:"text-amber-500 dark:text-amber-400",backgroundClassName:"bg-amber-50 dark:bg-amber-950",label:"MCP Ready",title:"MCP server configured, TaskMaster needs initialization"}:{icon:xt,colorClassName:"text-gray-400 dark:text-gray-500",backgroundClassName:"bg-gray-50 dark:bg-gray-900",label:"No TaskMaster",title:"TaskMaster not configured"};function wM({status:e="not-configured",size:t="sm",className:r="",showLabel:n=!1}){const a=vM(e),s=a.icon;return n?i.jsxs("div",{className:ue("inline-flex items-center gap-1.5 text-xs rounded-md px-2 py-1 transition-colors",a.backgroundClassName,a.colorClassName,r),title:a.title,children:[i.jsx(s,{className:kw[t]}),i.jsx("span",{className:"font-medium",children:a.label})]}):i.jsx("div",{className:ue("inline-flex items-center justify-center rounded-full transition-colors",a.backgroundClassName,yM[t],r),title:a.title,children:i.jsx(s,{className:ue(kw[t],a.colorClassName)})})}const kM=(e,t,r)=>{const n=new Date(e),a=t;if(isNaN(n.getTime()))return r?r("status.unknown"):"Unknown";const s=a.getTime()-n.getTime(),o=Math.floor(s/1e3),l=Math.floor(s/(1e3*60)),c=Math.floor(s/(1e3*60*60)),d=Math.floor(s/(1e3*60*60*24));return o<60?r?r("time.justNow"):"Just now":l===1?r?r("time.oneMinuteAgo"):"1 min ago":l<60?r?r("time.minutesAgo",{count:l}):`${l} mins ago`:c===1?r?r("time.oneHourAgo"):"1 hour ago":c<24?r?r("time.hoursAgo",{count:c}):`${c} hours ago`:d===1?r?r("time.oneDayAgo"):"1 day ago":d<7?r?r("time.daysAgo",{count:d}):`${d} days ago`:n.toLocaleDateString()};function Sw({isStarred:e,canDelete:t,onRename:r,onToggleStar:n,onDelete:a,t:s,className:o}){const l=d=>i.jsx(Is,{className:`${d.className??""} ${e?"fill-yellow-400 text-yellow-500":""}`}),c=[{id:"rename",label:s("actions.rename"),icon:AD,onClick:r},{id:"star",label:e?s("actions.unstarSession",{defaultValue:"Remove star"}):s("actions.starSession",{defaultValue:"Star"}),icon:l,onClick:n}];return t&&c.push({id:"delete",label:s("actions.delete"),icon:kr,onClick:a,danger:!0}),i.jsx(BN,{actions:c,className:o,triggerLabel:s("tooltips.sessionActions",{defaultValue:"Session actions"})})}const SM={claude:"Claude",cursor:"Cursor",codex:"Codex",gemini:"Gemini",qwen:"Qwen Code",opencode:"OpenCode"},Ew={claude:"bg-orange-500/10 text-orange-600 dark:bg-orange-400/10 dark:text-orange-300 ring-1 ring-orange-500/15",cursor:"bg-sky-500/10 text-sky-600 dark:bg-sky-400/10 dark:text-sky-300 ring-1 ring-sky-500/15",codex:"bg-violet-500/10 text-violet-600 dark:bg-violet-400/10 dark:text-violet-300 ring-1 ring-violet-500/15",gemini:"bg-emerald-500/10 text-emerald-600 dark:bg-emerald-400/10 dark:text-emerald-300 ring-1 ring-emerald-500/15",qwen:"bg-amber-500/10 text-amber-600 dark:bg-amber-400/10 dark:text-amber-300 ring-1 ring-amber-500/15",opencode:"bg-teal-500/10 text-teal-600 dark:bg-teal-400/10 dark:text-teal-300 ring-1 ring-teal-500/15"};function $N({project:e,session:t,selectedSession:r,currentTime:n,editingSession:a,editingSessionName:s,isStarred:o,compact:l=!1,onEditingSessionNameChange:c,onStartEditingSession:d,onCancelEditingSession:u,onSaveEditingSession:p,onToggleStarSession:f,onProjectSelect:m,onSessionSelect:g,onDeleteSession:b,t:x}){const y=iO(t,n,x),v=r?.id===t.id,w=a===t.id,k=t.__provider,E=SM[k]??k,S=Ew[k]??Ew.claude,j=rO(y.sessionName),_=()=>{m(e),g(t,e.name)},T=()=>{p(e.name,t.id,s,k)},C=()=>{b(e.name,t.id,y.sessionName,k)},L=()=>d(t.id,y.sessionName),A=()=>f(e.name,t.id),I=i.jsxs("div",{className:"mt-0.5 flex min-w-0 flex-wrap items-center gap-1 text-[10px] leading-tight",children:[i.jsxs("span",{className:ue("inline-flex items-center gap-1 rounded-full px-1.5 py-px font-medium",S),children:[i.jsx(dr,{provider:k,className:"h-2.5 w-2.5"}),E]}),i.jsx("span",{className:"text-muted-foreground/80",children:kM(y.sessionTime,n,x)}),y.isActive&&i.jsxs("span",{className:"inline-flex items-center gap-1 text-green-600 dark:text-green-400",children:[i.jsx("span",{className:"h-1.5 w-1.5 animate-pulse rounded-full bg-green-500"}),x("status.active",{defaultValue:"Active"})]}),j.slice(0,3).map(z=>i.jsxs("span",{className:"rounded-md bg-muted/60 px-1 py-px font-mono text-[9px] uppercase tracking-wide text-muted-foreground ring-1 ring-border/40",children:[".",z]},z))]}),N=i.jsxs(i.Fragment,{children:[i.jsx("input",{type:"text",value:s,onChange:z=>c(z.target.value),onKeyDown:z=>{z.stopPropagation(),z.key==="Enter"?T():z.key==="Escape"&&u()},onClick:z=>z.stopPropagation(),className:"w-full rounded-md border border-primary/40 bg-background px-2 py-1 text-xs focus:outline-none focus:ring-1 focus:ring-primary",autoFocus:!0}),i.jsx("button",{className:"flex h-6 w-6 items-center justify-center rounded-md bg-green-50 hover:bg-green-100 dark:bg-green-900/20 dark:hover:bg-green-900/40",onClick:z=>{z.stopPropagation(),T()},title:x("tooltips.save"),children:i.jsx(rr,{className:"h-3 w-3 text-green-600 dark:text-green-400"})}),i.jsx("button",{className:"flex h-6 w-6 items-center justify-center rounded-md bg-gray-50 hover:bg-gray-100 dark:bg-gray-900/20 dark:hover:bg-gray-900/40",onClick:z=>{z.stopPropagation(),u()},title:x("tooltips.cancel"),children:i.jsx(xt,{className:"h-3 w-3 text-gray-600 dark:text-gray-400"})})]}),P=i.jsx("div",{className:"md:hidden",children:i.jsx("div",{className:ue("relative mx-3 my-0.5 rounded-lg border border-border/30 bg-card p-2 transition-all duration-150 active:scale-[0.98]",v&&"border-primary/30 bg-primary/5 shadow-sm",!v&&y.isActive&&"border-green-500/25 bg-green-50/5 dark:bg-green-900/5",o&&!v&&"ring-1 ring-yellow-300/50 dark:ring-yellow-500/30"),onClick:w?void 0:_,children:w?i.jsx("div",{className:"flex items-center gap-1",children:N}):i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("div",{className:ue("flex h-6 w-6 flex-shrink-0 items-center justify-center rounded-md",v?"bg-primary/10":"bg-muted/60"),children:i.jsx(dr,{provider:k,className:"h-3 w-3"})}),i.jsxs("div",{className:"min-w-0 flex-1",children:[i.jsxs("div",{className:"flex items-center gap-1",children:[o&&i.jsx("span",{className:"text-yellow-500","aria-hidden":!0,children:"★"}),i.jsx("span",{className:"truncate text-xs font-medium text-foreground",children:y.sessionName})]}),I]}),i.jsx("div",{className:"flex-shrink-0",onClick:z=>z.stopPropagation(),children:i.jsx(Sw,{isStarred:o,canDelete:!y.isCursorSession,onRename:L,onToggleStar:A,onDelete:C,t:x,className:"!opacity-100"})})]})})}),H=i.jsxs("div",{className:ue("group/item relative hidden md:block"),children:[i.jsxs(_e,{variant:"ghost",className:ue("relative h-auto w-full justify-start overflow-hidden p-0 text-left font-normal transition-colors duration-150","hover:bg-accent/60",v&&"bg-accent text-accent-foreground",o&&!v&&"bg-yellow-50/40 hover:bg-yellow-100/40 dark:bg-yellow-900/10 dark:hover:bg-yellow-900/20",l?"rounded-xl px-3 py-2.5":"rounded-lg px-3 py-2"),onClick:w?void 0:()=>g(t,e.name),children:[v&&i.jsx("span",{"aria-hidden":!0,className:"absolute left-0 top-1/2 h-5 w-0.5 -translate-y-1/2 rounded-r bg-primary"}),!v&&!w&&i.jsx("span",{"aria-hidden":!0,className:"session-item-accent"}),i.jsxs("div",{className:"flex w-full min-w-0 items-start gap-2 pr-6",children:[i.jsx("div",{className:ue("mt-0.5 flex h-5 w-5 flex-shrink-0 items-center justify-center rounded-md",v?"bg-primary/10":"bg-muted/50 group-hover/item:bg-muted/80"),children:i.jsx(dr,{provider:k,className:"h-3 w-3"})}),i.jsx("div",{className:"min-w-0 flex-1",children:w?i.jsx("div",{className:"flex items-center gap-1",children:N}):i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:"flex min-w-0 items-center gap-1",children:[o&&i.jsx("span",{className:"flex-shrink-0 text-yellow-500","aria-hidden":!0,children:"★"}),i.jsx("span",{className:"truncate text-xs font-medium text-foreground",children:y.sessionName})]}),I]})})]})]}),!w&&i.jsx("div",{className:"absolute right-1.5 top-1/2 -translate-y-1/2",onClick:z=>z.stopPropagation(),children:i.jsx(Sw,{isStarred:o,canDelete:!y.isCursorSession,onRename:L,onToggleStar:A,onDelete:C,t:x,className:"opacity-0 focus-visible:opacity-100 group-hover/item:opacity-100"})})]});return i.jsxs("div",{className:"group relative",children:[P,H]})}const EM=e=>e==="claude-code"?"claude":e==="codex"?"codex":e==="gemini"?"gemini":e==="qwen"?"qwen":e==="opencode"?"opencode":null;function NM(){return i.jsx(i.Fragment,{children:Array.from({length:3}).map((e,t)=>i.jsx("div",{className:"rounded-md p-2",children:i.jsxs("div",{className:"flex items-start gap-2",children:[i.jsx("div",{className:"mt-0.5 h-3 w-3 animate-pulse rounded-full bg-muted"}),i.jsxs("div",{className:"flex-1 space-y-1",children:[i.jsx("div",{className:"h-3 animate-pulse rounded bg-muted",style:{width:`${60+t*15}%`}}),i.jsx("div",{className:"h-2 w-1/2 animate-pulse rounded bg-muted"})]})]})},t))})}function CM({project:e,isExpanded:t,sessions:r,selectedSession:n,initialSessionsLoaded:a,isLoadingSessions:s,currentTime:o,editingSession:l,editingSessionName:c,isSessionStarred:d,onEditingSessionNameChange:u,onStartEditingSession:p,onCancelEditingSession:f,onSaveEditingSession:m,onToggleStarSession:g,onProjectSelect:b,onSessionSelect:x,onDeleteSession:y,onLoadMoreSessions:v,onNewSession:w,onOpenOrchestration:k,t:E}){const[S,j]=h.useState([]);if(h.useEffect(()=>{if(!t)return;let C=!1;const L=async()=>{const I=await ve(`/api/orchestration/workflows/runs?projectId=${encodeURIComponent(e.name)}`);if(!I.ok)return;const N=await I.json();C||j((N.runs??[]).slice(0,5))};L();const A=window.setInterval(()=>{L()},15e3);return()=>{C=!0,window.clearInterval(A)}},[t,e.name]),!t)return null;const _=r.length>0,T=e.sessionMeta?.hasMore===!0;return i.jsxs("div",{className:"ml-3 space-y-1 border-l border-border pl-3",children:[i.jsx("div",{className:"px-3 pb-1 pt-1 md:hidden",children:i.jsxs("button",{className:"flex h-8 w-full items-center justify-center gap-2 rounded-md bg-primary text-xs font-medium text-primary-foreground transition-all duration-150 hover:bg-primary/90 active:scale-[0.98]",onClick:()=>{b(e),w(e)},children:[i.jsx(Ut,{className:"h-3 w-3"}),E("sessions.newSession")]})}),i.jsxs(_e,{variant:"default",size:"sm",className:"hidden h-8 w-full justify-start gap-2 bg-primary text-xs font-medium text-primary-foreground transition-colors hover:bg-primary/90 md:flex",onClick:()=>w(e),children:[i.jsx(Ut,{className:"h-3 w-3"}),E("sessions.newSession")]}),S.length>0&&i.jsxs("div",{className:"space-y-1",children:[i.jsxs("div",{className:"flex items-center gap-1 px-3 pt-2 text-[10px] font-semibold uppercase tracking-wide text-muted-foreground",children:[i.jsx(aa,{className:"h-3 w-3"}),E("orchestration.section")]}),S.map(C=>{const L=[...new Set(C.nodeRuns.map(A=>EM(A.adapterId)).filter(Boolean))];return i.jsx("button",{type:"button",onClick:()=>k?.(e,C.id),className:"w-full rounded-lg px-3 py-2 text-left transition-colors hover:bg-accent/60",children:i.jsxs("div",{className:"flex min-w-0 items-start gap-2",children:[i.jsx(aa,{className:"mt-0.5 h-4 w-4 flex-shrink-0 text-primary"}),i.jsxs("div",{className:"min-w-0 flex-1",children:[i.jsx("div",{className:"truncate text-xs font-medium text-foreground",children:C.input||E("orchestration.fallbackTitle")}),i.jsxs("div",{className:"mt-1 flex items-center gap-1",children:[L.slice(0,4).map(A=>i.jsx("span",{className:"flex h-4 w-4 items-center justify-center rounded bg-muted",children:i.jsx(dr,{provider:A,className:"h-3 w-3"})},A)),i.jsx("span",{className:"text-[10px] text-muted-foreground",children:E(`common:orchestration.status.${C.status}`,{defaultValue:C.status})})]})]})]})},C.id)})]}),a?!_&&!s?i.jsx("div",{className:"px-3 py-2 text-left",children:i.jsx("p",{className:"text-xs text-muted-foreground",children:E("sessions.noSessions")})}):r.map(C=>i.jsx($N,{project:e,session:C,selectedSession:n,currentTime:o,editingSession:l,editingSessionName:c,isStarred:d(e.name,C.id),onEditingSessionNameChange:u,onStartEditingSession:p,onCancelEditingSession:f,onSaveEditingSession:m,onToggleStarSession:g,onProjectSelect:b,onSessionSelect:x,onDeleteSession:y,t:E},C.id)):i.jsx(NM,{}),_&&T&&i.jsx(_e,{variant:"ghost",size:"sm",className:"mt-2 w-full justify-center gap-2 text-muted-foreground",onClick:()=>v(e),disabled:s,children:s?i.jsxs(i.Fragment,{children:[i.jsx("div",{className:"h-3 w-3 animate-spin rounded-full border border-muted-foreground border-t-transparent"}),E("sessions.loading")]}):i.jsxs(i.Fragment,{children:[i.jsx(Pr,{className:"h-3 w-3"}),E("sessions.showMore")]})})]})}const AM=(e,t)=>{const r=e.length;return t&&r>=5?`${r}+`:`${r}`};function TM({project:e,selectedProject:t,selectedSession:r,isExpanded:n,isDeleting:a,isStarred:s,editingProject:o,editingName:l,sessions:c,initialSessionsLoaded:d,isLoadingSessions:u,currentTime:p,editingSession:f,editingSessionName:m,tasksEnabled:g,mcpServerStatus:b,isSessionStarred:x,onEditingNameChange:y,onToggleProject:v,onProjectSelect:w,onToggleStarProject:k,onToggleStarSession:E,onStartEditingProject:S,onCancelEditingProject:j,onSaveProjectName:_,onDeleteProject:T,onSessionSelect:C,onDeleteSession:L,onLoadMoreSessions:A,onNewSession:I,onOpenOrchestration:N,onEditingSessionNameChange:P,onStartEditingSession:H,onCancelEditingSession:z,onSaveEditingSession:U,t:V}){const O=t?.name===e.name,G=o===e.name,$=e.sessionMeta?.hasMore===!0,F=AM(c,$),te=`${F} session${c.length===1?"":"s"}`,Q=lO(e,b),ge=()=>v(e.name),ae=()=>k(e.name),me=()=>{_(e.name)},pe=()=>{t?.name!==e.name&&w(e),ge()};return i.jsxs("div",{className:ue("md:space-y-1",a&&"opacity-50 pointer-events-none"),children:[i.jsxs("div",{className:"md:group group",children:[i.jsx("div",{className:"md:hidden",children:i.jsx("div",{className:ue("p-3 mx-3 my-1 rounded-lg bg-card border border-border/50 active:scale-[0.98] transition-all duration-150",O&&"bg-primary/5 border-primary/20",s&&!O&&"bg-yellow-50/50 dark:bg-yellow-900/5 border-yellow-200/30 dark:border-yellow-800/30"),onClick:ge,children:i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsxs("div",{className:"flex min-w-0 flex-1 items-center gap-3",children:[i.jsx("div",{className:ue("w-8 h-8 rounded-lg flex items-center justify-center transition-colors",n?"bg-primary/10":"bg-muted"),children:n?i.jsx(Sa,{className:"h-4 w-4 text-primary"}):i.jsx(Pn,{className:"h-4 w-4 text-muted-foreground"})}),i.jsx("div",{className:"min-w-0 flex-1",children:G?i.jsx("input",{type:"text",value:l,onChange:be=>y(be.target.value),className:"w-full rounded-lg border-2 border-primary/40 bg-background px-3 py-2 text-sm text-foreground shadow-sm transition-all duration-200 focus:border-primary focus:shadow-md focus:outline-none",placeholder:V("projects.projectNamePlaceholder"),autoFocus:!0,autoComplete:"off",onClick:be=>be.stopPropagation(),onKeyDown:be=>{be.key==="Enter"&&me(),be.key==="Escape"&&j()},style:{fontSize:"16px",WebkitAppearance:"none",borderRadius:"8px"}}):i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:"flex min-w-0 flex-1 items-center justify-between",children:[i.jsx("h3",{className:"truncate text-sm font-medium text-foreground",children:e.displayName}),g&&i.jsx(wM,{status:Q,size:"xs",className:"ml-2 hidden flex-shrink-0 md:inline-flex"})]}),i.jsx("p",{className:"text-xs text-muted-foreground",children:te})]})})]}),i.jsx("div",{className:"flex items-center gap-1",children:G?i.jsxs(i.Fragment,{children:[i.jsx("button",{className:"flex h-8 w-8 items-center justify-center rounded-lg bg-green-500 shadow-sm transition-all duration-150 active:scale-90 active:shadow-none dark:bg-green-600",onClick:be=>{be.stopPropagation(),me()},children:i.jsx(rr,{className:"h-4 w-4 text-white"})}),i.jsx("button",{className:"flex h-8 w-8 items-center justify-center rounded-lg bg-gray-500 shadow-sm transition-all duration-150 active:scale-90 active:shadow-none dark:bg-gray-600",onClick:be=>{be.stopPropagation(),j()},children:i.jsx(xt,{className:"h-4 w-4 text-white"})})]}):i.jsxs(i.Fragment,{children:[i.jsx("button",{className:ue("w-8 h-8 rounded-lg flex items-center justify-center active:scale-90 transition-all duration-150 border",s?"bg-yellow-500/10 dark:bg-yellow-900/30 border-yellow-200 dark:border-yellow-800":"bg-gray-500/10 dark:bg-gray-900/30 border-gray-200 dark:border-gray-800"),onClick:be=>{be.stopPropagation(),ae()},title:V(s?"tooltips.removeFromFavorites":"tooltips.addToFavorites"),children:i.jsx(Is,{className:ue("w-4 h-4 transition-colors",s?"text-yellow-600 dark:text-yellow-400 fill-current":"text-gray-600 dark:text-gray-400")})}),i.jsx("button",{className:"flex h-8 w-8 items-center justify-center rounded-lg border border-red-200 bg-red-500/10 active:scale-90 dark:border-red-800 dark:bg-red-900/30",onClick:be=>{be.stopPropagation(),T(e)},children:i.jsx(kr,{className:"h-4 w-4 text-red-600 dark:text-red-400"})}),i.jsx("button",{className:"flex h-8 w-8 items-center justify-center rounded-lg border border-primary/20 bg-primary/10 active:scale-90 dark:border-primary/30 dark:bg-primary/20",onClick:be=>{be.stopPropagation(),S(e)},children:i.jsx(Um,{className:"h-4 w-4 text-primary"})}),i.jsx("div",{className:"flex h-6 w-6 items-center justify-center rounded-md bg-muted/30",children:n?i.jsx(Pr,{className:"h-3 w-3 text-muted-foreground"}):i.jsx(An,{className:"h-3 w-3 text-muted-foreground"})})]})})]})})}),i.jsxs(_e,{variant:"ghost",className:ue("hidden md:flex w-full justify-between p-2 h-auto font-normal hover:bg-accent/50",O&&"bg-accent text-accent-foreground",s&&!O&&"bg-yellow-50/50 dark:bg-yellow-900/10 hover:bg-yellow-100/50 dark:hover:bg-yellow-900/20"),onClick:pe,children:[i.jsxs("div",{className:"flex min-w-0 flex-1 items-center gap-3",children:[n?i.jsx(Sa,{className:"h-4 w-4 flex-shrink-0 text-primary"}):i.jsx(Pn,{className:"h-4 w-4 flex-shrink-0 text-muted-foreground"}),i.jsx("div",{className:"min-w-0 flex-1 text-left",children:G?i.jsxs("div",{className:"space-y-1",children:[i.jsx("input",{type:"text",value:l,onChange:be=>y(be.target.value),className:"w-full rounded border border-border bg-background px-2 py-1 text-sm text-foreground focus:ring-2 focus:ring-primary/20",placeholder:V("projects.projectNamePlaceholder"),autoFocus:!0,onKeyDown:be=>{be.key==="Enter"&&me(),be.key==="Escape"&&j()}}),i.jsx("div",{className:"truncate text-xs text-muted-foreground",title:e.fullPath,children:e.fullPath})]}):i.jsxs("div",{children:[i.jsx("div",{className:"truncate text-sm font-semibold text-foreground",title:e.displayName,children:e.displayName}),i.jsxs("div",{className:"text-xs text-muted-foreground",children:[F,e.fullPath!==e.displayName&&i.jsxs("span",{className:"ml-1 opacity-60",title:e.fullPath,children:[" - ",e.fullPath.length>25?`...${e.fullPath.slice(-22)}`:e.fullPath]})]})]})})]}),i.jsx("div",{className:"flex flex-shrink-0 items-center gap-1",children:G?i.jsxs(i.Fragment,{children:[i.jsx("div",{className:"flex h-6 w-6 cursor-pointer items-center justify-center rounded text-green-600 transition-colors hover:bg-green-50 hover:text-green-700 dark:hover:bg-green-900/20",onClick:be=>{be.stopPropagation(),me()},children:i.jsx(rr,{className:"h-3 w-3"})}),i.jsx("div",{className:"flex h-6 w-6 cursor-pointer items-center justify-center rounded text-gray-500 transition-colors hover:bg-gray-50 hover:text-gray-700 dark:hover:bg-gray-800",onClick:be=>{be.stopPropagation(),j()},children:i.jsx(xt,{className:"h-3 w-3"})})]}):i.jsxs(i.Fragment,{children:[s&&i.jsx("div",{className:"flex h-6 w-6 cursor-pointer items-center justify-center rounded hover:bg-yellow-50 dark:hover:bg-yellow-900/20",onClick:be=>{be.stopPropagation(),ae()},title:V("tooltips.removeFromFavorites"),children:i.jsx(Is,{className:"h-3 w-3 fill-current text-yellow-600 dark:text-yellow-400"})}),i.jsx(BN,{triggerLabel:V("tooltips.projectActions",{defaultValue:"Project actions"}),actions:[{id:"rename",label:V("actions.rename"),icon:Um,onClick:()=>S(e)},{id:"star",label:V(s?"tooltips.removeFromFavorites":"tooltips.addToFavorites"),icon:Is,onClick:ae},{id:"delete",label:V("actions.delete",{defaultValue:"Delete"}),icon:kr,onClick:()=>T(e),danger:!0}]}),n?i.jsx(Pr,{className:"h-4 w-4 text-muted-foreground transition-colors group-hover:text-foreground"}):i.jsx(An,{className:"h-4 w-4 text-muted-foreground transition-colors group-hover:text-foreground"})]})})]})]}),i.jsx(CM,{project:e,isExpanded:n,sessions:c,selectedSession:r,initialSessionsLoaded:d,isLoadingSessions:u,currentTime:p,editingSession:f,editingSessionName:m,isSessionStarred:x,onEditingSessionNameChange:P,onStartEditingSession:H,onCancelEditingSession:z,onSaveEditingSession:U,onToggleStarSession:E,onProjectSelect:w,onSessionSelect:C,onDeleteSession:L,onLoadMoreSessions:A,onNewSession:I,onOpenOrchestration:N,t:V})]})}function UN({isLoading:e,loadingProgress:t,projectsCount:r,filteredProjectsCount:n,t:a}){return e?i.jsxs("div",{className:"px-4 py-12 text-center md:py-8",children:[i.jsx("div",{className:"mx-auto mb-4 flex h-12 w-12 items-center justify-center rounded-lg bg-muted md:mb-3",children:i.jsx("div",{className:"h-6 w-6 animate-spin rounded-full border-2 border-muted-foreground border-t-transparent"})}),i.jsx("h3",{className:"mb-2 text-base font-medium text-foreground md:mb-1",children:a("projects.loadingProjects")}),t&&t.total>0?i.jsxs("div",{className:"space-y-2",children:[i.jsx("div",{className:"h-2 w-full overflow-hidden rounded-full bg-muted",children:i.jsx("div",{className:"h-full bg-primary transition-all duration-300 ease-out",style:{width:`${t.current/t.total*100}%`}})}),i.jsxs("p",{className:"text-sm text-muted-foreground",children:[t.current,"/",t.total," ",a("projects.projects")]}),t.currentProject&&i.jsx("p",{className:"mx-auto max-w-[200px] truncate text-xs text-muted-foreground/70",title:t.currentProject,children:t.currentProject.split("-").slice(-2).join("/")})]}):i.jsx("p",{className:"text-sm text-muted-foreground",children:a("projects.fetchingProjects")})]}):r===0?i.jsxs("div",{className:"px-4 py-12 text-center md:py-8",children:[i.jsx("div",{className:"mx-auto mb-4 flex h-12 w-12 items-center justify-center rounded-lg bg-muted md:mb-3",children:i.jsx(Pn,{className:"h-6 w-6 text-muted-foreground"})}),i.jsx("h3",{className:"mb-2 text-base font-medium text-foreground md:mb-1",children:a("projects.noProjects")}),i.jsx("p",{className:"text-sm text-muted-foreground",children:a("projects.runClaudeCli")})]}):n===0?i.jsxs("div",{className:"px-4 py-12 text-center md:py-8",children:[i.jsx("div",{className:"mx-auto mb-4 flex h-12 w-12 items-center justify-center rounded-lg bg-muted md:mb-3",children:i.jsx(Ea,{className:"h-6 w-6 text-muted-foreground"})}),i.jsx("h3",{className:"mb-2 text-base font-medium text-foreground md:mb-1",children:a("projects.noMatchingProjects")}),i.jsx("p",{className:"text-sm text-muted-foreground",children:a("projects.tryDifferentSearch")})]}):null}function jM({projects:e,filteredProjects:t,selectedProject:r,selectedSession:n,isLoading:a,loadingProgress:s,expandedProjects:o,editingProject:l,editingName:c,loadingSessions:d,initialSessionsLoaded:u,currentTime:p,editingSession:f,editingSessionName:m,deletingProjects:g,tasksEnabled:b,mcpServerStatus:x,getProjectSessions:y,isProjectStarred:v,isSessionStarred:w,onEditingNameChange:k,onToggleProject:E,onProjectSelect:S,onToggleStarProject:j,onToggleStarSession:_,onStartEditingProject:T,onCancelEditingProject:C,onSaveProjectName:L,onDeleteProject:A,onSessionSelect:I,onDeleteSession:N,onLoadMoreSessions:P,onNewSession:H,onOpenOrchestration:z,onEditingSessionNameChange:U,onStartEditingSession:V,onCancelEditingSession:O,onSaveEditingSession:G,t:$}){const F=i.jsx(UN,{isLoading:a,loadingProgress:s,projectsCount:e.length,filteredProjectsCount:t.length,t:$});h.useEffect(()=>{let pe="Pixcode";const be=r?.displayName?.trim();be&&(pe=`${be} - ${pe}`),document.title=pe},[r]);const te=!a&&e.length>0&&t.length>0,Q=pe=>pe.source==="history"||pe.autoDiscovered===!0&&pe.isManuallyAdded!==!0,ge=t.filter(pe=>!Q(pe)),ae=t.filter(pe=>Q(pe)),me=pe=>i.jsx(TM,{project:pe,selectedProject:r,selectedSession:n,isExpanded:o.has(pe.name),isDeleting:g.has(pe.name),isStarred:v(pe.name),editingProject:l,editingName:c,sessions:y(pe),initialSessionsLoaded:u.has(pe.name),isLoadingSessions:!!d[pe.name],currentTime:p,editingSession:f,editingSessionName:m,tasksEnabled:b,mcpServerStatus:x,isSessionStarred:w,onEditingNameChange:k,onToggleProject:E,onProjectSelect:S,onToggleStarProject:j,onToggleStarSession:_,onStartEditingProject:T,onCancelEditingProject:C,onSaveProjectName:L,onDeleteProject:A,onSessionSelect:I,onDeleteSession:N,onLoadMoreSessions:P,onNewSession:H,onOpenOrchestration:z,onEditingSessionNameChange:U,onStartEditingSession:V,onCancelEditingSession:O,onSaveEditingSession:G,t:$},pe.name);return i.jsx("div",{className:"pb-safe-area-inset-bottom md:space-y-1",children:te?i.jsxs(i.Fragment,{children:[ge.map(pe=>me(pe)),ae.length>0&&i.jsxs(i.Fragment,{children:[i.jsx("div",{className:"px-3 pb-1 pt-3 text-[11px] font-semibold uppercase tracking-wide text-gray-500 dark:text-gray-400",children:$("projects.detectedFromHistory")}),ae.map(pe=>me(pe))]})]}):F})}function fa(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function GN(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,e.__proto__=t}/*!
230
230
  * GSAP 3.15.0
231
231
  * https://gsap.com
232
232
  *
@@ -305,7 +305,7 @@ Waiting for the server to restart…
305
305
  ❌ Update failed: ${N.message}
306
306
  `),u(!1)}},[S,C,_,L]);if(!e)return null;const I=d||y==="restarting"||y==="waiting";return i.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center",children:[i.jsx("button",{className:"fixed inset-0 bg-black/50 backdrop-blur-sm",onClick:I?void 0:t,"aria-label":l("versionUpdate.ariaLabels.closeModal"),disabled:I}),i.jsxs("div",{ref:k,className:"relative mx-4 max-h-[90vh] w-full max-w-2xl space-y-4 overflow-y-auto rounded-2xl border border-gray-200 bg-white p-6 shadow-xl dark:border-gray-700 dark:bg-gray-800",children:[i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsx("div",{className:"flex h-10 w-10 items-center justify-center rounded-lg bg-blue-100 dark:bg-blue-900/30",children:i.jsx("svg",{className:"h-5 w-5 text-blue-600 dark:text-blue-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M7 16a4 4 0 01-.88-7.903A5 5 0 1115.9 6L16 6a5 5 0 011 9.9M9 19l3 3m0 0l3-3m-3 3V10"})})}),i.jsxs("div",{children:[i.jsx("h2",{className:"text-lg font-semibold text-gray-900 dark:text-white",children:o?l("versionUpdate.title"):l("versionUpdate.releaseNotesTitle",{defaultValue:"Release Notes"})}),i.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400",children:r?.title||(o?l("versionUpdate.newVersionReady"):l("versionUpdate.releaseNotesSubtitle",{defaultValue:"Latest Pixcode changes"}))})]})]}),i.jsx("button",{onClick:t,disabled:I,className:"rounded-md p-2 text-gray-400 hover:bg-gray-100 hover:text-gray-600 disabled:cursor-not-allowed disabled:opacity-50 dark:hover:bg-gray-700 dark:hover:text-gray-300",children:i.jsx("svg",{className:"h-5 w-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),i.jsxs("div",{className:"space-y-3",children:[i.jsxs("div",{className:"flex items-center justify-between rounded-lg bg-gray-50 p-3 dark:bg-gray-700/50",children:[i.jsx("span",{className:"text-sm font-medium text-gray-700 dark:text-gray-300",children:l("versionUpdate.currentVersion")}),i.jsx("span",{className:"font-mono text-sm text-gray-900 dark:text-white",children:n})]}),i.jsxs("div",{className:"flex items-center justify-between rounded-lg border border-blue-200 bg-blue-50 p-3 dark:border-blue-700 dark:bg-blue-900/20",children:[i.jsx("span",{className:"text-sm font-medium text-blue-700 dark:text-blue-300",children:o?l("versionUpdate.latestVersion"):l("versionUpdate.latestRelease",{defaultValue:"Latest Release"})}),i.jsx("span",{className:"font-mono text-sm text-blue-900 dark:text-blue-100",children:a||n})]})]}),i.jsx(lB,{releaseBody:r?.body||"",version:a||n}),r?.body&&i.jsxs("div",{className:"space-y-3",children:[i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsx("h3",{className:"text-sm font-medium text-gray-900 dark:text-white",children:l("versionUpdate.whatsNew")}),r?.htmlUrl&&i.jsxs("a",{href:r.htmlUrl,target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-1 text-xs text-blue-600 hover:text-blue-700 hover:underline dark:text-blue-400 dark:hover:text-blue-300",children:[l("versionUpdate.viewFullRelease"),i.jsx("svg",{className:"h-3 w-3",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M10 6H6a2 2 0 00-2 2v10a2 2 0 002 2h10a2 2 0 002-2v-4M14 4h6m0 0v6m0-6L10 14"})})]})]}),i.jsx("div",{className:"max-h-64 overflow-y-auto rounded-lg border border-gray-200 bg-gray-50 p-4 dark:border-gray-600 dark:bg-gray-700/50",children:i.jsx("div",{className:"prose prose-sm max-w-none whitespace-pre-wrap text-sm text-gray-700 dark:prose-invert dark:text-gray-300",children:uB(r.body)})})]}),(p||m)&&i.jsxs("div",{className:"space-y-2",children:[i.jsx("h3",{className:"text-sm font-medium text-gray-900 dark:text-white",children:l("versionUpdate.updateProgress")}),i.jsx("div",{ref:w,className:"max-h-48 overflow-y-auto rounded-lg border border-gray-700 bg-gray-900 p-4 dark:bg-gray-950",children:i.jsx("pre",{className:"whitespace-pre-wrap font-mono text-xs text-green-400",children:p})}),y==="waiting"&&i.jsx("div",{className:"rounded-md border border-blue-200 bg-blue-50 px-3 py-2 text-xs text-blue-700 dark:border-blue-900/40 dark:bg-blue-900/20 dark:text-blue-200",children:"Waiting for server to come back online... this can take up to a minute."}),y==="timeout"&&i.jsx("div",{className:"rounded-md border border-yellow-200 bg-yellow-50 px-3 py-2 text-xs text-yellow-800 dark:border-yellow-900/40 dark:bg-yellow-900/20 dark:text-yellow-200",children:"Server did not restart automatically. Start it again (daemon/pm2/your wrapper) and refresh the page."}),U_,m&&i.jsx("div",{className:"rounded-md border border-red-200 bg-red-50 px-3 py-2 text-xs text-red-700 dark:border-red-900/40 dark:bg-red-900/20 dark:text-red-200",children:m})]}),E&&!d&&!p&&i.jsxs("div",{className:"space-y-3",children:[i.jsx("h3",{className:"text-sm font-medium text-gray-900 dark:text-white",children:l("versionUpdate.manualUpgrade")}),i.jsx("div",{className:"rounded-lg border bg-gray-100 p-3 dark:bg-gray-800",children:i.jsx("code",{className:"font-mono text-sm text-gray-800 dark:text-gray-200",children:c})}),i.jsx("p",{className:"text-xs text-gray-600 dark:text-gray-400",children:l("versionUpdate.manualUpgradeHint")})]}),i.jsxs("div",{className:"flex gap-2 pt-2",children:[i.jsx("button",{onClick:t,disabled:I,className:"flex-1 rounded-md bg-gray-100 px-4 py-2 text-sm font-medium text-gray-700 transition-colors hover:bg-gray-200 disabled:cursor-not-allowed disabled:opacity-50 dark:bg-gray-700 dark:text-gray-300 dark:hover:bg-gray-600",children:l(p||!E?"versionUpdate.buttons.close":"versionUpdate.buttons.later")}),(y==="timeout"||y==="error")&&i.jsx("button",{onClick:()=>window.location.reload(),className:"flex-1 rounded-md bg-blue-600 px-4 py-2 text-sm font-medium text-white transition-colors hover:bg-blue-700",children:"Refresh page"}),E&&!p&&i.jsxs(i.Fragment,{children:[i.jsx("button",{onClick:()=>Cn(c),className:"flex-1 rounded-md bg-gray-100 px-4 py-2 text-sm font-medium text-gray-700 transition-colors hover:bg-gray-200 dark:bg-gray-700 dark:text-gray-300 dark:hover:bg-gray-600",children:l("versionUpdate.buttons.copyCommand")}),i.jsx("button",{onClick:A,disabled:d,className:"flex flex-1 items-center justify-center gap-2 rounded-md bg-blue-600 px-4 py-2 text-sm font-medium text-white transition-colors hover:bg-blue-700 disabled:cursor-not-allowed disabled:bg-blue-400",children:d?i.jsxs(i.Fragment,{children:[i.jsx("div",{className:"h-4 w-4 animate-spin rounded-full border-2 border-white border-t-transparent"}),l("versionUpdate.buttons.updating")]}):l("versionUpdate.buttons.updateNow")})]})]})]})]})}const uB=e=>e?nB(e).replace(/\b[0-9a-f]{40}\b/gi,"").replace(/(?:^|\s|-)([0-9a-f]{7,10})\b/gi,"").replace(/\*\*Full Changelog\*\*:.*$/gim,"").replace(/https?:\/\/github\.com\/[^\/]+\/[^\/]+\/compare\/[^\s)]+/gi,"").replace(/\n\s*\n\s*\n/g,`
307
307
 
308
- `).trim():"";function pB({message:e}){return i.jsxs("div",{className:"flex items-start gap-3 rounded-lg border border-red-200 bg-red-50 p-4 dark:border-red-800 dark:bg-red-900/20",children:[i.jsx(En,{className:"mt-0.5 h-5 w-5 flex-shrink-0 text-red-600 dark:text-red-400"}),i.jsx("p",{className:"text-sm text-red-800 dark:text-red-200",children:e})]})}const mB=["git@","ssh://"],hB=/^[A-Za-z]:\\?$/,JC=e=>{const t=e.trim();return mB.some(r=>t.startsWith(r))},QC=(e,t)=>e==="new"&&t.trim().length>0&&!JC(t),$k=(e,t)=>e==="new"&&t.trim().length>0,fB=e=>{const t=e.trim(),r=Math.max(t.lastIndexOf("/"),t.lastIndexOf("\\"));return r===2&&/^[A-Za-z]:/.test(t)?`${t.slice(0,2)}\\`:r>0?t.slice(0,r):"~"},gB=e=>{if(e==="~"||e==="/"||hB.test(e))return null;const t=Math.max(e.lastIndexOf("/"),e.lastIndexOf("\\"));return t<=0?"/":t===2&&/^[A-Za-z]:/.test(e)?`${e.slice(0,2)}\\`:e.slice(0,t)},bB=(e,t)=>{const r=e.trim().replace(/[\\/]+$/,""),n=r.includes("\\")&&!r.includes("/")?"\\":"/";return`${r}${n}${t.trim()}`},Ip=(e,t)=>`px-3 py-2 text-sm font-medium rounded-lg transition-colors ${e===t?e==="none"?"bg-green-500 text-white":"bg-blue-500 text-white":"bg-gray-200 dark:bg-gray-700 text-gray-700 dark:text-gray-300"}`;function xB({tokenMode:e,selectedGithubToken:t,newGithubToken:r,availableTokens:n,loadingTokens:a,tokenLoadError:s,onTokenModeChange:o,onSelectedGithubTokenChange:l,onNewGithubTokenChange:c}){const{t:d}=Me();return i.jsxs("div",{className:"rounded-lg border border-gray-200 bg-gray-50 p-4 dark:border-gray-700 dark:bg-gray-900/50",children:[i.jsxs("div",{className:"mb-4 flex items-start gap-3",children:[i.jsx(Wd,{className:"mt-0.5 h-5 w-5 flex-shrink-0 text-gray-600 dark:text-gray-400"}),i.jsxs("div",{className:"flex-1",children:[i.jsx("h5",{className:"mb-1 font-medium text-gray-900 dark:text-white",children:d("projectWizard.step2.githubAuth")}),i.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400",children:d("projectWizard.step2.githubAuthHelp")})]})]}),a&&i.jsxs("div",{className:"flex items-center gap-2 text-sm text-gray-500",children:[i.jsx(Ot,{className:"h-4 w-4 animate-spin"}),d("projectWizard.step2.loadingTokens")]}),!a&&s&&i.jsx("p",{className:"mb-3 text-sm text-red-600 dark:text-red-400",children:s}),!a&&n.length>0&&i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:"mb-4 grid grid-cols-3 gap-2",children:[i.jsx("button",{onClick:()=>o("stored"),className:Ip(e,"stored"),children:d("projectWizard.step2.storedToken")}),i.jsx("button",{onClick:()=>o("new"),className:Ip(e,"new"),children:d("projectWizard.step2.newToken")}),i.jsx("button",{onClick:()=>{o("none"),l(""),c("")},className:Ip(e,"none"),children:d("projectWizard.step2.nonePublic")})]}),e==="stored"?i.jsxs("div",{children:[i.jsx("label",{className:"mb-2 block text-sm font-medium text-gray-700 dark:text-gray-300",children:d("projectWizard.step2.selectToken")}),i.jsxs("select",{value:t,onChange:u=>l(u.target.value),className:"w-full rounded-lg border border-gray-300 bg-white px-3 py-2 text-sm dark:border-gray-600 dark:bg-gray-800",children:[i.jsx("option",{value:"",children:d("projectWizard.step2.selectTokenPlaceholder")}),n.map(u=>i.jsx("option",{value:String(u.id),children:u.credential_name},u.id))]})]}):e==="new"?i.jsxs("div",{children:[i.jsx("label",{className:"mb-2 block text-sm font-medium text-gray-700 dark:text-gray-300",children:d("projectWizard.step2.newToken")}),i.jsx(Nt,{type:"password",value:r,onChange:u=>c(u.target.value),placeholder:"ghp_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",className:"w-full"}),i.jsx("p",{className:"mt-1 text-xs text-gray-500 dark:text-gray-400",children:d("projectWizard.step2.tokenHelp")})]}):null]}),!a&&n.length===0&&i.jsxs("div",{className:"space-y-4",children:[i.jsx("div",{className:"rounded-lg border border-blue-200 bg-blue-50 p-3 dark:border-blue-800 dark:bg-blue-900/20",children:i.jsx("p",{className:"text-sm text-blue-800 dark:text-blue-200",children:d("projectWizard.step2.publicRepoInfo")})}),i.jsxs("div",{children:[i.jsx("label",{className:"mb-2 block text-sm font-medium text-gray-700 dark:text-gray-300",children:d("projectWizard.step2.optionalTokenPublic")}),i.jsx(Nt,{type:"password",value:r,onChange:u=>{const p=u.target.value;c(p),o(p.trim()?"new":"none")},placeholder:d("projectWizard.step2.tokenPublicPlaceholder"),className:"w-full"}),i.jsx("p",{className:"mt-1 text-xs text-gray-500 dark:text-gray-400",children:d("projectWizard.step2.noTokensHelp")})]})]})]})}const au=async e=>await e.json(),yB=async()=>{const e=await ot.get("/settings/credentials?type=github_token"),t=await au(e);if(!e.ok)throw new Error(t.error||"Failed to load GitHub tokens");return(t.credentials||[]).filter(r=>r.is_active)},e3=async e=>{const t=`/browse-filesystem?path=${encodeURIComponent(e)}`,r=await ot.get(t),n=await au(r);if(!r.ok)throw new Error(n.error||"Failed to browse filesystem");return{path:n.path||e,rootPath:n.rootPath||n.path||e,suggestions:n.suggestions||[]}},vB=async e=>{const t=await ot.createFolder(e),r=await au(t);if(!t.ok)throw new Error(r.error||"Failed to create folder");return r.path||e},wB=async e=>{const t=await ot.createWorkspace(e),r=await au(t);if(!t.ok)throw new Error(r.details||r.error||"Failed to create workspace");return r.project},kB=({workspacePath:e,githubUrl:t,tokenMode:r,selectedGithubToken:n,newGithubToken:a})=>{const s=new URLSearchParams({path:e.trim(),githubUrl:t.trim()});r==="stored"&&n&&s.set("githubTokenId",n),r==="new"&&a.trim()&&s.set("newGithubToken",a.trim());const o=localStorage.getItem("auth-token");return o&&s.set("token",o),s.toString()},SB=(e,t)=>new Promise((r,n)=>{const a=kB(e),s=new EventSource(`/api/projects/clone-progress?${a}`);let o=!1;const l=c=>{o||(o=!0,s.close(),c())};s.onmessage=c=>{try{const d=JSON.parse(c.data);if(d.type==="progress"&&d.message){t.onProgress(d.message);return}if(d.type==="complete"){l(()=>r(d.project));return}d.type==="error"&&l(()=>n(new Error(d.message||"Failed to clone repository")))}catch(d){console.error("Error parsing clone progress event:",d)}},s.onerror=()=>{l(()=>n(new Error("Connection lost during clone")))}});function EB({isOpen:e,autoAdvanceOnSelect:t,onClose:r,onFolderSelected:n}){const[a,s]=h.useState("~"),[o,l]=h.useState("~"),[c,d]=h.useState("~"),[u,p]=h.useState([]),[f,m]=h.useState(!1),[g,b]=h.useState(!1),[x,y]=h.useState(!1),[v,w]=h.useState(""),[k,E]=h.useState(!1),[S,j]=h.useState(null),_=h.useCallback(async N=>{m(!0),j(null);try{const P=await e3(N);s(P.path),d(P.path),l(P.rootPath),p(P.suggestions)}catch(P){j(P instanceof Error?P.message:"Failed to load folders")}finally{m(!1)}},[]);h.useEffect(()=>{e&&_("~")},[e,_]);const T=h.useMemo(()=>u.filter(N=>g||!N.name.startsWith(".")).sort((N,P)=>N.name.toLowerCase().localeCompare(P.name.toLowerCase())),[u,g]),C=()=>{y(!1),w("")},L=()=>{j(null),C(),r()},A=h.useCallback(async()=>{if(v.trim()){E(!0),j(null);try{const N=bB(a,v),P=await vB(N);C(),await _(P)}catch(N){j(N instanceof Error?N.message:"Failed to create folder")}finally{E(!1)}}},[a,_,v]),I=a===o?null:gB(a);return e?i.jsx("div",{className:"fixed inset-0 z-[70] flex items-center justify-center bg-black/50 p-4 backdrop-blur-sm",children:i.jsxs("div",{className:"flex max-h-[80vh] w-full max-w-2xl flex-col rounded-lg border border-gray-200 bg-white shadow-xl dark:border-gray-700 dark:bg-gray-800",children:[i.jsxs("div",{className:"flex items-center justify-between border-b border-gray-200 p-4 dark:border-gray-700",children:[i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsx("div",{className:"flex h-8 w-8 items-center justify-center rounded-lg bg-blue-100 dark:bg-blue-900/50",children:i.jsx(Sa,{className:"h-4 w-4 text-blue-600 dark:text-blue-400"})}),i.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white",children:"Select Folder"})]}),i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("button",{onClick:()=>b(N=>!N),className:`rounded-md p-2 transition-colors ${g?"bg-blue-50 text-blue-600 dark:bg-blue-900/30 dark:text-blue-400":"text-gray-400 hover:bg-gray-100 hover:text-gray-600 dark:hover:bg-gray-700 dark:hover:text-gray-300"}`,title:g?"Hide hidden folders":"Show hidden folders",children:g?i.jsx(Yi,{className:"h-5 w-5"}):i.jsx(Af,{className:"h-5 w-5"})}),i.jsx("button",{onClick:()=>y(N=>!N),className:`rounded-md p-2 transition-colors ${x?"bg-blue-50 text-blue-600 dark:bg-blue-900/30 dark:text-blue-400":"text-gray-400 hover:bg-gray-100 hover:text-gray-600 dark:hover:bg-gray-700 dark:hover:text-gray-300"}`,title:"Create new folder",children:i.jsx(Ut,{className:"h-5 w-5"})}),i.jsx("button",{onClick:L,className:"rounded-md p-2 text-gray-400 hover:bg-gray-100 hover:text-gray-600 dark:hover:bg-gray-700 dark:hover:text-gray-300",children:i.jsx(xt,{className:"h-5 w-5"})})]})]}),x&&i.jsx("div",{className:"border-b border-gray-200 bg-blue-50 px-4 py-3 dark:border-gray-700 dark:bg-blue-900/20",children:i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx(Nt,{type:"text",value:v,onChange:N=>w(N.target.value),placeholder:"New folder name",className:"flex-1",onKeyDown:N=>{N.key==="Enter"&&A(),N.key==="Escape"&&C()},autoFocus:!0}),i.jsx(_e,{size:"sm",onClick:A,disabled:!v.trim()||k,children:k?i.jsx(Ot,{className:"h-4 w-4 animate-spin"}):"Create"}),i.jsx(_e,{size:"sm",variant:"ghost",onClick:C,children:"Cancel"})]})}),S&&i.jsx("div",{className:"px-4 pt-3",children:i.jsx("p",{className:"text-sm text-red-600 dark:text-red-400",children:S})}),i.jsx("div",{className:"flex-1 overflow-y-auto p-4",children:f?i.jsx("div",{className:"flex items-center justify-center py-8",children:i.jsx(Ot,{className:"h-6 w-6 animate-spin text-gray-400"})}):i.jsxs("div",{className:"space-y-1",children:[I&&i.jsxs("button",{onClick:()=>_(I),className:"flex w-full items-center gap-3 rounded-lg px-4 py-3 text-left hover:bg-gray-100 dark:hover:bg-gray-700",children:[i.jsx(Sa,{className:"h-5 w-5 text-gray-400"}),i.jsx("span",{className:"font-medium text-gray-700 dark:text-gray-300",children:".."})]}),T.length===0?i.jsx("div",{className:"py-8 text-center text-gray-500 dark:text-gray-400",children:"No subfolders found"}):T.map(N=>i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsxs("button",{onClick:()=>_(N.path),className:"flex flex-1 items-center gap-3 rounded-lg px-4 py-3 text-left hover:bg-gray-100 dark:hover:bg-gray-700",children:[i.jsx(ai,{className:"h-5 w-5 text-blue-500"}),i.jsx("span",{className:"font-medium text-gray-900 dark:text-white",children:N.name})]}),i.jsx(_e,{variant:"ghost",size:"sm",onClick:()=>n(N.path,t),className:"px-3 text-xs",children:"Select"})]},N.path))]})}),i.jsxs("div",{className:"border-t border-gray-200 dark:border-gray-700",children:[i.jsxs("div",{className:"flex items-center gap-2 bg-gray-50 px-4 py-3 dark:bg-gray-900/50",children:[i.jsx("span",{className:"text-sm text-gray-600 dark:text-gray-400",children:"Path:"}),i.jsx(Nt,{type:"text",value:c,onChange:N=>d(N.target.value),onKeyDown:N=>{if(N.key==="Enter"){N.preventDefault();const P=c.trim();P&&_(P)}N.key==="Escape"&&d(a)},placeholder:"Type a path (e.g. D:\\\\Projects) and press Enter",className:"flex-1 font-mono text-sm"})]}),i.jsxs("div",{className:"flex items-center justify-end gap-2 p-4",children:[i.jsx(_e,{variant:"outline",onClick:L,children:"Cancel"}),i.jsx(_e,{variant:"outline",onClick:()=>n(a,t),children:"Use this folder"})]})]})]})}):null}function NB({workspaceType:e,value:t,disabled:r=!1,onChange:n,onAdvanceToConfirm:a}){const[s,o]=h.useState([]),[l,c]=h.useState(!1),[d,u]=h.useState(!1);h.useEffect(()=>{if(t.trim().length<=2){o([]),c(!1);return}const m=window.setTimeout(async()=>{try{const g=fB(t),b=await e3(g),x=t.toLowerCase(),y=b.suggestions.filter(v=>{const w=v.path.toLowerCase();return w.startsWith(x)&&w!==x}).slice(0,5);o(y),c(y.length>0)}catch(g){console.error("Failed to load path suggestions:",g)}},200);return()=>{window.clearTimeout(m)}},[t]);const p=h.useCallback(m=>{n(m.path),c(!1)},[n]),f=h.useCallback((m,g)=>{n(m),u(!1),g&&a()},[a,n]);return i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:"relative flex gap-2",children:[i.jsxs("div",{className:"relative flex-1",children:[i.jsx(Nt,{type:"text",value:t,onChange:m=>n(m.target.value),placeholder:e==="existing"?"my-existing-project or /absolute/path":"my-new-project or /absolute/path",className:"w-full",disabled:r}),l&&s.length>0&&i.jsx("div",{className:"absolute z-10 mt-1 max-h-60 w-full overflow-y-auto rounded-lg border border-gray-200 bg-white shadow-lg dark:border-gray-700 dark:bg-gray-800",children:s.map(m=>i.jsxs("button",{onClick:()=>p(m),className:"w-full px-4 py-2 text-left text-sm hover:bg-gray-100 dark:hover:bg-gray-700",children:[i.jsx("div",{className:"font-medium text-gray-900 dark:text-white",children:m.name}),i.jsx("div",{className:"text-xs text-gray-500 dark:text-gray-400",children:m.path})]},m.path))})]}),i.jsx(_e,{type:"button",variant:"outline",onClick:()=>u(!0),className:"px-3",title:"Browse folders",disabled:r,children:i.jsx(Sa,{className:"h-4 w-4"})})]}),i.jsx(EB,{isOpen:d,autoAdvanceOnSelect:e==="existing",onClose:()=>u(!1),onFolderSelected:f})]})}const CB={existing:"projectWizard.step2.existingPath",new:"projectWizard.step2.newPath",subfolder:"projectWizard.step2.subfolderParentPath"},AB={existing:"projectWizard.step2.existingHelp",new:"projectWizard.step2.newHelp",subfolder:"projectWizard.step2.subfolderParentHelp"};function TB({workspaceType:e,workspacePath:t,githubUrl:r,subfolderName:n,tokenMode:a,selectedGithubToken:s,newGithubToken:o,availableTokens:l,loadingTokens:c,tokenLoadError:d,isCreating:u,onWorkspacePathChange:p,onGithubUrlChange:f,onSubfolderNameChange:m,onTokenModeChange:g,onSelectedGithubTokenChange:b,onNewGithubTokenChange:x,onAdvanceToConfirm:y}){const{t:v}=Me(),w=QC(e,r);return i.jsxs("div",{className:"space-y-4",children:[i.jsxs("div",{children:[i.jsx("label",{className:"mb-2 block text-sm font-medium text-gray-700 dark:text-gray-300",children:v(CB[e])}),i.jsx(NB,{workspaceType:e,value:t,disabled:u,onChange:p,onAdvanceToConfirm:y}),i.jsx("p",{className:"mt-1 text-xs text-gray-500 dark:text-gray-400",children:v(AB[e])})]}),e==="subfolder"&&i.jsxs("div",{children:[i.jsx("label",{className:"mb-2 block text-sm font-medium text-gray-700 dark:text-gray-300",children:v("projectWizard.step2.subfolderName")}),i.jsx(Nt,{type:"text",value:n,onChange:k=>m(k.target.value),placeholder:"my-new-app",className:"w-full",disabled:u}),i.jsx("p",{className:"mt-1 text-xs text-gray-500 dark:text-gray-400",children:v("projectWizard.step2.subfolderNameHelp")})]}),e==="new"&&i.jsxs(i.Fragment,{children:[i.jsxs("div",{children:[i.jsx("label",{className:"mb-2 block text-sm font-medium text-gray-700 dark:text-gray-300",children:v("projectWizard.step2.githubUrl")}),i.jsx(Nt,{type:"text",value:r,onChange:k=>f(k.target.value),placeholder:"https://github.com/username/repository",className:"w-full",disabled:u}),i.jsx("p",{className:"mt-1 text-xs text-gray-500 dark:text-gray-400",children:v("projectWizard.step2.githubHelp")})]}),w&&i.jsx(xB,{tokenMode:a,selectedGithubToken:s,newGithubToken:o,availableTokens:l,loadingTokens:c,tokenLoadError:d,onTokenModeChange:g,onSelectedGithubTokenChange:b,onNewGithubTokenChange:x})]})]})}function jB({formState:e,selectedTokenName:t,isCreating:r,cloneProgress:n}){const{t:a}=Me(),s=h.useMemo(()=>e.tokenMode==="stored"&&e.selectedGithubToken?`${a("projectWizard.step3.usingStoredToken")} ${t||"Unknown"}`:e.tokenMode==="new"&&e.newGithubToken.trim()?a("projectWizard.step3.usingProvidedToken"):JC(e.githubUrl)?a("projectWizard.step3.sshKey",{defaultValue:"SSH Key"}):a("projectWizard.step3.noAuthentication"),[e,t,a]);return i.jsxs("div",{className:"space-y-4",children:[i.jsxs("div",{className:"rounded-lg border border-gray-200 bg-gray-50 p-4 dark:border-gray-700 dark:bg-gray-900/50",children:[i.jsx("h4",{className:"mb-3 text-sm font-semibold text-gray-900 dark:text-white",children:a("projectWizard.step3.reviewConfig")}),i.jsxs("div",{className:"space-y-2",children:[i.jsxs("div",{className:"flex justify-between text-sm",children:[i.jsx("span",{className:"text-gray-600 dark:text-gray-400",children:a("projectWizard.step3.workspaceType")}),i.jsx("span",{className:"font-medium text-gray-900 dark:text-white",children:e.workspaceType==="existing"?a("projectWizard.step3.existingWorkspace"):e.workspaceType==="subfolder"?a("projectWizard.step3.subfolderWorkspace"):a("projectWizard.step3.newWorkspace")})]}),i.jsxs("div",{className:"flex justify-between text-sm",children:[i.jsx("span",{className:"text-gray-600 dark:text-gray-400",children:e.workspaceType==="subfolder"?a("projectWizard.step3.parentPath"):a("projectWizard.step3.path")}),i.jsx("span",{className:"break-all font-mono text-xs text-gray-900 dark:text-white",children:e.workspacePath})]}),e.workspaceType==="subfolder"&&e.subfolderName&&i.jsxs("div",{className:"flex justify-between text-sm",children:[i.jsx("span",{className:"text-gray-600 dark:text-gray-400",children:a("projectWizard.step3.subfolderName")}),i.jsx("span",{className:"break-all font-mono text-xs text-gray-900 dark:text-white",children:e.subfolderName})]}),e.workspaceType==="new"&&e.githubUrl&&i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:"flex justify-between text-sm",children:[i.jsx("span",{className:"text-gray-600 dark:text-gray-400",children:a("projectWizard.step3.cloneFrom")}),i.jsx("span",{className:"break-all font-mono text-xs text-gray-900 dark:text-white",children:e.githubUrl})]}),i.jsxs("div",{className:"flex justify-between text-sm",children:[i.jsx("span",{className:"text-gray-600 dark:text-gray-400",children:a("projectWizard.step3.authentication")}),i.jsx("span",{className:"text-xs text-gray-900 dark:text-white",children:s})]})]})]})]}),i.jsx("div",{className:"rounded-lg border border-blue-200 bg-blue-50 p-4 dark:border-blue-800 dark:bg-blue-900/20",children:r&&n?i.jsxs("div",{className:"space-y-2",children:[i.jsx("p",{className:"text-sm font-medium text-blue-800 dark:text-blue-200",children:a("projectWizard.step3.cloningRepository",{defaultValue:"Cloning repository..."})}),i.jsx("code",{className:"block whitespace-pre-wrap break-all font-mono text-xs text-blue-700 dark:text-blue-300",children:n})]}):i.jsx("p",{className:"text-sm text-blue-800 dark:text-blue-200",children:e.workspaceType==="existing"?a("projectWizard.step3.existingInfo"):e.workspaceType==="subfolder"?a("projectWizard.step3.subfolderInfo"):e.githubUrl?a("projectWizard.step3.newWithClone"):a("projectWizard.step3.newEmpty")})})]})}const _B=[{id:"existing",iconKey:"folderOpen",i18nKey:"existing",accent:{active:"border-blue-500 bg-blue-50 dark:bg-blue-900/20",tint:"border-gray-200 hover:border-gray-300 dark:border-gray-700 dark:hover:border-gray-600",iconBg:"bg-blue-100 dark:bg-blue-900/50",iconFg:"text-blue-600 dark:text-blue-400"}},{id:"new",iconKey:"gitBranch",i18nKey:"githubClone",accent:{active:"border-blue-500 bg-blue-50 dark:bg-blue-900/20",tint:"border-gray-200 hover:border-gray-300 dark:border-gray-700 dark:hover:border-gray-600",iconBg:"bg-purple-100 dark:bg-purple-900/50",iconFg:"text-purple-600 dark:text-purple-400"}},{id:"subfolder",iconKey:"folderPlus",i18nKey:"subfolder",accent:{active:"border-blue-500 bg-blue-50 dark:bg-blue-900/20",tint:"border-gray-200 hover:border-gray-300 dark:border-gray-700 dark:hover:border-gray-600",iconBg:"bg-green-100 dark:bg-green-900/50",iconFg:"text-green-600 dark:text-green-400"}}];function IB({workspaceType:e,onWorkspaceTypeChange:t}){const{t:r}=Me();return i.jsxs("div",{className:"space-y-4",children:[i.jsx("h4",{className:"mb-3 text-sm font-medium text-gray-700 dark:text-gray-300",children:r("projectWizard.step1.question")}),i.jsx("div",{className:"grid grid-cols-1 gap-4 md:grid-cols-3",children:_B.map(n=>{const a=e===n.id,s=n.iconKey==="folderOpen"?Sa:n.iconKey==="gitBranch"?Qr:ai;return i.jsx("button",{onClick:()=>t(n.id),className:`rounded-lg border-2 p-4 text-left transition-all ${a?n.accent.active:n.accent.tint}`,children:i.jsxs("div",{className:"flex items-start gap-3",children:[i.jsx("div",{className:`flex h-10 w-10 flex-shrink-0 items-center justify-center rounded-lg ${n.accent.iconBg}`,children:i.jsx(s,{className:`h-5 w-5 ${n.accent.iconFg}`})}),i.jsxs("div",{className:"flex-1",children:[i.jsx("h5",{className:"mb-1 font-semibold text-gray-900 dark:text-white",children:r(`projectWizard.step1.${n.i18nKey}.title`)}),i.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400",children:r(`projectWizard.step1.${n.i18nKey}.description`)})]})]})},n.id)})})]})}function RB({step:e,isCreating:t,isCloneWorkflow:r,onClose:n,onBack:a,onNext:s,onCreate:o}){const{t:l}=Me();return i.jsxs("div",{className:"flex items-center justify-between border-t border-gray-200 p-6 dark:border-gray-700",children:[i.jsx(_e,{variant:"outline",onClick:e===1?n:a,disabled:t,children:e===1?l("projectWizard.buttons.cancel"):i.jsxs(i.Fragment,{children:[i.jsx(Sf,{className:"mr-1 h-4 w-4"}),l("projectWizard.buttons.back")]})}),i.jsx(_e,{onClick:e===3?o:s,disabled:t,children:t?i.jsxs(i.Fragment,{children:[i.jsx(Ot,{className:"mr-2 h-4 w-4 animate-spin"}),r?l("projectWizard.buttons.cloning",{defaultValue:"Cloning..."}):l("projectWizard.buttons.creating")]}):e===3?i.jsxs(i.Fragment,{children:[i.jsx(rr,{className:"mr-1 h-4 w-4"}),l("projectWizard.buttons.createProject")]}):i.jsxs(i.Fragment,{children:[l("projectWizard.buttons.next"),i.jsx(An,{className:"ml-1 h-4 w-4"})]})})]})}function LB({step:e}){const{t}=Me(),r=[1,2,3];return i.jsx("div",{className:"px-6 pb-2 pt-4",children:i.jsx("div",{className:"flex items-center justify-between",children:r.map(n=>i.jsxs(h.Fragment,{children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("div",{className:`flex h-8 w-8 items-center justify-center rounded-full text-sm font-medium ${n<e?"bg-green-500 text-white":n===e?"bg-blue-500 text-white":"bg-gray-200 text-gray-500 dark:bg-gray-700"}`,children:n<e?i.jsx(rr,{className:"h-4 w-4"}):n}),i.jsx("span",{className:"hidden text-sm font-medium text-gray-700 dark:text-gray-300 sm:inline",children:t(n===1?"projectWizard.steps.type":n===2?"projectWizard.steps.configure":"projectWizard.steps.confirm")})]}),n<3&&i.jsx("div",{className:`mx-2 h-1 flex-1 rounded ${n<e?"bg-green-500":"bg-gray-200 dark:bg-gray-700"}`})]},n))})})}const DB=({shouldLoad:e,selectedTokenId:t,onAutoSelectToken:r})=>{const[n,a]=h.useState([]),[s,o]=h.useState(!1),[l,c]=h.useState(null),d=h.useRef(!1);h.useEffect(()=>{if(!e||d.current)return;let p=!1;return(async()=>{o(!0),c(null);try{const m=await yB();if(p)return;a(m),d.current=!0,m.length>0&&!t&&r(String(m[0].id))}catch(m){p||c(m instanceof Error?m.message:"Failed to load GitHub tokens")}finally{p||o(!1)}})(),()=>{p=!0}},[r,t,e]);const u=h.useMemo(()=>n.find(p=>String(p.id)===t)?.credential_name||null,[t,n]);return{tokens:n,loading:s,loadError:l,selectedTokenName:u}},OB={workspaceType:"existing",workspacePath:"",githubUrl:"",subfolderName:"",tokenMode:"stored",selectedGithubToken:"",newGithubToken:""};function MB({onClose:e,onProjectCreated:t}){const{t:r}=Me(),[n,a]=h.useState(1),[s,o]=h.useState(OB),[l,c]=h.useState(!1),[d,u]=h.useState(null),[p,f]=h.useState(""),m=n===2&&QC(s.workspaceType,s.githubUrl),g=h.useCallback(C=>{o(L=>({...L,selectedGithubToken:C}))},[]),{tokens:b,loading:x,loadError:y,selectedTokenName:v}=DB({shouldLoad:m,selectedTokenId:s.selectedGithubToken,onAutoSelectToken:g}),w=h.useCallback((C,L)=>{o(A=>({...A,[C]:L}))},[]),k=h.useCallback(C=>w("workspaceType",C),[w]),E=h.useCallback(C=>w("tokenMode",C),[w]),S=h.useCallback(()=>{if(u(null),n===1){if(!s.workspaceType){u(r("projectWizard.errors.selectType"));return}a(2);return}if(n===2){if(!s.workspacePath.trim()){u(r("projectWizard.errors.providePath"));return}if(s.workspaceType==="subfolder"){const C=s.subfolderName.trim();if(!C){u(r("projectWizard.errors.provideSubfolderName"));return}if(/[\\/]/.test(C)||C==="."||C===".."){u(r("projectWizard.errors.subfolderNameInvalid"));return}}a(3)}},[s.subfolderName,s.workspacePath,s.workspaceType,n,r]),j=h.useCallback(()=>{u(null),a(C=>C>1?C-1:C)},[]),_=h.useCallback(async()=>{c(!0),u(null),f("");try{if($k(s.workspaceType,s.githubUrl)){const A=await SB({workspacePath:s.workspacePath,githubUrl:s.githubUrl,tokenMode:s.tokenMode,selectedGithubToken:s.selectedGithubToken,newGithubToken:s.newGithubToken},{onProgress:f});t?.(A),e();return}const L=await wB({workspaceType:s.workspaceType,path:s.workspacePath.trim(),...s.workspaceType==="subfolder"?{subfolderName:s.subfolderName.trim()}:{}});t?.(L),e()}catch(C){const L=C instanceof Error?C.message:r("projectWizard.errors.failedToCreate");u(L)}finally{c(!1)}},[s,e,t,r]),T=h.useMemo(()=>$k(s.workspaceType,s.githubUrl),[s.githubUrl,s.workspaceType]);return i.jsx("div",{className:"fixed bottom-0 left-0 right-0 top-0 z-[60] flex items-center justify-center bg-black/50 p-0 backdrop-blur-sm sm:p-4",children:i.jsxs("div",{className:"h-full w-full overflow-y-auto rounded-none border-0 border-gray-200 bg-white shadow-xl dark:border-gray-700 dark:bg-gray-800 sm:h-auto sm:max-w-2xl sm:rounded-lg sm:border",children:[i.jsxs("div",{className:"flex items-center justify-between border-b border-gray-200 p-6 dark:border-gray-700",children:[i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsx("div",{className:"flex h-8 w-8 items-center justify-center rounded-lg bg-blue-100 dark:bg-blue-900/50",children:i.jsx(ai,{className:"h-4 w-4 text-blue-600 dark:text-blue-400"})}),i.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white",children:r("projectWizard.title")})]}),i.jsx("button",{onClick:e,className:"rounded-md p-2 text-gray-400 hover:bg-gray-100 hover:text-gray-600 dark:hover:bg-gray-700 dark:hover:text-gray-300",disabled:l,children:i.jsx(xt,{className:"h-5 w-5"})})]}),i.jsx(LB,{step:n}),i.jsxs("div",{className:"min-h-[300px] space-y-6 p-6",children:[d&&i.jsx(pB,{message:d}),n===1&&i.jsx(IB,{workspaceType:s.workspaceType,onWorkspaceTypeChange:k}),n===2&&i.jsx(TB,{workspaceType:s.workspaceType,workspacePath:s.workspacePath,githubUrl:s.githubUrl,subfolderName:s.subfolderName,tokenMode:s.tokenMode,selectedGithubToken:s.selectedGithubToken,newGithubToken:s.newGithubToken,availableTokens:b,loadingTokens:x,tokenLoadError:y,isCreating:l,onWorkspacePathChange:C=>w("workspacePath",C),onGithubUrlChange:C=>w("githubUrl",C),onSubfolderNameChange:C=>w("subfolderName",C),onTokenModeChange:E,onSelectedGithubTokenChange:C=>w("selectedGithubToken",C),onNewGithubTokenChange:C=>w("newGithubToken",C),onAdvanceToConfirm:()=>a(3)}),n===3&&i.jsx(jB,{formState:s,selectedTokenName:v,isCreating:l,cloneProgress:p})]}),i.jsx(RB,{step:n,isCreating:l,isCloneWorkflow:T,onClose:e,onBack:j,onNext:S,onCreate:_})]})})}const PB=eB;function FB(e){return i.jsx(PB,{...e})}function zB({projects:e,showSettings:t,settingsInitialTab:r,onCloseSettings:n,showNewProject:a,onCloseNewProject:s,onProjectCreated:o,deleteConfirmation:l,onCancelDeleteProject:c,onConfirmDeleteProject:d,sessionDeleteConfirmation:u,onCancelDeleteSession:p,onConfirmDeleteSession:f,showVersionModal:m,onCloseVersionModal:g,releaseInfo:b,currentVersion:x,latestVersion:y,installMode:v,isUpdateAvailable:w,t:k}){const E=h.useMemo(()=>e.map(c9),[e]);return i.jsxs(i.Fragment,{children:[a&&Xl.createPortal(i.jsx(MB,{onClose:s,onProjectCreated:o}),document.body),t&&Xl.createPortal(i.jsx(FB,{isOpen:t,onClose:n,projects:E,initialTab:r}),document.body),l&&Xl.createPortal(i.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/60 p-4 backdrop-blur-sm",children:i.jsxs("div",{className:"w-full max-w-md overflow-hidden rounded-xl border border-border bg-card shadow-2xl",children:[i.jsx("div",{className:"p-6",children:i.jsxs("div",{className:"flex items-start gap-4",children:[i.jsx("div",{className:"flex h-12 w-12 flex-shrink-0 items-center justify-center rounded-full bg-orange-100 dark:bg-orange-900/30",children:i.jsx(Tr,{className:"h-6 w-6 text-orange-600 dark:text-orange-400"})}),i.jsxs("div",{className:"min-w-0 flex-1",children:[i.jsx("h3",{className:"mb-2 text-lg font-semibold text-foreground",children:k("deleteConfirmation.deleteProject")}),i.jsxs("p",{className:"mb-1 text-sm text-muted-foreground",children:[k("deleteConfirmation.confirmDelete")," ",i.jsx("span",{className:"font-medium text-foreground",children:l.project.displayName||l.project.name}),"?"]}),l.sessionCount>0&&i.jsx("p",{className:"mt-2 text-sm text-muted-foreground",children:k("deleteConfirmation.sessionCount",{count:l.sessionCount})})]})]})}),i.jsxs("div",{className:"flex flex-col gap-2 border-t border-border bg-muted/30 p-4",children:[i.jsxs(_e,{variant:"outline",className:"w-full justify-start",onClick:()=>d(!1),children:[i.jsx(Af,{className:"mr-2 h-4 w-4"}),k("deleteConfirmation.removeFromSidebar")]}),i.jsxs(_e,{variant:"destructive",className:"w-full justify-start bg-red-600 text-white hover:bg-red-700",onClick:()=>d(!0),children:[i.jsx(kr,{className:"mr-2 h-4 w-4"}),k("deleteConfirmation.deleteAllData")]}),i.jsx(_e,{variant:"ghost",className:"w-full",onClick:c,children:k("actions.cancel")})]})]})}),document.body),u&&Xl.createPortal(i.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/60 p-4 backdrop-blur-sm",children:i.jsxs("div",{className:"w-full max-w-md overflow-hidden rounded-xl border border-border bg-card shadow-2xl",children:[i.jsx("div",{className:"p-6",children:i.jsxs("div",{className:"flex items-start gap-4",children:[i.jsx("div",{className:"flex h-12 w-12 flex-shrink-0 items-center justify-center rounded-full bg-red-100 dark:bg-red-900/30",children:i.jsx(Tr,{className:"h-6 w-6 text-red-600 dark:text-red-400"})}),i.jsxs("div",{className:"min-w-0 flex-1",children:[i.jsx("h3",{className:"mb-2 text-lg font-semibold text-foreground",children:k("deleteConfirmation.deleteSession")}),i.jsxs("p",{className:"mb-1 text-sm text-muted-foreground",children:[k("deleteConfirmation.confirmDelete")," ",i.jsx("span",{className:"font-medium text-foreground",children:u.sessionTitle||k("sessions.unnamed")}),"?"]}),i.jsx("p",{className:"mt-3 text-xs text-muted-foreground",children:k("deleteConfirmation.cannotUndo")})]})]})}),i.jsxs("div",{className:"flex gap-3 border-t border-border bg-muted/30 p-4",children:[i.jsx(_e,{variant:"outline",className:"flex-1",onClick:p,children:k("actions.cancel")}),i.jsxs(_e,{variant:"destructive",className:"flex-1 bg-red-600 text-white hover:bg-red-700",onClick:f,children:[i.jsx(kr,{className:"mr-2 h-4 w-4"}),k("actions.delete")]})]})]})}),document.body),i.jsx(dB,{isOpen:m,onClose:g,releaseInfo:b,currentVersion:x,latestVersion:y,installMode:v,isUpdateAvailable:w})]})}const Uk="pixcode.version.releaseNotes.seenVersion";function Gk({projects:e,selectedProject:t,selectedSession:r,onProjectSelect:n,onSessionSelect:a,onNewSession:s,onProjectCreated:o,onOpenOrchestration:l,onQuickStartSession:c,onSessionDelete:d,onProjectDelete:u,isLoading:p,loadingProgress:f,onRefresh:m,onShowSettings:g,showSettings:b,settingsInitialTab:x,onCloseSettings:y,isMobile:v}){const{t:w}=Me(["sidebar","common"]),{isPWA:k}=Lf({trackMobile:!1}),{updateAvailable:E,latestVersion:S,currentVersion:j,releaseInfo:_,installMode:T}=$E("alicomert","pixcode"),C=h.useRef(null),[L,A]=h.useState(null),{preferences:I,setPreference:N}=Mf(),{sidebarVisible:P,historyView:H}=I,{setCurrentProject:z,mcpServerStatus:U}=eo(),{tasksEnabled:V}=Kd(),{isSidebarCollapsed:O,expandedProjects:G,editingProject:$,showNewProject:F,editingName:te,loadingSessions:Q,initialSessionsLoaded:ge,currentTime:ae,isRefreshing:me,editingSession:pe,editingSessionName:be,searchFilter:Ne,searchMode:xe,setSearchMode:Be,conversationResults:M,isSearching:de,searchProgress:ce,clearConversationResults:Y,deletingProjects:W,deleteConfirmation:ne,sessionDeleteConfirmation:fe,showVersionModal:ye,filteredProjects:se,toggleProject:Se,handleSessionClick:re,toggleStarProject:X,isProjectStarred:Z,toggleStarSession:le,isSessionStarred:Ee,getProjectSessions:Te,startEditing:Ke,cancelEditing:Ze,saveProjectName:vt,showDeleteSessionConfirmation:Qe,confirmDeleteSession:jt,requestProjectDelete:wt,confirmDeleteProject:st,loadMoreSessions:lt,handleProjectSelect:kt,refreshProjects:_t,updateSessionSummary:At,collapseSidebar:pr,expandSidebar:nr,setShowNewProject:Xt,setEditingName:zr,setEditingSession:De,setEditingSessionName:Xe,setSearchFilter:Je,setDeleteConfirmation:ie,setSessionDeleteConfirmation:ke,setShowVersionModal:we}=d9({projects:e,selectedProject:t,selectedSession:r,isLoading:p,isMobile:v,t:w,onRefresh:m,onProjectSelect:n,onSessionSelect:a,onSessionDelete:d,onProjectDelete:u,setCurrentProject:z,setSidebarVisible:He=>N("sidebarVisible",He),sidebarVisible:P});h.useEffect(()=>{const He=()=>Xt(!0);return window.addEventListener("pixcode:create-project",He),()=>{window.removeEventListener("pixcode:create-project",He)}},[Xt]),h.useEffect(()=>{const He=je=>{const Ue=je.detail;A(Ue??null),we(!0)};return window.addEventListener(Jm,He),()=>{window.removeEventListener(Jm,He)}},[we]),h.useEffect(()=>{if(!S||!_||C.current===S)return;const je=(typeof window<"u"?window.localStorage.getItem(Uk):null)===S,Ue=!E&&S===j;(E||Ue&&!je)&&(C.current=S,Ue&&window.localStorage.setItem(Uk,S),A(null),we(!0))},[j,S,_,we,E]),h.useEffect(()=>{typeof document>"u"||(document.documentElement.classList.toggle("pwa-mode",k),document.body.classList.toggle("pwa-mode",k))},[k]);const Ve=He=>{if(He&&o?.(He),window.refreshProjects){window.refreshProjects();return}He||window.location.reload()},et=(He,je)=>{De(He),Xe(je)},Ce=()=>{De(null),Xe("")},Oe=(He,je,Ue,Fe)=>{At(He,je,Ue,Fe)},ct={projects:e,filteredProjects:se,selectedProject:t,selectedSession:r,isLoading:p,loadingProgress:f,expandedProjects:G,editingProject:$,editingName:te,loadingSessions:Q,initialSessionsLoaded:ge,currentTime:ae,editingSession:pe,editingSessionName:be,deletingProjects:W,tasksEnabled:V,mcpServerStatus:U,getProjectSessions:Te,isProjectStarred:Z,isSessionStarred:Ee,onEditingNameChange:zr,onToggleProject:Se,onProjectSelect:kt,onToggleStarProject:X,onToggleStarSession:le,onStartEditingProject:Ke,onCancelEditingProject:Ze,onSaveProjectName:He=>{vt(He)},onDeleteProject:wt,onSessionSelect:re,onDeleteSession:Qe,onLoadMoreSessions:He=>{lt(He)},onNewSession:s,onOpenOrchestration:l,onEditingSessionNameChange:Xe,onStartEditingSession:et,onCancelEditingSession:Ce,onSaveEditingSession:Oe,t:w},Ge={projects:e,filteredProjects:se,selectedSession:r,isLoading:p,loadingProgress:f,currentTime:ae,editingSession:pe,editingSessionName:be,getProjectSessions:Te,isSessionStarred:Ee,onEditingSessionNameChange:Xe,onStartEditingSession:et,onCancelEditingSession:Ce,onSaveEditingSession:Oe,onToggleStarSession:le,onProjectSelect:kt,onSessionSelect:re,onOpenOrchestration:l,onDeleteSession:Qe,t:w};return i.jsxs(i.Fragment,{children:[i.jsx(zB,{projects:e,showSettings:b,settingsInitialTab:x,onCloseSettings:y,showNewProject:F,onCloseNewProject:()=>Xt(!1),onProjectCreated:Ve,deleteConfirmation:ne,onCancelDeleteProject:()=>ie(null),onConfirmDeleteProject:st,sessionDeleteConfirmation:fe,onCancelDeleteSession:()=>ke(null),onConfirmDeleteSession:jt,showVersionModal:ye,onCloseVersionModal:()=>{we(!1),A(null)},releaseInfo:L?.releaseInfo??_,currentVersion:L?.currentVersion??j,latestVersion:L?.latestVersion??S,installMode:T,isUpdateAvailable:L?.updateAvailable??E,t:w}),O?i.jsx(h9,{onExpand:nr,onShowSettings:g,updateAvailable:E,onShowVersionModal:()=>we(!0),t:w}):i.jsx(i.Fragment,{children:i.jsx(rF,{isPWA:k,isMobile:v,isLoading:p,projects:e,searchFilter:Ne,onSearchFilterChange:Je,onClearSearchFilter:()=>Je(""),searchMode:xe,onSearchModeChange:He=>{Be(He),He==="projects"&&Y()},conversationResults:M,isSearching:de,searchProgress:ce,onConversationResultClick:(He,je,Ue,Fe,dt)=>{const ar=Ue||"claude",gr=e.find(ua=>ua.name===He),Et={__searchTargetTimestamp:Fe||null,__searchTargetSnippet:dt||null},In={id:je,__provider:ar,__projectName:He,...Et};if(gr){kt(gr);const Fa=Te(gr).find(zn=>zn.id===je);re(Fa?{...Fa,...Et}:In,He)}else re(In,He)},onRefresh:()=>{_t()},isRefreshing:me,onCreateProject:()=>Xt(!0),onQuickStartSession:c,onCollapseSidebar:pr,updateAvailable:E,releaseInfo:_,latestVersion:S,currentVersion:j,onShowVersionModal:()=>we(!0),onShowSettings:g,projectListProps:ct,flatListProps:Ge,historyView:H,onHistoryViewChange:He=>N("historyView",He),t:w})})]})}const t3=h.createContext(null);function BB(){return h.useContext(t3)}const no={OPTIONS:[{value:"sonnet",label:"Sonnet"},{value:"opus",label:"Opus"},{value:"haiku",label:"Haiku"},{value:"claude-opus-4-6",label:"Opus 4.6"},{value:"opusplan",label:"Opus Plan"},{value:"sonnet[1m]",label:"Sonnet [1M]"},{value:"opus[1m]",label:"Opus [1M]"}],DEFAULT:"opus"},ao={OPTIONS:[{value:"opus-4.6-thinking",label:"Claude 4.6 Opus (Thinking)"},{value:"gpt-5.3-codex",label:"GPT-5.3"},{value:"gpt-5.2-high",label:"GPT-5.2 High"},{value:"gemini-3-pro",label:"Gemini 3 Pro"},{value:"opus-4.5-thinking",label:"Claude 4.5 Opus (Thinking)"},{value:"gpt-5.2",label:"GPT-5.2"},{value:"gpt-5.1",label:"GPT-5.1"},{value:"gpt-5.1-high",label:"GPT-5.1 High"},{value:"composer-1",label:"Composer 1"},{value:"auto",label:"Auto"},{value:"sonnet-4.5",label:"Claude 4.5 Sonnet"},{value:"sonnet-4.5-thinking",label:"Claude 4.5 Sonnet (Thinking)"},{value:"opus-4.5",label:"Claude 4.5 Opus"},{value:"gpt-5.1-codex",label:"GPT-5.1 Codex"},{value:"gpt-5.1-codex-high",label:"GPT-5.1 Codex High"},{value:"gpt-5.1-codex-max",label:"GPT-5.1 Codex Max"},{value:"gpt-5.1-codex-max-high",label:"GPT-5.1 Codex Max High"},{value:"opus-4.1",label:"Claude 4.1 Opus"},{value:"grok",label:"Grok"}],DEFAULT:"gpt-5-3-codex"},io={OPTIONS:[{value:"gpt-5.4",label:"GPT-5.4"},{value:"gpt-5.4-mini",label:"GPT-5.4 mini"},{value:"gpt-5.3-codex",label:"GPT-5.3 Codex"},{value:"gpt-5.2-codex",label:"GPT-5.2 Codex"},{value:"gpt-5.2",label:"GPT-5.2"},{value:"gpt-5.1-codex-max",label:"GPT-5.1 Codex Max"},{value:"o3",label:"O3"},{value:"o4-mini",label:"O4-mini"}],DEFAULT:"gpt-5.4"},so={OPTIONS:[{value:"qwen3-coder-plus",label:"Qwen3 Coder Plus"},{value:"qwen3-coder-next",label:"Qwen3 Coder Next"},{value:"qwen3-coder-480B-A35B-instruct",label:"Qwen3 Coder 480B (Instruct)"},{value:"qwen3-coder-30B-A3B",label:"Qwen3 Coder 30B"},{value:"qwen3.5-plus",label:"Qwen3.5 Plus"},{value:"qwen3-max",label:"Qwen3 Max"},{value:"glm-4.7",label:"GLM-4.7 (Alibaba Coding Plan)"},{value:"kimi-k2.5",label:"Kimi K2.5 (Alibaba Coding Plan)"}],DEFAULT:"qwen3-coder-plus"},oo={OPTIONS:[{value:"opencode/big-pickle",label:"OpenCode Zen · Big Pickle (Free)",free:!0},{value:"opencode/minimax-m2.5-free",label:"OpenCode Zen · MiniMax M2.5 (Free)",free:!0},{value:"opencode/nemotron-3-super-free",label:"OpenCode Zen · Nemotron 3 Super (Free)",free:!0},{value:"opencode/gpt-5-nano",label:"OpenCode Zen · GPT-5 Nano (Free)",free:!0},{value:"anthropic/claude-opus-4-7",label:"Claude Opus 4.7 (Anthropic)"},{value:"anthropic/claude-sonnet-4-6",label:"Claude Sonnet 4.6 (Anthropic)"},{value:"anthropic/claude-haiku-4-5",label:"Claude Haiku 4.5 (Anthropic)"},{value:"openai/gpt-5.4",label:"GPT-5.4 (OpenAI)"},{value:"openai/gpt-5.1-codex",label:"GPT-5.1 Codex (OpenAI)"},{value:"google/gemini-3.1-pro-preview",label:"Gemini 3.1 Pro (Google)"},{value:"google/gemini-3-flash-preview",label:"Gemini 3 Flash (Google)"},{value:"xai/grok-code-fast-1",label:"Grok Code Fast 1 (xAI)"}],DEFAULT:"opencode/big-pickle"},lo={OPTIONS:[{value:"gemini-3.1-pro-preview",label:"Gemini 3.1 Pro Preview"},{value:"gemini-3-pro-preview",label:"Gemini 3 Pro Preview"},{value:"gemini-3-flash-preview",label:"Gemini 3 Flash Preview"},{value:"gemini-2.5-flash",label:"Gemini 2.5 Flash"},{value:"gemini-2.5-pro",label:"Gemini 2.5 Pro"},{value:"gemini-2.0-flash-lite",label:"Gemini 2.0 Flash Lite"},{value:"gemini-2.0-flash",label:"Gemini 2.0 Flash"},{value:"gemini-2.0-pro-exp",label:"Gemini 2.0 Pro Experimental"},{value:"gemini-2.0-flash-thinking-exp",label:"Gemini 2.0 Flash Thinking"}],DEFAULT:"gemini-3.1-pro-preview"},Rp="permissionMode-global",Lp=e=>{const t=localStorage.getItem(e);return t==="default"||t==="acceptEdits"||t==="bypassPermissions"||t==="plan"?t:null};function $B({selectedSession:e}){const[t,r]=h.useState(()=>Lp(Rp)||"default"),[n,a]=h.useState([]),[s,o]=h.useState(()=>localStorage.getItem("selected-provider")||"claude"),[l,c]=h.useState(()=>localStorage.getItem("cursor-model")||ao.DEFAULT),[d,u]=h.useState(()=>localStorage.getItem("claude-model")||no.DEFAULT),[p,f]=h.useState(()=>localStorage.getItem("codex-model")||io.DEFAULT),[m,g]=h.useState(()=>localStorage.getItem("gemini-model")||lo.DEFAULT),[b,x]=h.useState(()=>localStorage.getItem("qwen-model")||so.DEFAULT),[y,v]=h.useState(()=>localStorage.getItem("opencode-model")||oo.DEFAULT),w=h.useRef(s);h.useEffect(()=>{if(!e?.id)return;const S=Lp(`permissionMode-${e.id}`)||Lp(Rp);r(S||"default")},[e?.id]),h.useEffect(()=>{!e?.__provider||e.__provider===s||(o(e.__provider),localStorage.setItem("selected-provider",e.__provider))},[s,e]),h.useEffect(()=>{w.current!==s&&(a([]),w.current=s)},[s]),h.useEffect(()=>{a(S=>S.filter(j=>!j.sessionId||j.sessionId===e?.id))},[e?.id]),h.useEffect(()=>{s==="cursor"&&ve("/api/cursor/config").then(S=>S.json()).then(S=>{if(!S.success||!S.config?.model?.modelId)return;const j=S.config.model.modelId;localStorage.getItem("cursor-model")||c(j)}).catch(S=>{console.error("Error loading Cursor config:",S)})},[s]);const k=h.useCallback(S=>{r(S),localStorage.setItem(Rp,S),e?.id&&localStorage.setItem(`permissionMode-${e.id}`,S)},[e?.id]),E=h.useCallback(()=>{const S=s==="codex"?["default","acceptEdits","bypassPermissions"]:["default","acceptEdits","bypassPermissions","plan"],_=(S.indexOf(t)+1)%S.length,T=S[_];k(T)},[t,s,k]);return{provider:s,setProvider:o,cursorModel:l,setCursorModel:c,claudeModel:d,setClaudeModel:u,codexModel:p,setCodexModel:f,geminiModel:m,setGeminiModel:g,qwenModel:b,setQwenModel:x,opencodeModel:y,setOpencodeModel:v,permissionMode:t,setPermissionMode:k,pendingPermissionRequests:n,setPendingPermissionRequests:a,cyclePermissionMode:E}}const UB=(e,t)=>{const r=e.split(`
308
+ `).trim():"";function pB({message:e}){return i.jsxs("div",{className:"flex items-start gap-3 rounded-lg border border-red-200 bg-red-50 p-4 dark:border-red-800 dark:bg-red-900/20",children:[i.jsx(En,{className:"mt-0.5 h-5 w-5 flex-shrink-0 text-red-600 dark:text-red-400"}),i.jsx("p",{className:"text-sm text-red-800 dark:text-red-200",children:e})]})}const mB=["git@","ssh://"],hB=/^[A-Za-z]:\\?$/,JC=e=>{const t=e.trim();return mB.some(r=>t.startsWith(r))},QC=(e,t)=>e==="new"&&t.trim().length>0&&!JC(t),$k=(e,t)=>e==="new"&&t.trim().length>0,fB=e=>{const t=e.trim(),r=Math.max(t.lastIndexOf("/"),t.lastIndexOf("\\"));return r===2&&/^[A-Za-z]:/.test(t)?`${t.slice(0,2)}\\`:r>0?t.slice(0,r):"~"},gB=e=>{if(e==="~"||e==="/"||hB.test(e))return null;const t=Math.max(e.lastIndexOf("/"),e.lastIndexOf("\\"));return t<=0?"/":t===2&&/^[A-Za-z]:/.test(e)?`${e.slice(0,2)}\\`:e.slice(0,t)},bB=(e,t)=>{const r=e.trim().replace(/[\\/]+$/,""),n=r.includes("\\")&&!r.includes("/")?"\\":"/";return`${r}${n}${t.trim()}`},Ip=(e,t)=>`px-3 py-2 text-sm font-medium rounded-lg transition-colors ${e===t?e==="none"?"bg-green-500 text-white":"bg-blue-500 text-white":"bg-gray-200 dark:bg-gray-700 text-gray-700 dark:text-gray-300"}`;function xB({tokenMode:e,selectedGithubToken:t,newGithubToken:r,availableTokens:n,loadingTokens:a,tokenLoadError:s,onTokenModeChange:o,onSelectedGithubTokenChange:l,onNewGithubTokenChange:c}){const{t:d}=Me();return i.jsxs("div",{className:"rounded-lg border border-gray-200 bg-gray-50 p-4 dark:border-gray-700 dark:bg-gray-900/50",children:[i.jsxs("div",{className:"mb-4 flex items-start gap-3",children:[i.jsx(Wd,{className:"mt-0.5 h-5 w-5 flex-shrink-0 text-gray-600 dark:text-gray-400"}),i.jsxs("div",{className:"flex-1",children:[i.jsx("h5",{className:"mb-1 font-medium text-gray-900 dark:text-white",children:d("projectWizard.step2.githubAuth")}),i.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400",children:d("projectWizard.step2.githubAuthHelp")})]})]}),a&&i.jsxs("div",{className:"flex items-center gap-2 text-sm text-gray-500",children:[i.jsx(Ot,{className:"h-4 w-4 animate-spin"}),d("projectWizard.step2.loadingTokens")]}),!a&&s&&i.jsx("p",{className:"mb-3 text-sm text-red-600 dark:text-red-400",children:s}),!a&&n.length>0&&i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:"mb-4 grid grid-cols-3 gap-2",children:[i.jsx("button",{onClick:()=>o("stored"),className:Ip(e,"stored"),children:d("projectWizard.step2.storedToken")}),i.jsx("button",{onClick:()=>o("new"),className:Ip(e,"new"),children:d("projectWizard.step2.newToken")}),i.jsx("button",{onClick:()=>{o("none"),l(""),c("")},className:Ip(e,"none"),children:d("projectWizard.step2.nonePublic")})]}),e==="stored"?i.jsxs("div",{children:[i.jsx("label",{className:"mb-2 block text-sm font-medium text-gray-700 dark:text-gray-300",children:d("projectWizard.step2.selectToken")}),i.jsxs("select",{value:t,onChange:u=>l(u.target.value),className:"w-full rounded-lg border border-gray-300 bg-white px-3 py-2 text-sm dark:border-gray-600 dark:bg-gray-800",children:[i.jsx("option",{value:"",children:d("projectWizard.step2.selectTokenPlaceholder")}),n.map(u=>i.jsx("option",{value:String(u.id),children:u.credential_name},u.id))]})]}):e==="new"?i.jsxs("div",{children:[i.jsx("label",{className:"mb-2 block text-sm font-medium text-gray-700 dark:text-gray-300",children:d("projectWizard.step2.newToken")}),i.jsx(Nt,{type:"password",value:r,onChange:u=>c(u.target.value),placeholder:"ghp_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",className:"w-full"}),i.jsx("p",{className:"mt-1 text-xs text-gray-500 dark:text-gray-400",children:d("projectWizard.step2.tokenHelp")})]}):null]}),!a&&n.length===0&&i.jsxs("div",{className:"space-y-4",children:[i.jsx("div",{className:"rounded-lg border border-blue-200 bg-blue-50 p-3 dark:border-blue-800 dark:bg-blue-900/20",children:i.jsx("p",{className:"text-sm text-blue-800 dark:text-blue-200",children:d("projectWizard.step2.publicRepoInfo")})}),i.jsxs("div",{children:[i.jsx("label",{className:"mb-2 block text-sm font-medium text-gray-700 dark:text-gray-300",children:d("projectWizard.step2.optionalTokenPublic")}),i.jsx(Nt,{type:"password",value:r,onChange:u=>{const p=u.target.value;c(p),o(p.trim()?"new":"none")},placeholder:d("projectWizard.step2.tokenPublicPlaceholder"),className:"w-full"}),i.jsx("p",{className:"mt-1 text-xs text-gray-500 dark:text-gray-400",children:d("projectWizard.step2.noTokensHelp")})]})]})]})}const au=async e=>await e.json(),yB=async()=>{const e=await ot.get("/settings/credentials?type=github_token"),t=await au(e);if(!e.ok)throw new Error(t.error||"Failed to load GitHub tokens");return(t.credentials||[]).filter(r=>r.is_active)},e3=async e=>{const t=`/browse-filesystem?path=${encodeURIComponent(e)}`,r=await ot.get(t),n=await au(r);if(!r.ok)throw new Error(n.error||"Failed to browse filesystem");return{path:n.path||e,rootPath:n.rootPath||n.path||e,suggestions:n.suggestions||[]}},vB=async e=>{const t=await ot.createFolder(e),r=await au(t);if(!t.ok)throw new Error(r.error||"Failed to create folder");return r.path||e},wB=async e=>{const t=await ot.createWorkspace(e),r=await au(t);if(!t.ok)throw new Error(r.details||r.error||"Failed to create workspace");return r.project},kB=({workspacePath:e,githubUrl:t,tokenMode:r,selectedGithubToken:n,newGithubToken:a})=>{const s=new URLSearchParams({path:e.trim(),githubUrl:t.trim()});r==="stored"&&n&&s.set("githubTokenId",n),r==="new"&&a.trim()&&s.set("newGithubToken",a.trim());const o=localStorage.getItem("auth-token");return o&&s.set("token",o),s.toString()},SB=(e,t)=>new Promise((r,n)=>{const a=kB(e),s=new EventSource(`/api/projects/clone-progress?${a}`);let o=!1;const l=c=>{o||(o=!0,s.close(),c())};s.onmessage=c=>{try{const d=JSON.parse(c.data);if(d.type==="progress"&&d.message){t.onProgress(d.message);return}if(d.type==="complete"){l(()=>r(d.project));return}d.type==="error"&&l(()=>n(new Error(d.message||"Failed to clone repository")))}catch(d){console.error("Error parsing clone progress event:",d)}},s.onerror=()=>{l(()=>n(new Error("Connection lost during clone")))}});function EB({isOpen:e,autoAdvanceOnSelect:t,onClose:r,onFolderSelected:n}){const[a,s]=h.useState("~"),[o,l]=h.useState("~"),[c,d]=h.useState("~"),[u,p]=h.useState([]),[f,m]=h.useState(!1),[g,b]=h.useState(!1),[x,y]=h.useState(!1),[v,w]=h.useState(""),[k,E]=h.useState(!1),[S,j]=h.useState(null),_=h.useCallback(async N=>{m(!0),j(null);try{const P=await e3(N);s(P.path),d(P.path),l(P.rootPath),p(P.suggestions)}catch(P){j(P instanceof Error?P.message:"Failed to load folders")}finally{m(!1)}},[]);h.useEffect(()=>{e&&_("~")},[e,_]);const T=h.useMemo(()=>u.filter(N=>g||!N.name.startsWith(".")).sort((N,P)=>N.name.toLowerCase().localeCompare(P.name.toLowerCase())),[u,g]),C=()=>{y(!1),w("")},L=()=>{j(null),C(),r()},A=h.useCallback(async()=>{if(v.trim()){E(!0),j(null);try{const N=bB(a,v),P=await vB(N);C(),await _(P)}catch(N){j(N instanceof Error?N.message:"Failed to create folder")}finally{E(!1)}}},[a,_,v]),I=a===o?null:gB(a);return e?i.jsx("div",{className:"fixed inset-0 z-[70] flex items-center justify-center bg-black/50 p-4 backdrop-blur-sm",children:i.jsxs("div",{className:"flex max-h-[80vh] w-full max-w-2xl flex-col rounded-lg border border-gray-200 bg-white shadow-xl dark:border-gray-700 dark:bg-gray-800",children:[i.jsxs("div",{className:"flex items-center justify-between border-b border-gray-200 p-4 dark:border-gray-700",children:[i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsx("div",{className:"flex h-8 w-8 items-center justify-center rounded-lg bg-blue-100 dark:bg-blue-900/50",children:i.jsx(Sa,{className:"h-4 w-4 text-blue-600 dark:text-blue-400"})}),i.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white",children:"Select Folder"})]}),i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("button",{onClick:()=>b(N=>!N),className:`rounded-md p-2 transition-colors ${g?"bg-blue-50 text-blue-600 dark:bg-blue-900/30 dark:text-blue-400":"text-gray-400 hover:bg-gray-100 hover:text-gray-600 dark:hover:bg-gray-700 dark:hover:text-gray-300"}`,title:g?"Hide hidden folders":"Show hidden folders",children:g?i.jsx(Yi,{className:"h-5 w-5"}):i.jsx(Af,{className:"h-5 w-5"})}),i.jsx("button",{onClick:()=>y(N=>!N),className:`rounded-md p-2 transition-colors ${x?"bg-blue-50 text-blue-600 dark:bg-blue-900/30 dark:text-blue-400":"text-gray-400 hover:bg-gray-100 hover:text-gray-600 dark:hover:bg-gray-700 dark:hover:text-gray-300"}`,title:"Create new folder",children:i.jsx(Ut,{className:"h-5 w-5"})}),i.jsx("button",{onClick:L,className:"rounded-md p-2 text-gray-400 hover:bg-gray-100 hover:text-gray-600 dark:hover:bg-gray-700 dark:hover:text-gray-300",children:i.jsx(xt,{className:"h-5 w-5"})})]})]}),x&&i.jsx("div",{className:"border-b border-gray-200 bg-blue-50 px-4 py-3 dark:border-gray-700 dark:bg-blue-900/20",children:i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx(Nt,{type:"text",value:v,onChange:N=>w(N.target.value),placeholder:"New folder name",className:"flex-1",onKeyDown:N=>{N.key==="Enter"&&A(),N.key==="Escape"&&C()},autoFocus:!0}),i.jsx(_e,{size:"sm",onClick:A,disabled:!v.trim()||k,children:k?i.jsx(Ot,{className:"h-4 w-4 animate-spin"}):"Create"}),i.jsx(_e,{size:"sm",variant:"ghost",onClick:C,children:"Cancel"})]})}),S&&i.jsx("div",{className:"px-4 pt-3",children:i.jsx("p",{className:"text-sm text-red-600 dark:text-red-400",children:S})}),i.jsx("div",{className:"flex-1 overflow-y-auto p-4",children:f?i.jsx("div",{className:"flex items-center justify-center py-8",children:i.jsx(Ot,{className:"h-6 w-6 animate-spin text-gray-400"})}):i.jsxs("div",{className:"space-y-1",children:[I&&i.jsxs("button",{onClick:()=>_(I),className:"flex w-full items-center gap-3 rounded-lg px-4 py-3 text-left hover:bg-gray-100 dark:hover:bg-gray-700",children:[i.jsx(Sa,{className:"h-5 w-5 text-gray-400"}),i.jsx("span",{className:"font-medium text-gray-700 dark:text-gray-300",children:".."})]}),T.length===0?i.jsx("div",{className:"py-8 text-center text-gray-500 dark:text-gray-400",children:"No subfolders found"}):T.map(N=>i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsxs("button",{onClick:()=>_(N.path),className:"flex flex-1 items-center gap-3 rounded-lg px-4 py-3 text-left hover:bg-gray-100 dark:hover:bg-gray-700",children:[i.jsx(ai,{className:"h-5 w-5 text-blue-500"}),i.jsx("span",{className:"font-medium text-gray-900 dark:text-white",children:N.name})]}),i.jsx(_e,{variant:"ghost",size:"sm",onClick:()=>n(N.path,t),className:"px-3 text-xs",children:"Select"})]},N.path))]})}),i.jsxs("div",{className:"border-t border-gray-200 dark:border-gray-700",children:[i.jsxs("div",{className:"flex items-center gap-2 bg-gray-50 px-4 py-3 dark:bg-gray-900/50",children:[i.jsx("span",{className:"text-sm text-gray-600 dark:text-gray-400",children:"Path:"}),i.jsx(Nt,{type:"text",value:c,onChange:N=>d(N.target.value),onKeyDown:N=>{if(N.key==="Enter"){N.preventDefault();const P=c.trim();P&&_(P)}N.key==="Escape"&&d(a)},placeholder:"Type a path (e.g. D:\\\\Projects) and press Enter",className:"flex-1 font-mono text-sm"})]}),i.jsxs("div",{className:"flex items-center justify-end gap-2 p-4",children:[i.jsx(_e,{variant:"outline",onClick:L,children:"Cancel"}),i.jsx(_e,{variant:"outline",onClick:()=>n(a,t),children:"Use this folder"})]})]})]})}):null}function NB({workspaceType:e,value:t,disabled:r=!1,onChange:n,onAdvanceToConfirm:a}){const[s,o]=h.useState([]),[l,c]=h.useState(!1),[d,u]=h.useState(!1);h.useEffect(()=>{if(t.trim().length<=2){o([]),c(!1);return}const m=window.setTimeout(async()=>{try{const g=fB(t),b=await e3(g),x=t.toLowerCase(),y=b.suggestions.filter(v=>{const w=v.path.toLowerCase();return w.startsWith(x)&&w!==x}).slice(0,5);o(y),c(y.length>0)}catch(g){console.error("Failed to load path suggestions:",g)}},200);return()=>{window.clearTimeout(m)}},[t]);const p=h.useCallback(m=>{n(m.path),c(!1)},[n]),f=h.useCallback((m,g)=>{n(m),u(!1),g&&a()},[a,n]);return i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:"relative flex gap-2",children:[i.jsxs("div",{className:"relative flex-1",children:[i.jsx(Nt,{type:"text",value:t,onChange:m=>n(m.target.value),placeholder:e==="existing"?"my-existing-project or /absolute/path":"my-new-project or /absolute/path",className:"w-full",disabled:r}),l&&s.length>0&&i.jsx("div",{className:"absolute z-10 mt-1 max-h-60 w-full overflow-y-auto rounded-lg border border-gray-200 bg-white shadow-lg dark:border-gray-700 dark:bg-gray-800",children:s.map(m=>i.jsxs("button",{onClick:()=>p(m),className:"w-full px-4 py-2 text-left text-sm hover:bg-gray-100 dark:hover:bg-gray-700",children:[i.jsx("div",{className:"font-medium text-gray-900 dark:text-white",children:m.name}),i.jsx("div",{className:"text-xs text-gray-500 dark:text-gray-400",children:m.path})]},m.path))})]}),i.jsx(_e,{type:"button",variant:"outline",onClick:()=>u(!0),className:"px-3",title:"Browse folders",disabled:r,children:i.jsx(Sa,{className:"h-4 w-4"})})]}),i.jsx(EB,{isOpen:d,autoAdvanceOnSelect:e==="existing",onClose:()=>u(!1),onFolderSelected:f})]})}const CB={existing:"projectWizard.step2.existingPath",new:"projectWizard.step2.newPath",subfolder:"projectWizard.step2.subfolderParentPath"},AB={existing:"projectWizard.step2.existingHelp",new:"projectWizard.step2.newHelp",subfolder:"projectWizard.step2.subfolderParentHelp"};function TB({workspaceType:e,workspacePath:t,githubUrl:r,subfolderName:n,tokenMode:a,selectedGithubToken:s,newGithubToken:o,availableTokens:l,loadingTokens:c,tokenLoadError:d,isCreating:u,onWorkspacePathChange:p,onGithubUrlChange:f,onSubfolderNameChange:m,onTokenModeChange:g,onSelectedGithubTokenChange:b,onNewGithubTokenChange:x,onAdvanceToConfirm:y}){const{t:v}=Me(),w=QC(e,r);return i.jsxs("div",{className:"space-y-4",children:[i.jsxs("div",{children:[i.jsx("label",{className:"mb-2 block text-sm font-medium text-gray-700 dark:text-gray-300",children:v(CB[e])}),i.jsx(NB,{workspaceType:e,value:t,disabled:u,onChange:p,onAdvanceToConfirm:y}),i.jsx("p",{className:"mt-1 text-xs text-gray-500 dark:text-gray-400",children:v(AB[e])})]}),e==="subfolder"&&i.jsxs("div",{children:[i.jsx("label",{className:"mb-2 block text-sm font-medium text-gray-700 dark:text-gray-300",children:v("projectWizard.step2.subfolderName")}),i.jsx(Nt,{type:"text",value:n,onChange:k=>m(k.target.value),placeholder:"my-new-app",className:"w-full",disabled:u}),i.jsx("p",{className:"mt-1 text-xs text-gray-500 dark:text-gray-400",children:v("projectWizard.step2.subfolderNameHelp")})]}),e==="new"&&i.jsxs(i.Fragment,{children:[i.jsxs("div",{children:[i.jsx("label",{className:"mb-2 block text-sm font-medium text-gray-700 dark:text-gray-300",children:v("projectWizard.step2.githubUrl")}),i.jsx(Nt,{type:"text",value:r,onChange:k=>f(k.target.value),placeholder:"https://github.com/username/repository",className:"w-full",disabled:u}),i.jsx("p",{className:"mt-1 text-xs text-gray-500 dark:text-gray-400",children:v("projectWizard.step2.githubHelp")})]}),w&&i.jsx(xB,{tokenMode:a,selectedGithubToken:s,newGithubToken:o,availableTokens:l,loadingTokens:c,tokenLoadError:d,onTokenModeChange:g,onSelectedGithubTokenChange:b,onNewGithubTokenChange:x})]})]})}function jB({formState:e,selectedTokenName:t,isCreating:r,cloneProgress:n}){const{t:a}=Me(),s=h.useMemo(()=>e.tokenMode==="stored"&&e.selectedGithubToken?`${a("projectWizard.step3.usingStoredToken")} ${t||"Unknown"}`:e.tokenMode==="new"&&e.newGithubToken.trim()?a("projectWizard.step3.usingProvidedToken"):JC(e.githubUrl)?a("projectWizard.step3.sshKey",{defaultValue:"SSH Key"}):a("projectWizard.step3.noAuthentication"),[e,t,a]);return i.jsxs("div",{className:"space-y-4",children:[i.jsxs("div",{className:"rounded-lg border border-gray-200 bg-gray-50 p-4 dark:border-gray-700 dark:bg-gray-900/50",children:[i.jsx("h4",{className:"mb-3 text-sm font-semibold text-gray-900 dark:text-white",children:a("projectWizard.step3.reviewConfig")}),i.jsxs("div",{className:"space-y-2",children:[i.jsxs("div",{className:"flex justify-between text-sm",children:[i.jsx("span",{className:"text-gray-600 dark:text-gray-400",children:a("projectWizard.step3.workspaceType")}),i.jsx("span",{className:"font-medium text-gray-900 dark:text-white",children:e.workspaceType==="existing"?a("projectWizard.step3.existingWorkspace"):e.workspaceType==="subfolder"?a("projectWizard.step3.subfolderWorkspace"):a("projectWizard.step3.newWorkspace")})]}),i.jsxs("div",{className:"flex justify-between text-sm",children:[i.jsx("span",{className:"text-gray-600 dark:text-gray-400",children:e.workspaceType==="subfolder"?a("projectWizard.step3.parentPath"):a("projectWizard.step3.path")}),i.jsx("span",{className:"break-all font-mono text-xs text-gray-900 dark:text-white",children:e.workspacePath})]}),e.workspaceType==="subfolder"&&e.subfolderName&&i.jsxs("div",{className:"flex justify-between text-sm",children:[i.jsx("span",{className:"text-gray-600 dark:text-gray-400",children:a("projectWizard.step3.subfolderName")}),i.jsx("span",{className:"break-all font-mono text-xs text-gray-900 dark:text-white",children:e.subfolderName})]}),e.workspaceType==="new"&&e.githubUrl&&i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:"flex justify-between text-sm",children:[i.jsx("span",{className:"text-gray-600 dark:text-gray-400",children:a("projectWizard.step3.cloneFrom")}),i.jsx("span",{className:"break-all font-mono text-xs text-gray-900 dark:text-white",children:e.githubUrl})]}),i.jsxs("div",{className:"flex justify-between text-sm",children:[i.jsx("span",{className:"text-gray-600 dark:text-gray-400",children:a("projectWizard.step3.authentication")}),i.jsx("span",{className:"text-xs text-gray-900 dark:text-white",children:s})]})]})]})]}),i.jsx("div",{className:"rounded-lg border border-blue-200 bg-blue-50 p-4 dark:border-blue-800 dark:bg-blue-900/20",children:r&&n?i.jsxs("div",{className:"space-y-2",children:[i.jsx("p",{className:"text-sm font-medium text-blue-800 dark:text-blue-200",children:a("projectWizard.step3.cloningRepository",{defaultValue:"Cloning repository..."})}),i.jsx("code",{className:"block whitespace-pre-wrap break-all font-mono text-xs text-blue-700 dark:text-blue-300",children:n})]}):i.jsx("p",{className:"text-sm text-blue-800 dark:text-blue-200",children:e.workspaceType==="existing"?a("projectWizard.step3.existingInfo"):e.workspaceType==="subfolder"?a("projectWizard.step3.subfolderInfo"):e.githubUrl?a("projectWizard.step3.newWithClone"):a("projectWizard.step3.newEmpty")})})]})}const _B=[{id:"existing",iconKey:"folderOpen",i18nKey:"existing",accent:{active:"border-blue-500 bg-blue-50 dark:bg-blue-900/20",tint:"border-gray-200 hover:border-gray-300 dark:border-gray-700 dark:hover:border-gray-600",iconBg:"bg-blue-100 dark:bg-blue-900/50",iconFg:"text-blue-600 dark:text-blue-400"}},{id:"new",iconKey:"gitBranch",i18nKey:"githubClone",accent:{active:"border-blue-500 bg-blue-50 dark:bg-blue-900/20",tint:"border-gray-200 hover:border-gray-300 dark:border-gray-700 dark:hover:border-gray-600",iconBg:"bg-purple-100 dark:bg-purple-900/50",iconFg:"text-purple-600 dark:text-purple-400"}},{id:"subfolder",iconKey:"folderPlus",i18nKey:"subfolder",accent:{active:"border-blue-500 bg-blue-50 dark:bg-blue-900/20",tint:"border-gray-200 hover:border-gray-300 dark:border-gray-700 dark:hover:border-gray-600",iconBg:"bg-green-100 dark:bg-green-900/50",iconFg:"text-green-600 dark:text-green-400"}}];function IB({workspaceType:e,onWorkspaceTypeChange:t}){const{t:r}=Me();return i.jsxs("div",{className:"space-y-4",children:[i.jsx("h4",{className:"mb-3 text-sm font-medium text-gray-700 dark:text-gray-300",children:r("projectWizard.step1.question")}),i.jsx("div",{className:"grid grid-cols-1 gap-4 md:grid-cols-3",children:_B.map(n=>{const a=e===n.id,s=n.iconKey==="folderOpen"?Sa:n.iconKey==="gitBranch"?Qr:ai;return i.jsx("button",{onClick:()=>t(n.id),className:`rounded-lg border-2 p-4 text-left transition-all ${a?n.accent.active:n.accent.tint}`,children:i.jsxs("div",{className:"flex items-start gap-3",children:[i.jsx("div",{className:`flex h-10 w-10 flex-shrink-0 items-center justify-center rounded-lg ${n.accent.iconBg}`,children:i.jsx(s,{className:`h-5 w-5 ${n.accent.iconFg}`})}),i.jsxs("div",{className:"flex-1",children:[i.jsx("h5",{className:"mb-1 font-semibold text-gray-900 dark:text-white",children:r(`projectWizard.step1.${n.i18nKey}.title`)}),i.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400",children:r(`projectWizard.step1.${n.i18nKey}.description`)})]})]})},n.id)})})]})}function RB({step:e,isCreating:t,isCloneWorkflow:r,onClose:n,onBack:a,onNext:s,onCreate:o}){const{t:l}=Me();return i.jsxs("div",{className:"flex items-center justify-between border-t border-gray-200 p-6 dark:border-gray-700",children:[i.jsx(_e,{variant:"outline",onClick:e===1?n:a,disabled:t,children:e===1?l("projectWizard.buttons.cancel"):i.jsxs(i.Fragment,{children:[i.jsx(Sf,{className:"mr-1 h-4 w-4"}),l("projectWizard.buttons.back")]})}),i.jsx(_e,{onClick:e===3?o:s,disabled:t,children:t?i.jsxs(i.Fragment,{children:[i.jsx(Ot,{className:"mr-2 h-4 w-4 animate-spin"}),r?l("projectWizard.buttons.cloning",{defaultValue:"Cloning..."}):l("projectWizard.buttons.creating")]}):e===3?i.jsxs(i.Fragment,{children:[i.jsx(rr,{className:"mr-1 h-4 w-4"}),l("projectWizard.buttons.createProject")]}):i.jsxs(i.Fragment,{children:[l("projectWizard.buttons.next"),i.jsx(An,{className:"ml-1 h-4 w-4"})]})})]})}function LB({step:e}){const{t}=Me(),r=[1,2,3];return i.jsx("div",{className:"px-6 pb-2 pt-4",children:i.jsx("div",{className:"flex items-center justify-between",children:r.map(n=>i.jsxs(h.Fragment,{children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("div",{className:`flex h-8 w-8 items-center justify-center rounded-full text-sm font-medium ${n<e?"bg-green-500 text-white":n===e?"bg-blue-500 text-white":"bg-gray-200 text-gray-500 dark:bg-gray-700"}`,children:n<e?i.jsx(rr,{className:"h-4 w-4"}):n}),i.jsx("span",{className:"hidden text-sm font-medium text-gray-700 dark:text-gray-300 sm:inline",children:t(n===1?"projectWizard.steps.type":n===2?"projectWizard.steps.configure":"projectWizard.steps.confirm")})]}),n<3&&i.jsx("div",{className:`mx-2 h-1 flex-1 rounded ${n<e?"bg-green-500":"bg-gray-200 dark:bg-gray-700"}`})]},n))})})}const DB=({shouldLoad:e,selectedTokenId:t,onAutoSelectToken:r})=>{const[n,a]=h.useState([]),[s,o]=h.useState(!1),[l,c]=h.useState(null),d=h.useRef(!1);h.useEffect(()=>{if(!e||d.current)return;let p=!1;return(async()=>{o(!0),c(null);try{const m=await yB();if(p)return;a(m),d.current=!0,m.length>0&&!t&&r(String(m[0].id))}catch(m){p||c(m instanceof Error?m.message:"Failed to load GitHub tokens")}finally{p||o(!1)}})(),()=>{p=!0}},[r,t,e]);const u=h.useMemo(()=>n.find(p=>String(p.id)===t)?.credential_name||null,[t,n]);return{tokens:n,loading:s,loadError:l,selectedTokenName:u}},OB={workspaceType:"existing",workspacePath:"",githubUrl:"",subfolderName:"",tokenMode:"stored",selectedGithubToken:"",newGithubToken:""};function MB({onClose:e,onProjectCreated:t}){const{t:r}=Me(),[n,a]=h.useState(1),[s,o]=h.useState(OB),[l,c]=h.useState(!1),[d,u]=h.useState(null),[p,f]=h.useState(""),m=n===2&&QC(s.workspaceType,s.githubUrl),g=h.useCallback(C=>{o(L=>({...L,selectedGithubToken:C}))},[]),{tokens:b,loading:x,loadError:y,selectedTokenName:v}=DB({shouldLoad:m,selectedTokenId:s.selectedGithubToken,onAutoSelectToken:g}),w=h.useCallback((C,L)=>{o(A=>({...A,[C]:L}))},[]),k=h.useCallback(C=>w("workspaceType",C),[w]),E=h.useCallback(C=>w("tokenMode",C),[w]),S=h.useCallback(()=>{if(u(null),n===1){if(!s.workspaceType){u(r("projectWizard.errors.selectType"));return}a(2);return}if(n===2){if(!s.workspacePath.trim()){u(r("projectWizard.errors.providePath"));return}if(s.workspaceType==="subfolder"){const C=s.subfolderName.trim();if(!C){u(r("projectWizard.errors.provideSubfolderName"));return}if(/[\\/]/.test(C)||C==="."||C===".."){u(r("projectWizard.errors.subfolderNameInvalid"));return}}a(3)}},[s.subfolderName,s.workspacePath,s.workspaceType,n,r]),j=h.useCallback(()=>{u(null),a(C=>C>1?C-1:C)},[]),_=h.useCallback(async()=>{c(!0),u(null),f("");try{if($k(s.workspaceType,s.githubUrl)){const A=await SB({workspacePath:s.workspacePath,githubUrl:s.githubUrl,tokenMode:s.tokenMode,selectedGithubToken:s.selectedGithubToken,newGithubToken:s.newGithubToken},{onProgress:f});t?.(A),e();return}const L=await wB({workspaceType:s.workspaceType,path:s.workspacePath.trim(),...s.workspaceType==="subfolder"?{subfolderName:s.subfolderName.trim()}:{}});t?.(L),e()}catch(C){const L=C instanceof Error?C.message:r("projectWizard.errors.failedToCreate");u(L)}finally{c(!1)}},[s,e,t,r]),T=h.useMemo(()=>$k(s.workspaceType,s.githubUrl),[s.githubUrl,s.workspaceType]);return i.jsx("div",{className:"fixed bottom-0 left-0 right-0 top-0 z-[60] flex items-center justify-center bg-black/50 p-0 backdrop-blur-sm sm:p-4",children:i.jsxs("div",{className:"h-full w-full overflow-y-auto rounded-none border-0 border-gray-200 bg-white shadow-xl dark:border-gray-700 dark:bg-gray-800 sm:h-auto sm:max-w-2xl sm:rounded-lg sm:border",children:[i.jsxs("div",{className:"flex items-center justify-between border-b border-gray-200 p-6 dark:border-gray-700",children:[i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsx("div",{className:"flex h-8 w-8 items-center justify-center rounded-lg bg-blue-100 dark:bg-blue-900/50",children:i.jsx(ai,{className:"h-4 w-4 text-blue-600 dark:text-blue-400"})}),i.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white",children:r("projectWizard.title")})]}),i.jsx("button",{onClick:e,className:"rounded-md p-2 text-gray-400 hover:bg-gray-100 hover:text-gray-600 dark:hover:bg-gray-700 dark:hover:text-gray-300",disabled:l,children:i.jsx(xt,{className:"h-5 w-5"})})]}),i.jsx(LB,{step:n}),i.jsxs("div",{className:"min-h-[300px] space-y-6 p-6",children:[d&&i.jsx(pB,{message:d}),n===1&&i.jsx(IB,{workspaceType:s.workspaceType,onWorkspaceTypeChange:k}),n===2&&i.jsx(TB,{workspaceType:s.workspaceType,workspacePath:s.workspacePath,githubUrl:s.githubUrl,subfolderName:s.subfolderName,tokenMode:s.tokenMode,selectedGithubToken:s.selectedGithubToken,newGithubToken:s.newGithubToken,availableTokens:b,loadingTokens:x,tokenLoadError:y,isCreating:l,onWorkspacePathChange:C=>w("workspacePath",C),onGithubUrlChange:C=>w("githubUrl",C),onSubfolderNameChange:C=>w("subfolderName",C),onTokenModeChange:E,onSelectedGithubTokenChange:C=>w("selectedGithubToken",C),onNewGithubTokenChange:C=>w("newGithubToken",C),onAdvanceToConfirm:()=>a(3)}),n===3&&i.jsx(jB,{formState:s,selectedTokenName:v,isCreating:l,cloneProgress:p})]}),i.jsx(RB,{step:n,isCreating:l,isCloneWorkflow:T,onClose:e,onBack:j,onNext:S,onCreate:_})]})})}const PB=eB;function FB(e){return i.jsx(PB,{...e})}function zB({projects:e,showSettings:t,settingsInitialTab:r,onCloseSettings:n,showNewProject:a,onCloseNewProject:s,onProjectCreated:o,deleteConfirmation:l,onCancelDeleteProject:c,onConfirmDeleteProject:d,sessionDeleteConfirmation:u,onCancelDeleteSession:p,onConfirmDeleteSession:f,showVersionModal:m,onCloseVersionModal:g,releaseInfo:b,currentVersion:x,latestVersion:y,installMode:v,isUpdateAvailable:w,t:k}){const E=h.useMemo(()=>e.map(cO),[e]);return i.jsxs(i.Fragment,{children:[a&&Xl.createPortal(i.jsx(MB,{onClose:s,onProjectCreated:o}),document.body),t&&Xl.createPortal(i.jsx(FB,{isOpen:t,onClose:n,projects:E,initialTab:r}),document.body),l&&Xl.createPortal(i.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/60 p-4 backdrop-blur-sm",children:i.jsxs("div",{className:"w-full max-w-md overflow-hidden rounded-xl border border-border bg-card shadow-2xl",children:[i.jsx("div",{className:"p-6",children:i.jsxs("div",{className:"flex items-start gap-4",children:[i.jsx("div",{className:"flex h-12 w-12 flex-shrink-0 items-center justify-center rounded-full bg-orange-100 dark:bg-orange-900/30",children:i.jsx(Tr,{className:"h-6 w-6 text-orange-600 dark:text-orange-400"})}),i.jsxs("div",{className:"min-w-0 flex-1",children:[i.jsx("h3",{className:"mb-2 text-lg font-semibold text-foreground",children:k("deleteConfirmation.deleteProject")}),i.jsxs("p",{className:"mb-1 text-sm text-muted-foreground",children:[k("deleteConfirmation.confirmDelete")," ",i.jsx("span",{className:"font-medium text-foreground",children:l.project.displayName||l.project.name}),"?"]}),l.sessionCount>0&&i.jsx("p",{className:"mt-2 text-sm text-muted-foreground",children:k("deleteConfirmation.sessionCount",{count:l.sessionCount})})]})]})}),i.jsxs("div",{className:"flex flex-col gap-2 border-t border-border bg-muted/30 p-4",children:[i.jsxs(_e,{variant:"outline",className:"w-full justify-start",onClick:()=>d(!1),children:[i.jsx(Af,{className:"mr-2 h-4 w-4"}),k("deleteConfirmation.removeFromSidebar")]}),i.jsxs(_e,{variant:"destructive",className:"w-full justify-start bg-red-600 text-white hover:bg-red-700",onClick:()=>d(!0),children:[i.jsx(kr,{className:"mr-2 h-4 w-4"}),k("deleteConfirmation.deleteAllData")]}),i.jsx(_e,{variant:"ghost",className:"w-full",onClick:c,children:k("actions.cancel")})]})]})}),document.body),u&&Xl.createPortal(i.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/60 p-4 backdrop-blur-sm",children:i.jsxs("div",{className:"w-full max-w-md overflow-hidden rounded-xl border border-border bg-card shadow-2xl",children:[i.jsx("div",{className:"p-6",children:i.jsxs("div",{className:"flex items-start gap-4",children:[i.jsx("div",{className:"flex h-12 w-12 flex-shrink-0 items-center justify-center rounded-full bg-red-100 dark:bg-red-900/30",children:i.jsx(Tr,{className:"h-6 w-6 text-red-600 dark:text-red-400"})}),i.jsxs("div",{className:"min-w-0 flex-1",children:[i.jsx("h3",{className:"mb-2 text-lg font-semibold text-foreground",children:k("deleteConfirmation.deleteSession")}),i.jsxs("p",{className:"mb-1 text-sm text-muted-foreground",children:[k("deleteConfirmation.confirmDelete")," ",i.jsx("span",{className:"font-medium text-foreground",children:u.sessionTitle||k("sessions.unnamed")}),"?"]}),i.jsx("p",{className:"mt-3 text-xs text-muted-foreground",children:k("deleteConfirmation.cannotUndo")})]})]})}),i.jsxs("div",{className:"flex gap-3 border-t border-border bg-muted/30 p-4",children:[i.jsx(_e,{variant:"outline",className:"flex-1",onClick:p,children:k("actions.cancel")}),i.jsxs(_e,{variant:"destructive",className:"flex-1 bg-red-600 text-white hover:bg-red-700",onClick:f,children:[i.jsx(kr,{className:"mr-2 h-4 w-4"}),k("actions.delete")]})]})]})}),document.body),i.jsx(dB,{isOpen:m,onClose:g,releaseInfo:b,currentVersion:x,latestVersion:y,installMode:v,isUpdateAvailable:w})]})}const Uk="pixcode.version.releaseNotes.seenVersion";function Gk({projects:e,selectedProject:t,selectedSession:r,onProjectSelect:n,onSessionSelect:a,onNewSession:s,onProjectCreated:o,onOpenOrchestration:l,onQuickStartSession:c,onSessionDelete:d,onProjectDelete:u,isLoading:p,loadingProgress:f,onRefresh:m,onShowSettings:g,showSettings:b,settingsInitialTab:x,onCloseSettings:y,isMobile:v}){const{t:w}=Me(["sidebar","common"]),{isPWA:k}=Lf({trackMobile:!1}),{updateAvailable:E,latestVersion:S,currentVersion:j,releaseInfo:_,installMode:T}=$E("alicomert","pixcode"),C=h.useRef(null),[L,A]=h.useState(null),{preferences:I,setPreference:N}=Mf(),{sidebarVisible:P,historyView:H}=I,{setCurrentProject:z,mcpServerStatus:U}=eo(),{tasksEnabled:V}=Kd(),{isSidebarCollapsed:O,expandedProjects:G,editingProject:$,showNewProject:F,editingName:te,loadingSessions:Q,initialSessionsLoaded:ge,currentTime:ae,isRefreshing:me,editingSession:pe,editingSessionName:be,searchFilter:Ne,searchMode:xe,setSearchMode:Be,conversationResults:M,isSearching:de,searchProgress:ce,clearConversationResults:Y,deletingProjects:W,deleteConfirmation:ne,sessionDeleteConfirmation:fe,showVersionModal:ye,filteredProjects:se,toggleProject:Se,handleSessionClick:re,toggleStarProject:X,isProjectStarred:Z,toggleStarSession:le,isSessionStarred:Ee,getProjectSessions:Te,startEditing:Ke,cancelEditing:Ze,saveProjectName:vt,showDeleteSessionConfirmation:Qe,confirmDeleteSession:jt,requestProjectDelete:wt,confirmDeleteProject:st,loadMoreSessions:lt,handleProjectSelect:kt,refreshProjects:_t,updateSessionSummary:At,collapseSidebar:pr,expandSidebar:nr,setShowNewProject:Xt,setEditingName:zr,setEditingSession:De,setEditingSessionName:Xe,setSearchFilter:Je,setDeleteConfirmation:ie,setSessionDeleteConfirmation:ke,setShowVersionModal:we}=dO({projects:e,selectedProject:t,selectedSession:r,isLoading:p,isMobile:v,t:w,onRefresh:m,onProjectSelect:n,onSessionSelect:a,onSessionDelete:d,onProjectDelete:u,setCurrentProject:z,setSidebarVisible:He=>N("sidebarVisible",He),sidebarVisible:P});h.useEffect(()=>{const He=()=>Xt(!0);return window.addEventListener("pixcode:create-project",He),()=>{window.removeEventListener("pixcode:create-project",He)}},[Xt]),h.useEffect(()=>{const He=je=>{const Ue=je.detail;A(Ue??null),we(!0)};return window.addEventListener(Jm,He),()=>{window.removeEventListener(Jm,He)}},[we]),h.useEffect(()=>{if(!S||!_||C.current===S)return;const je=(typeof window<"u"?window.localStorage.getItem(Uk):null)===S,Ue=!E&&S===j;(E||Ue&&!je)&&(C.current=S,Ue&&window.localStorage.setItem(Uk,S),A(null),we(!0))},[j,S,_,we,E]),h.useEffect(()=>{typeof document>"u"||(document.documentElement.classList.toggle("pwa-mode",k),document.body.classList.toggle("pwa-mode",k))},[k]);const Ve=He=>{if(He&&o?.(He),window.refreshProjects){window.refreshProjects();return}He||window.location.reload()},et=(He,je)=>{De(He),Xe(je)},Ce=()=>{De(null),Xe("")},Oe=(He,je,Ue,Fe)=>{At(He,je,Ue,Fe)},ct={projects:e,filteredProjects:se,selectedProject:t,selectedSession:r,isLoading:p,loadingProgress:f,expandedProjects:G,editingProject:$,editingName:te,loadingSessions:Q,initialSessionsLoaded:ge,currentTime:ae,editingSession:pe,editingSessionName:be,deletingProjects:W,tasksEnabled:V,mcpServerStatus:U,getProjectSessions:Te,isProjectStarred:Z,isSessionStarred:Ee,onEditingNameChange:zr,onToggleProject:Se,onProjectSelect:kt,onToggleStarProject:X,onToggleStarSession:le,onStartEditingProject:Ke,onCancelEditingProject:Ze,onSaveProjectName:He=>{vt(He)},onDeleteProject:wt,onSessionSelect:re,onDeleteSession:Qe,onLoadMoreSessions:He=>{lt(He)},onNewSession:s,onOpenOrchestration:l,onEditingSessionNameChange:Xe,onStartEditingSession:et,onCancelEditingSession:Ce,onSaveEditingSession:Oe,t:w},Ge={projects:e,filteredProjects:se,selectedSession:r,isLoading:p,loadingProgress:f,currentTime:ae,editingSession:pe,editingSessionName:be,getProjectSessions:Te,isSessionStarred:Ee,onEditingSessionNameChange:Xe,onStartEditingSession:et,onCancelEditingSession:Ce,onSaveEditingSession:Oe,onToggleStarSession:le,onProjectSelect:kt,onSessionSelect:re,onOpenOrchestration:l,onDeleteSession:Qe,t:w};return i.jsxs(i.Fragment,{children:[i.jsx(zB,{projects:e,showSettings:b,settingsInitialTab:x,onCloseSettings:y,showNewProject:F,onCloseNewProject:()=>Xt(!1),onProjectCreated:Ve,deleteConfirmation:ne,onCancelDeleteProject:()=>ie(null),onConfirmDeleteProject:st,sessionDeleteConfirmation:fe,onCancelDeleteSession:()=>ke(null),onConfirmDeleteSession:jt,showVersionModal:ye,onCloseVersionModal:()=>{we(!1),A(null)},releaseInfo:L?.releaseInfo??_,currentVersion:L?.currentVersion??j,latestVersion:L?.latestVersion??S,installMode:T,isUpdateAvailable:L?.updateAvailable??E,t:w}),O?i.jsx(hO,{onExpand:nr,onShowSettings:g,updateAvailable:E,onShowVersionModal:()=>we(!0),t:w}):i.jsx(i.Fragment,{children:i.jsx(rF,{isPWA:k,isMobile:v,isLoading:p,projects:e,searchFilter:Ne,onSearchFilterChange:Je,onClearSearchFilter:()=>Je(""),searchMode:xe,onSearchModeChange:He=>{Be(He),He==="projects"&&Y()},conversationResults:M,isSearching:de,searchProgress:ce,onConversationResultClick:(He,je,Ue,Fe,dt)=>{const ar=Ue||"claude",gr=e.find(ua=>ua.name===He),Et={__searchTargetTimestamp:Fe||null,__searchTargetSnippet:dt||null},In={id:je,__provider:ar,__projectName:He,...Et};if(gr){kt(gr);const Fa=Te(gr).find(zn=>zn.id===je);re(Fa?{...Fa,...Et}:In,He)}else re(In,He)},onRefresh:()=>{_t()},isRefreshing:me,onCreateProject:()=>Xt(!0),onQuickStartSession:c,onCollapseSidebar:pr,updateAvailable:E,releaseInfo:_,latestVersion:S,currentVersion:j,onShowVersionModal:()=>we(!0),onShowSettings:g,projectListProps:ct,flatListProps:Ge,historyView:H,onHistoryViewChange:He=>N("historyView",He),t:w})})]})}const t3=h.createContext(null);function BB(){return h.useContext(t3)}const no={OPTIONS:[{value:"sonnet",label:"Sonnet"},{value:"opus",label:"Opus"},{value:"haiku",label:"Haiku"},{value:"claude-opus-4-6",label:"Opus 4.6"},{value:"opusplan",label:"Opus Plan"},{value:"sonnet[1m]",label:"Sonnet [1M]"},{value:"opus[1m]",label:"Opus [1M]"}],DEFAULT:"opus"},ao={OPTIONS:[{value:"opus-4.6-thinking",label:"Claude 4.6 Opus (Thinking)"},{value:"gpt-5.3-codex",label:"GPT-5.3"},{value:"gpt-5.2-high",label:"GPT-5.2 High"},{value:"gemini-3-pro",label:"Gemini 3 Pro"},{value:"opus-4.5-thinking",label:"Claude 4.5 Opus (Thinking)"},{value:"gpt-5.2",label:"GPT-5.2"},{value:"gpt-5.1",label:"GPT-5.1"},{value:"gpt-5.1-high",label:"GPT-5.1 High"},{value:"composer-1",label:"Composer 1"},{value:"auto",label:"Auto"},{value:"sonnet-4.5",label:"Claude 4.5 Sonnet"},{value:"sonnet-4.5-thinking",label:"Claude 4.5 Sonnet (Thinking)"},{value:"opus-4.5",label:"Claude 4.5 Opus"},{value:"gpt-5.1-codex",label:"GPT-5.1 Codex"},{value:"gpt-5.1-codex-high",label:"GPT-5.1 Codex High"},{value:"gpt-5.1-codex-max",label:"GPT-5.1 Codex Max"},{value:"gpt-5.1-codex-max-high",label:"GPT-5.1 Codex Max High"},{value:"opus-4.1",label:"Claude 4.1 Opus"},{value:"grok",label:"Grok"}],DEFAULT:"gpt-5-3-codex"},io={OPTIONS:[{value:"gpt-5.4",label:"GPT-5.4"},{value:"gpt-5.4-mini",label:"GPT-5.4 mini"},{value:"gpt-5.3-codex",label:"GPT-5.3 Codex"},{value:"gpt-5.2-codex",label:"GPT-5.2 Codex"},{value:"gpt-5.2",label:"GPT-5.2"},{value:"gpt-5.1-codex-max",label:"GPT-5.1 Codex Max"},{value:"o3",label:"O3"},{value:"o4-mini",label:"O4-mini"}],DEFAULT:"gpt-5.4"},so={OPTIONS:[{value:"qwen3-coder-plus",label:"Qwen3 Coder Plus"},{value:"qwen3-coder-next",label:"Qwen3 Coder Next"},{value:"qwen3-coder-480B-A35B-instruct",label:"Qwen3 Coder 480B (Instruct)"},{value:"qwen3-coder-30B-A3B",label:"Qwen3 Coder 30B"},{value:"qwen3.5-plus",label:"Qwen3.5 Plus"},{value:"qwen3-max",label:"Qwen3 Max"},{value:"glm-4.7",label:"GLM-4.7 (Alibaba Coding Plan)"},{value:"kimi-k2.5",label:"Kimi K2.5 (Alibaba Coding Plan)"}],DEFAULT:"qwen3-coder-plus"},oo={OPTIONS:[{value:"opencode/big-pickle",label:"OpenCode Zen · Big Pickle (Free)",free:!0},{value:"opencode/minimax-m2.5-free",label:"OpenCode Zen · MiniMax M2.5 (Free)",free:!0},{value:"opencode/nemotron-3-super-free",label:"OpenCode Zen · Nemotron 3 Super (Free)",free:!0},{value:"opencode/gpt-5-nano",label:"OpenCode Zen · GPT-5 Nano (Free)",free:!0},{value:"anthropic/claude-opus-4-7",label:"Claude Opus 4.7 (Anthropic)"},{value:"anthropic/claude-sonnet-4-6",label:"Claude Sonnet 4.6 (Anthropic)"},{value:"anthropic/claude-haiku-4-5",label:"Claude Haiku 4.5 (Anthropic)"},{value:"openai/gpt-5.4",label:"GPT-5.4 (OpenAI)"},{value:"openai/gpt-5.1-codex",label:"GPT-5.1 Codex (OpenAI)"},{value:"google/gemini-3.1-pro-preview",label:"Gemini 3.1 Pro (Google)"},{value:"google/gemini-3-flash-preview",label:"Gemini 3 Flash (Google)"},{value:"xai/grok-code-fast-1",label:"Grok Code Fast 1 (xAI)"}],DEFAULT:"opencode/big-pickle"},lo={OPTIONS:[{value:"gemini-3.1-pro-preview",label:"Gemini 3.1 Pro Preview"},{value:"gemini-3-pro-preview",label:"Gemini 3 Pro Preview"},{value:"gemini-3-flash-preview",label:"Gemini 3 Flash Preview"},{value:"gemini-2.5-flash",label:"Gemini 2.5 Flash"},{value:"gemini-2.5-pro",label:"Gemini 2.5 Pro"},{value:"gemini-2.0-flash-lite",label:"Gemini 2.0 Flash Lite"},{value:"gemini-2.0-flash",label:"Gemini 2.0 Flash"},{value:"gemini-2.0-pro-exp",label:"Gemini 2.0 Pro Experimental"},{value:"gemini-2.0-flash-thinking-exp",label:"Gemini 2.0 Flash Thinking"}],DEFAULT:"gemini-3.1-pro-preview"},Rp="permissionMode-global",Lp=e=>{const t=localStorage.getItem(e);return t==="default"||t==="acceptEdits"||t==="bypassPermissions"||t==="plan"?t:null};function $B({selectedSession:e}){const[t,r]=h.useState(()=>Lp(Rp)||"default"),[n,a]=h.useState([]),[s,o]=h.useState(()=>localStorage.getItem("selected-provider")||"claude"),[l,c]=h.useState(()=>localStorage.getItem("cursor-model")||ao.DEFAULT),[d,u]=h.useState(()=>localStorage.getItem("claude-model")||no.DEFAULT),[p,f]=h.useState(()=>localStorage.getItem("codex-model")||io.DEFAULT),[m,g]=h.useState(()=>localStorage.getItem("gemini-model")||lo.DEFAULT),[b,x]=h.useState(()=>localStorage.getItem("qwen-model")||so.DEFAULT),[y,v]=h.useState(()=>localStorage.getItem("opencode-model")||oo.DEFAULT),w=h.useRef(s);h.useEffect(()=>{if(!e?.id)return;const S=Lp(`permissionMode-${e.id}`)||Lp(Rp);r(S||"default")},[e?.id]),h.useEffect(()=>{!e?.__provider||e.__provider===s||(o(e.__provider),localStorage.setItem("selected-provider",e.__provider))},[s,e]),h.useEffect(()=>{w.current!==s&&(a([]),w.current=s)},[s]),h.useEffect(()=>{a(S=>S.filter(j=>!j.sessionId||j.sessionId===e?.id))},[e?.id]),h.useEffect(()=>{s==="cursor"&&ve("/api/cursor/config").then(S=>S.json()).then(S=>{if(!S.success||!S.config?.model?.modelId)return;const j=S.config.model.modelId;localStorage.getItem("cursor-model")||c(j)}).catch(S=>{console.error("Error loading Cursor config:",S)})},[s]);const k=h.useCallback(S=>{r(S),localStorage.setItem(Rp,S),e?.id&&localStorage.setItem(`permissionMode-${e.id}`,S)},[e?.id]),E=h.useCallback(()=>{const S=s==="codex"?["default","acceptEdits","bypassPermissions"]:["default","acceptEdits","bypassPermissions","plan"],_=(S.indexOf(t)+1)%S.length,T=S[_];k(T)},[t,s,k]);return{provider:s,setProvider:o,cursorModel:l,setCursorModel:c,claudeModel:d,setClaudeModel:u,codexModel:p,setCodexModel:f,geminiModel:m,setGeminiModel:g,qwenModel:b,setQwenModel:x,opencodeModel:y,setOpencodeModel:v,permissionMode:t,setPermissionMode:k,pendingPermissionRequests:n,setPendingPermissionRequests:a,cyclePermissionMode:E}}const UB=(e,t)=>{const r=e.split(`
309
309
  `),n=t.split(`
310
310
  `),a=Array.from({length:r.length+1},()=>new Array(n.length+1).fill(0));for(let c=r.length-1;c>=0;c-=1)for(let d=n.length-1;d>=0;d-=1)r[c]===n[d]?a[c][d]=a[c+1][d+1]+1:a[c][d]=Math.max(a[c+1][d],a[c][d+1]);const s=[];let o=0,l=0;for(;o<r.length&&l<n.length;){const c=r[o],d=n[l];if(c===d){o+=1,l+=1;continue}if(a[o+1][l]>=a[o][l+1]){s.push({type:"removed",content:c,lineNum:o+1}),o+=1;continue}s.push({type:"added",content:d,lineNum:l+1}),l+=1}for(;o<r.length;)s.push({type:"removed",content:r[o],lineNum:o+1}),o+=1;for(;l<n.length;)s.push({type:"added",content:n[l],lineNum:l+1}),l+=1;return s},GB=()=>{const e=new Map;return(t,r)=>{const n=JSON.stringify([t,r]),a=e.get(n);if(a)return a;const s=UB(t,r);if(e.set(n,s),e.size>100){const o=e.keys().next().value;o&&e.delete(o)}return s}};function Hk(e){return e&&e.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"').replace(/&#39;/g,"'").replace(/&amp;/g,"&")}function HB(e){if(!e||typeof e!="string")return e;try{return e.replace(/```\s*([^\n\r]+?)\s*```/g,"`$1`")}catch{return e}}function Dp(e){if(!e||typeof e!="string")return e;const t=[],r="__MATH_BLOCK_",n="__";let a=e.replace(/\$\$([\s\S]*?)\$\$|\$([^\$\n]+?)\$/g,s=>{const o=t.length;return t.push(s),`${r}${o}${n}`});return a=a.replace(/\\n/g,`
311
311
  `).replace(/\\t/g," ").replace(/\\r/g,"\r"),a=a.replace(new RegExp(`${r}(\\d+)${n}`,"g"),(s,o)=>t[parseInt(o,10)]),a}function r3(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function m0(e){try{return typeof e!="string"?e:e.replace(/Claude AI usage limit reached\|(\d{10,13})/g,(t,r)=>{let n=parseInt(r,10);if(!Number.isFinite(n))return t;n<1e12&&(n*=1e3);const a=new Date(n),s=new Intl.DateTimeFormat(void 0,{hour:"2-digit",minute:"2-digit",hour12:!1}).format(a),o=-a.getTimezoneOffset(),l=o>=0?"+":"-",c=Math.abs(o),d=Math.floor(c/60),u=c%60,p=`GMT${l}${d}${u?":"+String(u).padStart(2,"0"):""}`,g=((Intl.DateTimeFormat().resolvedOptions().timeZone||"").split("/").pop()||"").replace(/_/g," ").toLowerCase().replace(/\b\w/g,v=>v.toUpperCase()),b=g?`${p} (${g})`:p,x=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],y=`${a.getDate()} ${x[a.getMonth()]} ${a.getFullYear()}`;return`Claude usage limit reached. Your limit will reset at **${s} ${b}** - ${y}`})}catch{return e}}function VB(e,t){if(typeof e!="string")return e;const r=e.toLowerCase(),n=t?t.charAt(0).toUpperCase()+t.slice(1):"The selected CLI",a=r.includes("insufficient_quota")||r.includes("insufficient quota")||r.includes("quota exceeded")||r.includes("credit balance")||r.includes("balance")||r.includes("billing")||r.includes("payment required")||r.includes("402")?"account balance or quota":r.includes("rate limit")||r.includes("too many requests")||r.includes("429")||r.includes("usage limit")?"rate limit":r.includes("unauthorized")||r.includes("forbidden")||r.includes("invalid api key")||r.includes("api key")||r.includes("oauth")||r.includes("login")||r.includes("401")||r.includes("403")?"authentication":r.includes("not installed")||r.includes("command not found")||r.includes("enoent")||r.includes("spawn")?"installation":r.includes("timeout")||r.includes("timed out")?"timeout":null;if(!a)return m0(e);const s=a==="account balance or quota"?"Add credits or switch to another provider/model, then retry.":a==="rate limit"?"Wait for the limit to reset or switch to another provider/model, then retry.":a==="authentication"?"Re-authenticate this CLI from provider settings, then retry.":a==="installation"?"Install or repair the CLI binary, refresh provider status, then retry.":"The CLI did not respond in time. Retry with a shorter prompt or another provider.";return[`${n} could not answer because of a ${a} issue.`,"",s,"",`Raw error: ${e}`].join(`
@@ -313,7 +313,7 @@ Waiting for the server to restart…
313
313
  In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function y$(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function v$(e){if(Array.isArray(e))return kh(e)}function e2(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,n)}return r}function t2(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?e2(Object(r),!0).forEach(function(n){i3(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):e2(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function i3(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Sl(e,t){return S$(e)||k$(e,t)||s3(e,t)||w$()}function w$(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
314
314
  In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function s3(e,t){if(e){if(typeof e=="string")return kh(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return kh(e,t)}}function kh(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function k$(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var n=[],a=!0,s=!1,o,l;try{for(r=r.call(e);!(a=(o=r.next()).done)&&(n.push(o.value),!(t&&n.length===t));a=!0);}catch(c){s=!0,l=c}finally{try{!a&&r.return!=null&&r.return()}finally{if(s)throw l}}return n}}function S$(e){if(Array.isArray(e))return e}var E$=typeof zp=="function"?zp:zp.default,N$="file-invalid-type",C$="file-too-large",A$="file-too-small",T$="too-many-files",j$=function(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"",r=t.split(","),n=r.length>1?"one of ".concat(r.join(", ")):r[0];return{code:N$,message:"File type must be ".concat(n)}},r2=function(t){return{code:C$,message:"File is larger than ".concat(t," ").concat(t===1?"byte":"bytes")}},n2=function(t){return{code:A$,message:"File is smaller than ".concat(t," ").concat(t===1?"byte":"bytes")}},_$={code:T$,message:"Too many files"};function o3(e,t){var r=e.type==="application/x-moz-file"||E$(e,t);return[r,r?null:j$(t)]}function l3(e,t,r){if(Di(e.size))if(Di(t)&&Di(r)){if(e.size>r)return[!1,r2(r)];if(e.size<t)return[!1,n2(t)]}else{if(Di(t)&&e.size<t)return[!1,n2(t)];if(Di(r)&&e.size>r)return[!1,r2(r)]}return[!0,null]}function Di(e){return e!=null}function I$(e){var t=e.files,r=e.accept,n=e.minSize,a=e.maxSize,s=e.multiple,o=e.maxFiles,l=e.validator;return!s&&t.length>1||s&&o>=1&&t.length>o?!1:t.every(function(c){var d=o3(c,r),u=Sl(d,1),p=u[0],f=l3(c,n,a),m=Sl(f,1),g=m[0],b=l?l(c):null;return p&&g&&!b})}function bd(e){return typeof e.isPropagationStopped=="function"?e.isPropagationStopped():typeof e.cancelBubble<"u"?e.cancelBubble:!1}function lc(e){return e.dataTransfer?Array.prototype.some.call(e.dataTransfer.types,function(t){return t==="Files"||t==="application/x-moz-file"}):!!e.target&&!!e.target.files}function a2(e){e.preventDefault()}function R$(e){return e.indexOf("MSIE")!==-1||e.indexOf("Trident/")!==-1}function L$(e){return e.indexOf("Edge/")!==-1}function D$(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:window.navigator.userAgent;return R$(e)||L$(e)}function $n(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return function(n){for(var a=arguments.length,s=new Array(a>1?a-1:0),o=1;o<a;o++)s[o-1]=arguments[o];return t.some(function(l){return!bd(n)&&l&&l.apply(void 0,[n].concat(s)),bd(n)})}}function O$(){return"showOpenFilePicker"in window}function M$(e){if(Di(e)){var t=Object.entries(e).filter(function(r){var n=Sl(r,2),a=n[0],s=n[1],o=!0;return c3(a)||(console.warn('Skipped "'.concat(a,'" because it is not a valid MIME type. Check https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types/Common_types for a list of valid MIME types.')),o=!1),(!Array.isArray(s)||!s.every(d3))&&(console.warn('Skipped "'.concat(a,'" because an invalid file extension was provided.')),o=!1),o}).reduce(function(r,n){var a=Sl(n,2),s=a[0],o=a[1];return t2(t2({},r),{},i3({},s,o))},{});return[{description:"Files",accept:t}]}return e}function P$(e){if(Di(e))return Object.entries(e).reduce(function(t,r){var n=Sl(r,2),a=n[0],s=n[1];return[].concat(Qk(t),[a],Qk(s))},[]).filter(function(t){return c3(t)||d3(t)}).join(",")}function F$(e){return e instanceof DOMException&&(e.name==="AbortError"||e.code===e.ABORT_ERR)}function z$(e){return e instanceof DOMException&&(e.name==="SecurityError"||e.code===e.SECURITY_ERR)}function c3(e){return e==="audio/*"||e==="video/*"||e==="image/*"||e==="text/*"||e==="application/*"||/\w+\/[-+.\w]+/g.test(e)}function d3(e){return/^.*\.[\w]+$/.test(e)}var B$=["children"],$$=["open"],U$=["refKey","role","onKeyDown","onFocus","onBlur","onClick","onDragEnter","onDragOver","onDragLeave","onDrop"],G$=["refKey","onChange","onClick"];function H$(e){return W$(e)||q$(e)||u3(e)||V$()}function V$(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
315
315
  In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function q$(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function W$(e){if(Array.isArray(e))return Sh(e)}function Bp(e,t){return Z$(e)||Y$(e,t)||u3(e,t)||K$()}function K$(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
316
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function u3(e,t){if(e){if(typeof e=="string")return Sh(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Sh(e,t)}}function Sh(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function Y$(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var n=[],a=!0,s=!1,o,l;try{for(r=r.call(e);!(a=(o=r.next()).done)&&(n.push(o.value),!(t&&n.length===t));a=!0);}catch(c){s=!0,l=c}finally{try{!a&&r.return!=null&&r.return()}finally{if(s)throw l}}return n}}function Z$(e){if(Array.isArray(e))return e}function i2(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,n)}return r}function qt(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?i2(Object(r),!0).forEach(function(n){Eh(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):i2(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Eh(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function xd(e,t){if(e==null)return{};var r=X$(e,t),n,a;if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(a=0;a<s.length;a++)n=s[a],!(t.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function X$(e,t){if(e==null)return{};var r={},n=Object.keys(e),a,s;for(s=0;s<n.length;s++)a=n[s],!(t.indexOf(a)>=0)&&(r[a]=e[a]);return r}var h0=h.forwardRef(function(e,t){var r=e.children,n=xd(e,B$),a=m3(n),s=a.open,o=xd(a,$$);return h.useImperativeHandle(t,function(){return{open:s}},[s]),qr.createElement(h.Fragment,null,r(qt(qt({},o),{},{open:s})))});h0.displayName="Dropzone";var p3={disabled:!1,getFilesFromEvent:o$,maxSize:1/0,minSize:0,multiple:!0,maxFiles:0,preventDropOnDocument:!0,noClick:!1,noKeyboard:!1,noDrag:!1,noDragEventsBubbling:!1,validator:null,useFsAccessApi:!1,autoFocus:!1};h0.defaultProps=p3;h0.propTypes={children:It.func,accept:It.objectOf(It.arrayOf(It.string)),multiple:It.bool,preventDropOnDocument:It.bool,noClick:It.bool,noKeyboard:It.bool,noDrag:It.bool,noDragEventsBubbling:It.bool,minSize:It.number,maxSize:It.number,maxFiles:It.number,disabled:It.bool,getFilesFromEvent:It.func,onFileDialogCancel:It.func,onFileDialogOpen:It.func,useFsAccessApi:It.bool,autoFocus:It.bool,onDragEnter:It.func,onDragLeave:It.func,onDragOver:It.func,onDrop:It.func,onDropAccepted:It.func,onDropRejected:It.func,onError:It.func,validator:It.func};var Nh={isFocused:!1,isFileDialogActive:!1,isDragActive:!1,isDragAccept:!1,isDragReject:!1,acceptedFiles:[],fileRejections:[]};function m3(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=qt(qt({},p3),e),r=t.accept,n=t.disabled,a=t.getFilesFromEvent,s=t.maxSize,o=t.minSize,l=t.multiple,c=t.maxFiles,d=t.onDragEnter,u=t.onDragLeave,p=t.onDragOver,f=t.onDrop,m=t.onDropAccepted,g=t.onDropRejected,b=t.onFileDialogCancel,x=t.onFileDialogOpen,y=t.useFsAccessApi,v=t.autoFocus,w=t.preventDropOnDocument,k=t.noClick,E=t.noKeyboard,S=t.noDrag,j=t.noDragEventsBubbling,_=t.onError,T=t.validator,C=h.useMemo(function(){return P$(r)},[r]),L=h.useMemo(function(){return M$(r)},[r]),A=h.useMemo(function(){return typeof x=="function"?x:s2},[x]),I=h.useMemo(function(){return typeof b=="function"?b:s2},[b]),N=h.useRef(null),P=h.useRef(null),H=h.useReducer(J$,Nh),z=Bp(H,2),U=z[0],V=z[1],O=U.isFocused,G=U.isFileDialogActive,$=h.useRef(typeof window<"u"&&window.isSecureContext&&y&&O$()),F=function(){!$.current&&G&&setTimeout(function(){if(P.current){var X=P.current.files;X.length||(V({type:"closeDialog"}),I())}},300)};h.useEffect(function(){return window.addEventListener("focus",F,!1),function(){window.removeEventListener("focus",F,!1)}},[P,G,I,$]);var te=h.useRef([]),Q=function(X){N.current&&N.current.contains(X.target)||(X.preventDefault(),te.current=[])};h.useEffect(function(){return w&&(document.addEventListener("dragover",a2,!1),document.addEventListener("drop",Q,!1)),function(){w&&(document.removeEventListener("dragover",a2),document.removeEventListener("drop",Q))}},[N,w]),h.useEffect(function(){return!n&&v&&N.current&&N.current.focus(),function(){}},[N,v,n]);var ge=h.useCallback(function(re){_?_(re):console.error(re)},[_]),ae=h.useCallback(function(re){re.preventDefault(),re.persist(),fe(re),te.current=[].concat(H$(te.current),[re.target]),lc(re)&&Promise.resolve(a(re)).then(function(X){if(!(bd(re)&&!j)){var Z=X.length,le=Z>0&&I$({files:X,accept:C,minSize:o,maxSize:s,multiple:l,maxFiles:c,validator:T}),Ee=Z>0&&!le;V({isDragAccept:le,isDragReject:Ee,isDragActive:!0,type:"setDraggedFiles"}),d&&d(re)}}).catch(function(X){return ge(X)})},[a,d,ge,j,C,o,s,l,c,T]),me=h.useCallback(function(re){re.preventDefault(),re.persist(),fe(re);var X=lc(re);if(X&&re.dataTransfer)try{re.dataTransfer.dropEffect="copy"}catch{}return X&&p&&p(re),!1},[p,j]),pe=h.useCallback(function(re){re.preventDefault(),re.persist(),fe(re);var X=te.current.filter(function(le){return N.current&&N.current.contains(le)}),Z=X.indexOf(re.target);Z!==-1&&X.splice(Z,1),te.current=X,!(X.length>0)&&(V({type:"setDraggedFiles",isDragActive:!1,isDragAccept:!1,isDragReject:!1}),lc(re)&&u&&u(re))},[N,u,j]),be=h.useCallback(function(re,X){var Z=[],le=[];re.forEach(function(Ee){var Te=o3(Ee,C),Ke=Bp(Te,2),Ze=Ke[0],vt=Ke[1],Qe=l3(Ee,o,s),jt=Bp(Qe,2),wt=jt[0],st=jt[1],lt=T?T(Ee):null;if(Ze&&wt&&!lt)Z.push(Ee);else{var kt=[vt,st];lt&&(kt=kt.concat(lt)),le.push({file:Ee,errors:kt.filter(function(_t){return _t})})}}),(!l&&Z.length>1||l&&c>=1&&Z.length>c)&&(Z.forEach(function(Ee){le.push({file:Ee,errors:[_$]})}),Z.splice(0)),V({acceptedFiles:Z,fileRejections:le,isDragReject:le.length>0,type:"setFiles"}),f&&f(Z,le,X),le.length>0&&g&&g(le,X),Z.length>0&&m&&m(Z,X)},[V,l,C,o,s,c,f,m,g,T]),Ne=h.useCallback(function(re){re.preventDefault(),re.persist(),fe(re),te.current=[],lc(re)&&Promise.resolve(a(re)).then(function(X){bd(re)&&!j||be(X,re)}).catch(function(X){return ge(X)}),V({type:"reset"})},[a,be,ge,j]),xe=h.useCallback(function(){if($.current){V({type:"openDialog"}),A();var re={multiple:l,types:L};window.showOpenFilePicker(re).then(function(X){return a(X)}).then(function(X){be(X,null),V({type:"closeDialog"})}).catch(function(X){F$(X)?(I(X),V({type:"closeDialog"})):z$(X)?($.current=!1,P.current?(P.current.value=null,P.current.click()):ge(new Error("Cannot open the file picker because the https://developer.mozilla.org/en-US/docs/Web/API/File_System_Access_API is not supported and no <input> was provided."))):ge(X)});return}P.current&&(V({type:"openDialog"}),A(),P.current.value=null,P.current.click())},[V,A,I,y,be,ge,L,l]),Be=h.useCallback(function(re){!N.current||!N.current.isEqualNode(re.target)||(re.key===" "||re.key==="Enter"||re.keyCode===32||re.keyCode===13)&&(re.preventDefault(),xe())},[N,xe]),M=h.useCallback(function(){V({type:"focus"})},[]),de=h.useCallback(function(){V({type:"blur"})},[]),ce=h.useCallback(function(){k||(D$()?setTimeout(xe,0):xe())},[k,xe]),Y=function(X){return n?null:X},W=function(X){return E?null:Y(X)},ne=function(X){return S?null:Y(X)},fe=function(X){j&&X.stopPropagation()},ye=h.useMemo(function(){return function(){var re=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},X=re.refKey,Z=X===void 0?"ref":X,le=re.role,Ee=re.onKeyDown,Te=re.onFocus,Ke=re.onBlur,Ze=re.onClick,vt=re.onDragEnter,Qe=re.onDragOver,jt=re.onDragLeave,wt=re.onDrop,st=xd(re,U$);return qt(qt(Eh({onKeyDown:W($n(Ee,Be)),onFocus:W($n(Te,M)),onBlur:W($n(Ke,de)),onClick:Y($n(Ze,ce)),onDragEnter:ne($n(vt,ae)),onDragOver:ne($n(Qe,me)),onDragLeave:ne($n(jt,pe)),onDrop:ne($n(wt,Ne)),role:typeof le=="string"&&le!==""?le:"presentation"},Z,N),!n&&!E?{tabIndex:0}:{}),st)}},[N,Be,M,de,ce,ae,me,pe,Ne,E,S,n]),se=h.useCallback(function(re){re.stopPropagation()},[]),Se=h.useMemo(function(){return function(){var re=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},X=re.refKey,Z=X===void 0?"ref":X,le=re.onChange,Ee=re.onClick,Te=xd(re,G$),Ke=Eh({accept:C,multiple:l,type:"file",style:{border:0,clip:"rect(0, 0, 0, 0)",clipPath:"inset(50%)",height:"1px",margin:"0 -1px -1px 0",overflow:"hidden",padding:0,position:"absolute",width:"1px",whiteSpace:"nowrap"},onChange:Y($n(le,Ne)),onClick:Y($n(Ee,se)),tabIndex:-1},Z,P);return qt(qt({},Ke),Te)}},[P,r,l,Ne,n]);return qt(qt({},U),{},{isFocused:O&&!n,getRootProps:ye,getInputProps:Se,rootRef:N,inputRef:P,open:Y(xe)})}function J$(e,t){switch(t.type){case"focus":return qt(qt({},e),{},{isFocused:!0});case"blur":return qt(qt({},e),{},{isFocused:!1});case"openDialog":return qt(qt({},Nh),{},{isFileDialogActive:!0});case"closeDialog":return qt(qt({},e),{},{isFileDialogActive:!1});case"setDraggedFiles":return qt(qt({},e),{},{isDragActive:t.isDragActive,isDragAccept:t.isDragAccept,isDragReject:t.isDragReject});case"setFiles":return qt(qt({},e),{},{acceptedFiles:t.acceptedFiles,fileRejections:t.fileRejections,isDragReject:t.isDragReject});case"reset":return qt({},Nh);default:return e}}function s2(){}const h3=[{id:"none",name:"Standard",description:"Regular Claude response",icon:null,prefix:"",color:"text-gray-600"},{id:"think",name:"Think",description:"Basic extended thinking",icon:Rf,prefix:"think",color:"text-blue-600"},{id:"think-hard",name:"Think Hard",description:"More thorough evaluation",icon:If,prefix:"think hard",color:"text-purple-600"},{id:"think-harder",name:"Think Harder",description:"Deep analysis with alternatives",icon:Na,prefix:"think harder",color:"text-indigo-600"},{id:"ultrathink",name:"Ultrathink",description:"Maximum thinking budget",icon:UD,prefix:"ultrathink",color:"text-red-600"}],f3="claude-settings",Vn={setItem:(e,t)=>{try{localStorage.setItem(e,t)}catch(r){if(r?.name==="QuotaExceededError"){console.warn("localStorage quota exceeded, clearing old data"),Object.keys(localStorage).filter(s=>s.startsWith("draft_input_")).forEach(s=>{localStorage.removeItem(s)});try{localStorage.setItem(e,t)}catch(s){console.error("Failed to save to localStorage even after cleanup:",s)}}else console.error("localStorage error:",r)}},getItem:e=>{try{return localStorage.getItem(e)}catch(t){return console.error("localStorage getItem error:",t),null}},removeItem:e=>{try{localStorage.removeItem(e)}catch(t){console.error("localStorage removeItem error:",t)}}};function f0(){const e=Vn.getItem(f3);if(!e)return{allowedTools:[],disallowedTools:[],skipPermissions:!1,projectSortOrder:"name"};try{const t=JSON.parse(e);return{...t,allowedTools:Array.isArray(t.allowedTools)?t.allowedTools:[],disallowedTools:Array.isArray(t.disallowedTools)?t.disallowedTools:[],skipPermissions:!!t.skipPermissions,projectSortOrder:t.projectSortOrder||"name"}}catch{return{allowedTools:[],disallowedTools:[],skipPermissions:!1,projectSortOrder:"name"}}}function Ch(e,t){if(!e)return null;if(e!=="Bash")return e;const r=Y9(t),n=typeof r?.command=="string"?r.command.trim():"";if(!n)return e;const a=n.split(/\s+/);return a.length===0?e:a[0]==="git"&&a[1]?`Bash(${a[0]} ${a[1]}:*)`:`Bash(${a[0]}:*)`}function o2(e){if(e==null)return"";if(typeof e=="string")return e;try{return JSON.stringify(e,null,2)}catch{return String(e)}}function Q$(e,t){if(t!=="claude"||!e?.toolResult?.isError)return null;const r=e?.toolName,n=Ch(r,e.toolInput);if(!n)return null;const s=f0().allowedTools.includes(n);return{toolName:r||"UnknownTool",entry:n,isAllowed:s}}function eU(e){if(!e)return{success:!1};const t=f0(),r=t.allowedTools.includes(e),n=r?t.allowedTools:[...t.allowedTools,e],a=t.disallowedTools.filter(o=>o!==e),s={...t,allowedTools:n,disallowedTools:a,lastUpdated:new Date().toISOString()};return Vn.setItem(f3,JSON.stringify(s)),{success:!0,alreadyAllowed:r,updatedSettings:s}}const Qa=4,g3="pixcode.workerSlots.v1",g0={claude:no.DEFAULT,cursor:ao.DEFAULT,codex:io.DEFAULT,gemini:lo.DEFAULT,qwen:so.DEFAULT,opencode:oo.DEFAULT},b3=["claude","cursor","codex","gemini","qwen","opencode"];function x3(e={}){const t=e.provider||"claude";return{id:e.id||`worker-${Date.now()}-${Math.random().toString(36).slice(2,7)}`,enabled:e.enabled??!0,provider:t,model:e.model||g0[t],projectName:e.projectName,projectPath:e.projectPath,mode:e.mode||"current_project"}}function y3(e){return e.model||g0[e.provider]}function tU(e){return Array.isArray(e)?e.slice(0,Qa).map(t=>{const r=t&&typeof t=="object"?t:{},n=b3.includes(r.provider)?r.provider:"claude";return x3({id:typeof r.id=="string"?r.id:void 0,enabled:r.enabled!==!1,provider:n,model:typeof r.model=="string"?r.model:g0[n],projectName:typeof r.projectName=="string"?r.projectName:void 0,projectPath:typeof r.projectPath=="string"?r.projectPath:void 0,mode:r.mode==="new_chat"?"new_chat":"current_project"})}):[]}function rU(){try{return tU(JSON.parse(localStorage.getItem(g3)||"[]"))}catch{return[]}}function nU(e){try{localStorage.setItem(g3,JSON.stringify(e.slice(0,Qa)))}catch{}}const v3=(e,t="")=>{let r=[];return e.forEach(n=>{const a=t?`${t}/${n.name}`:n.name;if(n.type==="directory"&&n.children){r=r.concat(v3(n.children,a));return}n.type==="file"&&r.push({name:n.name,path:a,relativePath:n.path})}),r};function aU({selectedProject:e,input:t,setInput:r,textareaRef:n}){const[a,s]=h.useState([]),[o,l]=h.useState([]),[c,d]=h.useState([]),[u,p]=h.useState(!1),[f,m]=h.useState(-1),[g,b]=h.useState(0),[x,y]=h.useState(-1);h.useEffect(()=>{const T=new AbortController;return(async()=>{const L=e?.name;if(s([]),d([]),!!L)try{const A=await ot.getFiles(L,{signal:T.signal});if(!A.ok)return;const I=await A.json();s(v3(I))}catch(A){if(A?.name==="AbortError")return;console.error("Error fetching files:",A)}})(),()=>{T.abort()}},[e?.name]),h.useEffect(()=>{const T=t.slice(0,g),C=T.lastIndexOf("@");if(C===-1){p(!1),y(-1);return}const L=T.slice(C+1);if(L.includes(" ")){p(!1),y(-1);return}y(C),p(!0),m(-1);const A=a.filter(I=>I.name.toLowerCase().includes(L.toLowerCase())||I.path.toLowerCase().includes(L.toLowerCase())).slice(0,10);d(A)},[t,g,a]);const v=h.useMemo(()=>!t||o.length===0?[]:o.filter(T=>t.includes(T)),[o,t]),w=h.useMemo(()=>v.length===0?[]:Array.from(new Set(v)).sort((C,L)=>L.length-C.length),[v]),k=h.useMemo(()=>{if(w.length===0)return null;const T=w.map(r3).join("|");return new RegExp(`(${T})`,"g")},[w]),E=h.useMemo(()=>new Set(w),[w]),S=h.useCallback(T=>T?k?T.split(k).map((L,A)=>E.has(L)?i.jsx("span",{className:"-ml-0.5 rounded-md bg-blue-200/70 box-decoration-clone px-0.5 text-transparent dark:bg-blue-300/40",children:L},`mention-${A}`):i.jsx("span",{children:L},`text-${A}`)):T:"",[k,E]),j=h.useCallback(T=>{const C=t.slice(0,x),L=t.slice(x),A=L.indexOf(" "),I=A!==-1?L.slice(A):"",N=`${C}${T.path} ${I}`,P=C.length+T.path.length+1;n.current&&!n.current.matches(":focus")&&n.current.focus(),r(N),b(P),l(H=>H.includes(T.path)?H:[...H,T.path]),p(!1),y(-1),n.current&&requestAnimationFrame(()=>{n.current&&(n.current.setSelectionRange(P,P),n.current.matches(":focus")||n.current.focus())})},[t,x,n,r]),_=h.useCallback(T=>!u||c.length===0?!1:T.key==="ArrowDown"?(T.preventDefault(),m(C=>C<c.length-1?C+1:0),!0):T.key==="ArrowUp"?(T.preventDefault(),m(C=>C>0?C-1:c.length-1),!0):T.key==="Tab"||T.key==="Enter"?(T.preventDefault(),f>=0?j(c[f]):c.length>0&&j(c[0]),!0):T.key==="Escape"?(T.preventDefault(),p(!1),!0):!1,[u,c,f,j]);return{showFileDropdown:u,filteredFiles:c,selectedFileIndex:f,renderInputWithMentions:S,selectFile:j,setCursorPosition:b,handleFileMentionsKeyDown:_}}function ja(e){return Array.isArray?Array.isArray(e):S3(e)==="[object Array]"}function iU(e){if(typeof e=="string")return e;let t=e+"";return t=="0"&&1/e==-1/0?"-0":t}function sU(e){return e==null?"":iU(e)}function Jn(e){return typeof e=="string"}function w3(e){return typeof e=="number"}function oU(e){return e===!0||e===!1||lU(e)&&S3(e)=="[object Boolean]"}function k3(e){return typeof e=="object"}function lU(e){return k3(e)&&e!==null}function on(e){return e!=null}function $p(e){return!e.trim().length}function S3(e){return e==null?e===void 0?"[object Undefined]":"[object Null]":Object.prototype.toString.call(e)}const cU="Incorrect 'index' type",dU=e=>`Invalid value for key ${e}`,uU=e=>`Pattern length exceeds max of ${e}.`,pU=e=>`Missing ${e} property in key`,mU=e=>`Property 'weight' in key '${e}' must be a positive integer`,l2=Object.prototype.hasOwnProperty;class hU{constructor(t){this._keys=[],this._keyMap={};let r=0;t.forEach(n=>{let a=E3(n);this._keys.push(a),this._keyMap[a.id]=a,r+=a.weight}),this._keys.forEach(n=>{n.weight/=r})}get(t){return this._keyMap[t]}keys(){return this._keys}toJSON(){return JSON.stringify(this._keys)}}function E3(e){let t=null,r=null,n=null,a=1,s=null;if(Jn(e)||ja(e))n=e,t=c2(e),r=Ah(e);else{if(!l2.call(e,"name"))throw new Error(pU("name"));const o=e.name;if(n=o,l2.call(e,"weight")&&(a=e.weight,a<=0))throw new Error(mU(o));t=c2(o),r=Ah(o),s=e.getFn}return{path:t,id:r,weight:a,src:n,getFn:s}}function c2(e){return ja(e)?e:e.split(".")}function Ah(e){return ja(e)?e.join("."):e}function fU(e,t){let r=[],n=!1;const a=(s,o,l)=>{if(on(s))if(!o[l])r.push(s);else{let c=o[l];const d=s[c];if(!on(d))return;if(l===o.length-1&&(Jn(d)||w3(d)||oU(d)))r.push(sU(d));else if(ja(d)){n=!0;for(let u=0,p=d.length;u<p;u+=1)a(d[u],o,l+1)}else o.length&&a(d,o,l+1)}};return a(e,Jn(t)?t.split("."):t,0),n?r:r[0]}const gU={includeMatches:!1,findAllMatches:!1,minMatchCharLength:1},bU={isCaseSensitive:!1,ignoreDiacritics:!1,includeScore:!1,keys:[],shouldSort:!0,sortFn:(e,t)=>e.score===t.score?e.idx<t.idx?-1:1:e.score<t.score?-1:1},xU={location:0,threshold:.6,distance:100},yU={useExtendedSearch:!1,getFn:fU,ignoreLocation:!1,ignoreFieldNorm:!1,fieldNormWeight:1};var at={...bU,...gU,...xU,...yU};const vU=/[^ ]+/g;function wU(e=1,t=3){const r=new Map,n=Math.pow(10,t);return{get(a){const s=a.match(vU).length;if(r.has(s))return r.get(s);const o=1/Math.pow(s,.5*e),l=parseFloat(Math.round(o*n)/n);return r.set(s,l),l},clear(){r.clear()}}}class b0{constructor({getFn:t=at.getFn,fieldNormWeight:r=at.fieldNormWeight}={}){this.norm=wU(r,3),this.getFn=t,this.isCreated=!1,this.setIndexRecords()}setSources(t=[]){this.docs=t}setIndexRecords(t=[]){this.records=t}setKeys(t=[]){this.keys=t,this._keysMap={},t.forEach((r,n)=>{this._keysMap[r.id]=n})}create(){this.isCreated||!this.docs.length||(this.isCreated=!0,Jn(this.docs[0])?this.docs.forEach((t,r)=>{this._addString(t,r)}):this.docs.forEach((t,r)=>{this._addObject(t,r)}),this.norm.clear())}add(t){const r=this.size();Jn(t)?this._addString(t,r):this._addObject(t,r)}removeAt(t){this.records.splice(t,1);for(let r=t,n=this.size();r<n;r+=1)this.records[r].i-=1}getValueForItemAtKeyId(t,r){return t[this._keysMap[r]]}size(){return this.records.length}_addString(t,r){if(!on(t)||$p(t))return;let n={v:t,i:r,n:this.norm.get(t)};this.records.push(n)}_addObject(t,r){let n={i:r,$:{}};this.keys.forEach((a,s)=>{let o=a.getFn?a.getFn(t):this.getFn(t,a.path);if(on(o)){if(ja(o)){let l=[];const c=[{nestedArrIndex:-1,value:o}];for(;c.length;){const{nestedArrIndex:d,value:u}=c.pop();if(on(u))if(Jn(u)&&!$p(u)){let p={v:u,i:d,n:this.norm.get(u)};l.push(p)}else ja(u)&&u.forEach((p,f)=>{c.push({nestedArrIndex:f,value:p})})}n.$[s]=l}else if(Jn(o)&&!$p(o)){let l={v:o,n:this.norm.get(o)};n.$[s]=l}}}),this.records.push(n)}toJSON(){return{keys:this.keys,records:this.records}}}function N3(e,t,{getFn:r=at.getFn,fieldNormWeight:n=at.fieldNormWeight}={}){const a=new b0({getFn:r,fieldNormWeight:n});return a.setKeys(e.map(E3)),a.setSources(t),a.create(),a}function kU(e,{getFn:t=at.getFn,fieldNormWeight:r=at.fieldNormWeight}={}){const{keys:n,records:a}=e,s=new b0({getFn:t,fieldNormWeight:r});return s.setKeys(n),s.setIndexRecords(a),s}function cc(e,{errors:t=0,currentLocation:r=0,expectedLocation:n=0,distance:a=at.distance,ignoreLocation:s=at.ignoreLocation}={}){const o=t/e.length;if(s)return o;const l=Math.abs(n-r);return a?o+l/a:l?1:o}function SU(e=[],t=at.minMatchCharLength){let r=[],n=-1,a=-1,s=0;for(let o=e.length;s<o;s+=1){let l=e[s];l&&n===-1?n=s:!l&&n!==-1&&(a=s-1,a-n+1>=t&&r.push([n,a]),n=-1)}return e[s-1]&&s-n>=t&&r.push([n,s-1]),r}const Oi=32;function EU(e,t,r,{location:n=at.location,distance:a=at.distance,threshold:s=at.threshold,findAllMatches:o=at.findAllMatches,minMatchCharLength:l=at.minMatchCharLength,includeMatches:c=at.includeMatches,ignoreLocation:d=at.ignoreLocation}={}){if(t.length>Oi)throw new Error(uU(Oi));const u=t.length,p=e.length,f=Math.max(0,Math.min(n,p));let m=s,g=f;const b=l>1||c,x=b?Array(p):[];let y;for(;(y=e.indexOf(t,g))>-1;){let j=cc(t,{currentLocation:y,expectedLocation:f,distance:a,ignoreLocation:d});if(m=Math.min(j,m),g=y+u,b){let _=0;for(;_<u;)x[y+_]=1,_+=1}}g=-1;let v=[],w=1,k=u+p;const E=1<<u-1;for(let j=0;j<u;j+=1){let _=0,T=k;for(;_<T;)cc(t,{errors:j,currentLocation:f+T,expectedLocation:f,distance:a,ignoreLocation:d})<=m?_=T:k=T,T=Math.floor((k-_)/2+_);k=T;let C=Math.max(1,f-T+1),L=o?p:Math.min(f+T,p)+u,A=Array(L+2);A[L+1]=(1<<j)-1;for(let N=L;N>=C;N-=1){let P=N-1,H=r[e.charAt(P)];if(b&&(x[P]=+!!H),A[N]=(A[N+1]<<1|1)&H,j&&(A[N]|=(v[N+1]|v[N])<<1|1|v[N+1]),A[N]&E&&(w=cc(t,{errors:j,currentLocation:P,expectedLocation:f,distance:a,ignoreLocation:d}),w<=m)){if(m=w,g=P,g<=f)break;C=Math.max(1,2*f-g)}}if(cc(t,{errors:j+1,currentLocation:f,expectedLocation:f,distance:a,ignoreLocation:d})>m)break;v=A}const S={isMatch:g>=0,score:Math.max(.001,w)};if(b){const j=SU(x,l);j.length?c&&(S.indices=j):S.isMatch=!1}return S}function NU(e){let t={};for(let r=0,n=e.length;r<n;r+=1){const a=e.charAt(r);t[a]=(t[a]||0)|1<<n-r-1}return t}const yd=String.prototype.normalize?e=>e.normalize("NFD").replace(/[\u0300-\u036F\u0483-\u0489\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u0610-\u061A\u064B-\u065F\u0670\u06D6-\u06DC\u06DF-\u06E4\u06E7\u06E8\u06EA-\u06ED\u0711\u0730-\u074A\u07A6-\u07B0\u07EB-\u07F3\u07FD\u0816-\u0819\u081B-\u0823\u0825-\u0827\u0829-\u082D\u0859-\u085B\u08D3-\u08E1\u08E3-\u0903\u093A-\u093C\u093E-\u094F\u0951-\u0957\u0962\u0963\u0981-\u0983\u09BC\u09BE-\u09C4\u09C7\u09C8\u09CB-\u09CD\u09D7\u09E2\u09E3\u09FE\u0A01-\u0A03\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A70\u0A71\u0A75\u0A81-\u0A83\u0ABC\u0ABE-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AE2\u0AE3\u0AFA-\u0AFF\u0B01-\u0B03\u0B3C\u0B3E-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B62\u0B63\u0B82\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD7\u0C00-\u0C04\u0C3E-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C62\u0C63\u0C81-\u0C83\u0CBC\u0CBE-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CE2\u0CE3\u0D00-\u0D03\u0D3B\u0D3C\u0D3E-\u0D44\u0D46-\u0D48\u0D4A-\u0D4D\u0D57\u0D62\u0D63\u0D82\u0D83\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DF2\u0DF3\u0E31\u0E34-\u0E3A\u0E47-\u0E4E\u0EB1\u0EB4-\u0EB9\u0EBB\u0EBC\u0EC8-\u0ECD\u0F18\u0F19\u0F35\u0F37\u0F39\u0F3E\u0F3F\u0F71-\u0F84\u0F86\u0F87\u0F8D-\u0F97\u0F99-\u0FBC\u0FC6\u102B-\u103E\u1056-\u1059\u105E-\u1060\u1062-\u1064\u1067-\u106D\u1071-\u1074\u1082-\u108D\u108F\u109A-\u109D\u135D-\u135F\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17B4-\u17D3\u17DD\u180B-\u180D\u1885\u1886\u18A9\u1920-\u192B\u1930-\u193B\u1A17-\u1A1B\u1A55-\u1A5E\u1A60-\u1A7C\u1A7F\u1AB0-\u1ABE\u1B00-\u1B04\u1B34-\u1B44\u1B6B-\u1B73\u1B80-\u1B82\u1BA1-\u1BAD\u1BE6-\u1BF3\u1C24-\u1C37\u1CD0-\u1CD2\u1CD4-\u1CE8\u1CED\u1CF2-\u1CF4\u1CF7-\u1CF9\u1DC0-\u1DF9\u1DFB-\u1DFF\u20D0-\u20F0\u2CEF-\u2CF1\u2D7F\u2DE0-\u2DFF\u302A-\u302F\u3099\u309A\uA66F-\uA672\uA674-\uA67D\uA69E\uA69F\uA6F0\uA6F1\uA802\uA806\uA80B\uA823-\uA827\uA880\uA881\uA8B4-\uA8C5\uA8E0-\uA8F1\uA8FF\uA926-\uA92D\uA947-\uA953\uA980-\uA983\uA9B3-\uA9C0\uA9E5\uAA29-\uAA36\uAA43\uAA4C\uAA4D\uAA7B-\uAA7D\uAAB0\uAAB2-\uAAB4\uAAB7\uAAB8\uAABE\uAABF\uAAC1\uAAEB-\uAAEF\uAAF5\uAAF6\uABE3-\uABEA\uABEC\uABED\uFB1E\uFE00-\uFE0F\uFE20-\uFE2F]/g,""):e=>e;class C3{constructor(t,{location:r=at.location,threshold:n=at.threshold,distance:a=at.distance,includeMatches:s=at.includeMatches,findAllMatches:o=at.findAllMatches,minMatchCharLength:l=at.minMatchCharLength,isCaseSensitive:c=at.isCaseSensitive,ignoreDiacritics:d=at.ignoreDiacritics,ignoreLocation:u=at.ignoreLocation}={}){if(this.options={location:r,threshold:n,distance:a,includeMatches:s,findAllMatches:o,minMatchCharLength:l,isCaseSensitive:c,ignoreDiacritics:d,ignoreLocation:u},t=c?t:t.toLowerCase(),t=d?yd(t):t,this.pattern=t,this.chunks=[],!this.pattern.length)return;const p=(m,g)=>{this.chunks.push({pattern:m,alphabet:NU(m),startIndex:g})},f=this.pattern.length;if(f>Oi){let m=0;const g=f%Oi,b=f-g;for(;m<b;)p(this.pattern.substr(m,Oi),m),m+=Oi;if(g){const x=f-Oi;p(this.pattern.substr(x),x)}}else p(this.pattern,0)}searchIn(t){const{isCaseSensitive:r,ignoreDiacritics:n,includeMatches:a}=this.options;if(t=r?t:t.toLowerCase(),t=n?yd(t):t,this.pattern===t){let b={isMatch:!0,score:0};return a&&(b.indices=[[0,t.length-1]]),b}const{location:s,distance:o,threshold:l,findAllMatches:c,minMatchCharLength:d,ignoreLocation:u}=this.options;let p=[],f=0,m=!1;this.chunks.forEach(({pattern:b,alphabet:x,startIndex:y})=>{const{isMatch:v,score:w,indices:k}=EU(t,b,x,{location:s+y,distance:o,threshold:l,findAllMatches:c,minMatchCharLength:d,includeMatches:a,ignoreLocation:u});v&&(m=!0),f+=w,v&&k&&(p=[...p,...k])});let g={isMatch:m,score:m?f/this.chunks.length:1};return m&&a&&(g.indices=p),g}}class hi{constructor(t){this.pattern=t}static isMultiMatch(t){return d2(t,this.multiRegex)}static isSingleMatch(t){return d2(t,this.singleRegex)}search(){}}function d2(e,t){const r=e.match(t);return r?r[1]:null}class CU extends hi{constructor(t){super(t)}static get type(){return"exact"}static get multiRegex(){return/^="(.*)"$/}static get singleRegex(){return/^=(.*)$/}search(t){const r=t===this.pattern;return{isMatch:r,score:r?0:1,indices:[0,this.pattern.length-1]}}}class AU extends hi{constructor(t){super(t)}static get type(){return"inverse-exact"}static get multiRegex(){return/^!"(.*)"$/}static get singleRegex(){return/^!(.*)$/}search(t){const n=t.indexOf(this.pattern)===-1;return{isMatch:n,score:n?0:1,indices:[0,t.length-1]}}}class TU extends hi{constructor(t){super(t)}static get type(){return"prefix-exact"}static get multiRegex(){return/^\^"(.*)"$/}static get singleRegex(){return/^\^(.*)$/}search(t){const r=t.startsWith(this.pattern);return{isMatch:r,score:r?0:1,indices:[0,this.pattern.length-1]}}}class jU extends hi{constructor(t){super(t)}static get type(){return"inverse-prefix-exact"}static get multiRegex(){return/^!\^"(.*)"$/}static get singleRegex(){return/^!\^(.*)$/}search(t){const r=!t.startsWith(this.pattern);return{isMatch:r,score:r?0:1,indices:[0,t.length-1]}}}class _U extends hi{constructor(t){super(t)}static get type(){return"suffix-exact"}static get multiRegex(){return/^"(.*)"\$$/}static get singleRegex(){return/^(.*)\$$/}search(t){const r=t.endsWith(this.pattern);return{isMatch:r,score:r?0:1,indices:[t.length-this.pattern.length,t.length-1]}}}class IU extends hi{constructor(t){super(t)}static get type(){return"inverse-suffix-exact"}static get multiRegex(){return/^!"(.*)"\$$/}static get singleRegex(){return/^!(.*)\$$/}search(t){const r=!t.endsWith(this.pattern);return{isMatch:r,score:r?0:1,indices:[0,t.length-1]}}}class A3 extends hi{constructor(t,{location:r=at.location,threshold:n=at.threshold,distance:a=at.distance,includeMatches:s=at.includeMatches,findAllMatches:o=at.findAllMatches,minMatchCharLength:l=at.minMatchCharLength,isCaseSensitive:c=at.isCaseSensitive,ignoreDiacritics:d=at.ignoreDiacritics,ignoreLocation:u=at.ignoreLocation}={}){super(t),this._bitapSearch=new C3(t,{location:r,threshold:n,distance:a,includeMatches:s,findAllMatches:o,minMatchCharLength:l,isCaseSensitive:c,ignoreDiacritics:d,ignoreLocation:u})}static get type(){return"fuzzy"}static get multiRegex(){return/^"(.*)"$/}static get singleRegex(){return/^(.*)$/}search(t){return this._bitapSearch.searchIn(t)}}class T3 extends hi{constructor(t){super(t)}static get type(){return"include"}static get multiRegex(){return/^'"(.*)"$/}static get singleRegex(){return/^'(.*)$/}search(t){let r=0,n;const a=[],s=this.pattern.length;for(;(n=t.indexOf(this.pattern,r))>-1;)r=n+s,a.push([n,r-1]);const o=!!a.length;return{isMatch:o,score:o?0:1,indices:a}}}const Th=[CU,T3,TU,jU,IU,_U,AU,A3],u2=Th.length,RU=/ +(?=(?:[^\"]*\"[^\"]*\")*[^\"]*$)/,LU="|";function DU(e,t={}){return e.split(LU).map(r=>{let n=r.trim().split(RU).filter(s=>s&&!!s.trim()),a=[];for(let s=0,o=n.length;s<o;s+=1){const l=n[s];let c=!1,d=-1;for(;!c&&++d<u2;){const u=Th[d];let p=u.isMultiMatch(l);p&&(a.push(new u(p,t)),c=!0)}if(!c)for(d=-1;++d<u2;){const u=Th[d];let p=u.isSingleMatch(l);if(p){a.push(new u(p,t));break}}}return a})}const OU=new Set([A3.type,T3.type]);class MU{constructor(t,{isCaseSensitive:r=at.isCaseSensitive,ignoreDiacritics:n=at.ignoreDiacritics,includeMatches:a=at.includeMatches,minMatchCharLength:s=at.minMatchCharLength,ignoreLocation:o=at.ignoreLocation,findAllMatches:l=at.findAllMatches,location:c=at.location,threshold:d=at.threshold,distance:u=at.distance}={}){this.query=null,this.options={isCaseSensitive:r,ignoreDiacritics:n,includeMatches:a,minMatchCharLength:s,findAllMatches:l,ignoreLocation:o,location:c,threshold:d,distance:u},t=r?t:t.toLowerCase(),t=n?yd(t):t,this.pattern=t,this.query=DU(this.pattern,this.options)}static condition(t,r){return r.useExtendedSearch}searchIn(t){const r=this.query;if(!r)return{isMatch:!1,score:1};const{includeMatches:n,isCaseSensitive:a,ignoreDiacritics:s}=this.options;t=a?t:t.toLowerCase(),t=s?yd(t):t;let o=0,l=[],c=0;for(let d=0,u=r.length;d<u;d+=1){const p=r[d];l.length=0,o=0;for(let f=0,m=p.length;f<m;f+=1){const g=p[f],{isMatch:b,indices:x,score:y}=g.search(t);if(b){if(o+=1,c+=y,n){const v=g.constructor.type;OU.has(v)?l=[...l,...x]:l.push(x)}}else{c=0,o=0,l.length=0;break}}if(o){let f={isMatch:!0,score:c/o};return n&&(f.indices=l),f}}return{isMatch:!1,score:1}}}const jh=[];function PU(...e){jh.push(...e)}function _h(e,t){for(let r=0,n=jh.length;r<n;r+=1){let a=jh[r];if(a.condition(e,t))return new a(e,t)}return new C3(e,t)}const vd={AND:"$and",OR:"$or"},Ih={PATH:"$path",PATTERN:"$val"},Rh=e=>!!(e[vd.AND]||e[vd.OR]),FU=e=>!!e[Ih.PATH],zU=e=>!ja(e)&&k3(e)&&!Rh(e),p2=e=>({[vd.AND]:Object.keys(e).map(t=>({[t]:e[t]}))});function j3(e,t,{auto:r=!0}={}){const n=a=>{let s=Object.keys(a);const o=FU(a);if(!o&&s.length>1&&!Rh(a))return n(p2(a));if(zU(a)){const c=o?a[Ih.PATH]:s[0],d=o?a[Ih.PATTERN]:a[c];if(!Jn(d))throw new Error(dU(c));const u={keyId:Ah(c),pattern:d};return r&&(u.searcher=_h(d,t)),u}let l={children:[],operator:s[0]};return s.forEach(c=>{const d=a[c];ja(d)&&d.forEach(u=>{l.children.push(n(u))})}),l};return Rh(e)||(e=p2(e)),n(e)}function BU(e,{ignoreFieldNorm:t=at.ignoreFieldNorm}){e.forEach(r=>{let n=1;r.matches.forEach(({key:a,norm:s,score:o})=>{const l=a?a.weight:null;n*=Math.pow(o===0&&l?Number.EPSILON:o,(l||1)*(t?1:s))}),r.score=n})}function $U(e,t){const r=e.matches;t.matches=[],on(r)&&r.forEach(n=>{if(!on(n.indices)||!n.indices.length)return;const{indices:a,value:s}=n;let o={indices:a,value:s};n.key&&(o.key=n.key.src),n.idx>-1&&(o.refIndex=n.idx),t.matches.push(o)})}function UU(e,t){t.score=e.score}function GU(e,t,{includeMatches:r=at.includeMatches,includeScore:n=at.includeScore}={}){const a=[];return r&&a.push($U),n&&a.push(UU),e.map(s=>{const{idx:o}=s,l={item:t[o],refIndex:o};return a.length&&a.forEach(c=>{c(s,l)}),l})}class co{constructor(t,r={},n){this.options={...at,...r},this.options.useExtendedSearch,this._keyStore=new hU(this.options.keys),this.setCollection(t,n)}setCollection(t,r){if(this._docs=t,r&&!(r instanceof b0))throw new Error(cU);this._myIndex=r||N3(this.options.keys,this._docs,{getFn:this.options.getFn,fieldNormWeight:this.options.fieldNormWeight})}add(t){on(t)&&(this._docs.push(t),this._myIndex.add(t))}remove(t=()=>!1){const r=[];for(let n=0,a=this._docs.length;n<a;n+=1){const s=this._docs[n];t(s,n)&&(this.removeAt(n),n-=1,a-=1,r.push(s))}return r}removeAt(t){this._docs.splice(t,1),this._myIndex.removeAt(t)}getIndex(){return this._myIndex}search(t,{limit:r=-1}={}){const{includeMatches:n,includeScore:a,shouldSort:s,sortFn:o,ignoreFieldNorm:l}=this.options;let c=Jn(t)?Jn(this._docs[0])?this._searchStringList(t):this._searchObjectList(t):this._searchLogical(t);return BU(c,{ignoreFieldNorm:l}),s&&c.sort(o),w3(r)&&r>-1&&(c=c.slice(0,r)),GU(c,this._docs,{includeMatches:n,includeScore:a})}_searchStringList(t){const r=_h(t,this.options),{records:n}=this._myIndex,a=[];return n.forEach(({v:s,i:o,n:l})=>{if(!on(s))return;const{isMatch:c,score:d,indices:u}=r.searchIn(s);c&&a.push({item:s,idx:o,matches:[{score:d,value:s,norm:l,indices:u}]})}),a}_searchLogical(t){const r=j3(t,this.options),n=(l,c,d)=>{if(!l.children){const{keyId:p,searcher:f}=l,m=this._findMatches({key:this._keyStore.get(p),value:this._myIndex.getValueForItemAtKeyId(c,p),searcher:f});return m&&m.length?[{idx:d,item:c,matches:m}]:[]}const u=[];for(let p=0,f=l.children.length;p<f;p+=1){const m=l.children[p],g=n(m,c,d);if(g.length)u.push(...g);else if(l.operator===vd.AND)return[]}return u},a=this._myIndex.records,s={},o=[];return a.forEach(({$:l,i:c})=>{if(on(l)){let d=n(r,l,c);d.length&&(s[c]||(s[c]={idx:c,item:l,matches:[]},o.push(s[c])),d.forEach(({matches:u})=>{s[c].matches.push(...u)}))}}),o}_searchObjectList(t){const r=_h(t,this.options),{keys:n,records:a}=this._myIndex,s=[];return a.forEach(({$:o,i:l})=>{if(!on(o))return;let c=[];n.forEach((d,u)=>{c.push(...this._findMatches({key:d,value:o[u],searcher:r}))}),c.length&&s.push({idx:l,item:o,matches:c})}),s}_findMatches({key:t,value:r,searcher:n}){if(!on(r))return[];let a=[];if(ja(r))r.forEach(({v:s,i:o,n:l})=>{if(!on(s))return;const{isMatch:c,score:d,indices:u}=n.searchIn(s);c&&a.push({score:d,key:t,value:s,idx:o,norm:l,indices:u})});else{const{v:s,n:o}=r,{isMatch:l,score:c,indices:d}=n.searchIn(s);l&&a.push({score:c,key:t,value:s,norm:o,indices:d})}return a}}co.version="7.1.0";co.createIndex=N3;co.parseIndex=kU;co.config=at;co.parseQuery=j3;PU(MU);const HU=150,_3=e=>`command_history_${e}`,Up=e=>{const t=Vn.getItem(_3(e));if(!t)return{};try{return JSON.parse(t)}catch(r){return console.error("Error parsing command history:",r),{}}},VU=(e,t)=>{Vn.setItem(_3(e),JSON.stringify(t))},m2=e=>!!e&&typeof e.then=="function";function qU({selectedProject:e,input:t,setInput:r,textareaRef:n,onExecuteCommand:a}){const[s,o]=h.useState([]),[l,c]=h.useState([]),[d,u]=h.useState(!1),[p,f]=h.useState(""),[m,g]=h.useState(-1),[b,x]=h.useState(-1),y=h.useRef(null),v=h.useCallback(()=>{y.current!==null&&(window.clearTimeout(y.current),y.current=null)},[]),w=h.useCallback(()=>{u(!1),x(-1),f(""),g(-1),v()},[v]);h.useEffect(()=>{(async()=>{if(!e){o([]),c([]);return}try{const I=await ve("/api/commands/list",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({projectPath:e.path})});if(!I.ok)throw new Error("Failed to fetch commands");const N=await I.json(),P=[...(N.builtIn||[]).map(U=>({...U,type:"built-in"})),...(N.custom||[]).map(U=>({...U,type:"custom"}))],H=Up(e.name),z=[...P].sort((U,V)=>{const O=H[U.name]||0;return(H[V.name]||0)-O});o(z)}catch(I){console.error("Error fetching slash commands:",I),o([])}})()},[e]),h.useEffect(()=>{d||g(-1)},[d]);const k=h.useMemo(()=>s.length?new co(s,{keys:[{name:"name",weight:2},{name:"description",weight:1}],threshold:.4,includeScore:!0,minMatchCharLength:1}):null,[s]);h.useEffect(()=>{if(!p){c(s);return}if(!k){c([]);return}const A=k.search(p);c(A.map(I=>I.item))},[p,s,k]);const E=h.useMemo(()=>{if(!e||s.length===0)return[];const A=Up(e.name);return s.map(I=>({...I,usageCount:A[I.name]||0})).filter(I=>I.usageCount>0).sort((I,N)=>N.usageCount-I.usageCount).slice(0,5)},[e,s]),S=h.useCallback(A=>{if(!e)return;const I=Up(e.name);I[A.name]=(I[A.name]||0)+1,VU(e.name,I)},[e]),j=h.useCallback(A=>{const I=t.slice(0,b),N=t.slice(b),P=N.indexOf(" "),H=P!==-1?N.slice(P):"",z=`${I}${A.name} ${H}`;r(z),w();const U=a(A);m2(U)&&U.catch(()=>{})},[t,b,r,w,a]),_=h.useCallback((A,I,N)=>{if(!A||!e)return;if(N){g(I);return}S(A);const P=a(A);m2(P)?(P.then(()=>{w()}),P.catch(()=>{})):w()},[e,S,a,w]),T=h.useCallback(()=>{const A=!d;u(A),f(""),g(-1),A&&c(s),n.current?.focus()},[d,s,n]),C=h.useCallback((A,I)=>{if(!A.trim()){w();return}const N=A.slice(0,I);if((N.match(/```/g)||[]).length%2===1){w();return}const z=/(^|\s)\/(\S*)$/,U=N.match(z);if(!U){w();return}const V=(U.index||0)+U[1].length,O=U[2];x(V),u(!0),g(-1),v(),y.current=window.setTimeout(()=>{f(O)},HU)},[w,v]),L=h.useCallback(A=>d?l.length?A.key==="ArrowDown"?(A.preventDefault(),g(I=>I<l.length-1?I+1:0),!0):A.key==="ArrowUp"?(A.preventDefault(),g(I=>I>0?I-1:l.length-1),!0):A.key==="Tab"||A.key==="Enter"?(A.preventDefault(),m>=0?j(l[m]):l.length>0&&j(l[0]),!0):A.key==="Escape"?(A.preventDefault(),w(),!0):!1:A.key==="Escape"?(A.preventDefault(),w(),!0):!1:!1,[d,l,w,j,m]);return h.useEffect(()=>()=>{v()},[v]),{slashCommands:s,slashCommandsCount:s.length,filteredCommands:l,frequentCommands:E,commandQuery:p,showCommandMenu:d,selectedCommandIndex:m,resetCommandMenuState:w,handleCommandSelect:_,handleToggleCommandMenu:T,handleCommandInputChange:C,handleCommandMenuKeyDown:L}}const WU=()=>({preventDefault:()=>{}}),Gp=e=>!!(e&&e.startsWith("new-session-"));function KU(e){const t=e&&typeof e=="object"?e:{};if(typeof t.error=="string")return t.error;const r=Array.isArray(t.messages)?t.messages:[],n=[];for(const a of r)a&&typeof a=="object"&&typeof a.content=="string"&&n.push(a.content);return n.join(`
316
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function u3(e,t){if(e){if(typeof e=="string")return Sh(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Sh(e,t)}}function Sh(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function Y$(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var n=[],a=!0,s=!1,o,l;try{for(r=r.call(e);!(a=(o=r.next()).done)&&(n.push(o.value),!(t&&n.length===t));a=!0);}catch(c){s=!0,l=c}finally{try{!a&&r.return!=null&&r.return()}finally{if(s)throw l}}return n}}function Z$(e){if(Array.isArray(e))return e}function i2(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,n)}return r}function qt(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?i2(Object(r),!0).forEach(function(n){Eh(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):i2(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Eh(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function xd(e,t){if(e==null)return{};var r=X$(e,t),n,a;if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(a=0;a<s.length;a++)n=s[a],!(t.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function X$(e,t){if(e==null)return{};var r={},n=Object.keys(e),a,s;for(s=0;s<n.length;s++)a=n[s],!(t.indexOf(a)>=0)&&(r[a]=e[a]);return r}var h0=h.forwardRef(function(e,t){var r=e.children,n=xd(e,B$),a=m3(n),s=a.open,o=xd(a,$$);return h.useImperativeHandle(t,function(){return{open:s}},[s]),qr.createElement(h.Fragment,null,r(qt(qt({},o),{},{open:s})))});h0.displayName="Dropzone";var p3={disabled:!1,getFilesFromEvent:o$,maxSize:1/0,minSize:0,multiple:!0,maxFiles:0,preventDropOnDocument:!0,noClick:!1,noKeyboard:!1,noDrag:!1,noDragEventsBubbling:!1,validator:null,useFsAccessApi:!1,autoFocus:!1};h0.defaultProps=p3;h0.propTypes={children:It.func,accept:It.objectOf(It.arrayOf(It.string)),multiple:It.bool,preventDropOnDocument:It.bool,noClick:It.bool,noKeyboard:It.bool,noDrag:It.bool,noDragEventsBubbling:It.bool,minSize:It.number,maxSize:It.number,maxFiles:It.number,disabled:It.bool,getFilesFromEvent:It.func,onFileDialogCancel:It.func,onFileDialogOpen:It.func,useFsAccessApi:It.bool,autoFocus:It.bool,onDragEnter:It.func,onDragLeave:It.func,onDragOver:It.func,onDrop:It.func,onDropAccepted:It.func,onDropRejected:It.func,onError:It.func,validator:It.func};var Nh={isFocused:!1,isFileDialogActive:!1,isDragActive:!1,isDragAccept:!1,isDragReject:!1,acceptedFiles:[],fileRejections:[]};function m3(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=qt(qt({},p3),e),r=t.accept,n=t.disabled,a=t.getFilesFromEvent,s=t.maxSize,o=t.minSize,l=t.multiple,c=t.maxFiles,d=t.onDragEnter,u=t.onDragLeave,p=t.onDragOver,f=t.onDrop,m=t.onDropAccepted,g=t.onDropRejected,b=t.onFileDialogCancel,x=t.onFileDialogOpen,y=t.useFsAccessApi,v=t.autoFocus,w=t.preventDropOnDocument,k=t.noClick,E=t.noKeyboard,S=t.noDrag,j=t.noDragEventsBubbling,_=t.onError,T=t.validator,C=h.useMemo(function(){return P$(r)},[r]),L=h.useMemo(function(){return M$(r)},[r]),A=h.useMemo(function(){return typeof x=="function"?x:s2},[x]),I=h.useMemo(function(){return typeof b=="function"?b:s2},[b]),N=h.useRef(null),P=h.useRef(null),H=h.useReducer(J$,Nh),z=Bp(H,2),U=z[0],V=z[1],O=U.isFocused,G=U.isFileDialogActive,$=h.useRef(typeof window<"u"&&window.isSecureContext&&y&&O$()),F=function(){!$.current&&G&&setTimeout(function(){if(P.current){var X=P.current.files;X.length||(V({type:"closeDialog"}),I())}},300)};h.useEffect(function(){return window.addEventListener("focus",F,!1),function(){window.removeEventListener("focus",F,!1)}},[P,G,I,$]);var te=h.useRef([]),Q=function(X){N.current&&N.current.contains(X.target)||(X.preventDefault(),te.current=[])};h.useEffect(function(){return w&&(document.addEventListener("dragover",a2,!1),document.addEventListener("drop",Q,!1)),function(){w&&(document.removeEventListener("dragover",a2),document.removeEventListener("drop",Q))}},[N,w]),h.useEffect(function(){return!n&&v&&N.current&&N.current.focus(),function(){}},[N,v,n]);var ge=h.useCallback(function(re){_?_(re):console.error(re)},[_]),ae=h.useCallback(function(re){re.preventDefault(),re.persist(),fe(re),te.current=[].concat(H$(te.current),[re.target]),lc(re)&&Promise.resolve(a(re)).then(function(X){if(!(bd(re)&&!j)){var Z=X.length,le=Z>0&&I$({files:X,accept:C,minSize:o,maxSize:s,multiple:l,maxFiles:c,validator:T}),Ee=Z>0&&!le;V({isDragAccept:le,isDragReject:Ee,isDragActive:!0,type:"setDraggedFiles"}),d&&d(re)}}).catch(function(X){return ge(X)})},[a,d,ge,j,C,o,s,l,c,T]),me=h.useCallback(function(re){re.preventDefault(),re.persist(),fe(re);var X=lc(re);if(X&&re.dataTransfer)try{re.dataTransfer.dropEffect="copy"}catch{}return X&&p&&p(re),!1},[p,j]),pe=h.useCallback(function(re){re.preventDefault(),re.persist(),fe(re);var X=te.current.filter(function(le){return N.current&&N.current.contains(le)}),Z=X.indexOf(re.target);Z!==-1&&X.splice(Z,1),te.current=X,!(X.length>0)&&(V({type:"setDraggedFiles",isDragActive:!1,isDragAccept:!1,isDragReject:!1}),lc(re)&&u&&u(re))},[N,u,j]),be=h.useCallback(function(re,X){var Z=[],le=[];re.forEach(function(Ee){var Te=o3(Ee,C),Ke=Bp(Te,2),Ze=Ke[0],vt=Ke[1],Qe=l3(Ee,o,s),jt=Bp(Qe,2),wt=jt[0],st=jt[1],lt=T?T(Ee):null;if(Ze&&wt&&!lt)Z.push(Ee);else{var kt=[vt,st];lt&&(kt=kt.concat(lt)),le.push({file:Ee,errors:kt.filter(function(_t){return _t})})}}),(!l&&Z.length>1||l&&c>=1&&Z.length>c)&&(Z.forEach(function(Ee){le.push({file:Ee,errors:[_$]})}),Z.splice(0)),V({acceptedFiles:Z,fileRejections:le,isDragReject:le.length>0,type:"setFiles"}),f&&f(Z,le,X),le.length>0&&g&&g(le,X),Z.length>0&&m&&m(Z,X)},[V,l,C,o,s,c,f,m,g,T]),Ne=h.useCallback(function(re){re.preventDefault(),re.persist(),fe(re),te.current=[],lc(re)&&Promise.resolve(a(re)).then(function(X){bd(re)&&!j||be(X,re)}).catch(function(X){return ge(X)}),V({type:"reset"})},[a,be,ge,j]),xe=h.useCallback(function(){if($.current){V({type:"openDialog"}),A();var re={multiple:l,types:L};window.showOpenFilePicker(re).then(function(X){return a(X)}).then(function(X){be(X,null),V({type:"closeDialog"})}).catch(function(X){F$(X)?(I(X),V({type:"closeDialog"})):z$(X)?($.current=!1,P.current?(P.current.value=null,P.current.click()):ge(new Error("Cannot open the file picker because the https://developer.mozilla.org/en-US/docs/Web/API/File_System_Access_API is not supported and no <input> was provided."))):ge(X)});return}P.current&&(V({type:"openDialog"}),A(),P.current.value=null,P.current.click())},[V,A,I,y,be,ge,L,l]),Be=h.useCallback(function(re){!N.current||!N.current.isEqualNode(re.target)||(re.key===" "||re.key==="Enter"||re.keyCode===32||re.keyCode===13)&&(re.preventDefault(),xe())},[N,xe]),M=h.useCallback(function(){V({type:"focus"})},[]),de=h.useCallback(function(){V({type:"blur"})},[]),ce=h.useCallback(function(){k||(D$()?setTimeout(xe,0):xe())},[k,xe]),Y=function(X){return n?null:X},W=function(X){return E?null:Y(X)},ne=function(X){return S?null:Y(X)},fe=function(X){j&&X.stopPropagation()},ye=h.useMemo(function(){return function(){var re=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},X=re.refKey,Z=X===void 0?"ref":X,le=re.role,Ee=re.onKeyDown,Te=re.onFocus,Ke=re.onBlur,Ze=re.onClick,vt=re.onDragEnter,Qe=re.onDragOver,jt=re.onDragLeave,wt=re.onDrop,st=xd(re,U$);return qt(qt(Eh({onKeyDown:W($n(Ee,Be)),onFocus:W($n(Te,M)),onBlur:W($n(Ke,de)),onClick:Y($n(Ze,ce)),onDragEnter:ne($n(vt,ae)),onDragOver:ne($n(Qe,me)),onDragLeave:ne($n(jt,pe)),onDrop:ne($n(wt,Ne)),role:typeof le=="string"&&le!==""?le:"presentation"},Z,N),!n&&!E?{tabIndex:0}:{}),st)}},[N,Be,M,de,ce,ae,me,pe,Ne,E,S,n]),se=h.useCallback(function(re){re.stopPropagation()},[]),Se=h.useMemo(function(){return function(){var re=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},X=re.refKey,Z=X===void 0?"ref":X,le=re.onChange,Ee=re.onClick,Te=xd(re,G$),Ke=Eh({accept:C,multiple:l,type:"file",style:{border:0,clip:"rect(0, 0, 0, 0)",clipPath:"inset(50%)",height:"1px",margin:"0 -1px -1px 0",overflow:"hidden",padding:0,position:"absolute",width:"1px",whiteSpace:"nowrap"},onChange:Y($n(le,Ne)),onClick:Y($n(Ee,se)),tabIndex:-1},Z,P);return qt(qt({},Ke),Te)}},[P,r,l,Ne,n]);return qt(qt({},U),{},{isFocused:O&&!n,getRootProps:ye,getInputProps:Se,rootRef:N,inputRef:P,open:Y(xe)})}function J$(e,t){switch(t.type){case"focus":return qt(qt({},e),{},{isFocused:!0});case"blur":return qt(qt({},e),{},{isFocused:!1});case"openDialog":return qt(qt({},Nh),{},{isFileDialogActive:!0});case"closeDialog":return qt(qt({},e),{},{isFileDialogActive:!1});case"setDraggedFiles":return qt(qt({},e),{},{isDragActive:t.isDragActive,isDragAccept:t.isDragAccept,isDragReject:t.isDragReject});case"setFiles":return qt(qt({},e),{},{acceptedFiles:t.acceptedFiles,fileRejections:t.fileRejections,isDragReject:t.isDragReject});case"reset":return qt({},Nh);default:return e}}function s2(){}const h3=[{id:"none",name:"Standard",description:"Regular Claude response",icon:null,prefix:"",color:"text-gray-600"},{id:"think",name:"Think",description:"Basic extended thinking",icon:Rf,prefix:"think",color:"text-blue-600"},{id:"think-hard",name:"Think Hard",description:"More thorough evaluation",icon:If,prefix:"think hard",color:"text-purple-600"},{id:"think-harder",name:"Think Harder",description:"Deep analysis with alternatives",icon:Na,prefix:"think harder",color:"text-indigo-600"},{id:"ultrathink",name:"Ultrathink",description:"Maximum thinking budget",icon:UD,prefix:"ultrathink",color:"text-red-600"}],f3="claude-settings",Vn={setItem:(e,t)=>{try{localStorage.setItem(e,t)}catch(r){if(r?.name==="QuotaExceededError"){console.warn("localStorage quota exceeded, clearing old data"),Object.keys(localStorage).filter(s=>s.startsWith("draft_input_")).forEach(s=>{localStorage.removeItem(s)});try{localStorage.setItem(e,t)}catch(s){console.error("Failed to save to localStorage even after cleanup:",s)}}else console.error("localStorage error:",r)}},getItem:e=>{try{return localStorage.getItem(e)}catch(t){return console.error("localStorage getItem error:",t),null}},removeItem:e=>{try{localStorage.removeItem(e)}catch(t){console.error("localStorage removeItem error:",t)}}};function f0(){const e=Vn.getItem(f3);if(!e)return{allowedTools:[],disallowedTools:[],skipPermissions:!1,projectSortOrder:"name"};try{const t=JSON.parse(e);return{...t,allowedTools:Array.isArray(t.allowedTools)?t.allowedTools:[],disallowedTools:Array.isArray(t.disallowedTools)?t.disallowedTools:[],skipPermissions:!!t.skipPermissions,projectSortOrder:t.projectSortOrder||"name"}}catch{return{allowedTools:[],disallowedTools:[],skipPermissions:!1,projectSortOrder:"name"}}}function Ch(e,t){if(!e)return null;if(e!=="Bash")return e;const r=YO(t),n=typeof r?.command=="string"?r.command.trim():"";if(!n)return e;const a=n.split(/\s+/);return a.length===0?e:a[0]==="git"&&a[1]?`Bash(${a[0]} ${a[1]}:*)`:`Bash(${a[0]}:*)`}function o2(e){if(e==null)return"";if(typeof e=="string")return e;try{return JSON.stringify(e,null,2)}catch{return String(e)}}function Q$(e,t){if(t!=="claude"||!e?.toolResult?.isError)return null;const r=e?.toolName,n=Ch(r,e.toolInput);if(!n)return null;const s=f0().allowedTools.includes(n);return{toolName:r||"UnknownTool",entry:n,isAllowed:s}}function eU(e){if(!e)return{success:!1};const t=f0(),r=t.allowedTools.includes(e),n=r?t.allowedTools:[...t.allowedTools,e],a=t.disallowedTools.filter(o=>o!==e),s={...t,allowedTools:n,disallowedTools:a,lastUpdated:new Date().toISOString()};return Vn.setItem(f3,JSON.stringify(s)),{success:!0,alreadyAllowed:r,updatedSettings:s}}const Qa=4,g3="pixcode.workerSlots.v1",g0={claude:no.DEFAULT,cursor:ao.DEFAULT,codex:io.DEFAULT,gemini:lo.DEFAULT,qwen:so.DEFAULT,opencode:oo.DEFAULT},b3=["claude","cursor","codex","gemini","qwen","opencode"];function x3(e={}){const t=e.provider||"claude";return{id:e.id||`worker-${Date.now()}-${Math.random().toString(36).slice(2,7)}`,enabled:e.enabled??!0,provider:t,model:e.model||g0[t],projectName:e.projectName,projectPath:e.projectPath,mode:e.mode||"current_project"}}function y3(e){return e.model||g0[e.provider]}function tU(e){return Array.isArray(e)?e.slice(0,Qa).map(t=>{const r=t&&typeof t=="object"?t:{},n=b3.includes(r.provider)?r.provider:"claude";return x3({id:typeof r.id=="string"?r.id:void 0,enabled:r.enabled!==!1,provider:n,model:typeof r.model=="string"?r.model:g0[n],projectName:typeof r.projectName=="string"?r.projectName:void 0,projectPath:typeof r.projectPath=="string"?r.projectPath:void 0,mode:r.mode==="new_chat"?"new_chat":"current_project"})}):[]}function rU(){try{return tU(JSON.parse(localStorage.getItem(g3)||"[]"))}catch{return[]}}function nU(e){try{localStorage.setItem(g3,JSON.stringify(e.slice(0,Qa)))}catch{}}const v3=(e,t="")=>{let r=[];return e.forEach(n=>{const a=t?`${t}/${n.name}`:n.name;if(n.type==="directory"&&n.children){r=r.concat(v3(n.children,a));return}n.type==="file"&&r.push({name:n.name,path:a,relativePath:n.path})}),r};function aU({selectedProject:e,input:t,setInput:r,textareaRef:n}){const[a,s]=h.useState([]),[o,l]=h.useState([]),[c,d]=h.useState([]),[u,p]=h.useState(!1),[f,m]=h.useState(-1),[g,b]=h.useState(0),[x,y]=h.useState(-1);h.useEffect(()=>{const T=new AbortController;return(async()=>{const L=e?.name;if(s([]),d([]),!!L)try{const A=await ot.getFiles(L,{signal:T.signal});if(!A.ok)return;const I=await A.json();s(v3(I))}catch(A){if(A?.name==="AbortError")return;console.error("Error fetching files:",A)}})(),()=>{T.abort()}},[e?.name]),h.useEffect(()=>{const T=t.slice(0,g),C=T.lastIndexOf("@");if(C===-1){p(!1),y(-1);return}const L=T.slice(C+1);if(L.includes(" ")){p(!1),y(-1);return}y(C),p(!0),m(-1);const A=a.filter(I=>I.name.toLowerCase().includes(L.toLowerCase())||I.path.toLowerCase().includes(L.toLowerCase())).slice(0,10);d(A)},[t,g,a]);const v=h.useMemo(()=>!t||o.length===0?[]:o.filter(T=>t.includes(T)),[o,t]),w=h.useMemo(()=>v.length===0?[]:Array.from(new Set(v)).sort((C,L)=>L.length-C.length),[v]),k=h.useMemo(()=>{if(w.length===0)return null;const T=w.map(r3).join("|");return new RegExp(`(${T})`,"g")},[w]),E=h.useMemo(()=>new Set(w),[w]),S=h.useCallback(T=>T?k?T.split(k).map((L,A)=>E.has(L)?i.jsx("span",{className:"-ml-0.5 rounded-md bg-blue-200/70 box-decoration-clone px-0.5 text-transparent dark:bg-blue-300/40",children:L},`mention-${A}`):i.jsx("span",{children:L},`text-${A}`)):T:"",[k,E]),j=h.useCallback(T=>{const C=t.slice(0,x),L=t.slice(x),A=L.indexOf(" "),I=A!==-1?L.slice(A):"",N=`${C}${T.path} ${I}`,P=C.length+T.path.length+1;n.current&&!n.current.matches(":focus")&&n.current.focus(),r(N),b(P),l(H=>H.includes(T.path)?H:[...H,T.path]),p(!1),y(-1),n.current&&requestAnimationFrame(()=>{n.current&&(n.current.setSelectionRange(P,P),n.current.matches(":focus")||n.current.focus())})},[t,x,n,r]),_=h.useCallback(T=>!u||c.length===0?!1:T.key==="ArrowDown"?(T.preventDefault(),m(C=>C<c.length-1?C+1:0),!0):T.key==="ArrowUp"?(T.preventDefault(),m(C=>C>0?C-1:c.length-1),!0):T.key==="Tab"||T.key==="Enter"?(T.preventDefault(),f>=0?j(c[f]):c.length>0&&j(c[0]),!0):T.key==="Escape"?(T.preventDefault(),p(!1),!0):!1,[u,c,f,j]);return{showFileDropdown:u,filteredFiles:c,selectedFileIndex:f,renderInputWithMentions:S,selectFile:j,setCursorPosition:b,handleFileMentionsKeyDown:_}}function ja(e){return Array.isArray?Array.isArray(e):S3(e)==="[object Array]"}function iU(e){if(typeof e=="string")return e;let t=e+"";return t=="0"&&1/e==-1/0?"-0":t}function sU(e){return e==null?"":iU(e)}function Jn(e){return typeof e=="string"}function w3(e){return typeof e=="number"}function oU(e){return e===!0||e===!1||lU(e)&&S3(e)=="[object Boolean]"}function k3(e){return typeof e=="object"}function lU(e){return k3(e)&&e!==null}function on(e){return e!=null}function $p(e){return!e.trim().length}function S3(e){return e==null?e===void 0?"[object Undefined]":"[object Null]":Object.prototype.toString.call(e)}const cU="Incorrect 'index' type",dU=e=>`Invalid value for key ${e}`,uU=e=>`Pattern length exceeds max of ${e}.`,pU=e=>`Missing ${e} property in key`,mU=e=>`Property 'weight' in key '${e}' must be a positive integer`,l2=Object.prototype.hasOwnProperty;class hU{constructor(t){this._keys=[],this._keyMap={};let r=0;t.forEach(n=>{let a=E3(n);this._keys.push(a),this._keyMap[a.id]=a,r+=a.weight}),this._keys.forEach(n=>{n.weight/=r})}get(t){return this._keyMap[t]}keys(){return this._keys}toJSON(){return JSON.stringify(this._keys)}}function E3(e){let t=null,r=null,n=null,a=1,s=null;if(Jn(e)||ja(e))n=e,t=c2(e),r=Ah(e);else{if(!l2.call(e,"name"))throw new Error(pU("name"));const o=e.name;if(n=o,l2.call(e,"weight")&&(a=e.weight,a<=0))throw new Error(mU(o));t=c2(o),r=Ah(o),s=e.getFn}return{path:t,id:r,weight:a,src:n,getFn:s}}function c2(e){return ja(e)?e:e.split(".")}function Ah(e){return ja(e)?e.join("."):e}function fU(e,t){let r=[],n=!1;const a=(s,o,l)=>{if(on(s))if(!o[l])r.push(s);else{let c=o[l];const d=s[c];if(!on(d))return;if(l===o.length-1&&(Jn(d)||w3(d)||oU(d)))r.push(sU(d));else if(ja(d)){n=!0;for(let u=0,p=d.length;u<p;u+=1)a(d[u],o,l+1)}else o.length&&a(d,o,l+1)}};return a(e,Jn(t)?t.split("."):t,0),n?r:r[0]}const gU={includeMatches:!1,findAllMatches:!1,minMatchCharLength:1},bU={isCaseSensitive:!1,ignoreDiacritics:!1,includeScore:!1,keys:[],shouldSort:!0,sortFn:(e,t)=>e.score===t.score?e.idx<t.idx?-1:1:e.score<t.score?-1:1},xU={location:0,threshold:.6,distance:100},yU={useExtendedSearch:!1,getFn:fU,ignoreLocation:!1,ignoreFieldNorm:!1,fieldNormWeight:1};var at={...bU,...gU,...xU,...yU};const vU=/[^ ]+/g;function wU(e=1,t=3){const r=new Map,n=Math.pow(10,t);return{get(a){const s=a.match(vU).length;if(r.has(s))return r.get(s);const o=1/Math.pow(s,.5*e),l=parseFloat(Math.round(o*n)/n);return r.set(s,l),l},clear(){r.clear()}}}class b0{constructor({getFn:t=at.getFn,fieldNormWeight:r=at.fieldNormWeight}={}){this.norm=wU(r,3),this.getFn=t,this.isCreated=!1,this.setIndexRecords()}setSources(t=[]){this.docs=t}setIndexRecords(t=[]){this.records=t}setKeys(t=[]){this.keys=t,this._keysMap={},t.forEach((r,n)=>{this._keysMap[r.id]=n})}create(){this.isCreated||!this.docs.length||(this.isCreated=!0,Jn(this.docs[0])?this.docs.forEach((t,r)=>{this._addString(t,r)}):this.docs.forEach((t,r)=>{this._addObject(t,r)}),this.norm.clear())}add(t){const r=this.size();Jn(t)?this._addString(t,r):this._addObject(t,r)}removeAt(t){this.records.splice(t,1);for(let r=t,n=this.size();r<n;r+=1)this.records[r].i-=1}getValueForItemAtKeyId(t,r){return t[this._keysMap[r]]}size(){return this.records.length}_addString(t,r){if(!on(t)||$p(t))return;let n={v:t,i:r,n:this.norm.get(t)};this.records.push(n)}_addObject(t,r){let n={i:r,$:{}};this.keys.forEach((a,s)=>{let o=a.getFn?a.getFn(t):this.getFn(t,a.path);if(on(o)){if(ja(o)){let l=[];const c=[{nestedArrIndex:-1,value:o}];for(;c.length;){const{nestedArrIndex:d,value:u}=c.pop();if(on(u))if(Jn(u)&&!$p(u)){let p={v:u,i:d,n:this.norm.get(u)};l.push(p)}else ja(u)&&u.forEach((p,f)=>{c.push({nestedArrIndex:f,value:p})})}n.$[s]=l}else if(Jn(o)&&!$p(o)){let l={v:o,n:this.norm.get(o)};n.$[s]=l}}}),this.records.push(n)}toJSON(){return{keys:this.keys,records:this.records}}}function N3(e,t,{getFn:r=at.getFn,fieldNormWeight:n=at.fieldNormWeight}={}){const a=new b0({getFn:r,fieldNormWeight:n});return a.setKeys(e.map(E3)),a.setSources(t),a.create(),a}function kU(e,{getFn:t=at.getFn,fieldNormWeight:r=at.fieldNormWeight}={}){const{keys:n,records:a}=e,s=new b0({getFn:t,fieldNormWeight:r});return s.setKeys(n),s.setIndexRecords(a),s}function cc(e,{errors:t=0,currentLocation:r=0,expectedLocation:n=0,distance:a=at.distance,ignoreLocation:s=at.ignoreLocation}={}){const o=t/e.length;if(s)return o;const l=Math.abs(n-r);return a?o+l/a:l?1:o}function SU(e=[],t=at.minMatchCharLength){let r=[],n=-1,a=-1,s=0;for(let o=e.length;s<o;s+=1){let l=e[s];l&&n===-1?n=s:!l&&n!==-1&&(a=s-1,a-n+1>=t&&r.push([n,a]),n=-1)}return e[s-1]&&s-n>=t&&r.push([n,s-1]),r}const Oi=32;function EU(e,t,r,{location:n=at.location,distance:a=at.distance,threshold:s=at.threshold,findAllMatches:o=at.findAllMatches,minMatchCharLength:l=at.minMatchCharLength,includeMatches:c=at.includeMatches,ignoreLocation:d=at.ignoreLocation}={}){if(t.length>Oi)throw new Error(uU(Oi));const u=t.length,p=e.length,f=Math.max(0,Math.min(n,p));let m=s,g=f;const b=l>1||c,x=b?Array(p):[];let y;for(;(y=e.indexOf(t,g))>-1;){let j=cc(t,{currentLocation:y,expectedLocation:f,distance:a,ignoreLocation:d});if(m=Math.min(j,m),g=y+u,b){let _=0;for(;_<u;)x[y+_]=1,_+=1}}g=-1;let v=[],w=1,k=u+p;const E=1<<u-1;for(let j=0;j<u;j+=1){let _=0,T=k;for(;_<T;)cc(t,{errors:j,currentLocation:f+T,expectedLocation:f,distance:a,ignoreLocation:d})<=m?_=T:k=T,T=Math.floor((k-_)/2+_);k=T;let C=Math.max(1,f-T+1),L=o?p:Math.min(f+T,p)+u,A=Array(L+2);A[L+1]=(1<<j)-1;for(let N=L;N>=C;N-=1){let P=N-1,H=r[e.charAt(P)];if(b&&(x[P]=+!!H),A[N]=(A[N+1]<<1|1)&H,j&&(A[N]|=(v[N+1]|v[N])<<1|1|v[N+1]),A[N]&E&&(w=cc(t,{errors:j,currentLocation:P,expectedLocation:f,distance:a,ignoreLocation:d}),w<=m)){if(m=w,g=P,g<=f)break;C=Math.max(1,2*f-g)}}if(cc(t,{errors:j+1,currentLocation:f,expectedLocation:f,distance:a,ignoreLocation:d})>m)break;v=A}const S={isMatch:g>=0,score:Math.max(.001,w)};if(b){const j=SU(x,l);j.length?c&&(S.indices=j):S.isMatch=!1}return S}function NU(e){let t={};for(let r=0,n=e.length;r<n;r+=1){const a=e.charAt(r);t[a]=(t[a]||0)|1<<n-r-1}return t}const yd=String.prototype.normalize?e=>e.normalize("NFD").replace(/[\u0300-\u036F\u0483-\u0489\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u0610-\u061A\u064B-\u065F\u0670\u06D6-\u06DC\u06DF-\u06E4\u06E7\u06E8\u06EA-\u06ED\u0711\u0730-\u074A\u07A6-\u07B0\u07EB-\u07F3\u07FD\u0816-\u0819\u081B-\u0823\u0825-\u0827\u0829-\u082D\u0859-\u085B\u08D3-\u08E1\u08E3-\u0903\u093A-\u093C\u093E-\u094F\u0951-\u0957\u0962\u0963\u0981-\u0983\u09BC\u09BE-\u09C4\u09C7\u09C8\u09CB-\u09CD\u09D7\u09E2\u09E3\u09FE\u0A01-\u0A03\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A70\u0A71\u0A75\u0A81-\u0A83\u0ABC\u0ABE-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AE2\u0AE3\u0AFA-\u0AFF\u0B01-\u0B03\u0B3C\u0B3E-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B62\u0B63\u0B82\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD7\u0C00-\u0C04\u0C3E-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C62\u0C63\u0C81-\u0C83\u0CBC\u0CBE-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CE2\u0CE3\u0D00-\u0D03\u0D3B\u0D3C\u0D3E-\u0D44\u0D46-\u0D48\u0D4A-\u0D4D\u0D57\u0D62\u0D63\u0D82\u0D83\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DF2\u0DF3\u0E31\u0E34-\u0E3A\u0E47-\u0E4E\u0EB1\u0EB4-\u0EB9\u0EBB\u0EBC\u0EC8-\u0ECD\u0F18\u0F19\u0F35\u0F37\u0F39\u0F3E\u0F3F\u0F71-\u0F84\u0F86\u0F87\u0F8D-\u0F97\u0F99-\u0FBC\u0FC6\u102B-\u103E\u1056-\u1059\u105E-\u1060\u1062-\u1064\u1067-\u106D\u1071-\u1074\u1082-\u108D\u108F\u109A-\u109D\u135D-\u135F\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17B4-\u17D3\u17DD\u180B-\u180D\u1885\u1886\u18A9\u1920-\u192B\u1930-\u193B\u1A17-\u1A1B\u1A55-\u1A5E\u1A60-\u1A7C\u1A7F\u1AB0-\u1ABE\u1B00-\u1B04\u1B34-\u1B44\u1B6B-\u1B73\u1B80-\u1B82\u1BA1-\u1BAD\u1BE6-\u1BF3\u1C24-\u1C37\u1CD0-\u1CD2\u1CD4-\u1CE8\u1CED\u1CF2-\u1CF4\u1CF7-\u1CF9\u1DC0-\u1DF9\u1DFB-\u1DFF\u20D0-\u20F0\u2CEF-\u2CF1\u2D7F\u2DE0-\u2DFF\u302A-\u302F\u3099\u309A\uA66F-\uA672\uA674-\uA67D\uA69E\uA69F\uA6F0\uA6F1\uA802\uA806\uA80B\uA823-\uA827\uA880\uA881\uA8B4-\uA8C5\uA8E0-\uA8F1\uA8FF\uA926-\uA92D\uA947-\uA953\uA980-\uA983\uA9B3-\uA9C0\uA9E5\uAA29-\uAA36\uAA43\uAA4C\uAA4D\uAA7B-\uAA7D\uAAB0\uAAB2-\uAAB4\uAAB7\uAAB8\uAABE\uAABF\uAAC1\uAAEB-\uAAEF\uAAF5\uAAF6\uABE3-\uABEA\uABEC\uABED\uFB1E\uFE00-\uFE0F\uFE20-\uFE2F]/g,""):e=>e;class C3{constructor(t,{location:r=at.location,threshold:n=at.threshold,distance:a=at.distance,includeMatches:s=at.includeMatches,findAllMatches:o=at.findAllMatches,minMatchCharLength:l=at.minMatchCharLength,isCaseSensitive:c=at.isCaseSensitive,ignoreDiacritics:d=at.ignoreDiacritics,ignoreLocation:u=at.ignoreLocation}={}){if(this.options={location:r,threshold:n,distance:a,includeMatches:s,findAllMatches:o,minMatchCharLength:l,isCaseSensitive:c,ignoreDiacritics:d,ignoreLocation:u},t=c?t:t.toLowerCase(),t=d?yd(t):t,this.pattern=t,this.chunks=[],!this.pattern.length)return;const p=(m,g)=>{this.chunks.push({pattern:m,alphabet:NU(m),startIndex:g})},f=this.pattern.length;if(f>Oi){let m=0;const g=f%Oi,b=f-g;for(;m<b;)p(this.pattern.substr(m,Oi),m),m+=Oi;if(g){const x=f-Oi;p(this.pattern.substr(x),x)}}else p(this.pattern,0)}searchIn(t){const{isCaseSensitive:r,ignoreDiacritics:n,includeMatches:a}=this.options;if(t=r?t:t.toLowerCase(),t=n?yd(t):t,this.pattern===t){let b={isMatch:!0,score:0};return a&&(b.indices=[[0,t.length-1]]),b}const{location:s,distance:o,threshold:l,findAllMatches:c,minMatchCharLength:d,ignoreLocation:u}=this.options;let p=[],f=0,m=!1;this.chunks.forEach(({pattern:b,alphabet:x,startIndex:y})=>{const{isMatch:v,score:w,indices:k}=EU(t,b,x,{location:s+y,distance:o,threshold:l,findAllMatches:c,minMatchCharLength:d,includeMatches:a,ignoreLocation:u});v&&(m=!0),f+=w,v&&k&&(p=[...p,...k])});let g={isMatch:m,score:m?f/this.chunks.length:1};return m&&a&&(g.indices=p),g}}class hi{constructor(t){this.pattern=t}static isMultiMatch(t){return d2(t,this.multiRegex)}static isSingleMatch(t){return d2(t,this.singleRegex)}search(){}}function d2(e,t){const r=e.match(t);return r?r[1]:null}class CU extends hi{constructor(t){super(t)}static get type(){return"exact"}static get multiRegex(){return/^="(.*)"$/}static get singleRegex(){return/^=(.*)$/}search(t){const r=t===this.pattern;return{isMatch:r,score:r?0:1,indices:[0,this.pattern.length-1]}}}class AU extends hi{constructor(t){super(t)}static get type(){return"inverse-exact"}static get multiRegex(){return/^!"(.*)"$/}static get singleRegex(){return/^!(.*)$/}search(t){const n=t.indexOf(this.pattern)===-1;return{isMatch:n,score:n?0:1,indices:[0,t.length-1]}}}class TU extends hi{constructor(t){super(t)}static get type(){return"prefix-exact"}static get multiRegex(){return/^\^"(.*)"$/}static get singleRegex(){return/^\^(.*)$/}search(t){const r=t.startsWith(this.pattern);return{isMatch:r,score:r?0:1,indices:[0,this.pattern.length-1]}}}class jU extends hi{constructor(t){super(t)}static get type(){return"inverse-prefix-exact"}static get multiRegex(){return/^!\^"(.*)"$/}static get singleRegex(){return/^!\^(.*)$/}search(t){const r=!t.startsWith(this.pattern);return{isMatch:r,score:r?0:1,indices:[0,t.length-1]}}}class _U extends hi{constructor(t){super(t)}static get type(){return"suffix-exact"}static get multiRegex(){return/^"(.*)"\$$/}static get singleRegex(){return/^(.*)\$$/}search(t){const r=t.endsWith(this.pattern);return{isMatch:r,score:r?0:1,indices:[t.length-this.pattern.length,t.length-1]}}}class IU extends hi{constructor(t){super(t)}static get type(){return"inverse-suffix-exact"}static get multiRegex(){return/^!"(.*)"\$$/}static get singleRegex(){return/^!(.*)\$$/}search(t){const r=!t.endsWith(this.pattern);return{isMatch:r,score:r?0:1,indices:[0,t.length-1]}}}class A3 extends hi{constructor(t,{location:r=at.location,threshold:n=at.threshold,distance:a=at.distance,includeMatches:s=at.includeMatches,findAllMatches:o=at.findAllMatches,minMatchCharLength:l=at.minMatchCharLength,isCaseSensitive:c=at.isCaseSensitive,ignoreDiacritics:d=at.ignoreDiacritics,ignoreLocation:u=at.ignoreLocation}={}){super(t),this._bitapSearch=new C3(t,{location:r,threshold:n,distance:a,includeMatches:s,findAllMatches:o,minMatchCharLength:l,isCaseSensitive:c,ignoreDiacritics:d,ignoreLocation:u})}static get type(){return"fuzzy"}static get multiRegex(){return/^"(.*)"$/}static get singleRegex(){return/^(.*)$/}search(t){return this._bitapSearch.searchIn(t)}}class T3 extends hi{constructor(t){super(t)}static get type(){return"include"}static get multiRegex(){return/^'"(.*)"$/}static get singleRegex(){return/^'(.*)$/}search(t){let r=0,n;const a=[],s=this.pattern.length;for(;(n=t.indexOf(this.pattern,r))>-1;)r=n+s,a.push([n,r-1]);const o=!!a.length;return{isMatch:o,score:o?0:1,indices:a}}}const Th=[CU,T3,TU,jU,IU,_U,AU,A3],u2=Th.length,RU=/ +(?=(?:[^\"]*\"[^\"]*\")*[^\"]*$)/,LU="|";function DU(e,t={}){return e.split(LU).map(r=>{let n=r.trim().split(RU).filter(s=>s&&!!s.trim()),a=[];for(let s=0,o=n.length;s<o;s+=1){const l=n[s];let c=!1,d=-1;for(;!c&&++d<u2;){const u=Th[d];let p=u.isMultiMatch(l);p&&(a.push(new u(p,t)),c=!0)}if(!c)for(d=-1;++d<u2;){const u=Th[d];let p=u.isSingleMatch(l);if(p){a.push(new u(p,t));break}}}return a})}const OU=new Set([A3.type,T3.type]);class MU{constructor(t,{isCaseSensitive:r=at.isCaseSensitive,ignoreDiacritics:n=at.ignoreDiacritics,includeMatches:a=at.includeMatches,minMatchCharLength:s=at.minMatchCharLength,ignoreLocation:o=at.ignoreLocation,findAllMatches:l=at.findAllMatches,location:c=at.location,threshold:d=at.threshold,distance:u=at.distance}={}){this.query=null,this.options={isCaseSensitive:r,ignoreDiacritics:n,includeMatches:a,minMatchCharLength:s,findAllMatches:l,ignoreLocation:o,location:c,threshold:d,distance:u},t=r?t:t.toLowerCase(),t=n?yd(t):t,this.pattern=t,this.query=DU(this.pattern,this.options)}static condition(t,r){return r.useExtendedSearch}searchIn(t){const r=this.query;if(!r)return{isMatch:!1,score:1};const{includeMatches:n,isCaseSensitive:a,ignoreDiacritics:s}=this.options;t=a?t:t.toLowerCase(),t=s?yd(t):t;let o=0,l=[],c=0;for(let d=0,u=r.length;d<u;d+=1){const p=r[d];l.length=0,o=0;for(let f=0,m=p.length;f<m;f+=1){const g=p[f],{isMatch:b,indices:x,score:y}=g.search(t);if(b){if(o+=1,c+=y,n){const v=g.constructor.type;OU.has(v)?l=[...l,...x]:l.push(x)}}else{c=0,o=0,l.length=0;break}}if(o){let f={isMatch:!0,score:c/o};return n&&(f.indices=l),f}}return{isMatch:!1,score:1}}}const jh=[];function PU(...e){jh.push(...e)}function _h(e,t){for(let r=0,n=jh.length;r<n;r+=1){let a=jh[r];if(a.condition(e,t))return new a(e,t)}return new C3(e,t)}const vd={AND:"$and",OR:"$or"},Ih={PATH:"$path",PATTERN:"$val"},Rh=e=>!!(e[vd.AND]||e[vd.OR]),FU=e=>!!e[Ih.PATH],zU=e=>!ja(e)&&k3(e)&&!Rh(e),p2=e=>({[vd.AND]:Object.keys(e).map(t=>({[t]:e[t]}))});function j3(e,t,{auto:r=!0}={}){const n=a=>{let s=Object.keys(a);const o=FU(a);if(!o&&s.length>1&&!Rh(a))return n(p2(a));if(zU(a)){const c=o?a[Ih.PATH]:s[0],d=o?a[Ih.PATTERN]:a[c];if(!Jn(d))throw new Error(dU(c));const u={keyId:Ah(c),pattern:d};return r&&(u.searcher=_h(d,t)),u}let l={children:[],operator:s[0]};return s.forEach(c=>{const d=a[c];ja(d)&&d.forEach(u=>{l.children.push(n(u))})}),l};return Rh(e)||(e=p2(e)),n(e)}function BU(e,{ignoreFieldNorm:t=at.ignoreFieldNorm}){e.forEach(r=>{let n=1;r.matches.forEach(({key:a,norm:s,score:o})=>{const l=a?a.weight:null;n*=Math.pow(o===0&&l?Number.EPSILON:o,(l||1)*(t?1:s))}),r.score=n})}function $U(e,t){const r=e.matches;t.matches=[],on(r)&&r.forEach(n=>{if(!on(n.indices)||!n.indices.length)return;const{indices:a,value:s}=n;let o={indices:a,value:s};n.key&&(o.key=n.key.src),n.idx>-1&&(o.refIndex=n.idx),t.matches.push(o)})}function UU(e,t){t.score=e.score}function GU(e,t,{includeMatches:r=at.includeMatches,includeScore:n=at.includeScore}={}){const a=[];return r&&a.push($U),n&&a.push(UU),e.map(s=>{const{idx:o}=s,l={item:t[o],refIndex:o};return a.length&&a.forEach(c=>{c(s,l)}),l})}class co{constructor(t,r={},n){this.options={...at,...r},this.options.useExtendedSearch,this._keyStore=new hU(this.options.keys),this.setCollection(t,n)}setCollection(t,r){if(this._docs=t,r&&!(r instanceof b0))throw new Error(cU);this._myIndex=r||N3(this.options.keys,this._docs,{getFn:this.options.getFn,fieldNormWeight:this.options.fieldNormWeight})}add(t){on(t)&&(this._docs.push(t),this._myIndex.add(t))}remove(t=()=>!1){const r=[];for(let n=0,a=this._docs.length;n<a;n+=1){const s=this._docs[n];t(s,n)&&(this.removeAt(n),n-=1,a-=1,r.push(s))}return r}removeAt(t){this._docs.splice(t,1),this._myIndex.removeAt(t)}getIndex(){return this._myIndex}search(t,{limit:r=-1}={}){const{includeMatches:n,includeScore:a,shouldSort:s,sortFn:o,ignoreFieldNorm:l}=this.options;let c=Jn(t)?Jn(this._docs[0])?this._searchStringList(t):this._searchObjectList(t):this._searchLogical(t);return BU(c,{ignoreFieldNorm:l}),s&&c.sort(o),w3(r)&&r>-1&&(c=c.slice(0,r)),GU(c,this._docs,{includeMatches:n,includeScore:a})}_searchStringList(t){const r=_h(t,this.options),{records:n}=this._myIndex,a=[];return n.forEach(({v:s,i:o,n:l})=>{if(!on(s))return;const{isMatch:c,score:d,indices:u}=r.searchIn(s);c&&a.push({item:s,idx:o,matches:[{score:d,value:s,norm:l,indices:u}]})}),a}_searchLogical(t){const r=j3(t,this.options),n=(l,c,d)=>{if(!l.children){const{keyId:p,searcher:f}=l,m=this._findMatches({key:this._keyStore.get(p),value:this._myIndex.getValueForItemAtKeyId(c,p),searcher:f});return m&&m.length?[{idx:d,item:c,matches:m}]:[]}const u=[];for(let p=0,f=l.children.length;p<f;p+=1){const m=l.children[p],g=n(m,c,d);if(g.length)u.push(...g);else if(l.operator===vd.AND)return[]}return u},a=this._myIndex.records,s={},o=[];return a.forEach(({$:l,i:c})=>{if(on(l)){let d=n(r,l,c);d.length&&(s[c]||(s[c]={idx:c,item:l,matches:[]},o.push(s[c])),d.forEach(({matches:u})=>{s[c].matches.push(...u)}))}}),o}_searchObjectList(t){const r=_h(t,this.options),{keys:n,records:a}=this._myIndex,s=[];return a.forEach(({$:o,i:l})=>{if(!on(o))return;let c=[];n.forEach((d,u)=>{c.push(...this._findMatches({key:d,value:o[u],searcher:r}))}),c.length&&s.push({idx:l,item:o,matches:c})}),s}_findMatches({key:t,value:r,searcher:n}){if(!on(r))return[];let a=[];if(ja(r))r.forEach(({v:s,i:o,n:l})=>{if(!on(s))return;const{isMatch:c,score:d,indices:u}=n.searchIn(s);c&&a.push({score:d,key:t,value:s,idx:o,norm:l,indices:u})});else{const{v:s,n:o}=r,{isMatch:l,score:c,indices:d}=n.searchIn(s);l&&a.push({score:c,key:t,value:s,norm:o,indices:d})}return a}}co.version="7.1.0";co.createIndex=N3;co.parseIndex=kU;co.config=at;co.parseQuery=j3;PU(MU);const HU=150,_3=e=>`command_history_${e}`,Up=e=>{const t=Vn.getItem(_3(e));if(!t)return{};try{return JSON.parse(t)}catch(r){return console.error("Error parsing command history:",r),{}}},VU=(e,t)=>{Vn.setItem(_3(e),JSON.stringify(t))},m2=e=>!!e&&typeof e.then=="function";function qU({selectedProject:e,input:t,setInput:r,textareaRef:n,onExecuteCommand:a}){const[s,o]=h.useState([]),[l,c]=h.useState([]),[d,u]=h.useState(!1),[p,f]=h.useState(""),[m,g]=h.useState(-1),[b,x]=h.useState(-1),y=h.useRef(null),v=h.useCallback(()=>{y.current!==null&&(window.clearTimeout(y.current),y.current=null)},[]),w=h.useCallback(()=>{u(!1),x(-1),f(""),g(-1),v()},[v]);h.useEffect(()=>{(async()=>{if(!e){o([]),c([]);return}try{const I=await ve("/api/commands/list",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({projectPath:e.path})});if(!I.ok)throw new Error("Failed to fetch commands");const N=await I.json(),P=[...(N.builtIn||[]).map(U=>({...U,type:"built-in"})),...(N.custom||[]).map(U=>({...U,type:"custom"}))],H=Up(e.name),z=[...P].sort((U,V)=>{const O=H[U.name]||0;return(H[V.name]||0)-O});o(z)}catch(I){console.error("Error fetching slash commands:",I),o([])}})()},[e]),h.useEffect(()=>{d||g(-1)},[d]);const k=h.useMemo(()=>s.length?new co(s,{keys:[{name:"name",weight:2},{name:"description",weight:1}],threshold:.4,includeScore:!0,minMatchCharLength:1}):null,[s]);h.useEffect(()=>{if(!p){c(s);return}if(!k){c([]);return}const A=k.search(p);c(A.map(I=>I.item))},[p,s,k]);const E=h.useMemo(()=>{if(!e||s.length===0)return[];const A=Up(e.name);return s.map(I=>({...I,usageCount:A[I.name]||0})).filter(I=>I.usageCount>0).sort((I,N)=>N.usageCount-I.usageCount).slice(0,5)},[e,s]),S=h.useCallback(A=>{if(!e)return;const I=Up(e.name);I[A.name]=(I[A.name]||0)+1,VU(e.name,I)},[e]),j=h.useCallback(A=>{const I=t.slice(0,b),N=t.slice(b),P=N.indexOf(" "),H=P!==-1?N.slice(P):"",z=`${I}${A.name} ${H}`;r(z),w();const U=a(A);m2(U)&&U.catch(()=>{})},[t,b,r,w,a]),_=h.useCallback((A,I,N)=>{if(!A||!e)return;if(N){g(I);return}S(A);const P=a(A);m2(P)?(P.then(()=>{w()}),P.catch(()=>{})):w()},[e,S,a,w]),T=h.useCallback(()=>{const A=!d;u(A),f(""),g(-1),A&&c(s),n.current?.focus()},[d,s,n]),C=h.useCallback((A,I)=>{if(!A.trim()){w();return}const N=A.slice(0,I);if((N.match(/```/g)||[]).length%2===1){w();return}const z=/(^|\s)\/(\S*)$/,U=N.match(z);if(!U){w();return}const V=(U.index||0)+U[1].length,O=U[2];x(V),u(!0),g(-1),v(),y.current=window.setTimeout(()=>{f(O)},HU)},[w,v]),L=h.useCallback(A=>d?l.length?A.key==="ArrowDown"?(A.preventDefault(),g(I=>I<l.length-1?I+1:0),!0):A.key==="ArrowUp"?(A.preventDefault(),g(I=>I>0?I-1:l.length-1),!0):A.key==="Tab"||A.key==="Enter"?(A.preventDefault(),m>=0?j(l[m]):l.length>0&&j(l[0]),!0):A.key==="Escape"?(A.preventDefault(),w(),!0):!1:A.key==="Escape"?(A.preventDefault(),w(),!0):!1:!1,[d,l,w,j,m]);return h.useEffect(()=>()=>{v()},[v]),{slashCommands:s,slashCommandsCount:s.length,filteredCommands:l,frequentCommands:E,commandQuery:p,showCommandMenu:d,selectedCommandIndex:m,resetCommandMenuState:w,handleCommandSelect:_,handleToggleCommandMenu:T,handleCommandInputChange:C,handleCommandMenuKeyDown:L}}const WU=()=>({preventDefault:()=>{}}),Gp=e=>!!(e&&e.startsWith("new-session-"));function KU(e){const t=e&&typeof e=="object"?e:{};if(typeof t.error=="string")return t.error;const r=Array.isArray(t.messages)?t.messages:[],n=[];for(const a of r)a&&typeof a=="object"&&typeof a.content=="string"&&n.push(a.content);return n.join(`
317
317
 
318
318
  `).trim()}const YU=(e,t)=>{const r=e?.summary||e?.name||e?.title;if(typeof r=="string"&&r.trim()){const a=r.replace(/\s+/g," ").trim();return a.length>80?`${a.slice(0,77)}...`:a}const n=t.replace(/\s+/g," ").trim();return n?n.length>80?`${n.slice(0,77)}...`:n:null};function ZU({selectedProject:e,selectedSession:t,currentSessionId:r,provider:n,permissionMode:a,cyclePermissionMode:s,cursorModel:o,claudeModel:l,codexModel:c,geminiModel:d,qwenModel:u,opencodeModel:p,isLoading:f,canAbortSession:m,tokenBudget:g,sendMessage:b,sendByCtrlEnter:x,onSessionActive:y,onSessionProcessing:v,onInputFocusChange:w,onFileOpen:k,onShowSettings:E,pendingViewSessionRef:S,scrollToBottom:j,addMessage:_,clearMessages:T,rewindMessages:C,setIsLoading:L,setCanAbortSession:A,setClaudeStatus:I,setIsUserScrolledUp:N,setPendingPermissionRequests:P}){const H=e?.name,[z,U]=h.useState(()=>typeof window<"u"&&e&&Vn.getItem(`draft_input_${e.name}`)||""),[V,O]=h.useState([]),[G,$]=h.useState(new Map),[F,te]=h.useState(new Map),[Q,ge]=h.useState(!1),[ae,me]=h.useState("none"),[pe,be]=h.useState(()=>typeof window>"u"?[]:rU()),Ne=h.useCallback(je=>{const Ue=je.slice(0,Qa);be(Ue),nU(Ue)},[]),xe=h.useRef(null),Be=h.useRef(null),M=h.useRef(null),de=h.useRef(null),ce=h.useRef(z),Y=h.useCallback(je=>{const{action:Ue,data:Fe}=je;switch(Ue){case"clear":T();break;case"help":_({type:"assistant",content:Fe.content,timestamp:Date.now()});break;case"model":_({type:"assistant",content:`**Current Model**: ${Fe.current.model}
319
319
 
@@ -864,4 +864,4 @@ https://github.com/nodeca/pako/blob/main/LICENSE
864
864
  "Lütfen Cloudinary kullanarak kullanıcı profil resmi yükleme özelliği için yeni bir görev ekle, en iyi yaklaşımı araştır."`},moreExamples:"Daha fazla örnek ve kullanım deseni →",proTips:{title:"💡 Pro İpuçları",search:"Belirli görevleri hızlıca bulmak için arama çubuğunu kullan",views:"Kanban, Liste ve Izgara görünümleri arasında geçiş yapmak için görünüm düğmelerini kullan",filters:"Belirli görev durumlarına veya önceliklere odaklanmak için filtreleri kullan",details:"Detaylı bilgi görmek ve alt görevleri yönetmek için herhangi bir göreve tıkla"},learnMore:{title:"📚 Daha Fazla Öğren",description:"TaskMaster AI, geliştiriciler için inşa edilmiş ileri seviye bir görev yönetim sistemidir. Dokümantasyona, örneklere bak ve projeye katkıda bulun.",githubButton:"GitHub'da Görüntüle"}},Fge={placeholder:"Görevlerde ara..."},zge={button:"Filtreler",status:"Durum",priority:"Öncelik",sortBy:"Sıralama",allStatuses:"Tüm Durumlar",allPriorities:"Tüm Öncelikler",showing:"{{total}} görevin {{filtered}} tanesi gösteriliyor",clearFilters:"Filtreleri Temizle"},Bge={id:"ID",status:"Durum",priority:"Öncelik",idAsc:"ID (Artan)",idDesc:"ID (Azalan)",titleAsc:"Başlık (A-Z)",titleDesc:"Başlık (Z-A)",statusAsc:"Durum (Önce Bekleyen)",statusDesc:"Durum (Önce Tamamlanan)",priorityAsc:"Öncelik (Önce Yüksek)",priorityDesc:"Öncelik (Önce Düşük)"},$ge={kanban:"Kanban görünümü",list:"Liste görünümü",grid:"Izgara görünümü"},Uge={pending:"📋 Yapılacak",inProgress:"🚀 Sürüyor",done:"✅ Tamamlandı",blocked:"🚫 Engellendi",deferred:"⏳ Ertelendi",cancelled:"❌ İptal Edildi",noTasksYet:"Henüz görev yok",tasksWillAppear:"Görevler burada görünecek",moveTasksHere:"Başlayan görevleri buraya taşı",completedTasksHere:"Tamamlanan görevler burada görünür",statusTasksHere:"Bu durumdaki görevler burada görünecek"},Gge={help:"TaskMaster Başlangıç Rehberi",prds:"PRD'ler",addPRD:"PRD Ekle",addTask:"Görev Ekle",createNewPRD:"Yeni PRD Oluştur",prdsAvailable:"{{count}} PRD mevcut"},Hge={modified:"Değişiklik: {{date}}"},Vge={pending:"Beklemede","in-progress":"Sürüyor",done:"Tamamlandı",blocked:"Engellendi",deferred:"Ertelendi",cancelled:"İptal Edildi"},qge={high:"Yüksek",medium:"Orta",low:"Düşük"},Wge={title:"Filtrelerine uygun görev yok",description:"Arama veya filtre kriterlerini değiştirmeyi dene."},Kge={notConfigured:Dge,gettingStarted:Oge,setupModal:Mge,helpGuide:Pge,search:Fge,filters:zge,sort:Bge,views:$ge,kanban:Uge,buttons:Gge,prd:Hge,statuses:Vge,priorities:qge,noMatchingTasks:Wge},Yge={save:"Salva",cancel:"Annulla",delete:"Elimina",create:"Crea",edit:"Modifica",close:"Chiudi",confirm:"Conferma",submit:"Invia",retry:"Riprova",refresh:"Aggiorna",search:"Cerca",clear:"Cancella",copy:"Copia",download:"Scarica",upload:"Carica",browse:"Sfoglia"},Zge={chat:"Chat",shell:"Terminale",files:"File",git:"Controllo Versione",changes:"Modifiche",liveView:"Vista live",tasks:"Attività",orchestration:"Orchestrazione"},Xge={loading:"Caricamento...",success:"Completato",error:"Errore",failed:"Fallito",pending:"In attesa",completed:"Completato",inProgress:"In corso"},Jge={savedSuccessfully:"Salvato con successo",deletedSuccessfully:"Eliminato con successo",updatedSuccessfully:"Aggiornato con successo",operationFailed:"Operazione fallita",networkError:"Errore di rete. Controlla la tua connessione.",unauthorized:"Non autorizzato. Effettua l'accesso.",notFound:"Non trovato",invalidInput:"Input non valido",requiredField:"Questo campo è obbligatorio",unknownError:"Si è verificato un errore sconosciuto"},Qge={settings:"Impostazioni",home:"Home",back:"Indietro",next:"Avanti",previous:"Precedente",logout:"Esci"},ebe={language:"Lingua",theme:"Tema",darkMode:"Modalità scura",lightMode:"Modalità chiara",name:"Nome",description:"Descrizione",enabled:"Abilitato",disabled:"Disabilitato",optional:"Opzionale",version:"Versione",select:"Seleziona",selectAll:"Seleziona tutto",deselectAll:"Deseleziona tutto"},tbe={justNow:"Adesso",minutesAgo:"{{count}} min fa",hoursAgo:"{{count}} ore fa",daysAgo:"{{count}} giorni fa",yesterday:"Ieri"},rbe={newFile:"Nuovo file",newFolder:"Nuova cartella",rename:"Rinomina",move:"Sposta",copyPath:"Copia percorso",openInEditor:"Apri nell'editor"},nbe={loading:"Caricamento Pixcode",settingUpWorkspace:"Preparazione dell'area di lavoro...",chooseProject:"Scegli il tuo progetto",selectProjectDescription:"Seleziona un progetto dalla barra laterale per iniziare a programmare con Claude. Ogni progetto contiene le tue sessioni di chat e la cronologia dei file.",tip:"Suggerimento",createProjectMobile:"Tocca il pulsante menu in alto per accedere ai progetti",createProjectDesktop:"Crea un nuovo progetto cliccando l'icona cartella nella barra laterale",newSession:"Nuova sessione",untitledSession:"Sessione senza titolo",projectFiles:"File del progetto",landing:{title:"Avvia uno spazio di lavoro Pixcode",description:"Scegli un progetto, avvia una nuova chat oppure lancia l’Orchestrazione con un solo obiettivo. L’Orchestrazione gestisce gli agenti CLI selezionati, mostra ogni passaggio e rende visibili gli errori.",startOrchestration:"Avvia Orchestrazione",startOrchestrationDescription:"Crea automaticamente un progetto e apre la schermata Orchestrazione con controllo agenti e cronologia.",startChat:"Avvia una nuova chat",startChatDescription:"Crea automaticamente una cartella e apre la chat normale con un agente.",taskSystem:"Sistema attività",taskSystemDescription:"Usa la scheda TaskMaster nel progetto per seguire attività, stati e lavoro pianificato.",sidebarHint:"Quando selezioni un progetto esistente dalla barra laterale, cronologia chat, file, stato git, attività e orchestrazione restano nella stessa schermata principale."}},abe={loading:"Caricamento file...",files:"File",simpleView:"Vista semplice",compactView:"Vista compatta",detailedView:"Vista dettagliata",searchPlaceholder:"Cerca file e cartelle...",clearSearch:"Cancella ricerca",name:"Nome",size:"Dimensione",modified:"Modificato",permissions:"Permessi",noFilesFound:"Nessun file trovato",checkProjectPath:"Verifica che il percorso del progetto sia accessibile",noMatchesFound:"Nessuna corrispondenza trovata",tryDifferentSearch:"Prova con un termine di ricerca diverso o cancella la ricerca",justNow:"adesso",minAgo:"{{count}} min fa",hoursAgo:"{{count}} ore fa",daysAgo:"{{count}} giorni fa",newFile:"Nuovo file (Cmd+N)",newFolder:"Nuova cartella (Cmd+Shift+N)",refresh:"Aggiorna",collapseAll:"Comprimi tutto",context:{rename:"Rinomina",delete:"Elimina",copyPath:"Copia percorso",download:"Scarica",newFile:"Nuovo file",newFolder:"Nuova cartella",refresh:"Aggiorna",menuLabel:"Menu contestuale file",loading:"Caricamento..."}},ibe={title:"Crea nuovo progetto",steps:{type:"Tipo",configure:"Configura",confirm:"Conferma"},step1:{question:"Hai già un'area di lavoro o vuoi crearne una nuova?",existing:{title:"Area di lavoro esistente",description:"Ho già un'area di lavoro sul mio server e devo solo aggiungerla alla lista dei progetti"},new:{title:"Nuova area di lavoro",description:"Crea una nuova area di lavoro, opzionalmente clonando da un repository GitHub"},githubClone:{title:"Clona da GitHub",description:"Scegli una cartella di destinazione e clona un repository al suo interno"},subfolder:{title:"Crea sottocartella",description:"Scegli una cartella padre e crea al suo interno una nuova sottocartella"}},step2:{existingPath:"Percorso area di lavoro",newPath:"Percorso area di lavoro",subfolderParentPath:"Cartella padre",subfolderParentHelp:"Percorso della cartella in cui verrà creata la nuova sottocartella",subfolderName:"Nome sottocartella",subfolderNameHelp:"Una cartella con questo nome verrà creata nella cartella padre",existingPlaceholder:"/percorso/area-di-lavoro/esistente",newPlaceholder:"/percorso/nuova/area-di-lavoro",existingHelp:"Percorso completo della directory dell'area di lavoro esistente",newHelp:"Percorso completo della directory dell'area di lavoro",githubUrl:"URL GitHub (opzionale)",githubPlaceholder:"https://github.com/utente/repository",githubHelp:"Opzionale: fornisci un URL GitHub per clonare un repository",githubAuth:"Autenticazione GitHub (opzionale)",githubAuthHelp:"Richiesta solo per repository privati. I repository pubblici possono essere clonati senza autenticazione.",loadingTokens:"Caricamento token salvati...",storedToken:"Token salvato",newToken:"Nuovo token",nonePublic:"Nessuno (pubblico)",selectToken:"Seleziona token",selectTokenPlaceholder:"-- Seleziona un token --",tokenPlaceholder:"ghp_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",tokenHelp:"Questo token verrà utilizzato solo per questa operazione",publicRepoInfo:"I repository pubblici non richiedono autenticazione. Puoi saltare il token se stai clonando un repository pubblico.",noTokensHelp:"Nessun token salvato disponibile. Puoi aggiungere token in Impostazioni → Chiavi API per un riutilizzo più semplice.",optionalTokenPublic:"Token GitHub (opzionale per repository pubblici)",tokenPublicPlaceholder:"ghp_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx (lascia vuoto per repository pubblici)"},step3:{reviewConfig:"Rivedi la tua configurazione",workspaceType:"Tipo area di lavoro:",existingWorkspace:"Area di lavoro esistente",newWorkspace:"Nuova area di lavoro",subfolderWorkspace:"Nuova sottocartella",path:"Percorso:",parentPath:"Percorso padre:",subfolderName:"Nome sottocartella:",cloneFrom:"Clona da:",authentication:"Autenticazione:",usingStoredToken:"Usando token salvato:",usingProvidedToken:"Usando token fornito",noAuthentication:"Nessuna autenticazione",sshKey:"Chiave SSH",existingInfo:"L'area di lavoro verrà aggiunta alla lista dei progetti e sarà disponibile per le sessioni Claude/Cursor.",newWithClone:"Il repository verrà clonato da questa cartella.",newEmpty:"L'area di lavoro verrà aggiunta alla lista dei progetti e sarà disponibile per le sessioni Claude/Cursor.",subfolderInfo:"Una nuova sottocartella verrà creata nella cartella padre e aggiunta al tuo elenco progetti.",cloningRepository:"Clonazione repository..."},buttons:{cancel:"Annulla",back:"Indietro",next:"Avanti",createProject:"Crea progetto",creating:"Creazione...",cloning:"Clonazione..."},errors:{selectType:"Seleziona se hai un'area di lavoro esistente o vuoi crearne una nuova",providePath:"Fornisci un percorso per l'area di lavoro",provideSubfolderName:"Fornisci un nome per la sottocartella",subfolderNameInvalid:"Il nome della sottocartella non può contenere separatori di percorso o essere . / ..",failedToCreate:"Impossibile creare l'area di lavoro",failedToCreateFolder:"Impossibile creare la cartella"}},sbe={genericTool:"uno strumento",codes:{generic:{info:{title:"Notifica"}},permission:{required:{title:"Azione richiesta",body:"{{toolName}} è in attesa della tua decisione."}},run:{stopped:{title:"Esecuzione interrotta",body:"Motivo: {{reason}}"},failed:{title:"Esecuzione fallita"}},agent:{notification:{title:"Notifica agente"}}}},obe={title:"Aggiornamento disponibile",newVersionReady:"Una nuova versione è pronta",currentVersion:"Versione attuale",latestVersion:"Ultima versione",whatsNew:"Novità:",viewFullRelease:"Vedi release completa",updateProgress:"Progresso aggiornamento:",manualUpgrade:"Aggiornamento manuale:",npmUpgradeCommand:"npm install -g @pixelbyte-software/pixcode@latest",manualUpgradeHint:`Oppure clicca "Aggiorna ora" per eseguire l'aggiornamento automaticamente.`,updateCompleted:"Aggiornamento completato con successo!",restartServer:"Riavvia il server per applicare le modifiche.",updateFailed:"Aggiornamento fallito",buttons:{close:"Chiudi",later:"Più tardi",copyCommand:"Copia comando",updateNow:"Aggiorna ora",updating:"Aggiornamento..."},ariaLabels:{closeModal:"Chiudi finestra aggiornamento versione",showSidebar:"Mostra barra laterale",settings:"Impostazioni",updateAvailable:"Aggiornamento disponibile",closeSidebar:"Chiudi barra laterale"}},lbe={title:"Orchestrazione",subtitle:"Dai un obiettivo in {{project}}; scegli i worker CLI, duplica qualsiasi CLI se serve e assegna il lavoro direttamente o lascialo dividere al coordinatore.",refresh:"Aggiorna",goal:"Obiettivo",goalPlaceholder:"Esempio: correggi la schermata auth per il deployment su porta singola, cattura gli errori e verifica con lint e typecheck.",mode:"Modalità di esecuzione",systemPlan:"Piano di sistema",noMode:"Nessuna modalità selezionata",loadingPlan:"Caricamento piano agenti.",start:"Avvia team",starting:"Avvio in corso",needAgent:"Abilita almeno un worker CLI.",startFailed:"Impossibile avviare il workflow.",cliControl:"Team CLI",enabledCount:"{{count}} attivi",enabled:"Attivo",disabled:"Disattivo",history:"Cronologia",emptyHistory:"Nessuna esecuzione. Scrivi un obiettivo e avvia gli agenti.",steps:"{{done}}/{{total}} passaggi",notSelected:"Nessuna esecuzione selezionata",notSelectedDescription:"Seleziona un’esecuzione precedente o avvia un nuovo obiettivo. Qui appaiono messaggi degli agenti, errori, riepiloghi modifiche e anteprime.",loadFailed:"Impossibile caricare i dettagli dell’esecuzione.",loadingRun:"Caricamento esecuzione...",agentSteps:"Passaggi agenti",noStepOutput:"Nessun output del passaggio.",agentMessages:"Messaggi agenti",noAgentMessages:"Questo agente non ha ancora prodotto messaggi. Se l’esecuzione è fallita, l’errore CLI reale appare sopra.",outputs:"Output",noOutputs:"Nessun riepilogo modifiche, anteprima o output comando.",open:"Apri",artifact:{fileDiff:"Riepilogo modifiche",previewUrl:"Anteprima",commandOutput:"Output comando"},role:{user:"Utente",agent:"Agente"},status:{queued:"In coda",running:"In esecuzione",completed:"Completato",failed:"Errore",canceled:"Annullato",skipped:"Saltato"},nodes:{codex_review:"Revisione Codex",gemini_review:"Revisione Gemini",claude_review:"Revisione Claude",claude_code_review:"Revisione Claude",cursor_review:"Revisione Cursor",aggregate:"Aggregazione",architect:"Pianificazione",implement:"Implementazione",review:"Revisione",proposal:"Proposta",critique:"Critica",response:"Risposta",judge:"Decisione",coordinator:"Coordinatore",final_report:"Report finale"},workflows:{multi_model_review:{name:"Revisione multi-modello",description:"Gli agenti CLI attivi revisionano separatamente lo stesso obiettivo, poi un agente attivo aggrega il risultato."},sequential_handoff:{name:"Passaggio sequenziale",description:"Gli agenti pianificano, implementano e revisionano in ordine. I passaggi CLI disattivati vengono saltati."},adversarial_debate:{name:"Dibattito decisionale",description:"Gli agenti propongono, criticano, rispondono e producono una raccomandazione finale."},agent_team:{name:"Team agenti",description:"Un coordinatore legge obiettivo e istanze CLI attive, assegna il lavoro e raccoglie il risultato."}},adapters:{"claude-code":{label:"Claude Code",role:"Worker CLI"},cursor:{label:"Cursor",role:"Worker CLI"},codex:{label:"Codex",role:"Worker CLI"},gemini:{label:"Gemini",role:"Worker CLI"},qwen:{label:"Qwen Code",role:"Worker CLI"},opencode:{label:"OpenCode",role:"Worker CLI"}},activeCount:"{{active}}/{{total}} attivi",teamHint:"Ogni riga è un worker CLI. Puoi creare più worker Claude, Codex, Cursor, Gemini, Qwen o OpenCode e dare a ciascuno un incarico diverso.",parallelLimit:"Limite parallelo",addAgent:"Aggiungi {{agent}}",duplicateAgent:"Duplica {{agent}}",removeAgent:"Rimuovi {{agent}}",assignment:"Incarico",assignmentPlaceholder:"Opzionale: indica esattamente cosa deve gestire questo worker. Lascia vuoto per far assegnare al coordinatore.",agentInstance:"{{name}} #{{number}}",taskTitle:"Attività",taskTitlePlaceholder:"Implementa funzionalità",taskDescription:"Descrizione",taskDescriptionPlaceholder:"Ambito, vincoli, output atteso",addTask:"Aggiungi",runTask:"Esegui",cancelTask:"Annulla",dispatchTask:"Assegna attività",syncTaskMaster:"Sincronizza TaskMaster",taskMasterSource:"TaskMaster",adapter:"Adapter",isolation:"Isolamento",dispatch:"Assegna",auto:"Automatico",waitingForStream:"In attesa dello stream...",workflow:"Workflow",input:"Input",taskStates:{todo:"Da fare",in_progress:"In corso",in_review:"In revisione",done:"Completato",failed:"Fallito",canceled:"Annullato"},isolationKind:{worktree:"Worktree",host:"Host",docker:"Docker"},stop:"Ferma team",stopping:"Arresto...",cancelFailed:"Impossibile fermare il workflow.",needRoles:"Assegna almeno un agente attivo a questi ruoli per questa modalità: {{roles}}.",quickPrompts:{label:"Prompt rapido:",liveTrading:{label:"Schermata trading live 8024",prompt:"Ciao, crea un piccolo progetto e poi avvialo sulla porta 8024. Voglio un design in stile TradingView collegato a Binance FAPI, con grafico TradingView e sistema di preferiti/stelle a sinistra. Dividi il lavoro in modo logico e gestisci automaticamente il processo."}},teamHistory:"Cronologia team",changeSummary:"Riepilogo modifiche",noChangeSummary:"Il riepilogo finale non è ancora pronto. Un riepilogo Markdown leggibile apparirà qui quando gli agenti avranno finito.",prepareTeamFromReport:"Prepara team agenti da questo report",prepareTeamTitle:"Prepara prompt team agenti",prepareTeamDescription:"L’output della discussione è stato trasformato in un nuovo prompt Agent Team. Modificalo e poi spostalo in modalità Agent Team.",usePreparedPrompt:"Usa prompt",reportToPromptPrefix:"Prepara ed esegui un team di agenti dal seguente report di discussione/decisione. Dividi le necessità in attività, proponi assegnazioni sensate per gli agenti CLI disponibili e avvia solo dopo conferma dell’utente.",generatedSummaryTitle:"Riepilogo automatico esecuzione",summaryStatus:"Stato generale",summarySteps:"Passaggi completati",summaryFailures:"Passaggi falliti",summaryCanceled:"Passaggi annullati",summaryDiffs:"Output diff/modifiche",summaryPreviews:"Output anteprima",summaryErrorPrefix:"Errore",assignedWork:"Lavoro assegnato",autoAssigned:"Automatico / decide il coordinatore",stages:{coordinator:"Coordinatore",handoff:"Passaggio",backend:"Backend",frontend:"Frontend",implementation:"Implementazione",review:"Revisione",repair:"Correzione",proposal:"Proposta",critique:"Critica",response:"Risposta",decision:"Decisione",report:"Report",final_report:"Report finale"},agentRole:"Fase",agentRoles:{auto:"Automatico",backend:"Backend",frontend:"Frontend",review:"Test / revisione",implementation:"Implementazione",proposal:"Proposta",critique:"Critica",response:"Risposta",decision:"Decisione / report",report:"Report",custom:"Personalizzato"},customRolePlaceholder:"Es. Sicurezza, UX mobile, architettura DB",roleHints:{default:"Lascia vuoto e il coordinatore assegnerà questo agente in base all’obiettivo.",agent_team:"Scegli fasi backend, frontend o revisione, oppure lascia gli agenti in automatico.",multi_model_review:"Gli agenti attivi revisionano; se è selezionato un ruolo report, quell’agente aggrega il riepilogo finale.",sequential_handoff:"Gli agenti lavorano nell’ordine scelto; il testo attività definisce ogni passaggio.",adversarial_debate:"La selezione della fase è opzionale nella discussione decisionale; se vuota, il sistema assegna gli agenti selezionati a Proposta, Critica e Risposta in ordine."},soloAgent:"Esegui solo con {{agent}}",soloAgentShort:"Solo",cliSettings:"Impostazioni CLI",workspaceTarget:"Workspace di destinazione",workspaceTargets:{selectedProject:"Progetto selezionato",pixcodeApp:"Sistema Pixcode",custom:"Percorso personalizzato"},customWorkspacePlaceholder:"/percorso/del/progetto",workspaceTargetHint:"Gli agenti verranno eseguiti in: {{path}}",autoDetect:"rilevamento automatico",needWorkspacePath:"Inserisci un percorso workspace personalizzato."},cbe={buttons:Yge,tabs:Zge,status:Xge,messages:Jge,navigation:Qge,common:ebe,time:tbe,fileOperations:rbe,mainContent:nbe,fileTree:abe,projectWizard:ibe,notifications:sbe,versionUpdate:obe,orchestration:lbe},dbe="Impostazioni",ube={account:"Account",permissions:"Permessi",mcpServers:"Server MCP",appearance:"Aspetto"},pbe={title:"Account",language:"Lingua",languageLabel:"Lingua dell'interfaccia",languageDescription:"Scegli la lingua preferita per l'interfaccia",username:"Nome utente",email:"Email",profile:"Profilo",changePassword:"Cambia password"},mbe={title:"Server MCP",addServer:"Aggiungi server",editServer:"Modifica server",deleteServer:"Elimina server",serverName:"Nome server",serverType:"Tipo server",config:"Configurazione",testConnection:"Testa connessione",status:"Stato",connected:"Connesso",disconnected:"Disconnesso",scope:{label:"Ambito",user:"Utente",project:"Progetto"}},hbe={title:"Aspetto",theme:"Tema",codeEditor:"Editor codice",editorTheme:"Tema editor",wordWrap:"A capo automatico",showMinimap:"Mostra minimappa",lineNumbers:"Numeri di riga",fontSize:"Dimensione carattere"},fbe={saveChanges:"Salva modifiche",resetToDefaults:"Ripristina predefiniti",cancelChanges:"Annulla modifiche"},gbe={title:"Impostazioni rapide",sections:{appearance:"Aspetto",toolDisplay:"Visualizzazione strumenti",viewOptions:"Opzioni visualizzazione",inputSettings:"Impostazioni input",changeAwareness:"Centro controllo"},darkMode:"Modalità scura",autoExpandTools:"Espandi strumenti automaticamente",showRawParameters:"Mostra parametri grezzi",showThinking:"Mostra ragionamento",autoScrollToBottom:"Scorrimento automatico in basso",sendByCtrlEnter:"Invia con Ctrl+Invio",sendByCtrlEnterDescription:"Se abilitato, premere Ctrl+Invio invierà il messaggio invece di Invio. Utile per gli utenti IME per evitare invii accidentali.",changeAwareness:"Centro controllo",changedFiles:{title:"File modificati",description:"Segue le modifiche locali e apre il pannello File quando appare una nuova modifica.",noProject:"Seleziona un progetto per seguire le modifiche locali.",refresh:"Aggiorna file modificati",empty:"Nessuna modifica locale rilevata",disabled:"Abilita Centro controllo per monitorare le modifiche locali.",more:"+{{count}} altri file",lastChecked:"Controllato {{value}}",guideTitle:"Guida pannello destro",guideFiles:"I file modificati si illuminano in verde in File.",guidePanel:"Le nuove modifiche aprono automaticamente il pannello diviso.",status:{M:"M",A:"A",D:"D",U:"U"}},dragHandle:{dragging:"Trascinamento maniglia",closePanel:"Chiudi pannello impostazioni",openPanel:"Apri pannello impostazioni",draggingStatus:"Trascinamento...",toggleAndMove:"Clicca per attivare/disattivare, trascina per spostare"}},bbe={title:"Scorciatoie terminale",sectionKeys:"Tasti",sectionNavigation:"Navigazione",escape:"Escape",tab:"Tab",shiftTab:"Shift+Tab",arrowUp:"Freccia su",arrowDown:"Freccia giù",scrollDown:"Scorri giù",handle:{closePanel:"Chiudi pannello scorciatoie",openPanel:"Apri pannello scorciatoie"}},xbe={label:"Impostazioni",agents:"Agenti",appearance:"Aspetto",git:"Git",apiTokens:"API e Token",tasks:"Attività",notifications:"Notifiche",plugins:"Plugin",mobile:"Usa da mobile",telegram:"Telegram",about:"Informazioni"},ybe={title:"Notifiche",description:"Controlla quali notifiche ricevere.",webPush:{title:"Notifiche push web",enable:"Abilita notifiche push",disable:"Disabilita notifiche push",enabled:"Le notifiche push sono abilitate",loading:"Aggiornamento...",unsupported:"Le notifiche push non sono supportate in questo browser.",denied:"Le notifiche push sono bloccate. Abilitale nelle impostazioni del browser."},events:{title:"Tipi di evento",actionRequired:"Azione richiesta",stop:"Esecuzione interrotta",error:"Esecuzione fallita"}},vbe={darkMode:{label:"Modalità scura",description:"Alterna tra tema chiaro e scuro"},projectSorting:{label:"Ordinamento progetti",description:"Come vengono ordinati i progetti nella barra laterale",alphabetical:"Alfabetico",recentActivity:"Attività recente"},codeEditor:{title:"Editor codice",theme:{label:"Tema editor",description:"Tema predefinito per l'editor di codice"},wordWrap:{label:"A capo automatico",description:"Abilita il ritorno a capo automatico nell'editor"},showMinimap:{label:"Mostra minimappa",description:"Visualizza una minimappa per facilitare la navigazione nella vista differenze"},lineNumbers:{label:"Mostra numeri di riga",description:"Visualizza i numeri di riga nell'editor"},fontSize:{label:"Dimensione carattere",description:"Dimensione del carattere dell'editor in pixel"}}},wbe={title:{add:"Aggiungi server MCP",edit:"Modifica server MCP"},importMode:{form:"Input modulo",json:"Importa JSON"},scope:{label:"Ambito",userGlobal:"Utente (globale)",projectLocal:"Progetto (locale)",userDescription:"Ambito utente: disponibile in tutti i progetti sulla tua macchina",projectDescription:"Ambito locale: disponibile solo nel progetto selezionato",cannotChange:"L'ambito non può essere modificato quando si modifica un server esistente"},fields:{serverName:"Nome server",transportType:"Tipo di trasporto",command:"Comando",arguments:"Argomenti (uno per riga)",jsonConfig:"Configurazione JSON",url:"URL",envVars:"Variabili d'ambiente (CHIAVE=valore, una per riga)",headers:"Header (CHIAVE=valore, uno per riga)",selectProject:"Seleziona un progetto..."},placeholders:{serverName:"mio-server"},validation:{missingType:"Campo obbligatorio mancante: type",stdioRequiresCommand:"Il tipo stdio richiede un campo command",httpRequiresUrl:"Il tipo {{type}} richiede un campo url",invalidJson:"Formato JSON non valido",jsonHelp:"Incolla la configurazione del server MCP in formato JSON. Esempi di formato:",jsonExampleStdio:'• stdio: {"type":"stdio","command":"npx","args":["@upstash/context7-mcp"]}',jsonExampleHttp:'• http/sse: {"type":"http","url":"https://api.example.com/mcp"}'},configDetails:"Dettagli configurazione (da {{configFile}})",projectPath:"Percorso: {{path}}",actions:{cancel:"Annulla",saving:"Salvataggio...",addServer:"Aggiungi server",updateServer:"Aggiorna server"}},kbe={success:"Impostazioni salvate con successo!",error:"Impossibile salvare le impostazioni",saving:"Salvataggio..."},Sbe={save:"Salva impostazioni",cancel:"Annulla"},Ebe={title:"Configurazione Git",description:"Configura la tua identità git per i commit. Queste impostazioni verranno applicate globalmente tramite git config --global",name:{label:"Nome Git",help:"Il tuo nome per i commit git"},email:{label:"Email Git",help:"La tua email per i commit git"},actions:{save:"Salva configurazione",saving:"Salvataggio..."},status:{success:"Salvato con successo"}},Nbe={title:"Chiavi API",description:"Genera chiavi API per accedere all'API esterna da altre applicazioni.",newKey:{alertTitle:"⚠️ Salva la tua chiave API",alertMessage:"Questa è l'unica volta che vedrai questa chiave. Conservala in modo sicuro.",iveSavedIt:"L'ho salvata"},form:{placeholder:"Nome chiave API (es. Server produzione)",createButton:"Crea",cancelButton:"Annulla"},newButton:"Nuova chiave API",empty:"Nessuna chiave API creata.",list:{created:"Creata:",lastUsed:"Ultimo utilizzo:"},confirmDelete:"Sei sicuro di voler eliminare questa chiave API?",status:{active:"Attiva",inactive:"Inattiva"},github:{title:"Token GitHub",description:"Aggiungi token di accesso personale GitHub per clonare repository privati tramite l'API esterna.",descriptionAlt:"Aggiungi token di accesso personale GitHub per clonare repository privati. Puoi anche passare i token direttamente nelle richieste API senza salvarli.",addButton:"Aggiungi token",form:{namePlaceholder:"Nome token (es. Repository personali)",tokenPlaceholder:"Token di accesso personale GitHub (ghp_...)",descriptionPlaceholder:"Descrizione (opzionale)",addButton:"Aggiungi token",cancelButton:"Annulla",howToCreate:"Come creare un token di accesso personale GitHub →"},empty:"Nessun token GitHub aggiunto.",added:"Aggiunto:",confirmDelete:"Sei sicuro di voler eliminare questo token GitHub?"},apiDocsLink:"Documentazione API",documentation:{title:"Documentazione API esterna",description:"Scopri come usare l'API esterna per avviare sessioni Claude/Cursor dalle tue applicazioni.",viewLink:"Vedi documentazione API →"},loading:"Caricamento...",version:{updateAvailable:"Aggiornamento disponibile: v{{version}}"}},Cbe={checking:"Verifica installazione TaskMaster...",notInstalled:{title:"TaskMaster AI CLI non installato",description:"TaskMaster CLI è necessario per usare le funzionalità di gestione attività. Installalo per iniziare:",installCommand:"npm install -g task-master-ai",viewOnGitHub:"Vedi su GitHub",afterInstallation:"Dopo l'installazione:",steps:{restart:"Riavvia questa applicazione",autoAvailable:"Le funzionalità TaskMaster saranno automaticamente disponibili",initCommand:"Usa task-master init nella directory del tuo progetto"}},settings:{enableLabel:"Abilita integrazione TaskMaster",enableDescription:"Mostra attività TaskMaster, banner e indicatori nella barra laterale nell'interfaccia"}},Abe={authStatus:{checking:"Verifica...",connected:"Connesso",notConnected:"Non connesso",disconnected:"Disconnesso",checkingAuth:"Verifica stato autenticazione...",loggedInAs:"Connesso come {{email}}",authenticatedUser:"utente autenticato"},account:{claude:{description:"Assistente AI Anthropic Claude"},cursor:{description:"Editor di codice potenziato da AI Cursor"},codex:{description:"Assistente AI OpenAI Codex"},gemini:{description:"Assistente AI Google Gemini"},qwen:{description:"Alibaba Qwen Code CLI (fork di Gemini CLI)"}},connectionStatus:"Stato connessione",login:{title:"Accedi",reAuthenticate:"Ri-autenticati",description:"Accedi al tuo account {{agent}} per abilitare le funzionalità AI",reAuthDescription:"Accedi con un account diverso o aggiorna le credenziali",button:"Accedi",reLoginButton:"Ri-accedi"},error:"Errore: {{error}}"},Tbe={title:"Impostazioni permessi",skipPermissions:{label:"Salta richieste di permesso (usa con cautela)",claudeDescription:"Equivalente al flag --dangerously-skip-permissions",cursorDescription:"Equivalente al flag -f in Cursor CLI",opencodeDescription:"Equivalente al flag --dangerously-skip-permissions in OpenCode"},allowedTools:{title:"Strumenti consentiti",description:"Strumenti automaticamente consentiti senza richiedere permesso",placeholder:'es. "Bash(git log:*)" o "Write"',quickAdd:"Aggiunta rapida strumenti comuni:",empty:"Nessuno strumento consentito configurato"},blockedTools:{title:"Strumenti bloccati",description:"Strumenti automaticamente bloccati senza richiedere permesso",placeholder:'es. "Bash(rm:*)"',empty:"Nessuno strumento bloccato configurato"},allowedCommands:{title:"Comandi shell consentiti",description:"Comandi shell automaticamente consentiti senza richiedere permesso",placeholder:'es. "Shell(ls)" o "Shell(git status)"',quickAdd:"Aggiunta rapida comandi comuni:",empty:"Nessun comando consentito configurato"},blockedCommands:{title:"Comandi shell bloccati",description:"Comandi shell automaticamente bloccati",placeholder:'es. "Shell(rm -rf)" o "Shell(sudo)"',empty:"Nessun comando bloccato configurato"},toolExamples:{title:"Esempi pattern strumenti:",bashGitLog:"- Consenti tutti i comandi git log",bashGitDiff:"- Consenti tutti i comandi git diff",write:"- Consenti tutti gli utilizzi dello strumento Write",bashRm:"- Blocca tutti i comandi rm (pericoloso)"},shellExamples:{title:"Esempi comandi shell:",ls:"- Consenti comando ls",gitStatus:"- Consenti git status",npmInstall:"- Consenti npm install",rmRf:"- Blocca eliminazione ricorsiva"},opencodeAllowed:{title:"Pattern Bash Consentiti",description:"Pattern di comandi bash che OpenCode approva automaticamente senza chiedere",placeholder:'es. "git *" o "npm test"',quickAdd:"Aggiunta rapida pattern comuni:",empty:"Nessun pattern consentito configurato"},opencodeBlocked:{title:"Pattern Bash Bloccati",description:"Pattern di comandi bash che OpenCode rifiuta sempre",placeholder:'es. "rm -rf *" o "sudo *"',empty:"Nessun pattern bloccato configurato"},opencodeExamples:{title:"Esempi di pattern:",gitAll:"- Consenti tutti i comandi git",gitPush:"- Blocca solo git push",rmRf:"- Blocca cancellazione ricorsiva",npm:"- Consenti tutti i comandi npm"},codex:{permissionMode:"Modalità permessi",description:"Controlla come Codex gestisce le modifiche ai file e l'esecuzione dei comandi",modes:{default:{title:"Predefinito",description:"Solo i comandi attendibili (ls, cat, grep, git status, ecc.) vengono eseguiti automaticamente. Gli altri comandi vengono saltati. Può scrivere nell'area di lavoro."},acceptEdits:{title:"Accetta modifiche",description:"Tutti i comandi vengono eseguiti automaticamente nell'area di lavoro. Modalità completamente automatica con esecuzione sandboxed."},bypassPermissions:{title:"Ignora permessi",description:"Accesso completo al sistema senza restrizioni. Tutti i comandi vengono eseguiti automaticamente con accesso completo a disco e rete. Usa con cautela."}},technicalDetails:"Dettagli tecnici",technicalInfo:{default:"sandboxMode=workspace-write, approvalPolicy=untrusted. Comandi attendibili: cat, cd, grep, head, ls, pwd, tail, git status/log/diff/show, find (senza -exec), ecc.",acceptEdits:"sandboxMode=workspace-write, approvalPolicy=never. Tutti i comandi vengono auto-eseguiti nella directory del progetto.",bypassPermissions:"sandboxMode=danger-full-access, approvalPolicy=never. Accesso completo al sistema, usa solo in ambienti attendibili.",overrideNote:"Puoi sovrascrivere questa impostazione per sessione usando il pulsante modalità nell'interfaccia chat."}},actions:{add:"Aggiungi"}},jbe={title:"Server MCP",description:{claude:"I server Model Context Protocol forniscono strumenti e fonti dati aggiuntive a Claude",cursor:"I server Model Context Protocol forniscono strumenti e fonti dati aggiuntive a Cursor",codex:"I server Model Context Protocol forniscono strumenti e fonti dati aggiuntive a Codex"},addButton:"Aggiungi server MCP",empty:"Nessun server MCP configurato",serverType:"Tipo",scope:{local:"locale",user:"utente"},config:{command:"Comando",url:"URL",args:"Argomenti",environment:"Ambiente"},tools:{title:"Strumenti",count:"({{count}}):",more:"+{{count}} altri"},actions:{edit:"Modifica server",delete:"Elimina server"},help:{title:"Informazioni su Codex MCP",description:"Codex supporta server MCP basati su stdio. Puoi aggiungere server che estendono le capacità di Codex con strumenti e risorse aggiuntive."}},_be={title:"Plugin",description:"Estendi l'interfaccia con plugin personalizzati. Installa da git o inserisci una cartella in ~/.pixcode/plugins/",installPlaceholder:"https://github.com/utente/mio-plugin",installButton:"Installa",installing:"Installazione…",securityWarning:"Installa solo plugin di cui hai verificato il codice sorgente o di autori di cui ti fidi.",scanningPlugins:"Scansione plugin…",noPluginsInstalled:"Nessun plugin installato",pullLatest:"Aggiorna da git",noGitRemote:"Nessun remote git — aggiornamento non disponibile",uninstallPlugin:"Disinstalla plugin",confirmUninstall:"Clicca di nuovo per confermare",confirmUninstallMessage:"Rimuovere {{name}}? Questa azione non può essere annullata.",cancel:"Annulla",remove:"Rimuovi",updateFailed:"Aggiornamento fallito",installFailed:"Installazione fallita",uninstallFailed:"Disinstallazione fallita",toggleFailed:"Attivazione/disattivazione fallita",starterPluginLabel:"Plugin iniziale",starter:"Iniziale",docs:"Documentazione",starterPlugin:{name:"Statistiche progetto",badge:"iniziale",description:"Conteggio file, righe di codice, ripartizione per tipo di file e attività recente per il tuo progetto.",install:"Installa"},terminalPlugin:{name:"Terminale",badge:"ufficiale",description:"Terminale integrato con accesso completo alla shell direttamente nell'interfaccia.",install:"Installa"},morePlugins:"Altri",enable:"Abilita",disable:"Disabilita",installAriaLabel:"URL repository git del plugin",tab:"scheda",runningStatus:"in esecuzione"},Ibe={title:dbe,tabs:ube,account:pbe,mcp:mbe,appearance:hbe,actions:fbe,quickSettings:gbe,terminalShortcuts:bbe,mainTabs:xbe,notifications:ybe,appearanceSettings:vbe,mcpForm:wbe,saveStatus:kbe,footerActions:Sbe,git:Ebe,apiKeys:Nbe,tasks:Cbe,agents:Abe,permissions:Tbe,mcpServers:jbe,pluginSettings:_be},Rbe={title:"Bentornato",description:"Accedi al tuo account Pixcode self-hosted",username:"Nome utente",password:"Password",submit:"Accedi",loading:"Accesso in corso...",errors:{invalidCredentials:"Nome utente o password non validi",requiredFields:"Compila tutti i campi",networkError:"Errore di rete. Riprova."},placeholders:{username:"Inserisci il tuo nome utente",password:"Inserisci la tua password"}},Lbe={title:"Crea account",username:"Nome utente",password:"Password",confirmPassword:"Conferma password",submit:"Crea account",loading:"Creazione account...",errors:{passwordMismatch:"Le password non corrispondono",usernameTaken:"Nome utente già in uso",weakPassword:"La password è troppo debole"}},Dbe={title:"Disconnetti",confirm:"Sei sicuro di volerti disconnettere?",button:"Disconnetti"},Obe={login:Rbe,register:Lbe,logout:Dbe},Mbe={title:"Progetti",newProject:"Nuovo progetto",deleteProject:"Rimuovi progetto",renameProject:"Rinomina progetto",noProjects:"Nessun progetto trovato",loadingProjects:"Caricamento progetti...",searchPlaceholder:"Cerca progetti...",projectNamePlaceholder:"Nome progetto",starred:"Preferiti",all:"Tutti",untitledSession:"Sessione senza titolo",newSession:"Nuova sessione",codexSession:"Sessione Codex",fetchingProjects:"Recupero dei tuoi progetti e sessioni Claude",projects:"progetti",detectedFromHistory:"Rilevato dalla cronologia",noMatchingProjects:"Nessun progetto corrispondente",tryDifferentSearch:"Prova a modificare il termine di ricerca",runClaudeCli:"Esegui Claude CLI in una directory di progetto per iniziare"},Pbe={title:"Pixcode",subtitle:"Interfaccia assistente di programmazione AI"},Fbe={title:"Sessioni",newSession:"Nuova sessione",deleteSession:"Elimina sessione",renameSession:"Rinomina sessione",noSessions:"Nessuna sessione",loadingSessions:"Caricamento sessioni...",unnamed:"Senza nome",loading:"Caricamento...",showMore:"Mostra più sessioni",startToSee:"Inizia una nuova sessione per vederla qui."},zbe={viewEnvironments:"Visualizza ambienti",hideSidebar:"Nascondi barra laterale",createProject:"Crea nuovo progetto",refresh:"Aggiorna progetti e sessioni (Ctrl+R)",renameProject:"Rinomina progetto (F2)",deleteProject:"Rimuovi progetto dalla barra laterale (Canc)",addToFavorites:"Aggiungi ai preferiti",removeFromFavorites:"Rimuovi dai preferiti",editSessionName:"Modifica manualmente il nome della sessione",deleteSession:"Elimina questa sessione permanentemente",save:"Salva",cancel:"Annulla",clearSearch:"Cancella ricerca",sessionActions:"Azioni sessione",historyView:"Visualizzazione cronologia",historyViewFlat:"Conversazioni recenti",historyViewGrouped:"Raggruppate per progetto"},Bbe={chat:"Chat",files:"File",git:"Git",terminal:"Terminale",tasks:"Attività"},$be={refresh:"Aggiorna",settings:"Impostazioni",collapseAll:"Comprimi tutto",expandAll:"Espandi tutto",cancel:"Annulla",save:"Salva",delete:"Elimina",rename:"Rinomina",joinCommunity:"Unisciti alla community",reportIssue:"Segnala problema",starOnGithub:"Metti stella su GitHub",starSession:"Preferita",unstarSession:"Rimuovi preferita"},Ube={openSource:"Open Source"},Gbe={active:"Attivo",inactive:"Inattivo",thinking:"Sto pensando...",error:"Errore",aborted:"Interrotto",unknown:"Sconosciuto"},Hbe={justNow:"Adesso",oneMinuteAgo:"1 min fa",minutesAgo:"{{count}} min fa",oneHourAgo:"1 ora fa",hoursAgo:"{{count}} ore fa",oneDayAgo:"1 giorno fa",daysAgo:"{{count}} giorni fa",buckets:{today:"Oggi",yesterday:"Ieri",thisWeek:"Ultimi 7 giorni",thisMonth:"Ultimi 30 giorni",older:"Più vecchi"}},Vbe={deleteConfirm:"Sei sicuro di voler eliminare questo elemento?",renameSuccess:"Rinominato con successo",deleteSuccess:"Eliminato con successo",errorOccurred:"Si è verificato un errore",deleteSessionConfirm:"Sei sicuro di voler eliminare questa sessione? Questa azione non può essere annullata.",deleteProjectConfirm:"Rimuovere questo progetto dalla barra laterale? I file del progetto, le memorie e i dati delle sessioni non verranno eliminati.",enterProjectPath:"Inserisci un percorso di progetto",deleteSessionFailed:"Impossibile eliminare la sessione. Riprova.",deleteSessionError:"Errore durante l'eliminazione della sessione. Riprova.",renameSessionFailed:"Impossibile rinominare la sessione. Riprova.",renameSessionError:"Errore durante la rinomina della sessione. Riprova.",deleteProjectFailed:"Impossibile rimuovere il progetto. Riprova.",deleteProjectError:"Errore durante la rimozione del progetto. Riprova.",createProjectFailed:"Impossibile creare il progetto. Riprova.",createProjectError:"Errore durante la creazione del progetto. Riprova."},qbe={updateAvailable:"Aggiornamento disponibile"},Wbe={modeProjects:"Progetti",modeConversations:"Conversazioni",conversationsPlaceholder:"Cerca nelle conversazioni...",searching:"Ricerca in corso...",noResults:"Nessun risultato trovato",tryDifferentQuery:"Prova con una ricerca diversa",matches_one:"{{count}} corrispondenza",matches_other:"{{count}} corrispondenze",projectsScanned_one:"{{count}} progetto analizzato",projectsScanned_other:"{{count}} progetti analizzati"},Kbe={deleteProject:"Rimuovi progetto",deleteSession:"Elimina sessione",confirmDelete:"Cosa vuoi fare con",sessionCount_one:"Questo progetto contiene {{count}} conversazione.",sessionCount_other:"Questo progetto contiene {{count}} conversazioni.",removeFromSidebar:"Rimuovi solo dalla barra laterale",deleteAllData:"Elimina tutti i dati permanentemente",allConversationsDeleted:"Il progetto verrà rimosso dalla barra laterale. I tuoi file, memorie e dati delle sessioni verranno preservati.",cannotUndo:"Puoi riaggiungerlo in seguito."},Ybe={flat:"Recenti",grouped:"Per progetto"},Zbe={section:"Orchestrazione",fallbackTitle:"Esecuzione orchestrazione"},Xbe={projects:Mbe,app:Pbe,sessions:Fbe,tooltips:zbe,navigation:Bbe,actions:$be,branding:Ube,status:Gbe,time:Hbe,messages:Vbe,version:qbe,search:Wbe,deleteConfirmation:Kbe,historyView:Ybe,orchestration:Zbe},Jbe={copy:"Copia",copied:"Copiato",copyCode:"Copia codice"},Qbe={copy:"Copia messaggio",copied:"Messaggio copiato",selectFormat:"Seleziona formato copia",copyAsMarkdown:"Copia come markdown",copyAsText:"Copia come testo"},exe={user:"U",error:"Errore",tool:"Strumento",claude:"Claude",cursor:"Cursor",codex:"Codex",gemini:"Gemini",qwen:"Qwen Code"},txe={settings:"Impostazioni strumento",error:"Errore strumento",result:"Risultato strumento",viewParams:"Vedi parametri input",viewRawParams:"Vedi parametri grezzi",viewDiff:"Vedi differenze per",creatingFile:"Creazione nuovo file:",updatingTodo:"Aggiornamento lista attività",read:"Leggi",readFile:"Leggi file",updateTodo:"Aggiorna lista attività",readTodo:"Leggi lista attività",searchResults:"risultati"},rxe={found:"Trovati {{count}} {{type}}",file:"file",files:"file",pattern:"pattern:",in:"in:"},nxe={updated:"File aggiornato con successo",created:"File creato con successo",written:"File scritto con successo",diff:"Differenze",newFile:"Nuovo file",viewContent:"Vedi contenuto file",viewFullOutput:"Vedi output completo ({{count}} caratteri)",contentDisplayed:"Il contenuto del file è visualizzato nella vista differenze sopra"},axe={title:"Prompt interattivo",waiting:"In attesa della tua risposta nella CLI",instruction:"Seleziona un'opzione nel terminale dove Claude è in esecuzione.",selectedOption:"✓ Claude ha selezionato l'opzione {{number}}",instructionDetail:"Nella CLI, selezioneresti questa opzione interattivamente usando i tasti freccia o digitando il numero."},ixe={title:"Sto pensando...",emoji:"💭 Sto pensando..."},sxe={response:"Risposta JSON"},oxe={grant:"Concedi permesso per {{tool}}",added:"Permesso aggiunto",addTo:"Aggiunge {{entry}} agli strumenti consentiti.",retry:"Permesso salvato. Riprova la richiesta per usare lo strumento.",error:"Impossibile aggiornare i permessi. Riprova.",openSettings:"Apri impostazioni"},lxe={updated:"Lista attività aggiornata con successo",current:"Lista attività corrente"},cxe={viewPlan:"📋 Vedi piano di implementazione",title:"Piano di implementazione"},dxe={resetAt:"Limite di utilizzo Claude raggiunto. Il tuo limite verrà ripristinato alle **{{time}} {{timezone}}** - {{date}}"},uxe={permissionMode:"Modalità permessi",modes:{default:"Modalità predefinita",acceptEdits:"Accetta modifiche",bypassPermissions:"Ignora permessi",plan:"Modalità piano"},descriptions:{default:"Solo i comandi attendibili (ls, cat, grep, git status, ecc.) vengono eseguiti automaticamente. Gli altri comandi vengono saltati. Può scrivere nell'area di lavoro.",acceptEdits:"Tutti i comandi vengono eseguiti automaticamente nell'area di lavoro. Modalità completamente automatica con esecuzione sandboxed.",bypassPermissions:"Accesso completo al sistema senza restrizioni. Tutti i comandi vengono eseguiti automaticamente con accesso completo a disco e rete. Usa con cautela.",plan:"Modalità pianificazione - nessun comando viene eseguito"},technicalDetails:"Dettagli tecnici"},pxe={permissionMode:"Modalità permessi Gemini",description:"Controlla come Gemini CLI gestisce le approvazioni delle operazioni.",modes:{default:{title:"Standard (chiedi approvazione)",description:"Gemini chiederà l'approvazione prima di eseguire comandi, scrivere file e recuperare risorse web."},autoEdit:{title:"Modifica automatica (salta approvazioni file)",description:"Gemini approverà automaticamente modifiche ai file e recupero web, ma chiederà conferma per i comandi shell."},yolo:{title:"YOLO (ignora tutti i permessi)",description:"Gemini eseguirà tutte le operazioni senza chiedere approvazione. Usa con cautela."}}},mxe={placeholder:"Digita / per i comandi, @ per i file, o chiedi qualcosa a {{provider}}...",placeholderDefault:"Scrivi il tuo messaggio...",disabled:"Input disabilitato",attachFiles:"Allega file",attachImages:"Allega immagini",send:"Invia",stop:"Ferma",clickToChangeMode:"Clicca per cambiare modalità permessi (o premi Tab nell'input)",showAllCommands:"Mostra tutti i comandi",clearInput:"Cancella input",scrollToBottom:"Scorri in basso"},hxe={selector:{title:"Modalità ragionamento",description:"Il ragionamento esteso dà a Claude più tempo per valutare le alternative",active:"Attivo",tip:"Modalità di ragionamento più elevate richiedono più tempo ma forniscono un'analisi più approfondita"},modes:{none:{name:"Standard",description:"Risposta Claude normale",prefix:""},think:{name:"Pensa",description:"Ragionamento esteso base",prefix:"think"},thinkHard:{name:"Pensa di più",description:"Valutazione più approfondita",prefix:"think hard"},thinkHarder:{name:"Pensa ancora",description:"Analisi profonda con alternative",prefix:"think harder"},ultrathink:{name:"Ultrapensiero",description:"Budget massimo di ragionamento",prefix:"ultrathink"}},buttonTitle:"Modalità ragionamento: {{mode}}"},fxe={title:"Scegli il tuo assistente AI",description:"Seleziona un provider per iniziare una nuova conversazione",selectModel:"Seleziona modello",providerInfo:{anthropic:"di Anthropic",openai:"di OpenAI",cursorEditor:"Editor codice AI",google:"di Google"},readyPrompt:{claude:"Pronto a usare Claude con {{model}}. Inizia a digitare il tuo messaggio qui sotto.",cursor:"Pronto a usare Cursor con {{model}}. Inizia a digitare il tuo messaggio qui sotto.",codex:"Pronto a usare Codex con {{model}}. Inizia a digitare il tuo messaggio qui sotto.",gemini:"Pronto a usare Gemini con {{model}}. Inizia a digitare il tuo messaggio qui sotto.",default:"Seleziona un provider sopra per iniziare"}},gxe={continue:{title:"Continua la tua conversazione",description:"Fai domande sul tuo codice, richiedi modifiche o chiedi aiuto con le attività di sviluppo"},loading:{olderMessages:"Caricamento messaggi precedenti...",sessionMessages:"Caricamento messaggi della sessione..."},messages:{showingOf:"Visualizzati {{shown}} di {{total}} messaggi",scrollToLoad:"Scorri in alto per caricare altri",showingLast:"Visualizzati ultimi {{count}} messaggi ({{total}} totali)",loadEarlier:"Carica messaggi precedenti",loadAll:"Carica tutti i messaggi",loadingAll:"Caricamento di tutti i messaggi...",allLoaded:"Tutti i messaggi caricati",perfWarning:'Tutti i messaggi caricati — lo scorrimento potrebbe essere più lento. Clicca "Scorri in basso" per ripristinare le prestazioni.'}},bxe={selectProject:{title:"Seleziona un progetto",description:"Scegli un progetto per aprire una shell interattiva in quella directory"},status:{newSession:"Nuova sessione",initializing:"Inizializzazione...",restarting:"Riavvio..."},actions:{disconnect:"Disconnetti",disconnectTitle:"Disconnetti dalla shell",restart:"Riavvia",restartTitle:"Riavvia shell (disconnetti prima)",connect:"Continua nella shell",connectTitle:"Connetti alla shell"},loading:"Caricamento terminale...",connecting:"Connessione alla shell...",startSession:"Avvia una nuova sessione Claude",resumeSession:"Riprendi sessione: {{displayName}}...",runCommand:"Esegui {{command}} in {{projectName}}",startCli:"Avvio Claude CLI in {{projectName}}",defaultCommand:"comando"},xxe={actions:{thinking:"Ragionamento",processing:"Elaborazione",analyzing:"Analisi",working:"In lavorazione",computing:"Calcolo",reasoning:"Ragionamento"},state:{live:"Attivo",paused:"In pausa"},elapsed:{seconds:"{{count}}s",minutesSeconds:"{{minutes}}m {{seconds}}s",label:"{{time}} trascorsi",startingNow:"Avvio in corso"},controls:{stopGeneration:"Interrompi generazione",pressEscToStop:"Premi Esc in qualsiasi momento per interrompere"},providers:{assistant:"Assistente"}},yxe={startChatWithProvider:"Seleziona un progetto per iniziare a chattare con {{provider}}"},vxe={nextTaskPrompt:"Inizia l'attività successiva"},wxe={codeBlock:Jbe,copyMessage:Qbe,messageTypes:exe,tools:txe,search:rxe,fileOperations:nxe,interactive:axe,thinking:ixe,json:sxe,permissions:oxe,todo:lxe,plan:cxe,usageLimit:dxe,codex:uxe,gemini:pxe,input:mxe,thinkingMode:hxe,providerSelection:fxe,session:gxe,shell:bxe,claudeStatus:xxe,projectSelection:yxe,tasks:vxe},kxe={changes:"modifiche",previousChange:"Modifica precedente",nextChange:"Modifica successiva",hideDiff:"Nascondi evidenziazione differenze",showDiff:"Mostra evidenziazione differenze",settings:"Impostazioni editor",collapse:"Comprimi editor",expand:"Espandi editor a larghezza piena"},Sxe="Caricamento {{fileName}}...",Exe={showingChanges:"Visualizzazione modifiche"},Nxe={download:"Scarica file",save:"Salva",saving:"Salvataggio...",saved:"Salvato!",exitFullscreen:"Esci dalla modalità schermo intero",fullscreen:"Schermo intero",close:"Chiudi",previewMarkdown:"Anteprima markdown",editMarkdown:"Modifica markdown"},Cxe={lines:"Righe:",characters:"Caratteri:",shortcuts:"Premi Ctrl+S per salvare • Esc per chiudere"},Axe={title:"File binario",message:`Il file "{{fileName}}" non può essere visualizzato nell'editor di testo perché è un file binario.`},Txe={toolbar:kxe,loading:Sxe,header:Exe,actions:Nxe,footer:Cxe,binaryFile:Axe},jxe={title:"TaskMaster AI non è configurato",description:"TaskMaster aiuta a suddividere progetti complessi in attività gestibili con assistenza AI",whatIsTitle:"🎯 Cos'è TaskMaster?",features:{aiPowered:"Gestione attività AI: suddividi progetti complessi in sotto-attività gestibili",prdTemplates:"Template PRD: genera attività da documenti di requisiti del prodotto",dependencyTracking:"Tracciamento dipendenze: comprendi le relazioni tra attività e l'ordine di esecuzione",progressVisualization:"Visualizzazione progresso: board Kanban e analisi dettagliata delle attività",cliIntegration:"Integrazione CLI: usa i comandi taskmaster per flussi di lavoro avanzati"},initializeButton:"Inizializza TaskMaster AI"},_xe={title:"Inizia con TaskMaster",subtitle:"TaskMaster è inizializzato! Ecco cosa fare dopo:",steps:{createPRD:{title:"Crea un documento di requisiti del prodotto (PRD)",description:"Discuti la tua idea di progetto e crea un PRD che descriva cosa vuoi costruire.",addButton:"Aggiungi PRD",existingPRDs:"PRD esistenti:"},generateTasks:{title:"Genera attività dal PRD",description:"Una volta che hai un PRD, chiedi al tuo assistente AI di analizzarlo e TaskMaster lo suddividerà automaticamente in attività gestibili con dettagli di implementazione."},analyzeTasks:{title:"Analizza ed espandi le attività",description:"Chiedi al tuo assistente AI di analizzare la complessità delle attività ed espanderle in sotto-attività dettagliate per un'implementazione più semplice."},startBuilding:{title:"Inizia a costruire",description:"Chiedi al tuo assistente AI di iniziare a lavorare sulle attività, aggiornare il loro stato e aggiungere nuove attività man mano che il tuo progetto evolve."}},tip:"💡 Suggerimento: inizia con un PRD per ottenere il massimo dalla generazione di attività AI di TaskMaster"},Ixe={title:"Configurazione TaskMaster",subtitle:"CLI interattiva per {{projectName}}",willStart:"L'inizializzazione di TaskMaster partirà automaticamente",completed:"Configurazione TaskMaster completata! Ora puoi chiudere questa finestra.",closeButton:"Chiudi",closeContinueButton:"Chiudi e continua"},Rxe={title:"Inizia con TaskMaster",subtitle:"La tua guida per una gestione produttiva delle attività",examples:{parsePRD:`💬 Esempio:
865
865
  "Ho appena inizializzato un nuovo progetto con Claude Task Master. Ho un PRD in .taskmaster/docs/prd.txt. Puoi aiutarmi ad analizzarlo e configurare le attività iniziali?"`,expandTask:`💬 Esempio:
866
866
  "L'attività 5 sembra complessa. Puoi suddividerla in sotto-attività?"`,addTask:`💬 Esempio:
867
- "Per favore aggiungi una nuova attività per implementare il caricamento delle immagini profilo utente usando Cloudinary, ricerca l'approccio migliore."`},moreExamples:"Vedi altri esempi e pattern di utilizzo →",proTips:{title:"💡 Suggerimenti pro",search:"Usa la barra di ricerca per trovare rapidamente attività specifiche",views:"Passa tra le viste Kanban, Lista e Griglia usando i selettori di vista",filters:"Usa i filtri per concentrarti su stati o priorità specifiche delle attività",details:"Clicca su qualsiasi attività per vedere informazioni dettagliate e gestire le sotto-attività"},learnMore:{title:"📚 Per saperne di più",description:"TaskMaster AI è un sistema avanzato di gestione attività pensato per sviluppatori. Trova documentazione, esempi e contribuisci al progetto.",githubButton:"Vedi su GitHub"}},Lxe={placeholder:"Cerca attività..."},Dxe={button:"Filtri",status:"Stato",priority:"Priorità",sortBy:"Ordina per",allStatuses:"Tutti gli stati",allPriorities:"Tutte le priorità",showing:"Visualizzate {{filtered}} di {{total}} attività",clearFilters:"Cancella filtri"},Oxe={id:"ID",status:"Stato",priority:"Priorità",idAsc:"ID (crescente)",idDesc:"ID (decrescente)",titleAsc:"Titolo (A-Z)",titleDesc:"Titolo (Z-A)",statusAsc:"Stato (in attesa prima)",statusDesc:"Stato (completati prima)",priorityAsc:"Priorità (alta prima)",priorityDesc:"Priorità (bassa prima)"},Mxe={kanban:"Vista Kanban",list:"Vista lista",grid:"Vista griglia"},Pxe={pending:"📋 Da fare",inProgress:"🚀 In corso",done:"✅ Completate",blocked:"🚫 Bloccate",deferred:"⏳ Rimandate",cancelled:"❌ Annullate",noTasksYet:"Nessuna attività",tasksWillAppear:"Le attività appariranno qui",moveTasksHere:"Sposta le attività qui quando iniziate",completedTasksHere:"Le attività completate appariranno qui",statusTasksHere:"Le attività con questo stato appariranno qui"},Fxe={help:"Guida introduttiva TaskMaster",prds:"PRD",addPRD:"Aggiungi PRD",addTask:"Aggiungi attività",createNewPRD:"Crea nuovo PRD",prdsAvailable:"{{count}} PRD disponibili"},zxe={modified:"Modificato: {{date}}"},Bxe={pending:"In attesa","in-progress":"In corso",done:"Completata",blocked:"Bloccata",deferred:"Rimandata",cancelled:"Annullata"},$xe={high:"Alta",medium:"Media",low:"Bassa"},Uxe={title:"Nessuna attività corrisponde ai filtri",description:"Prova a modificare la ricerca o i criteri di filtro."},Gxe={notConfigured:jxe,gettingStarted:_xe,setupModal:Ixe,helpGuide:Rxe,search:Lxe,filters:Dxe,sort:Oxe,views:Mxe,kanban:Pxe,buttons:Fxe,prd:zxe,statuses:Bxe,priorities:$xe,noMatchingTasks:Uxe},Hxe=()=>{try{const e=localStorage.getItem("userLanguage");return e&&vh.some(t=>t.value===e)?e:"en"}catch{return"en"}};Sr.use(rj).use(C_).init({resources:{en:{common:Aie,settings:Jie,auth:rse,sidebar:xse,chat:Gse,codeEditor:Zse,tasks:uoe},ko:{common:Coe,settings:Koe,auth:Joe,sidebar:ple,chat:Ole,codeEditor:Ule},"zh-CN":{common:nce,settings:Nce,auth:jce,sidebar:Hce,chat:mde,codeEditor:vde},ja:{common:Ode,settings:nue,auth:oue,sidebar:wue,chat:Uue,codeEditor:Yue,tasks:dpe},ru:{common:Epe,settings:Vpe,auth:Ype,sidebar:dme,chat:Dme,codeEditor:$me,tasks:rhe},de:{common:ghe,settings:Phe,auth:$he,sidebar:rfe,chat:Cfe,codeEditor:Lfe,tasks:Kfe},tr:{common:d0e,settings:O0e,auth:z0e,sidebar:tge,chat:Cge,codeEditor:Lge,tasks:Kge},it:{common:cbe,settings:Ibe,auth:Obe,sidebar:Xbe,chat:wxe,codeEditor:Txe,tasks:Gxe}},lng:Hxe(),fallbackLng:"en",debug:!1,ns:["common","settings","auth","sidebar","chat","codeEditor","tasks"],defaultNS:"common",keySeparator:".",nsSeparator:":",saveMissing:!1,interpolation:{escapeValue:!1},react:{useSuspense:!0,bindI18n:"languageChanged",bindI18nStore:!1},detection:{order:["localStorage"],lookupLocalStorage:"userLanguage",caches:["localStorage"]}});Sr.on("languageChanged",e=>{try{localStorage.setItem("userLanguage",e)}catch(t){console.error("Failed to save language preference:",t)}});function Vxe(){return i.jsx(D_,{i18n:Sr,children:i.jsx($_,{children:i.jsx(W_,{children:i.jsx(TO,{children:i.jsx(IO,{children:i.jsx(PO,{children:i.jsx(MO,{children:i.jsx(OO,{children:i.jsx(zj,{basename:window.__ROUTER_BASENAME__||"",children:i.jsxs(Bj,{children:[i.jsx(Ru,{path:"/",element:i.jsx(Om,{})}),i.jsx(Ru,{path:"/session/:sessionId",element:i.jsx(Om,{})}),i.jsx(Ru,{path:"/orchestration",element:i.jsx(Om,{})})]})})})})})})})})})})}"serviceWorker"in navigator&&navigator.serviceWorker.register("/sw.js").catch(e=>{console.warn("Service worker registration failed:",e)});qj.createRoot(document.getElementById("root")).render(i.jsx(qr.StrictMode,{children:i.jsx(Vxe,{})}));
867
+ "Per favore aggiungi una nuova attività per implementare il caricamento delle immagini profilo utente usando Cloudinary, ricerca l'approccio migliore."`},moreExamples:"Vedi altri esempi e pattern di utilizzo →",proTips:{title:"💡 Suggerimenti pro",search:"Usa la barra di ricerca per trovare rapidamente attività specifiche",views:"Passa tra le viste Kanban, Lista e Griglia usando i selettori di vista",filters:"Usa i filtri per concentrarti su stati o priorità specifiche delle attività",details:"Clicca su qualsiasi attività per vedere informazioni dettagliate e gestire le sotto-attività"},learnMore:{title:"📚 Per saperne di più",description:"TaskMaster AI è un sistema avanzato di gestione attività pensato per sviluppatori. Trova documentazione, esempi e contribuisci al progetto.",githubButton:"Vedi su GitHub"}},Lxe={placeholder:"Cerca attività..."},Dxe={button:"Filtri",status:"Stato",priority:"Priorità",sortBy:"Ordina per",allStatuses:"Tutti gli stati",allPriorities:"Tutte le priorità",showing:"Visualizzate {{filtered}} di {{total}} attività",clearFilters:"Cancella filtri"},Oxe={id:"ID",status:"Stato",priority:"Priorità",idAsc:"ID (crescente)",idDesc:"ID (decrescente)",titleAsc:"Titolo (A-Z)",titleDesc:"Titolo (Z-A)",statusAsc:"Stato (in attesa prima)",statusDesc:"Stato (completati prima)",priorityAsc:"Priorità (alta prima)",priorityDesc:"Priorità (bassa prima)"},Mxe={kanban:"Vista Kanban",list:"Vista lista",grid:"Vista griglia"},Pxe={pending:"📋 Da fare",inProgress:"🚀 In corso",done:"✅ Completate",blocked:"🚫 Bloccate",deferred:"⏳ Rimandate",cancelled:"❌ Annullate",noTasksYet:"Nessuna attività",tasksWillAppear:"Le attività appariranno qui",moveTasksHere:"Sposta le attività qui quando iniziate",completedTasksHere:"Le attività completate appariranno qui",statusTasksHere:"Le attività con questo stato appariranno qui"},Fxe={help:"Guida introduttiva TaskMaster",prds:"PRD",addPRD:"Aggiungi PRD",addTask:"Aggiungi attività",createNewPRD:"Crea nuovo PRD",prdsAvailable:"{{count}} PRD disponibili"},zxe={modified:"Modificato: {{date}}"},Bxe={pending:"In attesa","in-progress":"In corso",done:"Completata",blocked:"Bloccata",deferred:"Rimandata",cancelled:"Annullata"},$xe={high:"Alta",medium:"Media",low:"Bassa"},Uxe={title:"Nessuna attività corrisponde ai filtri",description:"Prova a modificare la ricerca o i criteri di filtro."},Gxe={notConfigured:jxe,gettingStarted:_xe,setupModal:Ixe,helpGuide:Rxe,search:Lxe,filters:Dxe,sort:Oxe,views:Mxe,kanban:Pxe,buttons:Fxe,prd:zxe,statuses:Bxe,priorities:$xe,noMatchingTasks:Uxe},Hxe=()=>{try{const e=localStorage.getItem("userLanguage");return e&&vh.some(t=>t.value===e)?e:"en"}catch{return"en"}};Sr.use(rj).use(C_).init({resources:{en:{common:Aie,settings:Jie,auth:rse,sidebar:xse,chat:Gse,codeEditor:Zse,tasks:uoe},ko:{common:Coe,settings:Koe,auth:Joe,sidebar:ple,chat:Ole,codeEditor:Ule},"zh-CN":{common:nce,settings:Nce,auth:jce,sidebar:Hce,chat:mde,codeEditor:vde},ja:{common:Ode,settings:nue,auth:oue,sidebar:wue,chat:Uue,codeEditor:Yue,tasks:dpe},ru:{common:Epe,settings:Vpe,auth:Ype,sidebar:dme,chat:Dme,codeEditor:$me,tasks:rhe},de:{common:ghe,settings:Phe,auth:$he,sidebar:rfe,chat:Cfe,codeEditor:Lfe,tasks:Kfe},tr:{common:d0e,settings:O0e,auth:z0e,sidebar:tge,chat:Cge,codeEditor:Lge,tasks:Kge},it:{common:cbe,settings:Ibe,auth:Obe,sidebar:Xbe,chat:wxe,codeEditor:Txe,tasks:Gxe}},lng:Hxe(),fallbackLng:"en",debug:!1,ns:["common","settings","auth","sidebar","chat","codeEditor","tasks"],defaultNS:"common",keySeparator:".",nsSeparator:":",saveMissing:!1,interpolation:{escapeValue:!1},react:{useSuspense:!0,bindI18n:"languageChanged",bindI18nStore:!1},detection:{order:["localStorage"],lookupLocalStorage:"userLanguage",caches:["localStorage"]}});Sr.on("languageChanged",e=>{try{localStorage.setItem("userLanguage",e)}catch(t){console.error("Failed to save language preference:",t)}});function Vxe(){return i.jsx(D_,{i18n:Sr,children:i.jsx($_,{children:i.jsx(W_,{children:i.jsx(T9,{children:i.jsx(I9,{children:i.jsx(P9,{children:i.jsx(M9,{children:i.jsx(O9,{children:i.jsx(zj,{basename:window.__ROUTER_BASENAME__||"",children:i.jsxs(Bj,{children:[i.jsx(Ru,{path:"/",element:i.jsx(Om,{})}),i.jsx(Ru,{path:"/session/:sessionId",element:i.jsx(Om,{})}),i.jsx(Ru,{path:"/orchestration",element:i.jsx(Om,{})})]})})})})})})})})})})}"serviceWorker"in navigator&&navigator.serviceWorker.register("/sw.js").catch(e=>{console.warn("Service worker registration failed:",e)});qj.createRoot(document.getElementById("root")).render(i.jsx(qr.StrictMode,{children:i.jsx(Vxe,{})}));