@siteboon/claude-code-ui 1.15.0 → 1.16.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -411,10 +411,10 @@ import{j as a,_ as M3,a as F3,S as rs,F as vo,T as r4,P as n4,E as rn,V as ko,b
|
|
|
411
411
|
*
|
|
412
412
|
* This source code is licensed under the MIT license found in the
|
|
413
413
|
* LICENSE file in the root directory of this source tree.
|
|
414
|
-
*/var _f;function ET(){if(_f)return al;_f=1;var e=t5();function t(p,h){return p===h&&(p!==0||1/p===1/h)||p!==p&&h!==h}var r=typeof Object.is=="function"?Object.is:t,n=e.useState,i=e.useEffect,s=e.useLayoutEffect,o=e.useDebugValue;function l(p,h){var m=h(),g=n({inst:{value:m,getSnapshot:h}}),f=g[0].inst,w=g[1];return s(function(){f.value=m,f.getSnapshot=h,c(f)&&w({inst:f})},[p,m,h]),i(function(){return c(f)&&w({inst:f}),p(function(){c(f)&&w({inst:f})})},[p]),o(m),m}function c(p){var h=p.getSnapshot;p=p.value;try{var m=h();return!r(p,m)}catch{return!0}}function d(p,h){return h()}var u=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?d:l;return al.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:u,al}var Lf;function NT(){return Lf||(Lf=1,nl.exports=ET()),nl.exports}var CT=NT();const TT=(e,t)=>Ra(t)?t:mT(t)&&Ra(t.defaultValue)?t.defaultValue:Array.isArray(e)?e[e.length-1]:e,AT={t:TT,ready:!1},IT=()=>()=>{},Ht=(e,t={})=>{const{i18n:r}=t,{i18n:n,defaultNS:i}=x.useContext(F4)||{},s=r||n||kT();s&&!s.reportNamespaces&&(s.reportNamespaces=new ST),s||O4(s,"NO_I18NEXT_INSTANCE","useTranslation: You will need to pass in an i18next instance by using initReactI18next");const o=x.useMemo(()=>({...yT(),...s?.options?.react,...t}),[s,t]),{useSuspense:l,keyPrefix:c}=o,d=e||i||s?.options?.defaultNS,u=Ra(d)?[d]:d||["translation"],p=x.useMemo(()=>u,u);s?.reportNamespaces?.addUsedNamespaces?.(p);const h=x.useRef(0),m=x.useCallback(j=>{if(!s)return IT;const{bindI18n:T,bindI18nStore:P}=o,q=()=>{h.current+=1,j()};return T&&s.on(T,q),P&&s.store.on(P,q),()=>{T&&T.split(" ").forEach(D=>s.off(D,q)),P&&P.split(" ").forEach(D=>s.store.off(D,q))}},[s,o]),g=x.useRef(),f=x.useCallback(()=>{if(!s)return AT;const j=!!(s.isInitialized||s.initializedStoreOnce)&&p.every(U=>pT(U,s,o)),T=t.lng||s.language,P=h.current,q=g.current;if(q&&q.ready===j&&q.lng===T&&q.keyPrefix===c&&q.revision===P)return q;const z={t:s.getFixedT(T,o.nsMode==="fallback"?p:p[0],c),ready:j,lng:T,keyPrefix:c,revision:P};return g.current=z,z},[s,p,c,o,t.lng]),[w,S]=x.useState(0),{t:k,ready:E}=CT.useSyncExternalStore(m,f,f);x.useEffect(()=>{if(s&&!E&&!l){const j=()=>S(T=>T+1);t.lng?jf(s,t.lng,p,j):qm(s,p,j)}},[s,t.lng,p,E,l,w]);const N=s||{},C=x.useRef(null),v=x.useRef(),I=j=>{const T=Object.getOwnPropertyDescriptors(j);T.__original&&delete T.__original;const P=Object.create(Object.getPrototypeOf(j),T);if(!Object.prototype.hasOwnProperty.call(P,"__original"))try{Object.defineProperty(P,"__original",{value:j,writable:!1,enumerable:!1,configurable:!1})}catch{}return P},M=x.useMemo(()=>{const j=N,T=j?.language;let P=j;j&&(C.current&&C.current.__original===j?v.current!==T?(P=I(j),C.current=P,v.current=T):P=C.current:(P=I(j),C.current=P,v.current=T));const q=[k,P,E];return q.t=k,q.i18n=P,q.ready=E,q},[k,N,E,N.resolvedLanguage,N.language,N.languages]);if(s&&l&&!E)throw new Promise(j=>{const T=()=>j();t.lng?jf(s,t.lng,p,T):qm(s,p,T)});return M};function RT({i18n:e,defaultNS:t,children:r}){const n=x.useMemo(()=>({i18n:e,defaultNS:t}),[e,t]);return x.createElement(F4.Provider,{value:n},r)}const nn=({className:e="w-5 h-5"})=>a.jsx("img",{src:"/icons/claude-ai-icon.svg",alt:"Claude",className:e}),P4=x.createContext(),as=()=>{const e=x.useContext(P4);if(!e)throw new Error("useTheme must be used within a ThemeProvider");return e},jT=({children:e})=>{const[t,r]=x.useState(()=>{const s=localStorage.getItem("theme");return s?s==="dark":window.matchMedia?window.matchMedia("(prefers-color-scheme: dark)").matches:!1});x.useEffect(()=>{if(t){document.documentElement.classList.add("dark"),localStorage.setItem("theme","dark");const s=document.querySelector('meta[name="apple-mobile-web-app-status-bar-style"]');s&&s.setAttribute("content","black-translucent");const o=document.querySelector('meta[name="theme-color"]');o&&o.setAttribute("content","#0c1117")}else{document.documentElement.classList.remove("dark"),localStorage.setItem("theme","light");const s=document.querySelector('meta[name="apple-mobile-web-app-status-bar-style"]');s&&s.setAttribute("content","default");const o=document.querySelector('meta[name="theme-color"]');o&&o.setAttribute("content","#ffffff")}},[t]),x.useEffect(()=>{if(!window.matchMedia)return;const s=window.matchMedia("(prefers-color-scheme: dark)"),o=l=>{localStorage.getItem("theme")||r(l.matches)};return s.addEventListener("change",o),()=>s.removeEventListener("change",o)},[]);const i={isDarkMode:t,toggleDarkMode:()=>{r(s=>!s)}};return a.jsx(P4.Provider,{value:i,children:e})},pn=({className:e="w-5 h-5"})=>{const{isDarkMode:t}=as();return a.jsx("img",{src:t?"/icons/cursor-white.svg":"/icons/cursor.svg",alt:"Cursor",className:e})},wn=({className:e="w-5 h-5"})=>{const{isDarkMode:t}=as();return a.jsx("img",{src:t?"/icons/codex-white.svg":"/icons/codex.svg",alt:"Codex",className:e})},_T=({status:e="not-configured",size:t="sm",className:r="",showLabel:n=!1})=>{const s=(()=>{switch(e){case"fully-configured":return{icon:ns,color:"text-green-500 dark:text-green-400",bgColor:"bg-green-50 dark:bg-green-950",label:"TaskMaster Ready",title:"TaskMaster fully configured with MCP server"};case"taskmaster-only":return{icon:Ia,color:"text-blue-500 dark:text-blue-400",bgColor:"bg-blue-50 dark:bg-blue-950",label:"TaskMaster Init",title:"TaskMaster initialized, MCP server needs setup"};case"mcp-only":return{icon:So,color:"text-amber-500 dark:text-amber-400",bgColor:"bg-amber-50 dark:bg-amber-950",label:"MCP Ready",title:"MCP server configured, TaskMaster needs initialization"};case"not-configured":case"error":default:return{icon:Bt,color:"text-gray-400 dark:text-gray-500",bgColor:"bg-gray-50 dark:bg-gray-900",label:"No TaskMaster",title:"TaskMaster not configured"}}})(),o=s.icon,l={xs:"w-3 h-3",sm:"w-4 h-4",md:"w-5 h-5",lg:"w-6 h-6"},c={xs:"p-0.5",sm:"p-1",md:"p-1.5",lg:"p-2"};return n?a.jsxs("div",{className:Ze("inline-flex items-center gap-1.5 text-xs rounded-md px-2 py-1 transition-colors",s.bgColor,s.color,r),title:s.title,children:[a.jsx(o,{className:l[t]}),a.jsx("span",{className:"font-medium",children:s.label})]}):a.jsx("div",{className:Ze("inline-flex items-center justify-center rounded-full transition-colors",s.bgColor,c[t],r),title:s.title,children:a.jsx(o,{className:Ze(l[t],s.color)})})},Ce=(e,t={})=>{const r=localStorage.getItem("auth-token"),n={};return t.body instanceof FormData||(n["Content-Type"]="application/json"),r&&(n.Authorization=`Bearer ${r}`),fetch(e,{...t,headers:{...n,...t.headers}})},yt={auth:{status:()=>fetch("/api/auth/status"),login:(e,t)=>fetch("/api/auth/login",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({username:e,password:t})}),register:(e,t)=>fetch("/api/auth/register",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({username:e,password:t})}),user:()=>Ce("/api/auth/user"),logout:()=>Ce("/api/auth/logout",{method:"POST"})},projects:()=>Ce("/api/projects"),sessions:(e,t=5,r=0)=>Ce(`/api/projects/${e}/sessions?limit=${t}&offset=${r}`),sessionMessages:(e,t,r=null,n=0,i="claude")=>{const s=new URLSearchParams;r!==null&&(s.append("limit",r),s.append("offset",n));const o=s.toString();let l;return i==="codex"?l=`/api/codex/sessions/${t}/messages${o?`?${o}`:""}`:i==="cursor"?l=`/api/cursor/sessions/${t}/messages${o?`?${o}`:""}`:l=`/api/projects/${e}/sessions/${t}/messages${o?`?${o}`:""}`,Ce(l)},renameProject:(e,t)=>Ce(`/api/projects/${e}/rename`,{method:"PUT",body:JSON.stringify({displayName:t})}),deleteSession:(e,t)=>Ce(`/api/projects/${e}/sessions/${t}`,{method:"DELETE"}),deleteCodexSession:e=>Ce(`/api/codex/sessions/${e}`,{method:"DELETE"}),deleteProject:(e,t=!1)=>Ce(`/api/projects/${e}${t?"?force=true":""}`,{method:"DELETE"}),createProject:e=>Ce("/api/projects/create",{method:"POST",body:JSON.stringify({path:e})}),createWorkspace:e=>Ce("/api/projects/create-workspace",{method:"POST",body:JSON.stringify(e)}),readFile:(e,t)=>Ce(`/api/projects/${e}/file?filePath=${encodeURIComponent(t)}`),saveFile:(e,t,r)=>Ce(`/api/projects/${e}/file`,{method:"PUT",body:JSON.stringify({filePath:t,content:r})}),getFiles:e=>Ce(`/api/projects/${e}/files`),transcribe:e=>Ce("/api/transcribe",{method:"POST",body:e,headers:{}}),taskmaster:{init:e=>Ce(`/api/taskmaster/init/${e}`,{method:"POST"}),addTask:(e,{prompt:t,title:r,description:n,priority:i,dependencies:s})=>Ce(`/api/taskmaster/add-task/${e}`,{method:"POST",body:JSON.stringify({prompt:t,title:r,description:n,priority:i,dependencies:s})}),parsePRD:(e,{fileName:t,numTasks:r,append:n})=>Ce(`/api/taskmaster/parse-prd/${e}`,{method:"POST",body:JSON.stringify({fileName:t,numTasks:r,append:n})}),getTemplates:()=>Ce("/api/taskmaster/prd-templates"),applyTemplate:(e,{templateId:t,fileName:r,customizations:n})=>Ce(`/api/taskmaster/apply-template/${e}`,{method:"POST",body:JSON.stringify({templateId:t,fileName:r,customizations:n})}),updateTask:(e,t,r)=>Ce(`/api/taskmaster/update-task/${e}/${t}`,{method:"PUT",body:JSON.stringify(r)})},browseFilesystem:(e=null)=>{const t=new URLSearchParams;return e&&t.append("path",e),Ce(`/api/browse-filesystem?${t}`)},createFolder:e=>Ce("/api/create-folder",{method:"POST",body:JSON.stringify({path:e})}),user:{gitConfig:()=>Ce("/api/user/git-config"),updateGitConfig:(e,t)=>Ce("/api/user/git-config",{method:"POST",body:JSON.stringify({gitName:e,gitEmail:t})}),onboardingStatus:()=>Ce("/api/user/onboarding-status"),completeOnboarding:()=>Ce("/api/user/complete-onboarding",{method:"POST"})},get:e=>Ce(`/api${e}`)},LT=({onClose:e,onProjectCreated:t})=>{const{t:r}=Ht(),[n,i]=x.useState(1),[s,o]=x.useState("existing"),[l,c]=x.useState(""),[d,u]=x.useState(""),[p,h]=x.useState(""),[m,g]=x.useState("stored"),[f,w]=x.useState(""),[S,k]=x.useState(!1),[E,N]=x.useState(null),[C,v]=x.useState([]),[I,M]=x.useState(!1),[j,T]=x.useState([]),[P,q]=x.useState(!1),[D,z]=x.useState(!1),[U,G]=x.useState("~"),[re,K]=x.useState([]),[ue,R]=x.useState(!1),[F,te]=x.useState(!1),[_,Z]=x.useState(!1),[me,ke]=x.useState(""),[se,_e]=x.useState(!1),[oe,fe]=x.useState("");x.useEffect(()=>{n===2&&s==="new"&&d&&Ie()},[n,s,d]),x.useEffect(()=>{l.length>2?qe(l):(T([]),q(!1))},[l]);const Ie=async()=>{try{M(!0);const de=((await(await yt.get("/settings/credentials?type=github_token")).json()).credentials||[]).filter(Ee=>Ee.is_active);v(de),de.length>0&&!p&&h(de[0].id.toString())}catch(xe){console.error("Error loading GitHub tokens:",xe)}finally{M(!1)}},qe=async xe=>{try{const at=xe.lastIndexOf("/"),de=at>0?xe.substring(0,at):"~",H=await(await yt.browseFilesystem(de)).json();if(H.suggestions){const Y=H.suggestions.filter(le=>le.path.toLowerCase().startsWith(xe.toLowerCase())&&le.path.toLowerCase()!==xe.toLowerCase());T(Y.slice(0,5)),q(Y.length>0)}}catch(at){console.error("Error loading path suggestions:",at)}},ze=()=>{if(N(null),n===1){if(!s){N(r("projectWizard.errors.selectType"));return}i(2)}else if(n===2){if(!l.trim()){N(r("projectWizard.errors.providePath"));return}i(3)}},ct=()=>{N(null),i(n-1)},Ye=async()=>{k(!0),N(null),fe("");try{if(s==="new"&&d){const Ee=new URLSearchParams({path:l.trim(),githubUrl:d.trim()});m==="stored"&&p?Ee.append("githubTokenId",p):m==="new"&&f&&Ee.append("newGithubToken",f.trim());const H=localStorage.getItem("auth-token"),Y=`/api/projects/clone-progress?${Ee}${H?`&token=${H}`:""}`;await new Promise((le,ve)=>{const Ve=new EventSource(Y);Ve.onmessage=It=>{try{const ft=JSON.parse(It.data);ft.type==="progress"?fe(ft.message):ft.type==="complete"?(Ve.close(),t&&t(ft.project),e(),le()):ft.type==="error"&&(Ve.close(),ve(new Error(ft.message)))}catch(ft){console.error("Error parsing SSE event:",ft)}},Ve.onerror=()=>{Ve.close(),ve(new Error("Connection lost during clone"))}});return}const xe={workspaceType:s,path:l.trim()},at=await yt.createWorkspace(xe),de=await at.json();if(!at.ok)throw new Error(de.error||r("projectWizard.errors.failedToCreate"));t&&t(de.project),e()}catch(xe){console.error("Error creating workspace:",xe),N(xe.message||r("projectWizard.errors.failedToCreate"))}finally{k(!1)}},wt=xe=>{c(xe.path),q(!1)},gt=async()=>{z(!0),await et("~")},et=async xe=>{try{R(!0);const de=await(await yt.browseFilesystem(xe)).json();G(de.path||xe),K(de.suggestions||[])}catch(at){console.error("Error loading folders:",at)}finally{R(!1)}},Me=(xe,at=!1)=>{c(xe),z(!1),at&&i(3)},mt=async xe=>{await et(xe)},Pt=async()=>{if(me.trim()){_e(!0),N(null);try{const xe=U.includes("\\")?"\\":"/",at=`${U}${xe}${me.trim()}`,de=await yt.createFolder(at),Ee=await de.json();if(!de.ok)throw new Error(Ee.error||r("projectWizard.errors.failedToCreateFolder","Failed to create folder"));ke(""),Z(!1),await et(Ee.path||at)}catch(xe){console.error("Error creating folder:",xe),N(xe.message||r("projectWizard.errors.failedToCreateFolder","Failed to create folder"))}finally{_e(!1)}}};return a.jsxs("div",{className:"fixed top-0 left-0 right-0 bottom-0 bg-black/50 backdrop-blur-sm flex items-center justify-center z-[60] p-0 sm:p-4",children:[a.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-none sm:rounded-lg shadow-xl w-full h-full sm:h-auto sm:max-w-2xl border-0 sm:border border-gray-200 dark:border-gray-700 overflow-y-auto",children:[a.jsxs("div",{className:"flex items-center justify-between p-6 border-b border-gray-200 dark:border-gray-700",children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("div",{className:"w-8 h-8 bg-blue-100 dark:bg-blue-900/50 rounded-lg flex items-center justify-center",children:a.jsx(Pi,{className:"w-4 h-4 text-blue-600 dark:text-blue-400"})}),a.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white",children:r("projectWizard.title")})]}),a.jsx("button",{onClick:e,className:"p-2 text-gray-400 hover:text-gray-600 dark:hover:text-gray-300 rounded-md hover:bg-gray-100 dark:hover:bg-gray-700",disabled:S,children:a.jsx(Bt,{className:"w-5 h-5"})})]}),a.jsx("div",{className:"px-6 pt-4 pb-2",children:a.jsx("div",{className:"flex items-center justify-between",children:[1,2,3].map(xe=>a.jsxs(ir.Fragment,{children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("div",{className:`w-8 h-8 rounded-full flex items-center justify-center font-medium text-sm ${xe<n?"bg-green-500 text-white":xe===n?"bg-blue-500 text-white":"bg-gray-200 dark:bg-gray-700 text-gray-500"}`,children:xe<n?a.jsx(Cr,{className:"w-4 h-4"}):xe}),a.jsx("span",{className:"text-sm font-medium text-gray-700 dark:text-gray-300 hidden sm:inline",children:r(xe===1?"projectWizard.steps.type":xe===2?"projectWizard.steps.configure":"projectWizard.steps.confirm")})]}),xe<3&&a.jsx("div",{className:`flex-1 h-1 mx-2 rounded ${xe<n?"bg-green-500":"bg-gray-200 dark:bg-gray-700"}`})]},xe))})}),a.jsxs("div",{className:"p-6 space-y-6 min-h-[300px]",children:[E&&a.jsxs("div",{className:"bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800 rounded-lg p-4 flex items-start gap-3",children:[a.jsx(So,{className:"w-5 h-5 text-red-600 dark:text-red-400 flex-shrink-0 mt-0.5"}),a.jsx("div",{className:"flex-1",children:a.jsx("p",{className:"text-sm text-red-800 dark:text-red-200",children:E})})]}),n===1&&a.jsx("div",{className:"space-y-4",children:a.jsxs("div",{children:[a.jsx("h4",{className:"text-sm font-medium text-gray-700 dark:text-gray-300 mb-3",children:r("projectWizard.step1.question")}),a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[a.jsx("button",{onClick:()=>o("existing"),className:`p-4 border-2 rounded-lg text-left transition-all ${s==="existing"?"border-blue-500 bg-blue-50 dark:bg-blue-900/20":"border-gray-200 dark:border-gray-700 hover:border-gray-300 dark:hover:border-gray-600"}`,children:a.jsxs("div",{className:"flex items-start gap-3",children:[a.jsx("div",{className:"w-10 h-10 bg-green-100 dark:bg-green-900/50 rounded-lg flex items-center justify-center flex-shrink-0",children:a.jsx(Pi,{className:"w-5 h-5 text-green-600 dark:text-green-400"})}),a.jsxs("div",{className:"flex-1",children:[a.jsx("h5",{className:"font-semibold text-gray-900 dark:text-white mb-1",children:r("projectWizard.step1.existing.title")}),a.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400",children:r("projectWizard.step1.existing.description")})]})]})}),a.jsx("button",{onClick:()=>o("new"),className:`p-4 border-2 rounded-lg text-left transition-all ${s==="new"?"border-blue-500 bg-blue-50 dark:bg-blue-900/20":"border-gray-200 dark:border-gray-700 hover:border-gray-300 dark:hover:border-gray-600"}`,children:a.jsxs("div",{className:"flex items-start gap-3",children:[a.jsx("div",{className:"w-10 h-10 bg-purple-100 dark:bg-purple-900/50 rounded-lg flex items-center justify-center flex-shrink-0",children:a.jsx(qn,{className:"w-5 h-5 text-purple-600 dark:text-purple-400"})}),a.jsxs("div",{className:"flex-1",children:[a.jsx("h5",{className:"font-semibold text-gray-900 dark:text-white mb-1",children:r("projectWizard.step1.new.title")}),a.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400",children:r("projectWizard.step1.new.description")})]})]})})]})]})}),n===2&&a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{children:[a.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:r(s==="existing"?"projectWizard.step2.existingPath":"projectWizard.step2.newPath")}),a.jsxs("div",{className:"relative flex gap-2",children:[a.jsxs("div",{className:"flex-1 relative",children:[a.jsx(tr,{type:"text",value:l,onChange:xe=>c(xe.target.value),placeholder:s==="existing"?"/path/to/existing/workspace":"/path/to/new/workspace",className:"w-full"}),P&&j.length>0&&a.jsx("div",{className:"absolute z-10 w-full mt-1 bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg shadow-lg max-h-60 overflow-y-auto",children:j.map((xe,at)=>a.jsxs("button",{onClick:()=>wt(xe),className:"w-full px-4 py-2 text-left hover:bg-gray-100 dark:hover:bg-gray-700 text-sm",children:[a.jsx("div",{className:"font-medium text-gray-900 dark:text-white",children:xe.name}),a.jsx("div",{className:"text-xs text-gray-500 dark:text-gray-400",children:xe.path})]},at))})]}),a.jsx(Be,{type:"button",variant:"outline",onClick:gt,className:"px-3",title:"Browse folders",children:a.jsx(Tn,{className:"w-4 h-4"})})]}),a.jsx("p",{className:"mt-1 text-xs text-gray-500 dark:text-gray-400",children:r(s==="existing"?"projectWizard.step2.existingHelp":"projectWizard.step2.newHelp")})]}),s==="new"&&a.jsxs(a.Fragment,{children:[a.jsxs("div",{children:[a.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:r("projectWizard.step2.githubUrl")}),a.jsx(tr,{type:"text",value:d,onChange:xe=>u(xe.target.value),placeholder:"https://github.com/username/repository",className:"w-full"}),a.jsx("p",{className:"mt-1 text-xs text-gray-500 dark:text-gray-400",children:r("projectWizard.step2.githubHelp")})]}),d&&!d.startsWith("git@")&&!d.startsWith("ssh://")&&a.jsxs("div",{className:"bg-gray-50 dark:bg-gray-900/50 rounded-lg p-4 border border-gray-200 dark:border-gray-700",children:[a.jsxs("div",{className:"flex items-start gap-3 mb-4",children:[a.jsx(Fh,{className:"w-5 h-5 text-gray-600 dark:text-gray-400 flex-shrink-0 mt-0.5"}),a.jsxs("div",{className:"flex-1",children:[a.jsx("h5",{className:"font-medium text-gray-900 dark:text-white mb-1",children:r("projectWizard.step2.githubAuth")}),a.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400",children:r("projectWizard.step2.githubAuthHelp")})]})]}),I?a.jsxs("div",{className:"flex items-center gap-2 text-sm text-gray-500",children:[a.jsx(Ta,{className:"w-4 h-4 animate-spin"}),r("projectWizard.step2.loadingTokens")]}):C.length>0?a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"grid grid-cols-3 gap-2 mb-4",children:[a.jsx("button",{onClick:()=>g("stored"),className:`px-3 py-2 text-sm font-medium rounded-lg transition-colors ${m==="stored"?"bg-blue-500 text-white":"bg-gray-200 dark:bg-gray-700 text-gray-700 dark:text-gray-300"}`,children:r("projectWizard.step2.storedToken")}),a.jsx("button",{onClick:()=>g("new"),className:`px-3 py-2 text-sm font-medium rounded-lg transition-colors ${m==="new"?"bg-blue-500 text-white":"bg-gray-200 dark:bg-gray-700 text-gray-700 dark:text-gray-300"}`,children:r("projectWizard.step2.newToken")}),a.jsx("button",{onClick:()=>{g("none"),h(""),w("")},className:`px-3 py-2 text-sm font-medium rounded-lg transition-colors ${m==="none"?"bg-green-500 text-white":"bg-gray-200 dark:bg-gray-700 text-gray-700 dark:text-gray-300"}`,children:r("projectWizard.step2.nonePublic")})]}),m==="stored"?a.jsxs("div",{children:[a.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:r("projectWizard.step2.selectToken")}),a.jsxs("select",{value:p,onChange:xe=>h(xe.target.value),className:"w-full px-3 py-2 bg-white dark:bg-gray-800 border border-gray-300 dark:border-gray-600 rounded-lg text-sm",children:[a.jsx("option",{value:"",children:r("projectWizard.step2.selectTokenPlaceholder")}),C.map(xe=>a.jsx("option",{value:xe.id,children:xe.credential_name},xe.id))]})]}):m==="new"?a.jsxs("div",{children:[a.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:r("projectWizard.step2.newToken")}),a.jsx(tr,{type:"password",value:f,onChange:xe=>w(xe.target.value),placeholder:"ghp_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",className:"w-full"}),a.jsx("p",{className:"mt-1 text-xs text-gray-500 dark:text-gray-400",children:r("projectWizard.step2.tokenHelp")})]}):null]}):a.jsxs("div",{className:"space-y-4",children:[a.jsx("div",{className:"bg-blue-50 dark:bg-blue-900/20 rounded-lg p-3 border border-blue-200 dark:border-blue-800",children:a.jsx("p",{className:"text-sm text-blue-800 dark:text-blue-200",children:r("projectWizard.step2.publicRepoInfo")})}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:r("projectWizard.step2.optionalTokenPublic")}),a.jsx(tr,{type:"password",value:f,onChange:xe=>w(xe.target.value),placeholder:r("projectWizard.step2.tokenPublicPlaceholder"),className:"w-full"}),a.jsx("p",{className:"mt-1 text-xs text-gray-500 dark:text-gray-400",children:r("projectWizard.step2.noTokensHelp")})]})]})]})]})]}),n===3&&a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"bg-gray-50 dark:bg-gray-900/50 rounded-lg p-4 border border-gray-200 dark:border-gray-700",children:[a.jsx("h4",{className:"text-sm font-semibold text-gray-900 dark:text-white mb-3",children:r("projectWizard.step3.reviewConfig")}),a.jsxs("div",{className:"space-y-2",children:[a.jsxs("div",{className:"flex justify-between text-sm",children:[a.jsx("span",{className:"text-gray-600 dark:text-gray-400",children:r("projectWizard.step3.workspaceType")}),a.jsx("span",{className:"font-medium text-gray-900 dark:text-white",children:r(s==="existing"?"projectWizard.step3.existingWorkspace":"projectWizard.step3.newWorkspace")})]}),a.jsxs("div",{className:"flex justify-between text-sm",children:[a.jsx("span",{className:"text-gray-600 dark:text-gray-400",children:r("projectWizard.step3.path")}),a.jsx("span",{className:"font-mono text-xs text-gray-900 dark:text-white break-all",children:l})]}),s==="new"&&d&&a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"flex justify-between text-sm",children:[a.jsx("span",{className:"text-gray-600 dark:text-gray-400",children:r("projectWizard.step3.cloneFrom")}),a.jsx("span",{className:"font-mono text-xs text-gray-900 dark:text-white break-all",children:d})]}),a.jsxs("div",{className:"flex justify-between text-sm",children:[a.jsx("span",{className:"text-gray-600 dark:text-gray-400",children:r("projectWizard.step3.authentication")}),a.jsx("span",{className:"text-xs text-gray-900 dark:text-white",children:m==="stored"&&p?`${r("projectWizard.step3.usingStoredToken")} ${C.find(xe=>xe.id.toString()===p)?.credential_name||"Unknown"}`:m==="new"&&f?r("projectWizard.step3.usingProvidedToken"):d.startsWith("git@")||d.startsWith("ssh://")?r("projectWizard.step3.sshKey","SSH Key"):r("projectWizard.step3.noAuthentication")})]})]})]})]}),a.jsx("div",{className:"bg-blue-50 dark:bg-blue-900/20 rounded-lg p-4 border border-blue-200 dark:border-blue-800",children:S&&oe?a.jsxs("div",{className:"space-y-2",children:[a.jsx("p",{className:"text-sm font-medium text-blue-800 dark:text-blue-200",children:r("projectWizard.step3.cloningRepository","Cloning repository...")}),a.jsx("code",{className:"block text-xs font-mono text-blue-700 dark:text-blue-300 whitespace-pre-wrap break-all",children:oe})]}):a.jsx("p",{className:"text-sm text-blue-800 dark:text-blue-200",children:r(s==="existing"?"projectWizard.step3.existingInfo":d?"projectWizard.step3.newWithClone":"projectWizard.step3.newEmpty")})})]})]}),a.jsxs("div",{className:"flex items-center justify-between p-6 border-t border-gray-200 dark:border-gray-700",children:[a.jsx(Be,{variant:"outline",onClick:n===1?e:ct,disabled:S,children:n===1?r("projectWizard.buttons.cancel"):a.jsxs(a.Fragment,{children:[a.jsx(Mh,{className:"w-4 h-4 mr-1"}),r("projectWizard.buttons.back")]})}),a.jsx(Be,{onClick:n===3?Ye:ze,disabled:S||n===1&&!s,children:S?a.jsxs(a.Fragment,{children:[a.jsx(Ta,{className:"w-4 h-4 mr-2 animate-spin"}),d?r("projectWizard.buttons.cloning","Cloning..."):r("projectWizard.buttons.creating")]}):n===3?a.jsxs(a.Fragment,{children:[a.jsx(Cr,{className:"w-4 h-4 mr-1"}),r("projectWizard.buttons.createProject")]}):a.jsxs(a.Fragment,{children:[r("projectWizard.buttons.next"),a.jsx(Cn,{className:"w-4 h-4 ml-1"})]})})]})]}),D&&a.jsx("div",{className:"fixed inset-0 bg-black/50 backdrop-blur-sm flex items-center justify-center z-[70] p-4",children:a.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow-xl w-full max-w-2xl max-h-[80vh] border border-gray-200 dark:border-gray-700 flex flex-col",children:[a.jsxs("div",{className:"flex items-center justify-between p-4 border-b border-gray-200 dark:border-gray-700",children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("div",{className:"w-8 h-8 bg-blue-100 dark:bg-blue-900/50 rounded-lg flex items-center justify-center",children:a.jsx(Tn,{className:"w-4 h-4 text-blue-600 dark:text-blue-400"})}),a.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white",children:"Select Folder"})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("button",{onClick:()=>te(!F),className:`p-2 rounded-md transition-colors ${F?"text-blue-600 dark:text-blue-400 bg-blue-50 dark:bg-blue-900/30":"text-gray-400 hover:text-gray-600 dark:hover:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700"}`,title:F?"Hide hidden folders":"Show hidden folders",children:F?a.jsx(hi,{className:"w-5 h-5"}):a.jsx(p4,{className:"w-5 h-5"})}),a.jsx("button",{onClick:()=>Z(!_),className:`p-2 rounded-md transition-colors ${_?"text-blue-600 dark:text-blue-400 bg-blue-50 dark:bg-blue-900/30":"text-gray-400 hover:text-gray-600 dark:hover:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700"}`,title:"Create new folder",children:a.jsx(gr,{className:"w-5 h-5"})}),a.jsx("button",{onClick:()=>z(!1),className:"p-2 text-gray-400 hover:text-gray-600 dark:hover:text-gray-300 rounded-md hover:bg-gray-100 dark:hover:bg-gray-700",children:a.jsx(Bt,{className:"w-5 h-5"})})]})]}),_&&a.jsx("div",{className:"px-4 py-3 border-b border-gray-200 dark:border-gray-700 bg-blue-50 dark:bg-blue-900/20",children:a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(tr,{type:"text",value:me,onChange:xe=>ke(xe.target.value),placeholder:"New folder name",className:"flex-1",onKeyDown:xe=>{xe.key==="Enter"&&Pt(),xe.key==="Escape"&&(Z(!1),ke(""))},autoFocus:!0}),a.jsx(Be,{size:"sm",onClick:Pt,disabled:!me.trim()||se,children:se?a.jsx(Ta,{className:"w-4 h-4 animate-spin"}):"Create"}),a.jsx(Be,{size:"sm",variant:"ghost",onClick:()=>{Z(!1),ke("")},children:"Cancel"})]})}),a.jsx("div",{className:"flex-1 overflow-y-auto p-4",children:ue?a.jsx("div",{className:"flex items-center justify-center py-8",children:a.jsx(Ta,{className:"w-6 h-6 animate-spin text-gray-400"})}):a.jsxs("div",{className:"space-y-1",children:[U!=="~"&&U!=="/"&&!/^[A-Za-z]:\\?$/.test(U)&&a.jsxs("button",{onClick:()=>{const xe=Math.max(U.lastIndexOf("/"),U.lastIndexOf("\\"));let at;xe<=0?at="/":xe===2&&/^[A-Za-z]:/.test(U)?at=U.substring(0,3):at=U.substring(0,xe),mt(at)},className:"w-full px-4 py-3 text-left hover:bg-gray-100 dark:hover:bg-gray-700 rounded-lg flex items-center gap-3",children:[a.jsx(Tn,{className:"w-5 h-5 text-gray-400"}),a.jsx("span",{className:"font-medium text-gray-700 dark:text-gray-300",children:".."})]}),re.length===0?a.jsx("div",{className:"text-center py-8 text-gray-500 dark:text-gray-400",children:"No subfolders found"}):re.filter(xe=>F||!xe.name.startsWith(".")).sort((xe,at)=>xe.name.toLowerCase().localeCompare(at.name.toLowerCase())).map((xe,at)=>a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsxs("button",{onClick:()=>mt(xe.path),className:"flex-1 px-4 py-3 text-left hover:bg-gray-100 dark:hover:bg-gray-700 rounded-lg flex items-center gap-3",children:[a.jsx(Pi,{className:"w-5 h-5 text-blue-500"}),a.jsx("span",{className:"font-medium text-gray-900 dark:text-white",children:xe.name})]}),a.jsx(Be,{variant:"ghost",size:"sm",onClick:()=>Me(xe.path,s==="existing"),className:"text-xs px-3",children:"Select"})]},at))]})}),a.jsxs("div",{className:"border-t border-gray-200 dark:border-gray-700",children:[a.jsxs("div",{className:"px-4 py-3 bg-gray-50 dark:bg-gray-900/50 flex items-center gap-2",children:[a.jsx("span",{className:"text-sm text-gray-600 dark:text-gray-400",children:"Path:"}),a.jsx("code",{className:"text-sm font-mono text-gray-900 dark:text-white flex-1 truncate",children:U})]}),a.jsxs("div",{className:"flex items-center justify-end gap-2 p-4",children:[a.jsx(Be,{variant:"outline",onClick:()=>{z(!1),Z(!1),ke("")},children:"Cancel"}),a.jsx(Be,{variant:"outline",onClick:()=>Me(U,s==="existing"),children:"Use this folder"})]})]})]})})]})},B4=x.createContext({user:null,token:null,login:()=>{},register:()=>{},logout:()=>{},isLoading:!0,needsSetup:!1,hasCompletedOnboarding:!0,refreshOnboardingStatus:()=>{},error:null}),is=()=>{const e=x.useContext(B4);if(!e)throw new Error("useAuth must be used within an AuthProvider");return e},OT=({children:e})=>{const[t,r]=x.useState(null),[n,i]=x.useState(localStorage.getItem("auth-token")),[s,o]=x.useState(!0),[l,c]=x.useState(!1),[d,u]=x.useState(!0),[p,h]=x.useState(null);x.useEffect(()=>{f()},[]);const m=async()=>{try{const N=await yt.user.onboardingStatus();if(N.ok){const C=await N.json();u(C.hasCompletedOnboarding)}}catch(N){console.error("Error checking onboarding status:",N),u(!0)}},g=async()=>{await m()},f=async()=>{try{if(o(!0),h(null),(await(await yt.auth.status()).json()).needsSetup){c(!0),o(!1);return}if(n)try{const v=await yt.auth.user();if(v.ok){const I=await v.json();r(I.user),c(!1),await m()}else localStorage.removeItem("auth-token"),i(null),r(null)}catch(v){console.error("Token verification failed:",v),localStorage.removeItem("auth-token"),i(null),r(null)}}catch(N){console.error("[AuthContext] Auth status check failed:",N),h("Failed to check authentication status")}finally{o(!1)}},E={user:t,token:n,login:async(N,C)=>{try{h(null);const v=await yt.auth.login(N,C),I=await v.json();return v.ok?(i(I.token),r(I.user),localStorage.setItem("auth-token",I.token),{success:!0}):(h(I.error||"Login failed"),{success:!1,error:I.error||"Login failed"})}catch(v){console.error("Login error:",v);const I="Network error. Please try again.";return h(I),{success:!1,error:I}}},register:async(N,C)=>{try{h(null);const v=await yt.auth.register(N,C),I=await v.json();return v.ok?(i(I.token),r(I.user),c(!1),localStorage.setItem("auth-token",I.token),{success:!0}):(h(I.error||"Registration failed"),{success:!1,error:I.error||"Registration failed"})}catch(v){console.error("Registration error:",v);const I="Network error. Please try again.";return h(I),{success:!1,error:I}}},logout:()=>{i(null),r(null),localStorage.removeItem("auth-token"),n&&yt.auth.logout().catch(N=>{console.error("Logout endpoint error:",N)})},isLoading:s,needsSetup:l,hasCompletedOnboarding:d,refreshOnboardingStatus:g,error:p};return a.jsx(B4.Provider,{value:E,children:e})};function DT(){const[e,t]=x.useState(null),[r,n]=x.useState([]),[i,s]=x.useState(!1),o=x.useRef(null);x.useEffect(()=>(l(),()=>{o.current&&clearTimeout(o.current),e&&e.close()}),[]);const l=async()=>{try{let u;{const h=localStorage.getItem("auth-token");if(!h){console.warn("No authentication token found for WebSocket connection");return}u=`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}/ws?token=${encodeURIComponent(h)}`}const p=new WebSocket(u);p.onopen=()=>{s(!0),t(p)},p.onmessage=h=>{try{const m=JSON.parse(h.data);n(g=>[...g,m])}catch(m){console.error("Error parsing WebSocket message:",m)}},p.onclose=()=>{s(!1),t(null),o.current=setTimeout(()=>{l()},3e3)},p.onerror=h=>{console.error("WebSocket error:",h)}}catch(d){console.error("Error creating WebSocket connection:",d)}};return{ws:e,sendMessage:d=>{e&&i?e.send(JSON.stringify(d)):console.warn("WebSocket not connected")},messages:r,isConnected:i}}const z4=x.createContext({ws:null,sendMessage:()=>{},messages:[],isConnected:!1}),U4=()=>{const e=x.useContext(z4);if(!e)throw new Error("useWebSocketContext must be used within a WebSocketProvider");return e},MT=({children:e})=>{const t=DT();return a.jsx(z4.Provider,{value:t,children:e})},$4=x.createContext({projects:[],currentProject:null,projectTaskMaster:null,mcpServerStatus:null,tasks:[],nextTask:null,isLoading:!1,isLoadingTasks:!1,isLoadingMCP:!1,error:null,refreshProjects:()=>{},setCurrentProject:()=>{},refreshTasks:()=>{},refreshMCPStatus:()=>{},clearError:()=>{}}),ss=()=>{const e=x.useContext($4);if(!e)throw new Error("useTaskMaster must be used within a TaskMasterProvider");return e},FT=({children:e})=>{const{messages:t}=U4(),{user:r,token:n,isLoading:i}=is(),[s,o]=x.useState([]),[l,c]=x.useState(null),[d,u]=x.useState(null),[p,h]=x.useState(null),[m,g]=x.useState([]),[f,w]=x.useState(null),[S,k]=x.useState(!1),[E,N]=x.useState(!1),[C,v]=x.useState(!1),[I,M]=x.useState(null),j=(G,re)=>{console.error(`TaskMaster ${re} error:`,G),M({message:G.message||`Failed to ${re}`,context:re,timestamp:new Date().toISOString()})},T=x.useCallback(()=>{M(null)},[]),P=x.useCallback(async()=>{if(!r||!n){o([]),c(null);return}try{k(!0),T();const G=await yt.get("/projects");if(!G.ok)throw new Error(`Failed to fetch projects: ${G.status}`);const re=await G.json();if(!Array.isArray(re)){console.error("Projects API returned non-array data:",re),o([]);return}const K=re.map(ue=>({...ue,taskMasterConfigured:ue.taskmaster?.hasTaskmaster||!1,taskMasterStatus:ue.taskmaster?.status||"not-configured",taskCount:ue.taskmaster?.metadata?.taskCount||0,completedCount:ue.taskmaster?.metadata?.completed||0}));if(o(K),l){const ue=K.find(R=>R.name===l.name);ue&&(c(ue),u(ue.taskmaster))}}catch(G){j(G,"load projects")}finally{k(!1)}},[r,n]),q=x.useCallback(async G=>{try{c(G),g([]),w(null),u(G?.taskmaster||null)}catch(re){console.error("Error in setCurrentProject:",re),j(re,"set current project"),u(G?.taskmaster||null)}},[]),D=x.useCallback(async()=>{if(!r||!n){h(null);return}try{v(!0),T();const G=await yt.get("/mcp-utils/taskmaster-server");h(G)}catch(G){j(G,"check MCP server status")}finally{v(!1)}},[r,n]),z=x.useCallback(async()=>{if(!l){g([]),w(null);return}if(!r||!n){g([]),w(null);return}try{N(!0),T();const G=await yt.get(`/taskmaster/tasks/${encodeURIComponent(l.name)}`);if(!G.ok){const ue=await G.json();throw new Error(ue.message||"Failed to load tasks")}const re=await G.json();g(re.tasks||[]);const K=re.tasks?.find(ue=>ue.status==="pending"||ue.status==="in-progress")||null;w(K)}catch(G){console.error("Error loading tasks:",G),j(G,"load tasks"),g([]),w(null)}finally{N(!1)}},[l,r,n]);x.useEffect(()=>{!i&&r&&n?(P(),D()):console.log("Auth not ready or no user, skipping project load:",{authLoading:i,user:!!r,token:!!n})},[P,D,i,r,n]),x.useEffect(()=>{r&&n&&T()},[r,n,T]),x.useEffect(()=>{l?.name&&r&&n&&z()},[l?.name,r,n,z]),x.useEffect(()=>{const G=t[t.length-1];if(G)switch(G.type){case"taskmaster-project-updated":G.projectName&&P();break;case"taskmaster-tasks-updated":G.projectName===l?.name&&z();break;case"taskmaster-mcp-status-changed":D();break}},[t,P,z,D,l]);const U={projects:s,currentProject:l,projectTaskMaster:d,mcpServerStatus:p,tasks:m,nextTask:f,isLoading:S,isLoadingTasks:E,isLoadingMCP:C,error:I,refreshProjects:P,setCurrentProject:q,refreshTasks:z,refreshMCPStatus:D,clearError:T};return a.jsx($4.Provider,{value:U,children:e})},q4=x.createContext({tasksEnabled:!0,setTasksEnabled:()=>{},toggleTasksEnabled:()=>{},isTaskMasterInstalled:null,isTaskMasterReady:null,installationStatus:null,isCheckingInstallation:!0}),os=()=>{const e=x.useContext(q4);if(!e)throw new Error("useTasksSettings must be used within a TasksSettingsProvider");return e},PT=({children:e})=>{const[t,r]=x.useState(()=>{const m=localStorage.getItem("tasks-enabled");return m!==null?JSON.parse(m):!0}),[n,i]=x.useState(null),[s,o]=x.useState(null),[l,c]=x.useState(null),[d,u]=x.useState(!0);x.useEffect(()=>{localStorage.setItem("tasks-enabled",JSON.stringify(t))},[t]),x.useEffect(()=>{setTimeout(async()=>{try{const g=await yt.get("/taskmaster/installation-status");if(g.ok){const f=await g.json();c(f),i(f.installation?.isInstalled||!1),o(f.isReady||!1);const w=localStorage.getItem("tasks-enabled");!f.installation?.isInstalled&&!w&&r(!1)}else console.error("Failed to check TaskMaster installation status"),i(!1),o(!1)}catch(g){console.error("Error checking TaskMaster installation:",g),i(!1),o(!1)}finally{u(!1)}},0)},[]);const h={tasksEnabled:t,setTasksEnabled:r,toggleTasksEnabled:()=>{r(m=>!m)},isTaskMasterInstalled:n,isTaskMasterReady:s,installationStatus:l,isCheckingInstallation:d};return a.jsx(q4.Provider,{value:h,children:e})},Of=(e,t,r)=>{const n=new Date(e),i=t;if(isNaN(n.getTime()))return r?r("status.unknown"):"Unknown";const s=i-n,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 Df({projects:e,selectedProject:t,selectedSession:r,onProjectSelect:n,onSessionSelect:i,onNewSession:s,onSessionDelete:o,onProjectDelete:l,isLoading:c,loadingProgress:d,onRefresh:u,onShowSettings:p,updateAvailable:h,latestVersion:m,currentVersion:g,releaseInfo:f,onShowVersionModal:w,isPWA:S,isMobile:k,onToggleSidebar:E}){const{t:N}=Ht("sidebar"),[C,v]=x.useState(new Set),[I,M]=x.useState(null),[j,T]=x.useState(!1),[P,q]=x.useState(""),[D,z]=x.useState({}),[U,G]=x.useState({}),[re,K]=x.useState(new Set),[ue,R]=x.useState(new Date),[F,te]=x.useState("name"),[_,Z]=x.useState(!1),[me,ke]=x.useState(null),[se,_e]=x.useState(""),[oe,fe]=x.useState({}),[Ie,qe]=x.useState(""),[ze,ct]=x.useState(new Set),[Ye,wt]=x.useState(null),[gt,et]=x.useState(null),{setCurrentProject:Me,mcpServerStatus:mt}=ss(),{tasksEnabled:Pt}=os(),[xe,at]=x.useState(()=>{try{const J=localStorage.getItem("starredProjects");return J?new Set(JSON.parse(J)):new Set}catch(J){return console.error("Error loading starred projects:",J),new Set}}),de=J=>Fe=>{Fe.target.closest(".overflow-y-auto")||Fe.target.closest("[data-scroll-container]")||(Fe.preventDefault(),Fe.stopPropagation(),J())};x.useEffect(()=>{const J=setInterval(()=>{R(new Date)},6e4);return()=>clearInterval(J)},[]),x.useEffect(()=>{G({}),K(new Set)},[e]),x.useEffect(()=>{r&&t&&v(J=>new Set([...J,t.name]))},[r,t]),x.useEffect(()=>{if(e.length>0&&!c){const J=new Set;e.forEach(Fe=>{Fe.sessions&&Fe.sessions.length>=0&&J.add(Fe.name)}),K(J)}},[e,c]),x.useEffect(()=>{const J=()=>{try{const Ge=localStorage.getItem("claude-settings");if(Ge){const dt=JSON.parse(Ge);te(dt.projectSortOrder||"name")}}catch(Ge){console.error("Error loading sort order:",Ge)}};J();const Fe=Ge=>{Ge.key==="claude-settings"&&J()};window.addEventListener("storage",Fe);const Ke=setInterval(()=>{document.hasFocus()&&J()},1e3);return()=>{window.removeEventListener("storage",Fe),clearInterval(Ke)}},[]);const Ee=J=>{const Fe=new Set;C.has(J)||Fe.add(J),v(Fe)},H=(J,Fe)=>{i({...J,__projectName:Fe})},Y=J=>{const Fe=new Set(xe);Fe.has(J)?Fe.delete(J):Fe.add(J),at(Fe);try{localStorage.setItem("starredProjects",JSON.stringify([...Fe]))}catch(Ke){console.error("Error saving starred projects:",Ke)}},le=J=>xe.has(J),ve=J=>{const Fe=[...J.sessions||[],...U[J.name]||[]].map(he=>({...he,__provider:"claude"})),Ke=(J.cursorSessions||[]).map(he=>({...he,__provider:"cursor"})),Ge=(J.codexSessions||[]).map(he=>({...he,__provider:"codex"})),dt=he=>he.__provider==="cursor"?new Date(he.createdAt):he.__provider==="codex"?new Date(he.createdAt||he.lastActivity):new Date(he.lastActivity);return[...Fe,...Ke,...Ge].sort((he,zt)=>dt(zt)-dt(he))},Ve=J=>{const Fe=ve(J);return Fe.length===0?new Date(0):Fe.reduce((Ge,dt)=>{const he=new Date(dt.lastActivity);return he>Ge?he:Ge},new Date(0))},It=[...e].sort((J,Fe)=>{const Ke=le(J.name),Ge=le(Fe.name);if(Ke&&!Ge)return-1;if(!Ke&&Ge)return 1;if(F==="date")return Ve(Fe)-Ve(J);{const dt=J.displayName||J.name,he=Fe.displayName||Fe.name;return dt.localeCompare(he)}}),ft=J=>{M(J.name),q(J.displayName)},Rt=()=>{M(null),q("")},it=async J=>{try{(await yt.renameProject(J,P)).ok?window.refreshProjects?window.refreshProjects():window.location.reload():console.error("Failed to rename project")}catch(Fe){console.error("Error renaming project:",Fe)}M(null),q("")},ie=(J,Fe,Ke,Ge="claude")=>{et({projectName:J,sessionId:Fe,sessionTitle:Ke,provider:Ge})},je=async()=>{if(!gt)return;const{projectName:J,sessionId:Fe,provider:Ke}=gt;et(null);try{console.log("[Sidebar] Deleting session:",{projectName:J,sessionId:Fe,provider:Ke});let Ge;if(Ke==="codex"?Ge=await yt.deleteCodexSession(Fe):Ge=await yt.deleteSession(J,Fe),console.log("[Sidebar] Delete response:",{ok:Ge.ok,status:Ge.status}),Ge.ok)console.log("[Sidebar] Session deleted successfully, calling callback"),o?o(Fe):console.warn("[Sidebar] No onSessionDelete callback provided");else{const dt=await Ge.text();console.error("[Sidebar] Failed to delete session:",{status:Ge.status,error:dt}),alert(N("messages.deleteSessionFailed"))}}catch(Ge){console.error("[Sidebar] Error deleting session:",Ge),alert(N("messages.deleteSessionError"))}},Te=J=>{const Fe=ve(J).length;wt({project:J,sessionCount:Fe})},Pe=async()=>{if(!Ye)return;const{project:J,sessionCount:Fe}=Ye,Ke=Fe===0;wt(null),ct(Ge=>new Set([...Ge,J.name]));try{const Ge=await yt.deleteProject(J.name,!Ke);if(Ge.ok)l&&l(J.name);else{const dt=await Ge.json();console.error("Failed to delete project"),alert(dt.error||N("messages.deleteProjectFailed"))}}catch(Ge){console.error("Error deleting project:",Ge),alert(N("messages.deleteProjectError"))}finally{ct(Ge=>{const dt=new Set(Ge);return dt.delete(J.name),dt})}},Ue=async J=>{if(!(!(J.sessionMeta?.hasMore!==!1)||D[J.name])){z(Ke=>({...Ke,[J.name]:!0}));try{const Ke=(J.sessions?.length||0)+(U[J.name]?.length||0),Ge=await yt.sessions(J.name,5,Ke);if(Ge.ok){const dt=await Ge.json();G(he=>({...he,[J.name]:[...he[J.name]||[],...dt.sessions]})),dt.hasMore===!1&&(J.sessionMeta={...J.sessionMeta,hasMore:!1})}}catch(Ke){console.error("Error loading more sessions:",Ke)}finally{z(Ke=>({...Ke,[J.name]:!1}))}}},st=It.filter(J=>{if(!Ie.trim())return!0;const Fe=Ie.toLowerCase(),Ke=(J.displayName||J.name).toLowerCase(),Ge=J.name.toLowerCase();return Ke.includes(Fe)||Ge.includes(Fe)}),Qe=J=>{n(J),Me(J)};return a.jsxs(a.Fragment,{children:[j&&Xo.createPortal(a.jsx(LT,{onClose:()=>T(!1),onProjectCreated:J=>{window.refreshProjects?window.refreshProjects():window.location.reload()}}),document.body),Ye&&Xo.createPortal(a.jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm flex items-center justify-center z-50 p-4",children:a.jsxs("div",{className:"bg-card border border-border rounded-xl shadow-2xl max-w-md w-full overflow-hidden",children:[a.jsx("div",{className:"p-6",children:a.jsxs("div",{className:"flex items-start gap-4",children:[a.jsx("div",{className:"w-12 h-12 rounded-full bg-red-100 dark:bg-red-900/30 flex items-center justify-center flex-shrink-0",children:a.jsx(Vn,{className:"w-6 h-6 text-red-600 dark:text-red-400"})}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsx("h3",{className:"text-lg font-semibold text-foreground mb-2",children:N("deleteConfirmation.deleteProject")}),a.jsxs("p",{className:"text-sm text-muted-foreground mb-1",children:[N("deleteConfirmation.confirmDelete")," ",a.jsx("span",{className:"font-medium text-foreground",children:Ye.project.displayName||Ye.project.name}),"?"]}),Ye.sessionCount>0&&a.jsxs("div",{className:"mt-3 p-3 bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800 rounded-lg",children:[a.jsx("p",{className:"text-sm text-red-700 dark:text-red-300 font-medium",children:N("deleteConfirmation.sessionCount",{count:Ye.sessionCount})}),a.jsx("p",{className:"text-xs text-red-600 dark:text-red-400 mt-1",children:N("deleteConfirmation.allConversationsDeleted")})]}),a.jsx("p",{className:"text-xs text-muted-foreground mt-3",children:N("deleteConfirmation.cannotUndo")})]})]})}),a.jsxs("div",{className:"flex gap-3 p-4 bg-muted/30 border-t border-border",children:[a.jsx(Be,{variant:"outline",className:"flex-1",onClick:()=>wt(null),children:N("actions.cancel")}),a.jsxs(Be,{variant:"destructive",className:"flex-1 bg-red-600 hover:bg-red-700 text-white",onClick:Pe,children:[a.jsx(Nr,{className:"w-4 h-4 mr-2"}),N("actions.delete")]})]})]})}),document.body),gt&&Xo.createPortal(a.jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm flex items-center justify-center z-50 p-4",children:a.jsxs("div",{className:"bg-card border border-border rounded-xl shadow-2xl max-w-md w-full overflow-hidden",children:[a.jsx("div",{className:"p-6",children:a.jsxs("div",{className:"flex items-start gap-4",children:[a.jsx("div",{className:"w-12 h-12 rounded-full bg-red-100 dark:bg-red-900/30 flex items-center justify-center flex-shrink-0",children:a.jsx(Vn,{className:"w-6 h-6 text-red-600 dark:text-red-400"})}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsx("h3",{className:"text-lg font-semibold text-foreground mb-2",children:N("deleteConfirmation.deleteSession")}),a.jsxs("p",{className:"text-sm text-muted-foreground mb-1",children:[N("deleteConfirmation.confirmDelete")," ",a.jsx("span",{className:"font-medium text-foreground",children:gt.sessionTitle||N("sessions.unnamed")}),"?"]}),a.jsx("p",{className:"text-xs text-muted-foreground mt-3",children:N("deleteConfirmation.cannotUndo")})]})]})}),a.jsxs("div",{className:"flex gap-3 p-4 bg-muted/30 border-t border-border",children:[a.jsx(Be,{variant:"outline",className:"flex-1",onClick:()=>et(null),children:N("actions.cancel")}),a.jsxs(Be,{variant:"destructive",className:"flex-1 bg-red-600 hover:bg-red-700 text-white",onClick:je,children:[a.jsx(Nr,{className:"w-4 h-4 mr-2"}),N("actions.delete")]})]})]})}),document.body),a.jsxs("div",{className:"h-full flex flex-col bg-card md:select-none",style:S&&k?{paddingTop:"44px"}:{},children:[a.jsxs("div",{className:"md:p-4 md:border-b md:border-border",children:[a.jsxs("div",{className:"hidden md:flex items-center justify-between",children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("div",{className:"w-8 h-8 bg-primary rounded-lg flex items-center justify-center shadow-sm",children:a.jsx(Wi,{className:"w-4 h-4 text-primary-foreground"})}),a.jsxs("div",{children:[a.jsx("h1",{className:"text-lg font-bold text-foreground",children:N("app.title")}),a.jsx("p",{className:"text-sm text-muted-foreground",children:N("app.subtitle")})]})]}),E&&a.jsx(Be,{variant:"ghost",size:"sm",className:"h-8 w-8 px-0 hover:bg-accent transition-colors duration-200",onClick:E,title:N("tooltips.hideSidebar"),children:a.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 19l-7-7 7-7"})})})]}),a.jsx("div",{className:"md:hidden p-3 border-b border-border",style:S&&k?{paddingTop:"16px"}:{},children:a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("div",{className:"w-8 h-8 bg-primary rounded-lg flex items-center justify-center",children:a.jsx(Wi,{className:"w-4 h-4 text-primary-foreground"})}),a.jsxs("div",{children:[a.jsx("h1",{className:"text-lg font-semibold text-foreground",children:N("app.title")}),a.jsx("p",{className:"text-sm text-muted-foreground",children:N("projects.title")})]})]}),a.jsxs("div",{className:"flex gap-2",children:[a.jsx("button",{className:"w-8 h-8 rounded-md bg-background border border-border flex items-center justify-center active:scale-95 transition-all duration-150",onClick:async()=>{Z(!0);try{await u()}finally{Z(!1)}},disabled:_,children:a.jsx(Un,{className:`w-4 h-4 text-foreground ${_?"animate-spin":""}`})}),a.jsx("button",{className:"w-8 h-8 rounded-md bg-primary text-primary-foreground flex items-center justify-center active:scale-95 transition-all duration-150",onClick:()=>T(!0),children:a.jsx(Pi,{className:"w-4 h-4"})})]})]})})]}),!c&&!k&&a.jsx("div",{className:"px-3 md:px-4 py-2 border-b border-border",children:a.jsxs("div",{className:"flex gap-2",children:[a.jsxs(Be,{variant:"default",size:"sm",className:"flex-1 h-8 text-xs bg-primary hover:bg-primary/90 transition-all duration-200",onClick:()=>T(!0),title:N("tooltips.createProject"),children:[a.jsx(Pi,{className:"w-3.5 h-3.5 mr-1.5"}),N("projects.newProject")]}),a.jsx(Be,{variant:"outline",size:"sm",className:"h-8 w-8 px-0 hover:bg-accent transition-colors duration-200 group",onClick:async()=>{Z(!0);try{await u()}finally{Z(!1)}},disabled:_,title:N("tooltips.refresh"),children:a.jsx(Un,{className:`w-3.5 h-3.5 ${_?"animate-spin":""} group-hover:rotate-180 transition-transform duration-300`})})]})}),e.length>0&&!c&&a.jsx("div",{className:"px-3 md:px-4 py-2 border-b border-border",children:a.jsxs("div",{className:"relative",children:[a.jsx(si,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 w-4 h-4 text-muted-foreground"}),a.jsx(tr,{type:"text",placeholder:N("projects.searchPlaceholder"),value:Ie,onChange:J=>qe(J.target.value),className:"pl-9 h-9 text-sm bg-muted/50 border-0 focus:bg-background focus:ring-1 focus:ring-primary/20"}),Ie&&a.jsx("button",{onClick:()=>qe(""),className:"absolute right-2 top-1/2 transform -translate-y-1/2 p-1 hover:bg-accent rounded",children:a.jsx(Bt,{className:"w-3 h-3 text-muted-foreground"})})]})}),a.jsx($h,{className:"flex-1 md:px-2 md:py-3 overflow-y-auto overscroll-contain",children:a.jsx("div",{className:"md:space-y-1 pb-safe-area-inset-bottom",children:c?a.jsxs("div",{className:"text-center py-12 md:py-8 px-4",children:[a.jsx("div",{className:"w-12 h-12 bg-muted rounded-lg flex items-center justify-center mx-auto mb-4 md:mb-3",children:a.jsx("div",{className:"w-6 h-6 animate-spin rounded-full border-2 border-muted-foreground border-t-transparent"})}),a.jsx("h3",{className:"text-base font-medium text-foreground mb-2 md:mb-1",children:N("projects.loadingProjects")}),a.jsx("p",{className:"text-sm text-muted-foreground",children:N("projects.fetchingProjects")}),a.jsx("h3",{className:"text-base font-medium text-foreground mb-2 md:mb-1",children:N("projects.loadingProjects")}),d&&d.total>0?a.jsxs("div",{className:"space-y-2",children:[a.jsx("div",{className:"w-full bg-muted rounded-full h-2 overflow-hidden",children:a.jsx("div",{className:"bg-primary h-full transition-all duration-300 ease-out",style:{width:`${d.current/d.total*100}%`}})}),a.jsxs("p",{className:"text-sm text-muted-foreground",children:[d.current,"/",d.total," ",N("projects.projects")]}),d.currentProject&&a.jsx("p",{className:"text-xs text-muted-foreground/70 truncate max-w-[200px] mx-auto",title:d.currentProject,children:d.currentProject.split("-").slice(-2).join("/")})]}):a.jsx("p",{className:"text-sm text-muted-foreground",children:N("projects.fetchingProjects")})]}):e.length===0?a.jsxs("div",{className:"text-center py-12 md:py-8 px-4",children:[a.jsx("div",{className:"w-12 h-12 bg-muted rounded-lg flex items-center justify-center mx-auto mb-4 md:mb-3",children:a.jsx(ca,{className:"w-6 h-6 text-muted-foreground"})}),a.jsx("h3",{className:"text-base font-medium text-foreground mb-2 md:mb-1",children:N("projects.noProjects")}),a.jsx("p",{className:"text-sm text-muted-foreground",children:N("projects.runClaudeCli")})]}):st.length===0?a.jsxs("div",{className:"text-center py-12 md:py-8 px-4",children:[a.jsx("div",{className:"w-12 h-12 bg-muted rounded-lg flex items-center justify-center mx-auto mb-4 md:mb-3",children:a.jsx(si,{className:"w-6 h-6 text-muted-foreground"})}),a.jsx("h3",{className:"text-base font-medium text-foreground mb-2 md:mb-1",children:N("projects.noMatchingProjects")}),a.jsx("p",{className:"text-sm text-muted-foreground",children:N("projects.tryDifferentSearch")})]}):st.map(J=>{const Fe=C.has(J.name),Ke=t?.name===J.name,Ge=le(J.name),dt=ze.has(J.name);return a.jsxs("div",{className:Ze("md:space-y-1",dt&&"opacity-50 pointer-events-none"),children:[a.jsxs("div",{className:"group md:group",children:[a.jsx("div",{className:"md:hidden",children:a.jsx("div",{className:Ze("p-3 mx-3 my-1 rounded-lg bg-card border border-border/50 active:scale-[0.98] transition-all duration-150",Ke&&"bg-primary/5 border-primary/20",Ge&&!Ke&&"bg-yellow-50/50 dark:bg-yellow-900/5 border-yellow-200/30 dark:border-yellow-800/30"),onClick:()=>{Ee(J.name)},onTouchEnd:de(()=>Ee(J.name)),children:a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{className:"flex items-center gap-3 min-w-0 flex-1",children:[a.jsx("div",{className:Ze("w-8 h-8 rounded-lg flex items-center justify-center transition-colors",Fe?"bg-primary/10":"bg-muted"),children:Fe?a.jsx(Tn,{className:"w-4 h-4 text-primary"}):a.jsx(ca,{className:"w-4 h-4 text-muted-foreground"})}),a.jsx("div",{className:"min-w-0 flex-1",children:I===J.name?a.jsx("input",{type:"text",value:P,onChange:he=>q(he.target.value),className:"w-full px-3 py-2 text-sm border-2 border-primary/40 focus:border-primary rounded-lg bg-background text-foreground shadow-sm focus:shadow-md transition-all duration-200 focus:outline-none",placeholder:N("projects.projectNamePlaceholder"),autoFocus:!0,autoComplete:"off",onClick:he=>he.stopPropagation(),onKeyDown:he=>{he.key==="Enter"&&it(J.name),he.key==="Escape"&&Rt()},style:{fontSize:"16px",WebkitAppearance:"none",borderRadius:"8px"}}):a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"flex items-center justify-between min-w-0 flex-1",children:[a.jsx("h3",{className:"text-sm font-medium text-foreground truncate",children:J.displayName}),Pt&&a.jsx(_T,{status:(()=>{const he=J.taskmaster?.hasTaskmaster,zt=mt?.hasMCPServer&&mt?.isConfigured;return he&&zt?"fully-configured":he?"taskmaster-only":zt?"mcp-only":"not-configured"})(),size:"xs",className:"hidden md:inline-flex flex-shrink-0 ml-2"})]}),a.jsx("p",{className:"text-xs text-muted-foreground",children:(()=>{const he=ve(J).length,nr=J.sessionMeta?.hasMore!==!1&&he>=5?`${he}+`:he;return`${nr} session${nr===1?"":"s"}`})()})]})})]}),a.jsx("div",{className:"flex items-center gap-1",children:I===J.name?a.jsxs(a.Fragment,{children:[a.jsx("button",{className:"w-8 h-8 rounded-lg bg-green-500 dark:bg-green-600 flex items-center justify-center active:scale-90 transition-all duration-150 shadow-sm active:shadow-none",onClick:he=>{he.stopPropagation(),it(J.name)},children:a.jsx(Cr,{className:"w-4 h-4 text-white"})}),a.jsx("button",{className:"w-8 h-8 rounded-lg bg-gray-500 dark:bg-gray-600 flex items-center justify-center active:scale-90 transition-all duration-150 shadow-sm active:shadow-none",onClick:he=>{he.stopPropagation(),Rt()},children:a.jsx(Bt,{className:"w-4 h-4 text-white"})})]}):a.jsxs(a.Fragment,{children:[a.jsx("button",{className:Ze("w-8 h-8 rounded-lg flex items-center justify-center active:scale-90 transition-all duration-150 border",Ge?"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:he=>{he.stopPropagation(),Y(J.name)},onTouchEnd:de(()=>Y(J.name)),title:N(Ge?"tooltips.removeFromFavorites":"tooltips.addToFavorites"),children:a.jsx(df,{className:Ze("w-4 h-4 transition-colors",Ge?"text-yellow-600 dark:text-yellow-400 fill-current":"text-gray-600 dark:text-gray-400")})}),a.jsx("button",{className:"w-8 h-8 rounded-lg bg-red-500/10 dark:bg-red-900/30 flex items-center justify-center active:scale-90 border border-red-200 dark:border-red-800",onClick:he=>{he.stopPropagation(),Te(J)},onTouchEnd:de(()=>Te(J)),children:a.jsx(Nr,{className:"w-4 h-4 text-red-600 dark:text-red-400"})}),a.jsx("button",{className:"w-8 h-8 rounded-lg bg-primary/10 dark:bg-primary/20 flex items-center justify-center active:scale-90 border border-primary/20 dark:border-primary/30",onClick:he=>{he.stopPropagation(),ft(J)},onTouchEnd:de(()=>ft(J)),children:a.jsx(Vi,{className:"w-4 h-4 text-primary"})}),a.jsx("div",{className:"w-6 h-6 rounded-md bg-muted/30 flex items-center justify-center",children:Fe?a.jsx(tn,{className:"w-3 h-3 text-muted-foreground"}):a.jsx(Cn,{className:"w-3 h-3 text-muted-foreground"})})]})})]})})}),a.jsxs(Be,{variant:"ghost",className:Ze("hidden md:flex w-full justify-between p-2 h-auto font-normal hover:bg-accent/50",Ke&&"bg-accent text-accent-foreground",Ge&&!Ke&&"bg-yellow-50/50 dark:bg-yellow-900/10 hover:bg-yellow-100/50 dark:hover:bg-yellow-900/20"),onClick:()=>{t?.name!==J.name&&Qe(J),Ee(J.name)},onTouchEnd:de(()=>{t?.name!==J.name&&Qe(J),Ee(J.name)}),children:[a.jsxs("div",{className:"flex items-center gap-3 min-w-0 flex-1",children:[Fe?a.jsx(Tn,{className:"w-4 h-4 text-primary flex-shrink-0"}):a.jsx(ca,{className:"w-4 h-4 text-muted-foreground flex-shrink-0"}),a.jsx("div",{className:"min-w-0 flex-1 text-left",children:I===J.name?a.jsxs("div",{className:"space-y-1",children:[a.jsx("input",{type:"text",value:P,onChange:he=>q(he.target.value),className:"w-full px-2 py-1 text-sm border border-border rounded bg-background text-foreground focus:ring-2 focus:ring-primary/20",placeholder:N("projects.projectNamePlaceholder"),autoFocus:!0,onKeyDown:he=>{he.key==="Enter"&&it(J.name),he.key==="Escape"&&Rt()}}),a.jsx("div",{className:"text-xs text-muted-foreground truncate",title:J.fullPath,children:J.fullPath})]}):a.jsxs("div",{children:[a.jsx("div",{className:"text-sm font-semibold truncate text-foreground",title:J.displayName,children:J.displayName}),a.jsxs("div",{className:"text-xs text-muted-foreground",children:[(()=>{const he=ve(J).length;return J.sessionMeta?.hasMore!==!1&&he>=5?`${he}+`:he})(),J.fullPath!==J.displayName&&a.jsxs("span",{className:"ml-1 opacity-60",title:J.fullPath,children:["• ",J.fullPath.length>25?"..."+J.fullPath.slice(-22):J.fullPath]})]})]})})]}),a.jsx("div",{className:"flex items-center gap-1 flex-shrink-0",children:I===J.name?a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"w-6 h-6 text-green-600 hover:text-green-700 hover:bg-green-50 dark:hover:bg-green-900/20 flex items-center justify-center rounded cursor-pointer transition-colors",onClick:he=>{he.stopPropagation(),it(J.name)},children:a.jsx(Cr,{className:"w-3 h-3"})}),a.jsx("div",{className:"w-6 h-6 text-gray-500 hover:text-gray-700 hover:bg-gray-50 dark:hover:bg-gray-800 flex items-center justify-center rounded cursor-pointer transition-colors",onClick:he=>{he.stopPropagation(),Rt()},children:a.jsx(Bt,{className:"w-3 h-3"})})]}):a.jsxs(a.Fragment,{children:[a.jsx("div",{className:Ze("w-6 h-6 opacity-0 group-hover:opacity-100 transition-all duration-200 flex items-center justify-center rounded cursor-pointer touch:opacity-100",Ge?"hover:bg-yellow-50 dark:hover:bg-yellow-900/20 opacity-100":"hover:bg-accent"),onClick:he=>{he.stopPropagation(),Y(J.name)},title:N(Ge?"tooltips.removeFromFavorites":"tooltips.addToFavorites"),children:a.jsx(df,{className:Ze("w-3 h-3 transition-colors",Ge?"text-yellow-600 dark:text-yellow-400 fill-current":"text-muted-foreground")})}),a.jsx("div",{className:"w-6 h-6 opacity-0 group-hover:opacity-100 transition-all duration-200 hover:bg-accent flex items-center justify-center rounded cursor-pointer touch:opacity-100",onClick:he=>{he.stopPropagation(),ft(J)},title:N("tooltips.renameProject"),children:a.jsx(Vi,{className:"w-3 h-3"})}),a.jsx("div",{className:"w-6 h-6 opacity-0 group-hover:opacity-100 transition-all duration-200 hover:bg-red-50 dark:hover:bg-red-900/20 flex items-center justify-center rounded cursor-pointer touch:opacity-100",onClick:he=>{he.stopPropagation(),Te(J)},title:N("tooltips.deleteProject"),children:a.jsx(Nr,{className:"w-3 h-3 text-red-600 dark:text-red-400"})}),Fe?a.jsx(tn,{className:"w-4 h-4 text-muted-foreground group-hover:text-foreground transition-colors"}):a.jsx(Cn,{className:"w-4 h-4 text-muted-foreground group-hover:text-foreground transition-colors"})]})})]})]}),Fe&&a.jsxs("div",{className:"ml-3 space-y-1 border-l border-border pl-3",children:[re.has(J.name)?ve(J).length===0&&!D[J.name]?a.jsx("div",{className:"py-2 px-3 text-left",children:a.jsx("p",{className:"text-xs text-muted-foreground",children:N("sessions.noSessions")})}):ve(J).map(he=>{const zt=he.__provider==="cursor",nr=he.__provider==="codex",xr=zt?new Date(he.createdAt):nr?new Date(he.createdAt||he.lastActivity):new Date(he.lastActivity),ge=Math.floor((ue-xr)/(1e3*60))<10,bt=zt?he.name||N("projects.untitledSession"):nr?he.summary||he.name||N("projects.codexSession"):he.summary||N("projects.newSession"),ar=zt?he.createdAt:nr&&he.createdAt||he.lastActivity,Zr=he.messageCount||0;return a.jsxs("div",{className:"group relative",children:[ge&&a.jsx("div",{className:"absolute left-0 top-1/2 transform -translate-y-1/2 -translate-x-1",children:a.jsx("div",{className:"w-2 h-2 bg-green-500 rounded-full animate-pulse"})}),a.jsx("div",{className:"md:hidden",children:a.jsx("div",{className:Ze("p-2 mx-3 my-0.5 rounded-md bg-card border active:scale-[0.98] transition-all duration-150 relative",r?.id===he.id?"bg-primary/5 border-primary/20":ge?"border-green-500/30 bg-green-50/5 dark:bg-green-900/5":"border-border/30"),onClick:()=>{Qe(J),H(he,J.name)},onTouchEnd:de(()=>{Qe(J),H(he,J.name)}),children:a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("div",{className:Ze("w-5 h-5 rounded-md flex items-center justify-center flex-shrink-0",r?.id===he.id?"bg-primary/10":"bg-muted/50"),children:zt?a.jsx(pn,{className:"w-3 h-3"}):nr?a.jsx(wn,{className:"w-3 h-3"}):a.jsx(nn,{className:"w-3 h-3"})}),a.jsxs("div",{className:"min-w-0 flex-1",children:[a.jsx("div",{className:"text-xs font-medium truncate text-foreground",children:bt}),a.jsxs("div",{className:"flex items-center gap-1 mt-0.5",children:[a.jsx(Hi,{className:"w-2.5 h-2.5 text-muted-foreground"}),a.jsx("span",{className:"text-xs text-muted-foreground",children:Of(ar,ue,N)}),Zr>0&&a.jsx(mn,{variant:"secondary",className:"text-xs px-1 py-0 ml-auto",children:Zr}),a.jsx("span",{className:"ml-1 opacity-70",children:zt?a.jsx(pn,{className:"w-3 h-3"}):nr?a.jsx(wn,{className:"w-3 h-3"}):a.jsx(nn,{className:"w-3 h-3"})})]})]}),!zt&&a.jsx("button",{className:"w-5 h-5 rounded-md bg-red-50 dark:bg-red-900/20 flex items-center justify-center active:scale-95 transition-transform opacity-70 ml-1",onClick:Ut=>{Ut.stopPropagation(),ie(J.name,he.id,bt,he.__provider)},onTouchEnd:de(()=>ie(J.name,he.id,bt,he.__provider)),children:a.jsx(Nr,{className:"w-2.5 h-2.5 text-red-600 dark:text-red-400"})})]})})}),a.jsxs("div",{className:"hidden md:block",children:[a.jsx(Be,{variant:"ghost",className:Ze("w-full justify-start p-2 h-auto font-normal text-left hover:bg-accent/50 transition-colors duration-200",r?.id===he.id&&"bg-accent text-accent-foreground"),onClick:()=>H(he,J.name),onTouchEnd:de(()=>H(he,J.name)),children:a.jsxs("div",{className:"flex items-start gap-2 min-w-0 w-full",children:[zt?a.jsx(pn,{className:"w-3 h-3 mt-0.5 flex-shrink-0"}):nr?a.jsx(wn,{className:"w-3 h-3 mt-0.5 flex-shrink-0"}):a.jsx(nn,{className:"w-3 h-3 mt-0.5 flex-shrink-0"}),a.jsxs("div",{className:"min-w-0 flex-1",children:[a.jsx("div",{className:"text-xs font-medium truncate text-foreground",children:bt}),a.jsxs("div",{className:"flex items-center gap-1 mt-0.5",children:[a.jsx(Hi,{className:"w-2.5 h-2.5 text-muted-foreground"}),a.jsx("span",{className:"text-xs text-muted-foreground",children:Of(ar,ue,N)}),Zr>0&&a.jsx(mn,{variant:"secondary",className:"text-xs px-1 py-0 ml-auto group-hover:opacity-0 transition-opacity",children:Zr}),a.jsx("span",{className:"ml-1 opacity-70 group-hover:opacity-0 transition-opacity",children:zt?a.jsx(pn,{className:"w-3 h-3"}):nr?a.jsx(wn,{className:"w-3 h-3"}):a.jsx(nn,{className:"w-3 h-3"})})]})]})]})}),!zt&&a.jsx("div",{className:"absolute right-2 top-1/2 transform -translate-y-1/2 flex items-center gap-1 opacity-0 group-hover:opacity-100 transition-all duration-200",children:me===he.id&&!nr?a.jsxs(a.Fragment,{children:[a.jsx("input",{type:"text",value:se,onChange:Ut=>_e(Ut.target.value),onKeyDown:Ut=>{Ut.stopPropagation(),Ut.key==="Enter"?updateSessionSummary(J.name,he.id,se):Ut.key==="Escape"&&(ke(null),_e(""))},onClick:Ut=>Ut.stopPropagation(),className:"w-32 px-2 py-1 text-xs border border-border rounded bg-background focus:outline-none focus:ring-1 focus:ring-primary",autoFocus:!0}),a.jsx("button",{className:"w-6 h-6 bg-green-50 hover:bg-green-100 dark:bg-green-900/20 dark:hover:bg-green-900/40 rounded flex items-center justify-center",onClick:Ut=>{Ut.stopPropagation(),updateSessionSummary(J.name,he.id,se)},title:N("tooltips.save"),children:a.jsx(Cr,{className:"w-3 h-3 text-green-600 dark:text-green-400"})}),a.jsx("button",{className:"w-6 h-6 bg-gray-50 hover:bg-gray-100 dark:bg-gray-900/20 dark:hover:bg-gray-900/40 rounded flex items-center justify-center",onClick:Ut=>{Ut.stopPropagation(),ke(null),_e("")},title:N("tooltips.cancel"),children:a.jsx(Bt,{className:"w-3 h-3 text-gray-600 dark:text-gray-400"})})]}):a.jsxs(a.Fragment,{children:[!nr&&a.jsx("button",{className:"w-6 h-6 bg-gray-50 hover:bg-gray-100 dark:bg-gray-900/20 dark:hover:bg-gray-900/40 rounded flex items-center justify-center",onClick:Ut=>{Ut.stopPropagation(),ke(he.id),_e(he.summary||N("projects.newSession"))},title:N("tooltips.editSessionName"),children:a.jsx(_6,{className:"w-3 h-3 text-gray-600 dark:text-gray-400"})}),a.jsx("button",{className:"w-6 h-6 bg-red-50 hover:bg-red-100 dark:bg-red-900/20 dark:hover:bg-red-900/40 rounded flex items-center justify-center",onClick:Ut=>{Ut.stopPropagation(),ie(J.name,he.id,bt,he.__provider)},title:N("tooltips.deleteSession"),children:a.jsx(Nr,{className:"w-3 h-3 text-red-600 dark:text-red-400"})})]})})]})]},he.id)}):Array.from({length:3}).map((he,zt)=>a.jsx("div",{className:"p-2 rounded-md",children:a.jsxs("div",{className:"flex items-start gap-2",children:[a.jsx("div",{className:"w-3 h-3 bg-muted rounded-full animate-pulse mt-0.5"}),a.jsxs("div",{className:"flex-1 space-y-1",children:[a.jsx("div",{className:"h-3 bg-muted rounded animate-pulse",style:{width:`${60+zt*15}%`}}),a.jsx("div",{className:"h-2 bg-muted rounded animate-pulse w-1/2"})]})]})},zt)),ve(J).length>0&&J.sessionMeta?.hasMore!==!1&&a.jsx(Be,{variant:"ghost",size:"sm",className:"w-full justify-center gap-2 mt-2 text-muted-foreground",onClick:()=>Ue(J),disabled:D[J.name],children:D[J.name]?a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"w-3 h-3 animate-spin rounded-full border border-muted-foreground border-t-transparent"}),N("sessions.loading")]}):a.jsxs(a.Fragment,{children:[a.jsx(tn,{className:"w-3 h-3"}),N("sessions.showMore")]})}),a.jsx("div",{className:"md:hidden px-3 pb-2",children:a.jsxs("button",{className:"w-full h-8 bg-primary hover:bg-primary/90 text-primary-foreground rounded-md flex items-center justify-center gap-2 font-medium text-xs active:scale-[0.98] transition-all duration-150",onClick:()=>{Qe(J),s(J)},children:[a.jsx(gr,{className:"w-3 h-3"}),N("sessions.newSession")]})}),a.jsxs(Be,{variant:"default",size:"sm",className:"hidden md:flex w-full justify-start gap-2 mt-1 h-8 text-xs font-medium bg-primary hover:bg-primary/90 text-primary-foreground transition-colors",onClick:()=>s(J),children:[a.jsx(gr,{className:"w-3 h-3"}),N("sessions.newSession")]})]})]},J.name)})})}),h&&a.jsxs("div",{className:"md:p-2 border-t border-border/50 flex-shrink-0",children:[a.jsx("div",{className:"hidden md:block",children:a.jsxs(Be,{variant:"ghost",className:"w-full justify-start gap-3 p-3 h-auto font-normal text-left hover:bg-blue-50 dark:hover:bg-blue-900/20 transition-colors duration-200 border border-blue-200 dark:border-blue-700 rounded-lg mb-2",onClick:w,children:[a.jsxs("div",{className:"relative",children:[a.jsx("svg",{className:"w-4 h-4 text-blue-600 dark:text-blue-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:a.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"})}),a.jsx("div",{className:"absolute -top-1 -right-1 w-2 h-2 bg-blue-500 rounded-full animate-pulse"})]}),a.jsxs("div",{className:"min-w-0 flex-1",children:[a.jsx("div",{className:"text-sm font-medium text-blue-700 dark:text-blue-300",children:f?.title||`Version ${m}`}),a.jsx("div",{className:"text-xs text-blue-600 dark:text-blue-400",children:N("version.updateAvailable")})]})]})}),a.jsx("div",{className:"md:hidden p-3 pb-2",children:a.jsxs("button",{className:"w-full h-12 bg-blue-50 dark:bg-blue-900/20 border border-blue-200 dark:border-blue-700 rounded-xl flex items-center justify-start gap-3 px-4 active:scale-[0.98] transition-all duration-150",onClick:w,children:[a.jsxs("div",{className:"relative",children:[a.jsx("svg",{className:"w-5 h-5 text-blue-600 dark:text-blue-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:a.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"})}),a.jsx("div",{className:"absolute -top-1 -right-1 w-2 h-2 bg-blue-500 rounded-full animate-pulse"})]}),a.jsxs("div",{className:"min-w-0 flex-1 text-left",children:[a.jsx("div",{className:"text-sm font-medium text-blue-700 dark:text-blue-300",children:f?.title||`Version ${m}`}),a.jsx("div",{className:"text-xs text-blue-600 dark:text-blue-400",children:N("version.updateAvailable")})]})]})})]}),a.jsxs("div",{className:"md:p-2 md:border-t md:border-border flex-shrink-0",children:[a.jsx("div",{className:"md:hidden p-4 pb-20 border-t border-border/50",children:a.jsxs("button",{className:"w-full h-14 bg-muted/50 hover:bg-muted/70 rounded-2xl flex items-center justify-start gap-4 px-4 active:scale-[0.98] transition-all duration-150",onClick:p,children:[a.jsx("div",{className:"w-10 h-10 rounded-2xl bg-background/80 flex items-center justify-center",children:a.jsx(Ia,{className:"w-5 h-5 text-muted-foreground"})}),a.jsx("span",{className:"text-lg font-medium text-foreground",children:N("actions.settings")})]})}),a.jsxs(Be,{variant:"ghost",className:"hidden md:flex w-full justify-start gap-2 p-2 h-auto font-normal text-muted-foreground hover:text-foreground hover:bg-accent transition-colors duration-200",onClick:p,children:[a.jsx(Ia,{className:"w-3 h-3"}),a.jsx("span",{className:"text-xs",children:N("actions.settings")})]})]})]})]})}function Mf(e){const t=[],r=String(e||"");let n=r.indexOf(","),i=0,s=!1;for(;!s;){n===-1&&(n=r.length,s=!0);const o=r.slice(i,n).trim();(o||!s)&&t.push(o),i=n+1,n=r.indexOf(",",i)}return t}function BT(e,t){const r={};return(e[e.length-1]===""?[...e,""]:e).join((r.padRight?" ":"")+","+(r.padLeft===!1?"":" ")).trim()}const zT=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,UT=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,$T={};function Ff(e,t){return($T.jsx?UT:zT).test(e)}const qT=/[ \t\n\f\r]/g;function GT(e){return typeof e=="object"?e.type==="text"?Pf(e.value):!1:Pf(e)}function Pf(e){return e.replace(qT,"")===""}class ls{constructor(t,r,n){this.normal=r,this.property=t,n&&(this.space=n)}}ls.prototype.normal={};ls.prototype.property={};ls.prototype.space=void 0;function G4(e,t){const r={},n={};for(const i of e)Object.assign(r,i.property),Object.assign(n,i.normal);return new ls(r,n,t)}function Yi(e){return e.toLowerCase()}class zr{constructor(t,r){this.attribute=r,this.property=t}}zr.prototype.attribute="";zr.prototype.booleanish=!1;zr.prototype.boolean=!1;zr.prototype.commaOrSpaceSeparated=!1;zr.prototype.commaSeparated=!1;zr.prototype.defined=!1;zr.prototype.mustUseProperty=!1;zr.prototype.number=!1;zr.prototype.overloadedBoolean=!1;zr.prototype.property="";zr.prototype.spaceSeparated=!1;zr.prototype.space=void 0;let HT=0;const Et=La(),or=La(),Hm=La(),Ne=La(),Kt=La(),ri=La(),Gr=La();function La(){return 2**++HT}const Wm=Object.freeze(Object.defineProperty({__proto__:null,boolean:Et,booleanish:or,commaOrSpaceSeparated:Gr,commaSeparated:ri,number:Ne,overloadedBoolean:Hm,spaceSeparated:Kt},Symbol.toStringTag,{value:"Module"})),il=Object.keys(Wm);class qh extends zr{constructor(t,r,n,i){let s=-1;if(super(t,r),Bf(this,"space",i),typeof n=="number")for(;++s<il.length;){const o=il[s];Bf(this,il[s],(n&Wm[o])===Wm[o])}}}qh.prototype.defined=!0;function Bf(e,t,r){r&&(e[t]=r)}function bi(e){const t={},r={};for(const[n,i]of Object.entries(e.properties)){const s=new qh(n,e.transform(e.attributes||{},n),i,e.space);e.mustUseProperty&&e.mustUseProperty.includes(n)&&(s.mustUseProperty=!0),t[n]=s,r[Yi(n)]=n,r[Yi(s.attribute)]=n}return new ls(t,r,e.space)}const H4=bi({properties:{ariaActiveDescendant:null,ariaAtomic:or,ariaAutoComplete:null,ariaBusy:or,ariaChecked:or,ariaColCount:Ne,ariaColIndex:Ne,ariaColSpan:Ne,ariaControls:Kt,ariaCurrent:null,ariaDescribedBy:Kt,ariaDetails:null,ariaDisabled:or,ariaDropEffect:Kt,ariaErrorMessage:null,ariaExpanded:or,ariaFlowTo:Kt,ariaGrabbed:or,ariaHasPopup:null,ariaHidden:or,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:Kt,ariaLevel:Ne,ariaLive:null,ariaModal:or,ariaMultiLine:or,ariaMultiSelectable:or,ariaOrientation:null,ariaOwns:Kt,ariaPlaceholder:null,ariaPosInSet:Ne,ariaPressed:or,ariaReadOnly:or,ariaRelevant:null,ariaRequired:or,ariaRoleDescription:Kt,ariaRowCount:Ne,ariaRowIndex:Ne,ariaRowSpan:Ne,ariaSelected:or,ariaSetSize:Ne,ariaSort:null,ariaValueMax:Ne,ariaValueMin:Ne,ariaValueNow:Ne,ariaValueText:null,role:null},transform(e,t){return t==="role"?t:"aria-"+t.slice(4).toLowerCase()}});function W4(e,t){return t in e?e[t]:t}function V4(e,t){return W4(e,t.toLowerCase())}const WT=bi({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:ri,acceptCharset:Kt,accessKey:Kt,action:null,allow:null,allowFullScreen:Et,allowPaymentRequest:Et,allowUserMedia:Et,alt:null,as:null,async:Et,autoCapitalize:null,autoComplete:Kt,autoFocus:Et,autoPlay:Et,blocking:Kt,capture:null,charSet:null,checked:Et,cite:null,className:Kt,cols:Ne,colSpan:null,content:null,contentEditable:or,controls:Et,controlsList:Kt,coords:Ne|ri,crossOrigin:null,data:null,dateTime:null,decoding:null,default:Et,defer:Et,dir:null,dirName:null,disabled:Et,download:Hm,draggable:or,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:Et,formTarget:null,headers:Kt,height:Ne,hidden:Hm,high:Ne,href:null,hrefLang:null,htmlFor:Kt,httpEquiv:Kt,id:null,imageSizes:null,imageSrcSet:null,inert:Et,inputMode:null,integrity:null,is:null,isMap:Et,itemId:null,itemProp:Kt,itemRef:Kt,itemScope:Et,itemType:Kt,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:Et,low:Ne,manifest:null,max:null,maxLength:Ne,media:null,method:null,min:null,minLength:Ne,multiple:Et,muted:Et,name:null,nonce:null,noModule:Et,noValidate:Et,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:Et,optimum:Ne,pattern:null,ping:Kt,placeholder:null,playsInline:Et,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:Et,referrerPolicy:null,rel:Kt,required:Et,reversed:Et,rows:Ne,rowSpan:Ne,sandbox:Kt,scope:null,scoped:Et,seamless:Et,selected:Et,shadowRootClonable:Et,shadowRootDelegatesFocus:Et,shadowRootMode:null,shape:null,size:Ne,sizes:null,slot:null,span:Ne,spellCheck:or,src:null,srcDoc:null,srcLang:null,srcSet:null,start:Ne,step:null,style:null,tabIndex:Ne,target:null,title:null,translate:null,type:null,typeMustMatch:Et,useMap:null,value:or,width:Ne,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:Kt,axis:null,background:null,bgColor:null,border:Ne,borderColor:null,bottomMargin:Ne,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:Et,declare:Et,event:null,face:null,frame:null,frameBorder:null,hSpace:Ne,leftMargin:Ne,link:null,longDesc:null,lowSrc:null,marginHeight:Ne,marginWidth:Ne,noResize:Et,noHref:Et,noShade:Et,noWrap:Et,object:null,profile:null,prompt:null,rev:null,rightMargin:Ne,rules:null,scheme:null,scrolling:or,standby:null,summary:null,text:null,topMargin:Ne,valueType:null,version:null,vAlign:null,vLink:null,vSpace:Ne,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:Et,disableRemotePlayback:Et,prefix:null,property:null,results:Ne,security:null,unselectable:null},space:"html",transform:V4}),VT=bi({attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",dominantBaseline:"dominant-baseline",enableBackground:"enable-background",fillOpacity:"fill-opacity",fillRule:"fill-rule",floodColor:"flood-color",floodOpacity:"flood-opacity",fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",renderingIntent:"rendering-intent",shapeRendering:"shape-rendering",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",strokeDashArray:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeLineCap:"stroke-linecap",strokeLineJoin:"stroke-linejoin",strokeMiterLimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",vectorEffect:"vector-effect",vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",wordSpacing:"word-spacing",writingMode:"writing-mode",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},properties:{about:Gr,accentHeight:Ne,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:Ne,amplitude:Ne,arabicForm:null,ascent:Ne,attributeName:null,attributeType:null,azimuth:Ne,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:Ne,by:null,calcMode:null,capHeight:Ne,className:Kt,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:Ne,diffuseConstant:Ne,direction:null,display:null,dur:null,divisor:Ne,dominantBaseline:null,download:Et,dx:null,dy:null,edgeMode:null,editable:null,elevation:Ne,enableBackground:null,end:null,event:null,exponent:Ne,externalResourcesRequired:null,fill:null,fillOpacity:Ne,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:ri,g2:ri,glyphName:ri,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:Ne,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:Ne,horizOriginX:Ne,horizOriginY:Ne,id:null,ideographic:Ne,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:Ne,k:Ne,k1:Ne,k2:Ne,k3:Ne,k4:Ne,kernelMatrix:Gr,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:Ne,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:Ne,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:Ne,overlineThickness:Ne,paintOrder:null,panose1:null,path:null,pathLength:Ne,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:Kt,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:Ne,pointsAtY:Ne,pointsAtZ:Ne,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:Gr,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:Gr,rev:Gr,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:Gr,requiredFeatures:Gr,requiredFonts:Gr,requiredFormats:Gr,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:Ne,specularExponent:Ne,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:Ne,strikethroughThickness:Ne,string:null,stroke:null,strokeDashArray:Gr,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:Ne,strokeOpacity:Ne,strokeWidth:null,style:null,surfaceScale:Ne,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:Gr,tabIndex:Ne,tableValues:null,target:null,targetX:Ne,targetY:Ne,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:Gr,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:Ne,underlineThickness:Ne,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:Ne,values:null,vAlphabetic:Ne,vMathematical:Ne,vectorEffect:null,vHanging:Ne,vIdeographic:Ne,version:null,vertAdvY:Ne,vertOriginX:Ne,vertOriginY:Ne,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:Ne,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:W4}),K4=bi({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform(e,t){return"xlink:"+t.slice(5).toLowerCase()}}),Y4=bi({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:V4}),X4=bi({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}}),KT={classId:"classID",dataType:"datatype",itemId:"itemID",strokeDashArray:"strokeDasharray",strokeDashOffset:"strokeDashoffset",strokeLineCap:"strokeLinecap",strokeLineJoin:"strokeLinejoin",strokeMiterLimit:"strokeMiterlimit",typeOf:"typeof",xLinkActuate:"xlinkActuate",xLinkArcRole:"xlinkArcrole",xLinkHref:"xlinkHref",xLinkRole:"xlinkRole",xLinkShow:"xlinkShow",xLinkTitle:"xlinkTitle",xLinkType:"xlinkType",xmlnsXLink:"xmlnsXlink"},YT=/[A-Z]/g,zf=/-[a-z]/g,XT=/^data[-\w.:]+$/i;function Z4(e,t){const r=Yi(t);let n=t,i=zr;if(r in e.normal)return e.property[e.normal[r]];if(r.length>4&&r.slice(0,4)==="data"&&XT.test(t)){if(t.charAt(4)==="-"){const s=t.slice(5).replace(zf,JT);n="data"+s.charAt(0).toUpperCase()+s.slice(1)}else{const s=t.slice(4);if(!zf.test(s)){let o=s.replace(YT,ZT);o.charAt(0)!=="-"&&(o="-"+o),t="data"+o}}i=qh}return new i(n,t)}function ZT(e){return"-"+e.toLowerCase()}function JT(e){return e.charAt(1).toUpperCase()}const J4=G4([H4,WT,K4,Y4,X4],"html"),Co=G4([H4,VT,K4,Y4,X4],"svg");function Uf(e){const t=String(e||"").trim();return t?t.split(/[ \t\n\r\f]+/g):[]}function QT(e){return e.join(" ").trim()}var Ha={},sl,$f;function eA(){if($f)return sl;$f=1;var e=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,t=/\n/g,r=/^\s*/,n=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,i=/^:\s*/,s=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,o=/^[;\s]*/,l=/^\s+|\s+$/g,c=`
|
|
414
|
+
*/var _f;function ET(){if(_f)return al;_f=1;var e=t5();function t(p,h){return p===h&&(p!==0||1/p===1/h)||p!==p&&h!==h}var r=typeof Object.is=="function"?Object.is:t,n=e.useState,i=e.useEffect,s=e.useLayoutEffect,o=e.useDebugValue;function l(p,h){var m=h(),g=n({inst:{value:m,getSnapshot:h}}),f=g[0].inst,w=g[1];return s(function(){f.value=m,f.getSnapshot=h,c(f)&&w({inst:f})},[p,m,h]),i(function(){return c(f)&&w({inst:f}),p(function(){c(f)&&w({inst:f})})},[p]),o(m),m}function c(p){var h=p.getSnapshot;p=p.value;try{var m=h();return!r(p,m)}catch{return!0}}function d(p,h){return h()}var u=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?d:l;return al.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:u,al}var Lf;function NT(){return Lf||(Lf=1,nl.exports=ET()),nl.exports}var CT=NT();const TT=(e,t)=>Ra(t)?t:mT(t)&&Ra(t.defaultValue)?t.defaultValue:Array.isArray(e)?e[e.length-1]:e,AT={t:TT,ready:!1},IT=()=>()=>{},Ht=(e,t={})=>{const{i18n:r}=t,{i18n:n,defaultNS:i}=x.useContext(F4)||{},s=r||n||kT();s&&!s.reportNamespaces&&(s.reportNamespaces=new ST),s||O4(s,"NO_I18NEXT_INSTANCE","useTranslation: You will need to pass in an i18next instance by using initReactI18next");const o=x.useMemo(()=>({...yT(),...s?.options?.react,...t}),[s,t]),{useSuspense:l,keyPrefix:c}=o,d=e||i||s?.options?.defaultNS,u=Ra(d)?[d]:d||["translation"],p=x.useMemo(()=>u,u);s?.reportNamespaces?.addUsedNamespaces?.(p);const h=x.useRef(0),m=x.useCallback(j=>{if(!s)return IT;const{bindI18n:T,bindI18nStore:P}=o,q=()=>{h.current+=1,j()};return T&&s.on(T,q),P&&s.store.on(P,q),()=>{T&&T.split(" ").forEach(D=>s.off(D,q)),P&&P.split(" ").forEach(D=>s.store.off(D,q))}},[s,o]),g=x.useRef(),f=x.useCallback(()=>{if(!s)return AT;const j=!!(s.isInitialized||s.initializedStoreOnce)&&p.every(U=>pT(U,s,o)),T=t.lng||s.language,P=h.current,q=g.current;if(q&&q.ready===j&&q.lng===T&&q.keyPrefix===c&&q.revision===P)return q;const z={t:s.getFixedT(T,o.nsMode==="fallback"?p:p[0],c),ready:j,lng:T,keyPrefix:c,revision:P};return g.current=z,z},[s,p,c,o,t.lng]),[w,S]=x.useState(0),{t:k,ready:E}=CT.useSyncExternalStore(m,f,f);x.useEffect(()=>{if(s&&!E&&!l){const j=()=>S(T=>T+1);t.lng?jf(s,t.lng,p,j):qm(s,p,j)}},[s,t.lng,p,E,l,w]);const N=s||{},C=x.useRef(null),v=x.useRef(),I=j=>{const T=Object.getOwnPropertyDescriptors(j);T.__original&&delete T.__original;const P=Object.create(Object.getPrototypeOf(j),T);if(!Object.prototype.hasOwnProperty.call(P,"__original"))try{Object.defineProperty(P,"__original",{value:j,writable:!1,enumerable:!1,configurable:!1})}catch{}return P},M=x.useMemo(()=>{const j=N,T=j?.language;let P=j;j&&(C.current&&C.current.__original===j?v.current!==T?(P=I(j),C.current=P,v.current=T):P=C.current:(P=I(j),C.current=P,v.current=T));const q=[k,P,E];return q.t=k,q.i18n=P,q.ready=E,q},[k,N,E,N.resolvedLanguage,N.language,N.languages]);if(s&&l&&!E)throw new Promise(j=>{const T=()=>j();t.lng?jf(s,t.lng,p,T):qm(s,p,T)});return M};function RT({i18n:e,defaultNS:t,children:r}){const n=x.useMemo(()=>({i18n:e,defaultNS:t}),[e,t]);return x.createElement(F4.Provider,{value:n},r)}const nn=({className:e="w-5 h-5"})=>a.jsx("img",{src:"/icons/claude-ai-icon.svg",alt:"Claude",className:e}),P4=x.createContext(),as=()=>{const e=x.useContext(P4);if(!e)throw new Error("useTheme must be used within a ThemeProvider");return e},jT=({children:e})=>{const[t,r]=x.useState(()=>{const s=localStorage.getItem("theme");return s?s==="dark":window.matchMedia?window.matchMedia("(prefers-color-scheme: dark)").matches:!1});x.useEffect(()=>{if(t){document.documentElement.classList.add("dark"),localStorage.setItem("theme","dark");const s=document.querySelector('meta[name="apple-mobile-web-app-status-bar-style"]');s&&s.setAttribute("content","black-translucent");const o=document.querySelector('meta[name="theme-color"]');o&&o.setAttribute("content","#0c1117")}else{document.documentElement.classList.remove("dark"),localStorage.setItem("theme","light");const s=document.querySelector('meta[name="apple-mobile-web-app-status-bar-style"]');s&&s.setAttribute("content","default");const o=document.querySelector('meta[name="theme-color"]');o&&o.setAttribute("content","#ffffff")}},[t]),x.useEffect(()=>{if(!window.matchMedia)return;const s=window.matchMedia("(prefers-color-scheme: dark)"),o=l=>{localStorage.getItem("theme")||r(l.matches)};return s.addEventListener("change",o),()=>s.removeEventListener("change",o)},[]);const i={isDarkMode:t,toggleDarkMode:()=>{r(s=>!s)}};return a.jsx(P4.Provider,{value:i,children:e})},pn=({className:e="w-5 h-5"})=>{const{isDarkMode:t}=as();return a.jsx("img",{src:t?"/icons/cursor-white.svg":"/icons/cursor.svg",alt:"Cursor",className:e})},wn=({className:e="w-5 h-5"})=>{const{isDarkMode:t}=as();return a.jsx("img",{src:t?"/icons/codex-white.svg":"/icons/codex.svg",alt:"Codex",className:e})},_T=({status:e="not-configured",size:t="sm",className:r="",showLabel:n=!1})=>{const s=(()=>{switch(e){case"fully-configured":return{icon:ns,color:"text-green-500 dark:text-green-400",bgColor:"bg-green-50 dark:bg-green-950",label:"TaskMaster Ready",title:"TaskMaster fully configured with MCP server"};case"taskmaster-only":return{icon:Ia,color:"text-blue-500 dark:text-blue-400",bgColor:"bg-blue-50 dark:bg-blue-950",label:"TaskMaster Init",title:"TaskMaster initialized, MCP server needs setup"};case"mcp-only":return{icon:So,color:"text-amber-500 dark:text-amber-400",bgColor:"bg-amber-50 dark:bg-amber-950",label:"MCP Ready",title:"MCP server configured, TaskMaster needs initialization"};case"not-configured":case"error":default:return{icon:Bt,color:"text-gray-400 dark:text-gray-500",bgColor:"bg-gray-50 dark:bg-gray-900",label:"No TaskMaster",title:"TaskMaster not configured"}}})(),o=s.icon,l={xs:"w-3 h-3",sm:"w-4 h-4",md:"w-5 h-5",lg:"w-6 h-6"},c={xs:"p-0.5",sm:"p-1",md:"p-1.5",lg:"p-2"};return n?a.jsxs("div",{className:Ze("inline-flex items-center gap-1.5 text-xs rounded-md px-2 py-1 transition-colors",s.bgColor,s.color,r),title:s.title,children:[a.jsx(o,{className:l[t]}),a.jsx("span",{className:"font-medium",children:s.label})]}):a.jsx("div",{className:Ze("inline-flex items-center justify-center rounded-full transition-colors",s.bgColor,c[t],r),title:s.title,children:a.jsx(o,{className:Ze(l[t],s.color)})})},Ce=(e,t={})=>{const r=localStorage.getItem("auth-token"),n={};return t.body instanceof FormData||(n["Content-Type"]="application/json"),r&&(n.Authorization=`Bearer ${r}`),fetch(e,{...t,headers:{...n,...t.headers}})},yt={auth:{status:()=>fetch("/api/auth/status"),login:(e,t)=>fetch("/api/auth/login",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({username:e,password:t})}),register:(e,t)=>fetch("/api/auth/register",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({username:e,password:t})}),user:()=>Ce("/api/auth/user"),logout:()=>Ce("/api/auth/logout",{method:"POST"})},projects:()=>Ce("/api/projects"),sessions:(e,t=5,r=0)=>Ce(`/api/projects/${e}/sessions?limit=${t}&offset=${r}`),sessionMessages:(e,t,r=null,n=0,i="claude")=>{const s=new URLSearchParams;r!==null&&(s.append("limit",r),s.append("offset",n));const o=s.toString();let l;return i==="codex"?l=`/api/codex/sessions/${t}/messages${o?`?${o}`:""}`:i==="cursor"?l=`/api/cursor/sessions/${t}/messages${o?`?${o}`:""}`:l=`/api/projects/${e}/sessions/${t}/messages${o?`?${o}`:""}`,Ce(l)},renameProject:(e,t)=>Ce(`/api/projects/${e}/rename`,{method:"PUT",body:JSON.stringify({displayName:t})}),deleteSession:(e,t)=>Ce(`/api/projects/${e}/sessions/${t}`,{method:"DELETE"}),deleteCodexSession:e=>Ce(`/api/codex/sessions/${e}`,{method:"DELETE"}),deleteProject:(e,t=!1)=>Ce(`/api/projects/${e}${t?"?force=true":""}`,{method:"DELETE"}),createProject:e=>Ce("/api/projects/create",{method:"POST",body:JSON.stringify({path:e})}),createWorkspace:e=>Ce("/api/projects/create-workspace",{method:"POST",body:JSON.stringify(e)}),readFile:(e,t)=>Ce(`/api/projects/${e}/file?filePath=${encodeURIComponent(t)}`),saveFile:(e,t,r)=>Ce(`/api/projects/${e}/file`,{method:"PUT",body:JSON.stringify({filePath:t,content:r})}),getFiles:e=>Ce(`/api/projects/${e}/files`),transcribe:e=>Ce("/api/transcribe",{method:"POST",body:e,headers:{}}),taskmaster:{init:e=>Ce(`/api/taskmaster/init/${e}`,{method:"POST"}),addTask:(e,{prompt:t,title:r,description:n,priority:i,dependencies:s})=>Ce(`/api/taskmaster/add-task/${e}`,{method:"POST",body:JSON.stringify({prompt:t,title:r,description:n,priority:i,dependencies:s})}),parsePRD:(e,{fileName:t,numTasks:r,append:n})=>Ce(`/api/taskmaster/parse-prd/${e}`,{method:"POST",body:JSON.stringify({fileName:t,numTasks:r,append:n})}),getTemplates:()=>Ce("/api/taskmaster/prd-templates"),applyTemplate:(e,{templateId:t,fileName:r,customizations:n})=>Ce(`/api/taskmaster/apply-template/${e}`,{method:"POST",body:JSON.stringify({templateId:t,fileName:r,customizations:n})}),updateTask:(e,t,r)=>Ce(`/api/taskmaster/update-task/${e}/${t}`,{method:"PUT",body:JSON.stringify(r)})},browseFilesystem:(e=null)=>{const t=new URLSearchParams;return e&&t.append("path",e),Ce(`/api/browse-filesystem?${t}`)},createFolder:e=>Ce("/api/create-folder",{method:"POST",body:JSON.stringify({path:e})}),user:{gitConfig:()=>Ce("/api/user/git-config"),updateGitConfig:(e,t)=>Ce("/api/user/git-config",{method:"POST",body:JSON.stringify({gitName:e,gitEmail:t})}),onboardingStatus:()=>Ce("/api/user/onboarding-status"),completeOnboarding:()=>Ce("/api/user/complete-onboarding",{method:"POST"})},get:e=>Ce(`/api${e}`)},LT=({onClose:e,onProjectCreated:t})=>{const{t:r}=Ht(),[n,i]=x.useState(1),[s,o]=x.useState("existing"),[l,c]=x.useState(""),[d,u]=x.useState(""),[p,h]=x.useState(""),[m,g]=x.useState("stored"),[f,w]=x.useState(""),[S,k]=x.useState(!1),[E,N]=x.useState(null),[C,v]=x.useState([]),[I,M]=x.useState(!1),[j,T]=x.useState([]),[P,q]=x.useState(!1),[D,z]=x.useState(!1),[U,G]=x.useState("~"),[re,K]=x.useState([]),[ue,R]=x.useState(!1),[F,te]=x.useState(!1),[_,Z]=x.useState(!1),[me,ke]=x.useState(""),[se,_e]=x.useState(!1),[oe,fe]=x.useState("");x.useEffect(()=>{n===2&&s==="new"&&d&&Ie()},[n,s,d]),x.useEffect(()=>{l.length>2?qe(l):(T([]),q(!1))},[l]);const Ie=async()=>{try{M(!0);const ce=((await(await yt.get("/settings/credentials?type=github_token")).json()).credentials||[]).filter(Ee=>Ee.is_active);v(ce),ce.length>0&&!p&&h(ce[0].id.toString())}catch(xe){console.error("Error loading GitHub tokens:",xe)}finally{M(!1)}},qe=async xe=>{try{const at=xe.lastIndexOf("/"),ce=at>0?xe.substring(0,at):"~",H=await(await yt.browseFilesystem(ce)).json();if(H.suggestions){const Y=H.suggestions.filter(le=>le.path.toLowerCase().startsWith(xe.toLowerCase())&&le.path.toLowerCase()!==xe.toLowerCase());T(Y.slice(0,5)),q(Y.length>0)}}catch(at){console.error("Error loading path suggestions:",at)}},ze=()=>{if(N(null),n===1){if(!s){N(r("projectWizard.errors.selectType"));return}i(2)}else if(n===2){if(!l.trim()){N(r("projectWizard.errors.providePath"));return}i(3)}},ct=()=>{N(null),i(n-1)},Ye=async()=>{k(!0),N(null),fe("");try{if(s==="new"&&d){const Ee=new URLSearchParams({path:l.trim(),githubUrl:d.trim()});m==="stored"&&p?Ee.append("githubTokenId",p):m==="new"&&f&&Ee.append("newGithubToken",f.trim());const H=localStorage.getItem("auth-token"),Y=`/api/projects/clone-progress?${Ee}${H?`&token=${H}`:""}`;await new Promise((le,ve)=>{const Ve=new EventSource(Y);Ve.onmessage=It=>{try{const ft=JSON.parse(It.data);ft.type==="progress"?fe(ft.message):ft.type==="complete"?(Ve.close(),t&&t(ft.project),e(),le()):ft.type==="error"&&(Ve.close(),ve(new Error(ft.message)))}catch(ft){console.error("Error parsing SSE event:",ft)}},Ve.onerror=()=>{Ve.close(),ve(new Error("Connection lost during clone"))}});return}const xe={workspaceType:s,path:l.trim()},at=await yt.createWorkspace(xe),ce=await at.json();if(!at.ok)throw new Error(ce.details||ce.error||r("projectWizard.errors.failedToCreate"));t&&t(ce.project),e()}catch(xe){console.error("Error creating workspace:",xe),N(xe.message||r("projectWizard.errors.failedToCreate"))}finally{k(!1)}},wt=xe=>{c(xe.path),q(!1)},gt=async()=>{z(!0),await et("~")},et=async xe=>{try{R(!0);const ce=await(await yt.browseFilesystem(xe)).json();G(ce.path||xe),K(ce.suggestions||[])}catch(at){console.error("Error loading folders:",at)}finally{R(!1)}},Me=(xe,at=!1)=>{c(xe),z(!1),at&&i(3)},mt=async xe=>{await et(xe)},Pt=async()=>{if(me.trim()){_e(!0),N(null);try{const xe=U.includes("\\")?"\\":"/",at=`${U}${xe}${me.trim()}`,ce=await yt.createFolder(at),Ee=await ce.json();if(!ce.ok)throw new Error(Ee.error||r("projectWizard.errors.failedToCreateFolder","Failed to create folder"));ke(""),Z(!1),await et(Ee.path||at)}catch(xe){console.error("Error creating folder:",xe),N(xe.message||r("projectWizard.errors.failedToCreateFolder","Failed to create folder"))}finally{_e(!1)}}};return a.jsxs("div",{className:"fixed top-0 left-0 right-0 bottom-0 bg-black/50 backdrop-blur-sm flex items-center justify-center z-[60] p-0 sm:p-4",children:[a.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-none sm:rounded-lg shadow-xl w-full h-full sm:h-auto sm:max-w-2xl border-0 sm:border border-gray-200 dark:border-gray-700 overflow-y-auto",children:[a.jsxs("div",{className:"flex items-center justify-between p-6 border-b border-gray-200 dark:border-gray-700",children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("div",{className:"w-8 h-8 bg-blue-100 dark:bg-blue-900/50 rounded-lg flex items-center justify-center",children:a.jsx(Pi,{className:"w-4 h-4 text-blue-600 dark:text-blue-400"})}),a.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white",children:r("projectWizard.title")})]}),a.jsx("button",{onClick:e,className:"p-2 text-gray-400 hover:text-gray-600 dark:hover:text-gray-300 rounded-md hover:bg-gray-100 dark:hover:bg-gray-700",disabled:S,children:a.jsx(Bt,{className:"w-5 h-5"})})]}),a.jsx("div",{className:"px-6 pt-4 pb-2",children:a.jsx("div",{className:"flex items-center justify-between",children:[1,2,3].map(xe=>a.jsxs(ir.Fragment,{children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("div",{className:`w-8 h-8 rounded-full flex items-center justify-center font-medium text-sm ${xe<n?"bg-green-500 text-white":xe===n?"bg-blue-500 text-white":"bg-gray-200 dark:bg-gray-700 text-gray-500"}`,children:xe<n?a.jsx(Cr,{className:"w-4 h-4"}):xe}),a.jsx("span",{className:"text-sm font-medium text-gray-700 dark:text-gray-300 hidden sm:inline",children:r(xe===1?"projectWizard.steps.type":xe===2?"projectWizard.steps.configure":"projectWizard.steps.confirm")})]}),xe<3&&a.jsx("div",{className:`flex-1 h-1 mx-2 rounded ${xe<n?"bg-green-500":"bg-gray-200 dark:bg-gray-700"}`})]},xe))})}),a.jsxs("div",{className:"p-6 space-y-6 min-h-[300px]",children:[E&&a.jsxs("div",{className:"bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800 rounded-lg p-4 flex items-start gap-3",children:[a.jsx(So,{className:"w-5 h-5 text-red-600 dark:text-red-400 flex-shrink-0 mt-0.5"}),a.jsx("div",{className:"flex-1",children:a.jsx("p",{className:"text-sm text-red-800 dark:text-red-200",children:E})})]}),n===1&&a.jsx("div",{className:"space-y-4",children:a.jsxs("div",{children:[a.jsx("h4",{className:"text-sm font-medium text-gray-700 dark:text-gray-300 mb-3",children:r("projectWizard.step1.question")}),a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[a.jsx("button",{onClick:()=>o("existing"),className:`p-4 border-2 rounded-lg text-left transition-all ${s==="existing"?"border-blue-500 bg-blue-50 dark:bg-blue-900/20":"border-gray-200 dark:border-gray-700 hover:border-gray-300 dark:hover:border-gray-600"}`,children:a.jsxs("div",{className:"flex items-start gap-3",children:[a.jsx("div",{className:"w-10 h-10 bg-green-100 dark:bg-green-900/50 rounded-lg flex items-center justify-center flex-shrink-0",children:a.jsx(Pi,{className:"w-5 h-5 text-green-600 dark:text-green-400"})}),a.jsxs("div",{className:"flex-1",children:[a.jsx("h5",{className:"font-semibold text-gray-900 dark:text-white mb-1",children:r("projectWizard.step1.existing.title")}),a.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400",children:r("projectWizard.step1.existing.description")})]})]})}),a.jsx("button",{onClick:()=>o("new"),className:`p-4 border-2 rounded-lg text-left transition-all ${s==="new"?"border-blue-500 bg-blue-50 dark:bg-blue-900/20":"border-gray-200 dark:border-gray-700 hover:border-gray-300 dark:hover:border-gray-600"}`,children:a.jsxs("div",{className:"flex items-start gap-3",children:[a.jsx("div",{className:"w-10 h-10 bg-purple-100 dark:bg-purple-900/50 rounded-lg flex items-center justify-center flex-shrink-0",children:a.jsx(qn,{className:"w-5 h-5 text-purple-600 dark:text-purple-400"})}),a.jsxs("div",{className:"flex-1",children:[a.jsx("h5",{className:"font-semibold text-gray-900 dark:text-white mb-1",children:r("projectWizard.step1.new.title")}),a.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400",children:r("projectWizard.step1.new.description")})]})]})})]})]})}),n===2&&a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{children:[a.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:r(s==="existing"?"projectWizard.step2.existingPath":"projectWizard.step2.newPath")}),a.jsxs("div",{className:"relative flex gap-2",children:[a.jsxs("div",{className:"flex-1 relative",children:[a.jsx(tr,{type:"text",value:l,onChange:xe=>c(xe.target.value),placeholder:s==="existing"?"/path/to/existing/workspace":"/path/to/new/workspace",className:"w-full"}),P&&j.length>0&&a.jsx("div",{className:"absolute z-10 w-full mt-1 bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg shadow-lg max-h-60 overflow-y-auto",children:j.map((xe,at)=>a.jsxs("button",{onClick:()=>wt(xe),className:"w-full px-4 py-2 text-left hover:bg-gray-100 dark:hover:bg-gray-700 text-sm",children:[a.jsx("div",{className:"font-medium text-gray-900 dark:text-white",children:xe.name}),a.jsx("div",{className:"text-xs text-gray-500 dark:text-gray-400",children:xe.path})]},at))})]}),a.jsx(Be,{type:"button",variant:"outline",onClick:gt,className:"px-3",title:"Browse folders",children:a.jsx(Tn,{className:"w-4 h-4"})})]}),a.jsx("p",{className:"mt-1 text-xs text-gray-500 dark:text-gray-400",children:r(s==="existing"?"projectWizard.step2.existingHelp":"projectWizard.step2.newHelp")})]}),s==="new"&&a.jsxs(a.Fragment,{children:[a.jsxs("div",{children:[a.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:r("projectWizard.step2.githubUrl")}),a.jsx(tr,{type:"text",value:d,onChange:xe=>u(xe.target.value),placeholder:"https://github.com/username/repository",className:"w-full"}),a.jsx("p",{className:"mt-1 text-xs text-gray-500 dark:text-gray-400",children:r("projectWizard.step2.githubHelp")})]}),d&&!d.startsWith("git@")&&!d.startsWith("ssh://")&&a.jsxs("div",{className:"bg-gray-50 dark:bg-gray-900/50 rounded-lg p-4 border border-gray-200 dark:border-gray-700",children:[a.jsxs("div",{className:"flex items-start gap-3 mb-4",children:[a.jsx(Fh,{className:"w-5 h-5 text-gray-600 dark:text-gray-400 flex-shrink-0 mt-0.5"}),a.jsxs("div",{className:"flex-1",children:[a.jsx("h5",{className:"font-medium text-gray-900 dark:text-white mb-1",children:r("projectWizard.step2.githubAuth")}),a.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400",children:r("projectWizard.step2.githubAuthHelp")})]})]}),I?a.jsxs("div",{className:"flex items-center gap-2 text-sm text-gray-500",children:[a.jsx(Ta,{className:"w-4 h-4 animate-spin"}),r("projectWizard.step2.loadingTokens")]}):C.length>0?a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"grid grid-cols-3 gap-2 mb-4",children:[a.jsx("button",{onClick:()=>g("stored"),className:`px-3 py-2 text-sm font-medium rounded-lg transition-colors ${m==="stored"?"bg-blue-500 text-white":"bg-gray-200 dark:bg-gray-700 text-gray-700 dark:text-gray-300"}`,children:r("projectWizard.step2.storedToken")}),a.jsx("button",{onClick:()=>g("new"),className:`px-3 py-2 text-sm font-medium rounded-lg transition-colors ${m==="new"?"bg-blue-500 text-white":"bg-gray-200 dark:bg-gray-700 text-gray-700 dark:text-gray-300"}`,children:r("projectWizard.step2.newToken")}),a.jsx("button",{onClick:()=>{g("none"),h(""),w("")},className:`px-3 py-2 text-sm font-medium rounded-lg transition-colors ${m==="none"?"bg-green-500 text-white":"bg-gray-200 dark:bg-gray-700 text-gray-700 dark:text-gray-300"}`,children:r("projectWizard.step2.nonePublic")})]}),m==="stored"?a.jsxs("div",{children:[a.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:r("projectWizard.step2.selectToken")}),a.jsxs("select",{value:p,onChange:xe=>h(xe.target.value),className:"w-full px-3 py-2 bg-white dark:bg-gray-800 border border-gray-300 dark:border-gray-600 rounded-lg text-sm",children:[a.jsx("option",{value:"",children:r("projectWizard.step2.selectTokenPlaceholder")}),C.map(xe=>a.jsx("option",{value:xe.id,children:xe.credential_name},xe.id))]})]}):m==="new"?a.jsxs("div",{children:[a.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:r("projectWizard.step2.newToken")}),a.jsx(tr,{type:"password",value:f,onChange:xe=>w(xe.target.value),placeholder:"ghp_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",className:"w-full"}),a.jsx("p",{className:"mt-1 text-xs text-gray-500 dark:text-gray-400",children:r("projectWizard.step2.tokenHelp")})]}):null]}):a.jsxs("div",{className:"space-y-4",children:[a.jsx("div",{className:"bg-blue-50 dark:bg-blue-900/20 rounded-lg p-3 border border-blue-200 dark:border-blue-800",children:a.jsx("p",{className:"text-sm text-blue-800 dark:text-blue-200",children:r("projectWizard.step2.publicRepoInfo")})}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:r("projectWizard.step2.optionalTokenPublic")}),a.jsx(tr,{type:"password",value:f,onChange:xe=>w(xe.target.value),placeholder:r("projectWizard.step2.tokenPublicPlaceholder"),className:"w-full"}),a.jsx("p",{className:"mt-1 text-xs text-gray-500 dark:text-gray-400",children:r("projectWizard.step2.noTokensHelp")})]})]})]})]})]}),n===3&&a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"bg-gray-50 dark:bg-gray-900/50 rounded-lg p-4 border border-gray-200 dark:border-gray-700",children:[a.jsx("h4",{className:"text-sm font-semibold text-gray-900 dark:text-white mb-3",children:r("projectWizard.step3.reviewConfig")}),a.jsxs("div",{className:"space-y-2",children:[a.jsxs("div",{className:"flex justify-between text-sm",children:[a.jsx("span",{className:"text-gray-600 dark:text-gray-400",children:r("projectWizard.step3.workspaceType")}),a.jsx("span",{className:"font-medium text-gray-900 dark:text-white",children:r(s==="existing"?"projectWizard.step3.existingWorkspace":"projectWizard.step3.newWorkspace")})]}),a.jsxs("div",{className:"flex justify-between text-sm",children:[a.jsx("span",{className:"text-gray-600 dark:text-gray-400",children:r("projectWizard.step3.path")}),a.jsx("span",{className:"font-mono text-xs text-gray-900 dark:text-white break-all",children:l})]}),s==="new"&&d&&a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"flex justify-between text-sm",children:[a.jsx("span",{className:"text-gray-600 dark:text-gray-400",children:r("projectWizard.step3.cloneFrom")}),a.jsx("span",{className:"font-mono text-xs text-gray-900 dark:text-white break-all",children:d})]}),a.jsxs("div",{className:"flex justify-between text-sm",children:[a.jsx("span",{className:"text-gray-600 dark:text-gray-400",children:r("projectWizard.step3.authentication")}),a.jsx("span",{className:"text-xs text-gray-900 dark:text-white",children:m==="stored"&&p?`${r("projectWizard.step3.usingStoredToken")} ${C.find(xe=>xe.id.toString()===p)?.credential_name||"Unknown"}`:m==="new"&&f?r("projectWizard.step3.usingProvidedToken"):d.startsWith("git@")||d.startsWith("ssh://")?r("projectWizard.step3.sshKey","SSH Key"):r("projectWizard.step3.noAuthentication")})]})]})]})]}),a.jsx("div",{className:"bg-blue-50 dark:bg-blue-900/20 rounded-lg p-4 border border-blue-200 dark:border-blue-800",children:S&&oe?a.jsxs("div",{className:"space-y-2",children:[a.jsx("p",{className:"text-sm font-medium text-blue-800 dark:text-blue-200",children:r("projectWizard.step3.cloningRepository","Cloning repository...")}),a.jsx("code",{className:"block text-xs font-mono text-blue-700 dark:text-blue-300 whitespace-pre-wrap break-all",children:oe})]}):a.jsx("p",{className:"text-sm text-blue-800 dark:text-blue-200",children:r(s==="existing"?"projectWizard.step3.existingInfo":d?"projectWizard.step3.newWithClone":"projectWizard.step3.newEmpty")})})]})]}),a.jsxs("div",{className:"flex items-center justify-between p-6 border-t border-gray-200 dark:border-gray-700",children:[a.jsx(Be,{variant:"outline",onClick:n===1?e:ct,disabled:S,children:n===1?r("projectWizard.buttons.cancel"):a.jsxs(a.Fragment,{children:[a.jsx(Mh,{className:"w-4 h-4 mr-1"}),r("projectWizard.buttons.back")]})}),a.jsx(Be,{onClick:n===3?Ye:ze,disabled:S||n===1&&!s,children:S?a.jsxs(a.Fragment,{children:[a.jsx(Ta,{className:"w-4 h-4 mr-2 animate-spin"}),d?r("projectWizard.buttons.cloning","Cloning..."):r("projectWizard.buttons.creating")]}):n===3?a.jsxs(a.Fragment,{children:[a.jsx(Cr,{className:"w-4 h-4 mr-1"}),r("projectWizard.buttons.createProject")]}):a.jsxs(a.Fragment,{children:[r("projectWizard.buttons.next"),a.jsx(Cn,{className:"w-4 h-4 ml-1"})]})})]})]}),D&&a.jsx("div",{className:"fixed inset-0 bg-black/50 backdrop-blur-sm flex items-center justify-center z-[70] p-4",children:a.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow-xl w-full max-w-2xl max-h-[80vh] border border-gray-200 dark:border-gray-700 flex flex-col",children:[a.jsxs("div",{className:"flex items-center justify-between p-4 border-b border-gray-200 dark:border-gray-700",children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("div",{className:"w-8 h-8 bg-blue-100 dark:bg-blue-900/50 rounded-lg flex items-center justify-center",children:a.jsx(Tn,{className:"w-4 h-4 text-blue-600 dark:text-blue-400"})}),a.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white",children:"Select Folder"})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("button",{onClick:()=>te(!F),className:`p-2 rounded-md transition-colors ${F?"text-blue-600 dark:text-blue-400 bg-blue-50 dark:bg-blue-900/30":"text-gray-400 hover:text-gray-600 dark:hover:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700"}`,title:F?"Hide hidden folders":"Show hidden folders",children:F?a.jsx(hi,{className:"w-5 h-5"}):a.jsx(p4,{className:"w-5 h-5"})}),a.jsx("button",{onClick:()=>Z(!_),className:`p-2 rounded-md transition-colors ${_?"text-blue-600 dark:text-blue-400 bg-blue-50 dark:bg-blue-900/30":"text-gray-400 hover:text-gray-600 dark:hover:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700"}`,title:"Create new folder",children:a.jsx(gr,{className:"w-5 h-5"})}),a.jsx("button",{onClick:()=>z(!1),className:"p-2 text-gray-400 hover:text-gray-600 dark:hover:text-gray-300 rounded-md hover:bg-gray-100 dark:hover:bg-gray-700",children:a.jsx(Bt,{className:"w-5 h-5"})})]})]}),_&&a.jsx("div",{className:"px-4 py-3 border-b border-gray-200 dark:border-gray-700 bg-blue-50 dark:bg-blue-900/20",children:a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(tr,{type:"text",value:me,onChange:xe=>ke(xe.target.value),placeholder:"New folder name",className:"flex-1",onKeyDown:xe=>{xe.key==="Enter"&&Pt(),xe.key==="Escape"&&(Z(!1),ke(""))},autoFocus:!0}),a.jsx(Be,{size:"sm",onClick:Pt,disabled:!me.trim()||se,children:se?a.jsx(Ta,{className:"w-4 h-4 animate-spin"}):"Create"}),a.jsx(Be,{size:"sm",variant:"ghost",onClick:()=>{Z(!1),ke("")},children:"Cancel"})]})}),a.jsx("div",{className:"flex-1 overflow-y-auto p-4",children:ue?a.jsx("div",{className:"flex items-center justify-center py-8",children:a.jsx(Ta,{className:"w-6 h-6 animate-spin text-gray-400"})}):a.jsxs("div",{className:"space-y-1",children:[U!=="~"&&U!=="/"&&!/^[A-Za-z]:\\?$/.test(U)&&a.jsxs("button",{onClick:()=>{const xe=Math.max(U.lastIndexOf("/"),U.lastIndexOf("\\"));let at;xe<=0?at="/":xe===2&&/^[A-Za-z]:/.test(U)?at=U.substring(0,3):at=U.substring(0,xe),mt(at)},className:"w-full px-4 py-3 text-left hover:bg-gray-100 dark:hover:bg-gray-700 rounded-lg flex items-center gap-3",children:[a.jsx(Tn,{className:"w-5 h-5 text-gray-400"}),a.jsx("span",{className:"font-medium text-gray-700 dark:text-gray-300",children:".."})]}),re.length===0?a.jsx("div",{className:"text-center py-8 text-gray-500 dark:text-gray-400",children:"No subfolders found"}):re.filter(xe=>F||!xe.name.startsWith(".")).sort((xe,at)=>xe.name.toLowerCase().localeCompare(at.name.toLowerCase())).map((xe,at)=>a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsxs("button",{onClick:()=>mt(xe.path),className:"flex-1 px-4 py-3 text-left hover:bg-gray-100 dark:hover:bg-gray-700 rounded-lg flex items-center gap-3",children:[a.jsx(Pi,{className:"w-5 h-5 text-blue-500"}),a.jsx("span",{className:"font-medium text-gray-900 dark:text-white",children:xe.name})]}),a.jsx(Be,{variant:"ghost",size:"sm",onClick:()=>Me(xe.path,s==="existing"),className:"text-xs px-3",children:"Select"})]},at))]})}),a.jsxs("div",{className:"border-t border-gray-200 dark:border-gray-700",children:[a.jsxs("div",{className:"px-4 py-3 bg-gray-50 dark:bg-gray-900/50 flex items-center gap-2",children:[a.jsx("span",{className:"text-sm text-gray-600 dark:text-gray-400",children:"Path:"}),a.jsx("code",{className:"text-sm font-mono text-gray-900 dark:text-white flex-1 truncate",children:U})]}),a.jsxs("div",{className:"flex items-center justify-end gap-2 p-4",children:[a.jsx(Be,{variant:"outline",onClick:()=>{z(!1),Z(!1),ke("")},children:"Cancel"}),a.jsx(Be,{variant:"outline",onClick:()=>Me(U,s==="existing"),children:"Use this folder"})]})]})]})})]})},B4=x.createContext({user:null,token:null,login:()=>{},register:()=>{},logout:()=>{},isLoading:!0,needsSetup:!1,hasCompletedOnboarding:!0,refreshOnboardingStatus:()=>{},error:null}),is=()=>{const e=x.useContext(B4);if(!e)throw new Error("useAuth must be used within an AuthProvider");return e},OT=({children:e})=>{const[t,r]=x.useState(null),[n,i]=x.useState(localStorage.getItem("auth-token")),[s,o]=x.useState(!0),[l,c]=x.useState(!1),[d,u]=x.useState(!0),[p,h]=x.useState(null);x.useEffect(()=>{f()},[]);const m=async()=>{try{const N=await yt.user.onboardingStatus();if(N.ok){const C=await N.json();u(C.hasCompletedOnboarding)}}catch(N){console.error("Error checking onboarding status:",N),u(!0)}},g=async()=>{await m()},f=async()=>{try{if(o(!0),h(null),(await(await yt.auth.status()).json()).needsSetup){c(!0),o(!1);return}if(n)try{const v=await yt.auth.user();if(v.ok){const I=await v.json();r(I.user),c(!1),await m()}else localStorage.removeItem("auth-token"),i(null),r(null)}catch(v){console.error("Token verification failed:",v),localStorage.removeItem("auth-token"),i(null),r(null)}}catch(N){console.error("[AuthContext] Auth status check failed:",N),h("Failed to check authentication status")}finally{o(!1)}},E={user:t,token:n,login:async(N,C)=>{try{h(null);const v=await yt.auth.login(N,C),I=await v.json();return v.ok?(i(I.token),r(I.user),localStorage.setItem("auth-token",I.token),{success:!0}):(h(I.error||"Login failed"),{success:!1,error:I.error||"Login failed"})}catch(v){console.error("Login error:",v);const I="Network error. Please try again.";return h(I),{success:!1,error:I}}},register:async(N,C)=>{try{h(null);const v=await yt.auth.register(N,C),I=await v.json();return v.ok?(i(I.token),r(I.user),c(!1),localStorage.setItem("auth-token",I.token),{success:!0}):(h(I.error||"Registration failed"),{success:!1,error:I.error||"Registration failed"})}catch(v){console.error("Registration error:",v);const I="Network error. Please try again.";return h(I),{success:!1,error:I}}},logout:()=>{i(null),r(null),localStorage.removeItem("auth-token"),n&&yt.auth.logout().catch(N=>{console.error("Logout endpoint error:",N)})},isLoading:s,needsSetup:l,hasCompletedOnboarding:d,refreshOnboardingStatus:g,error:p};return a.jsx(B4.Provider,{value:E,children:e})};function DT(){const[e,t]=x.useState(null),[r,n]=x.useState([]),[i,s]=x.useState(!1),o=x.useRef(null);x.useEffect(()=>(l(),()=>{o.current&&clearTimeout(o.current),e&&e.close()}),[]);const l=async()=>{try{let u;{const h=localStorage.getItem("auth-token");if(!h){console.warn("No authentication token found for WebSocket connection");return}u=`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}/ws?token=${encodeURIComponent(h)}`}const p=new WebSocket(u);p.onopen=()=>{s(!0),t(p)},p.onmessage=h=>{try{const m=JSON.parse(h.data);n(g=>[...g,m])}catch(m){console.error("Error parsing WebSocket message:",m)}},p.onclose=()=>{s(!1),t(null),o.current=setTimeout(()=>{l()},3e3)},p.onerror=h=>{console.error("WebSocket error:",h)}}catch(d){console.error("Error creating WebSocket connection:",d)}};return{ws:e,sendMessage:d=>{e&&i?e.send(JSON.stringify(d)):console.warn("WebSocket not connected")},messages:r,isConnected:i}}const z4=x.createContext({ws:null,sendMessage:()=>{},messages:[],isConnected:!1}),U4=()=>{const e=x.useContext(z4);if(!e)throw new Error("useWebSocketContext must be used within a WebSocketProvider");return e},MT=({children:e})=>{const t=DT();return a.jsx(z4.Provider,{value:t,children:e})},$4=x.createContext({projects:[],currentProject:null,projectTaskMaster:null,mcpServerStatus:null,tasks:[],nextTask:null,isLoading:!1,isLoadingTasks:!1,isLoadingMCP:!1,error:null,refreshProjects:()=>{},setCurrentProject:()=>{},refreshTasks:()=>{},refreshMCPStatus:()=>{},clearError:()=>{}}),ss=()=>{const e=x.useContext($4);if(!e)throw new Error("useTaskMaster must be used within a TaskMasterProvider");return e},FT=({children:e})=>{const{messages:t}=U4(),{user:r,token:n,isLoading:i}=is(),[s,o]=x.useState([]),[l,c]=x.useState(null),[d,u]=x.useState(null),[p,h]=x.useState(null),[m,g]=x.useState([]),[f,w]=x.useState(null),[S,k]=x.useState(!1),[E,N]=x.useState(!1),[C,v]=x.useState(!1),[I,M]=x.useState(null),j=(G,re)=>{console.error(`TaskMaster ${re} error:`,G),M({message:G.message||`Failed to ${re}`,context:re,timestamp:new Date().toISOString()})},T=x.useCallback(()=>{M(null)},[]),P=x.useCallback(async()=>{if(!r||!n){o([]),c(null);return}try{k(!0),T();const G=await yt.get("/projects");if(!G.ok)throw new Error(`Failed to fetch projects: ${G.status}`);const re=await G.json();if(!Array.isArray(re)){console.error("Projects API returned non-array data:",re),o([]);return}const K=re.map(ue=>({...ue,taskMasterConfigured:ue.taskmaster?.hasTaskmaster||!1,taskMasterStatus:ue.taskmaster?.status||"not-configured",taskCount:ue.taskmaster?.metadata?.taskCount||0,completedCount:ue.taskmaster?.metadata?.completed||0}));if(o(K),l){const ue=K.find(R=>R.name===l.name);ue&&(c(ue),u(ue.taskmaster))}}catch(G){j(G,"load projects")}finally{k(!1)}},[r,n]),q=x.useCallback(async G=>{try{c(G),g([]),w(null),u(G?.taskmaster||null)}catch(re){console.error("Error in setCurrentProject:",re),j(re,"set current project"),u(G?.taskmaster||null)}},[]),D=x.useCallback(async()=>{if(!r||!n){h(null);return}try{v(!0),T();const G=await yt.get("/mcp-utils/taskmaster-server");h(G)}catch(G){j(G,"check MCP server status")}finally{v(!1)}},[r,n]),z=x.useCallback(async()=>{if(!l){g([]),w(null);return}if(!r||!n){g([]),w(null);return}try{N(!0),T();const G=await yt.get(`/taskmaster/tasks/${encodeURIComponent(l.name)}`);if(!G.ok){const ue=await G.json();throw new Error(ue.message||"Failed to load tasks")}const re=await G.json();g(re.tasks||[]);const K=re.tasks?.find(ue=>ue.status==="pending"||ue.status==="in-progress")||null;w(K)}catch(G){console.error("Error loading tasks:",G),j(G,"load tasks"),g([]),w(null)}finally{N(!1)}},[l,r,n]);x.useEffect(()=>{!i&&r&&n?(P(),D()):console.log("Auth not ready or no user, skipping project load:",{authLoading:i,user:!!r,token:!!n})},[P,D,i,r,n]),x.useEffect(()=>{r&&n&&T()},[r,n,T]),x.useEffect(()=>{l?.name&&r&&n&&z()},[l?.name,r,n,z]),x.useEffect(()=>{const G=t[t.length-1];if(G)switch(G.type){case"taskmaster-project-updated":G.projectName&&P();break;case"taskmaster-tasks-updated":G.projectName===l?.name&&z();break;case"taskmaster-mcp-status-changed":D();break}},[t,P,z,D,l]);const U={projects:s,currentProject:l,projectTaskMaster:d,mcpServerStatus:p,tasks:m,nextTask:f,isLoading:S,isLoadingTasks:E,isLoadingMCP:C,error:I,refreshProjects:P,setCurrentProject:q,refreshTasks:z,refreshMCPStatus:D,clearError:T};return a.jsx($4.Provider,{value:U,children:e})},q4=x.createContext({tasksEnabled:!0,setTasksEnabled:()=>{},toggleTasksEnabled:()=>{},isTaskMasterInstalled:null,isTaskMasterReady:null,installationStatus:null,isCheckingInstallation:!0}),os=()=>{const e=x.useContext(q4);if(!e)throw new Error("useTasksSettings must be used within a TasksSettingsProvider");return e},PT=({children:e})=>{const[t,r]=x.useState(()=>{const m=localStorage.getItem("tasks-enabled");return m!==null?JSON.parse(m):!0}),[n,i]=x.useState(null),[s,o]=x.useState(null),[l,c]=x.useState(null),[d,u]=x.useState(!0);x.useEffect(()=>{localStorage.setItem("tasks-enabled",JSON.stringify(t))},[t]),x.useEffect(()=>{setTimeout(async()=>{try{const g=await yt.get("/taskmaster/installation-status");if(g.ok){const f=await g.json();c(f),i(f.installation?.isInstalled||!1),o(f.isReady||!1);const w=localStorage.getItem("tasks-enabled");!f.installation?.isInstalled&&!w&&r(!1)}else console.error("Failed to check TaskMaster installation status"),i(!1),o(!1)}catch(g){console.error("Error checking TaskMaster installation:",g),i(!1),o(!1)}finally{u(!1)}},0)},[]);const h={tasksEnabled:t,setTasksEnabled:r,toggleTasksEnabled:()=>{r(m=>!m)},isTaskMasterInstalled:n,isTaskMasterReady:s,installationStatus:l,isCheckingInstallation:d};return a.jsx(q4.Provider,{value:h,children:e})},Of=(e,t,r)=>{const n=new Date(e),i=t;if(isNaN(n.getTime()))return r?r("status.unknown"):"Unknown";const s=i-n,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 Df({projects:e,selectedProject:t,selectedSession:r,onProjectSelect:n,onSessionSelect:i,onNewSession:s,onSessionDelete:o,onProjectDelete:l,isLoading:c,loadingProgress:d,onRefresh:u,onShowSettings:p,updateAvailable:h,latestVersion:m,currentVersion:g,releaseInfo:f,onShowVersionModal:w,isPWA:S,isMobile:k,onToggleSidebar:E}){const{t:N}=Ht("sidebar"),[C,v]=x.useState(new Set),[I,M]=x.useState(null),[j,T]=x.useState(!1),[P,q]=x.useState(""),[D,z]=x.useState({}),[U,G]=x.useState({}),[re,K]=x.useState(new Set),[ue,R]=x.useState(new Date),[F,te]=x.useState("name"),[_,Z]=x.useState(!1),[me,ke]=x.useState(null),[se,_e]=x.useState(""),[oe,fe]=x.useState({}),[Ie,qe]=x.useState(""),[ze,ct]=x.useState(new Set),[Ye,wt]=x.useState(null),[gt,et]=x.useState(null),{setCurrentProject:Me,mcpServerStatus:mt}=ss(),{tasksEnabled:Pt}=os(),[xe,at]=x.useState(()=>{try{const J=localStorage.getItem("starredProjects");return J?new Set(JSON.parse(J)):new Set}catch(J){return console.error("Error loading starred projects:",J),new Set}}),ce=J=>Fe=>{Fe.target.closest(".overflow-y-auto")||Fe.target.closest("[data-scroll-container]")||(Fe.preventDefault(),Fe.stopPropagation(),J())};x.useEffect(()=>{const J=setInterval(()=>{R(new Date)},6e4);return()=>clearInterval(J)},[]),x.useEffect(()=>{G({}),K(new Set)},[e]),x.useEffect(()=>{r&&t&&v(J=>new Set([...J,t.name]))},[r,t]),x.useEffect(()=>{if(e.length>0&&!c){const J=new Set;e.forEach(Fe=>{Fe.sessions&&Fe.sessions.length>=0&&J.add(Fe.name)}),K(J)}},[e,c]),x.useEffect(()=>{const J=()=>{try{const Ge=localStorage.getItem("claude-settings");if(Ge){const dt=JSON.parse(Ge);te(dt.projectSortOrder||"name")}}catch(Ge){console.error("Error loading sort order:",Ge)}};J();const Fe=Ge=>{Ge.key==="claude-settings"&&J()};window.addEventListener("storage",Fe);const Ke=setInterval(()=>{document.hasFocus()&&J()},1e3);return()=>{window.removeEventListener("storage",Fe),clearInterval(Ke)}},[]);const Ee=J=>{const Fe=new Set;C.has(J)||Fe.add(J),v(Fe)},H=(J,Fe)=>{i({...J,__projectName:Fe})},Y=J=>{const Fe=new Set(xe);Fe.has(J)?Fe.delete(J):Fe.add(J),at(Fe);try{localStorage.setItem("starredProjects",JSON.stringify([...Fe]))}catch(Ke){console.error("Error saving starred projects:",Ke)}},le=J=>xe.has(J),ve=J=>{const Fe=[...J.sessions||[],...U[J.name]||[]].map(he=>({...he,__provider:"claude"})),Ke=(J.cursorSessions||[]).map(he=>({...he,__provider:"cursor"})),Ge=(J.codexSessions||[]).map(he=>({...he,__provider:"codex"})),dt=he=>he.__provider==="cursor"?new Date(he.createdAt):he.__provider==="codex"?new Date(he.createdAt||he.lastActivity):new Date(he.lastActivity);return[...Fe,...Ke,...Ge].sort((he,zt)=>dt(zt)-dt(he))},Ve=J=>{const Fe=ve(J);return Fe.length===0?new Date(0):Fe.reduce((Ge,dt)=>{const he=new Date(dt.lastActivity);return he>Ge?he:Ge},new Date(0))},It=[...e].sort((J,Fe)=>{const Ke=le(J.name),Ge=le(Fe.name);if(Ke&&!Ge)return-1;if(!Ke&&Ge)return 1;if(F==="date")return Ve(Fe)-Ve(J);{const dt=J.displayName||J.name,he=Fe.displayName||Fe.name;return dt.localeCompare(he)}}),ft=J=>{M(J.name),q(J.displayName)},Rt=()=>{M(null),q("")},it=async J=>{try{(await yt.renameProject(J,P)).ok?window.refreshProjects?window.refreshProjects():window.location.reload():console.error("Failed to rename project")}catch(Fe){console.error("Error renaming project:",Fe)}M(null),q("")},ie=(J,Fe,Ke,Ge="claude")=>{et({projectName:J,sessionId:Fe,sessionTitle:Ke,provider:Ge})},je=async()=>{if(!gt)return;const{projectName:J,sessionId:Fe,provider:Ke}=gt;et(null);try{console.log("[Sidebar] Deleting session:",{projectName:J,sessionId:Fe,provider:Ke});let Ge;if(Ke==="codex"?Ge=await yt.deleteCodexSession(Fe):Ge=await yt.deleteSession(J,Fe),console.log("[Sidebar] Delete response:",{ok:Ge.ok,status:Ge.status}),Ge.ok)console.log("[Sidebar] Session deleted successfully, calling callback"),o?o(Fe):console.warn("[Sidebar] No onSessionDelete callback provided");else{const dt=await Ge.text();console.error("[Sidebar] Failed to delete session:",{status:Ge.status,error:dt}),alert(N("messages.deleteSessionFailed"))}}catch(Ge){console.error("[Sidebar] Error deleting session:",Ge),alert(N("messages.deleteSessionError"))}},Te=J=>{const Fe=ve(J).length;wt({project:J,sessionCount:Fe})},Pe=async()=>{if(!Ye)return;const{project:J,sessionCount:Fe}=Ye,Ke=Fe===0;wt(null),ct(Ge=>new Set([...Ge,J.name]));try{const Ge=await yt.deleteProject(J.name,!Ke);if(Ge.ok)l&&l(J.name);else{const dt=await Ge.json();console.error("Failed to delete project"),alert(dt.error||N("messages.deleteProjectFailed"))}}catch(Ge){console.error("Error deleting project:",Ge),alert(N("messages.deleteProjectError"))}finally{ct(Ge=>{const dt=new Set(Ge);return dt.delete(J.name),dt})}},Ue=async J=>{if(!(!(J.sessionMeta?.hasMore!==!1)||D[J.name])){z(Ke=>({...Ke,[J.name]:!0}));try{const Ke=(J.sessions?.length||0)+(U[J.name]?.length||0),Ge=await yt.sessions(J.name,5,Ke);if(Ge.ok){const dt=await Ge.json();G(he=>({...he,[J.name]:[...he[J.name]||[],...dt.sessions]})),dt.hasMore===!1&&(J.sessionMeta={...J.sessionMeta,hasMore:!1})}}catch(Ke){console.error("Error loading more sessions:",Ke)}finally{z(Ke=>({...Ke,[J.name]:!1}))}}},st=It.filter(J=>{if(!Ie.trim())return!0;const Fe=Ie.toLowerCase(),Ke=(J.displayName||J.name).toLowerCase(),Ge=J.name.toLowerCase();return Ke.includes(Fe)||Ge.includes(Fe)}),Qe=J=>{n(J),Me(J)};return a.jsxs(a.Fragment,{children:[j&&Xo.createPortal(a.jsx(LT,{onClose:()=>T(!1),onProjectCreated:J=>{window.refreshProjects?window.refreshProjects():window.location.reload()}}),document.body),Ye&&Xo.createPortal(a.jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm flex items-center justify-center z-50 p-4",children:a.jsxs("div",{className:"bg-card border border-border rounded-xl shadow-2xl max-w-md w-full overflow-hidden",children:[a.jsx("div",{className:"p-6",children:a.jsxs("div",{className:"flex items-start gap-4",children:[a.jsx("div",{className:"w-12 h-12 rounded-full bg-red-100 dark:bg-red-900/30 flex items-center justify-center flex-shrink-0",children:a.jsx(Vn,{className:"w-6 h-6 text-red-600 dark:text-red-400"})}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsx("h3",{className:"text-lg font-semibold text-foreground mb-2",children:N("deleteConfirmation.deleteProject")}),a.jsxs("p",{className:"text-sm text-muted-foreground mb-1",children:[N("deleteConfirmation.confirmDelete")," ",a.jsx("span",{className:"font-medium text-foreground",children:Ye.project.displayName||Ye.project.name}),"?"]}),Ye.sessionCount>0&&a.jsxs("div",{className:"mt-3 p-3 bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800 rounded-lg",children:[a.jsx("p",{className:"text-sm text-red-700 dark:text-red-300 font-medium",children:N("deleteConfirmation.sessionCount",{count:Ye.sessionCount})}),a.jsx("p",{className:"text-xs text-red-600 dark:text-red-400 mt-1",children:N("deleteConfirmation.allConversationsDeleted")})]}),a.jsx("p",{className:"text-xs text-muted-foreground mt-3",children:N("deleteConfirmation.cannotUndo")})]})]})}),a.jsxs("div",{className:"flex gap-3 p-4 bg-muted/30 border-t border-border",children:[a.jsx(Be,{variant:"outline",className:"flex-1",onClick:()=>wt(null),children:N("actions.cancel")}),a.jsxs(Be,{variant:"destructive",className:"flex-1 bg-red-600 hover:bg-red-700 text-white",onClick:Pe,children:[a.jsx(Nr,{className:"w-4 h-4 mr-2"}),N("actions.delete")]})]})]})}),document.body),gt&&Xo.createPortal(a.jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm flex items-center justify-center z-50 p-4",children:a.jsxs("div",{className:"bg-card border border-border rounded-xl shadow-2xl max-w-md w-full overflow-hidden",children:[a.jsx("div",{className:"p-6",children:a.jsxs("div",{className:"flex items-start gap-4",children:[a.jsx("div",{className:"w-12 h-12 rounded-full bg-red-100 dark:bg-red-900/30 flex items-center justify-center flex-shrink-0",children:a.jsx(Vn,{className:"w-6 h-6 text-red-600 dark:text-red-400"})}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsx("h3",{className:"text-lg font-semibold text-foreground mb-2",children:N("deleteConfirmation.deleteSession")}),a.jsxs("p",{className:"text-sm text-muted-foreground mb-1",children:[N("deleteConfirmation.confirmDelete")," ",a.jsx("span",{className:"font-medium text-foreground",children:gt.sessionTitle||N("sessions.unnamed")}),"?"]}),a.jsx("p",{className:"text-xs text-muted-foreground mt-3",children:N("deleteConfirmation.cannotUndo")})]})]})}),a.jsxs("div",{className:"flex gap-3 p-4 bg-muted/30 border-t border-border",children:[a.jsx(Be,{variant:"outline",className:"flex-1",onClick:()=>et(null),children:N("actions.cancel")}),a.jsxs(Be,{variant:"destructive",className:"flex-1 bg-red-600 hover:bg-red-700 text-white",onClick:je,children:[a.jsx(Nr,{className:"w-4 h-4 mr-2"}),N("actions.delete")]})]})]})}),document.body),a.jsxs("div",{className:"h-full flex flex-col bg-card md:select-none",style:S&&k?{paddingTop:"44px"}:{},children:[a.jsxs("div",{className:"md:p-4 md:border-b md:border-border",children:[a.jsxs("div",{className:"hidden md:flex items-center justify-between",children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("div",{className:"w-8 h-8 bg-primary rounded-lg flex items-center justify-center shadow-sm",children:a.jsx(Wi,{className:"w-4 h-4 text-primary-foreground"})}),a.jsxs("div",{children:[a.jsx("h1",{className:"text-lg font-bold text-foreground",children:N("app.title")}),a.jsx("p",{className:"text-sm text-muted-foreground",children:N("app.subtitle")})]})]}),E&&a.jsx(Be,{variant:"ghost",size:"sm",className:"h-8 w-8 px-0 hover:bg-accent transition-colors duration-200",onClick:E,title:N("tooltips.hideSidebar"),children:a.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 19l-7-7 7-7"})})})]}),a.jsx("div",{className:"md:hidden p-3 border-b border-border",style:S&&k?{paddingTop:"16px"}:{},children:a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("div",{className:"w-8 h-8 bg-primary rounded-lg flex items-center justify-center",children:a.jsx(Wi,{className:"w-4 h-4 text-primary-foreground"})}),a.jsxs("div",{children:[a.jsx("h1",{className:"text-lg font-semibold text-foreground",children:N("app.title")}),a.jsx("p",{className:"text-sm text-muted-foreground",children:N("projects.title")})]})]}),a.jsxs("div",{className:"flex gap-2",children:[a.jsx("button",{className:"w-8 h-8 rounded-md bg-background border border-border flex items-center justify-center active:scale-95 transition-all duration-150",onClick:async()=>{Z(!0);try{await u()}finally{Z(!1)}},disabled:_,children:a.jsx(Un,{className:`w-4 h-4 text-foreground ${_?"animate-spin":""}`})}),a.jsx("button",{className:"w-8 h-8 rounded-md bg-primary text-primary-foreground flex items-center justify-center active:scale-95 transition-all duration-150",onClick:()=>T(!0),children:a.jsx(Pi,{className:"w-4 h-4"})})]})]})})]}),!c&&!k&&a.jsx("div",{className:"px-3 md:px-4 py-2 border-b border-border",children:a.jsxs("div",{className:"flex gap-2",children:[a.jsxs(Be,{variant:"default",size:"sm",className:"flex-1 h-8 text-xs bg-primary hover:bg-primary/90 transition-all duration-200",onClick:()=>T(!0),title:N("tooltips.createProject"),children:[a.jsx(Pi,{className:"w-3.5 h-3.5 mr-1.5"}),N("projects.newProject")]}),a.jsx(Be,{variant:"outline",size:"sm",className:"h-8 w-8 px-0 hover:bg-accent transition-colors duration-200 group",onClick:async()=>{Z(!0);try{await u()}finally{Z(!1)}},disabled:_,title:N("tooltips.refresh"),children:a.jsx(Un,{className:`w-3.5 h-3.5 ${_?"animate-spin":""} group-hover:rotate-180 transition-transform duration-300`})})]})}),e.length>0&&!c&&a.jsx("div",{className:"px-3 md:px-4 py-2 border-b border-border",children:a.jsxs("div",{className:"relative",children:[a.jsx(si,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 w-4 h-4 text-muted-foreground"}),a.jsx(tr,{type:"text",placeholder:N("projects.searchPlaceholder"),value:Ie,onChange:J=>qe(J.target.value),className:"pl-9 h-9 text-sm bg-muted/50 border-0 focus:bg-background focus:ring-1 focus:ring-primary/20"}),Ie&&a.jsx("button",{onClick:()=>qe(""),className:"absolute right-2 top-1/2 transform -translate-y-1/2 p-1 hover:bg-accent rounded",children:a.jsx(Bt,{className:"w-3 h-3 text-muted-foreground"})})]})}),a.jsx($h,{className:"flex-1 md:px-2 md:py-3 overflow-y-auto overscroll-contain",children:a.jsx("div",{className:"md:space-y-1 pb-safe-area-inset-bottom",children:c?a.jsxs("div",{className:"text-center py-12 md:py-8 px-4",children:[a.jsx("div",{className:"w-12 h-12 bg-muted rounded-lg flex items-center justify-center mx-auto mb-4 md:mb-3",children:a.jsx("div",{className:"w-6 h-6 animate-spin rounded-full border-2 border-muted-foreground border-t-transparent"})}),a.jsx("h3",{className:"text-base font-medium text-foreground mb-2 md:mb-1",children:N("projects.loadingProjects")}),a.jsx("p",{className:"text-sm text-muted-foreground",children:N("projects.fetchingProjects")}),a.jsx("h3",{className:"text-base font-medium text-foreground mb-2 md:mb-1",children:N("projects.loadingProjects")}),d&&d.total>0?a.jsxs("div",{className:"space-y-2",children:[a.jsx("div",{className:"w-full bg-muted rounded-full h-2 overflow-hidden",children:a.jsx("div",{className:"bg-primary h-full transition-all duration-300 ease-out",style:{width:`${d.current/d.total*100}%`}})}),a.jsxs("p",{className:"text-sm text-muted-foreground",children:[d.current,"/",d.total," ",N("projects.projects")]}),d.currentProject&&a.jsx("p",{className:"text-xs text-muted-foreground/70 truncate max-w-[200px] mx-auto",title:d.currentProject,children:d.currentProject.split("-").slice(-2).join("/")})]}):a.jsx("p",{className:"text-sm text-muted-foreground",children:N("projects.fetchingProjects")})]}):e.length===0?a.jsxs("div",{className:"text-center py-12 md:py-8 px-4",children:[a.jsx("div",{className:"w-12 h-12 bg-muted rounded-lg flex items-center justify-center mx-auto mb-4 md:mb-3",children:a.jsx(ca,{className:"w-6 h-6 text-muted-foreground"})}),a.jsx("h3",{className:"text-base font-medium text-foreground mb-2 md:mb-1",children:N("projects.noProjects")}),a.jsx("p",{className:"text-sm text-muted-foreground",children:N("projects.runClaudeCli")})]}):st.length===0?a.jsxs("div",{className:"text-center py-12 md:py-8 px-4",children:[a.jsx("div",{className:"w-12 h-12 bg-muted rounded-lg flex items-center justify-center mx-auto mb-4 md:mb-3",children:a.jsx(si,{className:"w-6 h-6 text-muted-foreground"})}),a.jsx("h3",{className:"text-base font-medium text-foreground mb-2 md:mb-1",children:N("projects.noMatchingProjects")}),a.jsx("p",{className:"text-sm text-muted-foreground",children:N("projects.tryDifferentSearch")})]}):st.map(J=>{const Fe=C.has(J.name),Ke=t?.name===J.name,Ge=le(J.name),dt=ze.has(J.name);return a.jsxs("div",{className:Ze("md:space-y-1",dt&&"opacity-50 pointer-events-none"),children:[a.jsxs("div",{className:"group md:group",children:[a.jsx("div",{className:"md:hidden",children:a.jsx("div",{className:Ze("p-3 mx-3 my-1 rounded-lg bg-card border border-border/50 active:scale-[0.98] transition-all duration-150",Ke&&"bg-primary/5 border-primary/20",Ge&&!Ke&&"bg-yellow-50/50 dark:bg-yellow-900/5 border-yellow-200/30 dark:border-yellow-800/30"),onClick:()=>{Ee(J.name)},onTouchEnd:ce(()=>Ee(J.name)),children:a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{className:"flex items-center gap-3 min-w-0 flex-1",children:[a.jsx("div",{className:Ze("w-8 h-8 rounded-lg flex items-center justify-center transition-colors",Fe?"bg-primary/10":"bg-muted"),children:Fe?a.jsx(Tn,{className:"w-4 h-4 text-primary"}):a.jsx(ca,{className:"w-4 h-4 text-muted-foreground"})}),a.jsx("div",{className:"min-w-0 flex-1",children:I===J.name?a.jsx("input",{type:"text",value:P,onChange:he=>q(he.target.value),className:"w-full px-3 py-2 text-sm border-2 border-primary/40 focus:border-primary rounded-lg bg-background text-foreground shadow-sm focus:shadow-md transition-all duration-200 focus:outline-none",placeholder:N("projects.projectNamePlaceholder"),autoFocus:!0,autoComplete:"off",onClick:he=>he.stopPropagation(),onKeyDown:he=>{he.key==="Enter"&&it(J.name),he.key==="Escape"&&Rt()},style:{fontSize:"16px",WebkitAppearance:"none",borderRadius:"8px"}}):a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"flex items-center justify-between min-w-0 flex-1",children:[a.jsx("h3",{className:"text-sm font-medium text-foreground truncate",children:J.displayName}),Pt&&a.jsx(_T,{status:(()=>{const he=J.taskmaster?.hasTaskmaster,zt=mt?.hasMCPServer&&mt?.isConfigured;return he&&zt?"fully-configured":he?"taskmaster-only":zt?"mcp-only":"not-configured"})(),size:"xs",className:"hidden md:inline-flex flex-shrink-0 ml-2"})]}),a.jsx("p",{className:"text-xs text-muted-foreground",children:(()=>{const he=ve(J).length,nr=J.sessionMeta?.hasMore!==!1&&he>=5?`${he}+`:he;return`${nr} session${nr===1?"":"s"}`})()})]})})]}),a.jsx("div",{className:"flex items-center gap-1",children:I===J.name?a.jsxs(a.Fragment,{children:[a.jsx("button",{className:"w-8 h-8 rounded-lg bg-green-500 dark:bg-green-600 flex items-center justify-center active:scale-90 transition-all duration-150 shadow-sm active:shadow-none",onClick:he=>{he.stopPropagation(),it(J.name)},children:a.jsx(Cr,{className:"w-4 h-4 text-white"})}),a.jsx("button",{className:"w-8 h-8 rounded-lg bg-gray-500 dark:bg-gray-600 flex items-center justify-center active:scale-90 transition-all duration-150 shadow-sm active:shadow-none",onClick:he=>{he.stopPropagation(),Rt()},children:a.jsx(Bt,{className:"w-4 h-4 text-white"})})]}):a.jsxs(a.Fragment,{children:[a.jsx("button",{className:Ze("w-8 h-8 rounded-lg flex items-center justify-center active:scale-90 transition-all duration-150 border",Ge?"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:he=>{he.stopPropagation(),Y(J.name)},onTouchEnd:ce(()=>Y(J.name)),title:N(Ge?"tooltips.removeFromFavorites":"tooltips.addToFavorites"),children:a.jsx(df,{className:Ze("w-4 h-4 transition-colors",Ge?"text-yellow-600 dark:text-yellow-400 fill-current":"text-gray-600 dark:text-gray-400")})}),a.jsx("button",{className:"w-8 h-8 rounded-lg bg-red-500/10 dark:bg-red-900/30 flex items-center justify-center active:scale-90 border border-red-200 dark:border-red-800",onClick:he=>{he.stopPropagation(),Te(J)},onTouchEnd:ce(()=>Te(J)),children:a.jsx(Nr,{className:"w-4 h-4 text-red-600 dark:text-red-400"})}),a.jsx("button",{className:"w-8 h-8 rounded-lg bg-primary/10 dark:bg-primary/20 flex items-center justify-center active:scale-90 border border-primary/20 dark:border-primary/30",onClick:he=>{he.stopPropagation(),ft(J)},onTouchEnd:ce(()=>ft(J)),children:a.jsx(Vi,{className:"w-4 h-4 text-primary"})}),a.jsx("div",{className:"w-6 h-6 rounded-md bg-muted/30 flex items-center justify-center",children:Fe?a.jsx(tn,{className:"w-3 h-3 text-muted-foreground"}):a.jsx(Cn,{className:"w-3 h-3 text-muted-foreground"})})]})})]})})}),a.jsxs(Be,{variant:"ghost",className:Ze("hidden md:flex w-full justify-between p-2 h-auto font-normal hover:bg-accent/50",Ke&&"bg-accent text-accent-foreground",Ge&&!Ke&&"bg-yellow-50/50 dark:bg-yellow-900/10 hover:bg-yellow-100/50 dark:hover:bg-yellow-900/20"),onClick:()=>{t?.name!==J.name&&Qe(J),Ee(J.name)},onTouchEnd:ce(()=>{t?.name!==J.name&&Qe(J),Ee(J.name)}),children:[a.jsxs("div",{className:"flex items-center gap-3 min-w-0 flex-1",children:[Fe?a.jsx(Tn,{className:"w-4 h-4 text-primary flex-shrink-0"}):a.jsx(ca,{className:"w-4 h-4 text-muted-foreground flex-shrink-0"}),a.jsx("div",{className:"min-w-0 flex-1 text-left",children:I===J.name?a.jsxs("div",{className:"space-y-1",children:[a.jsx("input",{type:"text",value:P,onChange:he=>q(he.target.value),className:"w-full px-2 py-1 text-sm border border-border rounded bg-background text-foreground focus:ring-2 focus:ring-primary/20",placeholder:N("projects.projectNamePlaceholder"),autoFocus:!0,onKeyDown:he=>{he.key==="Enter"&&it(J.name),he.key==="Escape"&&Rt()}}),a.jsx("div",{className:"text-xs text-muted-foreground truncate",title:J.fullPath,children:J.fullPath})]}):a.jsxs("div",{children:[a.jsx("div",{className:"text-sm font-semibold truncate text-foreground",title:J.displayName,children:J.displayName}),a.jsxs("div",{className:"text-xs text-muted-foreground",children:[(()=>{const he=ve(J).length;return J.sessionMeta?.hasMore!==!1&&he>=5?`${he}+`:he})(),J.fullPath!==J.displayName&&a.jsxs("span",{className:"ml-1 opacity-60",title:J.fullPath,children:["• ",J.fullPath.length>25?"..."+J.fullPath.slice(-22):J.fullPath]})]})]})})]}),a.jsx("div",{className:"flex items-center gap-1 flex-shrink-0",children:I===J.name?a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"w-6 h-6 text-green-600 hover:text-green-700 hover:bg-green-50 dark:hover:bg-green-900/20 flex items-center justify-center rounded cursor-pointer transition-colors",onClick:he=>{he.stopPropagation(),it(J.name)},children:a.jsx(Cr,{className:"w-3 h-3"})}),a.jsx("div",{className:"w-6 h-6 text-gray-500 hover:text-gray-700 hover:bg-gray-50 dark:hover:bg-gray-800 flex items-center justify-center rounded cursor-pointer transition-colors",onClick:he=>{he.stopPropagation(),Rt()},children:a.jsx(Bt,{className:"w-3 h-3"})})]}):a.jsxs(a.Fragment,{children:[a.jsx("div",{className:Ze("w-6 h-6 opacity-0 group-hover:opacity-100 transition-all duration-200 flex items-center justify-center rounded cursor-pointer touch:opacity-100",Ge?"hover:bg-yellow-50 dark:hover:bg-yellow-900/20 opacity-100":"hover:bg-accent"),onClick:he=>{he.stopPropagation(),Y(J.name)},title:N(Ge?"tooltips.removeFromFavorites":"tooltips.addToFavorites"),children:a.jsx(df,{className:Ze("w-3 h-3 transition-colors",Ge?"text-yellow-600 dark:text-yellow-400 fill-current":"text-muted-foreground")})}),a.jsx("div",{className:"w-6 h-6 opacity-0 group-hover:opacity-100 transition-all duration-200 hover:bg-accent flex items-center justify-center rounded cursor-pointer touch:opacity-100",onClick:he=>{he.stopPropagation(),ft(J)},title:N("tooltips.renameProject"),children:a.jsx(Vi,{className:"w-3 h-3"})}),a.jsx("div",{className:"w-6 h-6 opacity-0 group-hover:opacity-100 transition-all duration-200 hover:bg-red-50 dark:hover:bg-red-900/20 flex items-center justify-center rounded cursor-pointer touch:opacity-100",onClick:he=>{he.stopPropagation(),Te(J)},title:N("tooltips.deleteProject"),children:a.jsx(Nr,{className:"w-3 h-3 text-red-600 dark:text-red-400"})}),Fe?a.jsx(tn,{className:"w-4 h-4 text-muted-foreground group-hover:text-foreground transition-colors"}):a.jsx(Cn,{className:"w-4 h-4 text-muted-foreground group-hover:text-foreground transition-colors"})]})})]})]}),Fe&&a.jsxs("div",{className:"ml-3 space-y-1 border-l border-border pl-3",children:[re.has(J.name)?ve(J).length===0&&!D[J.name]?a.jsx("div",{className:"py-2 px-3 text-left",children:a.jsx("p",{className:"text-xs text-muted-foreground",children:N("sessions.noSessions")})}):ve(J).map(he=>{const zt=he.__provider==="cursor",nr=he.__provider==="codex",xr=zt?new Date(he.createdAt):nr?new Date(he.createdAt||he.lastActivity):new Date(he.lastActivity),ge=Math.floor((ue-xr)/(1e3*60))<10,bt=zt?he.name||N("projects.untitledSession"):nr?he.summary||he.name||N("projects.codexSession"):he.summary||N("projects.newSession"),ar=zt?he.createdAt:nr&&he.createdAt||he.lastActivity,Zr=he.messageCount||0;return a.jsxs("div",{className:"group relative",children:[ge&&a.jsx("div",{className:"absolute left-0 top-1/2 transform -translate-y-1/2 -translate-x-1",children:a.jsx("div",{className:"w-2 h-2 bg-green-500 rounded-full animate-pulse"})}),a.jsx("div",{className:"md:hidden",children:a.jsx("div",{className:Ze("p-2 mx-3 my-0.5 rounded-md bg-card border active:scale-[0.98] transition-all duration-150 relative",r?.id===he.id?"bg-primary/5 border-primary/20":ge?"border-green-500/30 bg-green-50/5 dark:bg-green-900/5":"border-border/30"),onClick:()=>{Qe(J),H(he,J.name)},onTouchEnd:ce(()=>{Qe(J),H(he,J.name)}),children:a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("div",{className:Ze("w-5 h-5 rounded-md flex items-center justify-center flex-shrink-0",r?.id===he.id?"bg-primary/10":"bg-muted/50"),children:zt?a.jsx(pn,{className:"w-3 h-3"}):nr?a.jsx(wn,{className:"w-3 h-3"}):a.jsx(nn,{className:"w-3 h-3"})}),a.jsxs("div",{className:"min-w-0 flex-1",children:[a.jsx("div",{className:"text-xs font-medium truncate text-foreground",children:bt}),a.jsxs("div",{className:"flex items-center gap-1 mt-0.5",children:[a.jsx(Hi,{className:"w-2.5 h-2.5 text-muted-foreground"}),a.jsx("span",{className:"text-xs text-muted-foreground",children:Of(ar,ue,N)}),Zr>0&&a.jsx(mn,{variant:"secondary",className:"text-xs px-1 py-0 ml-auto",children:Zr}),a.jsx("span",{className:"ml-1 opacity-70",children:zt?a.jsx(pn,{className:"w-3 h-3"}):nr?a.jsx(wn,{className:"w-3 h-3"}):a.jsx(nn,{className:"w-3 h-3"})})]})]}),!zt&&a.jsx("button",{className:"w-5 h-5 rounded-md bg-red-50 dark:bg-red-900/20 flex items-center justify-center active:scale-95 transition-transform opacity-70 ml-1",onClick:Ut=>{Ut.stopPropagation(),ie(J.name,he.id,bt,he.__provider)},onTouchEnd:ce(()=>ie(J.name,he.id,bt,he.__provider)),children:a.jsx(Nr,{className:"w-2.5 h-2.5 text-red-600 dark:text-red-400"})})]})})}),a.jsxs("div",{className:"hidden md:block",children:[a.jsx(Be,{variant:"ghost",className:Ze("w-full justify-start p-2 h-auto font-normal text-left hover:bg-accent/50 transition-colors duration-200",r?.id===he.id&&"bg-accent text-accent-foreground"),onClick:()=>H(he,J.name),onTouchEnd:ce(()=>H(he,J.name)),children:a.jsxs("div",{className:"flex items-start gap-2 min-w-0 w-full",children:[zt?a.jsx(pn,{className:"w-3 h-3 mt-0.5 flex-shrink-0"}):nr?a.jsx(wn,{className:"w-3 h-3 mt-0.5 flex-shrink-0"}):a.jsx(nn,{className:"w-3 h-3 mt-0.5 flex-shrink-0"}),a.jsxs("div",{className:"min-w-0 flex-1",children:[a.jsx("div",{className:"text-xs font-medium truncate text-foreground",children:bt}),a.jsxs("div",{className:"flex items-center gap-1 mt-0.5",children:[a.jsx(Hi,{className:"w-2.5 h-2.5 text-muted-foreground"}),a.jsx("span",{className:"text-xs text-muted-foreground",children:Of(ar,ue,N)}),Zr>0&&a.jsx(mn,{variant:"secondary",className:"text-xs px-1 py-0 ml-auto group-hover:opacity-0 transition-opacity",children:Zr}),a.jsx("span",{className:"ml-1 opacity-70 group-hover:opacity-0 transition-opacity",children:zt?a.jsx(pn,{className:"w-3 h-3"}):nr?a.jsx(wn,{className:"w-3 h-3"}):a.jsx(nn,{className:"w-3 h-3"})})]})]})]})}),!zt&&a.jsx("div",{className:"absolute right-2 top-1/2 transform -translate-y-1/2 flex items-center gap-1 opacity-0 group-hover:opacity-100 transition-all duration-200",children:me===he.id&&!nr?a.jsxs(a.Fragment,{children:[a.jsx("input",{type:"text",value:se,onChange:Ut=>_e(Ut.target.value),onKeyDown:Ut=>{Ut.stopPropagation(),Ut.key==="Enter"?updateSessionSummary(J.name,he.id,se):Ut.key==="Escape"&&(ke(null),_e(""))},onClick:Ut=>Ut.stopPropagation(),className:"w-32 px-2 py-1 text-xs border border-border rounded bg-background focus:outline-none focus:ring-1 focus:ring-primary",autoFocus:!0}),a.jsx("button",{className:"w-6 h-6 bg-green-50 hover:bg-green-100 dark:bg-green-900/20 dark:hover:bg-green-900/40 rounded flex items-center justify-center",onClick:Ut=>{Ut.stopPropagation(),updateSessionSummary(J.name,he.id,se)},title:N("tooltips.save"),children:a.jsx(Cr,{className:"w-3 h-3 text-green-600 dark:text-green-400"})}),a.jsx("button",{className:"w-6 h-6 bg-gray-50 hover:bg-gray-100 dark:bg-gray-900/20 dark:hover:bg-gray-900/40 rounded flex items-center justify-center",onClick:Ut=>{Ut.stopPropagation(),ke(null),_e("")},title:N("tooltips.cancel"),children:a.jsx(Bt,{className:"w-3 h-3 text-gray-600 dark:text-gray-400"})})]}):a.jsxs(a.Fragment,{children:[!nr&&a.jsx("button",{className:"w-6 h-6 bg-gray-50 hover:bg-gray-100 dark:bg-gray-900/20 dark:hover:bg-gray-900/40 rounded flex items-center justify-center",onClick:Ut=>{Ut.stopPropagation(),ke(he.id),_e(he.summary||N("projects.newSession"))},title:N("tooltips.editSessionName"),children:a.jsx(_6,{className:"w-3 h-3 text-gray-600 dark:text-gray-400"})}),a.jsx("button",{className:"w-6 h-6 bg-red-50 hover:bg-red-100 dark:bg-red-900/20 dark:hover:bg-red-900/40 rounded flex items-center justify-center",onClick:Ut=>{Ut.stopPropagation(),ie(J.name,he.id,bt,he.__provider)},title:N("tooltips.deleteSession"),children:a.jsx(Nr,{className:"w-3 h-3 text-red-600 dark:text-red-400"})})]})})]})]},he.id)}):Array.from({length:3}).map((he,zt)=>a.jsx("div",{className:"p-2 rounded-md",children:a.jsxs("div",{className:"flex items-start gap-2",children:[a.jsx("div",{className:"w-3 h-3 bg-muted rounded-full animate-pulse mt-0.5"}),a.jsxs("div",{className:"flex-1 space-y-1",children:[a.jsx("div",{className:"h-3 bg-muted rounded animate-pulse",style:{width:`${60+zt*15}%`}}),a.jsx("div",{className:"h-2 bg-muted rounded animate-pulse w-1/2"})]})]})},zt)),ve(J).length>0&&J.sessionMeta?.hasMore!==!1&&a.jsx(Be,{variant:"ghost",size:"sm",className:"w-full justify-center gap-2 mt-2 text-muted-foreground",onClick:()=>Ue(J),disabled:D[J.name],children:D[J.name]?a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"w-3 h-3 animate-spin rounded-full border border-muted-foreground border-t-transparent"}),N("sessions.loading")]}):a.jsxs(a.Fragment,{children:[a.jsx(tn,{className:"w-3 h-3"}),N("sessions.showMore")]})}),a.jsx("div",{className:"md:hidden px-3 pb-2",children:a.jsxs("button",{className:"w-full h-8 bg-primary hover:bg-primary/90 text-primary-foreground rounded-md flex items-center justify-center gap-2 font-medium text-xs active:scale-[0.98] transition-all duration-150",onClick:()=>{Qe(J),s(J)},children:[a.jsx(gr,{className:"w-3 h-3"}),N("sessions.newSession")]})}),a.jsxs(Be,{variant:"default",size:"sm",className:"hidden md:flex w-full justify-start gap-2 mt-1 h-8 text-xs font-medium bg-primary hover:bg-primary/90 text-primary-foreground transition-colors",onClick:()=>s(J),children:[a.jsx(gr,{className:"w-3 h-3"}),N("sessions.newSession")]})]})]},J.name)})})}),h&&a.jsxs("div",{className:"md:p-2 border-t border-border/50 flex-shrink-0",children:[a.jsx("div",{className:"hidden md:block",children:a.jsxs(Be,{variant:"ghost",className:"w-full justify-start gap-3 p-3 h-auto font-normal text-left hover:bg-blue-50 dark:hover:bg-blue-900/20 transition-colors duration-200 border border-blue-200 dark:border-blue-700 rounded-lg mb-2",onClick:w,children:[a.jsxs("div",{className:"relative",children:[a.jsx("svg",{className:"w-4 h-4 text-blue-600 dark:text-blue-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:a.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"})}),a.jsx("div",{className:"absolute -top-1 -right-1 w-2 h-2 bg-blue-500 rounded-full animate-pulse"})]}),a.jsxs("div",{className:"min-w-0 flex-1",children:[a.jsx("div",{className:"text-sm font-medium text-blue-700 dark:text-blue-300",children:f?.title||`Version ${m}`}),a.jsx("div",{className:"text-xs text-blue-600 dark:text-blue-400",children:N("version.updateAvailable")})]})]})}),a.jsx("div",{className:"md:hidden p-3 pb-2",children:a.jsxs("button",{className:"w-full h-12 bg-blue-50 dark:bg-blue-900/20 border border-blue-200 dark:border-blue-700 rounded-xl flex items-center justify-start gap-3 px-4 active:scale-[0.98] transition-all duration-150",onClick:w,children:[a.jsxs("div",{className:"relative",children:[a.jsx("svg",{className:"w-5 h-5 text-blue-600 dark:text-blue-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:a.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"})}),a.jsx("div",{className:"absolute -top-1 -right-1 w-2 h-2 bg-blue-500 rounded-full animate-pulse"})]}),a.jsxs("div",{className:"min-w-0 flex-1 text-left",children:[a.jsx("div",{className:"text-sm font-medium text-blue-700 dark:text-blue-300",children:f?.title||`Version ${m}`}),a.jsx("div",{className:"text-xs text-blue-600 dark:text-blue-400",children:N("version.updateAvailable")})]})]})})]}),a.jsxs("div",{className:"md:p-2 md:border-t md:border-border flex-shrink-0",children:[a.jsx("div",{className:"md:hidden p-4 pb-20 border-t border-border/50",children:a.jsxs("button",{className:"w-full h-14 bg-muted/50 hover:bg-muted/70 rounded-2xl flex items-center justify-start gap-4 px-4 active:scale-[0.98] transition-all duration-150",onClick:p,children:[a.jsx("div",{className:"w-10 h-10 rounded-2xl bg-background/80 flex items-center justify-center",children:a.jsx(Ia,{className:"w-5 h-5 text-muted-foreground"})}),a.jsx("span",{className:"text-lg font-medium text-foreground",children:N("actions.settings")})]})}),a.jsxs(Be,{variant:"ghost",className:"hidden md:flex w-full justify-start gap-2 p-2 h-auto font-normal text-muted-foreground hover:text-foreground hover:bg-accent transition-colors duration-200",onClick:p,children:[a.jsx(Ia,{className:"w-3 h-3"}),a.jsx("span",{className:"text-xs",children:N("actions.settings")})]})]})]})]})}function Mf(e){const t=[],r=String(e||"");let n=r.indexOf(","),i=0,s=!1;for(;!s;){n===-1&&(n=r.length,s=!0);const o=r.slice(i,n).trim();(o||!s)&&t.push(o),i=n+1,n=r.indexOf(",",i)}return t}function BT(e,t){const r={};return(e[e.length-1]===""?[...e,""]:e).join((r.padRight?" ":"")+","+(r.padLeft===!1?"":" ")).trim()}const zT=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,UT=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,$T={};function Ff(e,t){return($T.jsx?UT:zT).test(e)}const qT=/[ \t\n\f\r]/g;function GT(e){return typeof e=="object"?e.type==="text"?Pf(e.value):!1:Pf(e)}function Pf(e){return e.replace(qT,"")===""}class ls{constructor(t,r,n){this.normal=r,this.property=t,n&&(this.space=n)}}ls.prototype.normal={};ls.prototype.property={};ls.prototype.space=void 0;function G4(e,t){const r={},n={};for(const i of e)Object.assign(r,i.property),Object.assign(n,i.normal);return new ls(r,n,t)}function Yi(e){return e.toLowerCase()}class zr{constructor(t,r){this.attribute=r,this.property=t}}zr.prototype.attribute="";zr.prototype.booleanish=!1;zr.prototype.boolean=!1;zr.prototype.commaOrSpaceSeparated=!1;zr.prototype.commaSeparated=!1;zr.prototype.defined=!1;zr.prototype.mustUseProperty=!1;zr.prototype.number=!1;zr.prototype.overloadedBoolean=!1;zr.prototype.property="";zr.prototype.spaceSeparated=!1;zr.prototype.space=void 0;let HT=0;const Et=La(),or=La(),Hm=La(),Ne=La(),Kt=La(),ri=La(),Gr=La();function La(){return 2**++HT}const Wm=Object.freeze(Object.defineProperty({__proto__:null,boolean:Et,booleanish:or,commaOrSpaceSeparated:Gr,commaSeparated:ri,number:Ne,overloadedBoolean:Hm,spaceSeparated:Kt},Symbol.toStringTag,{value:"Module"})),il=Object.keys(Wm);class qh extends zr{constructor(t,r,n,i){let s=-1;if(super(t,r),Bf(this,"space",i),typeof n=="number")for(;++s<il.length;){const o=il[s];Bf(this,il[s],(n&Wm[o])===Wm[o])}}}qh.prototype.defined=!0;function Bf(e,t,r){r&&(e[t]=r)}function bi(e){const t={},r={};for(const[n,i]of Object.entries(e.properties)){const s=new qh(n,e.transform(e.attributes||{},n),i,e.space);e.mustUseProperty&&e.mustUseProperty.includes(n)&&(s.mustUseProperty=!0),t[n]=s,r[Yi(n)]=n,r[Yi(s.attribute)]=n}return new ls(t,r,e.space)}const H4=bi({properties:{ariaActiveDescendant:null,ariaAtomic:or,ariaAutoComplete:null,ariaBusy:or,ariaChecked:or,ariaColCount:Ne,ariaColIndex:Ne,ariaColSpan:Ne,ariaControls:Kt,ariaCurrent:null,ariaDescribedBy:Kt,ariaDetails:null,ariaDisabled:or,ariaDropEffect:Kt,ariaErrorMessage:null,ariaExpanded:or,ariaFlowTo:Kt,ariaGrabbed:or,ariaHasPopup:null,ariaHidden:or,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:Kt,ariaLevel:Ne,ariaLive:null,ariaModal:or,ariaMultiLine:or,ariaMultiSelectable:or,ariaOrientation:null,ariaOwns:Kt,ariaPlaceholder:null,ariaPosInSet:Ne,ariaPressed:or,ariaReadOnly:or,ariaRelevant:null,ariaRequired:or,ariaRoleDescription:Kt,ariaRowCount:Ne,ariaRowIndex:Ne,ariaRowSpan:Ne,ariaSelected:or,ariaSetSize:Ne,ariaSort:null,ariaValueMax:Ne,ariaValueMin:Ne,ariaValueNow:Ne,ariaValueText:null,role:null},transform(e,t){return t==="role"?t:"aria-"+t.slice(4).toLowerCase()}});function W4(e,t){return t in e?e[t]:t}function V4(e,t){return W4(e,t.toLowerCase())}const WT=bi({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:ri,acceptCharset:Kt,accessKey:Kt,action:null,allow:null,allowFullScreen:Et,allowPaymentRequest:Et,allowUserMedia:Et,alt:null,as:null,async:Et,autoCapitalize:null,autoComplete:Kt,autoFocus:Et,autoPlay:Et,blocking:Kt,capture:null,charSet:null,checked:Et,cite:null,className:Kt,cols:Ne,colSpan:null,content:null,contentEditable:or,controls:Et,controlsList:Kt,coords:Ne|ri,crossOrigin:null,data:null,dateTime:null,decoding:null,default:Et,defer:Et,dir:null,dirName:null,disabled:Et,download:Hm,draggable:or,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:Et,formTarget:null,headers:Kt,height:Ne,hidden:Hm,high:Ne,href:null,hrefLang:null,htmlFor:Kt,httpEquiv:Kt,id:null,imageSizes:null,imageSrcSet:null,inert:Et,inputMode:null,integrity:null,is:null,isMap:Et,itemId:null,itemProp:Kt,itemRef:Kt,itemScope:Et,itemType:Kt,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:Et,low:Ne,manifest:null,max:null,maxLength:Ne,media:null,method:null,min:null,minLength:Ne,multiple:Et,muted:Et,name:null,nonce:null,noModule:Et,noValidate:Et,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:Et,optimum:Ne,pattern:null,ping:Kt,placeholder:null,playsInline:Et,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:Et,referrerPolicy:null,rel:Kt,required:Et,reversed:Et,rows:Ne,rowSpan:Ne,sandbox:Kt,scope:null,scoped:Et,seamless:Et,selected:Et,shadowRootClonable:Et,shadowRootDelegatesFocus:Et,shadowRootMode:null,shape:null,size:Ne,sizes:null,slot:null,span:Ne,spellCheck:or,src:null,srcDoc:null,srcLang:null,srcSet:null,start:Ne,step:null,style:null,tabIndex:Ne,target:null,title:null,translate:null,type:null,typeMustMatch:Et,useMap:null,value:or,width:Ne,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:Kt,axis:null,background:null,bgColor:null,border:Ne,borderColor:null,bottomMargin:Ne,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:Et,declare:Et,event:null,face:null,frame:null,frameBorder:null,hSpace:Ne,leftMargin:Ne,link:null,longDesc:null,lowSrc:null,marginHeight:Ne,marginWidth:Ne,noResize:Et,noHref:Et,noShade:Et,noWrap:Et,object:null,profile:null,prompt:null,rev:null,rightMargin:Ne,rules:null,scheme:null,scrolling:or,standby:null,summary:null,text:null,topMargin:Ne,valueType:null,version:null,vAlign:null,vLink:null,vSpace:Ne,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:Et,disableRemotePlayback:Et,prefix:null,property:null,results:Ne,security:null,unselectable:null},space:"html",transform:V4}),VT=bi({attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",dominantBaseline:"dominant-baseline",enableBackground:"enable-background",fillOpacity:"fill-opacity",fillRule:"fill-rule",floodColor:"flood-color",floodOpacity:"flood-opacity",fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",renderingIntent:"rendering-intent",shapeRendering:"shape-rendering",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",strokeDashArray:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeLineCap:"stroke-linecap",strokeLineJoin:"stroke-linejoin",strokeMiterLimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",vectorEffect:"vector-effect",vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",wordSpacing:"word-spacing",writingMode:"writing-mode",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},properties:{about:Gr,accentHeight:Ne,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:Ne,amplitude:Ne,arabicForm:null,ascent:Ne,attributeName:null,attributeType:null,azimuth:Ne,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:Ne,by:null,calcMode:null,capHeight:Ne,className:Kt,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:Ne,diffuseConstant:Ne,direction:null,display:null,dur:null,divisor:Ne,dominantBaseline:null,download:Et,dx:null,dy:null,edgeMode:null,editable:null,elevation:Ne,enableBackground:null,end:null,event:null,exponent:Ne,externalResourcesRequired:null,fill:null,fillOpacity:Ne,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:ri,g2:ri,glyphName:ri,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:Ne,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:Ne,horizOriginX:Ne,horizOriginY:Ne,id:null,ideographic:Ne,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:Ne,k:Ne,k1:Ne,k2:Ne,k3:Ne,k4:Ne,kernelMatrix:Gr,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:Ne,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:Ne,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:Ne,overlineThickness:Ne,paintOrder:null,panose1:null,path:null,pathLength:Ne,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:Kt,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:Ne,pointsAtY:Ne,pointsAtZ:Ne,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:Gr,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:Gr,rev:Gr,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:Gr,requiredFeatures:Gr,requiredFonts:Gr,requiredFormats:Gr,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:Ne,specularExponent:Ne,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:Ne,strikethroughThickness:Ne,string:null,stroke:null,strokeDashArray:Gr,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:Ne,strokeOpacity:Ne,strokeWidth:null,style:null,surfaceScale:Ne,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:Gr,tabIndex:Ne,tableValues:null,target:null,targetX:Ne,targetY:Ne,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:Gr,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:Ne,underlineThickness:Ne,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:Ne,values:null,vAlphabetic:Ne,vMathematical:Ne,vectorEffect:null,vHanging:Ne,vIdeographic:Ne,version:null,vertAdvY:Ne,vertOriginX:Ne,vertOriginY:Ne,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:Ne,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:W4}),K4=bi({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform(e,t){return"xlink:"+t.slice(5).toLowerCase()}}),Y4=bi({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:V4}),X4=bi({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}}),KT={classId:"classID",dataType:"datatype",itemId:"itemID",strokeDashArray:"strokeDasharray",strokeDashOffset:"strokeDashoffset",strokeLineCap:"strokeLinecap",strokeLineJoin:"strokeLinejoin",strokeMiterLimit:"strokeMiterlimit",typeOf:"typeof",xLinkActuate:"xlinkActuate",xLinkArcRole:"xlinkArcrole",xLinkHref:"xlinkHref",xLinkRole:"xlinkRole",xLinkShow:"xlinkShow",xLinkTitle:"xlinkTitle",xLinkType:"xlinkType",xmlnsXLink:"xmlnsXlink"},YT=/[A-Z]/g,zf=/-[a-z]/g,XT=/^data[-\w.:]+$/i;function Z4(e,t){const r=Yi(t);let n=t,i=zr;if(r in e.normal)return e.property[e.normal[r]];if(r.length>4&&r.slice(0,4)==="data"&&XT.test(t)){if(t.charAt(4)==="-"){const s=t.slice(5).replace(zf,JT);n="data"+s.charAt(0).toUpperCase()+s.slice(1)}else{const s=t.slice(4);if(!zf.test(s)){let o=s.replace(YT,ZT);o.charAt(0)!=="-"&&(o="-"+o),t="data"+o}}i=qh}return new i(n,t)}function ZT(e){return"-"+e.toLowerCase()}function JT(e){return e.charAt(1).toUpperCase()}const J4=G4([H4,WT,K4,Y4,X4],"html"),Co=G4([H4,VT,K4,Y4,X4],"svg");function Uf(e){const t=String(e||"").trim();return t?t.split(/[ \t\n\r\f]+/g):[]}function QT(e){return e.join(" ").trim()}var Ha={},sl,$f;function eA(){if($f)return sl;$f=1;var e=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,t=/\n/g,r=/^\s*/,n=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,i=/^:\s*/,s=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,o=/^[;\s]*/,l=/^\s+|\s+$/g,c=`
|
|
415
415
|
`,d="/",u="*",p="",h="comment",m="declaration";sl=function(f,w){if(typeof f!="string")throw new TypeError("First argument must be a string");if(!f)return[];w=w||{};var S=1,k=1;function E(D){var z=D.match(t);z&&(S+=z.length);var U=D.lastIndexOf(c);k=~U?D.length-U:k+D.length}function N(){var D={line:S,column:k};return function(z){return z.position=new C(D),M(),z}}function C(D){this.start=D,this.end={line:S,column:k},this.source=w.source}C.prototype.content=f;function v(D){var z=new Error(w.source+":"+S+":"+k+": "+D);if(z.reason=D,z.filename=w.source,z.line=S,z.column=k,z.source=f,!w.silent)throw z}function I(D){var z=D.exec(f);if(z){var U=z[0];return E(U),f=f.slice(U.length),z}}function M(){I(r)}function j(D){var z;for(D=D||[];z=T();)z!==!1&&D.push(z);return D}function T(){var D=N();if(!(d!=f.charAt(0)||u!=f.charAt(1))){for(var z=2;p!=f.charAt(z)&&(u!=f.charAt(z)||d!=f.charAt(z+1));)++z;if(z+=2,p===f.charAt(z-1))return v("End of comment missing");var U=f.slice(2,z-2);return k+=2,E(U),f=f.slice(z),k+=2,D({type:h,comment:U})}}function P(){var D=N(),z=I(n);if(z){if(T(),!I(i))return v("property missing ':'");var U=I(s),G=D({type:m,property:g(z[0].replace(e,p)),value:U?g(U[0].replace(e,p)):p});return I(o),G}}function q(){var D=[];j(D);for(var z;z=P();)z!==!1&&(D.push(z),j(D));return D}return M(),q()};function g(f){return f?f.replace(l,p):p}return sl}var qf;function tA(){if(qf)return Ha;qf=1;var e=Ha&&Ha.__importDefault||function(n){return n&&n.__esModule?n:{default:n}};Object.defineProperty(Ha,"__esModule",{value:!0}),Ha.default=r;var t=e(eA());function r(n,i){var s=null;if(!n||typeof n!="string")return s;var o=(0,t.default)(n),l=typeof i=="function";return o.forEach(function(c){if(c.type==="declaration"){var d=c.property,u=c.value;l?i(d,u,c):u&&(s=s||{},s[d]=u)}}),s}return Ha}var Ri={},Gf;function rA(){if(Gf)return Ri;Gf=1,Object.defineProperty(Ri,"__esModule",{value:!0}),Ri.camelCase=void 0;var e=/^--[a-zA-Z0-9_-]+$/,t=/-([a-z])/g,r=/^[^-]+$/,n=/^-(webkit|moz|ms|o|khtml)-/,i=/^-(ms)-/,s=function(d){return!d||r.test(d)||e.test(d)},o=function(d,u){return u.toUpperCase()},l=function(d,u){return"".concat(u,"-")},c=function(d,u){return u===void 0&&(u={}),s(d)?d:(d=d.toLowerCase(),u.reactCompat?d=d.replace(i,l):d=d.replace(n,l),d.replace(t,o))};return Ri.camelCase=c,Ri}var ji,Hf;function nA(){if(Hf)return ji;Hf=1;var e=ji&&ji.__importDefault||function(i){return i&&i.__esModule?i:{default:i}},t=e(tA()),r=rA();function n(i,s){var o={};return!i||typeof i!="string"||(0,t.default)(i,function(l,c){l&&c&&(o[(0,r.camelCase)(l,s)]=c)}),o}return n.default=n,ji=n,ji}var aA=nA();const iA=mi(aA),Q4=eS("end"),Gh=eS("start");function eS(e){return t;function t(r){const n=r&&r.position&&r.position[e]||{};if(typeof n.line=="number"&&n.line>0&&typeof n.column=="number"&&n.column>0)return{line:n.line,column:n.column,offset:typeof n.offset=="number"&&n.offset>-1?n.offset:void 0}}}function sA(e){const t=Gh(e),r=Q4(e);if(t&&r)return{start:t,end:r}}function Ui(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?Wf(e.position):"start"in e||"end"in e?Wf(e):"line"in e||"column"in e?Vm(e):""}function Vm(e){return Vf(e&&e.line)+":"+Vf(e&&e.column)}function Wf(e){return Vm(e&&e.start)+"-"+Vm(e&&e.end)}function Vf(e){return e&&typeof e=="number"?e:1}class wr extends Error{constructor(t,r,n){super(),typeof r=="string"&&(n=r,r=void 0);let i="",s={},o=!1;if(r&&("line"in r&&"column"in r?s={place:r}:"start"in r&&"end"in r?s={place:r}:"type"in r?s={ancestors:[r],place:r.position}:s={...r}),typeof t=="string"?i=t:!s.cause&&t&&(o=!0,i=t.message,s.cause=t),!s.ruleId&&!s.source&&typeof n=="string"){const c=n.indexOf(":");c===-1?s.ruleId=n:(s.source=n.slice(0,c),s.ruleId=n.slice(c+1))}if(!s.place&&s.ancestors&&s.ancestors){const c=s.ancestors[s.ancestors.length-1];c&&(s.place=c.position)}const l=s.place&&"start"in s.place?s.place.start:s.place;this.ancestors=s.ancestors||void 0,this.cause=s.cause||void 0,this.column=l?l.column:void 0,this.fatal=void 0,this.file,this.message=i,this.line=l?l.line:void 0,this.name=Ui(s.place)||"1:1",this.place=s.place||void 0,this.reason=this.message,this.ruleId=s.ruleId||void 0,this.source=s.source||void 0,this.stack=o&&s.cause&&typeof s.cause.stack=="string"?s.cause.stack:"",this.actual,this.expected,this.note,this.url}}wr.prototype.file="";wr.prototype.name="";wr.prototype.reason="";wr.prototype.message="";wr.prototype.stack="";wr.prototype.column=void 0;wr.prototype.line=void 0;wr.prototype.ancestors=void 0;wr.prototype.cause=void 0;wr.prototype.fatal=void 0;wr.prototype.place=void 0;wr.prototype.ruleId=void 0;wr.prototype.source=void 0;const Hh={}.hasOwnProperty,oA=new Map,lA=/[A-Z]/g,cA=new Set(["table","tbody","thead","tfoot","tr"]),dA=new Set(["td","th"]),tS="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function uA(e,t){if(!t||t.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const r=t.filePath||void 0;let n;if(t.development){if(typeof t.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");n=yA(r,t.jsxDEV)}else{if(typeof t.jsx!="function")throw new TypeError("Expected `jsx` in production options");if(typeof t.jsxs!="function")throw new TypeError("Expected `jsxs` in production options");n=xA(r,t.jsx,t.jsxs)}const i={Fragment:t.Fragment,ancestors:[],components:t.components||{},create:n,elementAttributeNameCase:t.elementAttributeNameCase||"react",evaluater:t.createEvaluater?t.createEvaluater():void 0,filePath:r,ignoreInvalidStyle:t.ignoreInvalidStyle||!1,passKeys:t.passKeys!==!1,passNode:t.passNode||!1,schema:t.space==="svg"?Co:J4,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},s=rS(i,e,void 0);return s&&typeof s!="string"?s:i.create(e,i.Fragment,{children:s||void 0},void 0)}function rS(e,t,r){if(t.type==="element")return pA(e,t,r);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return mA(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return gA(e,t,r);if(t.type==="mdxjsEsm")return hA(e,t);if(t.type==="root")return fA(e,t,r);if(t.type==="text")return bA(e,t)}function pA(e,t,r){const n=e.schema;let i=n;t.tagName.toLowerCase()==="svg"&&n.space==="html"&&(i=Co,e.schema=i),e.ancestors.push(t);const s=aS(e,t.tagName,!1),o=vA(e,t);let l=Vh(e,t);return cA.has(t.tagName)&&(l=l.filter(function(c){return typeof c=="string"?!GT(c):!0})),nS(e,o,s,t),Wh(o,l),e.ancestors.pop(),e.schema=n,e.create(t,s,o,r)}function mA(e,t){if(t.data&&t.data.estree&&e.evaluater){const n=t.data.estree.body[0];return n.type,e.evaluater.evaluateExpression(n.expression)}Xi(e,t.position)}function hA(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);Xi(e,t.position)}function gA(e,t,r){const n=e.schema;let i=n;t.name==="svg"&&n.space==="html"&&(i=Co,e.schema=i),e.ancestors.push(t);const s=t.name===null?e.Fragment:aS(e,t.name,!0),o=kA(e,t),l=Vh(e,t);return nS(e,o,s,t),Wh(o,l),e.ancestors.pop(),e.schema=n,e.create(t,s,o,r)}function fA(e,t,r){const n={};return Wh(n,Vh(e,t)),e.create(t,e.Fragment,n,r)}function bA(e,t){return t.value}function nS(e,t,r,n){typeof r!="string"&&r!==e.Fragment&&e.passNode&&(t.node=n)}function Wh(e,t){if(t.length>0){const r=t.length>1?t:t[0];r&&(e.children=r)}}function xA(e,t,r){return n;function n(i,s,o,l){const d=Array.isArray(o.children)?r:t;return l?d(s,o,l):d(s,o)}}function yA(e,t){return r;function r(n,i,s,o){const l=Array.isArray(s.children),c=Gh(n);return t(i,s,o,l,{columnNumber:c?c.column-1:void 0,fileName:e,lineNumber:c?c.line:void 0},void 0)}}function vA(e,t){const r={};let n,i;for(i in t.properties)if(i!=="children"&&Hh.call(t.properties,i)){const s=wA(e,i,t.properties[i]);if(s){const[o,l]=s;e.tableCellAlignToStyle&&o==="align"&&typeof l=="string"&&dA.has(t.tagName)?n=l:r[o]=l}}if(n){const s=r.style||(r.style={});s[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=n}return r}function kA(e,t){const r={};for(const n of t.attributes)if(n.type==="mdxJsxExpressionAttribute")if(n.data&&n.data.estree&&e.evaluater){const s=n.data.estree.body[0];s.type;const o=s.expression;o.type;const l=o.properties[0];l.type,Object.assign(r,e.evaluater.evaluateExpression(l.argument))}else Xi(e,t.position);else{const i=n.name;let s;if(n.value&&typeof n.value=="object")if(n.value.data&&n.value.data.estree&&e.evaluater){const l=n.value.data.estree.body[0];l.type,s=e.evaluater.evaluateExpression(l.expression)}else Xi(e,t.position);else s=n.value===null?!0:n.value;r[i]=s}return r}function Vh(e,t){const r=[];let n=-1;const i=e.passKeys?new Map:oA;for(;++n<t.children.length;){const s=t.children[n];let o;if(e.passKeys){const c=s.type==="element"?s.tagName:s.type==="mdxJsxFlowElement"||s.type==="mdxJsxTextElement"?s.name:void 0;if(c){const d=i.get(c)||0;o=c+"-"+d,i.set(c,d+1)}}const l=rS(e,s,o);l!==void 0&&r.push(l)}return r}function wA(e,t,r){const n=Z4(e.schema,t);if(!(r==null||typeof r=="number"&&Number.isNaN(r))){if(Array.isArray(r)&&(r=n.commaSeparated?BT(r):QT(r)),n.property==="style"){let i=typeof r=="object"?r:SA(e,String(r));return e.stylePropertyNameCase==="css"&&(i=EA(i)),["style",i]}return[e.elementAttributeNameCase==="react"&&n.space?KT[n.property]||n.property:n.attribute,r]}}function SA(e,t){try{return iA(t,{reactCompat:!0})}catch(r){if(e.ignoreInvalidStyle)return{};const n=r,i=new wr("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:n,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw i.file=e.filePath||void 0,i.url=tS+"#cannot-parse-style-attribute",i}}function aS(e,t,r){let n;if(!r)n={type:"Literal",value:t};else if(t.includes(".")){const i=t.split(".");let s=-1,o;for(;++s<i.length;){const l=Ff(i[s])?{type:"Identifier",name:i[s]}:{type:"Literal",value:i[s]};o=o?{type:"MemberExpression",object:o,property:l,computed:!!(s&&l.type==="Literal"),optional:!1}:l}n=o}else n=Ff(t)&&!/^[a-z]/.test(t)?{type:"Identifier",name:t}:{type:"Literal",value:t};if(n.type==="Literal"){const i=n.value;return Hh.call(e.components,i)?e.components[i]:i}if(e.evaluater)return e.evaluater.evaluateExpression(n);Xi(e)}function Xi(e,t){const r=new wr("Cannot handle MDX estrees without `createEvaluater`",{ancestors:e.ancestors,place:t,ruleId:"mdx-estree",source:"hast-util-to-jsx-runtime"});throw r.file=e.filePath||void 0,r.url=tS+"#cannot-handle-mdx-estrees-without-createevaluater",r}function EA(e){const t={};let r;for(r in e)Hh.call(e,r)&&(t[NA(r)]=e[r]);return t}function NA(e){let t=e.replace(lA,CA);return t.slice(0,3)==="ms-"&&(t="-"+t),t}function CA(e){return"-"+e.toLowerCase()}const ol={action:["form"],cite:["blockquote","del","ins","q"],data:["object"],formAction:["button","input"],href:["a","area","base","link"],icon:["menuitem"],itemId:null,manifest:["html"],ping:["a","area"],poster:["video"],src:["audio","embed","iframe","img","input","script","source","track","video"]},TA={};function Kh(e,t){const r=TA,n=typeof r.includeImageAlt=="boolean"?r.includeImageAlt:!0,i=typeof r.includeHtml=="boolean"?r.includeHtml:!0;return iS(e,n,i)}function iS(e,t,r){if(AA(e)){if("value"in e)return e.type==="html"&&!r?"":e.value;if(t&&"alt"in e&&e.alt)return e.alt;if("children"in e)return Kf(e.children,t,r)}return Array.isArray(e)?Kf(e,t,r):""}function Kf(e,t,r){const n=[];let i=-1;for(;++i<e.length;)n[i]=iS(e[i],t,r);return n.join("")}function AA(e){return!!(e&&typeof e=="object")}const Yf=document.createElement("i");function Yh(e){const t="&"+e+";";Yf.innerHTML=t;const r=Yf.textContent;return r.charCodeAt(r.length-1)===59&&e!=="semi"||r===t?!1:r}function Kr(e,t,r,n){const i=e.length;let s=0,o;if(t<0?t=-t>i?0:i+t:t=t>i?i:t,r=r>0?r:0,n.length<1e4)o=Array.from(n),o.unshift(t,r),e.splice(...o);else for(r&&e.splice(t,r);s<n.length;)o=n.slice(s,s+1e4),o.unshift(t,0),e.splice(...o),s+=1e4,t+=1e4}function en(e,t){return e.length>0?(Kr(e,e.length,0,t),e):t}const Xf={}.hasOwnProperty;function sS(e){const t={};let r=-1;for(;++r<e.length;)IA(t,e[r]);return t}function IA(e,t){let r;for(r in t){const i=(Xf.call(e,r)?e[r]:void 0)||(e[r]={}),s=t[r];let o;if(s)for(o in s){Xf.call(i,o)||(i[o]=[]);const l=s[o];RA(i[o],Array.isArray(l)?l:l?[l]:[])}}}function RA(e,t){let r=-1;const n=[];for(;++r<t.length;)(t[r].add==="after"?e:n).push(t[r]);Kr(e,0,0,n)}function oS(e,t){const r=Number.parseInt(e,t);return r<9||r===11||r>13&&r<32||r>126&&r<160||r>55295&&r<57344||r>64975&&r<65008||(r&65535)===65535||(r&65535)===65534||r>1114111?"�":String.fromCodePoint(r)}function hn(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const Tr=fa(/[A-Za-z]/),kr=fa(/[\dA-Za-z]/),jA=fa(/[#-'*+\--9=?A-Z^-~]/);function io(e){return e!==null&&(e<32||e===127)}const Km=fa(/\d/),_A=fa(/[\dA-Fa-f]/),LA=fa(/[!-/:-@[-`{-~]/);function Xe(e){return e!==null&&e<-2}function qt(e){return e!==null&&(e<0||e===32)}function jt(e){return e===-2||e===-1||e===32}const To=fa(new RegExp("\\p{P}|\\p{S}","u")),ja=fa(/\s/);function fa(e){return t;function t(r){return r!==null&&r>-1&&e.test(String.fromCharCode(r))}}function xi(e){const t=[];let r=-1,n=0,i=0;for(;++r<e.length;){const s=e.charCodeAt(r);let o="";if(s===37&&kr(e.charCodeAt(r+1))&&kr(e.charCodeAt(r+2)))i=2;else if(s<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(s))||(o=String.fromCharCode(s));else if(s>55295&&s<57344){const l=e.charCodeAt(r+1);s<56320&&l>56319&&l<57344?(o=String.fromCharCode(s,l),i=1):o="�"}else o=String.fromCharCode(s);o&&(t.push(e.slice(n,r),encodeURIComponent(o)),n=r+i+1,o=""),i&&(r+=i,i=0)}return t.join("")+e.slice(n)}function At(e,t,r,n){const i=n?n-1:Number.POSITIVE_INFINITY;let s=0;return o;function o(c){return jt(c)?(e.enter(r),l(c)):t(c)}function l(c){return jt(c)&&s++<i?(e.consume(c),l):(e.exit(r),t(c))}}const OA={tokenize:DA};function DA(e){const t=e.attempt(this.parser.constructs.contentInitial,n,i);let r;return t;function n(l){if(l===null){e.consume(l);return}return e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),At(e,t,"linePrefix")}function i(l){return e.enter("paragraph"),s(l)}function s(l){const c=e.enter("chunkText",{contentType:"text",previous:r});return r&&(r.next=c),r=c,o(l)}function o(l){if(l===null){e.exit("chunkText"),e.exit("paragraph"),e.consume(l);return}return Xe(l)?(e.consume(l),e.exit("chunkText"),s):(e.consume(l),o)}}const MA={tokenize:FA},Zf={tokenize:PA};function FA(e){const t=this,r=[];let n=0,i,s,o;return l;function l(E){if(n<r.length){const N=r[n];return t.containerState=N[1],e.attempt(N[0].continuation,c,d)(E)}return d(E)}function c(E){if(n++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,i&&k();const N=t.events.length;let C=N,v;for(;C--;)if(t.events[C][0]==="exit"&&t.events[C][1].type==="chunkFlow"){v=t.events[C][1].end;break}S(n);let I=N;for(;I<t.events.length;)t.events[I][1].end={...v},I++;return Kr(t.events,C+1,0,t.events.slice(N)),t.events.length=I,d(E)}return l(E)}function d(E){if(n===r.length){if(!i)return h(E);if(i.currentConstruct&&i.currentConstruct.concrete)return g(E);t.interrupt=!!(i.currentConstruct&&!i._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(Zf,u,p)(E)}function u(E){return i&&k(),S(n),h(E)}function p(E){return t.parser.lazy[t.now().line]=n!==r.length,o=t.now().offset,g(E)}function h(E){return t.containerState={},e.attempt(Zf,m,g)(E)}function m(E){return n++,r.push([t.currentConstruct,t.containerState]),h(E)}function g(E){if(E===null){i&&k(),S(0),e.consume(E);return}return i=i||t.parser.flow(t.now()),e.enter("chunkFlow",{_tokenizer:i,contentType:"flow",previous:s}),f(E)}function f(E){if(E===null){w(e.exit("chunkFlow"),!0),S(0),e.consume(E);return}return Xe(E)?(e.consume(E),w(e.exit("chunkFlow")),n=0,t.interrupt=void 0,l):(e.consume(E),f)}function w(E,N){const C=t.sliceStream(E);if(N&&C.push(null),E.previous=s,s&&(s.next=E),s=E,i.defineSkip(E.start),i.write(C),t.parser.lazy[E.start.line]){let v=i.events.length;for(;v--;)if(i.events[v][1].start.offset<o&&(!i.events[v][1].end||i.events[v][1].end.offset>o))return;const I=t.events.length;let M=I,j,T;for(;M--;)if(t.events[M][0]==="exit"&&t.events[M][1].type==="chunkFlow"){if(j){T=t.events[M][1].end;break}j=!0}for(S(n),v=I;v<t.events.length;)t.events[v][1].end={...T},v++;Kr(t.events,M+1,0,t.events.slice(I)),t.events.length=v}}function S(E){let N=r.length;for(;N-- >E;){const C=r[N];t.containerState=C[1],C[0].exit.call(t,e)}r.length=E}function k(){i.write([null]),s=void 0,i=void 0,t.containerState._closeFlow=void 0}}function PA(e,t,r){return At(e,e.attempt(this.parser.constructs.document,t,r),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function oi(e){if(e===null||qt(e)||ja(e))return 1;if(To(e))return 2}function Ao(e,t,r){const n=[];let i=-1;for(;++i<e.length;){const s=e[i].resolveAll;s&&!n.includes(s)&&(t=s(t,r),n.push(s))}return t}const Ym={name:"attention",resolveAll:BA,tokenize:zA};function BA(e,t){let r=-1,n,i,s,o,l,c,d,u;for(;++r<e.length;)if(e[r][0]==="enter"&&e[r][1].type==="attentionSequence"&&e[r][1]._close){for(n=r;n--;)if(e[n][0]==="exit"&&e[n][1].type==="attentionSequence"&&e[n][1]._open&&t.sliceSerialize(e[n][1]).charCodeAt(0)===t.sliceSerialize(e[r][1]).charCodeAt(0)){if((e[n][1]._close||e[r][1]._open)&&(e[r][1].end.offset-e[r][1].start.offset)%3&&!((e[n][1].end.offset-e[n][1].start.offset+e[r][1].end.offset-e[r][1].start.offset)%3))continue;c=e[n][1].end.offset-e[n][1].start.offset>1&&e[r][1].end.offset-e[r][1].start.offset>1?2:1;const p={...e[n][1].end},h={...e[r][1].start};Jf(p,-c),Jf(h,c),o={type:c>1?"strongSequence":"emphasisSequence",start:p,end:{...e[n][1].end}},l={type:c>1?"strongSequence":"emphasisSequence",start:{...e[r][1].start},end:h},s={type:c>1?"strongText":"emphasisText",start:{...e[n][1].end},end:{...e[r][1].start}},i={type:c>1?"strong":"emphasis",start:{...o.start},end:{...l.end}},e[n][1].end={...o.start},e[r][1].start={...l.end},d=[],e[n][1].end.offset-e[n][1].start.offset&&(d=en(d,[["enter",e[n][1],t],["exit",e[n][1],t]])),d=en(d,[["enter",i,t],["enter",o,t],["exit",o,t],["enter",s,t]]),d=en(d,Ao(t.parser.constructs.insideSpan.null,e.slice(n+1,r),t)),d=en(d,[["exit",s,t],["enter",l,t],["exit",l,t],["exit",i,t]]),e[r][1].end.offset-e[r][1].start.offset?(u=2,d=en(d,[["enter",e[r][1],t],["exit",e[r][1],t]])):u=0,Kr(e,n-1,r-n+3,d),r=n+d.length-u-2;break}}for(r=-1;++r<e.length;)e[r][1].type==="attentionSequence"&&(e[r][1].type="data");return e}function zA(e,t){const r=this.parser.constructs.attentionMarkers.null,n=this.previous,i=oi(n);let s;return o;function o(c){return s=c,e.enter("attentionSequence"),l(c)}function l(c){if(c===s)return e.consume(c),l;const d=e.exit("attentionSequence"),u=oi(c),p=!u||u===2&&i||r.includes(c),h=!i||i===2&&u||r.includes(n);return d._open=!!(s===42?p:p&&(i||!h)),d._close=!!(s===42?h:h&&(u||!p)),t(c)}}function Jf(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const UA={name:"autolink",tokenize:$A};function $A(e,t,r){let n=0;return i;function i(m){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(m),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),s}function s(m){return Tr(m)?(e.consume(m),o):m===64?r(m):d(m)}function o(m){return m===43||m===45||m===46||kr(m)?(n=1,l(m)):d(m)}function l(m){return m===58?(e.consume(m),n=0,c):(m===43||m===45||m===46||kr(m))&&n++<32?(e.consume(m),l):(n=0,d(m))}function c(m){return m===62?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(m),e.exit("autolinkMarker"),e.exit("autolink"),t):m===null||m===32||m===60||io(m)?r(m):(e.consume(m),c)}function d(m){return m===64?(e.consume(m),u):jA(m)?(e.consume(m),d):r(m)}function u(m){return kr(m)?p(m):r(m)}function p(m){return m===46?(e.consume(m),n=0,u):m===62?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(m),e.exit("autolinkMarker"),e.exit("autolink"),t):h(m)}function h(m){if((m===45||kr(m))&&n++<63){const g=m===45?h:p;return e.consume(m),g}return r(m)}}const cs={partial:!0,tokenize:qA};function qA(e,t,r){return n;function n(s){return jt(s)?At(e,i,"linePrefix")(s):i(s)}function i(s){return s===null||Xe(s)?t(s):r(s)}}const lS={continuation:{tokenize:HA},exit:WA,name:"blockQuote",tokenize:GA};function GA(e,t,r){const n=this;return i;function i(o){if(o===62){const l=n.containerState;return l.open||(e.enter("blockQuote",{_container:!0}),l.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(o),e.exit("blockQuoteMarker"),s}return r(o)}function s(o){return jt(o)?(e.enter("blockQuotePrefixWhitespace"),e.consume(o),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(o))}}function HA(e,t,r){const n=this;return i;function i(o){return jt(o)?At(e,s,"linePrefix",n.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(o):s(o)}function s(o){return e.attempt(lS,t,r)(o)}}function WA(e){e.exit("blockQuote")}const cS={name:"characterEscape",tokenize:VA};function VA(e,t,r){return n;function n(s){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(s),e.exit("escapeMarker"),i}function i(s){return LA(s)?(e.enter("characterEscapeValue"),e.consume(s),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):r(s)}}const dS={name:"characterReference",tokenize:KA};function KA(e,t,r){const n=this;let i=0,s,o;return l;function l(p){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(p),e.exit("characterReferenceMarker"),c}function c(p){return p===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(p),e.exit("characterReferenceMarkerNumeric"),d):(e.enter("characterReferenceValue"),s=31,o=kr,u(p))}function d(p){return p===88||p===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(p),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),s=6,o=_A,u):(e.enter("characterReferenceValue"),s=7,o=Km,u(p))}function u(p){if(p===59&&i){const h=e.exit("characterReferenceValue");return o===kr&&!Yh(n.sliceSerialize(h))?r(p):(e.enter("characterReferenceMarker"),e.consume(p),e.exit("characterReferenceMarker"),e.exit("characterReference"),t)}return o(p)&&i++<s?(e.consume(p),u):r(p)}}const Qf={partial:!0,tokenize:XA},eb={concrete:!0,name:"codeFenced",tokenize:YA};function YA(e,t,r){const n=this,i={partial:!0,tokenize:C};let s=0,o=0,l;return c;function c(v){return d(v)}function d(v){const I=n.events[n.events.length-1];return s=I&&I[1].type==="linePrefix"?I[2].sliceSerialize(I[1],!0).length:0,l=v,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),u(v)}function u(v){return v===l?(o++,e.consume(v),u):o<3?r(v):(e.exit("codeFencedFenceSequence"),jt(v)?At(e,p,"whitespace")(v):p(v))}function p(v){return v===null||Xe(v)?(e.exit("codeFencedFence"),n.interrupt?t(v):e.check(Qf,f,N)(v)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),h(v))}function h(v){return v===null||Xe(v)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),p(v)):jt(v)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),At(e,m,"whitespace")(v)):v===96&&v===l?r(v):(e.consume(v),h)}function m(v){return v===null||Xe(v)?p(v):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),g(v))}function g(v){return v===null||Xe(v)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),p(v)):v===96&&v===l?r(v):(e.consume(v),g)}function f(v){return e.attempt(i,N,w)(v)}function w(v){return e.enter("lineEnding"),e.consume(v),e.exit("lineEnding"),S}function S(v){return s>0&&jt(v)?At(e,k,"linePrefix",s+1)(v):k(v)}function k(v){return v===null||Xe(v)?e.check(Qf,f,N)(v):(e.enter("codeFlowValue"),E(v))}function E(v){return v===null||Xe(v)?(e.exit("codeFlowValue"),k(v)):(e.consume(v),E)}function N(v){return e.exit("codeFenced"),t(v)}function C(v,I,M){let j=0;return T;function T(U){return v.enter("lineEnding"),v.consume(U),v.exit("lineEnding"),P}function P(U){return v.enter("codeFencedFence"),jt(U)?At(v,q,"linePrefix",n.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(U):q(U)}function q(U){return U===l?(v.enter("codeFencedFenceSequence"),D(U)):M(U)}function D(U){return U===l?(j++,v.consume(U),D):j>=o?(v.exit("codeFencedFenceSequence"),jt(U)?At(v,z,"whitespace")(U):z(U)):M(U)}function z(U){return U===null||Xe(U)?(v.exit("codeFencedFence"),I(U)):M(U)}}}function XA(e,t,r){const n=this;return i;function i(o){return o===null?r(o):(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),s)}function s(o){return n.parser.lazy[n.now().line]?r(o):t(o)}}const ll={name:"codeIndented",tokenize:JA},ZA={partial:!0,tokenize:QA};function JA(e,t,r){const n=this;return i;function i(d){return e.enter("codeIndented"),At(e,s,"linePrefix",5)(d)}function s(d){const u=n.events[n.events.length-1];return u&&u[1].type==="linePrefix"&&u[2].sliceSerialize(u[1],!0).length>=4?o(d):r(d)}function o(d){return d===null?c(d):Xe(d)?e.attempt(ZA,o,c)(d):(e.enter("codeFlowValue"),l(d))}function l(d){return d===null||Xe(d)?(e.exit("codeFlowValue"),o(d)):(e.consume(d),l)}function c(d){return e.exit("codeIndented"),t(d)}}function QA(e,t,r){const n=this;return i;function i(o){return n.parser.lazy[n.now().line]?r(o):Xe(o)?(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),i):At(e,s,"linePrefix",5)(o)}function s(o){const l=n.events[n.events.length-1];return l&&l[1].type==="linePrefix"&&l[2].sliceSerialize(l[1],!0).length>=4?t(o):Xe(o)?i(o):r(o)}}const e7={name:"codeText",previous:r7,resolve:t7,tokenize:n7};function t7(e){let t=e.length-4,r=3,n,i;if((e[r][1].type==="lineEnding"||e[r][1].type==="space")&&(e[t][1].type==="lineEnding"||e[t][1].type==="space")){for(n=r;++n<t;)if(e[n][1].type==="codeTextData"){e[r][1].type="codeTextPadding",e[t][1].type="codeTextPadding",r+=2,t-=2;break}}for(n=r-1,t++;++n<=t;)i===void 0?n!==t&&e[n][1].type!=="lineEnding"&&(i=n):(n===t||e[n][1].type==="lineEnding")&&(e[i][1].type="codeTextData",n!==i+2&&(e[i][1].end=e[n-1][1].end,e.splice(i+2,n-i-2),t-=n-i-2,n=i+2),i=void 0);return e}function r7(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function n7(e,t,r){let n=0,i,s;return o;function o(p){return e.enter("codeText"),e.enter("codeTextSequence"),l(p)}function l(p){return p===96?(e.consume(p),n++,l):(e.exit("codeTextSequence"),c(p))}function c(p){return p===null?r(p):p===32?(e.enter("space"),e.consume(p),e.exit("space"),c):p===96?(s=e.enter("codeTextSequence"),i=0,u(p)):Xe(p)?(e.enter("lineEnding"),e.consume(p),e.exit("lineEnding"),c):(e.enter("codeTextData"),d(p))}function d(p){return p===null||p===32||p===96||Xe(p)?(e.exit("codeTextData"),c(p)):(e.consume(p),d)}function u(p){return p===96?(e.consume(p),i++,u):i===n?(e.exit("codeTextSequence"),e.exit("codeText"),t(p)):(s.type="codeTextData",d(p))}}class a7{constructor(t){this.left=t?[...t]:[],this.right=[]}get(t){if(t<0||t>=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+t+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return t<this.left.length?this.left[t]:this.right[this.right.length-t+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(t,r){const n=r??Number.POSITIVE_INFINITY;return n<this.left.length?this.left.slice(t,n):t>this.left.length?this.right.slice(this.right.length-n+this.left.length,this.right.length-t+this.left.length).reverse():this.left.slice(t).concat(this.right.slice(this.right.length-n+this.left.length).reverse())}splice(t,r,n){const i=r||0;this.setCursor(Math.trunc(t));const s=this.right.splice(this.right.length-i,Number.POSITIVE_INFINITY);return n&&_i(this.left,n),s.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(t){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(t)}pushMany(t){this.setCursor(Number.POSITIVE_INFINITY),_i(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),_i(this.right,t.reverse())}setCursor(t){if(!(t===this.left.length||t>this.left.length&&this.right.length===0||t<0&&this.left.length===0))if(t<this.left.length){const r=this.left.splice(t,Number.POSITIVE_INFINITY);_i(this.right,r.reverse())}else{const r=this.right.splice(this.left.length+this.right.length-t,Number.POSITIVE_INFINITY);_i(this.left,r.reverse())}}}function _i(e,t){let r=0;if(t.length<1e4)e.push(...t);else for(;r<t.length;)e.push(...t.slice(r,r+1e4)),r+=1e4}function uS(e){const t={};let r=-1,n,i,s,o,l,c,d;const u=new a7(e);for(;++r<u.length;){for(;r in t;)r=t[r];if(n=u.get(r),r&&n[1].type==="chunkFlow"&&u.get(r-1)[1].type==="listItemPrefix"&&(c=n[1]._tokenizer.events,s=0,s<c.length&&c[s][1].type==="lineEndingBlank"&&(s+=2),s<c.length&&c[s][1].type==="content"))for(;++s<c.length&&c[s][1].type!=="content";)c[s][1].type==="chunkText"&&(c[s][1]._isInFirstContentOfListItem=!0,s++);if(n[0]==="enter")n[1].contentType&&(Object.assign(t,i7(u,r)),r=t[r],d=!0);else if(n[1]._container){for(s=r,i=void 0;s--;)if(o=u.get(s),o[1].type==="lineEnding"||o[1].type==="lineEndingBlank")o[0]==="enter"&&(i&&(u.get(i)[1].type="lineEndingBlank"),o[1].type="lineEnding",i=s);else if(!(o[1].type==="linePrefix"||o[1].type==="listItemIndent"))break;i&&(n[1].end={...u.get(i)[1].start},l=u.slice(i,r),l.unshift(n),u.splice(i,r-i+1,l))}}return Kr(e,0,Number.POSITIVE_INFINITY,u.slice(0)),!d}function i7(e,t){const r=e.get(t)[1],n=e.get(t)[2];let i=t-1;const s=[];let o=r._tokenizer;o||(o=n.parser[r.contentType](r.start),r._contentTypeTextTrailing&&(o._contentTypeTextTrailing=!0));const l=o.events,c=[],d={};let u,p,h=-1,m=r,g=0,f=0;const w=[f];for(;m;){for(;e.get(++i)[1]!==m;);s.push(i),m._tokenizer||(u=n.sliceStream(m),m.next||u.push(null),p&&o.defineSkip(m.start),m._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=!0),o.write(u),m._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=void 0)),p=m,m=m.next}for(m=r;++h<l.length;)l[h][0]==="exit"&&l[h-1][0]==="enter"&&l[h][1].type===l[h-1][1].type&&l[h][1].start.line!==l[h][1].end.line&&(f=h+1,w.push(f),m._tokenizer=void 0,m.previous=void 0,m=m.next);for(o.events=[],m?(m._tokenizer=void 0,m.previous=void 0):w.pop(),h=w.length;h--;){const S=l.slice(w[h],w[h+1]),k=s.pop();c.push([k,k+S.length-1]),e.splice(k,2,S)}for(c.reverse(),h=-1;++h<c.length;)d[g+c[h][0]]=g+c[h][1],g+=c[h][1]-c[h][0]-1;return d}const s7={resolve:l7,tokenize:c7},o7={partial:!0,tokenize:d7};function l7(e){return uS(e),e}function c7(e,t){let r;return n;function n(l){return e.enter("content"),r=e.enter("chunkContent",{contentType:"content"}),i(l)}function i(l){return l===null?s(l):Xe(l)?e.check(o7,o,s)(l):(e.consume(l),i)}function s(l){return e.exit("chunkContent"),e.exit("content"),t(l)}function o(l){return e.consume(l),e.exit("chunkContent"),r.next=e.enter("chunkContent",{contentType:"content",previous:r}),r=r.next,i}}function d7(e,t,r){const n=this;return i;function i(o){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),At(e,s,"linePrefix")}function s(o){if(o===null||Xe(o))return r(o);const l=n.events[n.events.length-1];return!n.parser.constructs.disable.null.includes("codeIndented")&&l&&l[1].type==="linePrefix"&&l[2].sliceSerialize(l[1],!0).length>=4?t(o):e.interrupt(n.parser.constructs.flow,r,t)(o)}}function pS(e,t,r,n,i,s,o,l,c){const d=c||Number.POSITIVE_INFINITY;let u=0;return p;function p(S){return S===60?(e.enter(n),e.enter(i),e.enter(s),e.consume(S),e.exit(s),h):S===null||S===32||S===41||io(S)?r(S):(e.enter(n),e.enter(o),e.enter(l),e.enter("chunkString",{contentType:"string"}),f(S))}function h(S){return S===62?(e.enter(s),e.consume(S),e.exit(s),e.exit(i),e.exit(n),t):(e.enter(l),e.enter("chunkString",{contentType:"string"}),m(S))}function m(S){return S===62?(e.exit("chunkString"),e.exit(l),h(S)):S===null||S===60||Xe(S)?r(S):(e.consume(S),S===92?g:m)}function g(S){return S===60||S===62||S===92?(e.consume(S),m):m(S)}function f(S){return!u&&(S===null||S===41||qt(S))?(e.exit("chunkString"),e.exit(l),e.exit(o),e.exit(n),t(S)):u<d&&S===40?(e.consume(S),u++,f):S===41?(e.consume(S),u--,f):S===null||S===32||S===40||io(S)?r(S):(e.consume(S),S===92?w:f)}function w(S){return S===40||S===41||S===92?(e.consume(S),f):f(S)}}function mS(e,t,r,n,i,s){const o=this;let l=0,c;return d;function d(m){return e.enter(n),e.enter(i),e.consume(m),e.exit(i),e.enter(s),u}function u(m){return l>999||m===null||m===91||m===93&&!c||m===94&&!l&&"_hiddenFootnoteSupport"in o.parser.constructs?r(m):m===93?(e.exit(s),e.enter(i),e.consume(m),e.exit(i),e.exit(n),t):Xe(m)?(e.enter("lineEnding"),e.consume(m),e.exit("lineEnding"),u):(e.enter("chunkString",{contentType:"string"}),p(m))}function p(m){return m===null||m===91||m===93||Xe(m)||l++>999?(e.exit("chunkString"),u(m)):(e.consume(m),c||(c=!jt(m)),m===92?h:p)}function h(m){return m===91||m===92||m===93?(e.consume(m),l++,p):p(m)}}function hS(e,t,r,n,i,s){let o;return l;function l(h){return h===34||h===39||h===40?(e.enter(n),e.enter(i),e.consume(h),e.exit(i),o=h===40?41:h,c):r(h)}function c(h){return h===o?(e.enter(i),e.consume(h),e.exit(i),e.exit(n),t):(e.enter(s),d(h))}function d(h){return h===o?(e.exit(s),c(o)):h===null?r(h):Xe(h)?(e.enter("lineEnding"),e.consume(h),e.exit("lineEnding"),At(e,d,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),u(h))}function u(h){return h===o||h===null||Xe(h)?(e.exit("chunkString"),d(h)):(e.consume(h),h===92?p:u)}function p(h){return h===o||h===92?(e.consume(h),u):u(h)}}function $i(e,t){let r;return n;function n(i){return Xe(i)?(e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),r=!0,n):jt(i)?At(e,n,r?"linePrefix":"lineSuffix")(i):t(i)}}const u7={name:"definition",tokenize:m7},p7={partial:!0,tokenize:h7};function m7(e,t,r){const n=this;let i;return s;function s(m){return e.enter("definition"),o(m)}function o(m){return mS.call(n,e,l,r,"definitionLabel","definitionLabelMarker","definitionLabelString")(m)}function l(m){return i=hn(n.sliceSerialize(n.events[n.events.length-1][1]).slice(1,-1)),m===58?(e.enter("definitionMarker"),e.consume(m),e.exit("definitionMarker"),c):r(m)}function c(m){return qt(m)?$i(e,d)(m):d(m)}function d(m){return pS(e,u,r,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(m)}function u(m){return e.attempt(p7,p,p)(m)}function p(m){return jt(m)?At(e,h,"whitespace")(m):h(m)}function h(m){return m===null||Xe(m)?(e.exit("definition"),n.parser.defined.push(i),t(m)):r(m)}}function h7(e,t,r){return n;function n(l){return qt(l)?$i(e,i)(l):r(l)}function i(l){return hS(e,s,r,"definitionTitle","definitionTitleMarker","definitionTitleString")(l)}function s(l){return jt(l)?At(e,o,"whitespace")(l):o(l)}function o(l){return l===null||Xe(l)?t(l):r(l)}}const g7={name:"hardBreakEscape",tokenize:f7};function f7(e,t,r){return n;function n(s){return e.enter("hardBreakEscape"),e.consume(s),i}function i(s){return Xe(s)?(e.exit("hardBreakEscape"),t(s)):r(s)}}const b7={name:"headingAtx",resolve:x7,tokenize:y7};function x7(e,t){let r=e.length-2,n=3,i,s;return e[n][1].type==="whitespace"&&(n+=2),r-2>n&&e[r][1].type==="whitespace"&&(r-=2),e[r][1].type==="atxHeadingSequence"&&(n===r-1||r-4>n&&e[r-2][1].type==="whitespace")&&(r-=n+1===r?2:4),r>n&&(i={type:"atxHeadingText",start:e[n][1].start,end:e[r][1].end},s={type:"chunkText",start:e[n][1].start,end:e[r][1].end,contentType:"text"},Kr(e,n,r-n+1,[["enter",i,t],["enter",s,t],["exit",s,t],["exit",i,t]])),e}function y7(e,t,r){let n=0;return i;function i(u){return e.enter("atxHeading"),s(u)}function s(u){return e.enter("atxHeadingSequence"),o(u)}function o(u){return u===35&&n++<6?(e.consume(u),o):u===null||qt(u)?(e.exit("atxHeadingSequence"),l(u)):r(u)}function l(u){return u===35?(e.enter("atxHeadingSequence"),c(u)):u===null||Xe(u)?(e.exit("atxHeading"),t(u)):jt(u)?At(e,l,"whitespace")(u):(e.enter("atxHeadingText"),d(u))}function c(u){return u===35?(e.consume(u),c):(e.exit("atxHeadingSequence"),l(u))}function d(u){return u===null||u===35||qt(u)?(e.exit("atxHeadingText"),l(u)):(e.consume(u),d)}}const v7=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],tb=["pre","script","style","textarea"],k7={concrete:!0,name:"htmlFlow",resolveTo:E7,tokenize:N7},w7={partial:!0,tokenize:T7},S7={partial:!0,tokenize:C7};function E7(e){let t=e.length;for(;t--&&!(e[t][0]==="enter"&&e[t][1].type==="htmlFlow"););return t>1&&e[t-2][1].type==="linePrefix"&&(e[t][1].start=e[t-2][1].start,e[t+1][1].start=e[t-2][1].start,e.splice(t-2,2)),e}function N7(e,t,r){const n=this;let i,s,o,l,c;return d;function d(_){return u(_)}function u(_){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(_),p}function p(_){return _===33?(e.consume(_),h):_===47?(e.consume(_),s=!0,f):_===63?(e.consume(_),i=3,n.interrupt?t:R):Tr(_)?(e.consume(_),o=String.fromCharCode(_),w):r(_)}function h(_){return _===45?(e.consume(_),i=2,m):_===91?(e.consume(_),i=5,l=0,g):Tr(_)?(e.consume(_),i=4,n.interrupt?t:R):r(_)}function m(_){return _===45?(e.consume(_),n.interrupt?t:R):r(_)}function g(_){const Z="CDATA[";return _===Z.charCodeAt(l++)?(e.consume(_),l===Z.length?n.interrupt?t:q:g):r(_)}function f(_){return Tr(_)?(e.consume(_),o=String.fromCharCode(_),w):r(_)}function w(_){if(_===null||_===47||_===62||qt(_)){const Z=_===47,me=o.toLowerCase();return!Z&&!s&&tb.includes(me)?(i=1,n.interrupt?t(_):q(_)):v7.includes(o.toLowerCase())?(i=6,Z?(e.consume(_),S):n.interrupt?t(_):q(_)):(i=7,n.interrupt&&!n.parser.lazy[n.now().line]?r(_):s?k(_):E(_))}return _===45||kr(_)?(e.consume(_),o+=String.fromCharCode(_),w):r(_)}function S(_){return _===62?(e.consume(_),n.interrupt?t:q):r(_)}function k(_){return jt(_)?(e.consume(_),k):T(_)}function E(_){return _===47?(e.consume(_),T):_===58||_===95||Tr(_)?(e.consume(_),N):jt(_)?(e.consume(_),E):T(_)}function N(_){return _===45||_===46||_===58||_===95||kr(_)?(e.consume(_),N):C(_)}function C(_){return _===61?(e.consume(_),v):jt(_)?(e.consume(_),C):E(_)}function v(_){return _===null||_===60||_===61||_===62||_===96?r(_):_===34||_===39?(e.consume(_),c=_,I):jt(_)?(e.consume(_),v):M(_)}function I(_){return _===c?(e.consume(_),c=null,j):_===null||Xe(_)?r(_):(e.consume(_),I)}function M(_){return _===null||_===34||_===39||_===47||_===60||_===61||_===62||_===96||qt(_)?C(_):(e.consume(_),M)}function j(_){return _===47||_===62||jt(_)?E(_):r(_)}function T(_){return _===62?(e.consume(_),P):r(_)}function P(_){return _===null||Xe(_)?q(_):jt(_)?(e.consume(_),P):r(_)}function q(_){return _===45&&i===2?(e.consume(_),G):_===60&&i===1?(e.consume(_),re):_===62&&i===4?(e.consume(_),F):_===63&&i===3?(e.consume(_),R):_===93&&i===5?(e.consume(_),ue):Xe(_)&&(i===6||i===7)?(e.exit("htmlFlowData"),e.check(w7,te,D)(_)):_===null||Xe(_)?(e.exit("htmlFlowData"),D(_)):(e.consume(_),q)}function D(_){return e.check(S7,z,te)(_)}function z(_){return e.enter("lineEnding"),e.consume(_),e.exit("lineEnding"),U}function U(_){return _===null||Xe(_)?D(_):(e.enter("htmlFlowData"),q(_))}function G(_){return _===45?(e.consume(_),R):q(_)}function re(_){return _===47?(e.consume(_),o="",K):q(_)}function K(_){if(_===62){const Z=o.toLowerCase();return tb.includes(Z)?(e.consume(_),F):q(_)}return Tr(_)&&o.length<8?(e.consume(_),o+=String.fromCharCode(_),K):q(_)}function ue(_){return _===93?(e.consume(_),R):q(_)}function R(_){return _===62?(e.consume(_),F):_===45&&i===2?(e.consume(_),R):q(_)}function F(_){return _===null||Xe(_)?(e.exit("htmlFlowData"),te(_)):(e.consume(_),F)}function te(_){return e.exit("htmlFlow"),t(_)}}function C7(e,t,r){const n=this;return i;function i(o){return Xe(o)?(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),s):r(o)}function s(o){return n.parser.lazy[n.now().line]?r(o):t(o)}}function T7(e,t,r){return n;function n(i){return e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),e.attempt(cs,t,r)}}const A7={name:"htmlText",tokenize:I7};function I7(e,t,r){const n=this;let i,s,o;return l;function l(R){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(R),c}function c(R){return R===33?(e.consume(R),d):R===47?(e.consume(R),C):R===63?(e.consume(R),E):Tr(R)?(e.consume(R),M):r(R)}function d(R){return R===45?(e.consume(R),u):R===91?(e.consume(R),s=0,g):Tr(R)?(e.consume(R),k):r(R)}function u(R){return R===45?(e.consume(R),m):r(R)}function p(R){return R===null?r(R):R===45?(e.consume(R),h):Xe(R)?(o=p,re(R)):(e.consume(R),p)}function h(R){return R===45?(e.consume(R),m):p(R)}function m(R){return R===62?G(R):R===45?h(R):p(R)}function g(R){const F="CDATA[";return R===F.charCodeAt(s++)?(e.consume(R),s===F.length?f:g):r(R)}function f(R){return R===null?r(R):R===93?(e.consume(R),w):Xe(R)?(o=f,re(R)):(e.consume(R),f)}function w(R){return R===93?(e.consume(R),S):f(R)}function S(R){return R===62?G(R):R===93?(e.consume(R),S):f(R)}function k(R){return R===null||R===62?G(R):Xe(R)?(o=k,re(R)):(e.consume(R),k)}function E(R){return R===null?r(R):R===63?(e.consume(R),N):Xe(R)?(o=E,re(R)):(e.consume(R),E)}function N(R){return R===62?G(R):E(R)}function C(R){return Tr(R)?(e.consume(R),v):r(R)}function v(R){return R===45||kr(R)?(e.consume(R),v):I(R)}function I(R){return Xe(R)?(o=I,re(R)):jt(R)?(e.consume(R),I):G(R)}function M(R){return R===45||kr(R)?(e.consume(R),M):R===47||R===62||qt(R)?j(R):r(R)}function j(R){return R===47?(e.consume(R),G):R===58||R===95||Tr(R)?(e.consume(R),T):Xe(R)?(o=j,re(R)):jt(R)?(e.consume(R),j):G(R)}function T(R){return R===45||R===46||R===58||R===95||kr(R)?(e.consume(R),T):P(R)}function P(R){return R===61?(e.consume(R),q):Xe(R)?(o=P,re(R)):jt(R)?(e.consume(R),P):j(R)}function q(R){return R===null||R===60||R===61||R===62||R===96?r(R):R===34||R===39?(e.consume(R),i=R,D):Xe(R)?(o=q,re(R)):jt(R)?(e.consume(R),q):(e.consume(R),z)}function D(R){return R===i?(e.consume(R),i=void 0,U):R===null?r(R):Xe(R)?(o=D,re(R)):(e.consume(R),D)}function z(R){return R===null||R===34||R===39||R===60||R===61||R===96?r(R):R===47||R===62||qt(R)?j(R):(e.consume(R),z)}function U(R){return R===47||R===62||qt(R)?j(R):r(R)}function G(R){return R===62?(e.consume(R),e.exit("htmlTextData"),e.exit("htmlText"),t):r(R)}function re(R){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(R),e.exit("lineEnding"),K}function K(R){return jt(R)?At(e,ue,"linePrefix",n.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(R):ue(R)}function ue(R){return e.enter("htmlTextData"),o(R)}}const Xh={name:"labelEnd",resolveAll:L7,resolveTo:O7,tokenize:D7},R7={tokenize:M7},j7={tokenize:F7},_7={tokenize:P7};function L7(e){let t=-1;const r=[];for(;++t<e.length;){const n=e[t][1];if(r.push(e[t]),n.type==="labelImage"||n.type==="labelLink"||n.type==="labelEnd"){const i=n.type==="labelImage"?4:2;n.type="data",t+=i}}return e.length!==r.length&&Kr(e,0,e.length,r),e}function O7(e,t){let r=e.length,n=0,i,s,o,l;for(;r--;)if(i=e[r][1],s){if(i.type==="link"||i.type==="labelLink"&&i._inactive)break;e[r][0]==="enter"&&i.type==="labelLink"&&(i._inactive=!0)}else if(o){if(e[r][0]==="enter"&&(i.type==="labelImage"||i.type==="labelLink")&&!i._balanced&&(s=r,i.type!=="labelLink")){n=2;break}}else i.type==="labelEnd"&&(o=r);const c={type:e[s][1].type==="labelLink"?"link":"image",start:{...e[s][1].start},end:{...e[e.length-1][1].end}},d={type:"label",start:{...e[s][1].start},end:{...e[o][1].end}},u={type:"labelText",start:{...e[s+n+2][1].end},end:{...e[o-2][1].start}};return l=[["enter",c,t],["enter",d,t]],l=en(l,e.slice(s+1,s+n+3)),l=en(l,[["enter",u,t]]),l=en(l,Ao(t.parser.constructs.insideSpan.null,e.slice(s+n+4,o-3),t)),l=en(l,[["exit",u,t],e[o-2],e[o-1],["exit",d,t]]),l=en(l,e.slice(o+1)),l=en(l,[["exit",c,t]]),Kr(e,s,e.length,l),e}function D7(e,t,r){const n=this;let i=n.events.length,s,o;for(;i--;)if((n.events[i][1].type==="labelImage"||n.events[i][1].type==="labelLink")&&!n.events[i][1]._balanced){s=n.events[i][1];break}return l;function l(h){return s?s._inactive?p(h):(o=n.parser.defined.includes(hn(n.sliceSerialize({start:s.end,end:n.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(h),e.exit("labelMarker"),e.exit("labelEnd"),c):r(h)}function c(h){return h===40?e.attempt(R7,u,o?u:p)(h):h===91?e.attempt(j7,u,o?d:p)(h):o?u(h):p(h)}function d(h){return e.attempt(_7,u,p)(h)}function u(h){return t(h)}function p(h){return s._balanced=!0,r(h)}}function M7(e,t,r){return n;function n(p){return e.enter("resource"),e.enter("resourceMarker"),e.consume(p),e.exit("resourceMarker"),i}function i(p){return qt(p)?$i(e,s)(p):s(p)}function s(p){return p===41?u(p):pS(e,o,l,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(p)}function o(p){return qt(p)?$i(e,c)(p):u(p)}function l(p){return r(p)}function c(p){return p===34||p===39||p===40?hS(e,d,r,"resourceTitle","resourceTitleMarker","resourceTitleString")(p):u(p)}function d(p){return qt(p)?$i(e,u)(p):u(p)}function u(p){return p===41?(e.enter("resourceMarker"),e.consume(p),e.exit("resourceMarker"),e.exit("resource"),t):r(p)}}function F7(e,t,r){const n=this;return i;function i(l){return mS.call(n,e,s,o,"reference","referenceMarker","referenceString")(l)}function s(l){return n.parser.defined.includes(hn(n.sliceSerialize(n.events[n.events.length-1][1]).slice(1,-1)))?t(l):r(l)}function o(l){return r(l)}}function P7(e,t,r){return n;function n(s){return e.enter("reference"),e.enter("referenceMarker"),e.consume(s),e.exit("referenceMarker"),i}function i(s){return s===93?(e.enter("referenceMarker"),e.consume(s),e.exit("referenceMarker"),e.exit("reference"),t):r(s)}}const B7={name:"labelStartImage",resolveAll:Xh.resolveAll,tokenize:z7};function z7(e,t,r){const n=this;return i;function i(l){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(l),e.exit("labelImageMarker"),s}function s(l){return l===91?(e.enter("labelMarker"),e.consume(l),e.exit("labelMarker"),e.exit("labelImage"),o):r(l)}function o(l){return l===94&&"_hiddenFootnoteSupport"in n.parser.constructs?r(l):t(l)}}const U7={name:"labelStartLink",resolveAll:Xh.resolveAll,tokenize:$7};function $7(e,t,r){const n=this;return i;function i(o){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(o),e.exit("labelMarker"),e.exit("labelLink"),s}function s(o){return o===94&&"_hiddenFootnoteSupport"in n.parser.constructs?r(o):t(o)}}const cl={name:"lineEnding",tokenize:q7};function q7(e,t){return r;function r(n){return e.enter("lineEnding"),e.consume(n),e.exit("lineEnding"),At(e,t,"linePrefix")}}const Vs={name:"thematicBreak",tokenize:G7};function G7(e,t,r){let n=0,i;return s;function s(d){return e.enter("thematicBreak"),o(d)}function o(d){return i=d,l(d)}function l(d){return d===i?(e.enter("thematicBreakSequence"),c(d)):n>=3&&(d===null||Xe(d))?(e.exit("thematicBreak"),t(d)):r(d)}function c(d){return d===i?(e.consume(d),n++,c):(e.exit("thematicBreakSequence"),jt(d)?At(e,l,"whitespace")(d):l(d))}}const Dr={continuation:{tokenize:K7},exit:X7,name:"list",tokenize:V7},H7={partial:!0,tokenize:Z7},W7={partial:!0,tokenize:Y7};function V7(e,t,r){const n=this,i=n.events[n.events.length-1];let s=i&&i[1].type==="linePrefix"?i[2].sliceSerialize(i[1],!0).length:0,o=0;return l;function l(m){const g=n.containerState.type||(m===42||m===43||m===45?"listUnordered":"listOrdered");if(g==="listUnordered"?!n.containerState.marker||m===n.containerState.marker:Km(m)){if(n.containerState.type||(n.containerState.type=g,e.enter(g,{_container:!0})),g==="listUnordered")return e.enter("listItemPrefix"),m===42||m===45?e.check(Vs,r,d)(m):d(m);if(!n.interrupt||m===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),c(m)}return r(m)}function c(m){return Km(m)&&++o<10?(e.consume(m),c):(!n.interrupt||o<2)&&(n.containerState.marker?m===n.containerState.marker:m===41||m===46)?(e.exit("listItemValue"),d(m)):r(m)}function d(m){return e.enter("listItemMarker"),e.consume(m),e.exit("listItemMarker"),n.containerState.marker=n.containerState.marker||m,e.check(cs,n.interrupt?r:u,e.attempt(H7,h,p))}function u(m){return n.containerState.initialBlankLine=!0,s++,h(m)}function p(m){return jt(m)?(e.enter("listItemPrefixWhitespace"),e.consume(m),e.exit("listItemPrefixWhitespace"),h):r(m)}function h(m){return n.containerState.size=s+n.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(m)}}function K7(e,t,r){const n=this;return n.containerState._closeFlow=void 0,e.check(cs,i,s);function i(l){return n.containerState.furtherBlankLines=n.containerState.furtherBlankLines||n.containerState.initialBlankLine,At(e,t,"listItemIndent",n.containerState.size+1)(l)}function s(l){return n.containerState.furtherBlankLines||!jt(l)?(n.containerState.furtherBlankLines=void 0,n.containerState.initialBlankLine=void 0,o(l)):(n.containerState.furtherBlankLines=void 0,n.containerState.initialBlankLine=void 0,e.attempt(W7,t,o)(l))}function o(l){return n.containerState._closeFlow=!0,n.interrupt=void 0,At(e,e.attempt(Dr,t,r),"linePrefix",n.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(l)}}function Y7(e,t,r){const n=this;return At(e,i,"listItemIndent",n.containerState.size+1);function i(s){const o=n.events[n.events.length-1];return o&&o[1].type==="listItemIndent"&&o[2].sliceSerialize(o[1],!0).length===n.containerState.size?t(s):r(s)}}function X7(e){e.exit(this.containerState.type)}function Z7(e,t,r){const n=this;return At(e,i,"listItemPrefixWhitespace",n.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function i(s){const o=n.events[n.events.length-1];return!jt(s)&&o&&o[1].type==="listItemPrefixWhitespace"?t(s):r(s)}}const rb={name:"setextUnderline",resolveTo:J7,tokenize:Q7};function J7(e,t){let r=e.length,n,i,s;for(;r--;)if(e[r][0]==="enter"){if(e[r][1].type==="content"){n=r;break}e[r][1].type==="paragraph"&&(i=r)}else e[r][1].type==="content"&&e.splice(r,1),!s&&e[r][1].type==="definition"&&(s=r);const o={type:"setextHeading",start:{...e[n][1].start},end:{...e[e.length-1][1].end}};return e[i][1].type="setextHeadingText",s?(e.splice(i,0,["enter",o,t]),e.splice(s+1,0,["exit",e[n][1],t]),e[n][1].end={...e[s][1].end}):e[n][1]=o,e.push(["exit",o,t]),e}function Q7(e,t,r){const n=this;let i;return s;function s(d){let u=n.events.length,p;for(;u--;)if(n.events[u][1].type!=="lineEnding"&&n.events[u][1].type!=="linePrefix"&&n.events[u][1].type!=="content"){p=n.events[u][1].type==="paragraph";break}return!n.parser.lazy[n.now().line]&&(n.interrupt||p)?(e.enter("setextHeadingLine"),i=d,o(d)):r(d)}function o(d){return e.enter("setextHeadingLineSequence"),l(d)}function l(d){return d===i?(e.consume(d),l):(e.exit("setextHeadingLineSequence"),jt(d)?At(e,c,"lineSuffix")(d):c(d))}function c(d){return d===null||Xe(d)?(e.exit("setextHeadingLine"),t(d)):r(d)}}const eI={tokenize:tI};function tI(e){const t=this,r=e.attempt(cs,n,e.attempt(this.parser.constructs.flowInitial,i,At(e,e.attempt(this.parser.constructs.flow,i,e.attempt(s7,i)),"linePrefix")));return r;function n(s){if(s===null){e.consume(s);return}return e.enter("lineEndingBlank"),e.consume(s),e.exit("lineEndingBlank"),t.currentConstruct=void 0,r}function i(s){if(s===null){e.consume(s);return}return e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),t.currentConstruct=void 0,r}}const rI={resolveAll:fS()},nI=gS("string"),aI=gS("text");function gS(e){return{resolveAll:fS(e==="text"?iI:void 0),tokenize:t};function t(r){const n=this,i=this.parser.constructs[e],s=r.attempt(i,o,l);return o;function o(u){return d(u)?s(u):l(u)}function l(u){if(u===null){r.consume(u);return}return r.enter("data"),r.consume(u),c}function c(u){return d(u)?(r.exit("data"),s(u)):(r.consume(u),c)}function d(u){if(u===null)return!0;const p=i[u];let h=-1;if(p)for(;++h<p.length;){const m=p[h];if(!m.previous||m.previous.call(n,n.previous))return!0}return!1}}}function fS(e){return t;function t(r,n){let i=-1,s;for(;++i<=r.length;)s===void 0?r[i]&&r[i][1].type==="data"&&(s=i,i++):(!r[i]||r[i][1].type!=="data")&&(i!==s+2&&(r[s][1].end=r[i-1][1].end,r.splice(s+2,i-s-2),i=s+2),s=void 0);return e?e(r,n):r}}function iI(e,t){let r=0;for(;++r<=e.length;)if((r===e.length||e[r][1].type==="lineEnding")&&e[r-1][1].type==="data"){const n=e[r-1][1],i=t.sliceStream(n);let s=i.length,o=-1,l=0,c;for(;s--;){const d=i[s];if(typeof d=="string"){for(o=d.length;d.charCodeAt(o-1)===32;)l++,o--;if(o)break;o=-1}else if(d===-2)c=!0,l++;else if(d!==-1){s++;break}}if(t._contentTypeTextTrailing&&r===e.length&&(l=0),l){const d={type:r===e.length||c||l<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:s?o:n.start._bufferIndex+o,_index:n.start._index+s,line:n.end.line,column:n.end.column-l,offset:n.end.offset-l},end:{...n.end}};n.end={...d.start},n.start.offset===n.end.offset?Object.assign(n,d):(e.splice(r,0,["enter",d,t],["exit",d,t]),r+=2)}r++}return e}const sI={42:Dr,43:Dr,45:Dr,48:Dr,49:Dr,50:Dr,51:Dr,52:Dr,53:Dr,54:Dr,55:Dr,56:Dr,57:Dr,62:lS},oI={91:u7},lI={[-2]:ll,[-1]:ll,32:ll},cI={35:b7,42:Vs,45:[rb,Vs],60:k7,61:rb,95:Vs,96:eb,126:eb},dI={38:dS,92:cS},uI={[-5]:cl,[-4]:cl,[-3]:cl,33:B7,38:dS,42:Ym,60:[UA,A7],91:U7,92:[g7,cS],93:Xh,95:Ym,96:e7},pI={null:[Ym,rI]},mI={null:[42,95]},hI={null:[]},gI=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:mI,contentInitial:oI,disable:hI,document:sI,flow:cI,flowInitial:lI,insideSpan:pI,string:dI,text:uI},Symbol.toStringTag,{value:"Module"}));function fI(e,t,r){let n={_bufferIndex:-1,_index:0,line:r&&r.line||1,column:r&&r.column||1,offset:r&&r.offset||0};const i={},s=[];let o=[],l=[];const c={attempt:I(C),check:I(v),consume:k,enter:E,exit:N,interrupt:I(v,{interrupt:!0})},d={code:null,containerState:{},defineSkip:f,events:[],now:g,parser:e,previous:null,sliceSerialize:h,sliceStream:m,write:p};let u=t.tokenize.call(d,c);return t.resolveAll&&s.push(t),d;function p(P){return o=en(o,P),w(),o[o.length-1]!==null?[]:(M(t,0),d.events=Ao(s,d.events,d),d.events)}function h(P,q){return xI(m(P),q)}function m(P){return bI(o,P)}function g(){const{_bufferIndex:P,_index:q,line:D,column:z,offset:U}=n;return{_bufferIndex:P,_index:q,line:D,column:z,offset:U}}function f(P){i[P.line]=P.column,T()}function w(){let P;for(;n._index<o.length;){const q=o[n._index];if(typeof q=="string")for(P=n._index,n._bufferIndex<0&&(n._bufferIndex=0);n._index===P&&n._bufferIndex<q.length;)S(q.charCodeAt(n._bufferIndex));else S(q)}}function S(P){u=u(P)}function k(P){Xe(P)?(n.line++,n.column=1,n.offset+=P===-3?2:1,T()):P!==-1&&(n.column++,n.offset++),n._bufferIndex<0?n._index++:(n._bufferIndex++,n._bufferIndex===o[n._index].length&&(n._bufferIndex=-1,n._index++)),d.previous=P}function E(P,q){const D=q||{};return D.type=P,D.start=g(),d.events.push(["enter",D,d]),l.push(D),D}function N(P){const q=l.pop();return q.end=g(),d.events.push(["exit",q,d]),q}function C(P,q){M(P,q.from)}function v(P,q){q.restore()}function I(P,q){return D;function D(z,U,G){let re,K,ue,R;return Array.isArray(z)?te(z):"tokenize"in z?te([z]):F(z);function F(ke){return se;function se(_e){const oe=_e!==null&&ke[_e],fe=_e!==null&&ke.null,Ie=[...Array.isArray(oe)?oe:oe?[oe]:[],...Array.isArray(fe)?fe:fe?[fe]:[]];return te(Ie)(_e)}}function te(ke){return re=ke,K=0,ke.length===0?G:_(ke[K])}function _(ke){return se;function se(_e){return R=j(),ue=ke,ke.partial||(d.currentConstruct=ke),ke.name&&d.parser.constructs.disable.null.includes(ke.name)?me():ke.tokenize.call(q?Object.assign(Object.create(d),q):d,c,Z,me)(_e)}}function Z(ke){return P(ue,R),U}function me(ke){return R.restore(),++K<re.length?_(re[K]):G}}}function M(P,q){P.resolveAll&&!s.includes(P)&&s.push(P),P.resolve&&Kr(d.events,q,d.events.length-q,P.resolve(d.events.slice(q),d)),P.resolveTo&&(d.events=P.resolveTo(d.events,d))}function j(){const P=g(),q=d.previous,D=d.currentConstruct,z=d.events.length,U=Array.from(l);return{from:z,restore:G};function G(){n=P,d.previous=q,d.currentConstruct=D,d.events.length=z,l=U,T()}}function T(){n.line in i&&n.column<2&&(n.column=i[n.line],n.offset+=i[n.line]-1)}}function bI(e,t){const r=t.start._index,n=t.start._bufferIndex,i=t.end._index,s=t.end._bufferIndex;let o;if(r===i)o=[e[r].slice(n,s)];else{if(o=e.slice(r,i),n>-1){const l=o[0];typeof l=="string"?o[0]=l.slice(n):o.shift()}s>0&&o.push(e[i].slice(0,s))}return o}function xI(e,t){let r=-1;const n=[];let i;for(;++r<e.length;){const s=e[r];let o;if(typeof s=="string")o=s;else switch(s){case-5:{o="\r";break}case-4:{o=`
|
|
416
416
|
`;break}case-3:{o=`\r
|
|
417
|
-
`;break}case-2:{o=t?" ":" ";break}case-1:{if(!t&&i)continue;o=" ";break}default:o=String.fromCharCode(s)}i=s===-2,n.push(o)}return n.join("")}function yI(e){const n={constructs:sS([gI,...(e||{}).extensions||[]]),content:i(OA),defined:[],document:i(MA),flow:i(eI),lazy:{},string:i(nI),text:i(aI)};return n;function i(s){return o;function o(l){return fI(n,s,l)}}}function vI(e){for(;!uS(e););return e}const nb=/[\0\t\n\r]/g;function kI(){let e=1,t="",r=!0,n;return i;function i(s,o,l){const c=[];let d,u,p,h,m;for(s=t+(typeof s=="string"?s.toString():new TextDecoder(o||void 0).decode(s)),p=0,t="",r&&(s.charCodeAt(0)===65279&&p++,r=void 0);p<s.length;){if(nb.lastIndex=p,d=nb.exec(s),h=d&&d.index!==void 0?d.index:s.length,m=s.charCodeAt(h),!d){t=s.slice(p);break}if(m===10&&p===h&&n)c.push(-3),n=void 0;else switch(n&&(c.push(-5),n=void 0),p<h&&(c.push(s.slice(p,h)),e+=h-p),m){case 0:{c.push(65533),e++;break}case 9:{for(u=Math.ceil(e/4)*4,c.push(-2);e++<u;)c.push(-1);break}case 10:{c.push(-4),e=1;break}default:n=!0,e=1}p=h+1}return l&&(n&&c.push(-5),t&&c.push(t),c.push(null)),c}}const wI=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function SI(e){return e.replace(wI,EI)}function EI(e,t,r){if(t)return t;if(r.charCodeAt(0)===35){const i=r.charCodeAt(1),s=i===120||i===88;return oS(r.slice(s?2:1),s?16:10)}return Yh(r)||e}const bS={}.hasOwnProperty;function NI(e,t,r){return typeof t!="string"&&(r=t,t=void 0),CI(r)(vI(yI(r).document().write(kI()(e,t,!0))))}function CI(e){const t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:s(Me),autolinkProtocol:j,autolinkEmail:j,atxHeading:s(Ye),blockQuote:s(fe),characterEscape:j,characterReference:j,codeFenced:s(Ie),codeFencedFenceInfo:o,codeFencedFenceMeta:o,codeIndented:s(Ie,o),codeText:s(qe,o),codeTextData:j,data:j,codeFlowValue:j,definition:s(ze),definitionDestinationString:o,definitionLabelString:o,definitionTitleString:o,emphasis:s(ct),hardBreakEscape:s(wt),hardBreakTrailing:s(wt),htmlFlow:s(gt,o),htmlFlowData:j,htmlText:s(gt,o),htmlTextData:j,image:s(et),label:o,link:s(Me),listItem:s(Pt),listItemValue:h,listOrdered:s(mt,p),listUnordered:s(mt),paragraph:s(xe),reference:_,referenceString:o,resourceDestinationString:o,resourceTitleString:o,setextHeading:s(Ye),strong:s(at),thematicBreak:s(Ee)},exit:{atxHeading:c(),atxHeadingSequence:C,autolink:c(),autolinkEmail:oe,autolinkProtocol:_e,blockQuote:c(),characterEscapeValue:T,characterReferenceMarkerHexadecimal:me,characterReferenceMarkerNumeric:me,characterReferenceValue:ke,characterReference:se,codeFenced:c(w),codeFencedFence:f,codeFencedFenceInfo:m,codeFencedFenceMeta:g,codeFlowValue:T,codeIndented:c(S),codeText:c(U),codeTextData:T,data:T,definition:c(),definitionDestinationString:N,definitionLabelString:k,definitionTitleString:E,emphasis:c(),hardBreakEscape:c(q),hardBreakTrailing:c(q),htmlFlow:c(D),htmlFlowData:T,htmlText:c(z),htmlTextData:T,image:c(re),label:ue,labelText:K,lineEnding:P,link:c(G),listItem:c(),listOrdered:c(),listUnordered:c(),paragraph:c(),referenceString:Z,resourceDestinationString:R,resourceTitleString:F,resource:te,setextHeading:c(M),setextHeadingLineSequence:I,setextHeadingText:v,strong:c(),thematicBreak:c()}};xS(t,(e||{}).mdastExtensions||[]);const r={};return n;function n(H){let Y={type:"root",children:[]};const le={stack:[Y],tokenStack:[],config:t,enter:l,exit:d,buffer:o,resume:u,data:r},ve=[];let Ve=-1;for(;++Ve<H.length;)if(H[Ve][1].type==="listOrdered"||H[Ve][1].type==="listUnordered")if(H[Ve][0]==="enter")ve.push(Ve);else{const It=ve.pop();Ve=i(H,It,Ve)}for(Ve=-1;++Ve<H.length;){const It=t[H[Ve][0]];bS.call(It,H[Ve][1].type)&&It[H[Ve][1].type].call(Object.assign({sliceSerialize:H[Ve][2].sliceSerialize},le),H[Ve][1])}if(le.tokenStack.length>0){const It=le.tokenStack[le.tokenStack.length-1];(It[1]||ab).call(le,void 0,It[0])}for(Y.position={start:ia(H.length>0?H[0][1].start:{line:1,column:1,offset:0}),end:ia(H.length>0?H[H.length-2][1].end:{line:1,column:1,offset:0})},Ve=-1;++Ve<t.transforms.length;)Y=t.transforms[Ve](Y)||Y;return Y}function i(H,Y,le){let ve=Y-1,Ve=-1,It=!1,ft,Rt,it,ie;for(;++ve<=le;){const je=H[ve];switch(je[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{je[0]==="enter"?Ve++:Ve--,ie=void 0;break}case"lineEndingBlank":{je[0]==="enter"&&(ft&&!ie&&!Ve&&!it&&(it=ve),ie=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:ie=void 0}if(!Ve&&je[0]==="enter"&&je[1].type==="listItemPrefix"||Ve===-1&&je[0]==="exit"&&(je[1].type==="listUnordered"||je[1].type==="listOrdered")){if(ft){let Te=ve;for(Rt=void 0;Te--;){const Pe=H[Te];if(Pe[1].type==="lineEnding"||Pe[1].type==="lineEndingBlank"){if(Pe[0]==="exit")continue;Rt&&(H[Rt][1].type="lineEndingBlank",It=!0),Pe[1].type="lineEnding",Rt=Te}else if(!(Pe[1].type==="linePrefix"||Pe[1].type==="blockQuotePrefix"||Pe[1].type==="blockQuotePrefixWhitespace"||Pe[1].type==="blockQuoteMarker"||Pe[1].type==="listItemIndent"))break}it&&(!Rt||it<Rt)&&(ft._spread=!0),ft.end=Object.assign({},Rt?H[Rt][1].start:je[1].end),H.splice(Rt||ve,0,["exit",ft,je[2]]),ve++,le++}if(je[1].type==="listItemPrefix"){const Te={type:"listItem",_spread:!1,start:Object.assign({},je[1].start),end:void 0};ft=Te,H.splice(ve,0,["enter",Te,je[2]]),ve++,le++,it=void 0,ie=!0}}}return H[Y][1]._spread=It,le}function s(H,Y){return le;function le(ve){l.call(this,H(ve),ve),Y&&Y.call(this,ve)}}function o(){this.stack.push({type:"fragment",children:[]})}function l(H,Y,le){this.stack[this.stack.length-1].children.push(H),this.stack.push(H),this.tokenStack.push([Y,le||void 0]),H.position={start:ia(Y.start),end:void 0}}function c(H){return Y;function Y(le){H&&H.call(this,le),d.call(this,le)}}function d(H,Y){const le=this.stack.pop(),ve=this.tokenStack.pop();if(ve)ve[0].type!==H.type&&(Y?Y.call(this,H,ve[0]):(ve[1]||ab).call(this,H,ve[0]));else throw new Error("Cannot close `"+H.type+"` ("+Ui({start:H.start,end:H.end})+"): it’s not open");le.position.end=ia(H.end)}function u(){return Kh(this.stack.pop())}function p(){this.data.expectingFirstListItemValue=!0}function h(H){if(this.data.expectingFirstListItemValue){const Y=this.stack[this.stack.length-2];Y.start=Number.parseInt(this.sliceSerialize(H),10),this.data.expectingFirstListItemValue=void 0}}function m(){const H=this.resume(),Y=this.stack[this.stack.length-1];Y.lang=H}function g(){const H=this.resume(),Y=this.stack[this.stack.length-1];Y.meta=H}function f(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function w(){const H=this.resume(),Y=this.stack[this.stack.length-1];Y.value=H.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function S(){const H=this.resume(),Y=this.stack[this.stack.length-1];Y.value=H.replace(/(\r?\n|\r)$/g,"")}function k(H){const Y=this.resume(),le=this.stack[this.stack.length-1];le.label=Y,le.identifier=hn(this.sliceSerialize(H)).toLowerCase()}function E(){const H=this.resume(),Y=this.stack[this.stack.length-1];Y.title=H}function N(){const H=this.resume(),Y=this.stack[this.stack.length-1];Y.url=H}function C(H){const Y=this.stack[this.stack.length-1];if(!Y.depth){const le=this.sliceSerialize(H).length;Y.depth=le}}function v(){this.data.setextHeadingSlurpLineEnding=!0}function I(H){const Y=this.stack[this.stack.length-1];Y.depth=this.sliceSerialize(H).codePointAt(0)===61?1:2}function M(){this.data.setextHeadingSlurpLineEnding=void 0}function j(H){const le=this.stack[this.stack.length-1].children;let ve=le[le.length-1];(!ve||ve.type!=="text")&&(ve=de(),ve.position={start:ia(H.start),end:void 0},le.push(ve)),this.stack.push(ve)}function T(H){const Y=this.stack.pop();Y.value+=this.sliceSerialize(H),Y.position.end=ia(H.end)}function P(H){const Y=this.stack[this.stack.length-1];if(this.data.atHardBreak){const le=Y.children[Y.children.length-1];le.position.end=ia(H.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(Y.type)&&(j.call(this,H),T.call(this,H))}function q(){this.data.atHardBreak=!0}function D(){const H=this.resume(),Y=this.stack[this.stack.length-1];Y.value=H}function z(){const H=this.resume(),Y=this.stack[this.stack.length-1];Y.value=H}function U(){const H=this.resume(),Y=this.stack[this.stack.length-1];Y.value=H}function G(){const H=this.stack[this.stack.length-1];if(this.data.inReference){const Y=this.data.referenceType||"shortcut";H.type+="Reference",H.referenceType=Y,delete H.url,delete H.title}else delete H.identifier,delete H.label;this.data.referenceType=void 0}function re(){const H=this.stack[this.stack.length-1];if(this.data.inReference){const Y=this.data.referenceType||"shortcut";H.type+="Reference",H.referenceType=Y,delete H.url,delete H.title}else delete H.identifier,delete H.label;this.data.referenceType=void 0}function K(H){const Y=this.sliceSerialize(H),le=this.stack[this.stack.length-2];le.label=SI(Y),le.identifier=hn(Y).toLowerCase()}function ue(){const H=this.stack[this.stack.length-1],Y=this.resume(),le=this.stack[this.stack.length-1];if(this.data.inReference=!0,le.type==="link"){const ve=H.children;le.children=ve}else le.alt=Y}function R(){const H=this.resume(),Y=this.stack[this.stack.length-1];Y.url=H}function F(){const H=this.resume(),Y=this.stack[this.stack.length-1];Y.title=H}function te(){this.data.inReference=void 0}function _(){this.data.referenceType="collapsed"}function Z(H){const Y=this.resume(),le=this.stack[this.stack.length-1];le.label=Y,le.identifier=hn(this.sliceSerialize(H)).toLowerCase(),this.data.referenceType="full"}function me(H){this.data.characterReferenceType=H.type}function ke(H){const Y=this.sliceSerialize(H),le=this.data.characterReferenceType;let ve;le?(ve=oS(Y,le==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):ve=Yh(Y);const Ve=this.stack[this.stack.length-1];Ve.value+=ve}function se(H){const Y=this.stack.pop();Y.position.end=ia(H.end)}function _e(H){T.call(this,H);const Y=this.stack[this.stack.length-1];Y.url=this.sliceSerialize(H)}function oe(H){T.call(this,H);const Y=this.stack[this.stack.length-1];Y.url="mailto:"+this.sliceSerialize(H)}function fe(){return{type:"blockquote",children:[]}}function Ie(){return{type:"code",lang:null,meta:null,value:""}}function qe(){return{type:"inlineCode",value:""}}function ze(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function ct(){return{type:"emphasis",children:[]}}function Ye(){return{type:"heading",depth:0,children:[]}}function wt(){return{type:"break"}}function gt(){return{type:"html",value:""}}function et(){return{type:"image",title:null,url:"",alt:null}}function Me(){return{type:"link",title:null,url:"",children:[]}}function mt(H){return{type:"list",ordered:H.type==="listOrdered",start:null,spread:H._spread,children:[]}}function Pt(H){return{type:"listItem",spread:H._spread,checked:null,children:[]}}function xe(){return{type:"paragraph",children:[]}}function at(){return{type:"strong",children:[]}}function de(){return{type:"text",value:""}}function Ee(){return{type:"thematicBreak"}}}function ia(e){return{line:e.line,column:e.column,offset:e.offset}}function xS(e,t){let r=-1;for(;++r<t.length;){const n=t[r];Array.isArray(n)?xS(e,n):TI(e,n)}}function TI(e,t){let r;for(r in t)if(bS.call(t,r))switch(r){case"canContainEols":{const n=t[r];n&&e[r].push(...n);break}case"transforms":{const n=t[r];n&&e[r].push(...n);break}case"enter":case"exit":{const n=t[r];n&&Object.assign(e[r],n);break}}}function ab(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+Ui({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+Ui({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+Ui({start:t.start,end:t.end})+") is still open")}function AI(e){const t=this;t.parser=r;function r(n){return NI(n,{...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})}}function II(e,t){const r={type:"element",tagName:"blockquote",properties:{},children:e.wrap(e.all(t),!0)};return e.patch(t,r),e.applyData(t,r)}function RI(e,t){const r={type:"element",tagName:"br",properties:{},children:[]};return e.patch(t,r),[e.applyData(t,r),{type:"text",value:`
|
|
417
|
+
`;break}case-2:{o=t?" ":" ";break}case-1:{if(!t&&i)continue;o=" ";break}default:o=String.fromCharCode(s)}i=s===-2,n.push(o)}return n.join("")}function yI(e){const n={constructs:sS([gI,...(e||{}).extensions||[]]),content:i(OA),defined:[],document:i(MA),flow:i(eI),lazy:{},string:i(nI),text:i(aI)};return n;function i(s){return o;function o(l){return fI(n,s,l)}}}function vI(e){for(;!uS(e););return e}const nb=/[\0\t\n\r]/g;function kI(){let e=1,t="",r=!0,n;return i;function i(s,o,l){const c=[];let d,u,p,h,m;for(s=t+(typeof s=="string"?s.toString():new TextDecoder(o||void 0).decode(s)),p=0,t="",r&&(s.charCodeAt(0)===65279&&p++,r=void 0);p<s.length;){if(nb.lastIndex=p,d=nb.exec(s),h=d&&d.index!==void 0?d.index:s.length,m=s.charCodeAt(h),!d){t=s.slice(p);break}if(m===10&&p===h&&n)c.push(-3),n=void 0;else switch(n&&(c.push(-5),n=void 0),p<h&&(c.push(s.slice(p,h)),e+=h-p),m){case 0:{c.push(65533),e++;break}case 9:{for(u=Math.ceil(e/4)*4,c.push(-2);e++<u;)c.push(-1);break}case 10:{c.push(-4),e=1;break}default:n=!0,e=1}p=h+1}return l&&(n&&c.push(-5),t&&c.push(t),c.push(null)),c}}const wI=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function SI(e){return e.replace(wI,EI)}function EI(e,t,r){if(t)return t;if(r.charCodeAt(0)===35){const i=r.charCodeAt(1),s=i===120||i===88;return oS(r.slice(s?2:1),s?16:10)}return Yh(r)||e}const bS={}.hasOwnProperty;function NI(e,t,r){return typeof t!="string"&&(r=t,t=void 0),CI(r)(vI(yI(r).document().write(kI()(e,t,!0))))}function CI(e){const t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:s(Me),autolinkProtocol:j,autolinkEmail:j,atxHeading:s(Ye),blockQuote:s(fe),characterEscape:j,characterReference:j,codeFenced:s(Ie),codeFencedFenceInfo:o,codeFencedFenceMeta:o,codeIndented:s(Ie,o),codeText:s(qe,o),codeTextData:j,data:j,codeFlowValue:j,definition:s(ze),definitionDestinationString:o,definitionLabelString:o,definitionTitleString:o,emphasis:s(ct),hardBreakEscape:s(wt),hardBreakTrailing:s(wt),htmlFlow:s(gt,o),htmlFlowData:j,htmlText:s(gt,o),htmlTextData:j,image:s(et),label:o,link:s(Me),listItem:s(Pt),listItemValue:h,listOrdered:s(mt,p),listUnordered:s(mt),paragraph:s(xe),reference:_,referenceString:o,resourceDestinationString:o,resourceTitleString:o,setextHeading:s(Ye),strong:s(at),thematicBreak:s(Ee)},exit:{atxHeading:c(),atxHeadingSequence:C,autolink:c(),autolinkEmail:oe,autolinkProtocol:_e,blockQuote:c(),characterEscapeValue:T,characterReferenceMarkerHexadecimal:me,characterReferenceMarkerNumeric:me,characterReferenceValue:ke,characterReference:se,codeFenced:c(w),codeFencedFence:f,codeFencedFenceInfo:m,codeFencedFenceMeta:g,codeFlowValue:T,codeIndented:c(S),codeText:c(U),codeTextData:T,data:T,definition:c(),definitionDestinationString:N,definitionLabelString:k,definitionTitleString:E,emphasis:c(),hardBreakEscape:c(q),hardBreakTrailing:c(q),htmlFlow:c(D),htmlFlowData:T,htmlText:c(z),htmlTextData:T,image:c(re),label:ue,labelText:K,lineEnding:P,link:c(G),listItem:c(),listOrdered:c(),listUnordered:c(),paragraph:c(),referenceString:Z,resourceDestinationString:R,resourceTitleString:F,resource:te,setextHeading:c(M),setextHeadingLineSequence:I,setextHeadingText:v,strong:c(),thematicBreak:c()}};xS(t,(e||{}).mdastExtensions||[]);const r={};return n;function n(H){let Y={type:"root",children:[]};const le={stack:[Y],tokenStack:[],config:t,enter:l,exit:d,buffer:o,resume:u,data:r},ve=[];let Ve=-1;for(;++Ve<H.length;)if(H[Ve][1].type==="listOrdered"||H[Ve][1].type==="listUnordered")if(H[Ve][0]==="enter")ve.push(Ve);else{const It=ve.pop();Ve=i(H,It,Ve)}for(Ve=-1;++Ve<H.length;){const It=t[H[Ve][0]];bS.call(It,H[Ve][1].type)&&It[H[Ve][1].type].call(Object.assign({sliceSerialize:H[Ve][2].sliceSerialize},le),H[Ve][1])}if(le.tokenStack.length>0){const It=le.tokenStack[le.tokenStack.length-1];(It[1]||ab).call(le,void 0,It[0])}for(Y.position={start:ia(H.length>0?H[0][1].start:{line:1,column:1,offset:0}),end:ia(H.length>0?H[H.length-2][1].end:{line:1,column:1,offset:0})},Ve=-1;++Ve<t.transforms.length;)Y=t.transforms[Ve](Y)||Y;return Y}function i(H,Y,le){let ve=Y-1,Ve=-1,It=!1,ft,Rt,it,ie;for(;++ve<=le;){const je=H[ve];switch(je[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{je[0]==="enter"?Ve++:Ve--,ie=void 0;break}case"lineEndingBlank":{je[0]==="enter"&&(ft&&!ie&&!Ve&&!it&&(it=ve),ie=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:ie=void 0}if(!Ve&&je[0]==="enter"&&je[1].type==="listItemPrefix"||Ve===-1&&je[0]==="exit"&&(je[1].type==="listUnordered"||je[1].type==="listOrdered")){if(ft){let Te=ve;for(Rt=void 0;Te--;){const Pe=H[Te];if(Pe[1].type==="lineEnding"||Pe[1].type==="lineEndingBlank"){if(Pe[0]==="exit")continue;Rt&&(H[Rt][1].type="lineEndingBlank",It=!0),Pe[1].type="lineEnding",Rt=Te}else if(!(Pe[1].type==="linePrefix"||Pe[1].type==="blockQuotePrefix"||Pe[1].type==="blockQuotePrefixWhitespace"||Pe[1].type==="blockQuoteMarker"||Pe[1].type==="listItemIndent"))break}it&&(!Rt||it<Rt)&&(ft._spread=!0),ft.end=Object.assign({},Rt?H[Rt][1].start:je[1].end),H.splice(Rt||ve,0,["exit",ft,je[2]]),ve++,le++}if(je[1].type==="listItemPrefix"){const Te={type:"listItem",_spread:!1,start:Object.assign({},je[1].start),end:void 0};ft=Te,H.splice(ve,0,["enter",Te,je[2]]),ve++,le++,it=void 0,ie=!0}}}return H[Y][1]._spread=It,le}function s(H,Y){return le;function le(ve){l.call(this,H(ve),ve),Y&&Y.call(this,ve)}}function o(){this.stack.push({type:"fragment",children:[]})}function l(H,Y,le){this.stack[this.stack.length-1].children.push(H),this.stack.push(H),this.tokenStack.push([Y,le||void 0]),H.position={start:ia(Y.start),end:void 0}}function c(H){return Y;function Y(le){H&&H.call(this,le),d.call(this,le)}}function d(H,Y){const le=this.stack.pop(),ve=this.tokenStack.pop();if(ve)ve[0].type!==H.type&&(Y?Y.call(this,H,ve[0]):(ve[1]||ab).call(this,H,ve[0]));else throw new Error("Cannot close `"+H.type+"` ("+Ui({start:H.start,end:H.end})+"): it’s not open");le.position.end=ia(H.end)}function u(){return Kh(this.stack.pop())}function p(){this.data.expectingFirstListItemValue=!0}function h(H){if(this.data.expectingFirstListItemValue){const Y=this.stack[this.stack.length-2];Y.start=Number.parseInt(this.sliceSerialize(H),10),this.data.expectingFirstListItemValue=void 0}}function m(){const H=this.resume(),Y=this.stack[this.stack.length-1];Y.lang=H}function g(){const H=this.resume(),Y=this.stack[this.stack.length-1];Y.meta=H}function f(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function w(){const H=this.resume(),Y=this.stack[this.stack.length-1];Y.value=H.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function S(){const H=this.resume(),Y=this.stack[this.stack.length-1];Y.value=H.replace(/(\r?\n|\r)$/g,"")}function k(H){const Y=this.resume(),le=this.stack[this.stack.length-1];le.label=Y,le.identifier=hn(this.sliceSerialize(H)).toLowerCase()}function E(){const H=this.resume(),Y=this.stack[this.stack.length-1];Y.title=H}function N(){const H=this.resume(),Y=this.stack[this.stack.length-1];Y.url=H}function C(H){const Y=this.stack[this.stack.length-1];if(!Y.depth){const le=this.sliceSerialize(H).length;Y.depth=le}}function v(){this.data.setextHeadingSlurpLineEnding=!0}function I(H){const Y=this.stack[this.stack.length-1];Y.depth=this.sliceSerialize(H).codePointAt(0)===61?1:2}function M(){this.data.setextHeadingSlurpLineEnding=void 0}function j(H){const le=this.stack[this.stack.length-1].children;let ve=le[le.length-1];(!ve||ve.type!=="text")&&(ve=ce(),ve.position={start:ia(H.start),end:void 0},le.push(ve)),this.stack.push(ve)}function T(H){const Y=this.stack.pop();Y.value+=this.sliceSerialize(H),Y.position.end=ia(H.end)}function P(H){const Y=this.stack[this.stack.length-1];if(this.data.atHardBreak){const le=Y.children[Y.children.length-1];le.position.end=ia(H.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(Y.type)&&(j.call(this,H),T.call(this,H))}function q(){this.data.atHardBreak=!0}function D(){const H=this.resume(),Y=this.stack[this.stack.length-1];Y.value=H}function z(){const H=this.resume(),Y=this.stack[this.stack.length-1];Y.value=H}function U(){const H=this.resume(),Y=this.stack[this.stack.length-1];Y.value=H}function G(){const H=this.stack[this.stack.length-1];if(this.data.inReference){const Y=this.data.referenceType||"shortcut";H.type+="Reference",H.referenceType=Y,delete H.url,delete H.title}else delete H.identifier,delete H.label;this.data.referenceType=void 0}function re(){const H=this.stack[this.stack.length-1];if(this.data.inReference){const Y=this.data.referenceType||"shortcut";H.type+="Reference",H.referenceType=Y,delete H.url,delete H.title}else delete H.identifier,delete H.label;this.data.referenceType=void 0}function K(H){const Y=this.sliceSerialize(H),le=this.stack[this.stack.length-2];le.label=SI(Y),le.identifier=hn(Y).toLowerCase()}function ue(){const H=this.stack[this.stack.length-1],Y=this.resume(),le=this.stack[this.stack.length-1];if(this.data.inReference=!0,le.type==="link"){const ve=H.children;le.children=ve}else le.alt=Y}function R(){const H=this.resume(),Y=this.stack[this.stack.length-1];Y.url=H}function F(){const H=this.resume(),Y=this.stack[this.stack.length-1];Y.title=H}function te(){this.data.inReference=void 0}function _(){this.data.referenceType="collapsed"}function Z(H){const Y=this.resume(),le=this.stack[this.stack.length-1];le.label=Y,le.identifier=hn(this.sliceSerialize(H)).toLowerCase(),this.data.referenceType="full"}function me(H){this.data.characterReferenceType=H.type}function ke(H){const Y=this.sliceSerialize(H),le=this.data.characterReferenceType;let ve;le?(ve=oS(Y,le==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):ve=Yh(Y);const Ve=this.stack[this.stack.length-1];Ve.value+=ve}function se(H){const Y=this.stack.pop();Y.position.end=ia(H.end)}function _e(H){T.call(this,H);const Y=this.stack[this.stack.length-1];Y.url=this.sliceSerialize(H)}function oe(H){T.call(this,H);const Y=this.stack[this.stack.length-1];Y.url="mailto:"+this.sliceSerialize(H)}function fe(){return{type:"blockquote",children:[]}}function Ie(){return{type:"code",lang:null,meta:null,value:""}}function qe(){return{type:"inlineCode",value:""}}function ze(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function ct(){return{type:"emphasis",children:[]}}function Ye(){return{type:"heading",depth:0,children:[]}}function wt(){return{type:"break"}}function gt(){return{type:"html",value:""}}function et(){return{type:"image",title:null,url:"",alt:null}}function Me(){return{type:"link",title:null,url:"",children:[]}}function mt(H){return{type:"list",ordered:H.type==="listOrdered",start:null,spread:H._spread,children:[]}}function Pt(H){return{type:"listItem",spread:H._spread,checked:null,children:[]}}function xe(){return{type:"paragraph",children:[]}}function at(){return{type:"strong",children:[]}}function ce(){return{type:"text",value:""}}function Ee(){return{type:"thematicBreak"}}}function ia(e){return{line:e.line,column:e.column,offset:e.offset}}function xS(e,t){let r=-1;for(;++r<t.length;){const n=t[r];Array.isArray(n)?xS(e,n):TI(e,n)}}function TI(e,t){let r;for(r in t)if(bS.call(t,r))switch(r){case"canContainEols":{const n=t[r];n&&e[r].push(...n);break}case"transforms":{const n=t[r];n&&e[r].push(...n);break}case"enter":case"exit":{const n=t[r];n&&Object.assign(e[r],n);break}}}function ab(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+Ui({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+Ui({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+Ui({start:t.start,end:t.end})+") is still open")}function AI(e){const t=this;t.parser=r;function r(n){return NI(n,{...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})}}function II(e,t){const r={type:"element",tagName:"blockquote",properties:{},children:e.wrap(e.all(t),!0)};return e.patch(t,r),e.applyData(t,r)}function RI(e,t){const r={type:"element",tagName:"br",properties:{},children:[]};return e.patch(t,r),[e.applyData(t,r),{type:"text",value:`
|
|
418
418
|
`}]}function jI(e,t){const r=t.value?t.value+`
|
|
419
419
|
`:"",n={};t.lang&&(n.className=["language-"+t.lang]);let i={type:"element",tagName:"code",properties:n,children:[{type:"text",value:r}]};return t.meta&&(i.data={meta:t.meta}),e.patch(t,i),i=e.applyData(t,i),i={type:"element",tagName:"pre",properties:{},children:[i]},e.patch(t,i),i}function _I(e,t){const r={type:"element",tagName:"del",properties:{},children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function LI(e,t){const r={type:"element",tagName:"em",properties:{},children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function OI(e,t){const r=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",n=String(t.identifier).toUpperCase(),i=xi(n.toLowerCase()),s=e.footnoteOrder.indexOf(n);let o,l=e.footnoteCounts.get(n);l===void 0?(l=0,e.footnoteOrder.push(n),o=e.footnoteOrder.length):o=s+1,l+=1,e.footnoteCounts.set(n,l);const c={type:"element",tagName:"a",properties:{href:"#"+r+"fn-"+i,id:r+"fnref-"+i+(l>1?"-"+l:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(o)}]};e.patch(t,c);const d={type:"element",tagName:"sup",properties:{},children:[c]};return e.patch(t,d),e.applyData(t,d)}function DI(e,t){const r={type:"element",tagName:"h"+t.depth,properties:{},children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function MI(e,t){if(e.options.allowDangerousHtml){const r={type:"raw",value:t.value};return e.patch(t,r),e.applyData(t,r)}}function yS(e,t){const r=t.referenceType;let n="]";if(r==="collapsed"?n+="[]":r==="full"&&(n+="["+(t.label||t.identifier)+"]"),t.type==="imageReference")return[{type:"text",value:"!["+t.alt+n}];const i=e.all(t),s=i[0];s&&s.type==="text"?s.value="["+s.value:i.unshift({type:"text",value:"["});const o=i[i.length-1];return o&&o.type==="text"?o.value+=n:i.push({type:"text",value:n}),i}function FI(e,t){const r=String(t.identifier).toUpperCase(),n=e.definitionById.get(r);if(!n)return yS(e,t);const i={src:xi(n.url||""),alt:t.alt};n.title!==null&&n.title!==void 0&&(i.title=n.title);const s={type:"element",tagName:"img",properties:i,children:[]};return e.patch(t,s),e.applyData(t,s)}function PI(e,t){const r={src:xi(t.url)};t.alt!==null&&t.alt!==void 0&&(r.alt=t.alt),t.title!==null&&t.title!==void 0&&(r.title=t.title);const n={type:"element",tagName:"img",properties:r,children:[]};return e.patch(t,n),e.applyData(t,n)}function BI(e,t){const r={type:"text",value:t.value.replace(/\r?\n|\r/g," ")};e.patch(t,r);const n={type:"element",tagName:"code",properties:{},children:[r]};return e.patch(t,n),e.applyData(t,n)}function zI(e,t){const r=String(t.identifier).toUpperCase(),n=e.definitionById.get(r);if(!n)return yS(e,t);const i={href:xi(n.url||"")};n.title!==null&&n.title!==void 0&&(i.title=n.title);const s={type:"element",tagName:"a",properties:i,children:e.all(t)};return e.patch(t,s),e.applyData(t,s)}function UI(e,t){const r={href:xi(t.url)};t.title!==null&&t.title!==void 0&&(r.title=t.title);const n={type:"element",tagName:"a",properties:r,children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function $I(e,t,r){const n=e.all(t),i=r?qI(r):vS(t),s={},o=[];if(typeof t.checked=="boolean"){const u=n[0];let p;u&&u.type==="element"&&u.tagName==="p"?p=u:(p={type:"element",tagName:"p",properties:{},children:[]},n.unshift(p)),p.children.length>0&&p.children.unshift({type:"text",value:" "}),p.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:t.checked,disabled:!0},children:[]}),s.className=["task-list-item"]}let l=-1;for(;++l<n.length;){const u=n[l];(i||l!==0||u.type!=="element"||u.tagName!=="p")&&o.push({type:"text",value:`
|
|
420
420
|
`}),u.type==="element"&&u.tagName==="p"&&!i?o.push(...u.children):o.push(u)}const c=n[n.length-1];c&&(i||c.type!=="element"||c.tagName!=="p")&&o.push({type:"text",value:`
|
|
@@ -710,7 +710,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
710
710
|
`))})}function cO(e){var t=e.codeString,r=e.codeStyle,n=e.containerStyle,i=n===void 0?{float:"left",paddingRight:"10px"}:n,s=e.numberStyle,o=s===void 0?{}:s,l=e.startingLineNumber;return ir.createElement("code",{style:Object.assign({},r,i)},lO({lines:t.replace(/\n$/,"").split(`
|
|
711
711
|
`),style:o,startingLineNumber:l}))}function dO(e){return"".concat(e.toString().length,".25em")}function tN(e,t){return{type:"element",tagName:"span",properties:{key:"line-number--".concat(e),className:["comment","linenumber","react-syntax-highlighter-line-number"],style:t},children:[{type:"text",value:e}]}}function rN(e,t,r){var n={display:"inline-block",minWidth:dO(r),paddingRight:"1em",textAlign:"right",userSelect:"none"},i=typeof e=="function"?e(t):e,s=ua(ua({},n),i);return s}function Xs(e){var t=e.children,r=e.lineNumber,n=e.lineNumberStyle,i=e.largestLineNumber,s=e.showInlineLineNumbers,o=e.lineProps,l=o===void 0?{}:o,c=e.className,d=c===void 0?[]:c,u=e.showLineNumbers,p=e.wrapLongLines,h=e.wrapLines,m=h===void 0?!1:h,g=m?ua({},typeof l=="function"?l(r):l):{};if(g.className=g.className?[].concat(mh(g.className.trim().split(/\s+/)),mh(d)):d,r&&s){var f=rN(n,r,i);t.unshift(tN(r,f))}return p&u&&(g.style=ua({display:"flex"},g.style)),{type:"element",tagName:"span",properties:g,children:t}}function nN(e){for(var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:[],n=0;n<e.length;n++){var i=e[n];if(i.type==="text")r.push(Xs({children:[i],className:mh(new Set(t))}));else if(i.children){var s=t.concat(i.properties.className);nN(i.children,s).forEach(function(o){return r.push(o)})}}return r}function uO(e,t,r,n,i,s,o,l,c){var d,u=nN(e.value),p=[],h=-1,m=0;function g(C,v){var I=arguments.length>2&&arguments[2]!==void 0?arguments[2]:[];return Xs({children:C,lineNumber:v,lineNumberStyle:l,largestLineNumber:o,showInlineLineNumbers:i,lineProps:r,className:I,showLineNumbers:n,wrapLongLines:c,wrapLines:t})}function f(C,v){if(n&&v&&i){var I=rN(l,v,o);C.unshift(tN(v,I))}return C}function w(C,v){var I=arguments.length>2&&arguments[2]!==void 0?arguments[2]:[];return t||I.length>0?g(C,v,I):f(C,v)}for(var S=function(){var v=u[m],I=v.children[0].value,M=oO(I);if(M){var j=I.split(`
|
|
712
712
|
`);j.forEach(function(T,P){var q=n&&p.length+s,D={type:"text",value:"".concat(T,`
|
|
713
|
-
`)};if(P===0){var z=u.slice(h+1,m).concat(Xs({children:[D],className:v.properties.className})),U=w(z,q);p.push(U)}else if(P===j.length-1){var G=u[m+1]&&u[m+1].children&&u[m+1].children[0],re={type:"text",value:"".concat(T)};if(G){var K=Xs({children:[re],className:v.properties.className});u.splice(m+1,0,K)}else{var ue=[re],R=w(ue,q,v.properties.className);p.push(R)}}else{var F=[D],te=w(F,q,v.properties.className);p.push(te)}}),h=m}m++};m<u.length;)S();if(h!==u.length-1){var k=u.slice(h+1,u.length);if(k&&k.length){var E=n&&p.length+s,N=w(k,E);p.push(N)}}return t?p:(d=[]).concat.apply(d,p)}function pO(e){var t=e.rows,r=e.stylesheet,n=e.useInlineStyles;return t.map(function(i,s){return eN({node:i,stylesheet:r,useInlineStyles:n,key:"code-segment-".concat(s)})})}function aN(e){return e&&typeof e.highlightAuto<"u"}function mO(e){var t=e.astGenerator,r=e.language,n=e.code,i=e.defaultCodeValue;if(aN(t)){var s=aO(t,r);return r==="text"?{value:i,language:"text"}:s?t.highlight(r,n):t.highlightAuto(n)}try{return r&&r!=="text"?{value:t.highlight(n,r)}:{value:i}}catch{return{value:i}}}function hO(e,t){return function(n){var i,s,o=n.language,l=n.children,c=n.style,d=c===void 0?t:c,u=n.customStyle,p=u===void 0?{}:u,h=n.codeTagProps,m=h===void 0?{className:o?"language-".concat(o):void 0,style:ua(ua({},d['code[class*="language-"]']),d['code[class*="language-'.concat(o,'"]')])}:h,g=n.useInlineStyles,f=g===void 0?!0:g,w=n.showLineNumbers,S=w===void 0?!1:w,k=n.showInlineLineNumbers,E=k===void 0?!0:k,N=n.startingLineNumber,C=N===void 0?1:N,v=n.lineNumberContainerStyle,I=n.lineNumberStyle,M=I===void 0?{}:I,j=n.wrapLines,T=n.wrapLongLines,P=T===void 0?!1:T,q=n.lineProps,D=q===void 0?{}:q,z=n.renderer,U=n.PreTag,G=U===void 0?"pre":U,re=n.CodeTag,K=re===void 0?"code":re,ue=n.code,R=ue===void 0?(Array.isArray(l)?l[0]:l)||"":ue,F=n.astGenerator,te=VL(n,iO);F=F||e;var _=S?ir.createElement(cO,{containerStyle:v,codeStyle:m.style||{},numberStyle:M,startingLineNumber:C,codeString:R}):null,Z=d.hljs||d['pre[class*="language-"]']||{backgroundColor:"#fff"},me=aN(F)?"hljs":"prismjs",ke=f?Object.assign({},te,{style:Object.assign({},Z,p)}):Object.assign({},te,{className:te.className?"".concat(me," ").concat(te.className):me,style:Object.assign({},p)});if(P?m.style=ua({whiteSpace:"pre-wrap"},m.style):m.style=ua({whiteSpace:"pre"},m.style),!F)return ir.createElement(G,ke,_,ir.createElement(K,m,R));(j===void 0&&z||P)&&(j=!0),z=z||pO;var se=[{type:"text",value:R}],_e=mO({astGenerator:F,language:o,code:R,defaultCodeValue:se});_e.language===null&&(_e.value=se);var oe=(i=(s=R.match(/\n/g))===null||s===void 0?void 0:s.length)!==null&&i!==void 0?i:0,fe=C+oe,Ie=uO(_e,j,D,S,E,C,fe,M,P);return ir.createElement(G,ke,ir.createElement(K,m,!E&&_,z({rows:Ie,stylesheet:d,useInlineStyles:f})))}}const gO=["abap","abnf","actionscript","ada","agda","al","antlr4","apacheconf","apex","apl","applescript","aql","arduino","arff","asciidoc","asm6502","asmatmel","aspnet","autohotkey","autoit","avisynth","avro-idl","bash","basic","batch","bbcode","bicep","birb","bison","bnf","brainfuck","brightscript","bro","bsl","c","cfscript","chaiscript","cil","clike","clojure","cmake","cobol","coffeescript","concurnas","coq","cpp","crystal","csharp","cshtml","csp","css-extras","css","csv","cypher","d","dart","dataweave","dax","dhall","diff","django","dns-zone-file","docker","dot","ebnf","editorconfig","eiffel","ejs","elixir","elm","erb","erlang","etlua","excel-formula","factor","false","firestore-security-rules","flow","fortran","fsharp","ftl","gap","gcode","gdscript","gedcom","gherkin","git","glsl","gml","gn","go-module","go","graphql","groovy","haml","handlebars","haskell","haxe","hcl","hlsl","hoon","hpkp","hsts","http","ichigojam","icon","icu-message-format","idris","iecst","ignore","inform7","ini","io","j","java","javadoc","javadoclike","javascript","javastacktrace","jexl","jolie","jq","js-extras","js-templates","jsdoc","json","json5","jsonp","jsstacktrace","jsx","julia","keepalived","keyman","kotlin","kumir","kusto","latex","latte","less","lilypond","liquid","lisp","livescript","llvm","log","lolcode","lua","magma","makefile","markdown","markup-templating","markup","matlab","maxscript","mel","mermaid","mizar","mongodb","monkey","moonscript","n1ql","n4js","nand2tetris-hdl","naniscript","nasm","neon","nevod","nginx","nim","nix","nsis","objectivec","ocaml","opencl","openqasm","oz","parigp","parser","pascal","pascaligo","pcaxis","peoplecode","perl","php-extras","php","phpdoc","plsql","powerquery","powershell","processing","prolog","promql","properties","protobuf","psl","pug","puppet","pure","purebasic","purescript","python","q","qml","qore","qsharp","r","racket","reason","regex","rego","renpy","rest","rip","roboconf","robotframework","ruby","rust","sas","sass","scala","scheme","scss","shell-session","smali","smalltalk","smarty","sml","solidity","solution-file","soy","sparql","splunk-spl","sqf","sql","squirrel","stan","stylus","swift","systemd","t4-cs","t4-templating","t4-vb","tap","tcl","textile","toml","tremor","tsx","tt2","turtle","twig","typescript","typoscript","unrealscript","uorazor","uri","v","vala","vbnet","velocity","verilog","vhdl","vim","visual-basic","warpscript","wasm","web-idl","wiki","wolfram","wren","xeora","xml-doc","xojo","xquery","yaml","yang","zig"];var Bl,vx;function fO(){if(vx)return Bl;vx=1,Bl=t;var e=Object.prototype.hasOwnProperty;function t(){for(var r={},n=0;n<arguments.length;n++){var i=arguments[n];for(var s in i)e.call(i,s)&&(r[s]=i[s])}return r}return Bl}var zl,kx;function iN(){if(kx)return zl;kx=1,zl=t;var e=t.prototype;e.space=null,e.normal={},e.property={};function t(r,n,i){this.property=r,this.normal=n,i&&(this.space=i)}return zl}var Ul,wx;function bO(){if(wx)return Ul;wx=1;var e=fO(),t=iN();Ul=r;function r(n){for(var i=n.length,s=[],o=[],l=-1,c,d;++l<i;)c=n[l],s.push(c.property),o.push(c.normal),d=c.space;return new t(e.apply(null,s),e.apply(null,o),d)}return Ul}var $l,Sx;function Ag(){if(Sx)return $l;Sx=1,$l=e;function e(t){return t.toLowerCase()}return $l}var ql,Ex;function sN(){if(Ex)return ql;Ex=1,ql=t;var e=t.prototype;e.space=null,e.attribute=null,e.property=null,e.boolean=!1,e.booleanish=!1,e.overloadedBoolean=!1,e.number=!1,e.commaSeparated=!1,e.spaceSeparated=!1,e.commaOrSpaceSeparated=!1,e.mustUseProperty=!1,e.defined=!1;function t(r,n){this.property=r,this.attribute=n}return ql}var zn={},Nx;function Ig(){if(Nx)return zn;Nx=1;var e=0;zn.boolean=t(),zn.booleanish=t(),zn.overloadedBoolean=t(),zn.number=t(),zn.spaceSeparated=t(),zn.commaSeparated=t(),zn.commaOrSpaceSeparated=t();function t(){return Math.pow(2,++e)}return zn}var Gl,Cx;function oN(){if(Cx)return Gl;Cx=1;var e=sN(),t=Ig();Gl=i,i.prototype=new e,i.prototype.defined=!0;var r=["boolean","booleanish","overloadedBoolean","number","commaSeparated","spaceSeparated","commaOrSpaceSeparated"],n=r.length;function i(o,l,c,d){var u=-1,p;for(s(this,"space",d),e.call(this,o,l);++u<n;)p=r[u],s(this,p,(c&t[p])===t[p])}function s(o,l,c){c&&(o[l]=c)}return Gl}var Hl,Tx;function gs(){if(Tx)return Hl;Tx=1;var e=Ag(),t=iN(),r=oN();Hl=n;function n(i){var s=i.space,o=i.mustUseProperty||[],l=i.attributes||{},c=i.properties,d=i.transform,u={},p={},h,m;for(h in c)m=new r(h,d(l,h),c[h],s),o.indexOf(h)!==-1&&(m.mustUseProperty=!0),u[h]=m,p[e(h)]=h,p[e(m.attribute)]=h;return new t(u,p,s)}return Hl}var Wl,Ax;function xO(){if(Ax)return Wl;Ax=1;var e=gs();Wl=e({space:"xlink",transform:t,properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null}});function t(r,n){return"xlink:"+n.slice(5).toLowerCase()}return Wl}var Vl,Ix;function yO(){if(Ix)return Vl;Ix=1;var e=gs();Vl=e({space:"xml",transform:t,properties:{xmlLang:null,xmlBase:null,xmlSpace:null}});function t(r,n){return"xml:"+n.slice(3).toLowerCase()}return Vl}var Kl,Rx;function vO(){if(Rx)return Kl;Rx=1,Kl=e;function e(t,r){return r in t?t[r]:r}return Kl}var Yl,jx;function lN(){if(jx)return Yl;jx=1;var e=vO();Yl=t;function t(r,n){return e(r,n.toLowerCase())}return Yl}var Xl,_x;function kO(){if(_x)return Xl;_x=1;var e=gs(),t=lN();return Xl=e({space:"xmlns",attributes:{xmlnsxlink:"xmlns:xlink"},transform:t,properties:{xmlns:null,xmlnsXLink:null}}),Xl}var Zl,Lx;function wO(){if(Lx)return Zl;Lx=1;var e=Ig(),t=gs(),r=e.booleanish,n=e.number,i=e.spaceSeparated;Zl=t({transform:s,properties:{ariaActiveDescendant:null,ariaAtomic:r,ariaAutoComplete:null,ariaBusy:r,ariaChecked:r,ariaColCount:n,ariaColIndex:n,ariaColSpan:n,ariaControls:i,ariaCurrent:null,ariaDescribedBy:i,ariaDetails:null,ariaDisabled:r,ariaDropEffect:i,ariaErrorMessage:null,ariaExpanded:r,ariaFlowTo:i,ariaGrabbed:r,ariaHasPopup:null,ariaHidden:r,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:i,ariaLevel:n,ariaLive:null,ariaModal:r,ariaMultiLine:r,ariaMultiSelectable:r,ariaOrientation:null,ariaOwns:i,ariaPlaceholder:null,ariaPosInSet:n,ariaPressed:r,ariaReadOnly:r,ariaRelevant:null,ariaRequired:r,ariaRoleDescription:i,ariaRowCount:n,ariaRowIndex:n,ariaRowSpan:n,ariaSelected:r,ariaSetSize:n,ariaSort:null,ariaValueMax:n,ariaValueMin:n,ariaValueNow:n,ariaValueText:null,role:null}});function s(o,l){return l==="role"?l:"aria-"+l.slice(4).toLowerCase()}return Zl}var Jl,Ox;function SO(){if(Ox)return Jl;Ox=1;var e=Ig(),t=gs(),r=lN(),n=e.boolean,i=e.overloadedBoolean,s=e.booleanish,o=e.number,l=e.spaceSeparated,c=e.commaSeparated;return Jl=t({space:"html",attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},transform:r,mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:c,acceptCharset:l,accessKey:l,action:null,allow:null,allowFullScreen:n,allowPaymentRequest:n,allowUserMedia:n,alt:null,as:null,async:n,autoCapitalize:null,autoComplete:l,autoFocus:n,autoPlay:n,capture:n,charSet:null,checked:n,cite:null,className:l,cols:o,colSpan:null,content:null,contentEditable:s,controls:n,controlsList:l,coords:o|c,crossOrigin:null,data:null,dateTime:null,decoding:null,default:n,defer:n,dir:null,dirName:null,disabled:n,download:i,draggable:s,encType:null,enterKeyHint:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:n,formTarget:null,headers:l,height:o,hidden:n,high:o,href:null,hrefLang:null,htmlFor:l,httpEquiv:l,id:null,imageSizes:null,imageSrcSet:c,inputMode:null,integrity:null,is:null,isMap:n,itemId:null,itemProp:l,itemRef:l,itemScope:n,itemType:l,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:n,low:o,manifest:null,max:null,maxLength:o,media:null,method:null,min:null,minLength:o,multiple:n,muted:n,name:null,nonce:null,noModule:n,noValidate:n,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforePrint:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextMenu:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:n,optimum:o,pattern:null,ping:l,placeholder:null,playsInline:n,poster:null,preload:null,readOnly:n,referrerPolicy:null,rel:l,required:n,reversed:n,rows:o,rowSpan:o,sandbox:l,scope:null,scoped:n,seamless:n,selected:n,shape:null,size:o,sizes:null,slot:null,span:o,spellCheck:s,src:null,srcDoc:null,srcLang:null,srcSet:c,start:o,step:null,style:null,tabIndex:o,target:null,title:null,translate:null,type:null,typeMustMatch:n,useMap:null,value:s,width:o,wrap:null,align:null,aLink:null,archive:l,axis:null,background:null,bgColor:null,border:o,borderColor:null,bottomMargin:o,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:n,declare:n,event:null,face:null,frame:null,frameBorder:null,hSpace:o,leftMargin:o,link:null,longDesc:null,lowSrc:null,marginHeight:o,marginWidth:o,noResize:n,noHref:n,noShade:n,noWrap:n,object:null,profile:null,prompt:null,rev:null,rightMargin:o,rules:null,scheme:null,scrolling:s,standby:null,summary:null,text:null,topMargin:o,valueType:null,version:null,vAlign:null,vLink:null,vSpace:o,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:n,disableRemotePlayback:n,prefix:null,property:null,results:o,security:null,unselectable:null}}),Jl}var Ql,Dx;function EO(){if(Dx)return Ql;Dx=1;var e=bO(),t=xO(),r=yO(),n=kO(),i=wO(),s=SO();return Ql=e([r,t,n,i,s]),Ql}var ec,Mx;function NO(){if(Mx)return ec;Mx=1;var e=Ag(),t=oN(),r=sN(),n="data";ec=l;var i=/^data[-\w.:]+$/i,s=/-[a-z]/g,o=/[A-Z]/g;function l(h,m){var g=e(m),f=m,w=r;return g in h.normal?h.property[h.normal[g]]:(g.length>4&&g.slice(0,4)===n&&i.test(m)&&(m.charAt(4)==="-"?f=c(m):m=d(m),w=t),new w(f,m))}function c(h){var m=h.slice(5).replace(s,p);return n+m.charAt(0).toUpperCase()+m.slice(1)}function d(h){var m=h.slice(4);return s.test(m)?h:(m=m.replace(o,u),m.charAt(0)!=="-"&&(m="-"+m),n+m)}function u(h){return"-"+h.toLowerCase()}function p(h){return h.charAt(1).toUpperCase()}return ec}var tc,Fx;function CO(){if(Fx)return tc;Fx=1,tc=t;var e=/[#.]/g;function t(r,n){for(var i=r||"",s=n||"div",o={},l=0,c,d,u;l<i.length;)e.lastIndex=l,u=e.exec(i),c=i.slice(l,u?u.index:i.length),c&&(d?d==="#"?o.id=c:o.className?o.className.push(c):o.className=[c]:s=c,l+=c.length),u&&(d=u[0],l++);return{type:"element",tagName:s,properties:o,children:[]}}return tc}var Bs={},Px;function TO(){if(Px)return Bs;Px=1,Bs.parse=n,Bs.stringify=i;var e="",t=" ",r=/[ \t\n\r\f]+/g;function n(s){var o=String(s||e).trim();return o===e?[]:o.split(r)}function i(s){return s.join(t).trim()}return Bs}var zs={},Bx;function AO(){if(Bx)return zs;Bx=1,zs.parse=n,zs.stringify=i;var e=",",t=" ",r="";function n(s){for(var o=[],l=String(s||r),c=l.indexOf(e),d=0,u=!1,p;!u;)c===-1&&(c=l.length,u=!0),p=l.slice(d,c).trim(),(p||!u)&&o.push(p),d=c+1,c=l.indexOf(e,d);return o}function i(s,o){var l=o||{},c=l.padLeft===!1?r:t,d=l.padRight?t:r;return s[s.length-1]===r&&(s=s.concat(r)),s.join(d+e+c).trim()}return zs}var rc,zx;function IO(){if(zx)return rc;zx=1;var e=NO(),t=Ag(),r=CO(),n=TO().parse,i=AO().parse;rc=o;var s={}.hasOwnProperty;function o(g,f,w){var S=w?m(w):null;return k;function k(N,C){var v=r(N,f),I=Array.prototype.slice.call(arguments,2),M=v.tagName.toLowerCase(),j;if(v.tagName=S&&s.call(S,M)?S[M]:M,C&&l(C,v)&&(I.unshift(C),C=null),C)for(j in C)E(v.properties,j,C[j]);return d(v.children,I),v.tagName==="template"&&(v.content={type:"root",children:v.children},v.children=[]),v}function E(N,C,v){var I,M,j;v==null||v!==v||(I=e(g,C),M=I.property,j=v,typeof j=="string"&&(I.spaceSeparated?j=n(j):I.commaSeparated?j=i(j):I.commaOrSpaceSeparated&&(j=n(i(j).join(" ")))),M==="style"&&typeof v!="string"&&(j=h(j)),M==="className"&&N.className&&(j=N.className.concat(j)),N[M]=u(I,M,j))}}function l(g,f){return typeof g=="string"||"length"in g||c(f.tagName,g)}function c(g,f){var w=f.type;return g==="input"||!w||typeof w!="string"?!1:typeof f.children=="object"&&"length"in f.children?!0:(w=w.toLowerCase(),g==="button"?w!=="menu"&&w!=="submit"&&w!=="reset"&&w!=="button":"value"in f)}function d(g,f){var w,S;if(typeof f=="string"||typeof f=="number"){g.push({type:"text",value:String(f)});return}if(typeof f=="object"&&"length"in f){for(w=-1,S=f.length;++w<S;)d(g,f[w]);return}if(typeof f!="object"||!("type"in f))throw new Error("Expected node, nodes, or string, got `"+f+"`");g.push(f)}function u(g,f,w){var S,k,E;if(typeof w!="object"||!("length"in w))return p(g,f,w);for(k=w.length,S=-1,E=[];++S<k;)E[S]=p(g,f,w[S]);return E}function p(g,f,w){var S=w;return g.number||g.positiveNumber?!isNaN(S)&&S!==""&&(S=Number(S)):(g.boolean||g.overloadedBoolean)&&typeof S=="string"&&(S===""||t(w)===t(f))&&(S=!0),S}function h(g){var f=[],w;for(w in g)f.push([w,g[w]].join(": "));return f.join("; ")}function m(g){for(var f=g.length,w=-1,S={},k;++w<f;)k=g[w],S[k.toLowerCase()]=k;return S}return rc}var nc,Ux;function RO(){if(Ux)return nc;Ux=1;var e=EO(),t=IO(),r=t(e,"div");return r.displayName="html",nc=r,nc}var ac,$x;function jO(){return $x||($x=1,ac=RO()),ac}const _O="Æ",LO="&",OO="Á",DO="Â",MO="À",FO="Å",PO="Ã",BO="Ä",zO="©",UO="Ç",$O="Ð",qO="É",GO="Ê",HO="È",WO="Ë",VO=">",KO="Í",YO="Î",XO="Ì",ZO="Ï",JO="<",QO="Ñ",eD="Ó",tD="Ô",rD="Ò",nD="Ø",aD="Õ",iD="Ö",sD='"',oD="®",lD="Þ",cD="Ú",dD="Û",uD="Ù",pD="Ü",mD="Ý",hD="á",gD="â",fD="´",bD="æ",xD="à",yD="&",vD="å",kD="ã",wD="ä",SD="¦",ED="ç",ND="¸",CD="¢",TD="©",AD="¤",ID="°",RD="÷",jD="é",_D="ê",LD="è",OD="ð",DD="ë",MD="½",FD="¼",PD="¾",BD=">",zD="í",UD="î",$D="¡",qD="ì",GD="¿",HD="ï",WD="«",VD="<",KD="¯",YD="µ",XD="·",ZD=" ",JD="¬",QD="ñ",eM="ó",tM="ô",rM="ò",nM="ª",aM="º",iM="ø",sM="õ",oM="ö",lM="¶",cM="±",dM="£",uM='"',pM="»",mM="®",hM="§",gM="",fM="¹",bM="²",xM="³",yM="ß",vM="þ",kM="×",wM="ú",SM="û",EM="ù",NM="¨",CM="ü",TM="ý",AM="¥",IM="ÿ",RM={AElig:_O,AMP:LO,Aacute:OO,Acirc:DO,Agrave:MO,Aring:FO,Atilde:PO,Auml:BO,COPY:zO,Ccedil:UO,ETH:$O,Eacute:qO,Ecirc:GO,Egrave:HO,Euml:WO,GT:VO,Iacute:KO,Icirc:YO,Igrave:XO,Iuml:ZO,LT:JO,Ntilde:QO,Oacute:eD,Ocirc:tD,Ograve:rD,Oslash:nD,Otilde:aD,Ouml:iD,QUOT:sD,REG:oD,THORN:lD,Uacute:cD,Ucirc:dD,Ugrave:uD,Uuml:pD,Yacute:mD,aacute:hD,acirc:gD,acute:fD,aelig:bD,agrave:xD,amp:yD,aring:vD,atilde:kD,auml:wD,brvbar:SD,ccedil:ED,cedil:ND,cent:CD,copy:TD,curren:AD,deg:ID,divide:RD,eacute:jD,ecirc:_D,egrave:LD,eth:OD,euml:DD,frac12:MD,frac14:FD,frac34:PD,gt:BD,iacute:zD,icirc:UD,iexcl:$D,igrave:qD,iquest:GD,iuml:HD,laquo:WD,lt:VD,macr:KD,micro:YD,middot:XD,nbsp:ZD,not:JD,ntilde:QD,oacute:eM,ocirc:tM,ograve:rM,ordf:nM,ordm:aM,oslash:iM,otilde:sM,ouml:oM,para:lM,plusmn:cM,pound:dM,quot:uM,raquo:pM,reg:mM,sect:hM,shy:gM,sup1:fM,sup2:bM,sup3:xM,szlig:yM,thorn:vM,times:kM,uacute:wM,ucirc:SM,ugrave:EM,uml:NM,uuml:CM,yacute:TM,yen:AM,yuml:IM},jM={0:"�",128:"€",130:"‚",131:"ƒ",132:"„",133:"…",134:"†",135:"‡",136:"ˆ",137:"‰",138:"Š",139:"‹",140:"Œ",142:"Ž",145:"‘",146:"’",147:"“",148:"”",149:"•",150:"–",151:"—",152:"˜",153:"™",154:"š",155:"›",156:"œ",158:"ž",159:"Ÿ"};var ic,qx;function cN(){if(qx)return ic;qx=1,ic=e;function e(t){var r=typeof t=="string"?t.charCodeAt(0):t;return r>=48&&r<=57}return ic}var sc,Gx;function _M(){if(Gx)return sc;Gx=1,sc=e;function e(t){var r=typeof t=="string"?t.charCodeAt(0):t;return r>=97&&r<=102||r>=65&&r<=70||r>=48&&r<=57}return sc}var oc,Hx;function LM(){if(Hx)return oc;Hx=1,oc=e;function e(t){var r=typeof t=="string"?t.charCodeAt(0):t;return r>=97&&r<=122||r>=65&&r<=90}return oc}var lc,Wx;function OM(){if(Wx)return lc;Wx=1;var e=LM(),t=cN();lc=r;function r(n){return e(n)||t(n)}return lc}var cc,Vx;function DM(){if(Vx)return cc;Vx=1;var e,t=59;cc=r;function r(n){var i="&"+n+";",s;return e=e||document.createElement("i"),e.innerHTML=i,s=e.textContent,s.charCodeAt(s.length-1)===t&&n!=="semi"||s===i?!1:s}return cc}var dc,Kx;function MM(){if(Kx)return dc;Kx=1;var e=RM,t=jM,r=cN(),n=_M(),i=OM(),s=DM();dc=ue;var o={}.hasOwnProperty,l=String.fromCharCode,c=Function.prototype,d={warning:null,reference:null,text:null,warningContext:null,referenceContext:null,textContext:null,position:{},additional:null,attribute:!1,nonTerminated:!0},u=9,p=10,h=12,m=32,g=38,f=59,w=60,S=61,k=35,E=88,N=120,C=65533,v="named",I="hexadecimal",M="decimal",j={};j[I]=16,j[M]=10;var T={};T[v]=i,T[M]=r,T[I]=n;var P=1,q=2,D=3,z=4,U=5,G=6,re=7,K={};K[P]="Named character references must be terminated by a semicolon",K[q]="Numeric character references must be terminated by a semicolon",K[D]="Named character references cannot be empty",K[z]="Numeric character references cannot be empty",K[U]="Named character references must be known",K[G]="Numeric character references cannot be disallowed",K[re]="Numeric character references cannot be outside the permissible Unicode range";function ue(_,Z){var me={},ke,se;Z||(Z={});for(se in d)ke=Z[se],me[se]=ke??d[se];return(me.position.indent||me.position.start)&&(me.indent=me.position.indent||[],me.position=me.position.start),R(_,me)}function R(_,Z){var me=Z.additional,ke=Z.nonTerminated,se=Z.text,_e=Z.reference,oe=Z.warning,fe=Z.textContext,Ie=Z.referenceContext,qe=Z.warningContext,ze=Z.position,ct=Z.indent||[],Ye=_.length,wt=0,gt=-1,et=ze.column||1,Me=ze.line||1,mt="",Pt=[],xe,at,de,Ee,H,Y,le,ve,Ve,It,ft,Rt,it,ie,je,Te,Pe,Ue,st;for(typeof me=="string"&&(me=me.charCodeAt(0)),Te=Qe(),ve=oe?J:c,wt--,Ye++;++wt<Ye;)if(H===p&&(et=ct[gt]||1),H=_.charCodeAt(wt),H===g){if(le=_.charCodeAt(wt+1),le===u||le===p||le===h||le===m||le===g||le===w||le!==le||me&&le===me){mt+=l(H),et++;continue}for(it=wt+1,Rt=it,st=it,le===k?(st=++Rt,le=_.charCodeAt(st),le===E||le===N?(ie=I,st=++Rt):ie=M):ie=v,xe="",ft="",Ee="",je=T[ie],st--;++st<Ye&&(le=_.charCodeAt(st),!!je(le));)Ee+=l(le),ie===v&&o.call(e,Ee)&&(xe=Ee,ft=e[Ee]);de=_.charCodeAt(st)===f,de&&(st++,at=ie===v?s(Ee):!1,at&&(xe=Ee,ft=at)),Ue=1+st-it,!de&&!ke||(Ee?ie===v?(de&&!ft?ve(U,1):(xe!==Ee&&(st=Rt+xe.length,Ue=1+st-Rt,de=!1),de||(Ve=xe?P:D,Z.attribute?(le=_.charCodeAt(st),le===S?(ve(Ve,Ue),ft=null):i(le)?ft=null:ve(Ve,Ue)):ve(Ve,Ue))),Y=ft):(de||ve(q,Ue),Y=parseInt(Ee,j[ie]),F(Y)?(ve(re,Ue),Y=l(C)):Y in t?(ve(G,Ue),Y=t[Y]):(It="",te(Y)&&ve(G,Ue),Y>65535&&(Y-=65536,It+=l(Y>>>10|55296),Y=56320|Y&1023),Y=It+l(Y))):ie!==v&&ve(z,Ue)),Y?(Fe(),Te=Qe(),wt=st-1,et+=st-it+1,Pt.push(Y),Pe=Qe(),Pe.offset++,_e&&_e.call(Ie,Y,{start:Te,end:Pe},_.slice(it-1,st)),Te=Pe):(Ee=_.slice(it-1,st),mt+=Ee,et+=Ee.length,wt=st-1)}else H===10&&(Me++,gt++,et=0),H===H?(mt+=l(H),et++):Fe();return Pt.join("");function Qe(){return{line:Me,column:et,offset:wt+(ze.offset||0)}}function J(Ke,Ge){var dt=Qe();dt.column+=Ge,dt.offset+=Ge,oe.call(qe,K[Ke],dt,Ke)}function Fe(){mt&&(Pt.push(mt),se&&se.call(fe,mt,{start:Te,end:Qe()}),mt="")}}function F(_){return _>=55296&&_<=57343||_>1114111}function te(_){return _>=1&&_<=8||_===11||_>=13&&_<=31||_>=127&&_<=159||_>=64976&&_<=65007||(_&65535)===65535||(_&65535)===65534}return dc}var uc={exports:{}},Yx;function FM(){return Yx||(Yx=1,function(e){var t=typeof window<"u"?window:typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope?self:{};/**
|
|
713
|
+
`)};if(P===0){var z=u.slice(h+1,m).concat(Xs({children:[D],className:v.properties.className})),U=w(z,q);p.push(U)}else if(P===j.length-1){var G=u[m+1]&&u[m+1].children&&u[m+1].children[0],re={type:"text",value:"".concat(T)};if(G){var K=Xs({children:[re],className:v.properties.className});u.splice(m+1,0,K)}else{var ue=[re],R=w(ue,q,v.properties.className);p.push(R)}}else{var F=[D],te=w(F,q,v.properties.className);p.push(te)}}),h=m}m++};m<u.length;)S();if(h!==u.length-1){var k=u.slice(h+1,u.length);if(k&&k.length){var E=n&&p.length+s,N=w(k,E);p.push(N)}}return t?p:(d=[]).concat.apply(d,p)}function pO(e){var t=e.rows,r=e.stylesheet,n=e.useInlineStyles;return t.map(function(i,s){return eN({node:i,stylesheet:r,useInlineStyles:n,key:"code-segment-".concat(s)})})}function aN(e){return e&&typeof e.highlightAuto<"u"}function mO(e){var t=e.astGenerator,r=e.language,n=e.code,i=e.defaultCodeValue;if(aN(t)){var s=aO(t,r);return r==="text"?{value:i,language:"text"}:s?t.highlight(r,n):t.highlightAuto(n)}try{return r&&r!=="text"?{value:t.highlight(n,r)}:{value:i}}catch{return{value:i}}}function hO(e,t){return function(n){var i,s,o=n.language,l=n.children,c=n.style,d=c===void 0?t:c,u=n.customStyle,p=u===void 0?{}:u,h=n.codeTagProps,m=h===void 0?{className:o?"language-".concat(o):void 0,style:ua(ua({},d['code[class*="language-"]']),d['code[class*="language-'.concat(o,'"]')])}:h,g=n.useInlineStyles,f=g===void 0?!0:g,w=n.showLineNumbers,S=w===void 0?!1:w,k=n.showInlineLineNumbers,E=k===void 0?!0:k,N=n.startingLineNumber,C=N===void 0?1:N,v=n.lineNumberContainerStyle,I=n.lineNumberStyle,M=I===void 0?{}:I,j=n.wrapLines,T=n.wrapLongLines,P=T===void 0?!1:T,q=n.lineProps,D=q===void 0?{}:q,z=n.renderer,U=n.PreTag,G=U===void 0?"pre":U,re=n.CodeTag,K=re===void 0?"code":re,ue=n.code,R=ue===void 0?(Array.isArray(l)?l[0]:l)||"":ue,F=n.astGenerator,te=VL(n,iO);F=F||e;var _=S?ir.createElement(cO,{containerStyle:v,codeStyle:m.style||{},numberStyle:M,startingLineNumber:C,codeString:R}):null,Z=d.hljs||d['pre[class*="language-"]']||{backgroundColor:"#fff"},me=aN(F)?"hljs":"prismjs",ke=f?Object.assign({},te,{style:Object.assign({},Z,p)}):Object.assign({},te,{className:te.className?"".concat(me," ").concat(te.className):me,style:Object.assign({},p)});if(P?m.style=ua({whiteSpace:"pre-wrap"},m.style):m.style=ua({whiteSpace:"pre"},m.style),!F)return ir.createElement(G,ke,_,ir.createElement(K,m,R));(j===void 0&&z||P)&&(j=!0),z=z||pO;var se=[{type:"text",value:R}],_e=mO({astGenerator:F,language:o,code:R,defaultCodeValue:se});_e.language===null&&(_e.value=se);var oe=(i=(s=R.match(/\n/g))===null||s===void 0?void 0:s.length)!==null&&i!==void 0?i:0,fe=C+oe,Ie=uO(_e,j,D,S,E,C,fe,M,P);return ir.createElement(G,ke,ir.createElement(K,m,!E&&_,z({rows:Ie,stylesheet:d,useInlineStyles:f})))}}const gO=["abap","abnf","actionscript","ada","agda","al","antlr4","apacheconf","apex","apl","applescript","aql","arduino","arff","asciidoc","asm6502","asmatmel","aspnet","autohotkey","autoit","avisynth","avro-idl","bash","basic","batch","bbcode","bicep","birb","bison","bnf","brainfuck","brightscript","bro","bsl","c","cfscript","chaiscript","cil","clike","clojure","cmake","cobol","coffeescript","concurnas","coq","cpp","crystal","csharp","cshtml","csp","css-extras","css","csv","cypher","d","dart","dataweave","dax","dhall","diff","django","dns-zone-file","docker","dot","ebnf","editorconfig","eiffel","ejs","elixir","elm","erb","erlang","etlua","excel-formula","factor","false","firestore-security-rules","flow","fortran","fsharp","ftl","gap","gcode","gdscript","gedcom","gherkin","git","glsl","gml","gn","go-module","go","graphql","groovy","haml","handlebars","haskell","haxe","hcl","hlsl","hoon","hpkp","hsts","http","ichigojam","icon","icu-message-format","idris","iecst","ignore","inform7","ini","io","j","java","javadoc","javadoclike","javascript","javastacktrace","jexl","jolie","jq","js-extras","js-templates","jsdoc","json","json5","jsonp","jsstacktrace","jsx","julia","keepalived","keyman","kotlin","kumir","kusto","latex","latte","less","lilypond","liquid","lisp","livescript","llvm","log","lolcode","lua","magma","makefile","markdown","markup-templating","markup","matlab","maxscript","mel","mermaid","mizar","mongodb","monkey","moonscript","n1ql","n4js","nand2tetris-hdl","naniscript","nasm","neon","nevod","nginx","nim","nix","nsis","objectivec","ocaml","opencl","openqasm","oz","parigp","parser","pascal","pascaligo","pcaxis","peoplecode","perl","php-extras","php","phpdoc","plsql","powerquery","powershell","processing","prolog","promql","properties","protobuf","psl","pug","puppet","pure","purebasic","purescript","python","q","qml","qore","qsharp","r","racket","reason","regex","rego","renpy","rest","rip","roboconf","robotframework","ruby","rust","sas","sass","scala","scheme","scss","shell-session","smali","smalltalk","smarty","sml","solidity","solution-file","soy","sparql","splunk-spl","sqf","sql","squirrel","stan","stylus","swift","systemd","t4-cs","t4-templating","t4-vb","tap","tcl","textile","toml","tremor","tsx","tt2","turtle","twig","typescript","typoscript","unrealscript","uorazor","uri","v","vala","vbnet","velocity","verilog","vhdl","vim","visual-basic","warpscript","wasm","web-idl","wiki","wolfram","wren","xeora","xml-doc","xojo","xquery","yaml","yang","zig"];var Bl,vx;function fO(){if(vx)return Bl;vx=1,Bl=t;var e=Object.prototype.hasOwnProperty;function t(){for(var r={},n=0;n<arguments.length;n++){var i=arguments[n];for(var s in i)e.call(i,s)&&(r[s]=i[s])}return r}return Bl}var zl,kx;function iN(){if(kx)return zl;kx=1,zl=t;var e=t.prototype;e.space=null,e.normal={},e.property={};function t(r,n,i){this.property=r,this.normal=n,i&&(this.space=i)}return zl}var Ul,wx;function bO(){if(wx)return Ul;wx=1;var e=fO(),t=iN();Ul=r;function r(n){for(var i=n.length,s=[],o=[],l=-1,c,d;++l<i;)c=n[l],s.push(c.property),o.push(c.normal),d=c.space;return new t(e.apply(null,s),e.apply(null,o),d)}return Ul}var $l,Sx;function Ag(){if(Sx)return $l;Sx=1,$l=e;function e(t){return t.toLowerCase()}return $l}var ql,Ex;function sN(){if(Ex)return ql;Ex=1,ql=t;var e=t.prototype;e.space=null,e.attribute=null,e.property=null,e.boolean=!1,e.booleanish=!1,e.overloadedBoolean=!1,e.number=!1,e.commaSeparated=!1,e.spaceSeparated=!1,e.commaOrSpaceSeparated=!1,e.mustUseProperty=!1,e.defined=!1;function t(r,n){this.property=r,this.attribute=n}return ql}var zn={},Nx;function Ig(){if(Nx)return zn;Nx=1;var e=0;zn.boolean=t(),zn.booleanish=t(),zn.overloadedBoolean=t(),zn.number=t(),zn.spaceSeparated=t(),zn.commaSeparated=t(),zn.commaOrSpaceSeparated=t();function t(){return Math.pow(2,++e)}return zn}var Gl,Cx;function oN(){if(Cx)return Gl;Cx=1;var e=sN(),t=Ig();Gl=i,i.prototype=new e,i.prototype.defined=!0;var r=["boolean","booleanish","overloadedBoolean","number","commaSeparated","spaceSeparated","commaOrSpaceSeparated"],n=r.length;function i(o,l,c,d){var u=-1,p;for(s(this,"space",d),e.call(this,o,l);++u<n;)p=r[u],s(this,p,(c&t[p])===t[p])}function s(o,l,c){c&&(o[l]=c)}return Gl}var Hl,Tx;function gs(){if(Tx)return Hl;Tx=1;var e=Ag(),t=iN(),r=oN();Hl=n;function n(i){var s=i.space,o=i.mustUseProperty||[],l=i.attributes||{},c=i.properties,d=i.transform,u={},p={},h,m;for(h in c)m=new r(h,d(l,h),c[h],s),o.indexOf(h)!==-1&&(m.mustUseProperty=!0),u[h]=m,p[e(h)]=h,p[e(m.attribute)]=h;return new t(u,p,s)}return Hl}var Wl,Ax;function xO(){if(Ax)return Wl;Ax=1;var e=gs();Wl=e({space:"xlink",transform:t,properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null}});function t(r,n){return"xlink:"+n.slice(5).toLowerCase()}return Wl}var Vl,Ix;function yO(){if(Ix)return Vl;Ix=1;var e=gs();Vl=e({space:"xml",transform:t,properties:{xmlLang:null,xmlBase:null,xmlSpace:null}});function t(r,n){return"xml:"+n.slice(3).toLowerCase()}return Vl}var Kl,Rx;function vO(){if(Rx)return Kl;Rx=1,Kl=e;function e(t,r){return r in t?t[r]:r}return Kl}var Yl,jx;function lN(){if(jx)return Yl;jx=1;var e=vO();Yl=t;function t(r,n){return e(r,n.toLowerCase())}return Yl}var Xl,_x;function kO(){if(_x)return Xl;_x=1;var e=gs(),t=lN();return Xl=e({space:"xmlns",attributes:{xmlnsxlink:"xmlns:xlink"},transform:t,properties:{xmlns:null,xmlnsXLink:null}}),Xl}var Zl,Lx;function wO(){if(Lx)return Zl;Lx=1;var e=Ig(),t=gs(),r=e.booleanish,n=e.number,i=e.spaceSeparated;Zl=t({transform:s,properties:{ariaActiveDescendant:null,ariaAtomic:r,ariaAutoComplete:null,ariaBusy:r,ariaChecked:r,ariaColCount:n,ariaColIndex:n,ariaColSpan:n,ariaControls:i,ariaCurrent:null,ariaDescribedBy:i,ariaDetails:null,ariaDisabled:r,ariaDropEffect:i,ariaErrorMessage:null,ariaExpanded:r,ariaFlowTo:i,ariaGrabbed:r,ariaHasPopup:null,ariaHidden:r,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:i,ariaLevel:n,ariaLive:null,ariaModal:r,ariaMultiLine:r,ariaMultiSelectable:r,ariaOrientation:null,ariaOwns:i,ariaPlaceholder:null,ariaPosInSet:n,ariaPressed:r,ariaReadOnly:r,ariaRelevant:null,ariaRequired:r,ariaRoleDescription:i,ariaRowCount:n,ariaRowIndex:n,ariaRowSpan:n,ariaSelected:r,ariaSetSize:n,ariaSort:null,ariaValueMax:n,ariaValueMin:n,ariaValueNow:n,ariaValueText:null,role:null}});function s(o,l){return l==="role"?l:"aria-"+l.slice(4).toLowerCase()}return Zl}var Jl,Ox;function SO(){if(Ox)return Jl;Ox=1;var e=Ig(),t=gs(),r=lN(),n=e.boolean,i=e.overloadedBoolean,s=e.booleanish,o=e.number,l=e.spaceSeparated,c=e.commaSeparated;return Jl=t({space:"html",attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},transform:r,mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:c,acceptCharset:l,accessKey:l,action:null,allow:null,allowFullScreen:n,allowPaymentRequest:n,allowUserMedia:n,alt:null,as:null,async:n,autoCapitalize:null,autoComplete:l,autoFocus:n,autoPlay:n,capture:n,charSet:null,checked:n,cite:null,className:l,cols:o,colSpan:null,content:null,contentEditable:s,controls:n,controlsList:l,coords:o|c,crossOrigin:null,data:null,dateTime:null,decoding:null,default:n,defer:n,dir:null,dirName:null,disabled:n,download:i,draggable:s,encType:null,enterKeyHint:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:n,formTarget:null,headers:l,height:o,hidden:n,high:o,href:null,hrefLang:null,htmlFor:l,httpEquiv:l,id:null,imageSizes:null,imageSrcSet:c,inputMode:null,integrity:null,is:null,isMap:n,itemId:null,itemProp:l,itemRef:l,itemScope:n,itemType:l,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:n,low:o,manifest:null,max:null,maxLength:o,media:null,method:null,min:null,minLength:o,multiple:n,muted:n,name:null,nonce:null,noModule:n,noValidate:n,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforePrint:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextMenu:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:n,optimum:o,pattern:null,ping:l,placeholder:null,playsInline:n,poster:null,preload:null,readOnly:n,referrerPolicy:null,rel:l,required:n,reversed:n,rows:o,rowSpan:o,sandbox:l,scope:null,scoped:n,seamless:n,selected:n,shape:null,size:o,sizes:null,slot:null,span:o,spellCheck:s,src:null,srcDoc:null,srcLang:null,srcSet:c,start:o,step:null,style:null,tabIndex:o,target:null,title:null,translate:null,type:null,typeMustMatch:n,useMap:null,value:s,width:o,wrap:null,align:null,aLink:null,archive:l,axis:null,background:null,bgColor:null,border:o,borderColor:null,bottomMargin:o,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:n,declare:n,event:null,face:null,frame:null,frameBorder:null,hSpace:o,leftMargin:o,link:null,longDesc:null,lowSrc:null,marginHeight:o,marginWidth:o,noResize:n,noHref:n,noShade:n,noWrap:n,object:null,profile:null,prompt:null,rev:null,rightMargin:o,rules:null,scheme:null,scrolling:s,standby:null,summary:null,text:null,topMargin:o,valueType:null,version:null,vAlign:null,vLink:null,vSpace:o,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:n,disableRemotePlayback:n,prefix:null,property:null,results:o,security:null,unselectable:null}}),Jl}var Ql,Dx;function EO(){if(Dx)return Ql;Dx=1;var e=bO(),t=xO(),r=yO(),n=kO(),i=wO(),s=SO();return Ql=e([r,t,n,i,s]),Ql}var ec,Mx;function NO(){if(Mx)return ec;Mx=1;var e=Ag(),t=oN(),r=sN(),n="data";ec=l;var i=/^data[-\w.:]+$/i,s=/-[a-z]/g,o=/[A-Z]/g;function l(h,m){var g=e(m),f=m,w=r;return g in h.normal?h.property[h.normal[g]]:(g.length>4&&g.slice(0,4)===n&&i.test(m)&&(m.charAt(4)==="-"?f=c(m):m=d(m),w=t),new w(f,m))}function c(h){var m=h.slice(5).replace(s,p);return n+m.charAt(0).toUpperCase()+m.slice(1)}function d(h){var m=h.slice(4);return s.test(m)?h:(m=m.replace(o,u),m.charAt(0)!=="-"&&(m="-"+m),n+m)}function u(h){return"-"+h.toLowerCase()}function p(h){return h.charAt(1).toUpperCase()}return ec}var tc,Fx;function CO(){if(Fx)return tc;Fx=1,tc=t;var e=/[#.]/g;function t(r,n){for(var i=r||"",s=n||"div",o={},l=0,c,d,u;l<i.length;)e.lastIndex=l,u=e.exec(i),c=i.slice(l,u?u.index:i.length),c&&(d?d==="#"?o.id=c:o.className?o.className.push(c):o.className=[c]:s=c,l+=c.length),u&&(d=u[0],l++);return{type:"element",tagName:s,properties:o,children:[]}}return tc}var Bs={},Px;function TO(){if(Px)return Bs;Px=1,Bs.parse=n,Bs.stringify=i;var e="",t=" ",r=/[ \t\n\r\f]+/g;function n(s){var o=String(s||e).trim();return o===e?[]:o.split(r)}function i(s){return s.join(t).trim()}return Bs}var zs={},Bx;function AO(){if(Bx)return zs;Bx=1,zs.parse=n,zs.stringify=i;var e=",",t=" ",r="";function n(s){for(var o=[],l=String(s||r),c=l.indexOf(e),d=0,u=!1,p;!u;)c===-1&&(c=l.length,u=!0),p=l.slice(d,c).trim(),(p||!u)&&o.push(p),d=c+1,c=l.indexOf(e,d);return o}function i(s,o){var l=o||{},c=l.padLeft===!1?r:t,d=l.padRight?t:r;return s[s.length-1]===r&&(s=s.concat(r)),s.join(d+e+c).trim()}return zs}var rc,zx;function IO(){if(zx)return rc;zx=1;var e=NO(),t=Ag(),r=CO(),n=TO().parse,i=AO().parse;rc=o;var s={}.hasOwnProperty;function o(g,f,w){var S=w?m(w):null;return k;function k(N,C){var v=r(N,f),I=Array.prototype.slice.call(arguments,2),M=v.tagName.toLowerCase(),j;if(v.tagName=S&&s.call(S,M)?S[M]:M,C&&l(C,v)&&(I.unshift(C),C=null),C)for(j in C)E(v.properties,j,C[j]);return d(v.children,I),v.tagName==="template"&&(v.content={type:"root",children:v.children},v.children=[]),v}function E(N,C,v){var I,M,j;v==null||v!==v||(I=e(g,C),M=I.property,j=v,typeof j=="string"&&(I.spaceSeparated?j=n(j):I.commaSeparated?j=i(j):I.commaOrSpaceSeparated&&(j=n(i(j).join(" ")))),M==="style"&&typeof v!="string"&&(j=h(j)),M==="className"&&N.className&&(j=N.className.concat(j)),N[M]=u(I,M,j))}}function l(g,f){return typeof g=="string"||"length"in g||c(f.tagName,g)}function c(g,f){var w=f.type;return g==="input"||!w||typeof w!="string"?!1:typeof f.children=="object"&&"length"in f.children?!0:(w=w.toLowerCase(),g==="button"?w!=="menu"&&w!=="submit"&&w!=="reset"&&w!=="button":"value"in f)}function d(g,f){var w,S;if(typeof f=="string"||typeof f=="number"){g.push({type:"text",value:String(f)});return}if(typeof f=="object"&&"length"in f){for(w=-1,S=f.length;++w<S;)d(g,f[w]);return}if(typeof f!="object"||!("type"in f))throw new Error("Expected node, nodes, or string, got `"+f+"`");g.push(f)}function u(g,f,w){var S,k,E;if(typeof w!="object"||!("length"in w))return p(g,f,w);for(k=w.length,S=-1,E=[];++S<k;)E[S]=p(g,f,w[S]);return E}function p(g,f,w){var S=w;return g.number||g.positiveNumber?!isNaN(S)&&S!==""&&(S=Number(S)):(g.boolean||g.overloadedBoolean)&&typeof S=="string"&&(S===""||t(w)===t(f))&&(S=!0),S}function h(g){var f=[],w;for(w in g)f.push([w,g[w]].join(": "));return f.join("; ")}function m(g){for(var f=g.length,w=-1,S={},k;++w<f;)k=g[w],S[k.toLowerCase()]=k;return S}return rc}var nc,Ux;function RO(){if(Ux)return nc;Ux=1;var e=EO(),t=IO(),r=t(e,"div");return r.displayName="html",nc=r,nc}var ac,$x;function jO(){return $x||($x=1,ac=RO()),ac}const _O="Æ",LO="&",OO="Á",DO="Â",MO="À",FO="Å",PO="Ã",BO="Ä",zO="©",UO="Ç",$O="Ð",qO="É",GO="Ê",HO="È",WO="Ë",VO=">",KO="Í",YO="Î",XO="Ì",ZO="Ï",JO="<",QO="Ñ",eD="Ó",tD="Ô",rD="Ò",nD="Ø",aD="Õ",iD="Ö",sD='"',oD="®",lD="Þ",cD="Ú",dD="Û",uD="Ù",pD="Ü",mD="Ý",hD="á",gD="â",fD="´",bD="æ",xD="à",yD="&",vD="å",kD="ã",wD="ä",SD="¦",ED="ç",ND="¸",CD="¢",TD="©",AD="¤",ID="°",RD="÷",jD="é",_D="ê",LD="è",OD="ð",DD="ë",MD="½",FD="¼",PD="¾",BD=">",zD="í",UD="î",$D="¡",qD="ì",GD="¿",HD="ï",WD="«",VD="<",KD="¯",YD="µ",XD="·",ZD=" ",JD="¬",QD="ñ",eM="ó",tM="ô",rM="ò",nM="ª",aM="º",iM="ø",sM="õ",oM="ö",lM="¶",cM="±",dM="£",uM='"',pM="»",mM="®",hM="§",gM="",fM="¹",bM="²",xM="³",yM="ß",vM="þ",kM="×",wM="ú",SM="û",EM="ù",NM="¨",CM="ü",TM="ý",AM="¥",IM="ÿ",RM={AElig:_O,AMP:LO,Aacute:OO,Acirc:DO,Agrave:MO,Aring:FO,Atilde:PO,Auml:BO,COPY:zO,Ccedil:UO,ETH:$O,Eacute:qO,Ecirc:GO,Egrave:HO,Euml:WO,GT:VO,Iacute:KO,Icirc:YO,Igrave:XO,Iuml:ZO,LT:JO,Ntilde:QO,Oacute:eD,Ocirc:tD,Ograve:rD,Oslash:nD,Otilde:aD,Ouml:iD,QUOT:sD,REG:oD,THORN:lD,Uacute:cD,Ucirc:dD,Ugrave:uD,Uuml:pD,Yacute:mD,aacute:hD,acirc:gD,acute:fD,aelig:bD,agrave:xD,amp:yD,aring:vD,atilde:kD,auml:wD,brvbar:SD,ccedil:ED,cedil:ND,cent:CD,copy:TD,curren:AD,deg:ID,divide:RD,eacute:jD,ecirc:_D,egrave:LD,eth:OD,euml:DD,frac12:MD,frac14:FD,frac34:PD,gt:BD,iacute:zD,icirc:UD,iexcl:$D,igrave:qD,iquest:GD,iuml:HD,laquo:WD,lt:VD,macr:KD,micro:YD,middot:XD,nbsp:ZD,not:JD,ntilde:QD,oacute:eM,ocirc:tM,ograve:rM,ordf:nM,ordm:aM,oslash:iM,otilde:sM,ouml:oM,para:lM,plusmn:cM,pound:dM,quot:uM,raquo:pM,reg:mM,sect:hM,shy:gM,sup1:fM,sup2:bM,sup3:xM,szlig:yM,thorn:vM,times:kM,uacute:wM,ucirc:SM,ugrave:EM,uml:NM,uuml:CM,yacute:TM,yen:AM,yuml:IM},jM={0:"�",128:"€",130:"‚",131:"ƒ",132:"„",133:"…",134:"†",135:"‡",136:"ˆ",137:"‰",138:"Š",139:"‹",140:"Œ",142:"Ž",145:"‘",146:"’",147:"“",148:"”",149:"•",150:"–",151:"—",152:"˜",153:"™",154:"š",155:"›",156:"œ",158:"ž",159:"Ÿ"};var ic,qx;function cN(){if(qx)return ic;qx=1,ic=e;function e(t){var r=typeof t=="string"?t.charCodeAt(0):t;return r>=48&&r<=57}return ic}var sc,Gx;function _M(){if(Gx)return sc;Gx=1,sc=e;function e(t){var r=typeof t=="string"?t.charCodeAt(0):t;return r>=97&&r<=102||r>=65&&r<=70||r>=48&&r<=57}return sc}var oc,Hx;function LM(){if(Hx)return oc;Hx=1,oc=e;function e(t){var r=typeof t=="string"?t.charCodeAt(0):t;return r>=97&&r<=122||r>=65&&r<=90}return oc}var lc,Wx;function OM(){if(Wx)return lc;Wx=1;var e=LM(),t=cN();lc=r;function r(n){return e(n)||t(n)}return lc}var cc,Vx;function DM(){if(Vx)return cc;Vx=1;var e,t=59;cc=r;function r(n){var i="&"+n+";",s;return e=e||document.createElement("i"),e.innerHTML=i,s=e.textContent,s.charCodeAt(s.length-1)===t&&n!=="semi"||s===i?!1:s}return cc}var dc,Kx;function MM(){if(Kx)return dc;Kx=1;var e=RM,t=jM,r=cN(),n=_M(),i=OM(),s=DM();dc=ue;var o={}.hasOwnProperty,l=String.fromCharCode,c=Function.prototype,d={warning:null,reference:null,text:null,warningContext:null,referenceContext:null,textContext:null,position:{},additional:null,attribute:!1,nonTerminated:!0},u=9,p=10,h=12,m=32,g=38,f=59,w=60,S=61,k=35,E=88,N=120,C=65533,v="named",I="hexadecimal",M="decimal",j={};j[I]=16,j[M]=10;var T={};T[v]=i,T[M]=r,T[I]=n;var P=1,q=2,D=3,z=4,U=5,G=6,re=7,K={};K[P]="Named character references must be terminated by a semicolon",K[q]="Numeric character references must be terminated by a semicolon",K[D]="Named character references cannot be empty",K[z]="Numeric character references cannot be empty",K[U]="Named character references must be known",K[G]="Numeric character references cannot be disallowed",K[re]="Numeric character references cannot be outside the permissible Unicode range";function ue(_,Z){var me={},ke,se;Z||(Z={});for(se in d)ke=Z[se],me[se]=ke??d[se];return(me.position.indent||me.position.start)&&(me.indent=me.position.indent||[],me.position=me.position.start),R(_,me)}function R(_,Z){var me=Z.additional,ke=Z.nonTerminated,se=Z.text,_e=Z.reference,oe=Z.warning,fe=Z.textContext,Ie=Z.referenceContext,qe=Z.warningContext,ze=Z.position,ct=Z.indent||[],Ye=_.length,wt=0,gt=-1,et=ze.column||1,Me=ze.line||1,mt="",Pt=[],xe,at,ce,Ee,H,Y,le,ve,Ve,It,ft,Rt,it,ie,je,Te,Pe,Ue,st;for(typeof me=="string"&&(me=me.charCodeAt(0)),Te=Qe(),ve=oe?J:c,wt--,Ye++;++wt<Ye;)if(H===p&&(et=ct[gt]||1),H=_.charCodeAt(wt),H===g){if(le=_.charCodeAt(wt+1),le===u||le===p||le===h||le===m||le===g||le===w||le!==le||me&&le===me){mt+=l(H),et++;continue}for(it=wt+1,Rt=it,st=it,le===k?(st=++Rt,le=_.charCodeAt(st),le===E||le===N?(ie=I,st=++Rt):ie=M):ie=v,xe="",ft="",Ee="",je=T[ie],st--;++st<Ye&&(le=_.charCodeAt(st),!!je(le));)Ee+=l(le),ie===v&&o.call(e,Ee)&&(xe=Ee,ft=e[Ee]);ce=_.charCodeAt(st)===f,ce&&(st++,at=ie===v?s(Ee):!1,at&&(xe=Ee,ft=at)),Ue=1+st-it,!ce&&!ke||(Ee?ie===v?(ce&&!ft?ve(U,1):(xe!==Ee&&(st=Rt+xe.length,Ue=1+st-Rt,ce=!1),ce||(Ve=xe?P:D,Z.attribute?(le=_.charCodeAt(st),le===S?(ve(Ve,Ue),ft=null):i(le)?ft=null:ve(Ve,Ue)):ve(Ve,Ue))),Y=ft):(ce||ve(q,Ue),Y=parseInt(Ee,j[ie]),F(Y)?(ve(re,Ue),Y=l(C)):Y in t?(ve(G,Ue),Y=t[Y]):(It="",te(Y)&&ve(G,Ue),Y>65535&&(Y-=65536,It+=l(Y>>>10|55296),Y=56320|Y&1023),Y=It+l(Y))):ie!==v&&ve(z,Ue)),Y?(Fe(),Te=Qe(),wt=st-1,et+=st-it+1,Pt.push(Y),Pe=Qe(),Pe.offset++,_e&&_e.call(Ie,Y,{start:Te,end:Pe},_.slice(it-1,st)),Te=Pe):(Ee=_.slice(it-1,st),mt+=Ee,et+=Ee.length,wt=st-1)}else H===10&&(Me++,gt++,et=0),H===H?(mt+=l(H),et++):Fe();return Pt.join("");function Qe(){return{line:Me,column:et,offset:wt+(ze.offset||0)}}function J(Ke,Ge){var dt=Qe();dt.column+=Ge,dt.offset+=Ge,oe.call(qe,K[Ke],dt,Ke)}function Fe(){mt&&(Pt.push(mt),se&&se.call(fe,mt,{start:Te,end:Qe()}),mt="")}}function F(_){return _>=55296&&_<=57343||_>1114111}function te(_){return _>=1&&_<=8||_===11||_>=13&&_<=31||_>=127&&_<=159||_>=64976&&_<=65007||(_&65535)===65535||(_&65535)===65534}return dc}var uc={exports:{}},Yx;function FM(){return Yx||(Yx=1,function(e){var t=typeof window<"u"?window:typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope?self:{};/**
|
|
714
714
|
* Prism: Lightweight, robust, elegant syntax highlighting
|
|
715
715
|
*
|
|
716
716
|
* @license MIT <https://opensource.org/licenses/MIT>
|
|
@@ -724,7 +724,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
724
724
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function YU(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function XU(e){if(Array.isArray(e))return gh(e)}function m2(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function h2(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?m2(Object(r),!0).forEach(function(n){vN(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):m2(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function vN(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function ts(e,t){return QU(e)||JU(e,t)||kN(e,t)||ZU()}function ZU(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
725
725
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function kN(e,t){if(e){if(typeof e=="string")return gh(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 gh(e,t)}}function gh(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 JU(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var n=[],i=!0,s=!1,o,l;try{for(r=r.call(e);!(i=(o=r.next()).done)&&(n.push(o.value),!(t&&n.length===t));i=!0);}catch(c){s=!0,l=c}finally{try{!i&&r.return!=null&&r.return()}finally{if(s)throw l}}return n}}function QU(e){if(Array.isArray(e))return e}var e$=typeof Em=="function"?Em:Em.default,t$="file-invalid-type",r$="file-too-large",n$="file-too-small",a$="too-many-files",i$=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:t$,message:"File type must be ".concat(n)}},g2=function(t){return{code:r$,message:"File is larger than ".concat(t," ").concat(t===1?"byte":"bytes")}},f2=function(t){return{code:n$,message:"File is smaller than ".concat(t," ").concat(t===1?"byte":"bytes")}},s$={code:a$,message:"Too many files"};function wN(e,t){var r=e.type==="application/x-moz-file"||e$(e,t);return[r,r?null:i$(t)]}function SN(e,t,r){if(Na(e.size))if(Na(t)&&Na(r)){if(e.size>r)return[!1,g2(r)];if(e.size<t)return[!1,f2(t)]}else{if(Na(t)&&e.size<t)return[!1,f2(t)];if(Na(r)&&e.size>r)return[!1,g2(r)]}return[!0,null]}function Na(e){return e!=null}function o$(e){var t=e.files,r=e.accept,n=e.minSize,i=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=wN(c,r),u=ts(d,1),p=u[0],h=SN(c,n,i),m=ts(h,1),g=m[0],f=l?l(c):null;return p&&g&&!f})}function fo(e){return typeof e.isPropagationStopped=="function"?e.isPropagationStopped():typeof e.cancelBubble<"u"?e.cancelBubble:!1}function $s(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 b2(e){e.preventDefault()}function l$(e){return e.indexOf("MSIE")!==-1||e.indexOf("Trident/")!==-1}function c$(e){return e.indexOf("Edge/")!==-1}function d$(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:window.navigator.userAgent;return l$(e)||c$(e)}function bn(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return function(n){for(var i=arguments.length,s=new Array(i>1?i-1:0),o=1;o<i;o++)s[o-1]=arguments[o];return t.some(function(l){return!fo(n)&&l&&l.apply(void 0,[n].concat(s)),fo(n)})}}function u$(){return"showOpenFilePicker"in window}function p$(e){if(Na(e)){var t=Object.entries(e).filter(function(r){var n=ts(r,2),i=n[0],s=n[1],o=!0;return EN(i)||(console.warn('Skipped "'.concat(i,'" 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(NN))&&(console.warn('Skipped "'.concat(i,'" because an invalid file extension was provided.')),o=!1),o}).reduce(function(r,n){var i=ts(n,2),s=i[0],o=i[1];return h2(h2({},r),{},vN({},s,o))},{});return[{description:"Files",accept:t}]}return e}function m$(e){if(Na(e))return Object.entries(e).reduce(function(t,r){var n=ts(r,2),i=n[0],s=n[1];return[].concat(p2(t),[i],p2(s))},[]).filter(function(t){return EN(t)||NN(t)}).join(",")}function h$(e){return e instanceof DOMException&&(e.name==="AbortError"||e.code===e.ABORT_ERR)}function g$(e){return e instanceof DOMException&&(e.name==="SecurityError"||e.code===e.SECURITY_ERR)}function EN(e){return e==="audio/*"||e==="video/*"||e==="image/*"||e==="text/*"||e==="application/*"||/\w+\/[-+.\w]+/g.test(e)}function NN(e){return/^.*\.[\w]+$/.test(e)}var f$=["children"],b$=["open"],x$=["refKey","role","onKeyDown","onFocus","onBlur","onClick","onDragEnter","onDragOver","onDragLeave","onDrop"],y$=["refKey","onChange","onClick"];function v$(e){return S$(e)||w$(e)||CN(e)||k$()}function k$(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
|
|
726
726
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function w$(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function S$(e){if(Array.isArray(e))return fh(e)}function Nm(e,t){return C$(e)||N$(e,t)||CN(e,t)||E$()}function E$(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
727
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function CN(e,t){if(e){if(typeof e=="string")return fh(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 fh(e,t)}}function fh(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 N$(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var n=[],i=!0,s=!1,o,l;try{for(r=r.call(e);!(i=(o=r.next()).done)&&(n.push(o.value),!(t&&n.length===t));i=!0);}catch(c){s=!0,l=c}finally{try{!i&&r.return!=null&&r.return()}finally{if(s)throw l}}return n}}function C$(e){if(Array.isArray(e))return e}function x2(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).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?x2(Object(r),!0).forEach(function(n){bh(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):x2(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function bh(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function bo(e,t){if(e==null)return{};var r=T$(e,t),n,i;if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(i=0;i<s.length;i++)n=s[i],!(t.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function T$(e,t){if(e==null)return{};var r={},n=Object.keys(e),i,s;for(s=0;s<n.length;s++)i=n[s],!(t.indexOf(i)>=0)&&(r[i]=e[i]);return r}var Pg=x.forwardRef(function(e,t){var r=e.children,n=bo(e,f$),i=AN(n),s=i.open,o=bo(i,b$);return x.useImperativeHandle(t,function(){return{open:s}},[s]),ir.createElement(x.Fragment,null,r(Qt(Qt({},o),{},{open:s})))});Pg.displayName="Dropzone";var TN={disabled:!1,getFilesFromEvent:FU,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};Pg.defaultProps=TN;Pg.propTypes={children:$t.func,accept:$t.objectOf($t.arrayOf($t.string)),multiple:$t.bool,preventDropOnDocument:$t.bool,noClick:$t.bool,noKeyboard:$t.bool,noDrag:$t.bool,noDragEventsBubbling:$t.bool,minSize:$t.number,maxSize:$t.number,maxFiles:$t.number,disabled:$t.bool,getFilesFromEvent:$t.func,onFileDialogCancel:$t.func,onFileDialogOpen:$t.func,useFsAccessApi:$t.bool,autoFocus:$t.bool,onDragEnter:$t.func,onDragLeave:$t.func,onDragOver:$t.func,onDrop:$t.func,onDropAccepted:$t.func,onDropRejected:$t.func,onError:$t.func,validator:$t.func};var xh={isFocused:!1,isFileDialogActive:!1,isDragActive:!1,isDragAccept:!1,isDragReject:!1,acceptedFiles:[],fileRejections:[]};function AN(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=Qt(Qt({},TN),e),r=t.accept,n=t.disabled,i=t.getFilesFromEvent,s=t.maxSize,o=t.minSize,l=t.multiple,c=t.maxFiles,d=t.onDragEnter,u=t.onDragLeave,p=t.onDragOver,h=t.onDrop,m=t.onDropAccepted,g=t.onDropRejected,f=t.onFileDialogCancel,w=t.onFileDialogOpen,S=t.useFsAccessApi,k=t.autoFocus,E=t.preventDropOnDocument,N=t.noClick,C=t.noKeyboard,v=t.noDrag,I=t.noDragEventsBubbling,M=t.onError,j=t.validator,T=x.useMemo(function(){return m$(r)},[r]),P=x.useMemo(function(){return p$(r)},[r]),q=x.useMemo(function(){return typeof w=="function"?w:y2},[w]),D=x.useMemo(function(){return typeof f=="function"?f:y2},[f]),z=x.useRef(null),U=x.useRef(null),G=x.useReducer(A$,xh),re=Nm(G,2),K=re[0],ue=re[1],R=K.isFocused,F=K.isFileDialogActive,te=x.useRef(typeof window<"u"&&window.isSecureContext&&S&&u$()),_=function(){!te.current&&F&&setTimeout(function(){if(U.current){var Ee=U.current.files;Ee.length||(ue({type:"closeDialog"}),D())}},300)};x.useEffect(function(){return window.addEventListener("focus",_,!1),function(){window.removeEventListener("focus",_,!1)}},[U,F,D,te]);var Z=x.useRef([]),me=function(Ee){z.current&&z.current.contains(Ee.target)||(Ee.preventDefault(),Z.current=[])};x.useEffect(function(){return E&&(document.addEventListener("dragover",b2,!1),document.addEventListener("drop",me,!1)),function(){E&&(document.removeEventListener("dragover",b2),document.removeEventListener("drop",me))}},[z,E]),x.useEffect(function(){return!n&&k&&z.current&&z.current.focus(),function(){}},[z,k,n]);var ke=x.useCallback(function(de){M?M(de):console.error(de)},[M]),se=x.useCallback(function(de){de.preventDefault(),de.persist(),mt(de),Z.current=[].concat(v$(Z.current),[de.target]),$s(de)&&Promise.resolve(i(de)).then(function(Ee){if(!(fo(de)&&!I)){var H=Ee.length,Y=H>0&&o$({files:Ee,accept:T,minSize:o,maxSize:s,multiple:l,maxFiles:c,validator:j}),le=H>0&&!Y;ue({isDragAccept:Y,isDragReject:le,isDragActive:!0,type:"setDraggedFiles"}),d&&d(de)}}).catch(function(Ee){return ke(Ee)})},[i,d,ke,I,T,o,s,l,c,j]),_e=x.useCallback(function(de){de.preventDefault(),de.persist(),mt(de);var Ee=$s(de);if(Ee&&de.dataTransfer)try{de.dataTransfer.dropEffect="copy"}catch{}return Ee&&p&&p(de),!1},[p,I]),oe=x.useCallback(function(de){de.preventDefault(),de.persist(),mt(de);var Ee=Z.current.filter(function(Y){return z.current&&z.current.contains(Y)}),H=Ee.indexOf(de.target);H!==-1&&Ee.splice(H,1),Z.current=Ee,!(Ee.length>0)&&(ue({type:"setDraggedFiles",isDragActive:!1,isDragAccept:!1,isDragReject:!1}),$s(de)&&u&&u(de))},[z,u,I]),fe=x.useCallback(function(de,Ee){var H=[],Y=[];de.forEach(function(le){var ve=wN(le,T),Ve=Nm(ve,2),It=Ve[0],ft=Ve[1],Rt=SN(le,o,s),it=Nm(Rt,2),ie=it[0],je=it[1],Te=j?j(le):null;if(It&&ie&&!Te)H.push(le);else{var Pe=[ft,je];Te&&(Pe=Pe.concat(Te)),Y.push({file:le,errors:Pe.filter(function(Ue){return Ue})})}}),(!l&&H.length>1||l&&c>=1&&H.length>c)&&(H.forEach(function(le){Y.push({file:le,errors:[s$]})}),H.splice(0)),ue({acceptedFiles:H,fileRejections:Y,isDragReject:Y.length>0,type:"setFiles"}),h&&h(H,Y,Ee),Y.length>0&&g&&g(Y,Ee),H.length>0&&m&&m(H,Ee)},[ue,l,T,o,s,c,h,m,g,j]),Ie=x.useCallback(function(de){de.preventDefault(),de.persist(),mt(de),Z.current=[],$s(de)&&Promise.resolve(i(de)).then(function(Ee){fo(de)&&!I||fe(Ee,de)}).catch(function(Ee){return ke(Ee)}),ue({type:"reset"})},[i,fe,ke,I]),qe=x.useCallback(function(){if(te.current){ue({type:"openDialog"}),q();var de={multiple:l,types:P};window.showOpenFilePicker(de).then(function(Ee){return i(Ee)}).then(function(Ee){fe(Ee,null),ue({type:"closeDialog"})}).catch(function(Ee){h$(Ee)?(D(Ee),ue({type:"closeDialog"})):g$(Ee)?(te.current=!1,U.current?(U.current.value=null,U.current.click()):ke(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."))):ke(Ee)});return}U.current&&(ue({type:"openDialog"}),q(),U.current.value=null,U.current.click())},[ue,q,D,S,fe,ke,P,l]),ze=x.useCallback(function(de){!z.current||!z.current.isEqualNode(de.target)||(de.key===" "||de.key==="Enter"||de.keyCode===32||de.keyCode===13)&&(de.preventDefault(),qe())},[z,qe]),ct=x.useCallback(function(){ue({type:"focus"})},[]),Ye=x.useCallback(function(){ue({type:"blur"})},[]),wt=x.useCallback(function(){N||(d$()?setTimeout(qe,0):qe())},[N,qe]),gt=function(Ee){return n?null:Ee},et=function(Ee){return C?null:gt(Ee)},Me=function(Ee){return v?null:gt(Ee)},mt=function(Ee){I&&Ee.stopPropagation()},Pt=x.useMemo(function(){return function(){var de=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},Ee=de.refKey,H=Ee===void 0?"ref":Ee,Y=de.role,le=de.onKeyDown,ve=de.onFocus,Ve=de.onBlur,It=de.onClick,ft=de.onDragEnter,Rt=de.onDragOver,it=de.onDragLeave,ie=de.onDrop,je=bo(de,x$);return Qt(Qt(bh({onKeyDown:et(bn(le,ze)),onFocus:et(bn(ve,ct)),onBlur:et(bn(Ve,Ye)),onClick:gt(bn(It,wt)),onDragEnter:Me(bn(ft,se)),onDragOver:Me(bn(Rt,_e)),onDragLeave:Me(bn(it,oe)),onDrop:Me(bn(ie,Ie)),role:typeof Y=="string"&&Y!==""?Y:"presentation"},H,z),!n&&!C?{tabIndex:0}:{}),je)}},[z,ze,ct,Ye,wt,se,_e,oe,Ie,C,v,n]),xe=x.useCallback(function(de){de.stopPropagation()},[]),at=x.useMemo(function(){return function(){var de=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},Ee=de.refKey,H=Ee===void 0?"ref":Ee,Y=de.onChange,le=de.onClick,ve=bo(de,y$),Ve=bh({accept:T,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:gt(bn(Y,Ie)),onClick:gt(bn(le,xe)),tabIndex:-1},H,U);return Qt(Qt({},Ve),ve)}},[U,r,l,Ie,n]);return Qt(Qt({},K),{},{isFocused:R&&!n,getRootProps:Pt,getInputProps:at,rootRef:z,inputRef:U,open:gt(qe)})}function A$(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({},xh),{},{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({},xh);default:return e}}function y2(){}const Cm=({todos:e,isResult:t=!1})=>{if(!e||!Array.isArray(e))return null;const r=s=>{switch(s){case"completed":return a.jsx(D5,{className:"w-4 h-4 text-green-500 dark:text-green-400"});case"in_progress":return a.jsx(Hi,{className:"w-4 h-4 text-blue-500 dark:text-blue-400"});case"pending":default:return a.jsx(ti,{className:"w-4 h-4 text-gray-400 dark:text-gray-500"})}},n=s=>{switch(s){case"completed":return"bg-green-100 dark:bg-green-900/30 text-green-800 dark:text-green-200 border-green-200 dark:border-green-800";case"in_progress":return"bg-blue-100 dark:bg-blue-900/30 text-blue-800 dark:text-blue-200 border-blue-200 dark:border-blue-800";case"pending":default:return"bg-gray-100 dark:bg-gray-800 text-gray-600 dark:text-gray-400 border-gray-200 dark:border-gray-700"}},i=s=>{switch(s){case"high":return"bg-red-100 dark:bg-red-900/30 text-red-700 dark:text-red-300 border-red-200 dark:border-red-800";case"medium":return"bg-yellow-100 dark:bg-yellow-900/30 text-yellow-700 dark:text-yellow-300 border-yellow-200 dark:border-yellow-800";case"low":default:return"bg-gray-100 dark:bg-gray-800 text-gray-600 dark:text-gray-400 border-gray-200 dark:border-gray-700"}};return a.jsxs("div",{className:"space-y-3",children:[t&&a.jsxs("div",{className:"text-sm font-medium text-gray-700 dark:text-gray-300 mb-3",children:["Todo List (",e.length," ",e.length===1?"item":"items",")"]}),e.map((s,o)=>a.jsxs("div",{className:"flex items-start gap-3 p-3 bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg shadow-sm hover:shadow-md dark:shadow-gray-900/50 transition-shadow",children:[a.jsx("div",{className:"flex-shrink-0 mt-0.5",children:r(s.status)}),a.jsx("div",{className:"flex-1 min-w-0",children:a.jsxs("div",{className:"flex items-start justify-between gap-2 mb-2",children:[a.jsx("p",{className:`text-sm font-medium ${s.status==="completed"?"line-through text-gray-500 dark:text-gray-400":"text-gray-900 dark:text-gray-100"}`,children:s.content}),a.jsxs("div",{className:"flex gap-1 flex-shrink-0",children:[a.jsx(mn,{variant:"outline",className:`text-xs px-2 py-0.5 ${i(s.priority)}`,children:s.priority}),a.jsx(mn,{variant:"outline",className:`text-xs px-2 py-0.5 ${n(s.status)}`,children:s.status.replace("_"," ")})]})]})})]},s.id||`todo-${o}`))]})};var I$=s5(),R$=o5(),j$=l5(),Tm={exports:{}},v2;function _$(){return v2||(v2=1,function(e,t){(function(r,n){e.exports=n()})(self,()=>(()=>{var r={6:(o,l)=>{function c(u){try{const p=new URL(u),h=p.password&&p.username?`${p.protocol}//${p.username}:${p.password}@${p.host}`:p.username?`${p.protocol}//${p.username}@${p.host}`:`${p.protocol}//${p.host}`;return u.toLocaleLowerCase().startsWith(h.toLocaleLowerCase())}catch{return!1}}Object.defineProperty(l,"__esModule",{value:!0}),l.LinkComputer=l.WebLinkProvider=void 0,l.WebLinkProvider=class{constructor(u,p,h,m={}){this._terminal=u,this._regex=p,this._handler=h,this._options=m}provideLinks(u,p){const h=d.computeLink(u,this._regex,this._terminal,this._handler);p(this._addCallbacks(h))}_addCallbacks(u){return u.map(p=>(p.leave=this._options.leave,p.hover=(h,m)=>{if(this._options.hover){const{range:g}=p;this._options.hover(h,m,g)}},p))}};class d{static computeLink(p,h,m,g){const f=new RegExp(h.source,(h.flags||"")+"g"),[w,S]=d._getWindowedLineStrings(p-1,m),k=w.join("");let E;const N=[];for(;E=f.exec(k);){const C=E[0];if(!c(C))continue;const[v,I]=d._mapStrIdx(m,S,0,E.index),[M,j]=d._mapStrIdx(m,v,I,C.length);if(v===-1||I===-1||M===-1||j===-1)continue;const T={start:{x:I+1,y:v+1},end:{x:j,y:M+1}};N.push({range:T,text:C,activate:g})}return N}static _getWindowedLineStrings(p,h){let m,g=p,f=p,w=0,S="";const k=[];if(m=h.buffer.active.getLine(p)){const E=m.translateToString(!0);if(m.isWrapped&&E[0]!==" "){for(w=0;(m=h.buffer.active.getLine(--g))&&w<2048&&(S=m.translateToString(!0),w+=S.length,k.push(S),m.isWrapped&&S.indexOf(" ")===-1););k.reverse()}for(k.push(E),w=0;(m=h.buffer.active.getLine(++f))&&m.isWrapped&&w<2048&&(S=m.translateToString(!0),w+=S.length,k.push(S),S.indexOf(" ")===-1););}return[k,g]}static _mapStrIdx(p,h,m,g){const f=p.buffer.active,w=f.getNullCell();let S=m;for(;g;){const k=f.getLine(h);if(!k)return[-1,-1];for(let E=S;E<k.length;++E){k.getCell(E,w);const N=w.getChars();if(w.getWidth()&&(g-=N.length||1,E===k.length-1&&N==="")){const C=f.getLine(h+1);C&&C.isWrapped&&(C.getCell(0,w),w.getWidth()===2&&(g+=1))}if(g<0)return[h,E]}h++,S=0}return[h,S]}}l.LinkComputer=d}},n={};function i(o){var l=n[o];if(l!==void 0)return l.exports;var c=n[o]={exports:{}};return r[o](c,c.exports,i),c.exports}var s={};return(()=>{var o=s;Object.defineProperty(o,"__esModule",{value:!0}),o.WebLinksAddon=void 0;const l=i(6),c=/(https?|HTTPS?):[/]{2}[^\s"'!*(){}|\\\^<>`]*[^\s"':,.!?{}|\\\^~\[\]`()<>]/;function d(u,p){const h=window.open();if(h){try{h.opener=null}catch{}h.location.href=p}else console.warn("Opening link blocked as opener could not be cleared")}o.WebLinksAddon=class{constructor(u=d,p={}){this._handler=u,this._options=p}activate(u){this._terminal=u;const p=this._options,h=p.urlRegex||c;this._linkProvider=this._terminal.registerLinkProvider(new l.WebLinkProvider(this._terminal,h,this._handler,p))}dispose(){this._linkProvider?.dispose()}}})(),s})())}(Tm)),Tm.exports}var L$=_$();const O$=`
|
|
727
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function CN(e,t){if(e){if(typeof e=="string")return fh(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 fh(e,t)}}function fh(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 N$(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var n=[],i=!0,s=!1,o,l;try{for(r=r.call(e);!(i=(o=r.next()).done)&&(n.push(o.value),!(t&&n.length===t));i=!0);}catch(c){s=!0,l=c}finally{try{!i&&r.return!=null&&r.return()}finally{if(s)throw l}}return n}}function C$(e){if(Array.isArray(e))return e}function x2(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).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?x2(Object(r),!0).forEach(function(n){bh(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):x2(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function bh(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function bo(e,t){if(e==null)return{};var r=T$(e,t),n,i;if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(i=0;i<s.length;i++)n=s[i],!(t.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function T$(e,t){if(e==null)return{};var r={},n=Object.keys(e),i,s;for(s=0;s<n.length;s++)i=n[s],!(t.indexOf(i)>=0)&&(r[i]=e[i]);return r}var Pg=x.forwardRef(function(e,t){var r=e.children,n=bo(e,f$),i=AN(n),s=i.open,o=bo(i,b$);return x.useImperativeHandle(t,function(){return{open:s}},[s]),ir.createElement(x.Fragment,null,r(Qt(Qt({},o),{},{open:s})))});Pg.displayName="Dropzone";var TN={disabled:!1,getFilesFromEvent:FU,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};Pg.defaultProps=TN;Pg.propTypes={children:$t.func,accept:$t.objectOf($t.arrayOf($t.string)),multiple:$t.bool,preventDropOnDocument:$t.bool,noClick:$t.bool,noKeyboard:$t.bool,noDrag:$t.bool,noDragEventsBubbling:$t.bool,minSize:$t.number,maxSize:$t.number,maxFiles:$t.number,disabled:$t.bool,getFilesFromEvent:$t.func,onFileDialogCancel:$t.func,onFileDialogOpen:$t.func,useFsAccessApi:$t.bool,autoFocus:$t.bool,onDragEnter:$t.func,onDragLeave:$t.func,onDragOver:$t.func,onDrop:$t.func,onDropAccepted:$t.func,onDropRejected:$t.func,onError:$t.func,validator:$t.func};var xh={isFocused:!1,isFileDialogActive:!1,isDragActive:!1,isDragAccept:!1,isDragReject:!1,acceptedFiles:[],fileRejections:[]};function AN(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=Qt(Qt({},TN),e),r=t.accept,n=t.disabled,i=t.getFilesFromEvent,s=t.maxSize,o=t.minSize,l=t.multiple,c=t.maxFiles,d=t.onDragEnter,u=t.onDragLeave,p=t.onDragOver,h=t.onDrop,m=t.onDropAccepted,g=t.onDropRejected,f=t.onFileDialogCancel,w=t.onFileDialogOpen,S=t.useFsAccessApi,k=t.autoFocus,E=t.preventDropOnDocument,N=t.noClick,C=t.noKeyboard,v=t.noDrag,I=t.noDragEventsBubbling,M=t.onError,j=t.validator,T=x.useMemo(function(){return m$(r)},[r]),P=x.useMemo(function(){return p$(r)},[r]),q=x.useMemo(function(){return typeof w=="function"?w:y2},[w]),D=x.useMemo(function(){return typeof f=="function"?f:y2},[f]),z=x.useRef(null),U=x.useRef(null),G=x.useReducer(A$,xh),re=Nm(G,2),K=re[0],ue=re[1],R=K.isFocused,F=K.isFileDialogActive,te=x.useRef(typeof window<"u"&&window.isSecureContext&&S&&u$()),_=function(){!te.current&&F&&setTimeout(function(){if(U.current){var Ee=U.current.files;Ee.length||(ue({type:"closeDialog"}),D())}},300)};x.useEffect(function(){return window.addEventListener("focus",_,!1),function(){window.removeEventListener("focus",_,!1)}},[U,F,D,te]);var Z=x.useRef([]),me=function(Ee){z.current&&z.current.contains(Ee.target)||(Ee.preventDefault(),Z.current=[])};x.useEffect(function(){return E&&(document.addEventListener("dragover",b2,!1),document.addEventListener("drop",me,!1)),function(){E&&(document.removeEventListener("dragover",b2),document.removeEventListener("drop",me))}},[z,E]),x.useEffect(function(){return!n&&k&&z.current&&z.current.focus(),function(){}},[z,k,n]);var ke=x.useCallback(function(ce){M?M(ce):console.error(ce)},[M]),se=x.useCallback(function(ce){ce.preventDefault(),ce.persist(),mt(ce),Z.current=[].concat(v$(Z.current),[ce.target]),$s(ce)&&Promise.resolve(i(ce)).then(function(Ee){if(!(fo(ce)&&!I)){var H=Ee.length,Y=H>0&&o$({files:Ee,accept:T,minSize:o,maxSize:s,multiple:l,maxFiles:c,validator:j}),le=H>0&&!Y;ue({isDragAccept:Y,isDragReject:le,isDragActive:!0,type:"setDraggedFiles"}),d&&d(ce)}}).catch(function(Ee){return ke(Ee)})},[i,d,ke,I,T,o,s,l,c,j]),_e=x.useCallback(function(ce){ce.preventDefault(),ce.persist(),mt(ce);var Ee=$s(ce);if(Ee&&ce.dataTransfer)try{ce.dataTransfer.dropEffect="copy"}catch{}return Ee&&p&&p(ce),!1},[p,I]),oe=x.useCallback(function(ce){ce.preventDefault(),ce.persist(),mt(ce);var Ee=Z.current.filter(function(Y){return z.current&&z.current.contains(Y)}),H=Ee.indexOf(ce.target);H!==-1&&Ee.splice(H,1),Z.current=Ee,!(Ee.length>0)&&(ue({type:"setDraggedFiles",isDragActive:!1,isDragAccept:!1,isDragReject:!1}),$s(ce)&&u&&u(ce))},[z,u,I]),fe=x.useCallback(function(ce,Ee){var H=[],Y=[];ce.forEach(function(le){var ve=wN(le,T),Ve=Nm(ve,2),It=Ve[0],ft=Ve[1],Rt=SN(le,o,s),it=Nm(Rt,2),ie=it[0],je=it[1],Te=j?j(le):null;if(It&&ie&&!Te)H.push(le);else{var Pe=[ft,je];Te&&(Pe=Pe.concat(Te)),Y.push({file:le,errors:Pe.filter(function(Ue){return Ue})})}}),(!l&&H.length>1||l&&c>=1&&H.length>c)&&(H.forEach(function(le){Y.push({file:le,errors:[s$]})}),H.splice(0)),ue({acceptedFiles:H,fileRejections:Y,isDragReject:Y.length>0,type:"setFiles"}),h&&h(H,Y,Ee),Y.length>0&&g&&g(Y,Ee),H.length>0&&m&&m(H,Ee)},[ue,l,T,o,s,c,h,m,g,j]),Ie=x.useCallback(function(ce){ce.preventDefault(),ce.persist(),mt(ce),Z.current=[],$s(ce)&&Promise.resolve(i(ce)).then(function(Ee){fo(ce)&&!I||fe(Ee,ce)}).catch(function(Ee){return ke(Ee)}),ue({type:"reset"})},[i,fe,ke,I]),qe=x.useCallback(function(){if(te.current){ue({type:"openDialog"}),q();var ce={multiple:l,types:P};window.showOpenFilePicker(ce).then(function(Ee){return i(Ee)}).then(function(Ee){fe(Ee,null),ue({type:"closeDialog"})}).catch(function(Ee){h$(Ee)?(D(Ee),ue({type:"closeDialog"})):g$(Ee)?(te.current=!1,U.current?(U.current.value=null,U.current.click()):ke(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."))):ke(Ee)});return}U.current&&(ue({type:"openDialog"}),q(),U.current.value=null,U.current.click())},[ue,q,D,S,fe,ke,P,l]),ze=x.useCallback(function(ce){!z.current||!z.current.isEqualNode(ce.target)||(ce.key===" "||ce.key==="Enter"||ce.keyCode===32||ce.keyCode===13)&&(ce.preventDefault(),qe())},[z,qe]),ct=x.useCallback(function(){ue({type:"focus"})},[]),Ye=x.useCallback(function(){ue({type:"blur"})},[]),wt=x.useCallback(function(){N||(d$()?setTimeout(qe,0):qe())},[N,qe]),gt=function(Ee){return n?null:Ee},et=function(Ee){return C?null:gt(Ee)},Me=function(Ee){return v?null:gt(Ee)},mt=function(Ee){I&&Ee.stopPropagation()},Pt=x.useMemo(function(){return function(){var ce=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},Ee=ce.refKey,H=Ee===void 0?"ref":Ee,Y=ce.role,le=ce.onKeyDown,ve=ce.onFocus,Ve=ce.onBlur,It=ce.onClick,ft=ce.onDragEnter,Rt=ce.onDragOver,it=ce.onDragLeave,ie=ce.onDrop,je=bo(ce,x$);return Qt(Qt(bh({onKeyDown:et(bn(le,ze)),onFocus:et(bn(ve,ct)),onBlur:et(bn(Ve,Ye)),onClick:gt(bn(It,wt)),onDragEnter:Me(bn(ft,se)),onDragOver:Me(bn(Rt,_e)),onDragLeave:Me(bn(it,oe)),onDrop:Me(bn(ie,Ie)),role:typeof Y=="string"&&Y!==""?Y:"presentation"},H,z),!n&&!C?{tabIndex:0}:{}),je)}},[z,ze,ct,Ye,wt,se,_e,oe,Ie,C,v,n]),xe=x.useCallback(function(ce){ce.stopPropagation()},[]),at=x.useMemo(function(){return function(){var ce=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},Ee=ce.refKey,H=Ee===void 0?"ref":Ee,Y=ce.onChange,le=ce.onClick,ve=bo(ce,y$),Ve=bh({accept:T,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:gt(bn(Y,Ie)),onClick:gt(bn(le,xe)),tabIndex:-1},H,U);return Qt(Qt({},Ve),ve)}},[U,r,l,Ie,n]);return Qt(Qt({},K),{},{isFocused:R&&!n,getRootProps:Pt,getInputProps:at,rootRef:z,inputRef:U,open:gt(qe)})}function A$(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({},xh),{},{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({},xh);default:return e}}function y2(){}const Cm=({todos:e,isResult:t=!1})=>{if(!e||!Array.isArray(e))return null;const r=s=>{switch(s){case"completed":return a.jsx(D5,{className:"w-4 h-4 text-green-500 dark:text-green-400"});case"in_progress":return a.jsx(Hi,{className:"w-4 h-4 text-blue-500 dark:text-blue-400"});case"pending":default:return a.jsx(ti,{className:"w-4 h-4 text-gray-400 dark:text-gray-500"})}},n=s=>{switch(s){case"completed":return"bg-green-100 dark:bg-green-900/30 text-green-800 dark:text-green-200 border-green-200 dark:border-green-800";case"in_progress":return"bg-blue-100 dark:bg-blue-900/30 text-blue-800 dark:text-blue-200 border-blue-200 dark:border-blue-800";case"pending":default:return"bg-gray-100 dark:bg-gray-800 text-gray-600 dark:text-gray-400 border-gray-200 dark:border-gray-700"}},i=s=>{switch(s){case"high":return"bg-red-100 dark:bg-red-900/30 text-red-700 dark:text-red-300 border-red-200 dark:border-red-800";case"medium":return"bg-yellow-100 dark:bg-yellow-900/30 text-yellow-700 dark:text-yellow-300 border-yellow-200 dark:border-yellow-800";case"low":default:return"bg-gray-100 dark:bg-gray-800 text-gray-600 dark:text-gray-400 border-gray-200 dark:border-gray-700"}};return a.jsxs("div",{className:"space-y-3",children:[t&&a.jsxs("div",{className:"text-sm font-medium text-gray-700 dark:text-gray-300 mb-3",children:["Todo List (",e.length," ",e.length===1?"item":"items",")"]}),e.map((s,o)=>a.jsxs("div",{className:"flex items-start gap-3 p-3 bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg shadow-sm hover:shadow-md dark:shadow-gray-900/50 transition-shadow",children:[a.jsx("div",{className:"flex-shrink-0 mt-0.5",children:r(s.status)}),a.jsx("div",{className:"flex-1 min-w-0",children:a.jsxs("div",{className:"flex items-start justify-between gap-2 mb-2",children:[a.jsx("p",{className:`text-sm font-medium ${s.status==="completed"?"line-through text-gray-500 dark:text-gray-400":"text-gray-900 dark:text-gray-100"}`,children:s.content}),a.jsxs("div",{className:"flex gap-1 flex-shrink-0",children:[a.jsx(mn,{variant:"outline",className:`text-xs px-2 py-0.5 ${i(s.priority)}`,children:s.priority}),a.jsx(mn,{variant:"outline",className:`text-xs px-2 py-0.5 ${n(s.status)}`,children:s.status.replace("_"," ")})]})]})})]},s.id||`todo-${o}`))]})};var I$=s5(),R$=o5(),j$=l5(),Tm={exports:{}},v2;function _$(){return v2||(v2=1,function(e,t){(function(r,n){e.exports=n()})(self,()=>(()=>{var r={6:(o,l)=>{function c(u){try{const p=new URL(u),h=p.password&&p.username?`${p.protocol}//${p.username}:${p.password}@${p.host}`:p.username?`${p.protocol}//${p.username}@${p.host}`:`${p.protocol}//${p.host}`;return u.toLocaleLowerCase().startsWith(h.toLocaleLowerCase())}catch{return!1}}Object.defineProperty(l,"__esModule",{value:!0}),l.LinkComputer=l.WebLinkProvider=void 0,l.WebLinkProvider=class{constructor(u,p,h,m={}){this._terminal=u,this._regex=p,this._handler=h,this._options=m}provideLinks(u,p){const h=d.computeLink(u,this._regex,this._terminal,this._handler);p(this._addCallbacks(h))}_addCallbacks(u){return u.map(p=>(p.leave=this._options.leave,p.hover=(h,m)=>{if(this._options.hover){const{range:g}=p;this._options.hover(h,m,g)}},p))}};class d{static computeLink(p,h,m,g){const f=new RegExp(h.source,(h.flags||"")+"g"),[w,S]=d._getWindowedLineStrings(p-1,m),k=w.join("");let E;const N=[];for(;E=f.exec(k);){const C=E[0];if(!c(C))continue;const[v,I]=d._mapStrIdx(m,S,0,E.index),[M,j]=d._mapStrIdx(m,v,I,C.length);if(v===-1||I===-1||M===-1||j===-1)continue;const T={start:{x:I+1,y:v+1},end:{x:j,y:M+1}};N.push({range:T,text:C,activate:g})}return N}static _getWindowedLineStrings(p,h){let m,g=p,f=p,w=0,S="";const k=[];if(m=h.buffer.active.getLine(p)){const E=m.translateToString(!0);if(m.isWrapped&&E[0]!==" "){for(w=0;(m=h.buffer.active.getLine(--g))&&w<2048&&(S=m.translateToString(!0),w+=S.length,k.push(S),m.isWrapped&&S.indexOf(" ")===-1););k.reverse()}for(k.push(E),w=0;(m=h.buffer.active.getLine(++f))&&m.isWrapped&&w<2048&&(S=m.translateToString(!0),w+=S.length,k.push(S),S.indexOf(" ")===-1););}return[k,g]}static _mapStrIdx(p,h,m,g){const f=p.buffer.active,w=f.getNullCell();let S=m;for(;g;){const k=f.getLine(h);if(!k)return[-1,-1];for(let E=S;E<k.length;++E){k.getCell(E,w);const N=w.getChars();if(w.getWidth()&&(g-=N.length||1,E===k.length-1&&N==="")){const C=f.getLine(h+1);C&&C.isWrapped&&(C.getCell(0,w),w.getWidth()===2&&(g+=1))}if(g<0)return[h,E]}h++,S=0}return[h,S]}}l.LinkComputer=d}},n={};function i(o){var l=n[o];if(l!==void 0)return l.exports;var c=n[o]={exports:{}};return r[o](c,c.exports,i),c.exports}var s={};return(()=>{var o=s;Object.defineProperty(o,"__esModule",{value:!0}),o.WebLinksAddon=void 0;const l=i(6),c=/(https?|HTTPS?):[/]{2}[^\s"'!*(){}|\\\^<>`]*[^\s"':,.!?{}|\\\^~\[\]`()<>]/;function d(u,p){const h=window.open();if(h){try{h.opener=null}catch{}h.location.href=p}else console.warn("Opening link blocked as opener could not be cleared")}o.WebLinksAddon=class{constructor(u=d,p={}){this._handler=u,this._options=p}activate(u){this._terminal=u;const p=this._options,h=p.urlRegex||c;this._linkProvider=this._terminal.registerLinkProvider(new l.WebLinkProvider(this._terminal,h,this._handler,p))}dispose(){this._linkProvider?.dispose()}}})(),s})())}(Tm)),Tm.exports}var L$=_$();const O$=`
|
|
728
728
|
.xterm .xterm-screen {
|
|
729
729
|
outline: none !important;
|
|
730
730
|
}
|
|
@@ -787,7 +787,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
787
787
|
`);return a.jsxs("div",{children:[a.jsx("div",{className:"flex items-center gap-2 mb-3",children:a.jsx("span",{className:"font-medium",children:"Implementation Plan"})}),a.jsx(Ka,{className:"prose prose-sm max-w-none dark:prose-invert",children:T})]})}}catch{}if((e.toolName==="Grep"||e.toolName==="Glob")&&e.toolResult?.toolUseResult){const j=e.toolResult.toolUseResult;if(j.filenames&&Array.isArray(j.filenames)&&j.filenames.length>0)return a.jsxs("div",{children:[a.jsx("div",{className:"flex items-center gap-2 mb-3",children:a.jsxs("span",{className:"font-medium",children:["Found ",j.numFiles||j.filenames.length," ",j.numFiles===1||j.filenames.length===1?"file":"files"]})}),a.jsx("div",{className:"space-y-1 max-h-96 overflow-y-auto",children:j.filenames.map((T,P)=>{const q=T.split("/").pop(),D=T.substring(0,T.lastIndexOf("/"));return a.jsxs("div",{onClick:()=>{i&&i(T)},className:"group flex items-center gap-2 px-2 py-1.5 rounded hover:bg-green-100/50 dark:hover:bg-green-800/20 cursor-pointer transition-colors",children:[a.jsx("svg",{className:"w-4 h-4 text-green-600 dark:text-green-400 flex-shrink-0",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z"})}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsx("div",{className:"font-mono text-sm font-medium text-green-800 dark:text-green-200 truncate group-hover:text-green-900 dark:group-hover:text-green-100",children:q}),a.jsx("div",{className:"font-mono text-xs text-green-600/70 dark:text-green-400/70 truncate",children:D})]}),a.jsx("svg",{className:"w-4 h-4 text-green-600 dark:text-green-400 opacity-0 group-hover:opacity-100 transition-opacity flex-shrink-0",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"})})]},P)})})]})}if(v.includes("Do you want to proceed?")&&e.toolName==="Bash"){const j=v.split(`
|
|
788
788
|
`),T=j.findIndex(re=>re.includes("Do you want to proceed?")),P=j.slice(0,T).join(`
|
|
789
789
|
`),q=j.slice(T),D=q.find(re=>re.includes("Do you want to proceed?"))||"",z=[];q.forEach(re=>{const K=re.match(/^\s*(\d+)\.\s+(.+)$/);K&&z.push({number:K[1],text:K[2].trim()})});const U=v.match(/>\s*(\d+)/),G=U?U[1]:null;return a.jsxs("div",{className:"space-y-3",children:[P&&a.jsx("div",{className:"bg-gray-900 dark:bg-gray-950 text-gray-100 rounded-lg p-3 font-mono text-xs overflow-x-auto",children:a.jsx("pre",{className:"whitespace-pre-wrap break-words",children:P})}),a.jsx("div",{className:"bg-amber-50 dark:bg-amber-900/20 border border-amber-200 dark:border-amber-800 rounded-lg p-4",children:a.jsxs("div",{className:"flex items-start gap-3",children:[a.jsx("div",{className:"w-8 h-8 bg-amber-500 rounded-full flex items-center justify-center flex-shrink-0 mt-0.5",children:a.jsx("svg",{className:"w-5 h-5 text-white",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M8.228 9c.549-1.165 2.03-2 3.772-2 2.21 0 4 1.343 4 3 0 1.4-1.278 2.575-3.006 2.907-.542.104-.994.54-.994 1.093m0 3h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})})}),a.jsxs("div",{className:"flex-1",children:[a.jsx("h4",{className:"font-semibold text-amber-900 dark:text-amber-100 text-base mb-2",children:"Interactive Prompt"}),a.jsx("p",{className:"text-sm text-amber-800 dark:text-amber-200 mb-4",children:D}),a.jsx("div",{className:"space-y-2 mb-4",children:z.map(re=>a.jsx("button",{className:`w-full text-left px-4 py-3 rounded-lg border-2 transition-all ${G===re.number?"bg-amber-600 dark:bg-amber-700 text-white border-amber-600 dark:border-amber-700 shadow-md":"bg-white dark:bg-gray-800 text-amber-900 dark:text-amber-100 border-amber-300 dark:border-amber-700 hover:border-amber-400 dark:hover:border-amber-600 hover:shadow-sm"} ${G?"cursor-default":"cursor-not-allowed opacity-75"}`,disabled:!0,children:a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("span",{className:`flex-shrink-0 w-8 h-8 rounded-full flex items-center justify-center text-sm font-bold ${G===re.number?"bg-white/20":"bg-amber-100 dark:bg-amber-800/50"}`,children:re.number}),a.jsx("span",{className:"text-sm sm:text-base font-medium flex-1",children:re.text}),G===re.number&&a.jsx("svg",{className:"w-5 h-5 flex-shrink-0",fill:"currentColor",viewBox:"0 0 20 20",children:a.jsx("path",{fillRule:"evenodd",d:"M16.707 5.293a1 1 0 010 1.414l-8 8a1 1 0 01-1.414 0l-4-4a1 1 0 011.414-1.414L8 12.586l7.293-7.293a1 1 0 011.414 0z",clipRule:"evenodd"})})]})},re.number))}),G&&a.jsxs("div",{className:"bg-amber-100 dark:bg-amber-800/30 rounded-lg p-3",children:[a.jsxs("p",{className:"text-amber-900 dark:text-amber-100 text-sm font-medium mb-1",children:["✓ Claude selected option ",G]}),a.jsx("p",{className:"text-amber-800 dark:text-amber-200 text-xs",children:"In the CLI, you would select this option interactively using arrow keys or by typing the number."})]})]})]})})]})}const I=v.match(/The file (.+?) has been updated\./);if(I)return a.jsxs("div",{children:[a.jsx("div",{className:"flex items-center gap-2 mb-2",children:a.jsx("span",{className:"font-medium",children:"File updated successfully"})}),a.jsx("button",{onClick:async()=>{if(i)try{const T=await(await Ce(`/api/git/file-with-diff?project=${encodeURIComponent(u?.name)}&file=${encodeURIComponent(I[1])}`)).json();!T.error&&T.oldContent!==void 0&&T.currentContent!==void 0?i(I[1],{old_string:T.oldContent||"",new_string:T.currentContent||""}):i(I[1])}catch(j){console.error("Error fetching file diff:",j),i(I[1])}},className:"text-xs font-mono bg-green-100 dark:bg-green-800/30 px-2 py-1 rounded text-blue-600 dark:text-blue-400 hover:text-blue-700 dark:hover:text-blue-300 underline cursor-pointer",children:I[1]})]});const M=v.match(/(?:The file|File) (.+?) has been (?:created|written)(?: successfully)?\.?/);return M?a.jsxs("div",{children:[a.jsx("div",{className:"flex items-center gap-2 mb-2",children:a.jsx("span",{className:"font-medium",children:"File created successfully"})}),a.jsx("button",{onClick:async()=>{if(i)try{const T=await(await Ce(`/api/git/file-with-diff?project=${encodeURIComponent(u?.name)}&file=${encodeURIComponent(M[1])}`)).json();!T.error&&T.oldContent!==void 0&&T.currentContent!==void 0?i(M[1],{old_string:T.oldContent||"",new_string:T.currentContent||""}):i(M[1])}catch(j){console.error("Error fetching file diff:",j),i(M[1])}},className:"text-xs font-mono bg-green-100 dark:bg-green-800/30 px-2 py-1 rounded text-blue-600 dark:text-blue-400 hover:text-blue-700 dark:hover:text-blue-300 underline cursor-pointer",children:M[1]})]}):e.toolName==="Write"&&!e.toolResult.isError?a.jsxs("div",{className:"text-green-700 dark:text-green-300",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:a.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"})}),a.jsx("span",{className:"font-medium",children:"File written successfully"})]}),a.jsx("p",{className:"text-xs mt-1 text-green-600 dark:text-green-400",children:"The file content is displayed in the diff view above"})]}):v.includes("cat -n")&&v.includes("→")?a.jsxs("details",{open:l,children:[a.jsxs("summary",{className:"text-sm text-green-700 dark:text-green-300 cursor-pointer hover:text-green-800 dark:hover:text-green-200 mb-2 flex items-center gap-2",children:[a.jsx("svg",{className:"w-4 h-4 transition-transform details-chevron",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})}),"View file content"]}),a.jsx("div",{className:"mt-2 bg-gray-100 dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg overflow-hidden",children:a.jsx("div",{className:"text-xs font-mono p-3 whitespace-pre-wrap break-words overflow-hidden",children:v})})]}):v.length>300?a.jsxs("details",{open:l,children:[a.jsxs("summary",{className:"text-sm text-green-700 dark:text-green-300 cursor-pointer hover:text-green-800 dark:hover:text-green-200 mb-2 flex items-center gap-2",children:[a.jsx("svg",{className:"w-4 h-4 transition-transform details-chevron",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})}),"View full output (",v.length," chars)"]}),a.jsx(Ka,{className:"mt-2 prose prose-sm max-w-none prose-green dark:prose-invert",children:v})]}):a.jsx(Ka,{className:"prose prose-sm max-w-none prose-green dark:prose-invert",children:v})})(),S&&a.jsxs("div",{className:"mt-4 border-t border-red-200/60 dark:border-red-800/60 pt-3",children:[a.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[a.jsx("button",{type:"button",onClick:()=>{if(!o)return;o(S)?.success?E("granted"):E("error")},disabled:S.isAllowed||k==="granted",className:`inline-flex items-center gap-2 px-3 py-1.5 rounded-md text-xs font-medium border transition-colors ${S.isAllowed||k==="granted"?"bg-green-100 dark:bg-green-900/30 border-green-300/70 dark:border-green-800/60 text-green-800 dark:text-green-200 cursor-default":"bg-white/80 dark:bg-gray-900/40 border-red-300/70 dark:border-red-800/60 text-red-700 dark:text-red-200 hover:bg-white dark:hover:bg-gray-900/70"}`,children:S.isAllowed||k==="granted"?"Permission added":`Grant permission for ${S.toolName}`}),s&&a.jsx("button",{type:"button",onClick:v=>{v.stopPropagation(),s()},className:"text-xs text-red-700 dark:text-red-200 underline hover:text-red-800 dark:hover:text-red-100",children:"Open settings"})]}),a.jsxs("div",{className:"mt-2 text-xs text-red-700/90 dark:text-red-200/80",children:["Adds ",a.jsx("span",{className:"font-mono",children:S.entry})," to Allowed Tools."]}),k==="error"&&a.jsx("div",{className:"mt-2 text-xs text-red-700 dark:text-red-200",children:"Unable to update permissions. Please try again."}),(S.isAllowed||k==="granted")&&a.jsx("div",{className:"mt-2 text-xs text-green-700 dark:text-green-200",children:"Permission saved. Retry the request to use the tool."})]})]})]}))]}):e.isInteractivePrompt?a.jsx("div",{className:"bg-amber-50 dark:bg-amber-900/20 border border-amber-200 dark:border-amber-800 rounded-lg p-4",children:a.jsxs("div",{className:"flex items-start gap-3",children:[a.jsx("div",{className:"w-8 h-8 bg-amber-500 rounded-full flex items-center justify-center flex-shrink-0 mt-0.5",children:a.jsx("svg",{className:"w-5 h-5 text-white",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M8.228 9c.549-1.165 2.03-2 3.772-2 2.21 0 4 1.343 4 3 0 1.4-1.278 2.575-3.006 2.907-.542.104-.994.54-.994 1.093m0 3h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})})}),a.jsxs("div",{className:"flex-1",children:[a.jsx("h4",{className:"font-semibold text-amber-900 dark:text-amber-100 text-base mb-3",children:"Interactive Prompt"}),(()=>{const N=e.content.split(`
|
|
790
|
-
`).filter(I=>I.trim()),C=N.find(I=>I.includes("?"))||N[0]||"",v=[];return N.forEach(I=>{const M=I.match(/[❯\s]*(\d+)\.\s+(.+)/);if(M){const j=I.includes("❯");v.push({number:M[1],text:M[2].trim(),isSelected:j})}}),a.jsxs(a.Fragment,{children:[a.jsx("p",{className:"text-sm text-amber-800 dark:text-amber-200 mb-4",children:C}),a.jsx("div",{className:"space-y-2 mb-4",children:v.map(I=>a.jsx("button",{className:`w-full text-left px-4 py-3 rounded-lg border-2 transition-all ${I.isSelected?"bg-amber-600 dark:bg-amber-700 text-white border-amber-600 dark:border-amber-700 shadow-md":"bg-white dark:bg-gray-800 text-amber-900 dark:text-amber-100 border-amber-300 dark:border-amber-700"} cursor-not-allowed opacity-75`,disabled:!0,children:a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("span",{className:`flex-shrink-0 w-8 h-8 rounded-full flex items-center justify-center text-sm font-bold ${I.isSelected?"bg-white/20":"bg-amber-100 dark:bg-amber-800/50"}`,children:I.number}),a.jsx("span",{className:"text-sm sm:text-base font-medium flex-1",children:I.text}),I.isSelected&&a.jsx("span",{className:"text-lg",children:"❯"})]})},I.number))}),a.jsxs("div",{className:"bg-amber-100 dark:bg-amber-800/30 rounded-lg p-3",children:[a.jsx("p",{className:"text-amber-900 dark:text-amber-100 text-sm font-medium mb-1",children:"⏳ Waiting for your response in the CLI"}),a.jsx("p",{className:"text-amber-800 dark:text-amber-200 text-xs",children:"Please select an option in your terminal where Claude is running."})]})]})})()]})]})}):e.isToolUse&&e.toolName==="Read"?(()=>{try{const N=JSON.parse(e.toolInput);if(N.file_path){const C=N.file_path.split("/").pop();return a.jsx("div",{className:"bg-gray-50/50 dark:bg-gray-800/30 border-l-2 border-gray-400 dark:border-gray-500 pl-3 py-2 my-2",children:a.jsxs("div",{className:"flex items-center gap-2 text-xs text-gray-600 dark:text-gray-400",children:[a.jsx("svg",{className:"w-3.5 h-3.5 text-gray-500 dark:text-gray-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 6.253v13m0-13C10.832 5.477 9.246 5 7.5 5S4.168 5.477 3 6.253v13C4.168 18.477 5.754 18 7.5 18s3.332.477 4.5 1.253m0-13C13.168 5.477 14.754 5 16.5 5c1.747 0 3.332.477 4.5 1.253v13C19.832 18.477 18.247 18 16.5 18c-1.746 0-3.332.477-4.5 1.253"})}),a.jsx("span",{className:"font-medium",children:"Read"}),a.jsx("button",{onClick:()=>i&&i(N.file_path),className:"text-blue-600 dark:text-blue-400 hover:text-blue-700 dark:hover:text-blue-300 font-mono transition-colors",children:C})]})})}}catch{return a.jsx("div",{className:"bg-gray-50/50 dark:bg-gray-800/30 border-l-2 border-gray-400 dark:border-gray-500 pl-3 py-2 my-2",children:a.jsxs("div",{className:"flex items-center gap-2 text-xs text-gray-600 dark:text-gray-400",children:[a.jsx("svg",{className:"w-3.5 h-3.5 text-gray-500 dark:text-gray-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 6.253v13m0-13C10.832 5.477 9.246 5 7.5 5S4.168 5.477 3 6.253v13C4.168 18.477 5.754 18 7.5 18s3.332.477 4.5 1.253m0-13C13.168 5.477 14.754 5 16.5 5c1.747 0 3.332.477 4.5 1.253v13C19.832 18.477 18.247 18 16.5 18c-1.746 0-3.332.477-4.5 1.253"})}),a.jsx("span",{className:"font-medium",children:"Read file"})]})})}})():e.isToolUse&&e.toolName==="TodoWrite"?(()=>{try{const N=JSON.parse(e.toolInput);if(N.todos&&Array.isArray(N.todos))return a.jsxs("div",{className:"bg-gray-50/50 dark:bg-gray-800/30 border-l-2 border-gray-400 dark:border-gray-500 pl-3 py-2 my-2",children:[a.jsxs("div",{className:"flex items-center gap-2 text-xs text-gray-600 dark:text-gray-400 mb-2",children:[a.jsx("svg",{className:"w-3.5 h-3.5 text-gray-500 dark:text-gray-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4"})}),a.jsx("span",{className:"font-medium",children:"Update todo list"})]}),a.jsx(Cm,{todos:N.todos})]})}catch{return a.jsx("div",{className:"bg-gray-50/50 dark:bg-gray-800/30 border-l-2 border-gray-400 dark:border-gray-500 pl-3 py-2 my-2",children:a.jsxs("div",{className:"flex items-center gap-2 text-xs text-gray-600 dark:text-gray-400",children:[a.jsx("svg",{className:"w-3.5 h-3.5 text-gray-500 dark:text-gray-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4"})}),a.jsx("span",{className:"font-medium",children:"Update todo list"})]})})}})():e.isToolUse&&e.toolName==="TodoRead"?a.jsx("div",{className:"bg-gray-50/50 dark:bg-gray-800/30 border-l-2 border-gray-400 dark:border-gray-500 pl-3 py-2 my-2",children:a.jsxs("div",{className:"flex items-center gap-2 text-xs text-gray-600 dark:text-gray-400",children:[a.jsx("svg",{className:"w-3.5 h-3.5 text-gray-500 dark:text-gray-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2"})}),a.jsx("span",{className:"font-medium",children:"Read todo list"})]})}):e.isThinking?a.jsx("div",{className:"text-sm text-gray-700 dark:text-gray-300",children:a.jsxs("details",{className:"group",children:[a.jsxs("summary",{className:"cursor-pointer text-gray-500 dark:text-gray-400 hover:text-gray-700 dark:hover:text-gray-200 font-medium flex items-center gap-2",children:[a.jsx("svg",{className:"w-3 h-3 transition-transform group-open:rotate-90",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"})}),a.jsx("span",{children:"💭 Thinking..."})]}),a.jsx("div",{className:"mt-2 pl-4 border-l-2 border-gray-300 dark:border-gray-600 text-gray-600 dark:text-gray-400 text-sm",children:a.jsx(Ka,{className:"prose prose-sm max-w-none dark:prose-invert prose-gray",children:e.content})})]})}):a.jsxs("div",{className:"text-sm text-gray-700 dark:text-gray-300",children:[d&&e.reasoning&&a.jsxs("details",{className:"mb-3",children:[a.jsx("summary",{className:"cursor-pointer text-gray-600 dark:text-gray-400 hover:text-gray-800 dark:hover:text-gray-200 font-medium",children:"💭 Thinking..."}),a.jsx("div",{className:"mt-2 pl-4 border-l-2 border-gray-300 dark:border-gray-600 italic text-gray-600 dark:text-gray-400 text-sm",children:a.jsx("div",{className:"whitespace-pre-wrap",children:e.reasoning})})]}),(()=>{const N=Nh(String(e.content||"")),C=N.trim();if((C.startsWith("{")||C.startsWith("["))&&(C.endsWith("}")||C.endsWith("]")))try{const v=JSON.parse(C),I=JSON.stringify(v,null,2);return a.jsxs("div",{className:"my-2",children:[a.jsxs("div",{className:"flex items-center gap-2 mb-2 text-sm text-gray-600 dark:text-gray-400",children:[a.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M7 21h10a2 2 0 002-2V9.414a1 1 0 00-.293-.707l-5.414-5.414A1 1 0 0012.586 3H7a2 2 0 00-2 2v14a2 2 0 002 2z"})}),a.jsx("span",{className:"font-medium",children:"JSON Response"})]}),a.jsx("div",{className:"bg-gray-800 dark:bg-gray-900 border border-gray-600/30 dark:border-gray-700 rounded-lg overflow-hidden",children:a.jsx("pre",{className:"p-4 overflow-x-auto",children:a.jsx("code",{className:"text-gray-100 dark:text-gray-200 text-sm font-mono block whitespace-pre",children:I})})})]})}catch{}return e.type==="assistant"?a.jsx(Ka,{className:"prose prose-sm max-w-none dark:prose-invert prose-gray",children:N}):a.jsx("div",{className:"whitespace-pre-wrap",children:N})})()]}),a.jsx("div",{className:`text-xs text-gray-500 dark:text-gray-400 mt-1 ${m?"opacity-0 group-hover:opacity-100":""}`,children:new Date(e.timestamp).toLocaleTimeString()})]})]})})}),Oq=({file:e,onRemove:t,uploadProgress:r,error:n})=>{const[i,s]=x.useState(null);return x.useEffect(()=>{const o=URL.createObjectURL(e);return s(o),()=>URL.revokeObjectURL(o)},[e]),a.jsxs("div",{className:"relative group",children:[a.jsx("img",{src:i,alt:e.name,className:"w-20 h-20 object-cover rounded"}),r!==void 0&&r<100&&a.jsx("div",{className:"absolute inset-0 bg-black/50 flex items-center justify-center",children:a.jsxs("div",{className:"text-white text-xs",children:[r,"%"]})}),n&&a.jsx("div",{className:"absolute inset-0 bg-red-500/50 flex items-center justify-center",children:a.jsx("svg",{className:"w-6 h-6 text-white",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})}),a.jsx("button",{onClick:t,className:"absolute -top-2 -right-2 bg-red-500 text-white rounded-full p-1 opacity-0 group-hover:opacity-100",children:a.jsx("svg",{className:"w-3 h-3",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]})};function Dq({selectedProject:e,selectedSession:t,ws:r,sendMessage:n,messages:i,onFileOpen:s,onInputFocusChange:o,onSessionActive:l,onSessionInactive:c,onSessionProcessing:d,onSessionNotProcessing:u,processingSessions:p,onReplaceTemporarySession:h,onNavigateToSession:m,onShowSettings:g,autoExpandTools:f,showRawParameters:w,showThinking:S,autoScrollToBottom:k,sendByCtrlEnter:E,externalMessageUpdate:N,onTaskClick:C,onShowAllTasks:v}){const{tasksEnabled:I,isTaskMasterInstalled:M}=os(),{t:j}=Ht("chat"),[T,P]=x.useState(()=>typeof window<"u"&&e&&vr.getItem(`draft_input_${e.name}`)||""),[q,D]=x.useState(()=>{if(typeof window<"u"&&e){const O=vr.getItem(`chat_messages_${e.name}`);return O?JSON.parse(O):[]}return[]}),[z,U]=x.useState(!1),[G,re]=x.useState(t?.id||null),[K,ue]=x.useState(!1),[R,F]=x.useState([]),[te,_]=x.useState(!1),[Z,me]=x.useState(!1),[ke,se]=x.useState(0),[_e,oe]=x.useState(!1),[fe,Ie]=x.useState(0),qe=20,[ze,ct]=x.useState(!1),[Ye,wt]=x.useState("default"),[gt,et]=x.useState([]),[Me,mt]=x.useState([]),[Pt,xe]=x.useState(new Map),[at,de]=x.useState(new Map),Ee=x.useRef(null),H=x.useRef(null),Y=x.useRef(null),le=x.useRef(null),ve=x.useRef(null),Ve=x.useRef(!1),It=x.useRef(!1),ft=x.useRef(!1),Rt=x.useRef(null),it=x.useRef(""),ie=x.useRef(null),je=x.useRef(null),Te=x.useRef(null),[Pe,Ue]=x.useState(""),[st,Qe]=x.useState(!1),[J,Fe]=x.useState([]),[Ke,Ge]=x.useState([]),[dt,he]=x.useState([]),[zt,nr]=x.useState(-1),[_n,xr]=x.useState(0),[ae,ge]=x.useState(-1),[tt,bt]=x.useState(!1),[hr,ar]=x.useState(!1),Zr=x.useRef({height:0,top:0}),[Ut,cn]=x.useState(!1),[jr,wi]=x.useState([]),[Ln,Pa]=x.useState([]),[ra,_r]=x.useState(""),[fs,gn]=x.useState(!1),[Ba,On]=x.useState(null),[za,Jr]=x.useState(-1),[Si,fn]=x.useState(-1),[ya,qo]=x.useState(100),[Go,qr]=x.useState(null),[Dn,Ei]=x.useState("none"),[vt,Ua]=x.useState(()=>localStorage.getItem("selected-provider")||"claude"),[na,bs]=x.useState(()=>localStorage.getItem("cursor-model")||A2.DEFAULT),[dn,X]=x.useState(()=>localStorage.getItem("claude-model")||T2.DEFAULT),[ce,Re]=x.useState(()=>localStorage.getItem("codex-model")||I2.DEFAULT),ht=x.useRef(vt),dr=x.useCallback(()=>{ie.current&&(clearTimeout(ie.current),ie.current=null),it.current=""},[]);x.useEffect(()=>{if(t?.id){const O=localStorage.getItem(`permissionMode-${t.id}`);wt(O||"default")}},[t?.id]),x.useEffect(()=>{t&&t.__provider&&t.__provider!==vt&&(Ua(t.__provider),localStorage.setItem("selected-provider",t.__provider))},[t]),x.useEffect(()=>{ht.current!==vt&&(et([]),ht.current=vt)},[vt]),x.useEffect(()=>{et(O=>O.filter(V=>!V.sessionId||V.sessionId===t?.id))},[t?.id]),x.useEffect(()=>{vt==="cursor"&&Ce("/api/cursor/config").then(O=>O.json()).then(O=>{if(O.success&&O.config?.model?.modelId){const V=O.config.model.modelId;localStorage.getItem("cursor-model")||bs(V)}}).catch(O=>console.error("Error loading Cursor config:",O))},[vt]),x.useEffect(()=>{(async()=>{if(e)try{const V=await Ce("/api/commands/list",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({projectPath:e.path})});if(!V.ok)throw new Error("Failed to fetch commands");const ee=await V.json(),ne=[...(ee.builtIn||[]).map(ot=>({...ot,type:"built-in"})),...(ee.custom||[]).map(ot=>({...ot,type:"custom"}))];wi(ne);const pe=`command_history_${e.name}`,Le=vr.getItem(pe);if(Le)try{const ot=JSON.parse(Le),Ct=ne.sort((kt,lt)=>{const Lt=ot[kt.name]||0;return(ot[lt.name]||0)-Lt});wi(Ct)}catch(ot){console.error("Error parsing command history:",ot)}}catch(V){console.error("Error fetching slash commands:",V),wi([])}})()},[e]);const Qr=x.useMemo(()=>jr.length?new ki(jr,{keys:[{name:"name",weight:2},{name:"description",weight:1}],threshold:.4,includeScore:!0,minMatchCharLength:1}):null,[jr]);x.useEffect(()=>{if(!ra){Pa(jr);return}if(!Qr){Pa([]);return}const O=Qr.search(ra);Pa(O.map(V=>V.item))},[ra,jr,Qr]);const h3=x.useMemo(()=>{if(!e||jr.length===0)return[];const O=`command_history_${e.name}`,V=vr.getItem(O);if(!V)return[];try{const ee=JSON.parse(V);return jr.map(pe=>({...pe,usageCount:ee[pe.name]||0})).filter(pe=>pe.usageCount>0).sort((pe,Le)=>Le.usageCount-pe.usageCount).slice(0,5)}catch(ee){return console.error("Error parsing command history:",ee),[]}},[e,jr]),g3=x.useCallback((O,V,ee)=>{if(!O||!e)return;if(ee){Jr(V);return}const ne=`command_history_${e.name}`,pe=vr.getItem(ne);let Le={};try{Le=pe?JSON.parse(pe):{}}catch(ot){console.error("Error parsing command history:",ot)}Le[O.name]=(Le[O.name]||0)+1,vr.setItem(ne,JSON.stringify(Le)),Vg(O)},[e]),f3=x.useCallback(O=>{const{action:V,data:ee}=O;switch(V){case"clear":D([]),F([]);break;case"help":D(ne=>[...ne,{role:"assistant",content:ee.content,timestamp:Date.now()}]);break;case"model":D(ne=>[...ne,{role:"assistant",content:`**Current Model**: ${ee.current.model}
|
|
790
|
+
`).filter(I=>I.trim()),C=N.find(I=>I.includes("?"))||N[0]||"",v=[];return N.forEach(I=>{const M=I.match(/[❯\s]*(\d+)\.\s+(.+)/);if(M){const j=I.includes("❯");v.push({number:M[1],text:M[2].trim(),isSelected:j})}}),a.jsxs(a.Fragment,{children:[a.jsx("p",{className:"text-sm text-amber-800 dark:text-amber-200 mb-4",children:C}),a.jsx("div",{className:"space-y-2 mb-4",children:v.map(I=>a.jsx("button",{className:`w-full text-left px-4 py-3 rounded-lg border-2 transition-all ${I.isSelected?"bg-amber-600 dark:bg-amber-700 text-white border-amber-600 dark:border-amber-700 shadow-md":"bg-white dark:bg-gray-800 text-amber-900 dark:text-amber-100 border-amber-300 dark:border-amber-700"} cursor-not-allowed opacity-75`,disabled:!0,children:a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("span",{className:`flex-shrink-0 w-8 h-8 rounded-full flex items-center justify-center text-sm font-bold ${I.isSelected?"bg-white/20":"bg-amber-100 dark:bg-amber-800/50"}`,children:I.number}),a.jsx("span",{className:"text-sm sm:text-base font-medium flex-1",children:I.text}),I.isSelected&&a.jsx("span",{className:"text-lg",children:"❯"})]})},I.number))}),a.jsxs("div",{className:"bg-amber-100 dark:bg-amber-800/30 rounded-lg p-3",children:[a.jsx("p",{className:"text-amber-900 dark:text-amber-100 text-sm font-medium mb-1",children:"⏳ Waiting for your response in the CLI"}),a.jsx("p",{className:"text-amber-800 dark:text-amber-200 text-xs",children:"Please select an option in your terminal where Claude is running."})]})]})})()]})]})}):e.isToolUse&&e.toolName==="Read"?(()=>{try{const N=JSON.parse(e.toolInput);if(N.file_path){const C=N.file_path.split("/").pop();return a.jsx("div",{className:"bg-gray-50/50 dark:bg-gray-800/30 border-l-2 border-gray-400 dark:border-gray-500 pl-3 py-2 my-2",children:a.jsxs("div",{className:"flex items-center gap-2 text-xs text-gray-600 dark:text-gray-400",children:[a.jsx("svg",{className:"w-3.5 h-3.5 text-gray-500 dark:text-gray-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 6.253v13m0-13C10.832 5.477 9.246 5 7.5 5S4.168 5.477 3 6.253v13C4.168 18.477 5.754 18 7.5 18s3.332.477 4.5 1.253m0-13C13.168 5.477 14.754 5 16.5 5c1.747 0 3.332.477 4.5 1.253v13C19.832 18.477 18.247 18 16.5 18c-1.746 0-3.332.477-4.5 1.253"})}),a.jsx("span",{className:"font-medium",children:"Read"}),a.jsx("button",{onClick:()=>i&&i(N.file_path),className:"text-blue-600 dark:text-blue-400 hover:text-blue-700 dark:hover:text-blue-300 font-mono transition-colors",children:C})]})})}}catch{return a.jsx("div",{className:"bg-gray-50/50 dark:bg-gray-800/30 border-l-2 border-gray-400 dark:border-gray-500 pl-3 py-2 my-2",children:a.jsxs("div",{className:"flex items-center gap-2 text-xs text-gray-600 dark:text-gray-400",children:[a.jsx("svg",{className:"w-3.5 h-3.5 text-gray-500 dark:text-gray-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 6.253v13m0-13C10.832 5.477 9.246 5 7.5 5S4.168 5.477 3 6.253v13C4.168 18.477 5.754 18 7.5 18s3.332.477 4.5 1.253m0-13C13.168 5.477 14.754 5 16.5 5c1.747 0 3.332.477 4.5 1.253v13C19.832 18.477 18.247 18 16.5 18c-1.746 0-3.332.477-4.5 1.253"})}),a.jsx("span",{className:"font-medium",children:"Read file"})]})})}})():e.isToolUse&&e.toolName==="TodoWrite"?(()=>{try{const N=JSON.parse(e.toolInput);if(N.todos&&Array.isArray(N.todos))return a.jsxs("div",{className:"bg-gray-50/50 dark:bg-gray-800/30 border-l-2 border-gray-400 dark:border-gray-500 pl-3 py-2 my-2",children:[a.jsxs("div",{className:"flex items-center gap-2 text-xs text-gray-600 dark:text-gray-400 mb-2",children:[a.jsx("svg",{className:"w-3.5 h-3.5 text-gray-500 dark:text-gray-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4"})}),a.jsx("span",{className:"font-medium",children:"Update todo list"})]}),a.jsx(Cm,{todos:N.todos})]})}catch{return a.jsx("div",{className:"bg-gray-50/50 dark:bg-gray-800/30 border-l-2 border-gray-400 dark:border-gray-500 pl-3 py-2 my-2",children:a.jsxs("div",{className:"flex items-center gap-2 text-xs text-gray-600 dark:text-gray-400",children:[a.jsx("svg",{className:"w-3.5 h-3.5 text-gray-500 dark:text-gray-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4"})}),a.jsx("span",{className:"font-medium",children:"Update todo list"})]})})}})():e.isToolUse&&e.toolName==="TodoRead"?a.jsx("div",{className:"bg-gray-50/50 dark:bg-gray-800/30 border-l-2 border-gray-400 dark:border-gray-500 pl-3 py-2 my-2",children:a.jsxs("div",{className:"flex items-center gap-2 text-xs text-gray-600 dark:text-gray-400",children:[a.jsx("svg",{className:"w-3.5 h-3.5 text-gray-500 dark:text-gray-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2"})}),a.jsx("span",{className:"font-medium",children:"Read todo list"})]})}):e.isThinking?a.jsx("div",{className:"text-sm text-gray-700 dark:text-gray-300",children:a.jsxs("details",{className:"group",children:[a.jsxs("summary",{className:"cursor-pointer text-gray-500 dark:text-gray-400 hover:text-gray-700 dark:hover:text-gray-200 font-medium flex items-center gap-2",children:[a.jsx("svg",{className:"w-3 h-3 transition-transform group-open:rotate-90",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"})}),a.jsx("span",{children:"💭 Thinking..."})]}),a.jsx("div",{className:"mt-2 pl-4 border-l-2 border-gray-300 dark:border-gray-600 text-gray-600 dark:text-gray-400 text-sm",children:a.jsx(Ka,{className:"prose prose-sm max-w-none dark:prose-invert prose-gray",children:e.content})})]})}):a.jsxs("div",{className:"text-sm text-gray-700 dark:text-gray-300",children:[d&&e.reasoning&&a.jsxs("details",{className:"mb-3",children:[a.jsx("summary",{className:"cursor-pointer text-gray-600 dark:text-gray-400 hover:text-gray-800 dark:hover:text-gray-200 font-medium",children:"💭 Thinking..."}),a.jsx("div",{className:"mt-2 pl-4 border-l-2 border-gray-300 dark:border-gray-600 italic text-gray-600 dark:text-gray-400 text-sm",children:a.jsx("div",{className:"whitespace-pre-wrap",children:e.reasoning})})]}),(()=>{const N=Nh(String(e.content||"")),C=N.trim();if((C.startsWith("{")||C.startsWith("["))&&(C.endsWith("}")||C.endsWith("]")))try{const v=JSON.parse(C),I=JSON.stringify(v,null,2);return a.jsxs("div",{className:"my-2",children:[a.jsxs("div",{className:"flex items-center gap-2 mb-2 text-sm text-gray-600 dark:text-gray-400",children:[a.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M7 21h10a2 2 0 002-2V9.414a1 1 0 00-.293-.707l-5.414-5.414A1 1 0 0012.586 3H7a2 2 0 00-2 2v14a2 2 0 002 2z"})}),a.jsx("span",{className:"font-medium",children:"JSON Response"})]}),a.jsx("div",{className:"bg-gray-800 dark:bg-gray-900 border border-gray-600/30 dark:border-gray-700 rounded-lg overflow-hidden",children:a.jsx("pre",{className:"p-4 overflow-x-auto",children:a.jsx("code",{className:"text-gray-100 dark:text-gray-200 text-sm font-mono block whitespace-pre",children:I})})})]})}catch{}return e.type==="assistant"?a.jsx(Ka,{className:"prose prose-sm max-w-none dark:prose-invert prose-gray",children:N}):a.jsx("div",{className:"whitespace-pre-wrap",children:N})})()]}),a.jsx("div",{className:`text-xs text-gray-500 dark:text-gray-400 mt-1 ${m?"opacity-0 group-hover:opacity-100":""}`,children:new Date(e.timestamp).toLocaleTimeString()})]})]})})}),Oq=({file:e,onRemove:t,uploadProgress:r,error:n})=>{const[i,s]=x.useState(null);return x.useEffect(()=>{const o=URL.createObjectURL(e);return s(o),()=>URL.revokeObjectURL(o)},[e]),a.jsxs("div",{className:"relative group",children:[a.jsx("img",{src:i,alt:e.name,className:"w-20 h-20 object-cover rounded"}),r!==void 0&&r<100&&a.jsx("div",{className:"absolute inset-0 bg-black/50 flex items-center justify-center",children:a.jsxs("div",{className:"text-white text-xs",children:[r,"%"]})}),n&&a.jsx("div",{className:"absolute inset-0 bg-red-500/50 flex items-center justify-center",children:a.jsx("svg",{className:"w-6 h-6 text-white",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})}),a.jsx("button",{onClick:t,className:"absolute -top-2 -right-2 bg-red-500 text-white rounded-full p-1 opacity-0 group-hover:opacity-100",children:a.jsx("svg",{className:"w-3 h-3",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]})};function Dq({selectedProject:e,selectedSession:t,ws:r,sendMessage:n,messages:i,onFileOpen:s,onInputFocusChange:o,onSessionActive:l,onSessionInactive:c,onSessionProcessing:d,onSessionNotProcessing:u,processingSessions:p,onReplaceTemporarySession:h,onNavigateToSession:m,onShowSettings:g,autoExpandTools:f,showRawParameters:w,showThinking:S,autoScrollToBottom:k,sendByCtrlEnter:E,externalMessageUpdate:N,onTaskClick:C,onShowAllTasks:v}){const{tasksEnabled:I,isTaskMasterInstalled:M}=os(),{t:j}=Ht("chat"),[T,P]=x.useState(()=>typeof window<"u"&&e&&vr.getItem(`draft_input_${e.name}`)||""),[q,D]=x.useState(()=>{if(typeof window<"u"&&e){const O=vr.getItem(`chat_messages_${e.name}`);return O?JSON.parse(O):[]}return[]}),[z,U]=x.useState(!1),[G,re]=x.useState(t?.id||null),[K,ue]=x.useState(!1),[R,F]=x.useState([]),[te,_]=x.useState(!1),[Z,me]=x.useState(!1),[ke,se]=x.useState(0),[_e,oe]=x.useState(!1),[fe,Ie]=x.useState(0),qe=20,[ze,ct]=x.useState(!1),[Ye,wt]=x.useState("default"),[gt,et]=x.useState([]),[Me,mt]=x.useState([]),[Pt,xe]=x.useState(new Map),[at,ce]=x.useState(new Map),Ee=x.useRef(null),H=x.useRef(null),Y=x.useRef(null),le=x.useRef(null),ve=x.useRef(null),Ve=x.useRef(!1),It=x.useRef(!1),ft=x.useRef(!1),Rt=x.useRef(null),it=x.useRef(""),ie=x.useRef(null),je=x.useRef(null),Te=x.useRef(null),[Pe,Ue]=x.useState(""),[st,Qe]=x.useState(!1),[J,Fe]=x.useState([]),[Ke,Ge]=x.useState([]),[dt,he]=x.useState([]),[zt,nr]=x.useState(-1),[_n,xr]=x.useState(0),[ae,ge]=x.useState(-1),[tt,bt]=x.useState(!1),[hr,ar]=x.useState(!1),Zr=x.useRef({height:0,top:0}),[Ut,cn]=x.useState(!1),[jr,wi]=x.useState([]),[Ln,Pa]=x.useState([]),[ra,_r]=x.useState(""),[fs,gn]=x.useState(!1),[Ba,On]=x.useState(null),[za,Jr]=x.useState(-1),[Si,fn]=x.useState(-1),[ya,qo]=x.useState(100),[Go,qr]=x.useState(null),[Dn,Ei]=x.useState("none"),[vt,Ua]=x.useState(()=>localStorage.getItem("selected-provider")||"claude"),[na,bs]=x.useState(()=>localStorage.getItem("cursor-model")||A2.DEFAULT),[dn,X]=x.useState(()=>localStorage.getItem("claude-model")||T2.DEFAULT),[de,Re]=x.useState(()=>localStorage.getItem("codex-model")||I2.DEFAULT),ht=x.useRef(vt),dr=x.useCallback(()=>{ie.current&&(clearTimeout(ie.current),ie.current=null),it.current=""},[]);x.useEffect(()=>{if(t?.id){const O=localStorage.getItem(`permissionMode-${t.id}`);wt(O||"default")}},[t?.id]),x.useEffect(()=>{t&&t.__provider&&t.__provider!==vt&&(Ua(t.__provider),localStorage.setItem("selected-provider",t.__provider))},[t]),x.useEffect(()=>{ht.current!==vt&&(et([]),ht.current=vt)},[vt]),x.useEffect(()=>{et(O=>O.filter(V=>!V.sessionId||V.sessionId===t?.id))},[t?.id]),x.useEffect(()=>{vt==="cursor"&&Ce("/api/cursor/config").then(O=>O.json()).then(O=>{if(O.success&&O.config?.model?.modelId){const V=O.config.model.modelId;localStorage.getItem("cursor-model")||bs(V)}}).catch(O=>console.error("Error loading Cursor config:",O))},[vt]),x.useEffect(()=>{(async()=>{if(e)try{const V=await Ce("/api/commands/list",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({projectPath:e.path})});if(!V.ok)throw new Error("Failed to fetch commands");const ee=await V.json(),ne=[...(ee.builtIn||[]).map(ot=>({...ot,type:"built-in"})),...(ee.custom||[]).map(ot=>({...ot,type:"custom"}))];wi(ne);const pe=`command_history_${e.name}`,Le=vr.getItem(pe);if(Le)try{const ot=JSON.parse(Le),Ct=ne.sort((kt,lt)=>{const Lt=ot[kt.name]||0;return(ot[lt.name]||0)-Lt});wi(Ct)}catch(ot){console.error("Error parsing command history:",ot)}}catch(V){console.error("Error fetching slash commands:",V),wi([])}})()},[e]);const Qr=x.useMemo(()=>jr.length?new ki(jr,{keys:[{name:"name",weight:2},{name:"description",weight:1}],threshold:.4,includeScore:!0,minMatchCharLength:1}):null,[jr]);x.useEffect(()=>{if(!ra){Pa(jr);return}if(!Qr){Pa([]);return}const O=Qr.search(ra);Pa(O.map(V=>V.item))},[ra,jr,Qr]);const h3=x.useMemo(()=>{if(!e||jr.length===0)return[];const O=`command_history_${e.name}`,V=vr.getItem(O);if(!V)return[];try{const ee=JSON.parse(V);return jr.map(pe=>({...pe,usageCount:ee[pe.name]||0})).filter(pe=>pe.usageCount>0).sort((pe,Le)=>Le.usageCount-pe.usageCount).slice(0,5)}catch(ee){return console.error("Error parsing command history:",ee),[]}},[e,jr]),g3=x.useCallback((O,V,ee)=>{if(!O||!e)return;if(ee){Jr(V);return}const ne=`command_history_${e.name}`,pe=vr.getItem(ne);let Le={};try{Le=pe?JSON.parse(pe):{}}catch(ot){console.error("Error parsing command history:",ot)}Le[O.name]=(Le[O.name]||0)+1,vr.setItem(ne,JSON.stringify(Le)),Vg(O)},[e]),f3=x.useCallback(O=>{const{action:V,data:ee}=O;switch(V){case"clear":D([]),F([]);break;case"help":D(ne=>[...ne,{role:"assistant",content:ee.content,timestamp:Date.now()}]);break;case"model":D(ne=>[...ne,{role:"assistant",content:`**Current Model**: ${ee.current.model}
|
|
791
791
|
|
|
792
792
|
**Available Models**:
|
|
793
793
|
|
|
@@ -824,11 +824,11 @@ ${ye}`:ye,ie.current||(ie.current=setTimeout(()=>{const Je=it.current;it.current
|
|
|
824
824
|
${Je}`:Je:Vt.push({type:"assistant",content:Je,timestamp:new Date,isStreaming:!0}),Vt})},100)))}break;case"claude-interactive-prompt":D(ye=>[...ye,{type:"assistant",content:O.data,timestamp:new Date,isInteractivePrompt:!0}]);break;case"claude-permission-request":{if(vt!=="claude"||!O.requestId)break;et(ye=>ye.some(Je=>Je.requestId===O.requestId)?ye:[...ye,{requestId:O.requestId,toolName:O.toolName||"UnknownTool",input:O.input,context:O.context,sessionId:O.sessionId||null,receivedAt:new Date}]),U(!0),bt(!0),qr({text:"Waiting for permission",tokens:0,can_interrupt:!0});break}case"claude-permission-cancelled":{if(!O.requestId)break;et(ye=>ye.filter(Je=>Je.requestId!==O.requestId));break}case"claude-error":D(ye=>[...ye,{type:"error",content:`Error: ${O.error}`,timestamp:new Date}]);break;case"cursor-system":try{const ye=O.data;if(ye&&ye.type==="system"&&ye.subtype==="init"&&ye.session_id){if(!lt)return;if(G&&ye.session_id!==G){console.log("🔄 Cursor session switch detected:",{originalSession:G,newSession:ye.session_id}),ct(!0),m&&m(ye.session_id);return}if(!G){console.log("🔄 Cursor new session init detected:",{newSession:ye.session_id}),ct(!0),m&&m(ye.session_id);return}}}catch(ye){console.warn("Error handling cursor-system message:",ye)}break;case"cursor-user":break;case"cursor-tool-use":D(ye=>[...ye,{type:"assistant",content:`Using tool: ${O.tool} ${O.input?`with ${O.input}`:""}`,timestamp:new Date,isToolUse:!0,toolName:O.tool,toolInput:O.input}]);break;case"cursor-error":D(ye=>[...ye,{type:"error",content:`Cursor error: ${O.error||"Unknown error"}`,timestamp:new Date}]);break;case"cursor-result":const Xt=O.sessionId||G;if(Xt===G&&(U(!1),bt(!1),qr(null)),Xt&&(c&&c(Xt),u&&u(Xt)),Xt===G)try{const ye=O.data||{},Je=typeof ye.result=="string"?ye.result:"";ie.current&&(clearTimeout(ie.current),ie.current=null);const Ot=it.current;it.current="",D(Vt=>{const Dt=[...Vt],Sr=Dt[Dt.length-1];if(Sr&&Sr.type==="assistant"&&!Sr.isToolUse&&Sr.isStreaming){const D3=Je&&Je.trim()?Je:(Sr.content||"")+(Ot||"");Sr.content=D3,Sr.isStreaming=!1}else Je&&Je.trim()&&Dt.push({type:ye.is_error?"error":"assistant",content:Je,timestamp:new Date,isStreaming:!1});return Dt})}catch(ye){console.warn("Error handling cursor-result message:",ye)}const Wt=sessionStorage.getItem("pendingSessionId");Xt&&!G&&Xt===Wt&&(re(Xt),sessionStorage.removeItem("pendingSessionId"),window.refreshProjects&&setTimeout(()=>window.refreshProjects(),500));break;case"cursor-output":try{const Je=String(O.data??"").replace(/\x1b\[[0-9;?]*[A-Za-z]/g,"").replace(/[\x00-\x08\x0B\x0C\x0E-\x1F]/g,"").trim();Je&&(it.current+=it.current?`
|
|
825
825
|
${Je}`:Je,ie.current||(ie.current=setTimeout(()=>{const Ot=it.current;it.current="",ie.current=null,Ot&&D(Vt=>{const Dt=[...Vt],Sr=Dt[Dt.length-1];return Sr&&Sr.type==="assistant"&&!Sr.isToolUse&&Sr.isStreaming?Sr.content=Sr.content?`${Sr.content}
|
|
826
826
|
${Ot}`:Ot:Dt.push({type:"assistant",content:Ot,timestamp:new Date,isStreaming:!0}),Dt})},100)))}catch(ye){console.warn("Error handling cursor-output message:",ye)}break;case"claude-complete":const St=O.sessionId||G||sessionStorage.getItem("pendingSessionId");(St===G||!G)&&(U(!1),bt(!1),qr(null)),St&&(c&&c(St),u&&u(St));const yr=sessionStorage.getItem("pendingSessionId");yr&&!G&&O.exitCode===0&&(re(yr),sessionStorage.removeItem("pendingSessionId"),console.log("✅ New session complete, ID set to:",yr)),e&&O.exitCode===0&&vr.removeItem(`chat_messages_${e.name}`),et([]);break;case"codex-response":const _t=O.data;if(_t){if(_t.type==="item")switch(_t.itemType){case"agent_message":if(_t.message?.content?.trim()){const ye=xn(_t.message.content);D(Je=>[...Je,{type:"assistant",content:ye,timestamp:new Date}])}break;case"reasoning":if(_t.message?.content?.trim()){const ye=xn(_t.message.content);D(Je=>[...Je,{type:"assistant",content:ye,timestamp:new Date,isThinking:!0}])}break;case"command_execution":_t.command&&D(ye=>[...ye,{type:"assistant",content:"",timestamp:new Date,isToolUse:!0,toolName:"Bash",toolInput:_t.command,toolResult:_t.output||null,exitCode:_t.exitCode}]);break;case"file_change":if(_t.changes?.length>0){const ye=_t.changes.map(Je=>`${Je.kind}: ${Je.path}`).join(`
|
|
827
|
-
`);D(Je=>[...Je,{type:"assistant",content:"",timestamp:new Date,isToolUse:!0,toolName:"FileChanges",toolInput:ye,toolResult:`Status: ${_t.status}`}])}break;case"mcp_tool_call":D(ye=>[...ye,{type:"assistant",content:"",timestamp:new Date,isToolUse:!0,toolName:`${_t.server}:${_t.tool}`,toolInput:JSON.stringify(_t.arguments,null,2),toolResult:_t.result?JSON.stringify(_t.result,null,2):_t.error?.message||null}]);break;case"error":_t.message?.content&&D(ye=>[...ye,{type:"error",content:_t.message.content,timestamp:new Date}]);break;default:console.log("[Codex] Unhandled item type:",_t.itemType,_t)}_t.type==="turn_complete"&&U(!1),_t.type==="turn_failed"&&(U(!1),D(ye=>[...ye,{type:"error",content:_t.error?.message||"Turn failed",timestamp:new Date}]))}break;case"codex-complete":const Lr=O.sessionId||G||sessionStorage.getItem("pendingSessionId");(Lr===G||!G)&&(U(!1),bt(!1),qr(null)),Lr&&(c&&c(Lr),u&&u(Lr));const $a=sessionStorage.getItem("pendingSessionId"),Or=O.actualSessionId||$a;$a&&!G&&(re(Or),ct(!0),m&&m(Or),sessionStorage.removeItem("pendingSessionId"),console.log("Codex session complete, ID set to:",$a)),e&&vr.removeItem(`chat_messages_${e.name}`);break;case"codex-error":U(!1),bt(!1),D(ye=>[...ye,{type:"error",content:O.error||"An error occurred with Codex",timestamp:new Date}]);break;case"session-aborted":{const ye=O.sessionId||G;ye===G&&(U(!1),bt(!1),qr(null)),ye&&(c&&c(ye),u&&u(ye)),et([]),D(Je=>[...Je,{type:"assistant",content:"Session interrupted by user.",timestamp:new Date}]);break}case"session-status":{const ye=O.sessionId;(ye===G||t&&ye===t.id)&&O.isProcessing&&(U(!0),bt(!0),d&&d(ye));break}case"claude-status":const ur=O.data;if(ur){let ye={text:"Working...",tokens:0,can_interrupt:!0};ur.message?ye.text=ur.message:ur.status?ye.text=ur.status:typeof ur=="string"&&(ye.text=ur),ur.tokens?ye.tokens=ur.tokens:ur.token_count&&(ye.tokens=ur.token_count),ur.can_interrupt!==void 0&&(ye.can_interrupt=ur.can_interrupt),qr(ye),U(!0),bt(ye.can_interrupt)}break}}},[i]),x.useEffect(()=>{e&&k3()},[e]);const k3=async()=>{try{const O=await yt.getFiles(e.name);if(O.ok){const V=await O.json(),ee=Xg(V);Fe(ee)}}catch(O){console.error("Error fetching files:",O)}},Xg=(O,V="")=>{let ee=[];for(const ne of O){const pe=V?`${V}/${ne.name}`:ne.name;ne.type==="directory"&&ne.children?ee=ee.concat(Xg(ne.children,pe)):ne.type==="file"&&ee.push({name:ne.name,path:pe,relativePath:ne.path})}return ee};x.useEffect(()=>{const O=T.slice(0,_n),V=O.lastIndexOf("@");if(V!==-1){const ee=O.slice(V+1);if(ee.includes(" "))Qe(!1),ge(-1);else{ge(V),Qe(!0);const ne=J.filter(pe=>pe.name.toLowerCase().includes(ee.toLowerCase())||pe.path.toLowerCase().includes(ee.toLowerCase())).slice(0,10);he(ne),nr(-1)}}else Qe(!1),ge(-1)},[T,_n,J]);const Wo=x.useMemo(()=>!T||Ke.length===0?[]:Ke.filter(O=>T.includes(O)),[Ke,T]),Ti=x.useMemo(()=>Wo.length===0?[]:Array.from(new Set(Wo)).sort((V,ee)=>ee.length-V.length),[Wo]),Vo=x.useMemo(()=>{if(Ti.length===0)return null;const O=Ti.map(Aq).join("|");return new RegExp(`(${O})`,"g")},[Ti]),Zg=x.useMemo(()=>new Set(Ti),[Ti]),w3=x.useCallback(O=>O?Vo?O.split(Vo).map((ee,ne)=>Zg.has(ee)?a.jsx("span",{className:"bg-blue-200/70 -ml-0.5 dark:bg-blue-300/40 px-0.5 rounded-md box-decoration-clone text-transparent",children:ee},`mention-${ne}`):a.jsx("span",{children:ee},`text-${ne}`)):O:"",[Vo,Zg]);x.useEffect(()=>{const O=setTimeout(()=>{Ue(T)},150);return()=>clearTimeout(O)},[T]);const Jg=x.useMemo(()=>q.length<=ya?q:q.slice(-ya),[q,ya]);x.useEffect(()=>{if(!k&&ve.current){const O=ve.current;Zr.current={height:O.scrollHeight,top:O.scrollTop}}}),x.useEffect(()=>{if(ve.current&&q.length>0)if(k)hr||setTimeout(()=>Mn(),50);else{const O=ve.current,V=Zr.current.height,ee=Zr.current.top,pe=O.scrollHeight-V;pe>0&&ee>0&&(O.scrollTop=ee+pe)}},[q.length,hr,Mn,k]),x.useEffect(()=>{ve.current&&q.length>0&&!Ve.current&&(ar(!1),setTimeout(()=>{Mn()},200))},[t?.id,e?.name]),x.useEffect(()=>{const O=ve.current;if(O)return O.addEventListener("scroll",Ci),()=>O.removeEventListener("scroll",Ci)},[Ci]),x.useEffect(()=>{if(H.current){H.current.style.height="auto",H.current.style.height=H.current.scrollHeight+"px";const O=parseInt(window.getComputedStyle(H.current).lineHeight),V=H.current.scrollHeight>O*2;gn(V)}},[]),x.useEffect(()=>{H.current&&!T.trim()&&(H.current.style.height="auto",gn(!1))},[T]),x.useEffect(()=>{if(!e||!t?.id||t.id.startsWith("new-session-")){On(null);return}if((t.__provider||"claude")!=="claude")return;(async()=>{try{const ee=`/api/projects/${e.name}/sessions/${t.id}/token-usage`,ne=await Ce(ee);if(ne.ok){const pe=await ne.json();On(pe)}else On(null)}catch(ee){console.error("Failed to fetch initial token usage:",ee)}})()},[t?.id,t?.__provider,e?.path]);const S3=x.useCallback(O=>{O.trim()&&P(V=>{const ee=V.trim()?`${V} ${O}`:O;return setTimeout(()=>{if(H.current){H.current.style.height="auto",H.current.style.height=H.current.scrollHeight+"px";const ne=parseInt(window.getComputedStyle(H.current).lineHeight),pe=H.current.scrollHeight>ne*2;gn(pe)}},0),ee})},[]),E3=x.useCallback(()=>{qo(O=>O+100)},[]),vs=x.useCallback(O=>{const V=O.filter(ee=>{try{if(!ee||typeof ee!="object")return console.warn("Invalid file object:",ee),!1;if(!ee.type||!ee.type.startsWith("image/"))return!1;if(!ee.size||ee.size>5242880){const ne=ee.name||"Unknown file";return de(pe=>{const Le=new Map(pe);return Le.set(ne,"File too large (max 5MB)"),Le}),!1}return!0}catch(ne){return console.error("Error validating file:",ne,ee),!1}});V.length>0&&mt(ee=>[...ee,...V].slice(0,5))},[]),N3=x.useCallback(async O=>{const V=Array.from(O.clipboardData.items);for(const ee of V)if(ee.type.startsWith("image/")){const ne=ee.getAsFile();ne&&vs([ne])}if(V.length===0&&O.clipboardData.files.length>0){const ne=Array.from(O.clipboardData.files).filter(pe=>pe.type.startsWith("image/"));ne.length>0&&vs(ne)}},[vs]),{getRootProps:C3,getInputProps:T3,isDragActive:A3,open:I3}=AN({accept:{"image/*":[".png",".jpg",".jpeg",".gif",".webp",".svg"]},maxSize:5*1024*1024,maxFiles:5,onDrop:vs,noClick:!0,noKeyboard:!0}),va=x.useCallback(async O=>{if(O.preventDefault(),!T.trim()||z||!e)return;let V=T;const ee=jN.find(lt=>lt.id===Dn);ee&&ee.prefix&&(V=`${ee.prefix}: ${T}`);let ne=[];if(Me.length>0){const lt=new FormData;Me.forEach(Lt=>{lt.append("images",Lt)});try{const Lt=await Ce(`/api/projects/${e.name}/upload-images`,{method:"POST",headers:{},body:lt});if(!Lt.ok)throw new Error("Failed to upload images");ne=(await Lt.json()).images}catch(Lt){console.error("Image upload failed:",Lt),D(fr=>[...fr,{type:"error",content:`Failed to upload images: ${Lt.message}`,timestamp:new Date}]);return}}const pe={type:"user",content:T,images:ne,timestamp:new Date};D(lt=>[...lt,pe]),U(!0),bt(!0),qr({text:"Processing",tokens:0,can_interrupt:!0}),ar(!1),setTimeout(()=>Mn(),100);const Le=G||t?.id||sessionStorage.getItem("cursorSessionId"),ot=Le||`new-session-${Date.now()}`;!Le&&!t?.id&&(je.current={sessionId:null,startedAt:Date.now()}),l&&l(ot);const kt=(()=>{try{const lt=vt==="cursor"?"cursor-tools-settings":vt==="codex"?"codex-settings":"claude-settings",Lt=vr.getItem(lt);if(Lt)return JSON.parse(Lt)}catch(lt){console.error("Error loading tools settings:",lt)}return{allowedTools:[],disallowedTools:[],skipPermissions:!1}})();n(vt==="cursor"?{type:"cursor-command",command:V,sessionId:Le,options:{cwd:e.fullPath||e.path,projectPath:e.fullPath||e.path,sessionId:Le,resume:!!Le,model:na,skipPermissions:kt?.skipPermissions||!1,toolsSettings:kt}}:vt==="codex"?{type:"codex-command",command:V,sessionId:Le,options:{cwd:e.fullPath||e.path,projectPath:e.fullPath||e.path,sessionId:Le,resume:!!Le,model:ce,permissionMode:Ye==="plan"?"default":Ye}}:{type:"claude-command",command:V,options:{projectPath:e.path,cwd:e.fullPath,sessionId:G,resume:!!G,toolsSettings:kt,permissionMode:Ye,model:dn,images:ne}}),P(""),mt([]),xe(new Map),de(new Map),gn(!1),Ei("none"),H.current&&(H.current.style.height="auto"),e&&vr.removeItem(`draft_input_${e.name}`)},[T,z,e,Me,G,t,vt,Ye,l,na,dn,ce,n,P,mt,xe,de,gn,H,D,U,bt,qr,ar,Mn,Dn]),Qg=x.useCallback(O=>!O||vt!=="claude"?{success:!1}:Rq(O.entry),[vt]),Ko=x.useCallback((O,V)=>{const ne=(Array.isArray(O)?O:[O]).filter(Boolean);ne.length!==0&&(ne.forEach(pe=>{n({type:"claude-permission-response",requestId:pe,allow:!!V?.allow,updatedInput:V?.updatedInput,message:V?.message,rememberEntry:V?.rememberEntry})}),et(pe=>{const Le=pe.filter(ot=>!ne.includes(ot.requestId));return Le.length===0&&qr(null),Le}))},[n]);x.useEffect(()=>{Ho.current=va},[va]);const ef=O=>{if(!O)return;const V=T.slice(0,Si),ee=T.slice(Si),ne=ee.indexOf(" "),pe=ne!==-1?ee.slice(ne):"",Le=V+O.name+" "+pe;P(Le),cn(!1),fn(-1),_r(""),Jr(-1),Te.current&&clearTimeout(Te.current),Vg(O)},R3=O=>{if(Ut&&Ln.length>0){if(O.key==="ArrowDown"){O.preventDefault(),Jr(V=>V<Ln.length-1?V+1:0);return}if(O.key==="ArrowUp"){O.preventDefault(),Jr(V=>V>0?V-1:Ln.length-1);return}if(O.key==="Tab"||O.key==="Enter"){O.preventDefault(),za>=0?ef(Ln[za]):Ln.length>0&&ef(Ln[0]);return}if(O.key==="Escape"){O.preventDefault(),cn(!1),fn(-1),_r(""),Jr(-1),Te.current&&clearTimeout(Te.current);return}}if(st&&dt.length>0){if(O.key==="ArrowDown"){O.preventDefault(),nr(V=>V<dt.length-1?V+1:0);return}if(O.key==="ArrowUp"){O.preventDefault(),nr(V=>V>0?V-1:dt.length-1);return}if(O.key==="Tab"||O.key==="Enter"){O.preventDefault(),zt>=0?Yo(dt[zt]):dt.length>0&&Yo(dt[0]);return}if(O.key==="Escape"){O.preventDefault(),Qe(!1);return}}if(O.key==="Tab"&&!st&&!Ut){O.preventDefault();const V=vt==="codex"?["default","acceptEdits","bypassPermissions"]:["default","acceptEdits","bypassPermissions","plan"],ne=(V.indexOf(Ye)+1)%V.length,pe=V[ne];wt(pe),t?.id&&localStorage.setItem(`permissionMode-${t.id}`,pe);return}if(O.key==="Enter"){if(O.nativeEvent.isComposing)return;(O.ctrlKey||O.metaKey)&&!O.shiftKey?(O.preventDefault(),va(O)):!O.shiftKey&&!O.ctrlKey&&!O.metaKey&&(E||(O.preventDefault(),va(O)))}},Yo=O=>{const V=T.slice(0,ae),ee=T.slice(ae),ne=ee.indexOf(" "),pe=ne!==-1?ee.slice(ne):"",Le=V+O.path+" "+pe,ot=V.length+O.path.length+1;H.current&&!H.current.matches(":focus")&&H.current.focus(),P(Le),xr(ot),Ge(Ct=>Ct.includes(O.path)?Ct:[...Ct,O.path]),Qe(!1),ge(-1),H.current&&requestAnimationFrame(()=>{H.current&&(H.current.setSelectionRange(ot,ot),H.current.matches(":focus")||H.current.focus())})},j3=O=>{const V=O.target.value,ee=O.target.selectionStart;if(!G&&V.trim(),P(V),xr(ee),!V.trim()){O.target.style.height="auto",gn(!1),cn(!1),fn(-1),_r("");return}const ne=V.slice(0,ee);if((ne.match(/```/g)||[]).length%2===1){cn(!1),fn(-1),_r("");return}const ot=/(^|\s)\/(\S*)$/,Ct=ne.match(ot);if(Ct){const kt=Ct.index+Ct[1].length,lt=Ct[2];fn(kt),cn(!0),Jr(-1),Te.current&&clearTimeout(Te.current),Te.current=setTimeout(()=>{_r(lt)},150)}else cn(!1),fn(-1),_r(""),Te.current&&clearTimeout(Te.current)},tf=x.useCallback(O=>{!le.current||!O||(le.current.scrollTop=O.scrollTop,le.current.scrollLeft=O.scrollLeft)},[]),_3=O=>{xr(O.target.selectionStart)},L3=()=>{G&&tt&&n({type:"abort-session",sessionId:G,provider:vt})},O3=()=>{const O=vt==="codex"?["default","acceptEdits","bypassPermissions"]:["default","acceptEdits","bypassPermissions","plan"],ee=(O.indexOf(Ye)+1)%O.length,ne=O[ee];wt(ne),t?.id&&localStorage.setItem(`permissionMode-${t.id}`,ne)};return e?a.jsxs(a.Fragment,{children:[a.jsx("style",{children:`
|
|
827
|
+
`);D(Je=>[...Je,{type:"assistant",content:"",timestamp:new Date,isToolUse:!0,toolName:"FileChanges",toolInput:ye,toolResult:`Status: ${_t.status}`}])}break;case"mcp_tool_call":D(ye=>[...ye,{type:"assistant",content:"",timestamp:new Date,isToolUse:!0,toolName:`${_t.server}:${_t.tool}`,toolInput:JSON.stringify(_t.arguments,null,2),toolResult:_t.result?JSON.stringify(_t.result,null,2):_t.error?.message||null}]);break;case"error":_t.message?.content&&D(ye=>[...ye,{type:"error",content:_t.message.content,timestamp:new Date}]);break;default:console.log("[Codex] Unhandled item type:",_t.itemType,_t)}_t.type==="turn_complete"&&U(!1),_t.type==="turn_failed"&&(U(!1),D(ye=>[...ye,{type:"error",content:_t.error?.message||"Turn failed",timestamp:new Date}]))}break;case"codex-complete":const Lr=O.sessionId||G||sessionStorage.getItem("pendingSessionId");(Lr===G||!G)&&(U(!1),bt(!1),qr(null)),Lr&&(c&&c(Lr),u&&u(Lr));const $a=sessionStorage.getItem("pendingSessionId"),Or=O.actualSessionId||$a;$a&&!G&&(re(Or),ct(!0),m&&m(Or),sessionStorage.removeItem("pendingSessionId"),console.log("Codex session complete, ID set to:",$a)),e&&vr.removeItem(`chat_messages_${e.name}`);break;case"codex-error":U(!1),bt(!1),D(ye=>[...ye,{type:"error",content:O.error||"An error occurred with Codex",timestamp:new Date}]);break;case"session-aborted":{const ye=O.sessionId||G;ye===G&&(U(!1),bt(!1),qr(null)),ye&&(c&&c(ye),u&&u(ye)),et([]),D(Je=>[...Je,{type:"assistant",content:"Session interrupted by user.",timestamp:new Date}]);break}case"session-status":{const ye=O.sessionId;(ye===G||t&&ye===t.id)&&O.isProcessing&&(U(!0),bt(!0),d&&d(ye));break}case"claude-status":const ur=O.data;if(ur){let ye={text:"Working...",tokens:0,can_interrupt:!0};ur.message?ye.text=ur.message:ur.status?ye.text=ur.status:typeof ur=="string"&&(ye.text=ur),ur.tokens?ye.tokens=ur.tokens:ur.token_count&&(ye.tokens=ur.token_count),ur.can_interrupt!==void 0&&(ye.can_interrupt=ur.can_interrupt),qr(ye),U(!0),bt(ye.can_interrupt)}break}}},[i]),x.useEffect(()=>{e&&k3()},[e]);const k3=async()=>{try{const O=await yt.getFiles(e.name);if(O.ok){const V=await O.json(),ee=Xg(V);Fe(ee)}}catch(O){console.error("Error fetching files:",O)}},Xg=(O,V="")=>{let ee=[];for(const ne of O){const pe=V?`${V}/${ne.name}`:ne.name;ne.type==="directory"&&ne.children?ee=ee.concat(Xg(ne.children,pe)):ne.type==="file"&&ee.push({name:ne.name,path:pe,relativePath:ne.path})}return ee};x.useEffect(()=>{const O=T.slice(0,_n),V=O.lastIndexOf("@");if(V!==-1){const ee=O.slice(V+1);if(ee.includes(" "))Qe(!1),ge(-1);else{ge(V),Qe(!0);const ne=J.filter(pe=>pe.name.toLowerCase().includes(ee.toLowerCase())||pe.path.toLowerCase().includes(ee.toLowerCase())).slice(0,10);he(ne),nr(-1)}}else Qe(!1),ge(-1)},[T,_n,J]);const Wo=x.useMemo(()=>!T||Ke.length===0?[]:Ke.filter(O=>T.includes(O)),[Ke,T]),Ti=x.useMemo(()=>Wo.length===0?[]:Array.from(new Set(Wo)).sort((V,ee)=>ee.length-V.length),[Wo]),Vo=x.useMemo(()=>{if(Ti.length===0)return null;const O=Ti.map(Aq).join("|");return new RegExp(`(${O})`,"g")},[Ti]),Zg=x.useMemo(()=>new Set(Ti),[Ti]),w3=x.useCallback(O=>O?Vo?O.split(Vo).map((ee,ne)=>Zg.has(ee)?a.jsx("span",{className:"bg-blue-200/70 -ml-0.5 dark:bg-blue-300/40 px-0.5 rounded-md box-decoration-clone text-transparent",children:ee},`mention-${ne}`):a.jsx("span",{children:ee},`text-${ne}`)):O:"",[Vo,Zg]);x.useEffect(()=>{const O=setTimeout(()=>{Ue(T)},150);return()=>clearTimeout(O)},[T]);const Jg=x.useMemo(()=>q.length<=ya?q:q.slice(-ya),[q,ya]);x.useEffect(()=>{if(!k&&ve.current){const O=ve.current;Zr.current={height:O.scrollHeight,top:O.scrollTop}}}),x.useEffect(()=>{if(ve.current&&q.length>0)if(k)hr||setTimeout(()=>Mn(),50);else{const O=ve.current,V=Zr.current.height,ee=Zr.current.top,pe=O.scrollHeight-V;pe>0&&ee>0&&(O.scrollTop=ee+pe)}},[q.length,hr,Mn,k]),x.useEffect(()=>{ve.current&&q.length>0&&!Ve.current&&(ar(!1),setTimeout(()=>{Mn()},200))},[t?.id,e?.name]),x.useEffect(()=>{const O=ve.current;if(O)return O.addEventListener("scroll",Ci),()=>O.removeEventListener("scroll",Ci)},[Ci]),x.useEffect(()=>{if(H.current){H.current.style.height="auto",H.current.style.height=H.current.scrollHeight+"px";const O=parseInt(window.getComputedStyle(H.current).lineHeight),V=H.current.scrollHeight>O*2;gn(V)}},[]),x.useEffect(()=>{H.current&&!T.trim()&&(H.current.style.height="auto",gn(!1))},[T]),x.useEffect(()=>{if(!e||!t?.id||t.id.startsWith("new-session-")){On(null);return}if((t.__provider||"claude")!=="claude")return;(async()=>{try{const ee=`/api/projects/${e.name}/sessions/${t.id}/token-usage`,ne=await Ce(ee);if(ne.ok){const pe=await ne.json();On(pe)}else On(null)}catch(ee){console.error("Failed to fetch initial token usage:",ee)}})()},[t?.id,t?.__provider,e?.path]);const S3=x.useCallback(O=>{O.trim()&&P(V=>{const ee=V.trim()?`${V} ${O}`:O;return setTimeout(()=>{if(H.current){H.current.style.height="auto",H.current.style.height=H.current.scrollHeight+"px";const ne=parseInt(window.getComputedStyle(H.current).lineHeight),pe=H.current.scrollHeight>ne*2;gn(pe)}},0),ee})},[]),E3=x.useCallback(()=>{qo(O=>O+100)},[]),vs=x.useCallback(O=>{const V=O.filter(ee=>{try{if(!ee||typeof ee!="object")return console.warn("Invalid file object:",ee),!1;if(!ee.type||!ee.type.startsWith("image/"))return!1;if(!ee.size||ee.size>5242880){const ne=ee.name||"Unknown file";return ce(pe=>{const Le=new Map(pe);return Le.set(ne,"File too large (max 5MB)"),Le}),!1}return!0}catch(ne){return console.error("Error validating file:",ne,ee),!1}});V.length>0&&mt(ee=>[...ee,...V].slice(0,5))},[]),N3=x.useCallback(async O=>{const V=Array.from(O.clipboardData.items);for(const ee of V)if(ee.type.startsWith("image/")){const ne=ee.getAsFile();ne&&vs([ne])}if(V.length===0&&O.clipboardData.files.length>0){const ne=Array.from(O.clipboardData.files).filter(pe=>pe.type.startsWith("image/"));ne.length>0&&vs(ne)}},[vs]),{getRootProps:C3,getInputProps:T3,isDragActive:A3,open:I3}=AN({accept:{"image/*":[".png",".jpg",".jpeg",".gif",".webp",".svg"]},maxSize:5*1024*1024,maxFiles:5,onDrop:vs,noClick:!0,noKeyboard:!0}),va=x.useCallback(async O=>{if(O.preventDefault(),!T.trim()||z||!e)return;let V=T;const ee=jN.find(lt=>lt.id===Dn);ee&&ee.prefix&&(V=`${ee.prefix}: ${T}`);let ne=[];if(Me.length>0){const lt=new FormData;Me.forEach(Lt=>{lt.append("images",Lt)});try{const Lt=await Ce(`/api/projects/${e.name}/upload-images`,{method:"POST",headers:{},body:lt});if(!Lt.ok)throw new Error("Failed to upload images");ne=(await Lt.json()).images}catch(Lt){console.error("Image upload failed:",Lt),D(fr=>[...fr,{type:"error",content:`Failed to upload images: ${Lt.message}`,timestamp:new Date}]);return}}const pe={type:"user",content:T,images:ne,timestamp:new Date};D(lt=>[...lt,pe]),U(!0),bt(!0),qr({text:"Processing",tokens:0,can_interrupt:!0}),ar(!1),setTimeout(()=>Mn(),100);const Le=G||t?.id||sessionStorage.getItem("cursorSessionId"),ot=Le||`new-session-${Date.now()}`;!Le&&!t?.id&&(je.current={sessionId:null,startedAt:Date.now()}),l&&l(ot);const kt=(()=>{try{const lt=vt==="cursor"?"cursor-tools-settings":vt==="codex"?"codex-settings":"claude-settings",Lt=vr.getItem(lt);if(Lt)return JSON.parse(Lt)}catch(lt){console.error("Error loading tools settings:",lt)}return{allowedTools:[],disallowedTools:[],skipPermissions:!1}})();n(vt==="cursor"?{type:"cursor-command",command:V,sessionId:Le,options:{cwd:e.fullPath||e.path,projectPath:e.fullPath||e.path,sessionId:Le,resume:!!Le,model:na,skipPermissions:kt?.skipPermissions||!1,toolsSettings:kt}}:vt==="codex"?{type:"codex-command",command:V,sessionId:Le,options:{cwd:e.fullPath||e.path,projectPath:e.fullPath||e.path,sessionId:Le,resume:!!Le,model:de,permissionMode:Ye==="plan"?"default":Ye}}:{type:"claude-command",command:V,options:{projectPath:e.path,cwd:e.fullPath,sessionId:G,resume:!!G,toolsSettings:kt,permissionMode:Ye,model:dn,images:ne}}),P(""),mt([]),xe(new Map),ce(new Map),gn(!1),Ei("none"),H.current&&(H.current.style.height="auto"),e&&vr.removeItem(`draft_input_${e.name}`)},[T,z,e,Me,G,t,vt,Ye,l,na,dn,de,n,P,mt,xe,ce,gn,H,D,U,bt,qr,ar,Mn,Dn]),Qg=x.useCallback(O=>!O||vt!=="claude"?{success:!1}:Rq(O.entry),[vt]),Ko=x.useCallback((O,V)=>{const ne=(Array.isArray(O)?O:[O]).filter(Boolean);ne.length!==0&&(ne.forEach(pe=>{n({type:"claude-permission-response",requestId:pe,allow:!!V?.allow,updatedInput:V?.updatedInput,message:V?.message,rememberEntry:V?.rememberEntry})}),et(pe=>{const Le=pe.filter(ot=>!ne.includes(ot.requestId));return Le.length===0&&qr(null),Le}))},[n]);x.useEffect(()=>{Ho.current=va},[va]);const ef=O=>{if(!O)return;const V=T.slice(0,Si),ee=T.slice(Si),ne=ee.indexOf(" "),pe=ne!==-1?ee.slice(ne):"",Le=V+O.name+" "+pe;P(Le),cn(!1),fn(-1),_r(""),Jr(-1),Te.current&&clearTimeout(Te.current),Vg(O)},R3=O=>{if(Ut&&Ln.length>0){if(O.key==="ArrowDown"){O.preventDefault(),Jr(V=>V<Ln.length-1?V+1:0);return}if(O.key==="ArrowUp"){O.preventDefault(),Jr(V=>V>0?V-1:Ln.length-1);return}if(O.key==="Tab"||O.key==="Enter"){O.preventDefault(),za>=0?ef(Ln[za]):Ln.length>0&&ef(Ln[0]);return}if(O.key==="Escape"){O.preventDefault(),cn(!1),fn(-1),_r(""),Jr(-1),Te.current&&clearTimeout(Te.current);return}}if(st&&dt.length>0){if(O.key==="ArrowDown"){O.preventDefault(),nr(V=>V<dt.length-1?V+1:0);return}if(O.key==="ArrowUp"){O.preventDefault(),nr(V=>V>0?V-1:dt.length-1);return}if(O.key==="Tab"||O.key==="Enter"){O.preventDefault(),zt>=0?Yo(dt[zt]):dt.length>0&&Yo(dt[0]);return}if(O.key==="Escape"){O.preventDefault(),Qe(!1);return}}if(O.key==="Tab"&&!st&&!Ut){O.preventDefault();const V=vt==="codex"?["default","acceptEdits","bypassPermissions"]:["default","acceptEdits","bypassPermissions","plan"],ne=(V.indexOf(Ye)+1)%V.length,pe=V[ne];wt(pe),t?.id&&localStorage.setItem(`permissionMode-${t.id}`,pe);return}if(O.key==="Enter"){if(O.nativeEvent.isComposing)return;(O.ctrlKey||O.metaKey)&&!O.shiftKey?(O.preventDefault(),va(O)):!O.shiftKey&&!O.ctrlKey&&!O.metaKey&&(E||(O.preventDefault(),va(O)))}},Yo=O=>{const V=T.slice(0,ae),ee=T.slice(ae),ne=ee.indexOf(" "),pe=ne!==-1?ee.slice(ne):"",Le=V+O.path+" "+pe,ot=V.length+O.path.length+1;H.current&&!H.current.matches(":focus")&&H.current.focus(),P(Le),xr(ot),Ge(Ct=>Ct.includes(O.path)?Ct:[...Ct,O.path]),Qe(!1),ge(-1),H.current&&requestAnimationFrame(()=>{H.current&&(H.current.setSelectionRange(ot,ot),H.current.matches(":focus")||H.current.focus())})},j3=O=>{const V=O.target.value,ee=O.target.selectionStart;if(!G&&V.trim(),P(V),xr(ee),!V.trim()){O.target.style.height="auto",gn(!1),cn(!1),fn(-1),_r("");return}const ne=V.slice(0,ee);if((ne.match(/```/g)||[]).length%2===1){cn(!1),fn(-1),_r("");return}const ot=/(^|\s)\/(\S*)$/,Ct=ne.match(ot);if(Ct){const kt=Ct.index+Ct[1].length,lt=Ct[2];fn(kt),cn(!0),Jr(-1),Te.current&&clearTimeout(Te.current),Te.current=setTimeout(()=>{_r(lt)},150)}else cn(!1),fn(-1),_r(""),Te.current&&clearTimeout(Te.current)},tf=x.useCallback(O=>{!le.current||!O||(le.current.scrollTop=O.scrollTop,le.current.scrollLeft=O.scrollLeft)},[]),_3=O=>{xr(O.target.selectionStart)},L3=()=>{G&&tt&&n({type:"abort-session",sessionId:G,provider:vt})},O3=()=>{const O=vt==="codex"?["default","acceptEdits","bypassPermissions"]:["default","acceptEdits","bypassPermissions","plan"],ee=(O.indexOf(Ye)+1)%O.length,ne=O[ee];wt(ne),t?.id&&localStorage.setItem(`permissionMode-${t.id}`,ne)};return e?a.jsxs(a.Fragment,{children:[a.jsx("style",{children:`
|
|
828
828
|
details[open] .details-chevron {
|
|
829
829
|
transform: rotate(180deg);
|
|
830
830
|
}
|
|
831
|
-
`}),a.jsxs("div",{className:"h-full flex flex-col",children:[a.jsxs("div",{ref:ve,onWheel:Ci,onTouchMove:Ci,className:"flex-1 overflow-y-auto overflow-x-hidden px-0 py-3 sm:p-4 space-y-3 sm:space-y-4 relative",children:[te&&q.length===0?a.jsx("div",{className:"text-center text-gray-500 dark:text-gray-400 mt-8",children:a.jsxs("div",{className:"flex items-center justify-center space-x-2",children:[a.jsx("div",{className:"animate-spin rounded-full h-4 w-4 border-b-2 border-gray-400"}),a.jsx("p",{children:j("session.loading.sessionMessages")})]})}):q.length===0?a.jsxs("div",{className:"flex items-center justify-center h-full",children:[!t&&!G&&a.jsxs("div",{className:"text-center px-6 sm:px-4 py-8",children:[a.jsx("h2",{className:"text-2xl font-bold text-gray-900 dark:text-white mb-3",children:j("providerSelection.title")}),a.jsx("p",{className:"text-gray-600 dark:text-gray-400 mb-8",children:j("providerSelection.description")}),a.jsxs("div",{className:"flex flex-col sm:flex-row gap-4 justify-center items-center mb-8",children:[a.jsxs("button",{onClick:()=>{Ua("claude"),localStorage.setItem("selected-provider","claude"),setTimeout(()=>H.current?.focus(),100)},className:`group relative w-64 h-32 bg-white dark:bg-gray-800 rounded-xl border-2 transition-all duration-200 hover:scale-105 hover:shadow-xl ${vt==="claude"?"border-blue-500 shadow-lg ring-2 ring-blue-500/20":"border-gray-200 dark:border-gray-700 hover:border-blue-400"}`,children:[a.jsxs("div",{className:"flex flex-col items-center justify-center h-full gap-3",children:[a.jsx(nn,{className:"w-10 h-10"}),a.jsxs("div",{children:[a.jsx("p",{className:"font-semibold text-gray-900 dark:text-white",children:"Claude Code"}),a.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:j("providerSelection.providerInfo.anthropic")})]})]}),vt==="claude"&&a.jsx("div",{className:"absolute top-2 right-2",children:a.jsx("div",{className:"w-5 h-5 bg-blue-500 rounded-full flex items-center justify-center",children:a.jsx("svg",{className:"w-3 h-3 text-white",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:3,d:"M5 13l4 4L19 7"})})})})]}),a.jsxs("button",{onClick:()=>{Ua("cursor"),localStorage.setItem("selected-provider","cursor"),setTimeout(()=>H.current?.focus(),100)},className:`group relative w-64 h-32 bg-white dark:bg-gray-800 rounded-xl border-2 transition-all duration-200 hover:scale-105 hover:shadow-xl ${vt==="cursor"?"border-purple-500 shadow-lg ring-2 ring-purple-500/20":"border-gray-200 dark:border-gray-700 hover:border-purple-400"}`,children:[a.jsxs("div",{className:"flex flex-col items-center justify-center h-full gap-3",children:[a.jsx(pn,{className:"w-10 h-10"}),a.jsxs("div",{children:[a.jsx("p",{className:"font-semibold text-gray-900 dark:text-white",children:"Cursor"}),a.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:j("providerSelection.providerInfo.cursorEditor")})]})]}),vt==="cursor"&&a.jsx("div",{className:"absolute top-2 right-2",children:a.jsx("div",{className:"w-5 h-5 bg-purple-500 rounded-full flex items-center justify-center",children:a.jsx("svg",{className:"w-3 h-3 text-white",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:3,d:"M5 13l4 4L19 7"})})})})]}),a.jsxs("button",{onClick:()=>{Ua("codex"),localStorage.setItem("selected-provider","codex"),setTimeout(()=>H.current?.focus(),100)},className:`group relative w-64 h-32 bg-white dark:bg-gray-800 rounded-xl border-2 transition-all duration-200 hover:scale-105 hover:shadow-xl ${vt==="codex"?"border-gray-800 dark:border-gray-300 shadow-lg ring-2 ring-gray-800/20 dark:ring-gray-300/20":"border-gray-200 dark:border-gray-700 hover:border-gray-500 dark:hover:border-gray-400"}`,children:[a.jsxs("div",{className:"flex flex-col items-center justify-center h-full gap-3",children:[a.jsx(wn,{className:"w-10 h-10"}),a.jsxs("div",{children:[a.jsx("p",{className:"font-semibold text-gray-900 dark:text-white",children:"Codex"}),a.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:j("providerSelection.providerInfo.openai")})]})]}),vt==="codex"&&a.jsx("div",{className:"absolute top-2 right-2",children:a.jsx("div",{className:"w-5 h-5 bg-gray-800 dark:bg-gray-300 rounded-full flex items-center justify-center",children:a.jsx("svg",{className:"w-3 h-3 text-white dark:text-gray-800",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:3,d:"M5 13l4 4L19 7"})})})})]})]}),a.jsxs("div",{className:`mb-6 transition-opacity duration-200 ${vt?"opacity-100":"opacity-0 pointer-events-none"}`,children:[a.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:j("providerSelection.selectModel")}),vt==="claude"?a.jsx("select",{value:dn,onChange:O=>{const V=O.target.value;X(V),localStorage.setItem("claude-model",V)},className:"pl-4 pr-10 py-2 text-sm bg-white dark:bg-gray-800 border border-gray-300 dark:border-gray-600 rounded-lg focus:ring-2 focus:ring-purple-500 focus:border-purple-500 min-w-[140px]",children:T2.OPTIONS.map(({value:O,label:V})=>a.jsx("option",{value:O,children:V},O))}):vt==="codex"?a.jsx("select",{value:ce,onChange:O=>{const V=O.target.value;Re(V),localStorage.setItem("codex-model",V)},className:"pl-4 pr-10 py-2 text-sm bg-white dark:bg-gray-800 border border-gray-300 dark:border-gray-600 rounded-lg focus:ring-2 focus:ring-gray-500 focus:border-gray-500 min-w-[140px]",children:I2.OPTIONS.map(({value:O,label:V})=>a.jsx("option",{value:O,children:V},O))}):a.jsx("select",{value:na,onChange:O=>{const V=O.target.value;bs(V),localStorage.setItem("cursor-model",V)},className:"pl-4 pr-10 py-2 text-sm bg-white dark:bg-gray-800 border border-gray-300 dark:border-gray-600 rounded-lg focus:ring-2 focus:ring-purple-500 focus:border-purple-500 min-w-[140px]",disabled:vt!=="cursor",children:A2.OPTIONS.map(({value:O,label:V})=>a.jsx("option",{value:O,children:V},O))})]}),a.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400",children:vt==="claude"?j("providerSelection.readyPrompt.claude",{model:dn}):vt==="cursor"?j("providerSelection.readyPrompt.cursor",{model:na}):vt==="codex"?j("providerSelection.readyPrompt.codex",{model:ce}):j("providerSelection.readyPrompt.default")}),vt&&I&&M&&a.jsx("div",{className:"mt-4 px-4 sm:px-0",children:a.jsx(k2,{onStartTask:()=>P("Start the next task"),onShowAllTasks:v})})]}),t&&a.jsxs("div",{className:"text-center text-gray-500 dark:text-gray-400 px-6 sm:px-4",children:[a.jsx("p",{className:"font-bold text-lg sm:text-xl mb-3",children:j("session.continue.title")}),a.jsx("p",{className:"text-sm sm:text-base leading-relaxed",children:j("session.continue.description")}),I&&M&&a.jsx("div",{className:"mt-4 px-4 sm:px-0",children:a.jsx(k2,{onStartTask:()=>P("Start the next task"),onShowAllTasks:v})})]})]}):a.jsxs(a.Fragment,{children:[Z&&a.jsx("div",{className:"text-center text-gray-500 dark:text-gray-400 py-3",children:a.jsxs("div",{className:"flex items-center justify-center space-x-2",children:[a.jsx("div",{className:"animate-spin rounded-full h-4 w-4 border-b-2 border-gray-400"}),a.jsx("p",{className:"text-sm",children:j("session.loading.olderMessages")})]})}),_e&&!Z&&a.jsx("div",{className:"text-center text-gray-500 dark:text-gray-400 text-sm py-2 border-b border-gray-200 dark:border-gray-700",children:fe>0&&a.jsxs("span",{children:[j("session.messages.showingOf",{shown:R.length,total:fe})," •",a.jsx("span",{className:"text-xs",children:j("session.messages.scrollToLoad")})]})}),!_e&&q.length>ya&&a.jsxs("div",{className:"text-center text-gray-500 dark:text-gray-400 text-sm py-2 border-b border-gray-200 dark:border-gray-700",children:[j("session.messages.showingLast",{count:ya,total:q.length})," •",a.jsx("button",{className:"ml-1 text-blue-600 hover:text-blue-700 underline",onClick:E3,children:j("session.messages.loadEarlier")})]}),Jg.map((O,V)=>{const ee=V>0?Jg[V-1]:null;return a.jsx(Lq,{message:O,index:V,prevMessage:ee,createDiff:x3,onFileOpen:s,onShowSettings:g,onGrantToolPermission:Qg,autoExpandTools:f,showRawParameters:w,showThinking:S,selectedProject:e,provider:vt},V)})]}),z&&a.jsx("div",{className:"chat-message assistant",children:a.jsxs("div",{className:"w-full",children:[a.jsxs("div",{className:"flex items-center space-x-3 mb-2",children:[a.jsx("div",{className:"w-8 h-8 rounded-full flex items-center justify-center text-white text-sm flex-shrink-0 p-1 bg-transparent",children:(localStorage.getItem("selected-provider")||"claude")==="cursor"?a.jsx(pn,{className:"w-full h-full"}):(localStorage.getItem("selected-provider")||"claude")==="codex"?a.jsx(wn,{className:"w-full h-full"}):a.jsx(nn,{className:"w-full h-full"})}),a.jsx("div",{className:"text-sm font-medium text-gray-900 dark:text-white",children:(localStorage.getItem("selected-provider")||"claude")==="cursor"?"Cursor":(localStorage.getItem("selected-provider")||"claude")==="codex"?"Codex":"Claude"})]}),a.jsx("div",{className:"w-full text-sm text-gray-500 dark:text-gray-400 pl-3 sm:pl-0",children:a.jsxs("div",{className:"flex items-center space-x-1",children:[a.jsx("div",{className:"animate-pulse",children:"●"}),a.jsx("div",{className:"animate-pulse",style:{animationDelay:"0.2s"},children:"●"}),a.jsx("div",{className:"animate-pulse",style:{animationDelay:"0.4s"},children:"●"}),a.jsx("span",{className:"ml-2",children:"Thinking..."})]})})]})}),a.jsx("div",{ref:Ee})]}),a.jsxs("div",{className:"p-2 sm:p-4 md:p-4 flex-shrink-0 pb-2 sm:pb-4 md:pb-6",children:[a.jsx("div",{className:"flex-1",children:a.jsx(F$,{status:Go,isLoading:z,onAbort:L3,provider:vt,showThinking:S})}),a.jsxs("div",{ref:Y,className:"max-w-4xl mx-auto mb-3",children:[gt.length>0&&a.jsx("div",{className:"mb-3 space-y-2",children:gt.map(O=>{const V=R2(O.input),ee=Ch(O.toolName,V),ne=Ug(),pe=ee?ne.allowedTools.includes(ee):!1,Le=pe?"Allow (saved)":"Allow & remember",ot=ee?gt.filter(Ct=>Ch(Ct.toolName,R2(Ct.input))===ee).map(Ct=>Ct.requestId):[O.requestId];return a.jsxs("div",{className:"rounded-lg border border-amber-200 dark:border-amber-800 bg-amber-50 dark:bg-amber-900/20 p-3 shadow-sm",children:[a.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[a.jsxs("div",{children:[a.jsx("div",{className:"text-sm font-semibold text-amber-900 dark:text-amber-100",children:"Permission required"}),a.jsxs("div",{className:"text-xs text-amber-800 dark:text-amber-200",children:["Tool: ",a.jsx("span",{className:"font-mono",children:O.toolName})]})]}),ee&&a.jsxs("div",{className:"text-xs text-amber-700 dark:text-amber-300",children:["Allow rule: ",a.jsx("span",{className:"font-mono",children:ee})]})]}),V&&a.jsxs("details",{className:"mt-2",children:[a.jsx("summary",{className:"cursor-pointer text-xs text-amber-800 dark:text-amber-200 hover:text-amber-900 dark:hover:text-amber-100",children:"View tool input"}),a.jsx("pre",{className:"mt-2 max-h-40 overflow-auto rounded-md bg-white/80 dark:bg-gray-900/60 border border-amber-200/60 dark:border-amber-800/60 p-2 text-xs text-amber-900 dark:text-amber-100 whitespace-pre-wrap",children:V})]}),a.jsxs("div",{className:"mt-3 flex flex-wrap gap-2",children:[a.jsx("button",{type:"button",onClick:()=>Ko(O.requestId,{allow:!0}),className:"inline-flex items-center gap-2 rounded-md bg-amber-600 text-white text-xs font-medium px-3 py-1.5 hover:bg-amber-700 transition-colors",children:"Allow once"}),a.jsx("button",{type:"button",onClick:()=>{ee&&!pe&&Qg({entry:ee,toolName:O.toolName}),Ko(ot,{allow:!0,rememberEntry:ee})},className:`inline-flex items-center gap-2 rounded-md text-xs font-medium px-3 py-1.5 border transition-colors ${ee?"border-amber-300 text-amber-800 hover:bg-amber-100 dark:border-amber-700 dark:text-amber-100 dark:hover:bg-amber-900/30":"border-gray-300 text-gray-400 cursor-not-allowed"}`,disabled:!ee,children:Le}),a.jsx("button",{type:"button",onClick:()=>Ko(O.requestId,{allow:!1,message:"User denied tool use"}),className:"inline-flex items-center gap-2 rounded-md text-xs font-medium px-3 py-1.5 border border-red-300 text-red-700 hover:bg-red-50 dark:border-red-800 dark:text-red-200 dark:hover:bg-red-900/30 transition-colors",children:"Deny"})]})]},O.requestId)})}),a.jsxs("div",{className:"flex items-center justify-center gap-3",children:[a.jsx("button",{type:"button",onClick:O3,className:`px-3 py-1.5 rounded-lg text-sm font-medium border transition-all duration-200 ${Ye==="default"?"bg-gray-100 dark:bg-gray-700 text-gray-700 dark:text-gray-300 border-gray-300 dark:border-gray-600 hover:bg-gray-200 dark:hover:bg-gray-600":Ye==="acceptEdits"?"bg-green-50 dark:bg-green-900/20 text-green-700 dark:text-green-300 border-green-300 dark:border-green-600 hover:bg-green-100 dark:hover:bg-green-900/30":Ye==="bypassPermissions"?"bg-orange-50 dark:bg-orange-900/20 text-orange-700 dark:text-orange-300 border-orange-300 dark:border-orange-600 hover:bg-orange-100 dark:hover:bg-orange-900/30":"bg-blue-50 dark:bg-blue-900/20 text-blue-700 dark:text-blue-300 border-blue-300 dark:border-blue-600 hover:bg-blue-100 dark:hover:bg-blue-900/30"}`,title:j("input.clickToChangeMode"),children:a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("div",{className:`w-2 h-2 rounded-full ${Ye==="default"?"bg-gray-500":Ye==="acceptEdits"?"bg-green-500":Ye==="bypassPermissions"?"bg-orange-500":"bg-blue-500"}`}),a.jsxs("span",{children:[Ye==="default"&&j("codex.modes.default"),Ye==="acceptEdits"&&j("codex.modes.acceptEdits"),Ye==="bypassPermissions"&&j("codex.modes.bypassPermissions"),Ye==="plan"&&j("codex.modes.plan")]})]})}),vt==="claude"&&a.jsx(z$,{selectedMode:Dn,onModeChange:Ei,className:""}),a.jsx(P$,{used:Ba?.used||0,total:Ba?.total||parseInt("160000")||16e4}),a.jsxs("button",{type:"button",onClick:()=>{const O=!Ut;cn(O),_r(""),Jr(-1),O&&Pa(jr),H.current&&H.current.focus()},className:"relative w-8 h-8 text-gray-500 hover:text-gray-700 dark:text-gray-400 dark:hover:text-gray-200 rounded-full flex items-center justify-center transition-colors focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2 dark:ring-offset-gray-800",title:j("input.showAllCommands"),children:[a.jsx("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M7 8h10M7 12h4m1 8l-4-4H5a2 2 0 01-2-2V6a2 2 0 012-2h14a2 2 0 012 2v8a2 2 0 01-2 2h-3l-4 4z"})}),jr.length>0&&a.jsx("span",{className:"absolute -top-1 -right-1 bg-blue-600 text-white text-xs font-bold rounded-full w-5 h-5 flex items-center justify-center",style:{fontSize:"10px"},children:jr.length})]}),T.trim()&&a.jsx("button",{type:"button",onClick:O=>{O.preventDefault(),O.stopPropagation(),P(""),H.current&&(H.current.style.height="auto",H.current.focus()),gn(!1)},className:"w-8 h-8 bg-white dark:bg-gray-800 hover:bg-gray-100 dark:hover:bg-gray-700 border border-gray-300 dark:border-gray-600 rounded-full flex items-center justify-center transition-all duration-200 group shadow-sm",title:"Clear input",children:a.jsx("svg",{className:"w-4 h-4 text-gray-600 dark:text-gray-300 group-hover:text-gray-800 dark:group-hover:text-gray-100 transition-colors",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})}),hr&&q.length>0&&a.jsx("button",{onClick:Mn,className:"w-8 h-8 bg-blue-600 hover:bg-blue-700 text-white rounded-full shadow-lg flex items-center justify-center transition-all duration-200 hover:scale-105 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2 dark:ring-offset-gray-800",title:"Scroll to bottom",children:a.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 14l-7 7m0 0l-7-7m7 7V3"})})})]})]}),a.jsxs("form",{onSubmit:va,className:"relative max-w-4xl mx-auto",children:[A3&&a.jsx("div",{className:"absolute inset-0 bg-blue-500/20 border-2 border-dashed border-blue-500 rounded-lg flex items-center justify-center z-50",children:a.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg p-4 shadow-lg",children:[a.jsx("svg",{className:"w-8 h-8 text-blue-500 mx-auto mb-2",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:a.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.9M15 13l-3-3m0 0l-3 3m3-3v12"})}),a.jsx("p",{className:"text-sm font-medium",children:"Drop images here"})]})}),Me.length>0&&a.jsx("div",{className:"mb-2 p-2 bg-gray-50 dark:bg-gray-800 rounded-lg",children:a.jsx("div",{className:"flex flex-wrap gap-2",children:Me.map((O,V)=>a.jsx(Oq,{file:O,onRemove:()=>{mt(ee=>ee.filter((ne,pe)=>pe!==V))},uploadProgress:Pt.get(O.name),error:at.get(O.name)},V))})}),st&&dt.length>0&&a.jsx("div",{className:"absolute bottom-full left-0 right-0 mb-2 bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-600 rounded-lg shadow-lg max-h-48 overflow-y-auto z-50 backdrop-blur-sm",children:dt.map((O,V)=>a.jsxs("div",{className:`px-4 py-3 cursor-pointer border-b border-gray-100 dark:border-gray-700 last:border-b-0 touch-manipulation ${V===zt?"bg-blue-50 dark:bg-blue-900/20 text-blue-700 dark:text-blue-300":"hover:bg-gray-50 dark:hover:bg-gray-700 text-gray-700 dark:text-gray-300"}`,onMouseDown:ee=>{ee.preventDefault(),ee.stopPropagation()},onClick:ee=>{ee.preventDefault(),ee.stopPropagation(),Yo(O)},children:[a.jsx("div",{className:"font-medium text-sm",children:O.name}),a.jsx("div",{className:"text-xs text-gray-500 dark:text-gray-400 font-mono",children:O.path})]},O.path))}),a.jsx(Cq,{commands:Ln,selectedIndex:za,onSelect:g3,onClose:()=>{cn(!1),fn(-1),_r(""),Jr(-1)},position:{top:H.current?Math.max(16,H.current.getBoundingClientRect().top-316):0,left:H.current?H.current.getBoundingClientRect().left:16,bottom:H.current?window.innerHeight-H.current.getBoundingClientRect().top+8:90},isOpen:Ut,frequentCommands:ra?[]:h3}),a.jsxs("div",{...C3(),className:`relative bg-white dark:bg-gray-800 rounded-2xl shadow-lg border border-gray-200 dark:border-gray-600 focus-within:ring-2 focus-within:ring-blue-500 dark:focus-within:ring-blue-500 focus-within:border-blue-500 transition-all duration-200 overflow-hidden ${fs?"chat-input-expanded":""}`,children:[a.jsx("input",{...T3()}),a.jsx("div",{ref:le,"aria-hidden":"true",className:"absolute inset-0 pointer-events-none overflow-hidden rounded-2xl",children:a.jsx("div",{className:"chat-input-placeholder block w-full pl-12 pr-20 sm:pr-40 py-1.5 sm:py-4 text-transparent text-base leading-6 whitespace-pre-wrap break-words",children:w3(T)})}),a.jsxs("div",{className:"relative z-10",children:[a.jsx("textarea",{ref:H,value:T,onChange:j3,onClick:_3,onKeyDown:R3,onPaste:N3,onScroll:O=>tf(O.target),onFocus:()=>ue(!0),onBlur:()=>ue(!1),onInput:O=>{O.target.style.height="auto",O.target.style.height=O.target.scrollHeight+"px",xr(O.target.selectionStart),tf(O.target);const V=parseInt(window.getComputedStyle(O.target).lineHeight),ee=O.target.scrollHeight>V*2;gn(ee)},placeholder:j("input.placeholder",{provider:j(vt==="cursor"?"messageTypes.cursor":vt==="codex"?"messageTypes.codex":"messageTypes.claude")}),disabled:z,className:"chat-input-placeholder block w-full pl-12 pr-20 sm:pr-40 py-1.5 sm:py-4 bg-transparent rounded-2xl focus:outline-none text-gray-900 dark:text-gray-100 placeholder-gray-400 dark:placeholder-gray-500 disabled:opacity-50 resize-none min-h-[50px] sm:min-h-[80px] max-h-[40vh] sm:max-h-[300px] overflow-y-auto text-base leading-6 transition-all duration-200",style:{height:"50px"}}),a.jsx("button",{type:"button",onClick:I3,className:"absolute left-2 top-1/2 transform -translate-y-1/2 p-2 hover:bg-gray-100 dark:hover:bg-gray-700 rounded-lg transition-colors",title:j("input.attachImages"),children:a.jsx("svg",{className:"w-5 h-5 text-gray-500",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 16l4.586-4.586a2 2 0 012.828 0L16 16m-2-2l1.586-1.586a2 2 0 012.828 0L20 14m-6-6h.01M6 20h12a2 2 0 002-2V6a2 2 0 00-2-2H6a2 2 0 00-2 2v12a2 2 0 002 2z"})})}),a.jsx("div",{className:"absolute right-16 sm:right-16 top-1/2 transform -translate-y-1/2",style:{display:"none"},children:a.jsx(RN,{onTranscript:S3,className:"w-10 h-10 sm:w-10 sm:h-10"})}),a.jsx("button",{type:"submit",disabled:!T.trim()||z,onMouseDown:O=>{O.preventDefault(),va(O)},onTouchStart:O=>{O.preventDefault(),va(O)},className:"absolute right-2 top-1/2 transform -translate-y-1/2 w-12 h-12 sm:w-12 sm:h-12 bg-blue-600 hover:bg-blue-700 disabled:bg-gray-400 disabled:cursor-not-allowed rounded-full flex items-center justify-center transition-colors focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2 dark:ring-offset-gray-800",children:a.jsx("svg",{className:"w-4 h-4 sm:w-5 sm:h-5 text-white transform rotate-90",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 19l9 2-9-18-9 18 9-2zm0 0v-8"})})}),a.jsx("div",{className:`absolute bottom-1 left-12 right-14 sm:right-40 text-xs text-gray-400 dark:text-gray-500 pointer-events-none hidden sm:block transition-opacity duration-200 ${T.trim()?"opacity-0":"opacity-100"}`,children:j(E?"input.hintText.ctrlEnter":"input.hintText.enter")})]})]})]})]})]})]}):a.jsx("div",{className:"flex items-center justify-center h-full",children:a.jsx("div",{className:"text-center text-gray-500 dark:text-gray-400",children:a.jsx("p",{children:"Select a project to start chatting with Claude"})})})}const Mq=ir.memo(Dq);class lr{constructor(t,r,n,i){this.fromA=t,this.toA=r,this.fromB=n,this.toB=i}offset(t,r=t){return new lr(this.fromA+t,this.toA+t,this.fromB+r,this.toB+r)}}function _a(e,t,r,n,i,s){if(e==n)return[];let o=qg(e,t,r,n,i,s),l=Gg(e,t+o,r,n,i+o,s);t+=o,r-=l,i+=o,s-=l;let c=r-t,d=s-i;if(!c||!d)return[new lr(t,r,i,s)];if(c>d){let p=e.slice(t,r).indexOf(n.slice(i,s));if(p>-1)return[new lr(t,t+p,i,i),new lr(t+p+d,r,s,s)]}else if(d>c){let p=n.slice(i,s).indexOf(e.slice(t,r));if(p>-1)return[new lr(t,t,i,i+p),new lr(r,r,i+p+c,s)]}if(c==1||d==1)return[new lr(t,r,i,s)];let u=GN(e,t,r,n,i,s);if(u){let[p,h,m]=u;return _a(e,t,p,n,i,h).concat(_a(e,p+m,r,n,h+m,s))}return Fq(e,t,r,n,i,s)}let Di=1e9,Mi=0,$g=!1;function Fq(e,t,r,n,i,s){let o=r-t,l=s-i;if(Di<1e9&&Math.min(o,l)>Di*16||Mi>0&&Date.now()>Mi)return Math.min(o,l)>Di*64?[new lr(t,r,i,s)]:j2(e,t,r,n,i,s);let c=Math.ceil((o+l)/2);Im.reset(c),Rm.reset(c);let d=(m,g)=>e.charCodeAt(t+m)==n.charCodeAt(i+g),u=(m,g)=>e.charCodeAt(r-m-1)==n.charCodeAt(s-g-1),p=(o-l)%2!=0?Rm:null,h=p?null:Im;for(let m=0;m<c;m++){if(m>Di||Mi>0&&!(m&63)&&Date.now()>Mi)return j2(e,t,r,n,i,s);let g=Im.advance(m,o,l,c,p,!1,d)||Rm.advance(m,o,l,c,h,!0,u);if(g)return Pq(e,t,r,t+g[0],n,i,s,i+g[1])}return[new lr(t,r,i,s)]}class $N{constructor(){this.vec=[]}reset(t){this.len=t<<1;for(let r=0;r<this.len;r++)this.vec[r]=-1;this.vec[t+1]=0,this.start=this.end=0}advance(t,r,n,i,s,o,l){for(let c=-t+this.start;c<=t-this.end;c+=2){let d=i+c,u=c==-t||c!=t&&this.vec[d-1]<this.vec[d+1]?this.vec[d+1]:this.vec[d-1]+1,p=u-c;for(;u<r&&p<n&&l(u,p);)u++,p++;if(this.vec[d]=u,u>r)this.end+=2;else if(p>n)this.start+=2;else if(s){let h=i+(r-n)-c;if(h>=0&&h<this.len&&s.vec[h]!=-1)if(o){let m=s.vec[h];if(m>=r-u)return[m,i+m-h]}else{let m=r-s.vec[h];if(u>=m)return[u,p]}}}return null}}const Im=new $N,Rm=new $N;function Pq(e,t,r,n,i,s,o,l){let c=!1;return!di(e,n)&&++n==r&&(c=!0),!di(i,l)&&++l==o&&(c=!0),c?[new lr(t,r,s,o)]:_a(e,t,n,i,s,l).concat(_a(e,n,r,i,l,o))}function qN(e,t){let r=1,n=Math.min(e,t);for(;r<n;)r=r<<1;return r}function qg(e,t,r,n,i,s){if(t==r||t==s||e.charCodeAt(t)!=n.charCodeAt(i))return 0;let o=qN(r-t,s-i);for(let l=t,c=i;;){let d=l+o,u=c+o;if(d>r||u>s||e.slice(l,d)!=n.slice(c,u)){if(o==1)return l-t-(di(e,l)?0:1);o=o>>1}else{if(d==r||u==s)return d-t;l=d,c=u}}}function Gg(e,t,r,n,i,s){if(t==r||i==s||e.charCodeAt(r-1)!=n.charCodeAt(s-1))return 0;let o=qN(r-t,s-i);for(let l=r,c=s;;){let d=l-o,u=c-o;if(d<t||u<i||e.slice(d,l)!=n.slice(u,c)){if(o==1)return r-l-(di(e,l)?0:1);o=o>>1}else{if(d==t||u==i)return r-d;l=d,c=u}}}function Th(e,t,r,n,i,s,o,l){let c=n.slice(i,s),d=null;for(;;){if(d||o<l)return d;for(let u=t+o;;){di(e,u)||u++;let p=u+o;if(di(e,p)||(p+=p==u+1?1:-1),p>=r)break;let h=e.slice(u,p),m=-1;for(;(m=c.indexOf(h,m+1))!=-1;){let g=qg(e,p,r,n,i+m+h.length,s),f=Gg(e,t,u,n,i,i+m),w=h.length+g+f;(!d||d[2]<w)&&(d=[u-f,i+m-f,w])}u=p}if(l<0)return d;o=o>>1}}function GN(e,t,r,n,i,s){let o=r-t,l=s-i;if(o<l){let c=GN(n,i,s,e,t,r);return c&&[c[1],c[0],c[2]]}return o<4||l*2<o?null:Th(e,t,r,n,i,s,Math.floor(o/4),-1)}function j2(e,t,r,n,i,s){$g=!0;let o=r-t,l=s-i,c;if(o<l){let h=Th(n,i,s,e,t,r,Math.floor(o/6),50);c=h&&[h[1],h[0],h[2]]}else c=Th(e,t,r,n,i,s,Math.floor(l/6),50);if(!c)return[new lr(t,r,i,s)];let[d,u,p]=c;return _a(e,t,d,n,i,u).concat(_a(e,d+p,r,n,u+p,s))}function HN(e,t){for(let r=1;r<e.length;r++){let n=e[r-1],i=e[r];n.toA>i.fromA-t&&n.toB>i.fromB-t&&(e[r-1]=new lr(n.fromA,i.toA,n.fromB,i.toB),e.splice(r--,1))}}function Bq(e,t,r){for(;;){HN(r,1);let n=!1;for(let i=0;i<r.length;i++){let s=r[i],o,l;(o=qg(e,s.fromA,s.toA,t,s.fromB,s.toB))&&(s=r[i]=new lr(s.fromA+o,s.toA,s.fromB+o,s.toB)),(l=Gg(e,s.fromA,s.toA,t,s.fromB,s.toB))&&(s=r[i]=new lr(s.fromA,s.toA-l,s.fromB,s.toB-l));let c=s.toA-s.fromA,d=s.toB-s.fromB;if(c&&d)continue;let u=s.fromA-(i?r[i-1].toA:0),p=(i<r.length-1?r[i+1].fromA:e.length)-s.toA;if(!u||!p)continue;let h=c?e.slice(s.fromA,s.toA):t.slice(s.fromB,s.toB);u<=h.length&&e.slice(s.fromA-u,s.fromA)==h.slice(h.length-u)?(r[i]=new lr(s.fromA-u,s.toA-u,s.fromB-u,s.toB-u),n=!0):p<=h.length&&e.slice(s.toA,s.toA+p)==h.slice(0,p)&&(r[i]=new lr(s.fromA+p,s.toA+p,s.fromB+p,s.toB+p),n=!0)}if(!n)break}return r}function zq(e,t,r){for(let n=0,i=0;i<e.length;i++){let s=e[i],o=s.toA-s.fromA,l=s.toB-s.fromB;if(o&&l||o>3||l>3){let c=i==e.length-1?t.length:e[i+1].fromA,d=s.fromA-n,u=c-s.toA,p=L2(t,s.fromA,d),h=_2(t,s.toA,u),m=s.fromA-p,g=h-s.toA;if((!o||!l)&&m&&g){let f=Math.max(o,l),[w,S,k]=o?[t,s.fromA,s.toA]:[r,s.fromB,s.toB];f>m&&t.slice(p,s.fromA)==w.slice(k-m,k)?(s=e[i]=new lr(p,p+o,s.fromB-m,s.toB-m),p=s.fromA,h=_2(t,s.toA,c-s.toA)):f>g&&t.slice(s.toA,h)==w.slice(S,S+g)&&(s=e[i]=new lr(h-o,h,s.fromB+g,s.toB+g),h=s.toA,p=L2(t,s.fromA,s.fromA-n)),m=s.fromA-p,g=h-s.toA}if(m||g)s=e[i]=new lr(s.fromA-m,s.toA+g,s.fromB-m,s.toB+g);else if(o){if(!l){let f=D2(t,s.fromA,s.toA),w,S=f<0?-1:O2(t,s.toA,s.fromA);f>-1&&(w=f-s.fromA)<=u&&t.slice(s.fromA,f)==t.slice(s.toA,s.toA+w)?s=e[i]=s.offset(w):S>-1&&(w=s.toA-S)<=d&&t.slice(s.fromA-w,s.fromA)==t.slice(S,s.toA)&&(s=e[i]=s.offset(-w))}}else{let f=D2(r,s.fromB,s.toB),w,S=f<0?-1:O2(r,s.toB,s.fromB);f>-1&&(w=f-s.fromB)<=u&&r.slice(s.fromB,f)==r.slice(s.toB,s.toB+w)?s=e[i]=s.offset(w):S>-1&&(w=s.toB-S)<=d&&r.slice(s.fromB-w,s.fromB)==r.slice(S,s.toB)&&(s=e[i]=s.offset(-w))}}n=s.toA}return HN(e,3),e}let Aa;try{Aa=new RegExp("[\\p{Alphabetic}\\p{Number}]","u")}catch{}function WN(e){return e>48&&e<58||e>64&&e<91||e>96&&e<123}function VN(e,t){if(t==e.length)return 0;let r=e.charCodeAt(t);return r<192?WN(r)?1:0:Aa?!XN(r)||t==e.length-1?Aa.test(String.fromCharCode(r))?1:0:Aa.test(e.slice(t,t+2))?2:0:0}function KN(e,t){if(!t)return 0;let r=e.charCodeAt(t-1);return r<192?WN(r)?1:0:Aa?!ZN(r)||t==1?Aa.test(String.fromCharCode(r))?1:0:Aa.test(e.slice(t-2,t))?2:0:0}const YN=8;function _2(e,t,r){if(t==e.length||!KN(e,t))return t;for(let n=t,i=t+r,s=0;s<YN;s++){let o=VN(e,n);if(!o||n+o>i)return n;n+=o}return t}function L2(e,t,r){if(!t||!VN(e,t))return t;for(let n=t,i=t-r,s=0;s<YN;s++){let o=KN(e,n);if(!o||n-o<i)return n;n-=o}return t}function O2(e,t,r){for(;t!=r;t--)if(e.charCodeAt(t-1)==10)return t;return-1}function D2(e,t,r){for(;t!=r;t++)if(e.charCodeAt(t)==10)return t;return-1}const XN=e=>e>=55296&&e<=56319,ZN=e=>e>=56320&&e<=57343;function di(e,t){return!t||t==e.length||!XN(e.charCodeAt(t-1))||!ZN(e.charCodeAt(t))}function Uq(e,t,r){var n;return Di=((n=r?.scanLimit)!==null&&n!==void 0?n:1e9)>>1,Mi=r?.timeout?Date.now()+r.timeout:0,$g=!1,Bq(e,t,_a(e,0,e.length,t,0,t.length))}function JN(){return!$g}function QN(e,t,r){return zq(Uq(e,t,r),e,t)}const Jn=vo.define({combine:e=>e[0]}),$q=_h.define(),e3=vo.define(),ln=rs.define({create(e){return null},update(e,t){for(let r of t.effects)r.is($q)&&(e=r.value);for(let r of t.state.facet(e3))e=r(e,t);return e}});function jm(e){let t=e.field(ln,!1);if(!t)return null;let r=e.facet(Jn);return{chunks:t,side:r?r.side:null}}class ai{constructor(t,r,n,i,s,o=!0){this.changes=t,this.fromA=r,this.toA=n,this.fromB=i,this.toB=s,this.precise=o}offset(t,r){return t||r?new ai(this.changes,this.fromA+t,this.toA+t,this.fromB+r,this.toB+r,this.precise):this}get endA(){return Math.max(this.fromA,this.toA-1)}get endB(){return Math.max(this.fromB,this.toB-1)}static build(t,r,n){let i=QN(t.toString(),r.toString(),n);return t3(i,t,r,0,0,JN())}static updateA(t,r,n,i,s){return z2(B2(t,i,!0,n.length),t,r,n,s)}static updateB(t,r,n,i,s){return z2(B2(t,i,!1,r.length),t,r,n,s)}}function M2(e,t,r,n){let i=r.lineAt(e),s=n.lineAt(t);return i.to==e&&s.to==t&&e<r.length&&t<n.length?[e+1,t+1]:[i.from,s.from]}function F2(e,t,r,n){let i=r.lineAt(e),s=n.lineAt(t);return i.from==e&&s.from==t?[e,t]:[i.to+1,s.to+1]}function t3(e,t,r,n,i,s){let o=[];for(let l=0;l<e.length;l++){let c=e[l],[d,u]=M2(c.fromA+n,c.fromB+i,t,r),[p,h]=F2(c.toA+n,c.toB+i,t,r),m=[c.offset(-d+n,-u+i)];for(;l<e.length-1;){let g=e[l+1],[f,w]=M2(g.fromA+n,g.fromB+i,t,r);if(f>p+1&&w>h+1)break;m.push(g.offset(-d+n,-u+i)),[p,h]=F2(g.toA+n,g.toB+i,t,r),l++}o.push(new ai(m,d,Math.max(d,p),u,Math.max(u,h),s))}return o}const Hs=1e3;function P2(e,t,r,n){let i=0,s=e.length;for(;;){if(i==s){let u=0,p=0;i&&({toA:u,toB:p}=e[i-1]);let h=t-(r?u:p);return[u+h,p+h]}let o=i+s>>1,l=e[o],[c,d]=r?[l.fromA,l.toA]:[l.fromB,l.toB];if(c>t)s=o;else if(d<=t)i=o+1;else return n?[l.fromA,l.fromB]:[l.toA,l.toB]}}function B2(e,t,r,n){let i=[];return t.iterChangedRanges((s,o,l,c)=>{let d=0,u=r?t.length:n,p=0,h=r?n:t.length;s>Hs&&([d,p]=P2(e,s-Hs,r,!0)),o<t.length-Hs&&([u,h]=P2(e,o+Hs,r,!1));let m=c-l-(o-s),g,[f,w]=r?[m,0]:[0,m];i.length&&(g=i[i.length-1]).toA>=d?i[i.length-1]={fromA:g.fromA,fromB:g.fromB,toA:u,toB:h,diffA:g.diffA+f,diffB:g.diffB+w}:i.push({fromA:d,toA:u,fromB:p,toB:h,diffA:f,diffB:w})}),i}function z2(e,t,r,n,i){if(!e.length)return t;let s=[];for(let o=0,l=0,c=0,d=0;;o++){let u=o==e.length?null:e[o],p=u?u.fromA+l:r.length,h=u?u.fromB+c:n.length;for(;d<t.length;){let w=t[d];if(w.toA+l>p||w.toB+c>h)break;s.push(w.offset(l,c)),d++}if(!u)break;let m=u.toA+l+u.diffA,g=u.toB+c+u.diffB,f=QN(r.sliceString(p,m),n.sliceString(h,g),i);for(let w of t3(f,r,n,p,h,JN()))s.push(w);for(l+=u.diffA,c+=u.diffB;d<t.length;){let w=t[d];if(w.fromA+l>m&&w.fromB+c>g)break;d++}}return s}const qq={scanLimit:500},r3=ko.fromClass(class{constructor(e){({deco:this.deco,gutter:this.gutter}=q2(e))}update(e){(e.docChanged||e.viewportChanged||Gq(e.startState,e.state)||Hq(e.startState,e.state))&&({deco:this.deco,gutter:this.gutter}=q2(e.view))}},{decorations:e=>e.deco});function Gq(e,t){return e.field(ln,!1)!=t.field(ln,!1)}function Hq(e,t){return e.facet(Jn)!=t.facet(Jn)}const U2=Qn.line({class:"cm-changedLine"}),n3=Qn.mark({class:"cm-changedText"}),Wq=Qn.mark({tagName:"ins",class:"cm-insertedLine"}),Vq=Qn.mark({tagName:"del",class:"cm-deletedLine"}),$2=new class extends Lh{constructor(){super(...arguments),this.elementClass="cm-changedLineGutter"}};function Kq(e,t,r,n,i,s){let o=r?e.fromA:e.fromB,l=r?e.toA:e.toB,c=0;if(o!=l){i.add(o,o,U2),i.add(o,l,r?Vq:Wq),s&&s.add(o,o,$2);for(let d=t.iterRange(o,l-1),u=o;!d.next().done;){if(d.lineBreak){u++,i.add(u,u,U2),s&&s.add(u,u,$2);continue}let p=u+d.value.length;if(n)for(;c<e.changes.length;){let h=e.changes[c],m=o+(r?h.fromA:h.fromB),g=o+(r?h.toA:h.toB),f=Math.max(u,m),w=Math.min(p,g);if(f<w&&i.add(f,w,n3),g<p)c++;else break}u=p}}}function q2(e){let t=e.state.field(ln),{side:r,highlightChanges:n,markGutter:i,overrideChunk:s}=e.state.facet(Jn),o=r=="a",l=new Zs,c=i?new Zs:null,{from:d,to:u}=e.viewport;for(let p of t){if((o?p.fromA:p.fromB)>=u)break;(o?p.toA:p.toB)>d&&(!s||!s(e.state,p,l,c))&&Kq(p,e.state.doc,o,n,l,c)}return{deco:l.finish(),gutter:c&&c.finish()}}const Ah=_h.define({map:(e,t)=>t.mapPos(e)});class Yq extends Oh{constructor(t){super(),this.lines=t}eq(t){return this.lines==t.lines}toDOM(t){let r=document.createElement("div");return r.className="cm-collapsedLines",r.textContent=t.state.phrase("$ unchanged lines",this.lines),r.addEventListener("click",n=>{let i=t.posAtDOM(n.target);t.dispatch({effects:Ah.of(i)});let{side:s,sibling:o}=t.state.facet(Jn);o&&o().dispatch({effects:Ah.of(Xq(i,t.state.field(ln),s=="a"))})}),r}ignoreEvent(t){return t instanceof MouseEvent}get estimatedHeight(){return 27}get type(){return"collapsed-unchanged-code"}}function Xq(e,t,r){let n=0,i=0;for(let s=0;;s++){let o=s<t.length?t[s]:null;if(!o||(r?o.fromA:o.fromB)>=e)return i+(e-n);[n,i]=r?[o.toA,o.toB]:[o.toB,o.toA]}}const Zq=rs.define({create(e){return Qn.none},update(e,t){e=e.map(t.changes);for(let r of t.effects)r.is(Ah)&&(e=e.update({filter:n=>n!=r.value}));return e},provide:e=>rn.decorations.from(e)});function Jq({margin:e=3,minSize:t=4}){return Zq.init(r=>Qq(r,e,t))}function Qq(e,t,r){let n=new Zs,i=e.facet(Jn).side=="a",s=e.field(ln),o=1;for(let l=0;;l++){let c=l<s.length?s[l]:null,d=l?o+t:1,u=c?e.doc.lineAt(i?c.fromA:c.fromB).number-1-t:e.doc.lines,p=u-d+1;if(p>=r&&n.add(e.doc.line(d).from,e.doc.line(u).to,Qn.replace({widget:new Yq(p),block:!0})),!c)break;o=e.doc.lineAt(Math.min(e.doc.length,i?c.toA:c.toB)).number}return n.finish()}const eG=rn.baseTheme({".cm-mergeView & .cm-scroller, .cm-mergeView &":{height:"auto !important",overflowY:"visible !important"},"&.cm-merge-a .cm-changedLine, .cm-deletedChunk":{backgroundColor:"rgba(160, 128, 100, .08)"},"&.cm-merge-b .cm-changedLine, .cm-inlineChangedLine":{backgroundColor:"rgba(100, 160, 128, .08)"},"&light.cm-merge-a .cm-changedText, &light .cm-deletedChunk .cm-deletedText":{background:"linear-gradient(#ee443366, #ee443366) bottom/100% 2px no-repeat"},"&dark.cm-merge-a .cm-changedText, &dark .cm-deletedChunk .cm-deletedText":{background:"linear-gradient(#ffaa9966, #ffaa9966) bottom/100% 2px no-repeat"},"&light.cm-merge-b .cm-changedText":{background:"linear-gradient(#22bb22aa, #22bb22aa) bottom/100% 2px no-repeat"},"&dark.cm-merge-b .cm-changedText":{background:"linear-gradient(#88ff88aa, #88ff88aa) bottom/100% 2px no-repeat"},"&.cm-merge-b .cm-deletedText":{background:"#ff000033"},".cm-insertedLine, .cm-deletedLine, .cm-deletedLine del":{textDecoration:"none"},".cm-deletedChunk":{paddingLeft:"6px","& .cm-chunkButtons":{position:"absolute",insetInlineEnd:"5px"},"& button":{border:"none",cursor:"pointer",color:"white",margin:"0 2px",borderRadius:"3px","&[name=accept]":{background:"#2a2"},"&[name=reject]":{background:"#d43"}}},".cm-collapsedLines":{padding:"5px 5px 5px 10px",cursor:"pointer","&:before":{content:'"⦚"',marginInlineEnd:"7px"},"&:after":{content:'"⦚"',marginInlineStart:"7px"}},"&light .cm-collapsedLines":{color:"#444",background:"linear-gradient(to bottom, transparent 0, #f3f3f3 30%, #f3f3f3 70%, transparent 100%)"},"&dark .cm-collapsedLines":{color:"#ddd",background:"linear-gradient(to bottom, transparent 0, #222 30%, #222 70%, transparent 100%)"},".cm-changeGutter":{width:"3px",paddingLeft:"1px"},"&light.cm-merge-a .cm-changedLineGutter, &light .cm-deletedLineGutter":{background:"#e43"},"&dark.cm-merge-a .cm-changedLineGutter, &dark .cm-deletedLineGutter":{background:"#fa9"},"&light.cm-merge-b .cm-changedLineGutter":{background:"#2b2"},"&dark.cm-merge-b .cm-changedLineGutter":{background:"#8f8"},".cm-inlineChangedLineGutter":{background:"#75d"}}),tG=new class extends Lh{constructor(){super(...arguments),this.elementClass="cm-deletedLineGutter"}},rG=n4.low(P3({class:"cm-changeGutter",markers:e=>{var t;return((t=e.plugin(r3))===null||t===void 0?void 0:t.gutter)||B3.empty},widgetMarker:(e,t)=>t instanceof a3?tG:null}));function nG(e){var t;let r=typeof e.original=="string"?r4.of(e.original.split(/\r?\n/)):e.original,n=e.diffConfig||qq;return[n4.low(r3),oG,eG,rn.editorAttributes.of({class:"cm-merge-b"}),e3.of((i,s)=>{let o=s.effects.find(l=>l.is(Hg));return o&&(i=ai.updateA(i,o.value.doc,s.startState.doc,o.value.changes,n)),s.docChanged&&(i=ai.updateB(i,s.state.field(ui),s.newDoc,s.changes,n)),i}),Jn.of({highlightChanges:e.highlightChanges!==!1,markGutter:e.gutter!==!1,syntaxHighlightDeletions:e.syntaxHighlightDeletions!==!1,syntaxHighlightDeletionsMaxLength:3e3,mergeControls:(t=e.mergeControls)!==null&&t!==void 0?t:!0,overrideChunk:e.allowInlineDiffs?uG:void 0,side:"b"}),ui.init(()=>r),e.gutter!==!1?rG:[],e.collapseUnchanged?Jq(e.collapseUnchanged):[],ln.init(i=>ai.build(r,i.doc,n))]}const Hg=_h.define(),ui=rs.define({create:()=>r4.empty,update(e,t){for(let r of t.effects)r.is(Hg)&&(e=r.value.doc);return e}}),G2=new WeakMap;class a3 extends Oh{constructor(t){super(),this.buildDOM=t,this.dom=null}eq(t){return this.dom==t.dom}toDOM(t){return this.dom||(this.dom=this.buildDOM(t))}}function aG(e,t,r){let n=G2.get(t.changes);if(n)return n;let i=o=>{let{highlightChanges:l,syntaxHighlightDeletions:c,syntaxHighlightDeletionsMaxLength:d,mergeControls:u}=e.facet(Jn),p=document.createElement("div");if(p.className="cm-deletedChunk",u){let N=p.appendChild(document.createElement("div"));N.className="cm-chunkButtons";let C=I=>{I.preventDefault(),iG(o,o.posAtDOM(p))},v=I=>{I.preventDefault(),sG(o,o.posAtDOM(p))};if(typeof u=="function")N.appendChild(u("accept",C)),N.appendChild(u("reject",v));else{let I=N.appendChild(document.createElement("button"));I.name="accept",I.textContent=e.phrase("Accept"),I.onmousedown=C;let M=N.appendChild(document.createElement("button"));M.name="reject",M.textContent=e.phrase("Reject"),M.onmousedown=v}}if(r||t.fromA>=t.toA)return p;let h=o.state.field(ui).sliceString(t.fromA,t.endA),m=c&&e.facet(a4),g=k(),f=t.changes,w=0,S=!1;function k(){let N=p.appendChild(document.createElement("div"));return N.className="cm-deletedLine",N.appendChild(document.createElement("del"))}function E(N,C,v){for(let I=N;I<C;){if(h.charAt(I)==`
|
|
831
|
+
`}),a.jsxs("div",{className:"h-full flex flex-col",children:[a.jsxs("div",{ref:ve,onWheel:Ci,onTouchMove:Ci,className:"flex-1 overflow-y-auto overflow-x-hidden px-0 py-3 sm:p-4 space-y-3 sm:space-y-4 relative",children:[te&&q.length===0?a.jsx("div",{className:"text-center text-gray-500 dark:text-gray-400 mt-8",children:a.jsxs("div",{className:"flex items-center justify-center space-x-2",children:[a.jsx("div",{className:"animate-spin rounded-full h-4 w-4 border-b-2 border-gray-400"}),a.jsx("p",{children:j("session.loading.sessionMessages")})]})}):q.length===0?a.jsxs("div",{className:"flex items-center justify-center h-full",children:[!t&&!G&&a.jsxs("div",{className:"text-center px-6 sm:px-4 py-8",children:[a.jsx("h2",{className:"text-2xl font-bold text-gray-900 dark:text-white mb-3",children:j("providerSelection.title")}),a.jsx("p",{className:"text-gray-600 dark:text-gray-400 mb-8",children:j("providerSelection.description")}),a.jsxs("div",{className:"flex flex-col sm:flex-row gap-4 justify-center items-center mb-8",children:[a.jsxs("button",{onClick:()=>{Ua("claude"),localStorage.setItem("selected-provider","claude"),setTimeout(()=>H.current?.focus(),100)},className:`group relative w-64 h-32 bg-white dark:bg-gray-800 rounded-xl border-2 transition-all duration-200 hover:scale-105 hover:shadow-xl ${vt==="claude"?"border-blue-500 shadow-lg ring-2 ring-blue-500/20":"border-gray-200 dark:border-gray-700 hover:border-blue-400"}`,children:[a.jsxs("div",{className:"flex flex-col items-center justify-center h-full gap-3",children:[a.jsx(nn,{className:"w-10 h-10"}),a.jsxs("div",{children:[a.jsx("p",{className:"font-semibold text-gray-900 dark:text-white",children:"Claude Code"}),a.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:j("providerSelection.providerInfo.anthropic")})]})]}),vt==="claude"&&a.jsx("div",{className:"absolute top-2 right-2",children:a.jsx("div",{className:"w-5 h-5 bg-blue-500 rounded-full flex items-center justify-center",children:a.jsx("svg",{className:"w-3 h-3 text-white",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:3,d:"M5 13l4 4L19 7"})})})})]}),a.jsxs("button",{onClick:()=>{Ua("cursor"),localStorage.setItem("selected-provider","cursor"),setTimeout(()=>H.current?.focus(),100)},className:`group relative w-64 h-32 bg-white dark:bg-gray-800 rounded-xl border-2 transition-all duration-200 hover:scale-105 hover:shadow-xl ${vt==="cursor"?"border-purple-500 shadow-lg ring-2 ring-purple-500/20":"border-gray-200 dark:border-gray-700 hover:border-purple-400"}`,children:[a.jsxs("div",{className:"flex flex-col items-center justify-center h-full gap-3",children:[a.jsx(pn,{className:"w-10 h-10"}),a.jsxs("div",{children:[a.jsx("p",{className:"font-semibold text-gray-900 dark:text-white",children:"Cursor"}),a.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:j("providerSelection.providerInfo.cursorEditor")})]})]}),vt==="cursor"&&a.jsx("div",{className:"absolute top-2 right-2",children:a.jsx("div",{className:"w-5 h-5 bg-purple-500 rounded-full flex items-center justify-center",children:a.jsx("svg",{className:"w-3 h-3 text-white",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:3,d:"M5 13l4 4L19 7"})})})})]}),a.jsxs("button",{onClick:()=>{Ua("codex"),localStorage.setItem("selected-provider","codex"),setTimeout(()=>H.current?.focus(),100)},className:`group relative w-64 h-32 bg-white dark:bg-gray-800 rounded-xl border-2 transition-all duration-200 hover:scale-105 hover:shadow-xl ${vt==="codex"?"border-gray-800 dark:border-gray-300 shadow-lg ring-2 ring-gray-800/20 dark:ring-gray-300/20":"border-gray-200 dark:border-gray-700 hover:border-gray-500 dark:hover:border-gray-400"}`,children:[a.jsxs("div",{className:"flex flex-col items-center justify-center h-full gap-3",children:[a.jsx(wn,{className:"w-10 h-10"}),a.jsxs("div",{children:[a.jsx("p",{className:"font-semibold text-gray-900 dark:text-white",children:"Codex"}),a.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:j("providerSelection.providerInfo.openai")})]})]}),vt==="codex"&&a.jsx("div",{className:"absolute top-2 right-2",children:a.jsx("div",{className:"w-5 h-5 bg-gray-800 dark:bg-gray-300 rounded-full flex items-center justify-center",children:a.jsx("svg",{className:"w-3 h-3 text-white dark:text-gray-800",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:3,d:"M5 13l4 4L19 7"})})})})]})]}),a.jsxs("div",{className:`mb-6 transition-opacity duration-200 ${vt?"opacity-100":"opacity-0 pointer-events-none"}`,children:[a.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:j("providerSelection.selectModel")}),vt==="claude"?a.jsx("select",{value:dn,onChange:O=>{const V=O.target.value;X(V),localStorage.setItem("claude-model",V)},className:"pl-4 pr-10 py-2 text-sm bg-white dark:bg-gray-800 border border-gray-300 dark:border-gray-600 rounded-lg focus:ring-2 focus:ring-purple-500 focus:border-purple-500 min-w-[140px]",children:T2.OPTIONS.map(({value:O,label:V})=>a.jsx("option",{value:O,children:V},O))}):vt==="codex"?a.jsx("select",{value:de,onChange:O=>{const V=O.target.value;Re(V),localStorage.setItem("codex-model",V)},className:"pl-4 pr-10 py-2 text-sm bg-white dark:bg-gray-800 border border-gray-300 dark:border-gray-600 rounded-lg focus:ring-2 focus:ring-gray-500 focus:border-gray-500 min-w-[140px]",children:I2.OPTIONS.map(({value:O,label:V})=>a.jsx("option",{value:O,children:V},O))}):a.jsx("select",{value:na,onChange:O=>{const V=O.target.value;bs(V),localStorage.setItem("cursor-model",V)},className:"pl-4 pr-10 py-2 text-sm bg-white dark:bg-gray-800 border border-gray-300 dark:border-gray-600 rounded-lg focus:ring-2 focus:ring-purple-500 focus:border-purple-500 min-w-[140px]",disabled:vt!=="cursor",children:A2.OPTIONS.map(({value:O,label:V})=>a.jsx("option",{value:O,children:V},O))})]}),a.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400",children:vt==="claude"?j("providerSelection.readyPrompt.claude",{model:dn}):vt==="cursor"?j("providerSelection.readyPrompt.cursor",{model:na}):vt==="codex"?j("providerSelection.readyPrompt.codex",{model:de}):j("providerSelection.readyPrompt.default")}),vt&&I&&M&&a.jsx("div",{className:"mt-4 px-4 sm:px-0",children:a.jsx(k2,{onStartTask:()=>P("Start the next task"),onShowAllTasks:v})})]}),t&&a.jsxs("div",{className:"text-center text-gray-500 dark:text-gray-400 px-6 sm:px-4",children:[a.jsx("p",{className:"font-bold text-lg sm:text-xl mb-3",children:j("session.continue.title")}),a.jsx("p",{className:"text-sm sm:text-base leading-relaxed",children:j("session.continue.description")}),I&&M&&a.jsx("div",{className:"mt-4 px-4 sm:px-0",children:a.jsx(k2,{onStartTask:()=>P("Start the next task"),onShowAllTasks:v})})]})]}):a.jsxs(a.Fragment,{children:[Z&&a.jsx("div",{className:"text-center text-gray-500 dark:text-gray-400 py-3",children:a.jsxs("div",{className:"flex items-center justify-center space-x-2",children:[a.jsx("div",{className:"animate-spin rounded-full h-4 w-4 border-b-2 border-gray-400"}),a.jsx("p",{className:"text-sm",children:j("session.loading.olderMessages")})]})}),_e&&!Z&&a.jsx("div",{className:"text-center text-gray-500 dark:text-gray-400 text-sm py-2 border-b border-gray-200 dark:border-gray-700",children:fe>0&&a.jsxs("span",{children:[j("session.messages.showingOf",{shown:R.length,total:fe})," •",a.jsx("span",{className:"text-xs",children:j("session.messages.scrollToLoad")})]})}),!_e&&q.length>ya&&a.jsxs("div",{className:"text-center text-gray-500 dark:text-gray-400 text-sm py-2 border-b border-gray-200 dark:border-gray-700",children:[j("session.messages.showingLast",{count:ya,total:q.length})," •",a.jsx("button",{className:"ml-1 text-blue-600 hover:text-blue-700 underline",onClick:E3,children:j("session.messages.loadEarlier")})]}),Jg.map((O,V)=>{const ee=V>0?Jg[V-1]:null;return a.jsx(Lq,{message:O,index:V,prevMessage:ee,createDiff:x3,onFileOpen:s,onShowSettings:g,onGrantToolPermission:Qg,autoExpandTools:f,showRawParameters:w,showThinking:S,selectedProject:e,provider:vt},V)})]}),z&&a.jsx("div",{className:"chat-message assistant",children:a.jsxs("div",{className:"w-full",children:[a.jsxs("div",{className:"flex items-center space-x-3 mb-2",children:[a.jsx("div",{className:"w-8 h-8 rounded-full flex items-center justify-center text-white text-sm flex-shrink-0 p-1 bg-transparent",children:(localStorage.getItem("selected-provider")||"claude")==="cursor"?a.jsx(pn,{className:"w-full h-full"}):(localStorage.getItem("selected-provider")||"claude")==="codex"?a.jsx(wn,{className:"w-full h-full"}):a.jsx(nn,{className:"w-full h-full"})}),a.jsx("div",{className:"text-sm font-medium text-gray-900 dark:text-white",children:(localStorage.getItem("selected-provider")||"claude")==="cursor"?"Cursor":(localStorage.getItem("selected-provider")||"claude")==="codex"?"Codex":"Claude"})]}),a.jsx("div",{className:"w-full text-sm text-gray-500 dark:text-gray-400 pl-3 sm:pl-0",children:a.jsxs("div",{className:"flex items-center space-x-1",children:[a.jsx("div",{className:"animate-pulse",children:"●"}),a.jsx("div",{className:"animate-pulse",style:{animationDelay:"0.2s"},children:"●"}),a.jsx("div",{className:"animate-pulse",style:{animationDelay:"0.4s"},children:"●"}),a.jsx("span",{className:"ml-2",children:"Thinking..."})]})})]})}),a.jsx("div",{ref:Ee})]}),a.jsxs("div",{className:"p-2 sm:p-4 md:p-4 flex-shrink-0 pb-2 sm:pb-4 md:pb-6",children:[a.jsx("div",{className:"flex-1",children:a.jsx(F$,{status:Go,isLoading:z,onAbort:L3,provider:vt,showThinking:S})}),a.jsxs("div",{ref:Y,className:"max-w-4xl mx-auto mb-3",children:[gt.length>0&&a.jsx("div",{className:"mb-3 space-y-2",children:gt.map(O=>{const V=R2(O.input),ee=Ch(O.toolName,V),ne=Ug(),pe=ee?ne.allowedTools.includes(ee):!1,Le=pe?"Allow (saved)":"Allow & remember",ot=ee?gt.filter(Ct=>Ch(Ct.toolName,R2(Ct.input))===ee).map(Ct=>Ct.requestId):[O.requestId];return a.jsxs("div",{className:"rounded-lg border border-amber-200 dark:border-amber-800 bg-amber-50 dark:bg-amber-900/20 p-3 shadow-sm",children:[a.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[a.jsxs("div",{children:[a.jsx("div",{className:"text-sm font-semibold text-amber-900 dark:text-amber-100",children:"Permission required"}),a.jsxs("div",{className:"text-xs text-amber-800 dark:text-amber-200",children:["Tool: ",a.jsx("span",{className:"font-mono",children:O.toolName})]})]}),ee&&a.jsxs("div",{className:"text-xs text-amber-700 dark:text-amber-300",children:["Allow rule: ",a.jsx("span",{className:"font-mono",children:ee})]})]}),V&&a.jsxs("details",{className:"mt-2",children:[a.jsx("summary",{className:"cursor-pointer text-xs text-amber-800 dark:text-amber-200 hover:text-amber-900 dark:hover:text-amber-100",children:"View tool input"}),a.jsx("pre",{className:"mt-2 max-h-40 overflow-auto rounded-md bg-white/80 dark:bg-gray-900/60 border border-amber-200/60 dark:border-amber-800/60 p-2 text-xs text-amber-900 dark:text-amber-100 whitespace-pre-wrap",children:V})]}),a.jsxs("div",{className:"mt-3 flex flex-wrap gap-2",children:[a.jsx("button",{type:"button",onClick:()=>Ko(O.requestId,{allow:!0}),className:"inline-flex items-center gap-2 rounded-md bg-amber-600 text-white text-xs font-medium px-3 py-1.5 hover:bg-amber-700 transition-colors",children:"Allow once"}),a.jsx("button",{type:"button",onClick:()=>{ee&&!pe&&Qg({entry:ee,toolName:O.toolName}),Ko(ot,{allow:!0,rememberEntry:ee})},className:`inline-flex items-center gap-2 rounded-md text-xs font-medium px-3 py-1.5 border transition-colors ${ee?"border-amber-300 text-amber-800 hover:bg-amber-100 dark:border-amber-700 dark:text-amber-100 dark:hover:bg-amber-900/30":"border-gray-300 text-gray-400 cursor-not-allowed"}`,disabled:!ee,children:Le}),a.jsx("button",{type:"button",onClick:()=>Ko(O.requestId,{allow:!1,message:"User denied tool use"}),className:"inline-flex items-center gap-2 rounded-md text-xs font-medium px-3 py-1.5 border border-red-300 text-red-700 hover:bg-red-50 dark:border-red-800 dark:text-red-200 dark:hover:bg-red-900/30 transition-colors",children:"Deny"})]})]},O.requestId)})}),a.jsxs("div",{className:"flex items-center justify-center gap-3",children:[a.jsx("button",{type:"button",onClick:O3,className:`px-3 py-1.5 rounded-lg text-sm font-medium border transition-all duration-200 ${Ye==="default"?"bg-gray-100 dark:bg-gray-700 text-gray-700 dark:text-gray-300 border-gray-300 dark:border-gray-600 hover:bg-gray-200 dark:hover:bg-gray-600":Ye==="acceptEdits"?"bg-green-50 dark:bg-green-900/20 text-green-700 dark:text-green-300 border-green-300 dark:border-green-600 hover:bg-green-100 dark:hover:bg-green-900/30":Ye==="bypassPermissions"?"bg-orange-50 dark:bg-orange-900/20 text-orange-700 dark:text-orange-300 border-orange-300 dark:border-orange-600 hover:bg-orange-100 dark:hover:bg-orange-900/30":"bg-blue-50 dark:bg-blue-900/20 text-blue-700 dark:text-blue-300 border-blue-300 dark:border-blue-600 hover:bg-blue-100 dark:hover:bg-blue-900/30"}`,title:j("input.clickToChangeMode"),children:a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("div",{className:`w-2 h-2 rounded-full ${Ye==="default"?"bg-gray-500":Ye==="acceptEdits"?"bg-green-500":Ye==="bypassPermissions"?"bg-orange-500":"bg-blue-500"}`}),a.jsxs("span",{children:[Ye==="default"&&j("codex.modes.default"),Ye==="acceptEdits"&&j("codex.modes.acceptEdits"),Ye==="bypassPermissions"&&j("codex.modes.bypassPermissions"),Ye==="plan"&&j("codex.modes.plan")]})]})}),vt==="claude"&&a.jsx(z$,{selectedMode:Dn,onModeChange:Ei,className:""}),a.jsx(P$,{used:Ba?.used||0,total:Ba?.total||parseInt("160000")||16e4}),a.jsxs("button",{type:"button",onClick:()=>{const O=!Ut;cn(O),_r(""),Jr(-1),O&&Pa(jr),H.current&&H.current.focus()},className:"relative w-8 h-8 text-gray-500 hover:text-gray-700 dark:text-gray-400 dark:hover:text-gray-200 rounded-full flex items-center justify-center transition-colors focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2 dark:ring-offset-gray-800",title:j("input.showAllCommands"),children:[a.jsx("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M7 8h10M7 12h4m1 8l-4-4H5a2 2 0 01-2-2V6a2 2 0 012-2h14a2 2 0 012 2v8a2 2 0 01-2 2h-3l-4 4z"})}),jr.length>0&&a.jsx("span",{className:"absolute -top-1 -right-1 bg-blue-600 text-white text-xs font-bold rounded-full w-5 h-5 flex items-center justify-center",style:{fontSize:"10px"},children:jr.length})]}),T.trim()&&a.jsx("button",{type:"button",onClick:O=>{O.preventDefault(),O.stopPropagation(),P(""),H.current&&(H.current.style.height="auto",H.current.focus()),gn(!1)},className:"w-8 h-8 bg-white dark:bg-gray-800 hover:bg-gray-100 dark:hover:bg-gray-700 border border-gray-300 dark:border-gray-600 rounded-full flex items-center justify-center transition-all duration-200 group shadow-sm",title:"Clear input",children:a.jsx("svg",{className:"w-4 h-4 text-gray-600 dark:text-gray-300 group-hover:text-gray-800 dark:group-hover:text-gray-100 transition-colors",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})}),hr&&q.length>0&&a.jsx("button",{onClick:Mn,className:"w-8 h-8 bg-blue-600 hover:bg-blue-700 text-white rounded-full shadow-lg flex items-center justify-center transition-all duration-200 hover:scale-105 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2 dark:ring-offset-gray-800",title:"Scroll to bottom",children:a.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 14l-7 7m0 0l-7-7m7 7V3"})})})]})]}),a.jsxs("form",{onSubmit:va,className:"relative max-w-4xl mx-auto",children:[A3&&a.jsx("div",{className:"absolute inset-0 bg-blue-500/20 border-2 border-dashed border-blue-500 rounded-lg flex items-center justify-center z-50",children:a.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg p-4 shadow-lg",children:[a.jsx("svg",{className:"w-8 h-8 text-blue-500 mx-auto mb-2",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:a.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.9M15 13l-3-3m0 0l-3 3m3-3v12"})}),a.jsx("p",{className:"text-sm font-medium",children:"Drop images here"})]})}),Me.length>0&&a.jsx("div",{className:"mb-2 p-2 bg-gray-50 dark:bg-gray-800 rounded-lg",children:a.jsx("div",{className:"flex flex-wrap gap-2",children:Me.map((O,V)=>a.jsx(Oq,{file:O,onRemove:()=>{mt(ee=>ee.filter((ne,pe)=>pe!==V))},uploadProgress:Pt.get(O.name),error:at.get(O.name)},V))})}),st&&dt.length>0&&a.jsx("div",{className:"absolute bottom-full left-0 right-0 mb-2 bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-600 rounded-lg shadow-lg max-h-48 overflow-y-auto z-50 backdrop-blur-sm",children:dt.map((O,V)=>a.jsxs("div",{className:`px-4 py-3 cursor-pointer border-b border-gray-100 dark:border-gray-700 last:border-b-0 touch-manipulation ${V===zt?"bg-blue-50 dark:bg-blue-900/20 text-blue-700 dark:text-blue-300":"hover:bg-gray-50 dark:hover:bg-gray-700 text-gray-700 dark:text-gray-300"}`,onMouseDown:ee=>{ee.preventDefault(),ee.stopPropagation()},onClick:ee=>{ee.preventDefault(),ee.stopPropagation(),Yo(O)},children:[a.jsx("div",{className:"font-medium text-sm",children:O.name}),a.jsx("div",{className:"text-xs text-gray-500 dark:text-gray-400 font-mono",children:O.path})]},O.path))}),a.jsx(Cq,{commands:Ln,selectedIndex:za,onSelect:g3,onClose:()=>{cn(!1),fn(-1),_r(""),Jr(-1)},position:{top:H.current?Math.max(16,H.current.getBoundingClientRect().top-316):0,left:H.current?H.current.getBoundingClientRect().left:16,bottom:H.current?window.innerHeight-H.current.getBoundingClientRect().top+8:90},isOpen:Ut,frequentCommands:ra?[]:h3}),a.jsxs("div",{...C3(),className:`relative bg-white dark:bg-gray-800 rounded-2xl shadow-lg border border-gray-200 dark:border-gray-600 focus-within:ring-2 focus-within:ring-blue-500 dark:focus-within:ring-blue-500 focus-within:border-blue-500 transition-all duration-200 overflow-hidden ${fs?"chat-input-expanded":""}`,children:[a.jsx("input",{...T3()}),a.jsx("div",{ref:le,"aria-hidden":"true",className:"absolute inset-0 pointer-events-none overflow-hidden rounded-2xl",children:a.jsx("div",{className:"chat-input-placeholder block w-full pl-12 pr-20 sm:pr-40 py-1.5 sm:py-4 text-transparent text-base leading-6 whitespace-pre-wrap break-words",children:w3(T)})}),a.jsxs("div",{className:"relative z-10",children:[a.jsx("textarea",{ref:H,value:T,onChange:j3,onClick:_3,onKeyDown:R3,onPaste:N3,onScroll:O=>tf(O.target),onFocus:()=>ue(!0),onBlur:()=>ue(!1),onInput:O=>{O.target.style.height="auto",O.target.style.height=O.target.scrollHeight+"px",xr(O.target.selectionStart),tf(O.target);const V=parseInt(window.getComputedStyle(O.target).lineHeight),ee=O.target.scrollHeight>V*2;gn(ee)},placeholder:j("input.placeholder",{provider:j(vt==="cursor"?"messageTypes.cursor":vt==="codex"?"messageTypes.codex":"messageTypes.claude")}),disabled:z,className:"chat-input-placeholder block w-full pl-12 pr-20 sm:pr-40 py-1.5 sm:py-4 bg-transparent rounded-2xl focus:outline-none text-gray-900 dark:text-gray-100 placeholder-gray-400 dark:placeholder-gray-500 disabled:opacity-50 resize-none min-h-[50px] sm:min-h-[80px] max-h-[40vh] sm:max-h-[300px] overflow-y-auto text-base leading-6 transition-all duration-200",style:{height:"50px"}}),a.jsx("button",{type:"button",onClick:I3,className:"absolute left-2 top-1/2 transform -translate-y-1/2 p-2 hover:bg-gray-100 dark:hover:bg-gray-700 rounded-lg transition-colors",title:j("input.attachImages"),children:a.jsx("svg",{className:"w-5 h-5 text-gray-500",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 16l4.586-4.586a2 2 0 012.828 0L16 16m-2-2l1.586-1.586a2 2 0 012.828 0L20 14m-6-6h.01M6 20h12a2 2 0 002-2V6a2 2 0 00-2-2H6a2 2 0 00-2 2v12a2 2 0 002 2z"})})}),a.jsx("div",{className:"absolute right-16 sm:right-16 top-1/2 transform -translate-y-1/2",style:{display:"none"},children:a.jsx(RN,{onTranscript:S3,className:"w-10 h-10 sm:w-10 sm:h-10"})}),a.jsx("button",{type:"submit",disabled:!T.trim()||z,onMouseDown:O=>{O.preventDefault(),va(O)},onTouchStart:O=>{O.preventDefault(),va(O)},className:"absolute right-2 top-1/2 transform -translate-y-1/2 w-12 h-12 sm:w-12 sm:h-12 bg-blue-600 hover:bg-blue-700 disabled:bg-gray-400 disabled:cursor-not-allowed rounded-full flex items-center justify-center transition-colors focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2 dark:ring-offset-gray-800",children:a.jsx("svg",{className:"w-4 h-4 sm:w-5 sm:h-5 text-white transform rotate-90",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 19l9 2-9-18-9 18 9-2zm0 0v-8"})})}),a.jsx("div",{className:`absolute bottom-1 left-12 right-14 sm:right-40 text-xs text-gray-400 dark:text-gray-500 pointer-events-none hidden sm:block transition-opacity duration-200 ${T.trim()?"opacity-0":"opacity-100"}`,children:j(E?"input.hintText.ctrlEnter":"input.hintText.enter")})]})]})]})]})]})]}):a.jsx("div",{className:"flex items-center justify-center h-full",children:a.jsx("div",{className:"text-center text-gray-500 dark:text-gray-400",children:a.jsx("p",{children:"Select a project to start chatting with Claude"})})})}const Mq=ir.memo(Dq);class lr{constructor(t,r,n,i){this.fromA=t,this.toA=r,this.fromB=n,this.toB=i}offset(t,r=t){return new lr(this.fromA+t,this.toA+t,this.fromB+r,this.toB+r)}}function _a(e,t,r,n,i,s){if(e==n)return[];let o=qg(e,t,r,n,i,s),l=Gg(e,t+o,r,n,i+o,s);t+=o,r-=l,i+=o,s-=l;let c=r-t,d=s-i;if(!c||!d)return[new lr(t,r,i,s)];if(c>d){let p=e.slice(t,r).indexOf(n.slice(i,s));if(p>-1)return[new lr(t,t+p,i,i),new lr(t+p+d,r,s,s)]}else if(d>c){let p=n.slice(i,s).indexOf(e.slice(t,r));if(p>-1)return[new lr(t,t,i,i+p),new lr(r,r,i+p+c,s)]}if(c==1||d==1)return[new lr(t,r,i,s)];let u=GN(e,t,r,n,i,s);if(u){let[p,h,m]=u;return _a(e,t,p,n,i,h).concat(_a(e,p+m,r,n,h+m,s))}return Fq(e,t,r,n,i,s)}let Di=1e9,Mi=0,$g=!1;function Fq(e,t,r,n,i,s){let o=r-t,l=s-i;if(Di<1e9&&Math.min(o,l)>Di*16||Mi>0&&Date.now()>Mi)return Math.min(o,l)>Di*64?[new lr(t,r,i,s)]:j2(e,t,r,n,i,s);let c=Math.ceil((o+l)/2);Im.reset(c),Rm.reset(c);let d=(m,g)=>e.charCodeAt(t+m)==n.charCodeAt(i+g),u=(m,g)=>e.charCodeAt(r-m-1)==n.charCodeAt(s-g-1),p=(o-l)%2!=0?Rm:null,h=p?null:Im;for(let m=0;m<c;m++){if(m>Di||Mi>0&&!(m&63)&&Date.now()>Mi)return j2(e,t,r,n,i,s);let g=Im.advance(m,o,l,c,p,!1,d)||Rm.advance(m,o,l,c,h,!0,u);if(g)return Pq(e,t,r,t+g[0],n,i,s,i+g[1])}return[new lr(t,r,i,s)]}class $N{constructor(){this.vec=[]}reset(t){this.len=t<<1;for(let r=0;r<this.len;r++)this.vec[r]=-1;this.vec[t+1]=0,this.start=this.end=0}advance(t,r,n,i,s,o,l){for(let c=-t+this.start;c<=t-this.end;c+=2){let d=i+c,u=c==-t||c!=t&&this.vec[d-1]<this.vec[d+1]?this.vec[d+1]:this.vec[d-1]+1,p=u-c;for(;u<r&&p<n&&l(u,p);)u++,p++;if(this.vec[d]=u,u>r)this.end+=2;else if(p>n)this.start+=2;else if(s){let h=i+(r-n)-c;if(h>=0&&h<this.len&&s.vec[h]!=-1)if(o){let m=s.vec[h];if(m>=r-u)return[m,i+m-h]}else{let m=r-s.vec[h];if(u>=m)return[u,p]}}}return null}}const Im=new $N,Rm=new $N;function Pq(e,t,r,n,i,s,o,l){let c=!1;return!di(e,n)&&++n==r&&(c=!0),!di(i,l)&&++l==o&&(c=!0),c?[new lr(t,r,s,o)]:_a(e,t,n,i,s,l).concat(_a(e,n,r,i,l,o))}function qN(e,t){let r=1,n=Math.min(e,t);for(;r<n;)r=r<<1;return r}function qg(e,t,r,n,i,s){if(t==r||t==s||e.charCodeAt(t)!=n.charCodeAt(i))return 0;let o=qN(r-t,s-i);for(let l=t,c=i;;){let d=l+o,u=c+o;if(d>r||u>s||e.slice(l,d)!=n.slice(c,u)){if(o==1)return l-t-(di(e,l)?0:1);o=o>>1}else{if(d==r||u==s)return d-t;l=d,c=u}}}function Gg(e,t,r,n,i,s){if(t==r||i==s||e.charCodeAt(r-1)!=n.charCodeAt(s-1))return 0;let o=qN(r-t,s-i);for(let l=r,c=s;;){let d=l-o,u=c-o;if(d<t||u<i||e.slice(d,l)!=n.slice(u,c)){if(o==1)return r-l-(di(e,l)?0:1);o=o>>1}else{if(d==t||u==i)return r-d;l=d,c=u}}}function Th(e,t,r,n,i,s,o,l){let c=n.slice(i,s),d=null;for(;;){if(d||o<l)return d;for(let u=t+o;;){di(e,u)||u++;let p=u+o;if(di(e,p)||(p+=p==u+1?1:-1),p>=r)break;let h=e.slice(u,p),m=-1;for(;(m=c.indexOf(h,m+1))!=-1;){let g=qg(e,p,r,n,i+m+h.length,s),f=Gg(e,t,u,n,i,i+m),w=h.length+g+f;(!d||d[2]<w)&&(d=[u-f,i+m-f,w])}u=p}if(l<0)return d;o=o>>1}}function GN(e,t,r,n,i,s){let o=r-t,l=s-i;if(o<l){let c=GN(n,i,s,e,t,r);return c&&[c[1],c[0],c[2]]}return o<4||l*2<o?null:Th(e,t,r,n,i,s,Math.floor(o/4),-1)}function j2(e,t,r,n,i,s){$g=!0;let o=r-t,l=s-i,c;if(o<l){let h=Th(n,i,s,e,t,r,Math.floor(o/6),50);c=h&&[h[1],h[0],h[2]]}else c=Th(e,t,r,n,i,s,Math.floor(l/6),50);if(!c)return[new lr(t,r,i,s)];let[d,u,p]=c;return _a(e,t,d,n,i,u).concat(_a(e,d+p,r,n,u+p,s))}function HN(e,t){for(let r=1;r<e.length;r++){let n=e[r-1],i=e[r];n.toA>i.fromA-t&&n.toB>i.fromB-t&&(e[r-1]=new lr(n.fromA,i.toA,n.fromB,i.toB),e.splice(r--,1))}}function Bq(e,t,r){for(;;){HN(r,1);let n=!1;for(let i=0;i<r.length;i++){let s=r[i],o,l;(o=qg(e,s.fromA,s.toA,t,s.fromB,s.toB))&&(s=r[i]=new lr(s.fromA+o,s.toA,s.fromB+o,s.toB)),(l=Gg(e,s.fromA,s.toA,t,s.fromB,s.toB))&&(s=r[i]=new lr(s.fromA,s.toA-l,s.fromB,s.toB-l));let c=s.toA-s.fromA,d=s.toB-s.fromB;if(c&&d)continue;let u=s.fromA-(i?r[i-1].toA:0),p=(i<r.length-1?r[i+1].fromA:e.length)-s.toA;if(!u||!p)continue;let h=c?e.slice(s.fromA,s.toA):t.slice(s.fromB,s.toB);u<=h.length&&e.slice(s.fromA-u,s.fromA)==h.slice(h.length-u)?(r[i]=new lr(s.fromA-u,s.toA-u,s.fromB-u,s.toB-u),n=!0):p<=h.length&&e.slice(s.toA,s.toA+p)==h.slice(0,p)&&(r[i]=new lr(s.fromA+p,s.toA+p,s.fromB+p,s.toB+p),n=!0)}if(!n)break}return r}function zq(e,t,r){for(let n=0,i=0;i<e.length;i++){let s=e[i],o=s.toA-s.fromA,l=s.toB-s.fromB;if(o&&l||o>3||l>3){let c=i==e.length-1?t.length:e[i+1].fromA,d=s.fromA-n,u=c-s.toA,p=L2(t,s.fromA,d),h=_2(t,s.toA,u),m=s.fromA-p,g=h-s.toA;if((!o||!l)&&m&&g){let f=Math.max(o,l),[w,S,k]=o?[t,s.fromA,s.toA]:[r,s.fromB,s.toB];f>m&&t.slice(p,s.fromA)==w.slice(k-m,k)?(s=e[i]=new lr(p,p+o,s.fromB-m,s.toB-m),p=s.fromA,h=_2(t,s.toA,c-s.toA)):f>g&&t.slice(s.toA,h)==w.slice(S,S+g)&&(s=e[i]=new lr(h-o,h,s.fromB+g,s.toB+g),h=s.toA,p=L2(t,s.fromA,s.fromA-n)),m=s.fromA-p,g=h-s.toA}if(m||g)s=e[i]=new lr(s.fromA-m,s.toA+g,s.fromB-m,s.toB+g);else if(o){if(!l){let f=D2(t,s.fromA,s.toA),w,S=f<0?-1:O2(t,s.toA,s.fromA);f>-1&&(w=f-s.fromA)<=u&&t.slice(s.fromA,f)==t.slice(s.toA,s.toA+w)?s=e[i]=s.offset(w):S>-1&&(w=s.toA-S)<=d&&t.slice(s.fromA-w,s.fromA)==t.slice(S,s.toA)&&(s=e[i]=s.offset(-w))}}else{let f=D2(r,s.fromB,s.toB),w,S=f<0?-1:O2(r,s.toB,s.fromB);f>-1&&(w=f-s.fromB)<=u&&r.slice(s.fromB,f)==r.slice(s.toB,s.toB+w)?s=e[i]=s.offset(w):S>-1&&(w=s.toB-S)<=d&&r.slice(s.fromB-w,s.fromB)==r.slice(S,s.toB)&&(s=e[i]=s.offset(-w))}}n=s.toA}return HN(e,3),e}let Aa;try{Aa=new RegExp("[\\p{Alphabetic}\\p{Number}]","u")}catch{}function WN(e){return e>48&&e<58||e>64&&e<91||e>96&&e<123}function VN(e,t){if(t==e.length)return 0;let r=e.charCodeAt(t);return r<192?WN(r)?1:0:Aa?!XN(r)||t==e.length-1?Aa.test(String.fromCharCode(r))?1:0:Aa.test(e.slice(t,t+2))?2:0:0}function KN(e,t){if(!t)return 0;let r=e.charCodeAt(t-1);return r<192?WN(r)?1:0:Aa?!ZN(r)||t==1?Aa.test(String.fromCharCode(r))?1:0:Aa.test(e.slice(t-2,t))?2:0:0}const YN=8;function _2(e,t,r){if(t==e.length||!KN(e,t))return t;for(let n=t,i=t+r,s=0;s<YN;s++){let o=VN(e,n);if(!o||n+o>i)return n;n+=o}return t}function L2(e,t,r){if(!t||!VN(e,t))return t;for(let n=t,i=t-r,s=0;s<YN;s++){let o=KN(e,n);if(!o||n-o<i)return n;n-=o}return t}function O2(e,t,r){for(;t!=r;t--)if(e.charCodeAt(t-1)==10)return t;return-1}function D2(e,t,r){for(;t!=r;t++)if(e.charCodeAt(t)==10)return t;return-1}const XN=e=>e>=55296&&e<=56319,ZN=e=>e>=56320&&e<=57343;function di(e,t){return!t||t==e.length||!XN(e.charCodeAt(t-1))||!ZN(e.charCodeAt(t))}function Uq(e,t,r){var n;return Di=((n=r?.scanLimit)!==null&&n!==void 0?n:1e9)>>1,Mi=r?.timeout?Date.now()+r.timeout:0,$g=!1,Bq(e,t,_a(e,0,e.length,t,0,t.length))}function JN(){return!$g}function QN(e,t,r){return zq(Uq(e,t,r),e,t)}const Jn=vo.define({combine:e=>e[0]}),$q=_h.define(),e3=vo.define(),ln=rs.define({create(e){return null},update(e,t){for(let r of t.effects)r.is($q)&&(e=r.value);for(let r of t.state.facet(e3))e=r(e,t);return e}});function jm(e){let t=e.field(ln,!1);if(!t)return null;let r=e.facet(Jn);return{chunks:t,side:r?r.side:null}}class ai{constructor(t,r,n,i,s,o=!0){this.changes=t,this.fromA=r,this.toA=n,this.fromB=i,this.toB=s,this.precise=o}offset(t,r){return t||r?new ai(this.changes,this.fromA+t,this.toA+t,this.fromB+r,this.toB+r,this.precise):this}get endA(){return Math.max(this.fromA,this.toA-1)}get endB(){return Math.max(this.fromB,this.toB-1)}static build(t,r,n){let i=QN(t.toString(),r.toString(),n);return t3(i,t,r,0,0,JN())}static updateA(t,r,n,i,s){return z2(B2(t,i,!0,n.length),t,r,n,s)}static updateB(t,r,n,i,s){return z2(B2(t,i,!1,r.length),t,r,n,s)}}function M2(e,t,r,n){let i=r.lineAt(e),s=n.lineAt(t);return i.to==e&&s.to==t&&e<r.length&&t<n.length?[e+1,t+1]:[i.from,s.from]}function F2(e,t,r,n){let i=r.lineAt(e),s=n.lineAt(t);return i.from==e&&s.from==t?[e,t]:[i.to+1,s.to+1]}function t3(e,t,r,n,i,s){let o=[];for(let l=0;l<e.length;l++){let c=e[l],[d,u]=M2(c.fromA+n,c.fromB+i,t,r),[p,h]=F2(c.toA+n,c.toB+i,t,r),m=[c.offset(-d+n,-u+i)];for(;l<e.length-1;){let g=e[l+1],[f,w]=M2(g.fromA+n,g.fromB+i,t,r);if(f>p+1&&w>h+1)break;m.push(g.offset(-d+n,-u+i)),[p,h]=F2(g.toA+n,g.toB+i,t,r),l++}o.push(new ai(m,d,Math.max(d,p),u,Math.max(u,h),s))}return o}const Hs=1e3;function P2(e,t,r,n){let i=0,s=e.length;for(;;){if(i==s){let u=0,p=0;i&&({toA:u,toB:p}=e[i-1]);let h=t-(r?u:p);return[u+h,p+h]}let o=i+s>>1,l=e[o],[c,d]=r?[l.fromA,l.toA]:[l.fromB,l.toB];if(c>t)s=o;else if(d<=t)i=o+1;else return n?[l.fromA,l.fromB]:[l.toA,l.toB]}}function B2(e,t,r,n){let i=[];return t.iterChangedRanges((s,o,l,c)=>{let d=0,u=r?t.length:n,p=0,h=r?n:t.length;s>Hs&&([d,p]=P2(e,s-Hs,r,!0)),o<t.length-Hs&&([u,h]=P2(e,o+Hs,r,!1));let m=c-l-(o-s),g,[f,w]=r?[m,0]:[0,m];i.length&&(g=i[i.length-1]).toA>=d?i[i.length-1]={fromA:g.fromA,fromB:g.fromB,toA:u,toB:h,diffA:g.diffA+f,diffB:g.diffB+w}:i.push({fromA:d,toA:u,fromB:p,toB:h,diffA:f,diffB:w})}),i}function z2(e,t,r,n,i){if(!e.length)return t;let s=[];for(let o=0,l=0,c=0,d=0;;o++){let u=o==e.length?null:e[o],p=u?u.fromA+l:r.length,h=u?u.fromB+c:n.length;for(;d<t.length;){let w=t[d];if(w.toA+l>p||w.toB+c>h)break;s.push(w.offset(l,c)),d++}if(!u)break;let m=u.toA+l+u.diffA,g=u.toB+c+u.diffB,f=QN(r.sliceString(p,m),n.sliceString(h,g),i);for(let w of t3(f,r,n,p,h,JN()))s.push(w);for(l+=u.diffA,c+=u.diffB;d<t.length;){let w=t[d];if(w.fromA+l>m&&w.fromB+c>g)break;d++}}return s}const qq={scanLimit:500},r3=ko.fromClass(class{constructor(e){({deco:this.deco,gutter:this.gutter}=q2(e))}update(e){(e.docChanged||e.viewportChanged||Gq(e.startState,e.state)||Hq(e.startState,e.state))&&({deco:this.deco,gutter:this.gutter}=q2(e.view))}},{decorations:e=>e.deco});function Gq(e,t){return e.field(ln,!1)!=t.field(ln,!1)}function Hq(e,t){return e.facet(Jn)!=t.facet(Jn)}const U2=Qn.line({class:"cm-changedLine"}),n3=Qn.mark({class:"cm-changedText"}),Wq=Qn.mark({tagName:"ins",class:"cm-insertedLine"}),Vq=Qn.mark({tagName:"del",class:"cm-deletedLine"}),$2=new class extends Lh{constructor(){super(...arguments),this.elementClass="cm-changedLineGutter"}};function Kq(e,t,r,n,i,s){let o=r?e.fromA:e.fromB,l=r?e.toA:e.toB,c=0;if(o!=l){i.add(o,o,U2),i.add(o,l,r?Vq:Wq),s&&s.add(o,o,$2);for(let d=t.iterRange(o,l-1),u=o;!d.next().done;){if(d.lineBreak){u++,i.add(u,u,U2),s&&s.add(u,u,$2);continue}let p=u+d.value.length;if(n)for(;c<e.changes.length;){let h=e.changes[c],m=o+(r?h.fromA:h.fromB),g=o+(r?h.toA:h.toB),f=Math.max(u,m),w=Math.min(p,g);if(f<w&&i.add(f,w,n3),g<p)c++;else break}u=p}}}function q2(e){let t=e.state.field(ln),{side:r,highlightChanges:n,markGutter:i,overrideChunk:s}=e.state.facet(Jn),o=r=="a",l=new Zs,c=i?new Zs:null,{from:d,to:u}=e.viewport;for(let p of t){if((o?p.fromA:p.fromB)>=u)break;(o?p.toA:p.toB)>d&&(!s||!s(e.state,p,l,c))&&Kq(p,e.state.doc,o,n,l,c)}return{deco:l.finish(),gutter:c&&c.finish()}}const Ah=_h.define({map:(e,t)=>t.mapPos(e)});class Yq extends Oh{constructor(t){super(),this.lines=t}eq(t){return this.lines==t.lines}toDOM(t){let r=document.createElement("div");return r.className="cm-collapsedLines",r.textContent=t.state.phrase("$ unchanged lines",this.lines),r.addEventListener("click",n=>{let i=t.posAtDOM(n.target);t.dispatch({effects:Ah.of(i)});let{side:s,sibling:o}=t.state.facet(Jn);o&&o().dispatch({effects:Ah.of(Xq(i,t.state.field(ln),s=="a"))})}),r}ignoreEvent(t){return t instanceof MouseEvent}get estimatedHeight(){return 27}get type(){return"collapsed-unchanged-code"}}function Xq(e,t,r){let n=0,i=0;for(let s=0;;s++){let o=s<t.length?t[s]:null;if(!o||(r?o.fromA:o.fromB)>=e)return i+(e-n);[n,i]=r?[o.toA,o.toB]:[o.toB,o.toA]}}const Zq=rs.define({create(e){return Qn.none},update(e,t){e=e.map(t.changes);for(let r of t.effects)r.is(Ah)&&(e=e.update({filter:n=>n!=r.value}));return e},provide:e=>rn.decorations.from(e)});function Jq({margin:e=3,minSize:t=4}){return Zq.init(r=>Qq(r,e,t))}function Qq(e,t,r){let n=new Zs,i=e.facet(Jn).side=="a",s=e.field(ln),o=1;for(let l=0;;l++){let c=l<s.length?s[l]:null,d=l?o+t:1,u=c?e.doc.lineAt(i?c.fromA:c.fromB).number-1-t:e.doc.lines,p=u-d+1;if(p>=r&&n.add(e.doc.line(d).from,e.doc.line(u).to,Qn.replace({widget:new Yq(p),block:!0})),!c)break;o=e.doc.lineAt(Math.min(e.doc.length,i?c.toA:c.toB)).number}return n.finish()}const eG=rn.baseTheme({".cm-mergeView & .cm-scroller, .cm-mergeView &":{height:"auto !important",overflowY:"visible !important"},"&.cm-merge-a .cm-changedLine, .cm-deletedChunk":{backgroundColor:"rgba(160, 128, 100, .08)"},"&.cm-merge-b .cm-changedLine, .cm-inlineChangedLine":{backgroundColor:"rgba(100, 160, 128, .08)"},"&light.cm-merge-a .cm-changedText, &light .cm-deletedChunk .cm-deletedText":{background:"linear-gradient(#ee443366, #ee443366) bottom/100% 2px no-repeat"},"&dark.cm-merge-a .cm-changedText, &dark .cm-deletedChunk .cm-deletedText":{background:"linear-gradient(#ffaa9966, #ffaa9966) bottom/100% 2px no-repeat"},"&light.cm-merge-b .cm-changedText":{background:"linear-gradient(#22bb22aa, #22bb22aa) bottom/100% 2px no-repeat"},"&dark.cm-merge-b .cm-changedText":{background:"linear-gradient(#88ff88aa, #88ff88aa) bottom/100% 2px no-repeat"},"&.cm-merge-b .cm-deletedText":{background:"#ff000033"},".cm-insertedLine, .cm-deletedLine, .cm-deletedLine del":{textDecoration:"none"},".cm-deletedChunk":{paddingLeft:"6px","& .cm-chunkButtons":{position:"absolute",insetInlineEnd:"5px"},"& button":{border:"none",cursor:"pointer",color:"white",margin:"0 2px",borderRadius:"3px","&[name=accept]":{background:"#2a2"},"&[name=reject]":{background:"#d43"}}},".cm-collapsedLines":{padding:"5px 5px 5px 10px",cursor:"pointer","&:before":{content:'"⦚"',marginInlineEnd:"7px"},"&:after":{content:'"⦚"',marginInlineStart:"7px"}},"&light .cm-collapsedLines":{color:"#444",background:"linear-gradient(to bottom, transparent 0, #f3f3f3 30%, #f3f3f3 70%, transparent 100%)"},"&dark .cm-collapsedLines":{color:"#ddd",background:"linear-gradient(to bottom, transparent 0, #222 30%, #222 70%, transparent 100%)"},".cm-changeGutter":{width:"3px",paddingLeft:"1px"},"&light.cm-merge-a .cm-changedLineGutter, &light .cm-deletedLineGutter":{background:"#e43"},"&dark.cm-merge-a .cm-changedLineGutter, &dark .cm-deletedLineGutter":{background:"#fa9"},"&light.cm-merge-b .cm-changedLineGutter":{background:"#2b2"},"&dark.cm-merge-b .cm-changedLineGutter":{background:"#8f8"},".cm-inlineChangedLineGutter":{background:"#75d"}}),tG=new class extends Lh{constructor(){super(...arguments),this.elementClass="cm-deletedLineGutter"}},rG=n4.low(P3({class:"cm-changeGutter",markers:e=>{var t;return((t=e.plugin(r3))===null||t===void 0?void 0:t.gutter)||B3.empty},widgetMarker:(e,t)=>t instanceof a3?tG:null}));function nG(e){var t;let r=typeof e.original=="string"?r4.of(e.original.split(/\r?\n/)):e.original,n=e.diffConfig||qq;return[n4.low(r3),oG,eG,rn.editorAttributes.of({class:"cm-merge-b"}),e3.of((i,s)=>{let o=s.effects.find(l=>l.is(Hg));return o&&(i=ai.updateA(i,o.value.doc,s.startState.doc,o.value.changes,n)),s.docChanged&&(i=ai.updateB(i,s.state.field(ui),s.newDoc,s.changes,n)),i}),Jn.of({highlightChanges:e.highlightChanges!==!1,markGutter:e.gutter!==!1,syntaxHighlightDeletions:e.syntaxHighlightDeletions!==!1,syntaxHighlightDeletionsMaxLength:3e3,mergeControls:(t=e.mergeControls)!==null&&t!==void 0?t:!0,overrideChunk:e.allowInlineDiffs?uG:void 0,side:"b"}),ui.init(()=>r),e.gutter!==!1?rG:[],e.collapseUnchanged?Jq(e.collapseUnchanged):[],ln.init(i=>ai.build(r,i.doc,n))]}const Hg=_h.define(),ui=rs.define({create:()=>r4.empty,update(e,t){for(let r of t.effects)r.is(Hg)&&(e=r.value.doc);return e}}),G2=new WeakMap;class a3 extends Oh{constructor(t){super(),this.buildDOM=t,this.dom=null}eq(t){return this.dom==t.dom}toDOM(t){return this.dom||(this.dom=this.buildDOM(t))}}function aG(e,t,r){let n=G2.get(t.changes);if(n)return n;let i=o=>{let{highlightChanges:l,syntaxHighlightDeletions:c,syntaxHighlightDeletionsMaxLength:d,mergeControls:u}=e.facet(Jn),p=document.createElement("div");if(p.className="cm-deletedChunk",u){let N=p.appendChild(document.createElement("div"));N.className="cm-chunkButtons";let C=I=>{I.preventDefault(),iG(o,o.posAtDOM(p))},v=I=>{I.preventDefault(),sG(o,o.posAtDOM(p))};if(typeof u=="function")N.appendChild(u("accept",C)),N.appendChild(u("reject",v));else{let I=N.appendChild(document.createElement("button"));I.name="accept",I.textContent=e.phrase("Accept"),I.onmousedown=C;let M=N.appendChild(document.createElement("button"));M.name="reject",M.textContent=e.phrase("Reject"),M.onmousedown=v}}if(r||t.fromA>=t.toA)return p;let h=o.state.field(ui).sliceString(t.fromA,t.endA),m=c&&e.facet(a4),g=k(),f=t.changes,w=0,S=!1;function k(){let N=p.appendChild(document.createElement("div"));return N.className="cm-deletedLine",N.appendChild(document.createElement("del"))}function E(N,C,v){for(let I=N;I<C;){if(h.charAt(I)==`
|
|
832
832
|
`){g.firstChild||g.appendChild(document.createElement("br")),g=k(),I++;continue}let M=C,j=v+(S?" cm-deletedText":""),T=!1,P=h.indexOf(`
|
|
833
833
|
`,I);if(P>-1&&P<C&&(M=P),l&&w<f.length){let q=Math.max(0,S?f[w].toA:f[w].fromA);q<=M&&(M=q,S&&w++,T=!0)}if(M>I){let q=document.createTextNode(h.slice(I,M));if(j){let D=g.appendChild(document.createElement("span"));D.className=j,D.appendChild(q)}else g.appendChild(q);I=M}T&&(S=!S)}}if(m&&t.toA-t.fromA<=d){let N=m.parser.parse(h),C=0;Om(N,{style:v=>i4(e,v)},(v,I,M)=>{v>C&&E(C,v,""),E(v,I,M),C=I}),E(C,h.length,"")}else E(0,h.length,"");return g.firstChild||g.appendChild(document.createElement("br")),p},s=Qn.widget({block:!0,side:-1,widget:new a3(i)});return G2.set(t.changes,s),s}function iG(e,t){let{state:r}=e,n=t??r.selection.main.head,i=e.state.field(ln).find(c=>c.fromB<=n&&c.endB>=n);if(!i)return!1;let s=e.state.sliceDoc(i.fromB,Math.max(i.fromB,i.toB-1)),o=e.state.field(ui);i.fromB!=i.toB&&i.toA<=o.length&&(s+=e.state.lineBreak);let l=z3.of({from:i.fromA,to:Math.min(o.length,i.toA),insert:s},o.length);return e.dispatch({effects:Hg.of({doc:l.apply(o),changes:l}),userEvent:"accept"}),!0}function sG(e,t){let{state:r}=e,n=t??r.selection.main.head,i=r.field(ln).find(l=>l.fromB<=n&&l.endB>=n);if(!i)return!1;let o=r.field(ui).sliceString(i.fromA,Math.max(i.fromA,i.toA-1));return i.fromA!=i.toA&&i.toB<=r.doc.length&&(o+=r.lineBreak),e.dispatch({changes:{from:i.fromB,to:Math.min(r.doc.length,i.toB),insert:o},userEvent:"revert"}),!0}function H2(e){let t=new Zs;for(let r of e.field(ln)){let n=e.facet(Jn).overrideChunk&&i3(e,r);t.add(r.fromB,r.fromB,aG(e,r,!!n))}return t.finish()}const oG=rs.define({create:e=>H2(e),update(e,t){return t.state.field(ln,!1)!=t.startState.field(ln,!1)?H2(t.state):e},provide:e=>rn.decorations.from(e)}),W2=new WeakMap;function i3(e,t){let r=W2.get(t);if(r!==void 0)return r;r=null;let n=e.field(ui),i=e.doc,s=n.lineAt(t.endA).number-n.lineAt(t.fromA).number+1,o=i.lineAt(t.endB).number-i.lineAt(t.fromB).number+1;e:if(s==o&&s<10){let l=[],c=0,d=t.fromA,u=t.fromB;for(let p of t.changes){if(p.fromA<p.toA){c+=p.toA-p.fromA;let h=n.sliceString(d+p.fromA,d+p.toA);if(/\n/.test(h))break e;l.push(Qn.widget({widget:new lG(h),side:-1}).range(u+p.fromB))}p.fromB<p.toB&&l.push(n3.range(u+p.fromB,u+p.toB))}c<t.endA-t.fromA-s*2&&(r=l)}return W2.set(t,r),r}class lG extends Oh{constructor(t){super(),this.text=t}eq(t){return this.text==t.text}toDOM(t){let r=document.createElement("del");return r.className="cm-deletedText",r.textContent=this.text,r}}const cG=new class extends Lh{constructor(){super(...arguments),this.elementClass="cm-inlineChangedLineGutter"}},dG=Qn.line({class:"cm-inlineChangedLine"});function uG(e,t,r,n){let i=i3(e,t),s=0;if(!i)return!1;for(let o=e.doc.lineAt(t.fromB);;){for(n&&n.add(o.from,o.from,cG),r.add(o.from,o.from,dG);s<i.length&&i[s].to<=o.to;){let l=i[s++];r.add(l.from,l.to,l.value)}if(o.to>=t.endB)break;o=e.doc.lineAt(o.to+1)}return!0}var pG=function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(e);i<n.length;i++)t.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(e,n[i])&&(r[n[i]]=e[n[i]]);return r};const Ir=vo.define({combine:e=>{const t=[];for(let r of e){if(!r)continue;const{create:n,gutters:i}=r,s=pG(r,["create","gutters"]);t.push(Object.assign(Object.assign({},s),{enabled:!0,gutters:i?i.filter(o=>Object.keys(o).length>0):void 0}))}return U3(t,{enabled:t.length>0,displayText:"characters",eventHandlers:{},showOverlay:"always",gutters:[]})}}),Hr={PixelMultiplier:2,SizeRatio:4,MaxWidth:120},mG=rn.theme({".cm-minimap-overlay-container":{position:"absolute",top:0,height:"100%",width:"100%","&.cm-minimap-overlay-mouse-over":{opacity:0,transition:"visibility 0s linear 300ms, opacity 300ms"},"&.cm-minimap-overlay-mouse-over:hover":{opacity:1,transition:"visibility 0s linear 0ms, opacity 300ms"},"&.cm-minimap-overlay-off":{display:"none"},"& .cm-minimap-overlay":{background:"rgb(121, 121, 121)",opacity:"0.2",position:"absolute",right:0,top:0,width:"100%",transition:"top 0s ease-in 0ms","&:hover":{opacity:"0.3"}},"&.cm-minimap-overlay-active":{opacity:1,visibility:"visible",transition:"visibility 0s linear 0ms, opacity 300ms","& .cm-minimap-overlay":{opacity:"0.4"}}}}),la=Hr.PixelMultiplier*Hr.SizeRatio,hG=ko.fromClass(class{constructor(e){this.view=e,this._isDragging=!1,e.state.facet(Ir).enabled&&this.create(e)}create(e){this.container=ii("div",{class:"cm-minimap-overlay-container"}),this.dom=ii("div",{class:"cm-minimap-overlay"}),this.container.appendChild(this.dom),this.container.addEventListener("mousedown",this.onMouseDown.bind(this)),window.addEventListener("mouseup",this.onMouseUp.bind(this)),window.addEventListener("mousemove",this.onMouseMove.bind(this));const t=e.dom.querySelector(".cm-minimap-inner");t&&t.appendChild(this.container),this.computeShowOverlay(),this.computeHeight(),this.computeTop()}remove(){this.container&&(this.container.removeEventListener("mousedown",this.onMouseDown),window.removeEventListener("mouseup",this.onMouseUp),window.removeEventListener("mousemove",this.onMouseMove),this.container.remove())}update(e){const t=e.startState.facet(Ir).enabled,r=e.state.facet(Ir).enabled;if(t&&!r){this.remove();return}!t&&r&&this.create(e.view),r&&(this.computeShowOverlay(),e.geometryChanged&&(this.computeHeight(),this.computeTop()))}computeHeight(){if(!this.dom)return;const e=this.view.dom.clientHeight/la;this.dom.style.height=e+"px"}computeTop(){if(!this._isDragging&&this.dom){const{clientHeight:e,scrollHeight:t,scrollTop:r}=this.view.scrollDOM,n=t-e,i=r/la,s=e/la,o=e-s;let l=r/n;isNaN(l)&&(l=0);const c=o*l,d=Math.min(c,i);this.dom.style.top=d+"px"}}computeShowOverlay(){if(!this.container)return;const{showOverlay:e}=this.view.state.facet(Ir);e==="mouse-over"?this.container.classList.add("cm-minimap-overlay-mouse-over"):this.container.classList.remove("cm-minimap-overlay-mouse-over");const{clientHeight:t,scrollHeight:r}=this.view.scrollDOM;t===r?this.container.classList.add("cm-minimap-overlay-off"):this.container.classList.remove("cm-minimap-overlay-off")}onMouseDown(e){if(!this.container||e.button===2)return;const{clientY:t,target:r}=e;if(r===this.dom){this._dragStartY=e.clientY,this._isDragging=!0,this.container.classList.add("cm-minimap-overlay-active");return}const{clientHeight:n,scrollHeight:i,scrollTop:s}=this.view.scrollDOM,o=r.getBoundingClientRect().top,l=(t-o)*la,c=s/(i-n),u=(n*la-n)*c,p=Math.max(0,s-u);this.view.scrollDOM.scrollTop=p+l-n/2}onMouseUp(e){this._isDragging&&this.container&&(this._dragStartY=void 0,this._isDragging=!1,this.container.classList.remove("cm-minimap-overlay-active"))}onMouseMove(e){if(!this._isDragging||!this.dom)return;if(e.preventDefault(),e.stopPropagation(),!this._dragStartY){this._dragStartY=e.clientY;return}const t=e.clientY-this._dragStartY,r=t<0,n=t>0;this._dragStartY=e.clientY;const i=this.dom.getBoundingClientRect().height,s=this.dom.getBoundingClientRect().y,o=s+i,l=parseFloat(this.dom.style.top),c=this.view.scrollDOM.scrollTop,d=this.view.scrollDOM.clientHeight,u=this.view.scrollDOM.scrollHeight,p=c===0,h=Math.round(c)>=Math.round(u-d);if(p&&r||p&&e.clientY<s||h&&n||h&&e.clientY>o)return;const m=this.view.scrollDOM.scrollHeight,g=this.view.scrollDOM.clientHeight,f=(m-g)/la,w=g-g/la,S=l+t,k=S/w,E=(m-g)*k,N=S*la;this.view.scrollDOM.scrollTop=Math.max(E,N);const C=Math.min(Math.max(0,S),Math.min(w,f));this.dom.style.top=C+"px"}destroy(){this.remove()}},{eventHandlers:{scroll(){requestAnimationFrame(()=>this.computeTop())}}}),gG=[mG,hG];class Wg{constructor(t){this.map=new Map,this.view=t}get(t){return this.map.get(t)}set(t,r){this.map.set(t,r)}}function V2(e){var t;if(!e.facet(Ir).enabled)return[];const r=[],n=e.doc.iterLines(),i=$3(e).iter();let s=0;for(n.next();!n.done;){const o=n.value;let l=s,c=l+o.length;for(;i.value&&i.to<l;)i.next();const{from:d,to:u}=i,p=l>=d&&l<u,h=c>d&&c<=u;if(p){let m=(t=r.pop())!==null&&t!==void 0?t:[],g=m.pop();g&&g.folded&&(g.to=u),g&&m.push(g),(!g||!g.folded)&&m.push({from:d,to:u,folded:!0}),h||m.push({from:u,to:c,folded:!1}),r.push(m)}else h?r.push([{from:l,to:d,folded:!1},{from:d,to:u,folded:!0}]):r.push([{from:l,to:c,folded:!1}]);s=c+1,n.next()}return r}const pi=rs.define({create:e=>V2(e),update:(e,t)=>$o([t])||t.docChanged?V2(t.state):e});function $o(e){return e.find(t=>t.effects.find(r=>r.is(q3)||r.is(G3)))}class fG extends Wg{constructor(t){super(t),this.count=void 0}shouldUpdate(t){if(!t.state.facet(Ir).enabled)return!1;if(t.docChanged)return!0;for(const r of t.transactions)for(const n of r.effects)if(n.is(H3))return!0;return!!($o(t.transactions)||this.count===void 0)}update(t){if(!this.shouldUpdate(t))return;this.map.clear();const r=t.state.field(pi);this.count=W3(t.state),V3(t.state,(n,i,s)=>{const o=this.findLine(i,r),l=this.findLine(s,r);let c=n.severity;for(let d=o;d<=l;d++){const u=this.get(d);u&&(c=[c,u].sort(this.sort.bind(this)).slice(0,1)[0]),this.set(d,c)}})}drawLine(t,r){const{context:n,lineHeight:i,offsetX:s,offsetY:o}=t,l=this.get(r);l&&(n.globalAlpha=.65,n.beginPath(),n.rect(s,o,n.canvas.width-s,i),n.fillStyle=this.color(l),n.fill())}findLine(t,r){return r.findIndex(i=>{const s=i.slice(0,1)[0],o=i.slice(-1)[0];return!s||!o?!1:s.from<=t&&t<=o.to})+1}color(t){return t==="error"?"#d11":t==="warning"?"orange":"#999"}sort(t,r){return this.score(r)-this.score(t)}score(t){switch(t){case"error":return 3;case"warning":return 2;default:return 1}}}function bG(e){return new fG(e)}class xG extends Wg{constructor(t){super(t),this.getDrawInfo(),this._themeClasses=t.dom.classList.value}shouldUpdate(t){return t.state.facet(Ir).enabled?!!(t.docChanged||t.selectionSet||this._themeClasses!==this.view.dom.classList.value||$o(t.transactions)):!1}update(t){if(!this.shouldUpdate(t))return;this.map.clear(),this._themeClasses!==this.view.dom.classList.value&&(this._drawInfo=void 0,this._themeClasses=this.view.dom.classList.value);const{ranges:r}=t.state.selection;let n=0;for(const[i,s]of t.state.field(pi).entries()){const o=[];let l=0;for(const d of s){do{if(n>=r.length||d.to<r[n].from)continue;if(r[n].from===r[n].to){n++;continue}const u=r[n],p={from:l+Math.max(d.from,u.from)-d.from,to:l+Math.min(d.to,u.to)-d.from,extends:u.to>d.to},h=o.slice(-1)[0];if(h&&h.to===p.from){let{to:m}=p;d.folded&&p.extends?m=p.from+1:d.folded&&!p.extends&&(m=h.to),o[o.length-1]=Object.assign(Object.assign({},h),{to:m,extends:p.extends})}else d.folded||o.push(p);if(p.extends)break;n++}while(n<r.length&&d.to>=r[n].from);l+=d.folded?1:d.to-d.from}if(o.length===0)continue;const c=i+1;this.map.set(c,o)}}drawLine(t,r){let{context:n,lineHeight:i,charWidth:s,offsetX:o,offsetY:l}=t;const c=this.get(r);if(c)for(const d of c){const u=o+d.from*s,p=(d.to-d.from)*s,h=n.canvas.width-u;d.extends&&(n.globalAlpha=.65,n.beginPath(),n.rect(u,l,h,i),n.fillStyle=this.getDrawInfo().backgroundColor,n.fill()),n.globalAlpha=1,n.beginPath(),n.rect(u,l,p,i),n.fillStyle=this.getDrawInfo().backgroundColor,n.fill()}}getDrawInfo(){if(this._drawInfo)return this._drawInfo;const t=document.createElement("span");t.setAttribute("class","cm-selectionBackground"),this.view.dom.appendChild(t);const n={backgroundColor:window.getComputedStyle(t).backgroundColor};return this._drawInfo=n,this.view.dom.removeChild(t),n}}function yG(e){return new xG(e)}class vG extends Wg{constructor(t){super(t),this._fontInfoMap=new Map,this._themeClasses=new Set(t.dom.classList.values()),t.state.facet(Ir).enabled&&this.updateImpl(t.state)}shouldUpdate(t){return!!(t.docChanged||t.state.facet(Ir)!==t.startState.facet(Ir)||this.themeChanged()||$o(t.transactions))}update(t){this.shouldUpdate(t)&&(this._highlightingCallbackId&&(typeof window.requestIdleCallback<"u"?cancelIdleCallback(this._highlightingCallbackId):clearTimeout(this._highlightingCallbackId)),this.updateImpl(t.state,t.changes))}updateImpl(t,r){var n;this.map.clear(),this._displayText=t.facet(Ir).displayText,this.themeChanged()&&this._fontInfoMap.clear();let i;if(this._previousTree&&r){const p=rf.addTree(this._previousTree),h=[];r.iterChangedRanges((m,g,f,w)=>h.push({fromA:m,toA:g,fromB:f,toB:w})),i=rf.applyChanges(p,h)}const s=t.doc.toString(),o=(n=t.facet(a4))===null||n===void 0?void 0:n.parser,l=o?o.parse(s,i):void 0;this._previousTree=l;const c={style:p=>i4(t,p)};let d=[];if(l){const p=t.doc.lineAt(this.view.viewport.from).number,h=t.doc.lineAt(this.view.viewport.to).number,m=h-p,g=p/(t.doc.lines-m),{SizeRatio:f,PixelMultiplier:w}=Hr,S=m*f*w,k=g*S,E=Math.max(1,Math.floor(p-k)),N=Math.min(h+Math.floor(S-k),t.doc.lines);Om(l,c,(C,v,I)=>{d.push({from:C,to:v,tags:I})},t.doc.line(E).from,t.doc.line(N).to)}this.updateMapImpl(t,d),d=[];const u=()=>{l&&(Om(l,c,(p,h,m)=>{d.push({from:p,to:h,tags:m})}),this.updateMapImpl(t,d),this._highlightingCallbackId=void 0)};this._highlightingCallbackId=typeof window.requestIdleCallback<"u"?requestIdleCallback(u):setTimeout(u)}updateMapImpl(t,r){this.map.clear();const n=t.doc.toString(),i=r.values();let s=i.next();for(const[o,l]of t.field(pi).entries()){const c=[];for(const u of l){if(u.from===u.to)continue;if(u.folded){c.push({text:"…",tags:""});continue}let p=u.from;for(;!s.done&&s.value.from<u.to;){const{from:h,to:m,tags:g}=s.value;if(m<p){s=i.next();continue}h>p&&c.push({text:n.slice(p,h),tags:""});const f=Math.max(h,u.from),w=Math.min(m,u.to);if(c.push({text:n.slice(f,w),tags:g}),p=w,m>w)break;s=i.next()}p!==u.to&&c.push({text:n.slice(p,u.to),tags:""})}const d=o+1;this.map.set(d,c)}}measure(t){const{color:r,font:n,lineHeight:i}=this.getFontInfo("");return t.textBaseline="ideographic",t.fillStyle=r,t.font=n,{charWidth:t.measureText("_").width,lineHeight:i}}beforeDraw(){this._fontInfoMap.clear()}drawLine(t,r){const n=this.get(r);if(!n)return;let{context:i,charWidth:s,lineHeight:o,offsetX:l,offsetY:c}=t,d;i.textBaseline="ideographic";for(const u of n){const p=this.getFontInfo(u.tags);switch((!d||d.color!==p.color)&&(i.fillStyle=p.color),(!d||d.font!==p.font)&&(i.font=p.font),d=p,o=Math.max(o,p.lineHeight),this._displayText){case"characters":{i.fillText(u.text,l,c+o),l+=u.text.length*s;break}case"blocks":{const h=/\S+/g;let m;for(;(m=h.exec(u.text))!==null;){const g=l+m.index*s;let f=(h.lastIndex-m.index)*s;if(g>i.canvas.width)break;g+f>i.canvas.width&&(f=i.canvas.width-g);const w=2/Hr.SizeRatio,S=o-w;i.fillStyle=p.color,i.globalAlpha=.65,i.beginPath(),i.rect(g,c,f,S),i.fill()}l+=u.text.length*s;break}}}}getFontInfo(t){const r=this._fontInfoMap.get(t);if(r)return r;const n=ii("span",{class:t}),i=ii("div",{class:"cm-line",style:"display: none"},n);this.view.contentDOM.appendChild(i);const s=window.getComputedStyle(n),o=parseFloat(s.lineHeight)/Hr.SizeRatio,l={color:s.color,font:`${s.fontStyle} ${s.fontWeight} ${o}px ${s.fontFamily}`,lineHeight:o};return this._fontInfoMap.set(t,l),this.view.contentDOM.removeChild(i),l}themeChanged(){const t=this._themeClasses,r=new Set(this.view.dom.classList.values());if(this._themeClasses=r,!t||(t.delete("cm-focused"),r.delete("cm-focused"),t.size!==r.size))return!0;let n=!0;return t.forEach(i=>{r.has(i)||(n=!1)}),!n}}function kG(e){return new vG(e)}const s3=4;function wG(e,t,r){const n=e[r];n&&(t.context.fillStyle=n,t.context.globalAlpha=1,t.context.beginPath(),t.context.rect(t.offsetX,t.offsetY,s3,t.lineHeight),t.context.fill())}const SG=rn.theme({"&":{height:"100%",overflowY:"auto"},"& .cm-minimap-gutter":{borderRight:0,flexShrink:0,left:"unset",position:"sticky",right:0,top:0},"& .cm-minimap-inner":{height:"100%",position:"absolute",right:0,top:0,overflowY:"hidden","& canvas":{display:"block"}},"& .cm-minimap-box-shadow":{boxShadow:"12px 0px 20px 5px #6c6c6c"}}),K2=6,EG=ko.fromClass(class{constructor(e){this.view=e,this.text=kG(e),this.selection=yG(e),this.diagnostic=bG(e),e.state.facet(Fi)&&this.create(e)}create(e){const t=e.state.facet(Fi);if(!t)throw Error("Expected nonnull");this.inner=ii("div",{class:"cm-minimap-inner"}),this.canvas=ii("canvas"),this.dom=t.create(e).dom,this.dom.classList.add("cm-gutters"),this.dom.classList.add("cm-minimap-gutter"),this.inner.appendChild(this.canvas),this.dom.appendChild(this.inner),this.view.scrollDOM.insertBefore(this.dom,this.view.contentDOM.nextSibling);for(const r in this.view.state.facet(Ir).eventHandlers){const n=this.view.state.facet(Ir).eventHandlers[r];n&&this.dom.addEventListener(r,i=>n(i,this.view))}}remove(){this.dom&&this.dom.remove()}update(e){const t=e.startState.facet(Fi),r=e.state.facet(Fi);if(t&&!r){this.remove();return}!t&&r&&this.create(e.view),r&&(this.text.update(e),this.selection.update(e),this.diagnostic.update(e),this.render())}getWidth(){const e=this.view.dom.clientWidth;if(e<=Hr.MaxWidth*K2){const t=e/(Hr.MaxWidth*K2);return Hr.MaxWidth*t}return Hr.MaxWidth}render(){if(!this.dom||!this.canvas||!this.inner)return;this.text.beforeDraw(),this.updateBoxShadow(),this.dom.style.width=this.getWidth()+"px",this.canvas.style.maxWidth=this.getWidth()+"px",this.canvas.width=this.getWidth()*Hr.PixelMultiplier;const e=this.view.dom.getBoundingClientRect().height;this.inner.style.minHeight=e+"px",this.canvas.height=e*Hr.PixelMultiplier,this.canvas.style.height=e+"px";const t=this.canvas.getContext("2d");if(!t)return;t.clearRect(0,0,this.canvas.width,this.canvas.height);const{charWidth:r,lineHeight:n}=this.text.measure(t);let{startIndex:i,endIndex:s,offsetY:o}=this.canvasStartAndEndIndex(t,n);const l=this.view.state.facet(Ir).gutters;for(let c=i;c<s;c++){const d=this.view.state.field(pi);if(c>=d.length)break;const u={offsetX:0,offsetY:o,context:t,lineHeight:n,charWidth:r};if(l.length){u.offsetX+=2;for(let p of l)wG(p,u,c+1),u.offsetX+=s3;u.offsetX+=2}this.text.drawLine(u,c+1),this.selection.drawLine(u,c+1),this.diagnostic.drawLine(u,c+1),o+=n}t.restore()}canvasStartAndEndIndex(e,t){let{top:r,bottom:n}=this.view.documentPadding;r/=Hr.SizeRatio,n/=Hr.SizeRatio;const i=e.canvas.height,{clientHeight:s,scrollHeight:o,scrollTop:l}=this.view.scrollDOM;let c=l/(o-s);isNaN(c)&&(c=0);const d=this.view.state.field(pi).length,u=r+n+d*t,p=Math.max(0,c*(u-i)),h=Math.max(0,r-p),m=Math.round(Math.max(0,p-r)/t),g=Math.round((i-h)/t);return{startIndex:m,endIndex:m+g,offsetY:h}}updateBoxShadow(){if(!this.canvas)return;const{clientWidth:e,scrollWidth:t,scrollLeft:r}=this.view.scrollDOM;e+r<t?this.canvas.classList.add("cm-minimap-box-shadow"):this.canvas.classList.remove("cm-minimap-box-shadow")}destroy(){this.remove()}},{eventHandlers:{scroll(){requestAnimationFrame(()=>this.render())}},provide:e=>rn.scrollMargins.of(t=>{var r;const n=(r=t.plugin(e))===null||r===void 0?void 0:r.getWidth();return n?{right:n}:null})}),Fi=vo.define({combine:e=>{var t;return(t=e.find(r=>r!==null))!==null&&t!==void 0?t:null},enables:e=>[[Ir.compute([e],t=>t.facet(e)),SG,pi,EG,gG]]});function Ih({file:e,onClose:t,projectPath:r,isSidebar:n=!1,isExpanded:i=!1,onToggleExpand:s=null}){const{t:o}=Ht("codeEditor"),[l,c]=x.useState(""),[d,u]=x.useState(!0),[p,h]=x.useState(!1),[m,g]=x.useState(!1),[f,w]=x.useState(()=>{const F=localStorage.getItem("codeEditorTheme");return F?F==="dark":!0}),[S,k]=x.useState(!1),[E,N]=x.useState(!!e.diffInfo),[C,v]=x.useState(()=>localStorage.getItem("codeEditorWordWrap")==="true"),[I,M]=x.useState(()=>localStorage.getItem("codeEditorShowMinimap")!=="false"),[j,T]=x.useState(()=>localStorage.getItem("codeEditorLineNumbers")!=="false"),[P,q]=x.useState(()=>localStorage.getItem("codeEditorFontSize")||"14"),D=x.useRef(null),z=x.useMemo(()=>{if(!e.diffInfo||!E||!I)return[];const F={};return[Fi.compute(["doc"],te=>{const Z=jm(te)?.chunks||[];return Object.keys(F).forEach(me=>delete F[me]),Z.forEach(me=>{const ke=te.doc.lineAt(me.fromB).number,se=te.doc.lineAt(Math.min(me.toB,te.doc.length)).number;for(let _e=ke;_e<=se;_e++)F[_e]=f?"rgba(34, 197, 94, 0.8)":"rgba(34, 197, 94, 1)"}),{create:()=>({dom:document.createElement("div")}),displayText:"blocks",showOverlay:"always",gutters:[F]}})]},[e.diffInfo,E,I,f]),U=x.useMemo(()=>!e.diffInfo||!E?[]:[ko.fromClass(class{constructor(F){setTimeout(()=>{const _=jm(F.state)?.chunks||[];if(_.length>0){const Z=_[0];F.dispatch({effects:rn.scrollIntoView(Z.fromB,{y:"center"})})}},100)}update(){}destroy(){}})],[e.diffInfo,E]),G=x.useMemo(()=>{const F=te=>{const _=document.createElement("div");_.className="cm-editor-toolbar-panel";let Z=0;const me=()=>{const ke=e.diffInfo&&E,_e=(ke?jm(te.state):null)?.chunks||[],oe=_e.length;let fe='<div style="display: flex; align-items: center; justify-content: space-between; width: 100%;">';if(fe+='<div style="display: flex; align-items: center; gap: 8px;">',ke&&(fe+=`
|
|
834
834
|
<span style="font-weight: 500;">${oe>0?`${Z+1}/${oe}`:"0"} ${o("toolbar.changes")}</span>
|
|
@@ -939,7 +939,7 @@ ${Ot}`:Ot:Dt.push({type:"assistant",content:Ot,timestamp:new Date,isStreaming:!0
|
|
|
939
939
|
}
|
|
940
940
|
`}),a.jsx("div",{className:n?"w-full h-full flex flex-col":`fixed inset-0 z-40 md:bg-black/50 md:flex md:items-center md:justify-center md:p-4 ${m?"md:p-0":""}`,children:a.jsxs("div",{className:n?"bg-background flex flex-col w-full h-full":`bg-background shadow-2xl flex flex-col ${"w-full h-full md:rounded-lg md:shadow-2xl"+(m?" md:w-full md:h-full md:rounded-none":" md:w-full md:max-w-6xl md:h-[80vh] md:max-h-[80vh]")}`,children:[a.jsxs("div",{className:"flex items-center justify-between p-4 border-b border-border flex-shrink-0 min-w-0",children:[a.jsx("div",{className:"flex items-center gap-3 min-w-0 flex-1",children:a.jsxs("div",{className:"min-w-0 flex-1",children:[a.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[a.jsx("h3",{className:"font-medium text-gray-900 dark:text-white truncate",children:e.name}),e.diffInfo&&a.jsx("span",{className:"text-xs bg-blue-100 dark:bg-blue-900 text-blue-600 dark:text-blue-300 px-2 py-1 rounded whitespace-nowrap",children:o("header.showingChanges")})]}),a.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400 truncate",children:e.path})]})}),a.jsxs("div",{className:"flex items-center gap-1 md:gap-2 flex-shrink-0",children:[a.jsx("button",{onClick:ue,className:"p-2 md:p-2 text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-white rounded-md hover:bg-gray-100 dark:hover:bg-gray-800 min-w-[44px] min-h-[44px] md:min-w-0 md:min-h-0 flex items-center justify-center",title:o("actions.download"),children:a.jsx(Qs,{className:"w-5 h-5 md:w-4 md:h-4"})}),a.jsx("button",{onClick:K,disabled:p,className:`px-3 py-2 text-white rounded-md disabled:opacity-50 flex items-center gap-2 transition-colors min-h-[44px] md:min-h-0 ${S?"bg-green-600 hover:bg-green-700":"bg-blue-600 hover:bg-blue-700"}`,children:S?a.jsxs(a.Fragment,{children:[a.jsx("svg",{className:"w-5 h-5 md:w-4 md:h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})}),a.jsx("span",{className:"hidden sm:inline",children:o("actions.saved")})]}):a.jsxs(a.Fragment,{children:[a.jsx(to,{className:"w-5 h-5 md:w-4 md:h-4"}),a.jsx("span",{className:"hidden sm:inline",children:o(p?"actions.saving":"actions.save")})]})}),!n&&a.jsx("button",{onClick:R,className:"hidden md:flex p-2 text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-white rounded-md hover:bg-gray-100 dark:hover:bg-gray-800 items-center justify-center",title:o(m?"actions.exitFullscreen":"actions.fullscreen"),children:m?a.jsx(f4,{className:"w-4 h-4"}):a.jsx(Ph,{className:"w-4 h-4"})}),a.jsx("button",{onClick:t,className:"p-2 md:p-2 text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-white rounded-md hover:bg-gray-100 dark:hover:bg-gray-800 min-w-[44px] min-h-[44px] md:min-w-0 md:min-h-0 flex items-center justify-center",title:o("actions.close"),children:a.jsx(Bt,{className:"w-6 h-6 md:w-4 md:h-4"})})]})]}),a.jsx("div",{className:"flex-1 overflow-hidden",children:a.jsx(s4,{ref:D,value:l,onChange:c,extensions:[...re(e.name),...G,...e.diffInfo&&E&&e.diffInfo.old_string!==void 0?[nG({original:e.diffInfo.old_string,mergeControls:!1,highlightChanges:!0,syntaxHighlightDeletions:!1,gutter:!0}),...z,...U]:[],...C?[rn.lineWrapping]:[]],theme:f?o4:void 0,height:"100%",style:{fontSize:`${P}px`,height:"100%"},basicSetup:{lineNumbers:j,foldGutter:!0,dropCursor:!1,allowMultipleSelections:!1,indentOnInput:!0,bracketMatching:!0,closeBrackets:!0,autocompletion:!0,highlightSelectionMatches:!0,searchKeymap:!0}})}),a.jsxs("div",{className:"flex items-center justify-between p-3 border-t border-border bg-muted flex-shrink-0",children:[a.jsxs("div",{className:"flex items-center gap-4 text-sm text-gray-600 dark:text-gray-400",children:[a.jsxs("span",{children:[o("footer.lines")," ",l.split(`
|
|
941
941
|
`).length]}),a.jsxs("span",{children:[o("footer.characters")," ",l.length]})]}),a.jsx("div",{className:"text-sm text-gray-500 dark:text-gray-400",children:o("footer.shortcuts")})]})]})})]})}function NG({file:e,onClose:t}){const r=`/api/projects/${e.projectName}/files/content?path=${encodeURIComponent(e.path)}`,[n,i]=x.useState(null),[s,o]=x.useState(null),[l,c]=x.useState(!0);return x.useEffect(()=>{let d;const u=new AbortController;return(async()=>{try{c(!0),o(null),i(null);const h=await Ce(r,{signal:u.signal});if(!h.ok)throw new Error(`Request failed with status ${h.status}`);const m=await h.blob();d=URL.createObjectURL(m),i(d)}catch(h){if(h.name==="AbortError")return;console.error("Error loading image:",h),o("Unable to load image")}finally{c(!1)}})(),()=>{u.abort(),d&&URL.revokeObjectURL(d)}},[r]),a.jsx("div",{className:"fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50",children:a.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow-xl max-w-4xl max-h-[90vh] w-full mx-4 overflow-hidden",children:[a.jsxs("div",{className:"flex items-center justify-between p-4 border-b",children:[a.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white",children:e.name}),a.jsx(Be,{variant:"ghost",size:"sm",onClick:t,className:"h-8 w-8 p-0",children:a.jsx(Bt,{className:"h-4 w-4"})})]}),a.jsxs("div",{className:"p-4 flex justify-center items-center bg-gray-50 dark:bg-gray-900 min-h-[400px]",children:[l&&a.jsx("div",{className:"text-center text-gray-500 dark:text-gray-400",children:a.jsx("p",{children:"Loading image…"})}),!l&&n&&a.jsx("img",{src:n,alt:e.name,className:"max-w-full max-h-[70vh] object-contain rounded-lg shadow-md"}),!l&&!n&&a.jsxs("div",{className:"text-center text-gray-500 dark:text-gray-400",children:[a.jsx("p",{children:s||"Unable to load image"}),a.jsx("p",{className:"text-sm mt-2 break-all",children:e.path})]})]}),a.jsx("div",{className:"p-4 border-t bg-gray-50 dark:bg-gray-800",children:a.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400",children:e.path})})]})})}function CG({selectedProject:e}){const{t}=Ht(),[r,n]=x.useState([]),[i,s]=x.useState(!1),[o,l]=x.useState(new Set),[c,d]=x.useState(null),[u,p]=x.useState(null),[h,m]=x.useState("detailed"),[g,f]=x.useState(""),[w,S]=x.useState([]);x.useEffect(()=>{e&&E()},[e]),x.useEffect(()=>{const D=localStorage.getItem("file-tree-view-mode");D&&["simple","detailed","compact"].includes(D)&&m(D)},[]),x.useEffect(()=>{if(!g.trim())S(r);else{const D=k(r,g.toLowerCase());S(D);const z=U=>{U.forEach(G=>{G.type==="directory"&&G.children&&G.children.length>0&&(l(re=>new Set(re.add(G.path))),z(G.children))})};z(D)}},[r,g]);const k=(D,z)=>D.reduce((U,G)=>{const re=G.name.toLowerCase().includes(z);let K=[];return G.type==="directory"&&G.children&&(K=k(G.children,z)),(re||K.length>0)&&U.push({...G,children:K}),U},[]),E=async()=>{s(!0);try{const D=await yt.getFiles(e.name);if(!D.ok){const U=await D.text();console.error("❌ File fetch failed:",D.status,U),n([]);return}const z=await D.json();n(z)}catch(D){console.error("❌ Error fetching files:",D),n([])}finally{s(!1)}},N=D=>{const z=new Set(o);z.has(D)?z.delete(D):z.add(D),l(z)},C=D=>{m(D),localStorage.setItem("file-tree-view-mode",D)},v=D=>{if(!D||D===0)return"0 B";const z=1024,U=["B","KB","MB","GB"],G=Math.floor(Math.log(D)/Math.log(z));return parseFloat((D/Math.pow(z,G)).toFixed(1))+" "+U[G]},I=D=>{if(!D)return"-";const z=new Date,U=new Date(D),G=Math.floor((z-U)/1e3);return G<60?t("fileTree.justNow"):G<3600?t("fileTree.minAgo",{count:Math.floor(G/60)}):G<86400?t("fileTree.hoursAgo",{count:Math.floor(G/3600)}):G<2592e3?t("fileTree.daysAgo",{count:Math.floor(G/86400)}):U.toLocaleDateString()},M=(D,z=0)=>D.map(U=>a.jsxs("div",{className:"select-none",children:[a.jsx(Be,{variant:"ghost",className:Ze("w-full justify-start p-2 h-auto font-normal text-left hover:bg-accent"),style:{paddingLeft:`${z*16+12}px`},onClick:()=>{U.type==="directory"?N(U.path):j(U.name)?p({name:U.name,path:U.path,projectPath:e.path,projectName:e.name}):d({name:U.name,path:U.path,projectPath:e.path,projectName:e.name})},children:a.jsxs("div",{className:"flex items-center gap-2 min-w-0 w-full",children:[U.type==="directory"?o.has(U.path)?a.jsx(Tn,{className:"w-4 h-4 text-blue-500 flex-shrink-0"}):a.jsx(ca,{className:"w-4 h-4 text-muted-foreground flex-shrink-0"}):T(U.name),a.jsx("span",{className:"text-sm truncate text-foreground",children:U.name})]})}),U.type==="directory"&&o.has(U.path)&&U.children&&U.children.length>0&&a.jsx("div",{children:M(U.children,z+1)})]},U.path)),j=D=>{const z=D.split(".").pop()?.toLowerCase();return["png","jpg","jpeg","gif","svg","webp","ico","bmp"].includes(z)},T=D=>{const z=D.split(".").pop()?.toLowerCase(),U=["js","jsx","ts","tsx","py","java","cpp","c","php","rb","go","rs"],G=["md","txt","doc","pdf"],re=["png","jpg","jpeg","gif","svg","webp","ico","bmp"];return U.includes(z)?a.jsx(K5,{className:"w-4 h-4 text-green-500 flex-shrink-0"}):G.includes(z)?a.jsx(Fr,{className:"w-4 h-4 text-blue-500 flex-shrink-0"}):re.includes(z)?a.jsx(lf,{className:"w-4 h-4 text-purple-500 flex-shrink-0"}):a.jsx(lf,{className:"w-4 h-4 text-muted-foreground flex-shrink-0"})},P=(D,z=0)=>D.map(U=>a.jsxs("div",{className:"select-none",children:[a.jsxs("div",{className:Ze("grid grid-cols-12 gap-2 p-2 hover:bg-accent cursor-pointer items-center"),style:{paddingLeft:`${z*16+12}px`},onClick:()=>{U.type==="directory"?N(U.path):j(U.name)?p({name:U.name,path:U.path,projectPath:e.path,projectName:e.name}):d({name:U.name,path:U.path,projectPath:e.path,projectName:e.name})},children:[a.jsxs("div",{className:"col-span-5 flex items-center gap-2 min-w-0",children:[U.type==="directory"?o.has(U.path)?a.jsx(Tn,{className:"w-4 h-4 text-blue-500 flex-shrink-0"}):a.jsx(ca,{className:"w-4 h-4 text-muted-foreground flex-shrink-0"}):T(U.name),a.jsx("span",{className:"text-sm truncate text-foreground",children:U.name})]}),a.jsx("div",{className:"col-span-2 text-sm text-muted-foreground",children:U.type==="file"?v(U.size):"-"}),a.jsx("div",{className:"col-span-3 text-sm text-muted-foreground",children:I(U.modified)}),a.jsx("div",{className:"col-span-2 text-sm text-muted-foreground font-mono",children:U.permissionsRwx||"-"})]}),U.type==="directory"&&o.has(U.path)&&U.children&&P(U.children,z+1)]},U.path)),q=(D,z=0)=>D.map(U=>a.jsxs("div",{className:"select-none",children:[a.jsxs("div",{className:Ze("flex items-center justify-between p-2 hover:bg-accent cursor-pointer"),style:{paddingLeft:`${z*16+12}px`},onClick:()=>{U.type==="directory"?N(U.path):j(U.name)?p({name:U.name,path:U.path,projectPath:e.path,projectName:e.name}):d({name:U.name,path:U.path,projectPath:e.path,projectName:e.name})},children:[a.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[U.type==="directory"?o.has(U.path)?a.jsx(Tn,{className:"w-4 h-4 text-blue-500 flex-shrink-0"}):a.jsx(ca,{className:"w-4 h-4 text-muted-foreground flex-shrink-0"}):T(U.name),a.jsx("span",{className:"text-sm truncate text-foreground",children:U.name})]}),a.jsx("div",{className:"flex items-center gap-3 text-xs text-muted-foreground",children:U.type==="file"&&a.jsxs(a.Fragment,{children:[a.jsx("span",{children:v(U.size)}),a.jsx("span",{className:"font-mono",children:U.permissionsRwx})]})})]}),U.type==="directory"&&o.has(U.path)&&U.children&&q(U.children,z+1)]},U.path));return i?a.jsx("div",{className:"h-full flex items-center justify-center",children:a.jsx("div",{className:"text-gray-500 dark:text-gray-400",children:t("fileTree.loading")})}):a.jsxs("div",{className:"h-full flex flex-col bg-card",children:[a.jsxs("div",{className:"p-4 border-b border-border space-y-3",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx("h3",{className:"text-sm font-medium text-foreground",children:t("fileTree.files")}),a.jsxs("div",{className:"flex gap-1",children:[a.jsx(Be,{variant:h==="simple"?"default":"ghost",size:"sm",className:"h-8 w-8 p-0",onClick:()=>C("simple"),title:t("fileTree.simpleView"),children:a.jsx(eo,{className:"w-4 h-4"})}),a.jsx(Be,{variant:h==="compact"?"default":"ghost",size:"sm",className:"h-8 w-8 p-0",onClick:()=>C("compact"),title:t("fileTree.compactView"),children:a.jsx(hi,{className:"w-4 h-4"})}),a.jsx(Be,{variant:h==="detailed"?"default":"ghost",size:"sm",className:"h-8 w-8 p-0",onClick:()=>C("detailed"),title:t("fileTree.detailedView"),children:a.jsx(J6,{className:"w-4 h-4"})})]})]}),a.jsxs("div",{className:"relative",children:[a.jsx(si,{className:"absolute left-2 top-1/2 transform -translate-y-1/2 w-4 h-4 text-muted-foreground"}),a.jsx(tr,{type:"text",placeholder:t("fileTree.searchPlaceholder"),value:g,onChange:D=>f(D.target.value),className:"pl-8 pr-8 h-8 text-sm"}),g&&a.jsx(Be,{variant:"ghost",size:"sm",className:"absolute right-1 top-1/2 transform -translate-y-1/2 h-6 w-6 p-0 hover:bg-accent",onClick:()=>f(""),title:t("fileTree.clearSearch"),children:a.jsx(Bt,{className:"w-3 h-3"})})]})]}),h==="detailed"&&w.length>0&&a.jsx("div",{className:"px-4 pt-2 pb-1 border-b border-border",children:a.jsxs("div",{className:"grid grid-cols-12 gap-2 px-2 text-xs font-medium text-muted-foreground",children:[a.jsx("div",{className:"col-span-5",children:t("fileTree.name")}),a.jsx("div",{className:"col-span-2",children:t("fileTree.size")}),a.jsx("div",{className:"col-span-3",children:t("fileTree.modified")}),a.jsx("div",{className:"col-span-2",children:t("fileTree.permissions")})]})}),a.jsx($h,{className:"flex-1 p-4",children:r.length===0?a.jsxs("div",{className:"text-center py-8",children:[a.jsx("div",{className:"w-12 h-12 bg-muted rounded-lg flex items-center justify-center mx-auto mb-3",children:a.jsx(ca,{className:"w-6 h-6 text-muted-foreground"})}),a.jsx("h4",{className:"font-medium text-foreground mb-1",children:t("fileTree.noFilesFound")}),a.jsx("p",{className:"text-sm text-muted-foreground",children:t("fileTree.checkProjectPath")})]}):w.length===0&&g?a.jsxs("div",{className:"text-center py-8",children:[a.jsx("div",{className:"w-12 h-12 bg-muted rounded-lg flex items-center justify-center mx-auto mb-3",children:a.jsx(si,{className:"w-6 h-6 text-muted-foreground"})}),a.jsx("h4",{className:"font-medium text-foreground mb-1",children:t("fileTree.noMatchesFound")}),a.jsx("p",{className:"text-sm text-muted-foreground",children:t("fileTree.tryDifferentSearch")})]}):a.jsxs("div",{className:h==="detailed"?"":"space-y-1",children:[h==="simple"&&M(w),h==="compact"&&q(w),h==="detailed"&&P(w)]})}),c&&a.jsx(Ih,{file:c,onClose:()=>d(null),projectPath:c.projectPath}),u&&a.jsx(NG,{file:u,onClose:()=>p(null)})]})}function o3({project:e,session:t=null,command:r=null,isPlainShell:n=null,autoConnect:i=!0,onComplete:s=null,onClose:o=null,title:l=null,className:c="",showHeader:d=!0,compact:u=!1,minimal:p=!1}){const[h,m]=x.useState(!1),g=n!==null?n:r!==null,f=x.useCallback(w=>{m(!0),s&&s(w)},[s]);return e?a.jsxs("div",{className:`h-full w-full flex flex-col ${c}`,children:[!p&&d&&l&&a.jsx("div",{className:"flex-shrink-0 bg-gray-800 border-b border-gray-700 px-4 py-2",children:a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx("h3",{className:"text-sm font-medium text-gray-200",children:l}),h&&a.jsx("span",{className:"text-xs text-green-400",children:"(Completed)"})]}),o&&a.jsx("button",{onClick:o,className:"text-gray-400 hover:text-white",title:"Close",children:a.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]})}),a.jsx("div",{className:"flex-1 w-full min-h-0",children:a.jsx(Bg,{selectedProject:e,selectedSession:t,initialCommand:r,isPlainShell:g,onProcessComplete:f,minimal:p,autoConnect:p?!0:i})})]}):a.jsx("div",{className:`h-full flex items-center justify-center ${c}`,children:a.jsxs("div",{className:"text-center text-gray-500 dark:text-gray-400",children:[a.jsx("div",{className:"w-16 h-16 mx-auto mb-4 bg-gray-100 dark:bg-gray-800 rounded-full flex items-center justify-center",children:a.jsx("svg",{className:"w-8 h-8 text-gray-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:a.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"})})}),a.jsx("h3",{className:"text-lg font-semibold mb-2",children:"No Project Selected"}),a.jsx("p",{children:"A project is required to open a shell"})]})})}function Y2({diff:e,fileName:t,isMobile:r,wrapText:n}){if(!e)return a.jsx("div",{className:"p-4 text-center text-gray-500 dark:text-gray-400 text-sm",children:"No diff available"});const i=(s,o)=>{const l=s.startsWith("+")&&!s.startsWith("+++"),c=s.startsWith("-")&&!s.startsWith("---"),d=s.startsWith("@@");return a.jsx("div",{className:`font-mono text-xs p-2 ${r&&n?"whitespace-pre-wrap break-all":"whitespace-pre overflow-x-auto"} ${l?"bg-green-50 dark:bg-green-950 text-green-700 dark:text-green-300":c?"bg-red-50 dark:bg-red-950 text-red-700 dark:text-red-300":d?"bg-blue-50 dark:bg-blue-950 text-blue-700 dark:text-blue-300":"text-gray-600 dark:text-gray-400"}`,children:s},o)};return a.jsx("div",{className:"diff-viewer",children:e.split(`
|
|
942
|
-
`).map((s,o)=>i(s,o))})}function TG({selectedProject:e,isMobile:t,onFileOpen:r}){const[n,i]=x.useState(null),[s,o]=x.useState({}),[l,c]=x.useState(!1),[d,u]=x.useState(""),[p,h]=x.useState(new Set),[m,g]=x.useState(new Set),[f,w]=x.useState(!1),[S,k]=x.useState(""),[E,N]=x.useState([]),[C,v]=x.useState(!0),[I,M]=x.useState(!1),[j,T]=x.useState(!1),[P,q]=x.useState(!1),[D,z]=x.useState(""),[U,G]=x.useState(!1),[re,K]=x.useState("changes"),[ue,R]=x.useState([]),[F,te]=x.useState(new Set),[_,Z]=x.useState({}),[me,ke]=x.useState(!1),[se,_e]=x.useState(null),[oe,fe]=x.useState(!1),[Ie,qe]=x.useState(!1),[ze,ct]=x.useState(!1),[Ye,wt]=x.useState(!1),[gt,et]=x.useState(t),[Me,mt]=x.useState(null),[Pt,xe]=x.useState(!1),at=x.useRef(null),de=x.useRef(null),[Ee,H]=x.useState(()=>localStorage.getItem("selected-provider")||"claude");x.useEffect(()=>{const ae=()=>{const ge=localStorage.getItem("selected-provider")||"claude";H(ge)};return window.addEventListener("storage",ae),()=>window.removeEventListener("storage",ae)},[]),x.useEffect(()=>{e&&(Y(),le(),ve(),re==="history"&&Qe())},[e,re]),x.useEffect(()=>{const ae=ge=>{de.current&&!de.current.contains(ge.target)&&T(!1)};return document.addEventListener("mousedown",ae),()=>document.removeEventListener("mousedown",ae)},[]);const Y=async()=>{if(e){c(!0);try{const ge=await(await Ce(`/api/git/status?project=${encodeURIComponent(e.name)}`)).json();if(ge.error)console.error("Git status error:",ge.error),i({error:ge.error,details:ge.details});else{i(ge),k(ge.branch||"main");const tt=new Set([...ge.modified||[],...ge.added||[],...ge.deleted||[],...ge.untracked||[]]);g(tt);for(const bt of ge.modified||[])Ue(bt);for(const bt of ge.added||[])Ue(bt);for(const bt of ge.deleted||[])Ue(bt);for(const bt of ge.untracked||[])Ue(bt)}}catch(ae){console.error("Error fetching git status:",ae)}finally{c(!1)}}},le=async()=>{try{const ge=await(await Ce(`/api/git/branches?project=${encodeURIComponent(e.name)}`)).json();!ge.error&&ge.branches&&N(ge.branches)}catch(ae){console.error("Error fetching branches:",ae)}},ve=async()=>{if(e)try{const ge=await(await Ce(`/api/git/remote-status?project=${encodeURIComponent(e.name)}`)).json();ge.error?_e(null):_e(ge)}catch(ae){console.error("Error fetching remote status:",ae),_e(null)}},Ve=async ae=>{try{const tt=await(await Ce("/api/git/checkout",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({project:e.name,branch:ae})})).json();tt.success?(k(ae),T(!1),Y()):console.error("Failed to switch branch:",tt.error)}catch(ge){console.error("Error switching branch:",ge)}},It=async()=>{if(D.trim()){G(!0);try{const ge=await(await Ce("/api/git/create-branch",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({project:e.name,branch:D.trim()})})).json();ge.success?(k(D.trim()),q(!1),T(!1),z(""),le(),Y()):console.error("Failed to create branch:",ge.error)}catch(ae){console.error("Error creating branch:",ae)}finally{G(!1)}}},ft=async()=>{fe(!0);try{const ge=await(await Ce("/api/git/fetch",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({project:e.name})})).json();ge.success?(Y(),ve()):console.error("Fetch failed:",ge.error)}catch(ae){console.error("Error fetching from remote:",ae)}finally{fe(!1)}},Rt=async()=>{qe(!0);try{const ge=await(await Ce("/api/git/pull",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({project:e.name})})).json();ge.success?(Y(),ve()):console.error("Pull failed:",ge.error)}catch(ae){console.error("Error pulling from remote:",ae)}finally{qe(!1)}},it=async()=>{ct(!0);try{const ge=await(await Ce("/api/git/push",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({project:e.name})})).json();ge.success?(Y(),ve()):console.error("Push failed:",ge.error)}catch(ae){console.error("Error pushing to remote:",ae)}finally{ct(!1)}},ie=async()=>{wt(!0);try{const ge=await(await Ce("/api/git/publish",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({project:e.name,branch:S})})).json();ge.success?(Y(),ve()):console.error("Publish failed:",ge.error)}catch(ae){console.error("Error publishing branch:",ae)}finally{wt(!1)}},je=async ae=>{try{const tt=await(await Ce("/api/git/discard",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({project:e.name,file:ae})})).json();tt.success?(g(bt=>{const hr=new Set(bt);return hr.delete(ae),hr}),Y()):console.error("Discard failed:",tt.error)}catch(ge){console.error("Error discarding changes:",ge)}},Te=async ae=>{try{const tt=await(await Ce("/api/git/delete-untracked",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({project:e.name,file:ae})})).json();tt.success?(g(bt=>{const hr=new Set(bt);return hr.delete(ae),hr}),Y()):console.error("Delete failed:",tt.error)}catch(ge){console.error("Error deleting untracked file:",ge)}},Pe=async()=>{if(!Me)return;const{type:ae,file:ge,message:tt}=Me;mt(null);try{switch(ae){case"discard":await je(ge);break;case"delete":await Te(ge);break;case"commit":await he();break;case"pull":await Rt();break;case"push":await it();break;case"publish":await ie();break}}catch(bt){console.error(`Error executing ${ae}:`,bt)}},Ue=async ae=>{try{const tt=await(await Ce(`/api/git/diff?project=${encodeURIComponent(e.name)}&file=${encodeURIComponent(ae)}`)).json();!tt.error&&tt.diff&&o(bt=>({...bt,[ae]:tt.diff}))}catch(ge){console.error("Error fetching file diff:",ge)}},st=async ae=>{if(r)try{const tt=await(await Ce(`/api/git/file-with-diff?project=${encodeURIComponent(e.name)}&file=${encodeURIComponent(ae)}`)).json();if(tt.error){console.error("Error fetching file with diff:",tt.error),r(ae);return}const bt={old_string:tt.oldContent||"",new_string:tt.currentContent||""};r(ae,bt)}catch(ge){console.error("Error opening file:",ge),r(ae)}},Qe=async()=>{try{const ge=await(await Ce(`/api/git/commits?project=${encodeURIComponent(e.name)}&limit=10`)).json();!ge.error&&ge.commits&&R(ge.commits)}catch(ae){console.error("Error fetching commits:",ae)}},J=async ae=>{try{const tt=await(await Ce(`/api/git/commit-diff?project=${encodeURIComponent(e.name)}&commit=${ae}`)).json();!tt.error&&tt.diff&&Z(bt=>({...bt,[ae]:tt.diff}))}catch(ge){console.error("Error fetching commit diff:",ge)}},Fe=async()=>{ke(!0);try{const ge=await(await Ce("/api/git/generate-commit-message",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({project:e.name,files:Array.from(m),provider:Ee})})).json();ge.message?u(ge.message):console.error("Failed to generate commit message:",ge.error)}catch(ae){console.error("Error generating commit message:",ae)}finally{ke(!1)}},Ke=ae=>{h(ge=>{const tt=new Set(ge);return tt.has(ae)?tt.delete(ae):tt.add(ae),tt})},Ge=ae=>{te(ge=>{const tt=new Set(ge);return tt.has(ae)?tt.delete(ae):(tt.add(ae),_[ae]||J(ae)),tt})},dt=ae=>{g(ge=>{const tt=new Set(ge);return tt.has(ae)?tt.delete(ae):tt.add(ae),tt})},he=async()=>{if(!(!d.trim()||m.size===0)){w(!0);try{const ge=await(await Ce("/api/git/commit",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({project:e.name,message:d,files:Array.from(m)})})).json();ge.success?(u(""),g(new Set),Y(),ve()):console.error("Commit failed:",ge.error)}catch(ae){console.error("Error committing changes:",ae)}finally{w(!1)}}},zt=async()=>{xe(!0);try{const ge=await(await Ce("/api/git/initial-commit",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({project:e.name})})).json();ge.success?(Y(),ve()):(console.error("Initial commit failed:",ge.error),alert(ge.error||"Failed to create initial commit"))}catch(ae){console.error("Error creating initial commit:",ae),alert("Failed to create initial commit")}finally{xe(!1)}},nr=ae=>{switch(ae){case"M":return"Modified";case"A":return"Added";case"D":return"Deleted";case"U":return"Untracked";default:return ae}},_n=ae=>{const ge=F.has(ae.hash),tt=_[ae.hash];return a.jsxs("div",{className:"border-b border-gray-200 dark:border-gray-700 last:border-0",children:[a.jsxs("div",{className:"flex items-start p-3 hover:bg-gray-50 dark:hover:bg-gray-800 cursor-pointer",onClick:()=>Ge(ae.hash),children:[a.jsx("div",{className:"mr-2 mt-1 p-0.5 hover:bg-gray-200 dark:hover:bg-gray-700 rounded",children:ge?a.jsx(tn,{className:"w-3 h-3"}):a.jsx(Cn,{className:"w-3 h-3"})}),a.jsx("div",{className:"flex-1 min-w-0",children:a.jsxs("div",{className:"flex items-start justify-between gap-2",children:[a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsx("p",{className:"text-sm font-medium text-gray-900 dark:text-white truncate",children:ae.message}),a.jsxs("p",{className:"text-xs text-gray-500 dark:text-gray-400 mt-1",children:[ae.author," • ",ae.date]})]}),a.jsx("span",{className:"text-xs font-mono text-gray-400 dark:text-gray-500 flex-shrink-0",children:ae.hash.substring(0,7)})]})})]}),ge&&tt&&a.jsx("div",{className:"bg-gray-50 dark:bg-gray-900",children:a.jsxs("div",{className:"max-h-96 overflow-y-auto p-2",children:[a.jsx("div",{className:"text-xs font-mono text-gray-600 dark:text-gray-400 mb-2",children:ae.stats}),a.jsx(Y2,{diff:tt,fileName:"commit",isMobile:t,wrapText:C})]})})]},ae.hash)},xr=(ae,ge)=>{const tt=p.has(ae),bt=m.has(ae),hr=s[ae];return a.jsxs("div",{className:"border-b border-gray-200 dark:border-gray-700 last:border-0",children:[a.jsxs("div",{className:`flex items-center hover:bg-gray-50 dark:hover:bg-gray-800 ${t?"px-2 py-1.5":"px-3 py-2"}`,children:[a.jsx("input",{type:"checkbox",checked:bt,onChange:()=>dt(ae),onClick:ar=>ar.stopPropagation(),className:`rounded border-gray-300 dark:border-gray-600 text-blue-600 dark:text-blue-500 focus:ring-blue-500 dark:focus:ring-blue-400 dark:bg-gray-800 dark:checked:bg-blue-600 ${t?"mr-1.5":"mr-2"}`}),a.jsxs("div",{className:"flex items-center flex-1",children:[a.jsx("div",{className:`p-0.5 hover:bg-gray-200 dark:hover:bg-gray-700 rounded cursor-pointer ${t?"mr-1":"mr-2"}`,onClick:ar=>{ar.stopPropagation(),Ke(ae)},children:a.jsx(Cn,{className:`w-3 h-3 transition-transform duration-200 ease-in-out ${tt?"rotate-90":"rotate-0"}`})}),a.jsx("span",{className:`flex-1 truncate ${t?"text-xs":"text-sm"} cursor-pointer hover:text-blue-600 dark:hover:text-blue-400 hover:underline`,onClick:ar=>{ar.stopPropagation(),st(ae)},title:"Click to open file",children:ae}),a.jsxs("div",{className:"flex items-center gap-1",children:[(ge==="M"||ge==="D")&&a.jsxs("button",{onClick:ar=>{ar.stopPropagation(),mt({type:"discard",file:ae,message:`Discard all changes to "${ae}"? This action cannot be undone.`})},className:`${t?"px-2 py-1 text-xs":"p-1"} hover:bg-red-100 dark:hover:bg-red-900 rounded text-red-600 dark:text-red-400 font-medium flex items-center gap-1`,title:"Discard changes",children:[a.jsx(Nr,{className:"w-3 h-3"}),t&&a.jsx("span",{children:"Discard"})]}),ge==="U"&&a.jsxs("button",{onClick:ar=>{ar.stopPropagation(),mt({type:"delete",file:ae,message:`Delete untracked file "${ae}"? This action cannot be undone.`})},className:`${t?"px-2 py-1 text-xs":"p-1"} hover:bg-red-100 dark:hover:bg-red-900 rounded text-red-600 dark:text-red-400 font-medium flex items-center gap-1`,title:"Delete untracked file",children:[a.jsx(Nr,{className:"w-3 h-3"}),t&&a.jsx("span",{children:"Delete"})]}),a.jsx("span",{className:`inline-flex items-center justify-center w-5 h-5 rounded text-xs font-bold border ${ge==="M"?"bg-yellow-100 text-yellow-700 dark:bg-yellow-900 dark:text-yellow-300 border-yellow-200 dark:border-yellow-800":ge==="A"?"bg-green-100 text-green-700 dark:bg-green-900 dark:text-green-300 border-green-200 dark:border-green-800":ge==="D"?"bg-red-100 text-red-700 dark:bg-red-900 dark:text-red-300 border-red-200 dark:border-red-800":"bg-gray-100 text-gray-700 dark:bg-gray-800 dark:text-gray-300 border-gray-300 dark:border-gray-600"}`,title:nr(ge),children:ge})]})]})]}),a.jsxs("div",{className:`bg-gray-50 dark:bg-gray-900 transition-all duration-400 ease-in-out overflow-hidden ${tt&&hr?"max-h-[600px] opacity-100 translate-y-0":"max-h-0 opacity-0 -translate-y-1"}`,children:[a.jsxs("div",{className:"flex items-center justify-between p-2 border-b border-gray-200 dark:border-gray-700",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("span",{className:`inline-flex items-center justify-center w-5 h-5 rounded text-xs font-bold border ${ge==="M"?"bg-yellow-100 text-yellow-700 dark:bg-yellow-900 dark:text-yellow-300 border-yellow-200 dark:border-yellow-800":ge==="A"?"bg-green-100 text-green-700 dark:bg-green-900 dark:text-green-300 border-green-200 dark:border-green-800":ge==="D"?"bg-red-100 text-red-700 dark:bg-red-900 dark:text-red-300 border-red-200 dark:border-red-800":"bg-gray-100 text-gray-700 dark:bg-gray-800 dark:text-gray-300 border-gray-300 dark:border-gray-600"}`,children:ge}),a.jsx("span",{className:"text-sm font-medium text-gray-900 dark:text-white",children:nr(ge)})]}),t&&a.jsx("button",{onClick:ar=>{ar.stopPropagation(),v(!C)},className:"text-xs text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-white",title:C?"Switch to horizontal scroll":"Switch to text wrap",children:C?"↔️ Scroll":"↩️ Wrap"})]}),a.jsx("div",{className:"max-h-96 overflow-y-auto",children:hr&&a.jsx(Y2,{diff:hr,fileName:ae,isMobile:t,wrapText:C})})]})]},ae)};return e?a.jsxs("div",{className:"h-full flex flex-col bg-background",children:[a.jsxs("div",{className:`flex items-center justify-between border-b border-gray-200 dark:border-gray-700 ${t?"px-3 py-2":"px-4 py-3"}`,children:[a.jsxs("div",{className:"relative",ref:de,children:[a.jsxs("button",{onClick:()=>T(!j),className:`flex items-center hover:bg-gray-100 dark:hover:bg-gray-800 rounded-md transition-colors ${t?"space-x-1 px-2 py-1":"space-x-2 px-3 py-1.5"}`,children:[a.jsx(qn,{className:`text-gray-600 dark:text-gray-400 ${t?"w-3 h-3":"w-4 h-4"}`}),a.jsxs("div",{className:"flex items-center gap-1",children:[a.jsx("span",{className:`font-medium ${t?"text-xs":"text-sm"}`,children:S}),se?.hasRemote&&a.jsxs("div",{className:"flex items-center gap-1 text-xs",children:[se.ahead>0&&a.jsxs("span",{className:"text-green-600 dark:text-green-400",title:`${se.ahead} commit${se.ahead!==1?"s":""} ahead`,children:["↑",se.ahead]}),se.behind>0&&a.jsxs("span",{className:"text-blue-600 dark:text-blue-400",title:`${se.behind} commit${se.behind!==1?"s":""} behind`,children:["↓",se.behind]}),se.isUpToDate&&a.jsx("span",{className:"text-gray-500 dark:text-gray-400",title:"Up to date with remote",children:"✓"})]})]}),a.jsx(tn,{className:`w-3 h-3 text-gray-500 transition-transform ${j?"rotate-180":""}`})]}),j&&a.jsxs("div",{className:"absolute top-full left-0 mt-1 w-64 bg-white dark:bg-gray-800 rounded-lg shadow-lg border border-gray-200 dark:border-gray-700 z-50",children:[a.jsx("div",{className:"py-1 max-h-64 overflow-y-auto",children:E.map(ae=>a.jsx("button",{onClick:()=>Ve(ae),className:`w-full text-left px-4 py-2 text-sm hover:bg-gray-100 dark:hover:bg-gray-700 ${ae===S?"bg-gray-50 dark:bg-gray-700 text-gray-900 dark:text-gray-100":"text-gray-700 dark:text-gray-300"}`,children:a.jsxs("div",{className:"flex items-center space-x-2",children:[ae===S&&a.jsx(Cr,{className:"w-3 h-3 text-green-600 dark:text-green-400"}),a.jsx("span",{className:ae===S?"font-medium":"",children:ae})]})},ae))}),a.jsx("div",{className:"border-t border-gray-200 dark:border-gray-700 py-1",children:a.jsxs("button",{onClick:()=>{q(!0),T(!1)},className:"w-full text-left px-4 py-2 text-sm hover:bg-gray-100 dark:hover:bg-gray-700 flex items-center space-x-2",children:[a.jsx(gr,{className:"w-3 h-3"}),a.jsx("span",{children:"Create new branch"})]})})]})]}),a.jsxs("div",{className:`flex items-center ${t?"gap-1":"gap-2"}`,children:[se?.hasRemote&&a.jsxs(a.Fragment,{children:[!se?.hasUpstream&&a.jsxs("button",{onClick:()=>mt({type:"publish",message:`Publish branch "${S}" to ${se.remoteName}?`}),disabled:Ye,className:"px-2 py-1 text-xs bg-purple-600 text-white rounded hover:bg-purple-700 disabled:opacity-50 flex items-center gap-1",title:`Publish branch "${S}" to ${se.remoteName}`,children:[a.jsx(ws,{className:`w-3 h-3 ${Ye?"animate-pulse":""}`}),a.jsx("span",{children:Ye?"Publishing...":"Publish"})]}),se?.hasUpstream&&!se?.isUpToDate&&a.jsxs(a.Fragment,{children:[se.behind>0&&a.jsxs("button",{onClick:()=>mt({type:"pull",message:`Pull ${se.behind} commit${se.behind!==1?"s":""} from ${se.remoteName}?`}),disabled:Ie,className:"px-2 py-1 text-xs bg-green-600 text-white rounded hover:bg-green-700 disabled:opacity-50 flex items-center gap-1",title:`Pull ${se.behind} commit${se.behind!==1?"s":""} from ${se.remoteName}`,children:[a.jsx(Qs,{className:`w-3 h-3 ${Ie?"animate-pulse":""}`}),a.jsx("span",{children:Ie?"Pulling...":`Pull ${se.behind}`})]}),se.ahead>0&&a.jsxs("button",{onClick:()=>mt({type:"push",message:`Push ${se.ahead} commit${se.ahead!==1?"s":""} to ${se.remoteName}?`}),disabled:ze,className:"px-2 py-1 text-xs bg-orange-600 text-white rounded hover:bg-orange-700 disabled:opacity-50 flex items-center gap-1",title:`Push ${se.ahead} commit${se.ahead!==1?"s":""} to ${se.remoteName}`,children:[a.jsx(ws,{className:`w-3 h-3 ${ze?"animate-pulse":""}`}),a.jsx("span",{children:ze?"Pushing...":`Push ${se.ahead}`})]}),(se.ahead>0||se.behind>0&&se.ahead>0)&&a.jsxs("button",{onClick:ft,disabled:oe,className:"px-2 py-1 text-xs bg-blue-600 text-white rounded hover:bg-blue-700 disabled:opacity-50 flex items-center gap-1",title:`Fetch from ${se.remoteName}`,children:[a.jsx(Un,{className:`w-3 h-3 ${oe?"animate-spin":""}`}),a.jsx("span",{children:oe?"Fetching...":"Fetch"})]})]})]}),a.jsx("button",{onClick:()=>{Y(),le(),ve()},disabled:l,className:`hover:bg-gray-100 dark:hover:bg-gray-800 rounded ${t?"p-1":"p-1.5"}`,children:a.jsx(Un,{className:`${l?"animate-spin":""} ${t?"w-3 h-3":"w-4 h-4"}`})})]})]}),n?.error?a.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center text-gray-500 dark:text-gray-400 px-6 py-12",children:[a.jsx(qn,{className:"w-20 h-20 mb-6 opacity-30"}),a.jsx("h3",{className:"text-xl font-medium mb-3 text-center",children:n.error}),n.details&&a.jsx("p",{className:"text-sm text-center leading-relaxed mb-6 max-w-md",children:n.details}),a.jsx("div",{className:"p-4 bg-blue-50 dark:bg-blue-900/20 rounded-lg border border-blue-200 dark:border-blue-800 max-w-md",children:a.jsxs("p",{className:"text-sm text-blue-700 dark:text-blue-300 text-center",children:[a.jsx("strong",{children:"Tip:"})," Run ",a.jsx("code",{className:"bg-blue-100 dark:bg-blue-900 px-2 py-1 rounded font-mono text-xs",children:"git init"})," in your project directory to initialize git source control."]})})]}):a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:`flex border-b border-gray-200 dark:border-gray-700 transition-all duration-300 ease-in-out ${p.size===0?"max-h-16 opacity-100 translate-y-0":"max-h-0 opacity-0 -translate-y-2 overflow-hidden"}`,children:[a.jsx("button",{onClick:()=>K("changes"),className:`flex-1 px-4 py-2 text-sm font-medium transition-colors ${re==="changes"?"text-blue-600 dark:text-blue-400 border-b-2 border-blue-600 dark:border-blue-400":"text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-white"}`,children:a.jsxs("div",{className:"flex items-center justify-center gap-2",children:[a.jsx(Fr,{className:"w-4 h-4"}),a.jsx("span",{children:"Changes"})]})}),a.jsx("button",{onClick:()=>K("history"),className:`flex-1 px-4 py-2 text-sm font-medium transition-colors ${re==="history"?"text-blue-600 dark:text-blue-400 border-b-2 border-blue-600 dark:border-blue-400":"text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-white"}`,children:a.jsxs("div",{className:"flex items-center justify-center gap-2",children:[a.jsx(cf,{className:"w-4 h-4"}),a.jsx("span",{children:"History"})]})})]}),re==="changes"&&a.jsx(a.Fragment,{children:a.jsx("div",{className:`transition-all duration-300 ease-in-out ${p.size===0?"max-h-96 opacity-100 translate-y-0":"max-h-0 opacity-0 -translate-y-2 overflow-hidden"}`,children:t&>?a.jsx("div",{className:"px-4 py-2 border-b border-gray-200 dark:border-gray-700",children:a.jsxs("button",{onClick:()=>et(!1),className:"w-full flex items-center justify-center gap-2 px-3 py-2 text-sm bg-blue-600 text-white rounded-md hover:bg-blue-700",children:[a.jsx(Zo,{className:"w-4 h-4"}),a.jsxs("span",{children:["Commit ",m.size," file",m.size!==1?"s":""]}),a.jsx(tn,{className:"w-3 h-3"})]})}):a.jsx(a.Fragment,{children:a.jsxs("div",{className:"px-4 py-3 border-b border-gray-200 dark:border-gray-700",children:[t&&a.jsxs("div",{className:"flex items-center justify-between mb-2",children:[a.jsx("span",{className:"text-sm font-medium",children:"Commit Changes"}),a.jsx("button",{onClick:()=>et(!0),className:"p-1 hover:bg-gray-100 dark:hover:bg-gray-800 rounded",children:a.jsx(tn,{className:"w-4 h-4 rotate-180"})})]}),a.jsxs("div",{className:"relative",children:[a.jsx("textarea",{ref:at,value:d,onChange:ae=>u(ae.target.value),placeholder:"Message (Ctrl+Enter to commit)",className:"w-full px-3 py-2 text-sm border border-gray-300 dark:border-gray-600 rounded-md bg-white dark:bg-gray-800 resize-none pr-20",rows:"3",onKeyDown:ae=>{ae.key==="Enter"&&(ae.ctrlKey||ae.metaKey)&&he()}}),a.jsxs("div",{className:"absolute right-2 top-2 flex gap-1",children:[a.jsx("button",{onClick:Fe,disabled:m.size===0||me,className:"p-1.5 text-gray-500 hover:text-gray-700 dark:text-gray-400 dark:hover:text-gray-200 disabled:opacity-50 disabled:cursor-not-allowed",title:"Generate commit message",children:me?a.jsx(Un,{className:"w-4 h-4 animate-spin"}):a.jsx(Gn,{className:"w-4 h-4"})}),a.jsx("div",{style:{display:"none"},children:a.jsx(RN,{onTranscript:ae=>u(ae),mode:"default",className:"p-1.5"})})]})]}),a.jsxs("div",{className:"flex items-center justify-between mt-2",children:[a.jsxs("span",{className:"text-xs text-gray-500",children:[m.size," file",m.size!==1?"s":""," selected"]}),a.jsxs("button",{onClick:()=>mt({type:"commit",message:`Commit ${m.size} file${m.size!==1?"s":""} with message: "${d.trim()}"?`}),disabled:!d.trim()||m.size===0||f,className:"px-3 py-1 text-sm bg-blue-600 text-white rounded-md hover:bg-blue-700 disabled:opacity-50 disabled:cursor-not-allowed flex items-center space-x-1",children:[a.jsx(Cr,{className:"w-3 h-3"}),a.jsx("span",{children:f?"Committing...":"Commit"})]})]})]})})})}),re==="changes"&&n&&!n.error&&a.jsxs("div",{className:`border-b border-gray-200 dark:border-gray-700 flex items-center justify-between transition-all duration-300 ease-in-out ${t?"px-3 py-1.5":"px-4 py-2"} ${p.size===0?"max-h-16 opacity-100 translate-y-0":"max-h-0 opacity-0 -translate-y-2 overflow-hidden"}`,children:[a.jsxs("span",{className:"text-gray-600 dark:text-gray-400 text-xs",children:[m.size," of ",(n?.modified?.length||0)+(n?.added?.length||0)+(n?.deleted?.length||0)+(n?.untracked?.length||0)," ",t?"":"files"," selected"]}),a.jsxs("div",{className:`flex ${t?"gap-1":"gap-2"}`,children:[a.jsx("button",{onClick:()=>{const ae=new Set([...n?.modified||[],...n?.added||[],...n?.deleted||[],...n?.untracked||[]]);g(ae)},className:"text-blue-600 dark:text-blue-400 hover:text-blue-700 dark:hover:text-blue-300 text-xs",children:t?"All":"Select All"}),a.jsx("span",{className:"text-gray-300 dark:text-gray-600",children:"|"}),a.jsx("button",{onClick:()=>g(new Set),className:"text-blue-600 dark:text-blue-400 hover:text-blue-700 dark:hover:text-blue-300 text-xs",children:t?"None":"Deselect All"})]})]}),!n?.error&&!t&&a.jsxs("div",{className:"border-b border-gray-200 dark:border-gray-700",children:[a.jsxs("button",{onClick:()=>M(!I),className:"w-full px-4 py-2 bg-gray-50 dark:bg-gray-800 hover:bg-gray-100 dark:hover:bg-gray-750 text-xs text-gray-600 dark:text-gray-400 flex items-center justify-center gap-1",children:[a.jsx(h6,{className:"w-3 h-3"}),a.jsx("span",{children:"File Status Guide"}),I?a.jsx(tn,{className:"w-3 h-3"}):a.jsx(Cn,{className:"w-3 h-3"})]}),I&&a.jsx("div",{className:"px-4 py-3 bg-gray-50 dark:bg-gray-800 text-xs",children:a.jsxs("div",{className:`${t?"grid grid-cols-2 gap-3 justify-items-center":"flex justify-center gap-6"}`,children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("span",{className:"inline-flex items-center justify-center w-5 h-5 bg-yellow-100 text-yellow-700 dark:bg-yellow-900 dark:text-yellow-300 rounded border border-yellow-200 dark:border-yellow-800 font-bold text-xs",children:"M"}),a.jsx("span",{className:"text-gray-600 dark:text-gray-400 italic",children:"Modified"})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("span",{className:"inline-flex items-center justify-center w-5 h-5 bg-green-100 text-green-700 dark:bg-green-900 dark:text-green-300 rounded border border-green-200 dark:border-green-800 font-bold text-xs",children:"A"}),a.jsx("span",{className:"text-gray-600 dark:text-gray-400 italic",children:"Added"})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("span",{className:"inline-flex items-center justify-center w-5 h-5 bg-red-100 text-red-700 dark:bg-red-900 dark:text-red-300 rounded border border-red-200 dark:border-red-800 font-bold text-xs",children:"D"}),a.jsx("span",{className:"text-gray-600 dark:text-gray-400 italic",children:"Deleted"})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("span",{className:"inline-flex items-center justify-center w-5 h-5 bg-gray-100 text-gray-700 dark:bg-gray-800 dark:text-gray-300 rounded border border-gray-300 dark:border-gray-600 font-bold text-xs",children:"U"}),a.jsx("span",{className:"text-gray-600 dark:text-gray-400 italic",children:"Untracked"})]})]})})]})]}),re==="changes"&&!n?.error&&a.jsx("div",{className:`flex-1 overflow-y-auto ${t?"pb-mobile-nav":""}`,children:l?a.jsx("div",{className:"flex items-center justify-center h-32",children:a.jsx(Un,{className:"w-6 h-6 animate-spin text-gray-400"})}):n?.hasCommits===!1?a.jsxs("div",{className:"flex flex-col items-center justify-center p-8 text-center",children:[a.jsx(qn,{className:"w-16 h-16 mb-4 opacity-30 text-gray-400 dark:text-gray-500"}),a.jsx("h3",{className:"text-lg font-medium mb-2 text-gray-900 dark:text-white",children:"No commits yet"}),a.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400 mb-6 max-w-md",children:"This repository doesn't have any commits yet. Create your first commit to start tracking changes."}),a.jsx("button",{onClick:zt,disabled:Pt,className:"px-4 py-2 bg-blue-600 text-white rounded-md hover:bg-blue-700 disabled:opacity-50 disabled:cursor-not-allowed flex items-center gap-2",children:Pt?a.jsxs(a.Fragment,{children:[a.jsx(Un,{className:"w-4 h-4 animate-spin"}),a.jsx("span",{children:"Creating Initial Commit..."})]}):a.jsxs(a.Fragment,{children:[a.jsx(Zo,{className:"w-4 h-4"}),a.jsx("span",{children:"Create Initial Commit"})]})})]}):!n||!n.modified?.length&&!n.added?.length&&!n.deleted?.length&&!n.untracked?.length?a.jsxs("div",{className:"flex flex-col items-center justify-center h-32 text-gray-500 dark:text-gray-400",children:[a.jsx(Zo,{className:"w-12 h-12 mb-2 opacity-50"}),a.jsx("p",{className:"text-sm",children:"No changes detected"})]}):a.jsxs("div",{className:t?"pb-4":"",children:[n.modified?.map(ae=>xr(ae,"M")),n.added?.map(ae=>xr(ae,"A")),n.deleted?.map(ae=>xr(ae,"D")),n.untracked?.map(ae=>xr(ae,"U"))]})}),re==="history"&&!n?.error&&a.jsx("div",{className:`flex-1 overflow-y-auto ${t?"pb-mobile-nav":""}`,children:l?a.jsx("div",{className:"flex items-center justify-center h-32",children:a.jsx(Un,{className:"w-6 h-6 animate-spin text-gray-400"})}):ue.length===0?a.jsxs("div",{className:"flex flex-col items-center justify-center h-32 text-gray-500 dark:text-gray-400",children:[a.jsx(cf,{className:"w-12 h-12 mb-2 opacity-50"}),a.jsx("p",{className:"text-sm",children:"No commits found"})]}):a.jsx("div",{className:t?"pb-4":"",children:ue.map(ae=>_n(ae))})}),P&&a.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-4",children:[a.jsx("div",{className:"fixed inset-0 bg-black bg-opacity-50",onClick:()=>q(!1)}),a.jsx("div",{className:"relative bg-white dark:bg-gray-800 rounded-lg shadow-xl max-w-md w-full",children:a.jsxs("div",{className:"p-6",children:[a.jsx("h3",{className:"text-lg font-semibold mb-4",children:"Create New Branch"}),a.jsxs("div",{className:"mb-4",children:[a.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:"Branch Name"}),a.jsx("input",{type:"text",value:D,onChange:ae=>z(ae.target.value),onKeyDown:ae=>{ae.key==="Enter"&&!U&&It()},placeholder:"feature/new-feature",className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md bg-white dark:bg-gray-700 focus:outline-none focus:ring-2 focus:ring-blue-500",autoFocus:!0})]}),a.jsxs("div",{className:"text-xs text-gray-500 dark:text-gray-400 mb-4",children:["This will create a new branch from the current branch (",S,")"]}),a.jsxs("div",{className:"flex justify-end space-x-3",children:[a.jsx("button",{onClick:()=>{q(!1),z("")},className:"px-4 py-2 text-sm text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700 rounded-md",children:"Cancel"}),a.jsx("button",{onClick:It,disabled:!D.trim()||U,className:"px-4 py-2 text-sm bg-blue-600 text-white rounded-md hover:bg-blue-700 disabled:opacity-50 disabled:cursor-not-allowed flex items-center space-x-2",children:U?a.jsxs(a.Fragment,{children:[a.jsx(Un,{className:"w-3 h-3 animate-spin"}),a.jsx("span",{children:"Creating..."})]}):a.jsxs(a.Fragment,{children:[a.jsx(gr,{className:"w-3 h-3"}),a.jsx("span",{children:"Create Branch"})]})})]})]})})]}),Me&&a.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-4",children:[a.jsx("div",{className:"fixed inset-0 bg-black bg-opacity-50",onClick:()=>mt(null)}),a.jsx("div",{className:"relative bg-white dark:bg-gray-800 rounded-lg shadow-xl max-w-md w-full",children:a.jsxs("div",{className:"p-6",children:[a.jsxs("div",{className:"flex items-center mb-4",children:[a.jsx("div",{className:`p-2 rounded-full mr-3 ${Me.type==="discard"||Me.type==="delete"?"bg-red-100 dark:bg-red-900":"bg-yellow-100 dark:bg-yellow-900"}`,children:a.jsx(Vn,{className:`w-5 h-5 ${Me.type==="discard"||Me.type==="delete"?"text-red-600 dark:text-red-400":"text-yellow-600 dark:text-yellow-400"}`})}),a.jsx("h3",{className:"text-lg font-semibold",children:Me.type==="discard"?"Discard Changes":Me.type==="delete"?"Delete File":Me.type==="commit"?"Confirm Commit":Me.type==="pull"?"Confirm Pull":Me.type==="publish"?"Publish Branch":"Confirm Push"})]}),a.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400 mb-6",children:Me.message}),a.jsxs("div",{className:"flex justify-end space-x-3",children:[a.jsx("button",{onClick:()=>mt(null),className:"px-4 py-2 text-sm text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700 rounded-md",children:"Cancel"}),a.jsx("button",{onClick:Pe,className:`px-4 py-2 text-sm text-white rounded-md ${Me.type==="discard"||Me.type==="delete"?"bg-red-600 hover:bg-red-700":Me.type==="commit"?"bg-blue-600 hover:bg-blue-700":Me.type==="pull"?"bg-green-600 hover:bg-green-700":Me.type==="publish"?"bg-purple-600 hover:bg-purple-700":"bg-orange-600 hover:bg-orange-700"} flex items-center space-x-2`,children:Me.type==="discard"?a.jsxs(a.Fragment,{children:[a.jsx(Nr,{className:"w-4 h-4"}),a.jsx("span",{children:"Discard"})]}):Me.type==="delete"?a.jsxs(a.Fragment,{children:[a.jsx(Nr,{className:"w-4 h-4"}),a.jsx("span",{children:"Delete"})]}):Me.type==="commit"?a.jsxs(a.Fragment,{children:[a.jsx(Cr,{className:"w-4 h-4"}),a.jsx("span",{children:"Commit"})]}):Me.type==="pull"?a.jsxs(a.Fragment,{children:[a.jsx(Qs,{className:"w-4 h-4"}),a.jsx("span",{children:"Pull"})]}):Me.type==="publish"?a.jsxs(a.Fragment,{children:[a.jsx(ws,{className:"w-4 h-4"}),a.jsx("span",{children:"Publish"})]}):a.jsxs(a.Fragment,{children:[a.jsx(ws,{className:"w-4 h-4"}),a.jsx("span",{children:"Push"})]})})]})]})})]})]}):a.jsx("div",{className:"h-full flex items-center justify-center text-gray-500 dark:text-gray-400",children:a.jsx("p",{children:"Select a project to view source control"})})}class AG extends ir.Component{constructor(t){super(t),this.state={hasError:!1,error:null,errorInfo:null}}static getDerivedStateFromError(t){return{hasError:!0}}componentDidCatch(t,r){console.error("ErrorBoundary caught an error:",t,r),this.setState({error:t,errorInfo:r})}render(){return this.state.hasError?a.jsx("div",{className:"flex flex-col items-center justify-center p-8 text-center",children:a.jsxs("div",{className:"bg-red-50 border border-red-200 rounded-lg p-6 max-w-md",children:[a.jsxs("div",{className:"flex items-center mb-4",children:[a.jsx("div",{className:"flex-shrink-0",children:a.jsx("svg",{className:"h-5 w-5 text-red-400",viewBox:"0 0 20 20",fill:"currentColor",children:a.jsx("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zM8.707 7.293a1 1 0 00-1.414 1.414L8.586 10l-1.293 1.293a1 1 0 101.414 1.414L10 11.414l1.293 1.293a1 1 0 001.414-1.414L11.414 10l1.293-1.293a1 1 0 00-1.414-1.414L10 8.586 8.707 7.293z",clipRule:"evenodd"})})}),a.jsx("h3",{className:"ml-3 text-sm font-medium text-red-800",children:"Something went wrong"})]}),a.jsxs("div",{className:"text-sm text-red-700",children:[a.jsx("p",{className:"mb-2",children:"An error occurred while loading the chat interface."}),this.props.showDetails&&this.state.error&&a.jsxs("details",{className:"mt-4",children:[a.jsx("summary",{className:"cursor-pointer text-xs font-mono",children:"Error Details"}),a.jsxs("pre",{className:"mt-2 text-xs bg-red-100 p-2 rounded overflow-auto max-h-40",children:[this.state.error.toString(),this.state.errorInfo&&this.state.errorInfo.componentStack]})]})]}),a.jsx("div",{className:"mt-4",children:a.jsx("button",{onClick:()=>{this.setState({hasError:!1,error:null,errorInfo:null}),this.props.onRetry&&this.props.onRetry()},className:"bg-red-600 text-white px-4 py-2 rounded text-sm hover:bg-red-700 focus:outline-none focus:ring-2 focus:ring-red-500",children:"Try Again"})})]})}):this.props.children}}const Pr=({children:e,content:t,position:r="top",className:n="",delay:i=500})=>{const[s,o]=x.useState(!1),[l,c]=x.useState(null),d=()=>{const m=setTimeout(()=>{o(!0)},i);c(m)},u=()=>{l&&(clearTimeout(l),c(null)),o(!1)},p=()=>{switch(r){case"top":return"bottom-full left-1/2 transform -translate-x-1/2 mb-2";case"bottom":return"top-full left-1/2 transform -translate-x-1/2 mt-2";case"left":return"right-full top-1/2 transform -translate-y-1/2 mr-2";case"right":return"left-full top-1/2 transform -translate-y-1/2 ml-2";default:return"bottom-full left-1/2 transform -translate-x-1/2 mb-2"}},h=()=>{switch(r){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"}};return t?a.jsxs("div",{className:"relative inline-block",onMouseEnter:d,onMouseLeave:u,children:[e,s&&a.jsxs("div",{className:Ze("absolute z-50 px-2 py-1 text-xs font-medium text-white bg-gray-900 dark:bg-gray-100 dark:text-gray-900 rounded shadow-lg whitespace-nowrap pointer-events-none","animate-in fade-in-0 zoom-in-95 duration-200",p(),n),children:[t,a.jsx("div",{className:Ze("absolute w-0 h-0 border-4 border-transparent",h())})]})]}):e},X2=({task:e,onClick:t,showParent:r=!1,className:n=""})=>{const s=(l=>{switch(l){case"done":return{icon:ns,bgColor:"bg-green-50 dark:bg-green-950",borderColor:"border-green-200 dark:border-green-800",iconColor:"text-green-600 dark:text-green-400",textColor:"text-green-900 dark:text-green-100",statusText:"Done"};case"in-progress":return{icon:Hi,bgColor:"bg-blue-50 dark:bg-blue-950",borderColor:"border-blue-200 dark:border-blue-800",iconColor:"text-blue-600 dark:text-blue-400",textColor:"text-blue-900 dark:text-blue-100",statusText:"In Progress"};case"review":return{icon:So,bgColor:"bg-amber-50 dark:bg-amber-950",borderColor:"border-amber-200 dark:border-amber-800",iconColor:"text-amber-600 dark:text-amber-400",textColor:"text-amber-900 dark:text-amber-100",statusText:"Review"};case"deferred":return{icon:b4,bgColor:"bg-gray-50 dark:bg-gray-800",borderColor:"border-gray-200 dark:border-gray-700",iconColor:"text-gray-500 dark:text-gray-400",textColor:"text-gray-700 dark:text-gray-300",statusText:"Deferred"};case"cancelled":return{icon:Bt,bgColor:"bg-red-50 dark:bg-red-950",borderColor:"border-red-200 dark:border-red-800",iconColor:"text-red-600 dark:text-red-400",textColor:"text-red-900 dark:text-red-100",statusText:"Cancelled"};case"pending":default:return{icon:ti,bgColor:"bg-slate-50 dark:bg-slate-800",borderColor:"border-slate-200 dark:border-slate-700",iconColor:"text-slate-500 dark:text-slate-400",textColor:"text-slate-900 dark:text-slate-100",statusText:"Pending"}}})(e.status);s.icon;const o=l=>{switch(l){case"high":return a.jsx(Pr,{content:"High Priority",children:a.jsx("div",{className:"w-4 h-4 bg-red-100 dark:bg-red-900/30 rounded flex items-center justify-center",children:a.jsx(j5,{className:"w-2.5 h-2.5 text-red-600 dark:text-red-400"})})});case"medium":return a.jsx(Pr,{content:"Medium Priority",children:a.jsx("div",{className:"w-4 h-4 bg-amber-100 dark:bg-amber-900/30 rounded flex items-center justify-center",children:a.jsx(T6,{className:"w-2.5 h-2.5 text-amber-600 dark:text-amber-400"})})});case"low":return a.jsx(Pr,{content:"Low Priority",children:a.jsx("div",{className:"w-4 h-4 bg-blue-100 dark:bg-blue-900/30 rounded flex items-center justify-center",children:a.jsx(ti,{className:"w-1.5 h-1.5 text-blue-600 dark:text-blue-400 fill-current"})})});default:return a.jsx(Pr,{content:"No Priority Set",children:a.jsx("div",{className:"w-4 h-4 bg-gray-100 dark:bg-gray-800 rounded flex items-center justify-center",children:a.jsx(ti,{className:"w-1.5 h-1.5 text-gray-400 dark:text-gray-500"})})})}};return a.jsxs("div",{className:Ze("bg-white dark:bg-gray-800 rounded-lg border border-gray-200 dark:border-gray-700","hover:shadow-md hover:border-blue-300 dark:hover:border-blue-600 transition-all duration-200 cursor-pointer","p-3 space-y-3",t&&"hover:-translate-y-0.5",n),onClick:t,children:[a.jsxs("div",{className:"flex items-start justify-between gap-2 mb-2",children:[a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsx("div",{className:"flex items-center gap-2 mb-1",children:a.jsx(Pr,{content:`Task ID: ${e.id}`,children:a.jsx("span",{className:"text-xs font-mono text-gray-500 dark:text-gray-400 bg-gray-100 dark:bg-gray-700 px-2 py-0.5 rounded",children:e.id})})}),a.jsx("h3",{className:"font-medium text-sm text-gray-900 dark:text-white line-clamp-2 leading-tight",children:e.title}),r&&e.parentId&&a.jsxs("span",{className:"text-xs text-gray-500 dark:text-gray-400 font-medium",children:["Task ",e.parentId]})]}),a.jsx("div",{className:"flex-shrink-0",children:o(e.priority)})]}),a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx("div",{className:"flex items-center",children:e.dependencies&&Array.isArray(e.dependencies)&&e.dependencies.length>0&&a.jsx(Pr,{content:`Depends on: ${e.dependencies.map(l=>`Task ${l}`).join(", ")}`,children:a.jsxs("div",{className:"flex items-center gap-1 text-xs text-amber-600 dark:text-amber-400",children:[a.jsx(Dh,{className:"w-3 h-3"}),a.jsxs("span",{children:["Depends on: ",e.dependencies.join(", ")]})]})})}),a.jsx(Pr,{content:`Status: ${s.statusText}`,children:a.jsxs("div",{className:"flex items-center gap-1",children:[a.jsx("div",{className:Ze("w-2 h-2 rounded-full",s.iconColor.replace("text-","bg-"))}),a.jsx("span",{className:Ze("text-xs font-medium",s.textColor),children:s.statusText})]})})]}),e.subtasks&&e.subtasks.length>0&&a.jsx("div",{className:"ml-3",children:a.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[a.jsx("span",{className:"text-xs text-gray-500 dark:text-gray-400",children:"Progress:"}),a.jsx(Pr,{content:`${e.subtasks.filter(l=>l.status==="done").length} of ${e.subtasks.length} subtasks completed`,children:a.jsx("div",{className:"flex-1 bg-gray-200 dark:bg-gray-700 rounded-full h-1.5",children:a.jsx("div",{className:Ze("h-full rounded-full transition-all duration-300",e.status==="done"?"bg-green-500":"bg-blue-500"),style:{width:`${Math.round(e.subtasks.filter(l=>l.status==="done").length/e.subtasks.length*100)}%`}})})}),a.jsx(Pr,{content:`${e.subtasks.filter(l=>l.status==="done").length} completed, ${e.subtasks.filter(l=>l.status==="pending").length} pending, ${e.subtasks.filter(l=>l.status==="in-progress").length} in progress`,children:a.jsxs("span",{className:"text-xs text-gray-500 dark:text-gray-400",children:[e.subtasks.filter(l=>l.status==="done").length,"/",e.subtasks.length]})})]})})]})},IG=({currentProject:e,onClose:t,onTaskCreated:r})=>a.jsx("div",{className:"fixed inset-0 bg-black/50 backdrop-blur-sm flex items-center justify-center z-50 p-4",children:a.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow-xl w-full max-w-md border border-gray-200 dark:border-gray-700",children:[a.jsxs("div",{className:"flex items-center justify-between p-6 border-b border-gray-200 dark:border-gray-700",children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("div",{className:"w-8 h-8 bg-blue-100 dark:bg-blue-900/50 rounded-lg flex items-center justify-center",children:a.jsx(Gn,{className:"w-4 h-4 text-blue-600 dark:text-blue-400"})}),a.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white",children:"Create AI-Generated Task"})]}),a.jsx("button",{onClick:t,className:"p-2 text-gray-400 hover:text-gray-600 dark:hover:text-gray-300 rounded-md hover:bg-gray-100 dark:hover:bg-gray-700",children:a.jsx(Bt,{className:"w-5 h-5"})})]}),a.jsxs("div",{className:"p-6 space-y-6",children:[a.jsx("div",{className:"bg-blue-50 dark:bg-blue-900/20 rounded-lg p-4 border border-blue-200 dark:border-blue-800",children:a.jsxs("div",{className:"flex items-start gap-3",children:[a.jsx("div",{className:"w-8 h-8 bg-blue-100 dark:bg-blue-900/50 rounded-lg flex items-center justify-center flex-shrink-0 mt-0.5",children:a.jsx(Gn,{className:"w-4 h-4 text-blue-600 dark:text-blue-400"})}),a.jsxs("div",{className:"flex-1",children:[a.jsx("h4",{className:"font-semibold text-blue-900 dark:text-blue-100 mb-2",children:"💡 Pro Tip: Ask Claude Code Directly!"}),a.jsx("p",{className:"text-sm text-blue-800 dark:text-blue-200 mb-3",children:"You can simply ask Claude Code in the chat to create tasks for you. The AI assistant will automatically generate detailed tasks with research-backed insights."}),a.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded border border-blue-200 dark:border-blue-700 p-3 mb-3",children:[a.jsx("p",{className:"text-xs font-medium text-gray-600 dark:text-gray-400 mb-1",children:"Example:"}),a.jsx("p",{className:"text-sm text-gray-900 dark:text-white font-mono",children:'"Please add a new task to implement user profile image uploads using Cloudinary, research the best approach."'})]}),a.jsxs("p",{className:"text-xs text-blue-700 dark:text-blue-300",children:[a.jsx("strong",{children:"This runs:"})," ",a.jsx("code",{className:"bg-blue-100 dark:bg-blue-900/50 px-1 rounded text-xs",children:'task-master add-task --prompt="Implement user profile image uploads using Cloudinary" --research'})]})]})]})}),a.jsxs("div",{className:"text-center pt-4 border-t border-gray-200 dark:border-gray-700",children:[a.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400 mb-3",children:"For more examples and advanced usage patterns:"}),a.jsx("a",{href:"https://github.com/eyaltoledano/claude-task-master/blob/main/docs/examples.md",target:"_blank",rel:"noopener noreferrer",className:"inline-block text-sm text-blue-600 dark:text-blue-400 hover:text-blue-700 dark:hover:text-blue-300 underline font-medium",children:"View TaskMaster Documentation →"})]}),a.jsx("div",{className:"pt-4",children:a.jsx("button",{onClick:t,className:"w-full px-4 py-2 text-sm font-medium text-gray-700 dark:text-gray-300 bg-white dark:bg-gray-700 border border-gray-300 dark:border-gray-600 rounded-lg hover:bg-gray-50 dark:hover:bg-gray-600 transition-colors",children:"Got it, I'll ask Claude Code directly"})})]})]})}),RG=({tasks:e=[],onTaskClick:t,className:r="",showParentTasks:n=!1,defaultView:i="kanban",currentProject:s,onTaskCreated:o,onShowPRDEditor:l,existingPRDs:c=[],onRefreshPRDs:d})=>{const[u,p]=x.useState(""),[h,m]=x.useState("all"),[g,f]=x.useState("all"),[w,S]=x.useState("id"),[k,E]=x.useState("asc"),[N,C]=x.useState(i),[v,I]=x.useState(!1),[M,j]=x.useState(!1),[T,P]=x.useState(!1),[q,D]=x.useState(!1),[z,U]=x.useState(!1),[G,re]=x.useState(!1),{projectTaskMaster:K,refreshProjects:ue,refreshTasks:R,setCurrentProject:F}=ss();x.useEffect(()=>{const oe=fe=>{G&&!fe.target.closest(".relative")&&re(!1)};return document.addEventListener("mousedown",oe),()=>document.removeEventListener("mousedown",oe)},[G]);const te=x.useMemo(()=>{const oe=new Set(e.map(fe=>fe.status).filter(Boolean));return Array.from(oe).sort()},[e]),_=x.useMemo(()=>{const oe=new Set(e.map(fe=>fe.priority).filter(Boolean));return Array.from(oe).sort()},[e]),Z=x.useMemo(()=>{let oe=e.filter(fe=>{const Ie=u.toLowerCase(),qe=!u||fe.title.toLowerCase().includes(Ie)||fe.description?.toLowerCase().includes(Ie)||fe.id.toString().includes(Ie),ze=h==="all"||fe.status===h,ct=g==="all"||fe.priority===g;return qe&&ze&&ct});return oe.sort((fe,Ie)=>{let qe,ze;switch(w){case"title":qe=fe.title.toLowerCase(),ze=Ie.title.toLowerCase();break;case"status":const ct={pending:1,"in-progress":2,done:3,blocked:4,deferred:5,cancelled:6};qe=ct[fe.status]||99,ze=ct[Ie.status]||99;break;case"priority":const Ye={high:3,medium:2,low:1};qe=Ye[fe.priority]||0,ze=Ye[Ie.priority]||0;break;case"updated":qe=new Date(fe.updatedAt||fe.createdAt||0),ze=new Date(Ie.updatedAt||Ie.createdAt||0);break;case"id":default:const wt=Me=>Me.toString().split(".").map(Pt=>parseInt(Pt,10)),gt=wt(fe.id),et=wt(Ie.id);for(let Me=0;Me<Math.max(gt.length,et.length);Me++){const mt=gt[Me]||0,Pt=et[Me]||0;if(mt!==Pt){qe=mt,ze=Pt;break}}break}return w==="updated"?k==="asc"?qe-ze:ze-qe:typeof qe=="string"?k==="asc"?qe.localeCompare(ze):ze.localeCompare(qe):k==="asc"?qe-ze:ze-qe}),oe},[e,u,h,g,w,k]),me=x.useMemo(()=>{const oe=[{id:"pending",title:"📋 To Do",status:"pending",color:"bg-slate-50 dark:bg-slate-900/50 border-slate-200 dark:border-slate-700",headerColor:"bg-slate-100 dark:bg-slate-800 text-slate-800 dark:text-slate-200"},{id:"in-progress",title:"🚀 In Progress",status:"in-progress",color:"bg-blue-50 dark:bg-blue-900/50 border-blue-200 dark:border-blue-700",headerColor:"bg-blue-100 dark:bg-blue-800 text-blue-800 dark:text-blue-200"},{id:"done",title:"✅ Done",status:"done",color:"bg-emerald-50 dark:bg-emerald-900/50 border-emerald-200 dark:border-emerald-700",headerColor:"bg-emerald-100 dark:bg-emerald-800 text-emerald-800 dark:text-emerald-200"},{id:"blocked",title:"🚫 Blocked",status:"blocked",color:"bg-red-50 dark:bg-red-900/50 border-red-200 dark:border-red-700",headerColor:"bg-red-100 dark:bg-red-800 text-red-800 dark:text-red-200"},{id:"deferred",title:"⏳ Deferred",status:"deferred",color:"bg-amber-50 dark:bg-amber-900/50 border-amber-200 dark:border-amber-700",headerColor:"bg-amber-100 dark:bg-amber-800 text-amber-800 dark:text-amber-200"},{id:"cancelled",title:"❌ Cancelled",status:"cancelled",color:"bg-gray-50 dark:bg-gray-900/50 border-gray-200 dark:border-gray-700",headerColor:"bg-gray-100 dark:bg-gray-800 text-gray-800 dark:text-gray-200"}],fe=["pending","in-progress","done"];return oe.filter(qe=>{const ze=Z.some(Ye=>Ye.status===qe.status),ct=fe.includes(qe.status);return ze||ct}).map(qe=>({...qe,tasks:Z.filter(ze=>ze.status===qe.status)}))},[Z]),ke=oe=>{w===oe?E(k==="asc"?"desc":"asc"):(S(oe),E("asc"))},se=()=>{p(""),m("all"),f("all")},_e=oe=>w!==oe?a.jsx(v5,{className:"w-4 h-4"}):k==="asc"?a.jsx(w5,{className:"w-4 h-4"}):a.jsx(d4,{className:"w-4 h-4"});if(e.length===0){const oe=s?.taskMasterConfigured||s?.taskmaster?.hasTaskmaster||K?.hasTaskmaster;return a.jsxs("div",{className:Ze("text-center py-12",r),children:[oe?a.jsxs("div",{className:"max-w-4xl mx-auto",children:[a.jsxs("div",{className:"bg-gradient-to-r from-blue-50 to-indigo-50 dark:from-blue-950/50 dark:to-indigo-950/50 rounded-xl border border-blue-200 dark:border-blue-800 p-6 mb-6",children:[a.jsxs("div",{className:"flex items-center gap-3 mb-4",children:[a.jsx("div",{className:"w-10 h-10 bg-blue-100 dark:bg-blue-900/50 rounded-lg flex items-center justify-center",children:a.jsx(Fr,{className:"w-5 h-5 text-blue-600 dark:text-blue-400"})}),a.jsxs("div",{children:[a.jsx("h2",{className:"text-xl font-semibold text-gray-900 dark:text-white",children:"Getting Started with TaskMaster"}),a.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400",children:"TaskMaster is initialized! Here's what to do next:"})]})]}),a.jsxs("div",{className:"space-y-4 text-left",children:[a.jsxs("div",{className:"grid gap-3",children:[a.jsxs("div",{className:"flex gap-3 p-3 bg-white dark:bg-gray-800/50 rounded-lg border border-blue-100 dark:border-blue-800/50",children:[a.jsx("div",{className:"flex-shrink-0 w-6 h-6 bg-blue-600 text-white text-xs font-semibold rounded-full flex items-center justify-center",children:"1"}),a.jsxs("div",{children:[a.jsx("h4",{className:"font-medium text-gray-900 dark:text-white mb-1",children:"Create a Product Requirements Document (PRD)"}),a.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400 mb-2",children:"Discuss your project idea and create a PRD that describes what you want to build."}),a.jsxs("button",{onClick:()=>{l?.()},className:"inline-flex items-center gap-1 text-xs bg-purple-100 dark:bg-purple-900/30 text-purple-700 dark:text-purple-300 px-2 py-1 rounded hover:bg-purple-200 dark:hover:bg-purple-900/50 transition-colors",children:[a.jsx(Fr,{className:"w-3 h-3"}),"Add PRD"]}),c.length>0&&a.jsxs("div",{className:"mt-3 pt-3 border-t border-gray-200 dark:border-gray-700",children:[a.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 mb-2",children:"Existing PRDs:"}),a.jsx("div",{className:"flex flex-wrap gap-2",children:c.map(fe=>a.jsxs("button",{onClick:async()=>{try{const Ie=await yt.get(`/taskmaster/prd/${encodeURIComponent(s.name)}/${encodeURIComponent(fe.name)}`);if(Ie.ok){const qe=await Ie.json();l?.({name:fe.name,content:qe.content,isExisting:!0})}else console.error("Failed to load PRD:",Ie.statusText)}catch(Ie){console.error("Error loading PRD:",Ie)}},className:"inline-flex items-center gap-1 text-xs bg-gray-100 dark:bg-gray-700 text-gray-700 dark:text-gray-300 px-2 py-1 rounded hover:bg-gray-200 dark:hover:bg-gray-600 transition-colors",children:[a.jsx(Fr,{className:"w-3 h-3"}),fe.name]},fe.name))})]})]})]}),a.jsxs("div",{className:"flex gap-3 p-3 bg-white dark:bg-gray-800/50 rounded-lg border border-blue-100 dark:border-blue-800/50",children:[a.jsx("div",{className:"flex-shrink-0 w-6 h-6 bg-blue-600 text-white text-xs font-semibold rounded-full flex items-center justify-center",children:"2"}),a.jsxs("div",{children:[a.jsx("h4",{className:"font-medium text-gray-900 dark:text-white mb-1",children:"Generate Tasks from PRD"}),a.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400",children:"Once you have a PRD, ask your AI assistant to parse it and TaskMaster will automatically break it down into manageable tasks with implementation details."})]})]}),a.jsxs("div",{className:"flex gap-3 p-3 bg-white dark:bg-gray-800/50 rounded-lg border border-blue-100 dark:border-blue-800/50",children:[a.jsx("div",{className:"flex-shrink-0 w-6 h-6 bg-blue-600 text-white text-xs font-semibold rounded-full flex items-center justify-center",children:"3"}),a.jsxs("div",{children:[a.jsx("h4",{className:"font-medium text-gray-900 dark:text-white mb-1",children:"Analyze & Expand Tasks"}),a.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400",children:"Ask your AI assistant to analyze task complexity and expand them into detailed subtasks for easier implementation."})]})]}),a.jsxs("div",{className:"flex gap-3 p-3 bg-white dark:bg-gray-800/50 rounded-lg border border-blue-100 dark:border-blue-800/50",children:[a.jsx("div",{className:"flex-shrink-0 w-6 h-6 bg-blue-600 text-white text-xs font-semibold rounded-full flex items-center justify-center",children:"4"}),a.jsxs("div",{children:[a.jsx("h4",{className:"font-medium text-gray-900 dark:text-white mb-1",children:"Start Building"}),a.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400",children:"Ask your AI assistant to begin working on tasks, update their status, and add new tasks as your project evolves."})]})]})]}),a.jsx("div",{className:"flex gap-3 pt-4 border-t border-blue-200 dark:border-blue-700",children:a.jsxs("button",{onClick:fe=>{fe.preventDefault(),fe.stopPropagation(),l?.()},className:"flex items-center gap-2 px-4 py-2 bg-purple-600 hover:bg-purple-700 text-white rounded-lg font-medium transition-colors cursor-pointer",style:{zIndex:10},children:[a.jsx(Fr,{className:"w-4 h-4"}),"Add PRD"]})})]})]}),a.jsx("div",{className:"text-center",children:a.jsxs("div",{className:"text-sm text-gray-500 dark:text-gray-400 mb-2",children:["💡 ",a.jsx("strong",{children:"Tip:"})," Start with a PRD to get the most out of TaskMaster's AI-powered task generation"]})})]}):a.jsxs("div",{className:"max-w-md mx-auto",children:[a.jsx("div",{className:"text-blue-600 dark:text-blue-400 mb-4",children:a.jsx(Ia,{className:"w-12 h-12 mx-auto mb-4"})}),a.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white mb-2",children:"TaskMaster AI is not configured"}),a.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400 mb-6",children:"TaskMaster helps break down complex projects into manageable tasks with AI-powered assistance"}),a.jsxs("div",{className:"mb-6 p-4 bg-blue-50 dark:bg-blue-950 rounded-lg text-left",children:[a.jsx("h4",{className:"text-sm font-medium text-blue-900 dark:text-blue-100 mb-3",children:"🎯 What is TaskMaster?"}),a.jsxs("div",{className:"text-xs text-blue-800 dark:text-blue-200 space-y-1",children:[a.jsxs("p",{children:["• ",a.jsx("strong",{children:"AI-Powered Task Management:"})," Break complex projects into manageable subtasks"]}),a.jsxs("p",{children:["• ",a.jsx("strong",{children:"PRD Templates:"})," Generate tasks from Product Requirements Documents"]}),a.jsxs("p",{children:["• ",a.jsx("strong",{children:"Dependency Tracking:"})," Understand task relationships and execution order"]}),a.jsxs("p",{children:["• ",a.jsx("strong",{children:"Progress Visualization:"})," Kanban boards and detailed task analytics"]}),a.jsxs("p",{children:["• ",a.jsx("strong",{children:"CLI Integration:"})," Use taskmaster commands for advanced workflows"]})]})]}),a.jsxs("button",{onClick:()=>{U(!1),P(!0)},className:"px-4 py-2 bg-blue-600 hover:bg-blue-700 text-white rounded-lg font-medium transition-colors flex items-center gap-2 mx-auto",children:[a.jsx(pa,{className:"w-4 h-4"}),"Initialize TaskMaster AI"]})]}),T&&a.jsx("div",{className:"fixed inset-0 z-50 flex items-start justify-center p-4 pt-16 bg-black/50 backdrop-blur-sm",children:a.jsxs("div",{className:"bg-white dark:bg-gray-900 rounded-lg shadow-xl border border-gray-200 dark:border-gray-700 w-full max-w-4xl h-[600px] flex flex-col",children:[a.jsxs("div",{className:"flex items-center justify-between p-4 border-b border-gray-200 dark:border-gray-700",children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("div",{className:"w-8 h-8 bg-blue-100 dark:bg-blue-900/50 rounded-lg flex items-center justify-center",children:a.jsx(pa,{className:"w-4 h-4 text-blue-600 dark:text-blue-400"})}),a.jsxs("div",{children:[a.jsx("h2",{className:"text-lg font-semibold text-gray-900 dark:text-white",children:"TaskMaster Setup"}),a.jsxs("p",{className:"text-sm text-gray-500 dark:text-gray-400",children:["Interactive CLI for ",s?.displayName]})]})]}),a.jsx("button",{onClick:()=>{P(!1),setTimeout(()=>{ue(),s&&F(s)},1e3)},className:"p-2 text-gray-400 hover:text-gray-600 dark:hover:text-gray-300 rounded-md hover:bg-gray-100 dark:hover:bg-gray-800",children:a.jsx(gr,{className:"w-5 h-5 rotate-45"})})]}),a.jsx("div",{className:"flex-1 p-4",children:a.jsx("div",{className:"h-full bg-black rounded-lg overflow-hidden",onClick:fe=>{const Ie=fe.currentTarget.querySelector(".xterm-screen");Ie&&Ie.focus()},children:a.jsx(Bg,{selectedProject:s,selectedSession:null,isActive:!0,initialCommand:"npx task-master init",isPlainShell:!0,onProcessComplete:fe=>{U(!0),fe===0&&setTimeout(()=>{ue(),s&&F(s)},1e3)}})})}),a.jsx("div",{className:"p-4 border-t border-gray-200 dark:border-gray-700 bg-gray-50 dark:bg-gray-800/50",children:a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx("div",{className:"text-sm text-gray-600 dark:text-gray-400",children:z?a.jsxs("span",{className:"flex items-center gap-2 text-green-600 dark:text-green-400",children:[a.jsx("div",{className:"w-2 h-2 bg-green-500 rounded-full"}),"TaskMaster setup completed! You can now close this window."]}):"TaskMaster initialization will start automatically"}),a.jsx("button",{onClick:()=>{P(!1),U(!1),setTimeout(()=>{ue(),s&&F(s)},1e3)},className:Ze("px-4 py-2 text-sm font-medium rounded-md transition-colors",z?"bg-green-600 hover:bg-green-700 text-white":"text-gray-700 dark:text-gray-300 bg-white dark:bg-gray-700 border border-gray-300 dark:border-gray-600 hover:bg-gray-50 dark:hover:bg-gray-600"),children:z?"Close & Continue":"Close"})]})})]})})]})}return a.jsxs("div",{className:Ze("space-y-4",r),children:[a.jsxs("div",{className:"flex flex-col lg:flex-row gap-3 lg:items-center lg:justify-between",children:[a.jsxs("div",{className:"relative flex-1 max-w-md",children:[a.jsx(si,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 text-gray-400 w-4 h-4"}),a.jsx("input",{type:"text",placeholder:"Search tasks...",value:u,onChange:oe=>p(oe.target.value),className:"pl-10 pr-4 py-2 w-full border border-gray-300 dark:border-gray-600 rounded-lg bg-white dark:bg-gray-800 text-gray-900 dark:text-white focus:ring-2 focus:ring-blue-500 focus:border-blue-500"})]}),a.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[a.jsxs("div",{className:"flex bg-gray-100 dark:bg-gray-800 rounded-lg p-1",children:[a.jsx("button",{onClick:()=>C("kanban"),className:Ze("p-2 rounded-md transition-colors",N==="kanban"?"bg-white dark:bg-gray-700 text-gray-900 dark:text-white shadow-sm":"text-gray-500 dark:text-gray-400 hover:text-gray-700 dark:hover:text-gray-300"),title:"Kanban view",children:a.jsx(U5,{className:"w-4 h-4"})}),a.jsx("button",{onClick:()=>C("list"),className:Ze("p-2 rounded-md transition-colors",N==="list"?"bg-white dark:bg-gray-700 text-gray-900 dark:text-white shadow-sm":"text-gray-500 dark:text-gray-400 hover:text-gray-700 dark:hover:text-gray-300"),title:"List view",children:a.jsx(eo,{className:"w-4 h-4"})}),a.jsx("button",{onClick:()=>C("grid"),className:Ze("p-2 rounded-md transition-colors",N==="grid"?"bg-white dark:bg-gray-700 text-gray-900 dark:text-white shadow-sm":"text-gray-500 dark:text-gray-400 hover:text-gray-700 dark:hover:text-gray-300"),title:"Grid view",children:a.jsx(c6,{className:"w-4 h-4"})})]}),a.jsxs("button",{onClick:()=>I(!v),className:Ze("flex items-center gap-2 px-3 py-2 rounded-lg border transition-colors",v?"bg-blue-50 dark:bg-blue-900 border-blue-200 dark:border-blue-700 text-blue-700 dark:text-blue-300":"bg-white dark:bg-gray-800 border-gray-300 dark:border-gray-600 text-gray-700 dark:text-gray-300 hover:bg-gray-50 dark:hover:bg-gray-700"),children:[a.jsx(r6,{className:"w-4 h-4"}),a.jsx("span",{className:"hidden sm:inline",children:"Filters"}),a.jsx(tn,{className:Ze("w-4 h-4 transition-transform",v&&"rotate-180")})]}),s&&a.jsxs(a.Fragment,{children:[a.jsx("button",{onClick:()=>D(!0),className:"p-2 text-gray-600 dark:text-gray-400 hover:text-blue-600 dark:hover:text-blue-400 hover:bg-gray-100 dark:hover:bg-gray-700 rounded-lg transition-colors border border-gray-300 dark:border-gray-600",title:"TaskMaster Getting Started Guide",children:a.jsx(F5,{className:"w-4 h-4"})}),a.jsx("div",{className:"relative",children:c.length>0?a.jsxs("div",{className:"relative",children:[a.jsxs("button",{onClick:()=>re(!G),className:"flex items-center gap-2 px-3 py-2 bg-purple-600 hover:bg-purple-700 text-white rounded-lg transition-colors font-medium",title:`${c.length} PRD${c.length>1?"s":""} available`,children:[a.jsx(Fr,{className:"w-4 h-4"}),a.jsx("span",{className:"hidden sm:inline",children:"PRDs"}),a.jsx("span",{className:"px-1.5 py-0.5 text-xs bg-purple-500 rounded-full min-w-[1.25rem] text-center",children:c.length}),a.jsx(tn,{className:Ze("w-3 h-3 transition-transform hidden sm:block",G&&"rotate-180")})]}),G&&a.jsx("div",{className:"absolute right-0 top-full mt-2 w-56 bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg shadow-xl z-30",children:a.jsxs("div",{className:"p-2",children:[a.jsxs("button",{onClick:()=>{l?.(),re(!1)},className:"w-full text-left px-3 py-2 text-sm font-medium text-purple-700 dark:text-purple-300 hover:bg-purple-50 dark:hover:bg-purple-900/30 rounded flex items-center gap-2",children:[a.jsx(gr,{className:"w-4 h-4"}),"Create New PRD"]}),a.jsx("div",{className:"border-t border-gray-200 dark:border-gray-700 my-1"}),a.jsx("div",{className:"text-xs text-gray-500 dark:text-gray-400 px-3 py-1 font-medium",children:"Existing PRDs:"}),c.map(oe=>a.jsxs("button",{onClick:async()=>{try{const fe=await yt.get(`/taskmaster/prd/${encodeURIComponent(s.name)}/${encodeURIComponent(oe.name)}`);if(fe.ok){const Ie=await fe.json();l?.({name:oe.name,content:Ie.content,isExisting:!0}),re(!1)}}catch(fe){console.error("Error loading PRD:",fe)}},className:"w-full text-left px-3 py-2 text-sm text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700 rounded flex items-center gap-2",title:`Modified: ${new Date(oe.modified).toLocaleDateString()}`,children:[a.jsx(Fr,{className:"w-4 h-4"}),a.jsx("span",{className:"truncate",children:oe.name})]},oe.name))]})})]}):a.jsxs("button",{onClick:()=>{l?.()},className:"flex items-center gap-2 px-3 py-2 bg-purple-600 hover:bg-purple-700 text-white rounded-lg transition-colors font-medium",title:"Create Product Requirements Document",children:[a.jsx(Fr,{className:"w-4 h-4"}),a.jsx("span",{className:"hidden sm:inline",children:"Add PRD"})]})}),(s?.taskMasterConfigured||s?.taskmaster?.hasTaskmaster||K?.hasTaskmaster||e.length>0)&&a.jsxs("button",{onClick:()=>j(!0),className:"flex items-center gap-2 px-3 py-2 bg-blue-600 hover:bg-blue-700 text-white rounded-lg transition-colors font-medium",title:"Add a new task",children:[a.jsx(gr,{className:"w-4 h-4"}),a.jsx("span",{className:"hidden sm:inline",children:"Add Task"})]})]})]})]}),v&&a.jsxs("div",{className:"bg-gray-50 dark:bg-gray-800 rounded-lg p-4 space-y-4",children:[a.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-4",children:[a.jsxs("div",{children:[a.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1",children:"Status"}),a.jsxs("select",{value:h,onChange:oe=>m(oe.target.value),className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md bg-white dark:bg-gray-800 text-gray-900 dark:text-white focus:ring-2 focus:ring-blue-500",children:[a.jsx("option",{value:"all",children:"All Statuses"}),te.map(oe=>a.jsx("option",{value:oe,children:oe.charAt(0).toUpperCase()+oe.slice(1).replace("-"," ")},oe))]})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1",children:"Priority"}),a.jsxs("select",{value:g,onChange:oe=>f(oe.target.value),className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md bg-white dark:bg-gray-800 text-gray-900 dark:text-white focus:ring-2 focus:ring-blue-500",children:[a.jsx("option",{value:"all",children:"All Priorities"}),_.map(oe=>a.jsx("option",{value:oe,children:oe.charAt(0).toUpperCase()+oe.slice(1)},oe))]})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1",children:"Sort By"}),a.jsxs("select",{value:`${w}-${k}`,onChange:oe=>{const[fe,Ie]=oe.target.value.split("-");S(fe),E(Ie)},className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md bg-white dark:bg-gray-800 text-gray-900 dark:text-white focus:ring-2 focus:ring-blue-500",children:[a.jsx("option",{value:"id-asc",children:"ID (Ascending)"}),a.jsx("option",{value:"id-desc",children:"ID (Descending)"}),a.jsx("option",{value:"title-asc",children:"Title (A-Z)"}),a.jsx("option",{value:"title-desc",children:"Title (Z-A)"}),a.jsx("option",{value:"status-asc",children:"Status (Pending First)"}),a.jsx("option",{value:"status-desc",children:"Status (Done First)"}),a.jsx("option",{value:"priority-asc",children:"Priority (High First)"}),a.jsx("option",{value:"priority-desc",children:"Priority (Low First)"})]})]})]}),a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{className:"text-sm text-gray-600 dark:text-gray-400",children:["Showing ",Z.length," of ",e.length," tasks"]}),a.jsx("button",{onClick:se,className:"text-sm text-blue-600 dark:text-blue-400 hover:text-blue-700 dark:hover:text-blue-300 font-medium",children:"Clear Filters"})]})]}),a.jsxs("div",{className:"flex flex-wrap gap-2",children:[a.jsxs("button",{onClick:()=>ke("id"),className:Ze("flex items-center gap-1 px-3 py-1.5 rounded-md text-sm transition-colors",w==="id"?"bg-blue-100 dark:bg-blue-900 text-blue-700 dark:text-blue-300":"bg-gray-100 dark:bg-gray-800 text-gray-600 dark:text-gray-400 hover:bg-gray-200 dark:hover:bg-gray-700"),children:["ID ",_e("id")]}),a.jsxs("button",{onClick:()=>ke("status"),className:Ze("flex items-center gap-1 px-3 py-1.5 rounded-md text-sm transition-colors",w==="status"?"bg-blue-100 dark:bg-blue-900 text-blue-700 dark:text-blue-300":"bg-gray-100 dark:bg-gray-800 text-gray-600 dark:text-gray-400 hover:bg-gray-200 dark:hover:bg-gray-700"),children:["Status ",_e("status")]}),a.jsxs("button",{onClick:()=>ke("priority"),className:Ze("flex items-center gap-1 px-3 py-1.5 rounded-md text-sm transition-colors",w==="priority"?"bg-blue-100 dark:bg-blue-900 text-blue-700 dark:text-blue-300":"bg-gray-100 dark:bg-gray-800 text-gray-600 dark:text-gray-400 hover:bg-gray-200 dark:hover:bg-gray-700"),children:["Priority ",_e("priority")]})]}),Z.length===0?a.jsx("div",{className:"text-center py-12",children:a.jsxs("div",{className:"text-gray-500 dark:text-gray-400",children:[a.jsx(si,{className:"w-12 h-12 mx-auto mb-4 opacity-50"}),a.jsx("h3",{className:"text-lg font-medium mb-2",children:"No tasks match your filters"}),a.jsx("p",{className:"text-sm",children:"Try adjusting your search or filter criteria."})]})}):N==="kanban"?a.jsx("div",{className:Ze("grid gap-6",me.length===1&&"grid-cols-1 max-w-md mx-auto",me.length===2&&"grid-cols-1 md:grid-cols-2",me.length===3&&"grid-cols-1 md:grid-cols-2 lg:grid-cols-3",me.length===4&&"grid-cols-1 md:grid-cols-2 lg:grid-cols-4",me.length===5&&"grid-cols-1 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-5",me.length>=6&&"grid-cols-1 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-6"),children:me.map(oe=>a.jsxs("div",{className:Ze("rounded-xl border shadow-sm transition-shadow hover:shadow-md",oe.color),children:[a.jsx("div",{className:Ze("px-4 py-3 rounded-t-xl border-b",oe.headerColor),children:a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx("h3",{className:"font-semibold text-sm",children:oe.title}),a.jsx("div",{className:"flex items-center gap-2",children:a.jsx("span",{className:"text-xs font-medium px-2 py-1 bg-white/60 dark:bg-black/20 rounded-full",children:oe.tasks.length})})]})}),a.jsx("div",{className:"p-3 space-y-3 min-h-[200px] max-h-[calc(100vh-300px)] overflow-y-auto",children:oe.tasks.length===0?a.jsxs("div",{className:"text-center py-8 text-gray-400 dark:text-gray-500",children:[a.jsx("div",{className:"w-8 h-8 mx-auto mb-2 rounded-full bg-gray-200 dark:bg-gray-700 flex items-center justify-center",children:a.jsx("div",{className:"w-3 h-3 rounded-full bg-gray-300 dark:bg-gray-600"})}),a.jsx("div",{className:"text-xs font-medium text-gray-500 dark:text-gray-400",children:"No tasks yet"}),a.jsx("div",{className:"text-xs text-gray-400 dark:text-gray-500 mt-1",children:oe.status==="pending"?"Tasks will appear here":oe.status==="in-progress"?"Move tasks here when started":oe.status==="done"?"Completed tasks appear here":"Tasks with this status will appear here"})]}):oe.tasks.map(fe=>a.jsx("div",{className:"transform transition-transform hover:scale-[1.02]",children:a.jsx(X2,{task:fe,onClick:()=>t?.(fe),showParent:n,className:"w-full shadow-sm hover:shadow-md transition-shadow cursor-pointer"})},fe.id))})]},oe.id))}):a.jsx("div",{className:Ze("gap-4",N==="grid"?"grid grid-cols-1 md:grid-cols-2 xl:grid-cols-3":"space-y-4"),children:Z.map(oe=>a.jsx(X2,{task:oe,onClick:()=>t?.(oe),showParent:n,className:N==="grid"?"h-full":""},oe.id))}),M&&a.jsx(IG,{currentProject:s,onClose:()=>j(!1),onTaskCreated:()=>{j(!1),o&&o()}}),q&&a.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-4 bg-black/50 backdrop-blur-sm",children:a.jsxs("div",{className:"bg-white dark:bg-gray-900 rounded-lg shadow-xl border border-gray-200 dark:border-gray-700 w-full max-w-4xl max-h-[90vh] overflow-hidden",children:[a.jsxs("div",{className:"flex items-center justify-between p-6 border-b border-gray-200 dark:border-gray-700",children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("div",{className:"w-10 h-10 bg-blue-100 dark:bg-blue-900/50 rounded-lg flex items-center justify-center",children:a.jsx(Fr,{className:"w-5 h-5 text-blue-600 dark:text-blue-400"})}),a.jsxs("div",{children:[a.jsx("h2",{className:"text-xl font-semibold text-gray-900 dark:text-white",children:"Getting Started with TaskMaster"}),a.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400",children:"Your guide to productive task management"})]})]}),a.jsx("button",{onClick:()=>D(!1),className:"p-2 text-gray-400 hover:text-gray-600 dark:hover:text-gray-300 rounded-lg hover:bg-gray-100 dark:hover:bg-gray-700 transition-colors",children:a.jsx(Bt,{className:"w-5 h-5"})})]}),a.jsx("div",{className:"p-6 overflow-y-auto max-h-[calc(90vh-120px)]",children:a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"flex gap-4 p-4 bg-gradient-to-r from-blue-50 to-indigo-50 dark:from-blue-950/50 dark:to-indigo-950/50 rounded-lg border border-blue-200 dark:border-blue-800",children:[a.jsx("div",{className:"flex-shrink-0 w-8 h-8 bg-blue-600 text-white text-sm font-semibold rounded-full flex items-center justify-center",children:"1"}),a.jsxs("div",{children:[a.jsx("h4",{className:"font-medium text-gray-900 dark:text-white mb-2",children:"Create a Product Requirements Document (PRD)"}),a.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400 mb-3",children:"Discuss your project idea and create a PRD that describes what you want to build."}),a.jsxs("button",{onClick:()=>{l?.(),D(!1)},className:"inline-flex items-center gap-2 text-sm bg-purple-100 dark:bg-purple-900/30 text-purple-700 dark:text-purple-300 px-3 py-1.5 rounded-lg hover:bg-purple-200 dark:hover:bg-purple-900/50 transition-colors",children:[a.jsx(Fr,{className:"w-4 h-4"}),"Add PRD"]})]})]}),a.jsxs("div",{className:"flex gap-4 p-4 bg-gradient-to-r from-green-50 to-emerald-50 dark:from-green-950/50 dark:to-emerald-950/50 rounded-lg border border-green-200 dark:border-green-800",children:[a.jsx("div",{className:"flex-shrink-0 w-8 h-8 bg-green-600 text-white text-sm font-semibold rounded-full flex items-center justify-center",children:"2"}),a.jsxs("div",{children:[a.jsx("h4",{className:"font-medium text-gray-900 dark:text-white mb-2",children:"Generate Tasks from PRD"}),a.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400 mb-3",children:"Once you have a PRD, ask your AI assistant to parse it and TaskMaster will automatically break it down into manageable tasks with implementation details."}),a.jsxs("div",{className:"bg-white dark:bg-gray-800/50 rounded border border-green-200 dark:border-green-700/50 p-3 mb-2",children:[a.jsx("p",{className:"text-xs font-medium text-gray-600 dark:text-gray-400 mb-1",children:"💬 Example:"}),a.jsx("p",{className:"text-xs text-gray-900 dark:text-white font-mono",children:`"I've just initialized a new project with Claude Task Master. I have a PRD at .taskmaster/docs/prd.txt. Can you help me parse it and set up the initial tasks?"`})]})]})]}),a.jsxs("div",{className:"flex gap-4 p-4 bg-gradient-to-r from-amber-50 to-orange-50 dark:from-amber-950/50 dark:to-orange-950/50 rounded-lg border border-amber-200 dark:border-amber-800",children:[a.jsx("div",{className:"flex-shrink-0 w-8 h-8 bg-amber-600 text-white text-sm font-semibold rounded-full flex items-center justify-center",children:"3"}),a.jsxs("div",{children:[a.jsx("h4",{className:"font-medium text-gray-900 dark:text-white mb-2",children:"Analyze & Expand Tasks"}),a.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400 mb-3",children:"Ask your AI assistant to analyze task complexity and expand them into detailed subtasks for easier implementation."}),a.jsxs("div",{className:"bg-white dark:bg-gray-800/50 rounded border border-amber-200 dark:border-amber-700/50 p-3 mb-2",children:[a.jsx("p",{className:"text-xs font-medium text-gray-600 dark:text-gray-400 mb-1",children:"💬 Example:"}),a.jsx("p",{className:"text-xs text-gray-900 dark:text-white font-mono",children:'"Task 5 seems complex. Can you break it down into subtasks?"'})]})]})]}),a.jsxs("div",{className:"flex gap-4 p-4 bg-gradient-to-r from-purple-50 to-pink-50 dark:from-purple-950/50 dark:to-pink-950/50 rounded-lg border border-purple-200 dark:border-purple-800",children:[a.jsx("div",{className:"flex-shrink-0 w-8 h-8 bg-purple-600 text-white text-sm font-semibold rounded-full flex items-center justify-center",children:"4"}),a.jsxs("div",{children:[a.jsx("h4",{className:"font-medium text-gray-900 dark:text-white mb-2",children:"Start Building"}),a.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400 mb-3",children:"Ask your AI assistant to begin working on tasks, update their status, and add new tasks as your project evolves."}),a.jsxs("div",{className:"bg-white dark:bg-gray-800/50 rounded border border-purple-200 dark:border-purple-700/50 p-3 mb-3",children:[a.jsx("p",{className:"text-xs font-medium text-gray-600 dark:text-gray-400 mb-1",children:"💬 Example:"}),a.jsx("p",{className:"text-xs text-gray-900 dark:text-white font-mono",children:'"Please add a new task to implement user profile image uploads using Cloudinary, research the best approach."'})]}),a.jsx("a",{href:"https://github.com/eyaltoledano/claude-task-master/blob/main/docs/examples.md",target:"_blank",rel:"noopener noreferrer",className:"inline-block text-xs text-blue-600 dark:text-blue-400 hover:text-blue-700 dark:hover:text-blue-300 underline",children:"View more examples and usage patterns →"})]})]}),a.jsxs("div",{className:"mt-6 p-4 bg-gray-50 dark:bg-gray-800 rounded-lg border border-gray-200 dark:border-gray-700",children:[a.jsx("h4",{className:"font-medium text-gray-900 dark:text-white mb-3",children:"💡 Pro Tips"}),a.jsxs("ul",{className:"space-y-2 text-sm text-gray-600 dark:text-gray-400",children:[a.jsxs("li",{className:"flex items-start gap-2",children:[a.jsx("span",{className:"w-1.5 h-1.5 bg-blue-500 rounded-full mt-2 flex-shrink-0"}),"Use the search bar to quickly find specific tasks"]}),a.jsxs("li",{className:"flex items-start gap-2",children:[a.jsx("span",{className:"w-1.5 h-1.5 bg-green-500 rounded-full mt-2 flex-shrink-0"}),"Switch between Kanban, List, and Grid views using the view toggles"]}),a.jsxs("li",{className:"flex items-start gap-2",children:[a.jsx("span",{className:"w-1.5 h-1.5 bg-purple-500 rounded-full mt-2 flex-shrink-0"}),"Use filters to focus on specific task statuses or priorities"]}),a.jsxs("li",{className:"flex items-start gap-2",children:[a.jsx("span",{className:"w-1.5 h-1.5 bg-orange-500 rounded-full mt-2 flex-shrink-0"}),"Click on any task to view detailed information and manage subtasks"]})]})]}),a.jsxs("div",{className:"mt-6 p-4 bg-blue-50 dark:bg-blue-950/50 rounded-lg border border-blue-200 dark:border-blue-800",children:[a.jsx("h4",{className:"font-medium text-blue-900 dark:text-blue-100 mb-3",children:"📚 Learn More"}),a.jsx("p",{className:"text-sm text-blue-800 dark:text-blue-200 mb-3",children:"TaskMaster AI is an advanced task management system built for developers. Get documentation, examples, and contribute to the project."}),a.jsxs("a",{href:"https://github.com/eyaltoledano/claude-task-master",target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-2 text-sm bg-blue-600 hover:bg-blue-700 text-white px-3 py-2 rounded-lg font-medium transition-colors",children:[a.jsx("svg",{className:"w-4 h-4",fill:"currentColor",viewBox:"0 0 20 20",children:a.jsx("path",{fillRule:"evenodd",d:"M10 0C4.477 0 0 4.484 0 10.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 0110 4.844c.85.004 1.705.115 2.504.337 1.909-1.296 2.747-1.027 2.747-1.027.546 1.379.203 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.942.359.31.678.921.678 1.856 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.019 10.019 0 0020 10.017C20 4.484 15.522 0 10 0z",clipRule:"evenodd"})}),"View on GitHub",a.jsx("svg",{className:"w-3 h-3",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:a.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"})})]})]})]})})]})})]})},jG=({file:e,onClose:t,projectPath:r,project:n,initialContent:i="",isNewFile:s=!1,onSave:o})=>{const[l,c]=x.useState(i),[d,u]=x.useState(!s),[p,h]=x.useState(!1),[m,g]=x.useState(!1),[f,w]=x.useState(!0),[S,k]=x.useState(!1),[E,N]=x.useState(!1),[C,v]=x.useState(!0),[I,M]=x.useState(""),[j,T]=x.useState(!1),[P,q]=x.useState(!1),[D,z]=x.useState([]),U=x.useRef(null),G=`# Product Requirements Document - Example Project
|
|
942
|
+
`).map((s,o)=>i(s,o))})}function TG({selectedProject:e,isMobile:t,onFileOpen:r}){const[n,i]=x.useState(null),[s,o]=x.useState({}),[l,c]=x.useState(!1),[d,u]=x.useState(""),[p,h]=x.useState(new Set),[m,g]=x.useState(new Set),[f,w]=x.useState(!1),[S,k]=x.useState(""),[E,N]=x.useState([]),[C,v]=x.useState(!0),[I,M]=x.useState(!1),[j,T]=x.useState(!1),[P,q]=x.useState(!1),[D,z]=x.useState(""),[U,G]=x.useState(!1),[re,K]=x.useState("changes"),[ue,R]=x.useState([]),[F,te]=x.useState(new Set),[_,Z]=x.useState({}),[me,ke]=x.useState(!1),[se,_e]=x.useState(null),[oe,fe]=x.useState(!1),[Ie,qe]=x.useState(!1),[ze,ct]=x.useState(!1),[Ye,wt]=x.useState(!1),[gt,et]=x.useState(t),[Me,mt]=x.useState(null),[Pt,xe]=x.useState(!1),at=x.useRef(null),ce=x.useRef(null),[Ee,H]=x.useState(()=>localStorage.getItem("selected-provider")||"claude");x.useEffect(()=>{const ae=()=>{const ge=localStorage.getItem("selected-provider")||"claude";H(ge)};return window.addEventListener("storage",ae),()=>window.removeEventListener("storage",ae)},[]),x.useEffect(()=>{e&&(Y(),le(),ve(),re==="history"&&Qe())},[e,re]),x.useEffect(()=>{const ae=ge=>{ce.current&&!ce.current.contains(ge.target)&&T(!1)};return document.addEventListener("mousedown",ae),()=>document.removeEventListener("mousedown",ae)},[]);const Y=async()=>{if(e){c(!0);try{const ge=await(await Ce(`/api/git/status?project=${encodeURIComponent(e.name)}`)).json();if(ge.error)console.error("Git status error:",ge.error),i({error:ge.error,details:ge.details});else{i(ge),k(ge.branch||"main");const tt=new Set([...ge.modified||[],...ge.added||[],...ge.deleted||[],...ge.untracked||[]]);g(tt);for(const bt of ge.modified||[])Ue(bt);for(const bt of ge.added||[])Ue(bt);for(const bt of ge.deleted||[])Ue(bt);for(const bt of ge.untracked||[])Ue(bt)}}catch(ae){console.error("Error fetching git status:",ae)}finally{c(!1)}}},le=async()=>{try{const ge=await(await Ce(`/api/git/branches?project=${encodeURIComponent(e.name)}`)).json();!ge.error&&ge.branches&&N(ge.branches)}catch(ae){console.error("Error fetching branches:",ae)}},ve=async()=>{if(e)try{const ge=await(await Ce(`/api/git/remote-status?project=${encodeURIComponent(e.name)}`)).json();ge.error?_e(null):_e(ge)}catch(ae){console.error("Error fetching remote status:",ae),_e(null)}},Ve=async ae=>{try{const tt=await(await Ce("/api/git/checkout",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({project:e.name,branch:ae})})).json();tt.success?(k(ae),T(!1),Y()):console.error("Failed to switch branch:",tt.error)}catch(ge){console.error("Error switching branch:",ge)}},It=async()=>{if(D.trim()){G(!0);try{const ge=await(await Ce("/api/git/create-branch",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({project:e.name,branch:D.trim()})})).json();ge.success?(k(D.trim()),q(!1),T(!1),z(""),le(),Y()):console.error("Failed to create branch:",ge.error)}catch(ae){console.error("Error creating branch:",ae)}finally{G(!1)}}},ft=async()=>{fe(!0);try{const ge=await(await Ce("/api/git/fetch",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({project:e.name})})).json();ge.success?(Y(),ve()):console.error("Fetch failed:",ge.error)}catch(ae){console.error("Error fetching from remote:",ae)}finally{fe(!1)}},Rt=async()=>{qe(!0);try{const ge=await(await Ce("/api/git/pull",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({project:e.name})})).json();ge.success?(Y(),ve()):console.error("Pull failed:",ge.error)}catch(ae){console.error("Error pulling from remote:",ae)}finally{qe(!1)}},it=async()=>{ct(!0);try{const ge=await(await Ce("/api/git/push",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({project:e.name})})).json();ge.success?(Y(),ve()):console.error("Push failed:",ge.error)}catch(ae){console.error("Error pushing to remote:",ae)}finally{ct(!1)}},ie=async()=>{wt(!0);try{const ge=await(await Ce("/api/git/publish",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({project:e.name,branch:S})})).json();ge.success?(Y(),ve()):console.error("Publish failed:",ge.error)}catch(ae){console.error("Error publishing branch:",ae)}finally{wt(!1)}},je=async ae=>{try{const tt=await(await Ce("/api/git/discard",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({project:e.name,file:ae})})).json();tt.success?(g(bt=>{const hr=new Set(bt);return hr.delete(ae),hr}),Y()):console.error("Discard failed:",tt.error)}catch(ge){console.error("Error discarding changes:",ge)}},Te=async ae=>{try{const tt=await(await Ce("/api/git/delete-untracked",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({project:e.name,file:ae})})).json();tt.success?(g(bt=>{const hr=new Set(bt);return hr.delete(ae),hr}),Y()):console.error("Delete failed:",tt.error)}catch(ge){console.error("Error deleting untracked file:",ge)}},Pe=async()=>{if(!Me)return;const{type:ae,file:ge,message:tt}=Me;mt(null);try{switch(ae){case"discard":await je(ge);break;case"delete":await Te(ge);break;case"commit":await he();break;case"pull":await Rt();break;case"push":await it();break;case"publish":await ie();break}}catch(bt){console.error(`Error executing ${ae}:`,bt)}},Ue=async ae=>{try{const tt=await(await Ce(`/api/git/diff?project=${encodeURIComponent(e.name)}&file=${encodeURIComponent(ae)}`)).json();!tt.error&&tt.diff&&o(bt=>({...bt,[ae]:tt.diff}))}catch(ge){console.error("Error fetching file diff:",ge)}},st=async ae=>{if(r)try{const tt=await(await Ce(`/api/git/file-with-diff?project=${encodeURIComponent(e.name)}&file=${encodeURIComponent(ae)}`)).json();if(tt.error){console.error("Error fetching file with diff:",tt.error),r(ae);return}const bt={old_string:tt.oldContent||"",new_string:tt.currentContent||""};r(ae,bt)}catch(ge){console.error("Error opening file:",ge),r(ae)}},Qe=async()=>{try{const ge=await(await Ce(`/api/git/commits?project=${encodeURIComponent(e.name)}&limit=10`)).json();!ge.error&&ge.commits&&R(ge.commits)}catch(ae){console.error("Error fetching commits:",ae)}},J=async ae=>{try{const tt=await(await Ce(`/api/git/commit-diff?project=${encodeURIComponent(e.name)}&commit=${ae}`)).json();!tt.error&&tt.diff&&Z(bt=>({...bt,[ae]:tt.diff}))}catch(ge){console.error("Error fetching commit diff:",ge)}},Fe=async()=>{ke(!0);try{const ge=await(await Ce("/api/git/generate-commit-message",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({project:e.name,files:Array.from(m),provider:Ee})})).json();ge.message?u(ge.message):console.error("Failed to generate commit message:",ge.error)}catch(ae){console.error("Error generating commit message:",ae)}finally{ke(!1)}},Ke=ae=>{h(ge=>{const tt=new Set(ge);return tt.has(ae)?tt.delete(ae):tt.add(ae),tt})},Ge=ae=>{te(ge=>{const tt=new Set(ge);return tt.has(ae)?tt.delete(ae):(tt.add(ae),_[ae]||J(ae)),tt})},dt=ae=>{g(ge=>{const tt=new Set(ge);return tt.has(ae)?tt.delete(ae):tt.add(ae),tt})},he=async()=>{if(!(!d.trim()||m.size===0)){w(!0);try{const ge=await(await Ce("/api/git/commit",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({project:e.name,message:d,files:Array.from(m)})})).json();ge.success?(u(""),g(new Set),Y(),ve()):console.error("Commit failed:",ge.error)}catch(ae){console.error("Error committing changes:",ae)}finally{w(!1)}}},zt=async()=>{xe(!0);try{const ge=await(await Ce("/api/git/initial-commit",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({project:e.name})})).json();ge.success?(Y(),ve()):(console.error("Initial commit failed:",ge.error),alert(ge.error||"Failed to create initial commit"))}catch(ae){console.error("Error creating initial commit:",ae),alert("Failed to create initial commit")}finally{xe(!1)}},nr=ae=>{switch(ae){case"M":return"Modified";case"A":return"Added";case"D":return"Deleted";case"U":return"Untracked";default:return ae}},_n=ae=>{const ge=F.has(ae.hash),tt=_[ae.hash];return a.jsxs("div",{className:"border-b border-gray-200 dark:border-gray-700 last:border-0",children:[a.jsxs("div",{className:"flex items-start p-3 hover:bg-gray-50 dark:hover:bg-gray-800 cursor-pointer",onClick:()=>Ge(ae.hash),children:[a.jsx("div",{className:"mr-2 mt-1 p-0.5 hover:bg-gray-200 dark:hover:bg-gray-700 rounded",children:ge?a.jsx(tn,{className:"w-3 h-3"}):a.jsx(Cn,{className:"w-3 h-3"})}),a.jsx("div",{className:"flex-1 min-w-0",children:a.jsxs("div",{className:"flex items-start justify-between gap-2",children:[a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsx("p",{className:"text-sm font-medium text-gray-900 dark:text-white truncate",children:ae.message}),a.jsxs("p",{className:"text-xs text-gray-500 dark:text-gray-400 mt-1",children:[ae.author," • ",ae.date]})]}),a.jsx("span",{className:"text-xs font-mono text-gray-400 dark:text-gray-500 flex-shrink-0",children:ae.hash.substring(0,7)})]})})]}),ge&&tt&&a.jsx("div",{className:"bg-gray-50 dark:bg-gray-900",children:a.jsxs("div",{className:"max-h-96 overflow-y-auto p-2",children:[a.jsx("div",{className:"text-xs font-mono text-gray-600 dark:text-gray-400 mb-2",children:ae.stats}),a.jsx(Y2,{diff:tt,fileName:"commit",isMobile:t,wrapText:C})]})})]},ae.hash)},xr=(ae,ge)=>{const tt=p.has(ae),bt=m.has(ae),hr=s[ae];return a.jsxs("div",{className:"border-b border-gray-200 dark:border-gray-700 last:border-0",children:[a.jsxs("div",{className:`flex items-center hover:bg-gray-50 dark:hover:bg-gray-800 ${t?"px-2 py-1.5":"px-3 py-2"}`,children:[a.jsx("input",{type:"checkbox",checked:bt,onChange:()=>dt(ae),onClick:ar=>ar.stopPropagation(),className:`rounded border-gray-300 dark:border-gray-600 text-blue-600 dark:text-blue-500 focus:ring-blue-500 dark:focus:ring-blue-400 dark:bg-gray-800 dark:checked:bg-blue-600 ${t?"mr-1.5":"mr-2"}`}),a.jsxs("div",{className:"flex items-center flex-1",children:[a.jsx("div",{className:`p-0.5 hover:bg-gray-200 dark:hover:bg-gray-700 rounded cursor-pointer ${t?"mr-1":"mr-2"}`,onClick:ar=>{ar.stopPropagation(),Ke(ae)},children:a.jsx(Cn,{className:`w-3 h-3 transition-transform duration-200 ease-in-out ${tt?"rotate-90":"rotate-0"}`})}),a.jsx("span",{className:`flex-1 truncate ${t?"text-xs":"text-sm"} cursor-pointer hover:text-blue-600 dark:hover:text-blue-400 hover:underline`,onClick:ar=>{ar.stopPropagation(),st(ae)},title:"Click to open file",children:ae}),a.jsxs("div",{className:"flex items-center gap-1",children:[(ge==="M"||ge==="D")&&a.jsxs("button",{onClick:ar=>{ar.stopPropagation(),mt({type:"discard",file:ae,message:`Discard all changes to "${ae}"? This action cannot be undone.`})},className:`${t?"px-2 py-1 text-xs":"p-1"} hover:bg-red-100 dark:hover:bg-red-900 rounded text-red-600 dark:text-red-400 font-medium flex items-center gap-1`,title:"Discard changes",children:[a.jsx(Nr,{className:"w-3 h-3"}),t&&a.jsx("span",{children:"Discard"})]}),ge==="U"&&a.jsxs("button",{onClick:ar=>{ar.stopPropagation(),mt({type:"delete",file:ae,message:`Delete untracked file "${ae}"? This action cannot be undone.`})},className:`${t?"px-2 py-1 text-xs":"p-1"} hover:bg-red-100 dark:hover:bg-red-900 rounded text-red-600 dark:text-red-400 font-medium flex items-center gap-1`,title:"Delete untracked file",children:[a.jsx(Nr,{className:"w-3 h-3"}),t&&a.jsx("span",{children:"Delete"})]}),a.jsx("span",{className:`inline-flex items-center justify-center w-5 h-5 rounded text-xs font-bold border ${ge==="M"?"bg-yellow-100 text-yellow-700 dark:bg-yellow-900 dark:text-yellow-300 border-yellow-200 dark:border-yellow-800":ge==="A"?"bg-green-100 text-green-700 dark:bg-green-900 dark:text-green-300 border-green-200 dark:border-green-800":ge==="D"?"bg-red-100 text-red-700 dark:bg-red-900 dark:text-red-300 border-red-200 dark:border-red-800":"bg-gray-100 text-gray-700 dark:bg-gray-800 dark:text-gray-300 border-gray-300 dark:border-gray-600"}`,title:nr(ge),children:ge})]})]})]}),a.jsxs("div",{className:`bg-gray-50 dark:bg-gray-900 transition-all duration-400 ease-in-out overflow-hidden ${tt&&hr?"max-h-[600px] opacity-100 translate-y-0":"max-h-0 opacity-0 -translate-y-1"}`,children:[a.jsxs("div",{className:"flex items-center justify-between p-2 border-b border-gray-200 dark:border-gray-700",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("span",{className:`inline-flex items-center justify-center w-5 h-5 rounded text-xs font-bold border ${ge==="M"?"bg-yellow-100 text-yellow-700 dark:bg-yellow-900 dark:text-yellow-300 border-yellow-200 dark:border-yellow-800":ge==="A"?"bg-green-100 text-green-700 dark:bg-green-900 dark:text-green-300 border-green-200 dark:border-green-800":ge==="D"?"bg-red-100 text-red-700 dark:bg-red-900 dark:text-red-300 border-red-200 dark:border-red-800":"bg-gray-100 text-gray-700 dark:bg-gray-800 dark:text-gray-300 border-gray-300 dark:border-gray-600"}`,children:ge}),a.jsx("span",{className:"text-sm font-medium text-gray-900 dark:text-white",children:nr(ge)})]}),t&&a.jsx("button",{onClick:ar=>{ar.stopPropagation(),v(!C)},className:"text-xs text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-white",title:C?"Switch to horizontal scroll":"Switch to text wrap",children:C?"↔️ Scroll":"↩️ Wrap"})]}),a.jsx("div",{className:"max-h-96 overflow-y-auto",children:hr&&a.jsx(Y2,{diff:hr,fileName:ae,isMobile:t,wrapText:C})})]})]},ae)};return e?a.jsxs("div",{className:"h-full flex flex-col bg-background",children:[a.jsxs("div",{className:`flex items-center justify-between border-b border-gray-200 dark:border-gray-700 ${t?"px-3 py-2":"px-4 py-3"}`,children:[a.jsxs("div",{className:"relative",ref:ce,children:[a.jsxs("button",{onClick:()=>T(!j),className:`flex items-center hover:bg-gray-100 dark:hover:bg-gray-800 rounded-md transition-colors ${t?"space-x-1 px-2 py-1":"space-x-2 px-3 py-1.5"}`,children:[a.jsx(qn,{className:`text-gray-600 dark:text-gray-400 ${t?"w-3 h-3":"w-4 h-4"}`}),a.jsxs("div",{className:"flex items-center gap-1",children:[a.jsx("span",{className:`font-medium ${t?"text-xs":"text-sm"}`,children:S}),se?.hasRemote&&a.jsxs("div",{className:"flex items-center gap-1 text-xs",children:[se.ahead>0&&a.jsxs("span",{className:"text-green-600 dark:text-green-400",title:`${se.ahead} commit${se.ahead!==1?"s":""} ahead`,children:["↑",se.ahead]}),se.behind>0&&a.jsxs("span",{className:"text-blue-600 dark:text-blue-400",title:`${se.behind} commit${se.behind!==1?"s":""} behind`,children:["↓",se.behind]}),se.isUpToDate&&a.jsx("span",{className:"text-gray-500 dark:text-gray-400",title:"Up to date with remote",children:"✓"})]})]}),a.jsx(tn,{className:`w-3 h-3 text-gray-500 transition-transform ${j?"rotate-180":""}`})]}),j&&a.jsxs("div",{className:"absolute top-full left-0 mt-1 w-64 bg-white dark:bg-gray-800 rounded-lg shadow-lg border border-gray-200 dark:border-gray-700 z-50",children:[a.jsx("div",{className:"py-1 max-h-64 overflow-y-auto",children:E.map(ae=>a.jsx("button",{onClick:()=>Ve(ae),className:`w-full text-left px-4 py-2 text-sm hover:bg-gray-100 dark:hover:bg-gray-700 ${ae===S?"bg-gray-50 dark:bg-gray-700 text-gray-900 dark:text-gray-100":"text-gray-700 dark:text-gray-300"}`,children:a.jsxs("div",{className:"flex items-center space-x-2",children:[ae===S&&a.jsx(Cr,{className:"w-3 h-3 text-green-600 dark:text-green-400"}),a.jsx("span",{className:ae===S?"font-medium":"",children:ae})]})},ae))}),a.jsx("div",{className:"border-t border-gray-200 dark:border-gray-700 py-1",children:a.jsxs("button",{onClick:()=>{q(!0),T(!1)},className:"w-full text-left px-4 py-2 text-sm hover:bg-gray-100 dark:hover:bg-gray-700 flex items-center space-x-2",children:[a.jsx(gr,{className:"w-3 h-3"}),a.jsx("span",{children:"Create new branch"})]})})]})]}),a.jsxs("div",{className:`flex items-center ${t?"gap-1":"gap-2"}`,children:[se?.hasRemote&&a.jsxs(a.Fragment,{children:[!se?.hasUpstream&&a.jsxs("button",{onClick:()=>mt({type:"publish",message:`Publish branch "${S}" to ${se.remoteName}?`}),disabled:Ye,className:"px-2 py-1 text-xs bg-purple-600 text-white rounded hover:bg-purple-700 disabled:opacity-50 flex items-center gap-1",title:`Publish branch "${S}" to ${se.remoteName}`,children:[a.jsx(ws,{className:`w-3 h-3 ${Ye?"animate-pulse":""}`}),a.jsx("span",{children:Ye?"Publishing...":"Publish"})]}),se?.hasUpstream&&!se?.isUpToDate&&a.jsxs(a.Fragment,{children:[se.behind>0&&a.jsxs("button",{onClick:()=>mt({type:"pull",message:`Pull ${se.behind} commit${se.behind!==1?"s":""} from ${se.remoteName}?`}),disabled:Ie,className:"px-2 py-1 text-xs bg-green-600 text-white rounded hover:bg-green-700 disabled:opacity-50 flex items-center gap-1",title:`Pull ${se.behind} commit${se.behind!==1?"s":""} from ${se.remoteName}`,children:[a.jsx(Qs,{className:`w-3 h-3 ${Ie?"animate-pulse":""}`}),a.jsx("span",{children:Ie?"Pulling...":`Pull ${se.behind}`})]}),se.ahead>0&&a.jsxs("button",{onClick:()=>mt({type:"push",message:`Push ${se.ahead} commit${se.ahead!==1?"s":""} to ${se.remoteName}?`}),disabled:ze,className:"px-2 py-1 text-xs bg-orange-600 text-white rounded hover:bg-orange-700 disabled:opacity-50 flex items-center gap-1",title:`Push ${se.ahead} commit${se.ahead!==1?"s":""} to ${se.remoteName}`,children:[a.jsx(ws,{className:`w-3 h-3 ${ze?"animate-pulse":""}`}),a.jsx("span",{children:ze?"Pushing...":`Push ${se.ahead}`})]}),(se.ahead>0||se.behind>0&&se.ahead>0)&&a.jsxs("button",{onClick:ft,disabled:oe,className:"px-2 py-1 text-xs bg-blue-600 text-white rounded hover:bg-blue-700 disabled:opacity-50 flex items-center gap-1",title:`Fetch from ${se.remoteName}`,children:[a.jsx(Un,{className:`w-3 h-3 ${oe?"animate-spin":""}`}),a.jsx("span",{children:oe?"Fetching...":"Fetch"})]})]})]}),a.jsx("button",{onClick:()=>{Y(),le(),ve()},disabled:l,className:`hover:bg-gray-100 dark:hover:bg-gray-800 rounded ${t?"p-1":"p-1.5"}`,children:a.jsx(Un,{className:`${l?"animate-spin":""} ${t?"w-3 h-3":"w-4 h-4"}`})})]})]}),n?.error?a.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center text-gray-500 dark:text-gray-400 px-6 py-12",children:[a.jsx(qn,{className:"w-20 h-20 mb-6 opacity-30"}),a.jsx("h3",{className:"text-xl font-medium mb-3 text-center",children:n.error}),n.details&&a.jsx("p",{className:"text-sm text-center leading-relaxed mb-6 max-w-md",children:n.details}),a.jsx("div",{className:"p-4 bg-blue-50 dark:bg-blue-900/20 rounded-lg border border-blue-200 dark:border-blue-800 max-w-md",children:a.jsxs("p",{className:"text-sm text-blue-700 dark:text-blue-300 text-center",children:[a.jsx("strong",{children:"Tip:"})," Run ",a.jsx("code",{className:"bg-blue-100 dark:bg-blue-900 px-2 py-1 rounded font-mono text-xs",children:"git init"})," in your project directory to initialize git source control."]})})]}):a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:`flex border-b border-gray-200 dark:border-gray-700 transition-all duration-300 ease-in-out ${p.size===0?"max-h-16 opacity-100 translate-y-0":"max-h-0 opacity-0 -translate-y-2 overflow-hidden"}`,children:[a.jsx("button",{onClick:()=>K("changes"),className:`flex-1 px-4 py-2 text-sm font-medium transition-colors ${re==="changes"?"text-blue-600 dark:text-blue-400 border-b-2 border-blue-600 dark:border-blue-400":"text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-white"}`,children:a.jsxs("div",{className:"flex items-center justify-center gap-2",children:[a.jsx(Fr,{className:"w-4 h-4"}),a.jsx("span",{children:"Changes"})]})}),a.jsx("button",{onClick:()=>K("history"),className:`flex-1 px-4 py-2 text-sm font-medium transition-colors ${re==="history"?"text-blue-600 dark:text-blue-400 border-b-2 border-blue-600 dark:border-blue-400":"text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-white"}`,children:a.jsxs("div",{className:"flex items-center justify-center gap-2",children:[a.jsx(cf,{className:"w-4 h-4"}),a.jsx("span",{children:"History"})]})})]}),re==="changes"&&a.jsx(a.Fragment,{children:a.jsx("div",{className:`transition-all duration-300 ease-in-out ${p.size===0?"max-h-96 opacity-100 translate-y-0":"max-h-0 opacity-0 -translate-y-2 overflow-hidden"}`,children:t&>?a.jsx("div",{className:"px-4 py-2 border-b border-gray-200 dark:border-gray-700",children:a.jsxs("button",{onClick:()=>et(!1),className:"w-full flex items-center justify-center gap-2 px-3 py-2 text-sm bg-blue-600 text-white rounded-md hover:bg-blue-700",children:[a.jsx(Zo,{className:"w-4 h-4"}),a.jsxs("span",{children:["Commit ",m.size," file",m.size!==1?"s":""]}),a.jsx(tn,{className:"w-3 h-3"})]})}):a.jsx(a.Fragment,{children:a.jsxs("div",{className:"px-4 py-3 border-b border-gray-200 dark:border-gray-700",children:[t&&a.jsxs("div",{className:"flex items-center justify-between mb-2",children:[a.jsx("span",{className:"text-sm font-medium",children:"Commit Changes"}),a.jsx("button",{onClick:()=>et(!0),className:"p-1 hover:bg-gray-100 dark:hover:bg-gray-800 rounded",children:a.jsx(tn,{className:"w-4 h-4 rotate-180"})})]}),a.jsxs("div",{className:"relative",children:[a.jsx("textarea",{ref:at,value:d,onChange:ae=>u(ae.target.value),placeholder:"Message (Ctrl+Enter to commit)",className:"w-full px-3 py-2 text-sm border border-gray-300 dark:border-gray-600 rounded-md bg-white dark:bg-gray-800 resize-none pr-20",rows:"3",onKeyDown:ae=>{ae.key==="Enter"&&(ae.ctrlKey||ae.metaKey)&&he()}}),a.jsxs("div",{className:"absolute right-2 top-2 flex gap-1",children:[a.jsx("button",{onClick:Fe,disabled:m.size===0||me,className:"p-1.5 text-gray-500 hover:text-gray-700 dark:text-gray-400 dark:hover:text-gray-200 disabled:opacity-50 disabled:cursor-not-allowed",title:"Generate commit message",children:me?a.jsx(Un,{className:"w-4 h-4 animate-spin"}):a.jsx(Gn,{className:"w-4 h-4"})}),a.jsx("div",{style:{display:"none"},children:a.jsx(RN,{onTranscript:ae=>u(ae),mode:"default",className:"p-1.5"})})]})]}),a.jsxs("div",{className:"flex items-center justify-between mt-2",children:[a.jsxs("span",{className:"text-xs text-gray-500",children:[m.size," file",m.size!==1?"s":""," selected"]}),a.jsxs("button",{onClick:()=>mt({type:"commit",message:`Commit ${m.size} file${m.size!==1?"s":""} with message: "${d.trim()}"?`}),disabled:!d.trim()||m.size===0||f,className:"px-3 py-1 text-sm bg-blue-600 text-white rounded-md hover:bg-blue-700 disabled:opacity-50 disabled:cursor-not-allowed flex items-center space-x-1",children:[a.jsx(Cr,{className:"w-3 h-3"}),a.jsx("span",{children:f?"Committing...":"Commit"})]})]})]})})})}),re==="changes"&&n&&!n.error&&a.jsxs("div",{className:`border-b border-gray-200 dark:border-gray-700 flex items-center justify-between transition-all duration-300 ease-in-out ${t?"px-3 py-1.5":"px-4 py-2"} ${p.size===0?"max-h-16 opacity-100 translate-y-0":"max-h-0 opacity-0 -translate-y-2 overflow-hidden"}`,children:[a.jsxs("span",{className:"text-gray-600 dark:text-gray-400 text-xs",children:[m.size," of ",(n?.modified?.length||0)+(n?.added?.length||0)+(n?.deleted?.length||0)+(n?.untracked?.length||0)," ",t?"":"files"," selected"]}),a.jsxs("div",{className:`flex ${t?"gap-1":"gap-2"}`,children:[a.jsx("button",{onClick:()=>{const ae=new Set([...n?.modified||[],...n?.added||[],...n?.deleted||[],...n?.untracked||[]]);g(ae)},className:"text-blue-600 dark:text-blue-400 hover:text-blue-700 dark:hover:text-blue-300 text-xs",children:t?"All":"Select All"}),a.jsx("span",{className:"text-gray-300 dark:text-gray-600",children:"|"}),a.jsx("button",{onClick:()=>g(new Set),className:"text-blue-600 dark:text-blue-400 hover:text-blue-700 dark:hover:text-blue-300 text-xs",children:t?"None":"Deselect All"})]})]}),!n?.error&&!t&&a.jsxs("div",{className:"border-b border-gray-200 dark:border-gray-700",children:[a.jsxs("button",{onClick:()=>M(!I),className:"w-full px-4 py-2 bg-gray-50 dark:bg-gray-800 hover:bg-gray-100 dark:hover:bg-gray-750 text-xs text-gray-600 dark:text-gray-400 flex items-center justify-center gap-1",children:[a.jsx(h6,{className:"w-3 h-3"}),a.jsx("span",{children:"File Status Guide"}),I?a.jsx(tn,{className:"w-3 h-3"}):a.jsx(Cn,{className:"w-3 h-3"})]}),I&&a.jsx("div",{className:"px-4 py-3 bg-gray-50 dark:bg-gray-800 text-xs",children:a.jsxs("div",{className:`${t?"grid grid-cols-2 gap-3 justify-items-center":"flex justify-center gap-6"}`,children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("span",{className:"inline-flex items-center justify-center w-5 h-5 bg-yellow-100 text-yellow-700 dark:bg-yellow-900 dark:text-yellow-300 rounded border border-yellow-200 dark:border-yellow-800 font-bold text-xs",children:"M"}),a.jsx("span",{className:"text-gray-600 dark:text-gray-400 italic",children:"Modified"})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("span",{className:"inline-flex items-center justify-center w-5 h-5 bg-green-100 text-green-700 dark:bg-green-900 dark:text-green-300 rounded border border-green-200 dark:border-green-800 font-bold text-xs",children:"A"}),a.jsx("span",{className:"text-gray-600 dark:text-gray-400 italic",children:"Added"})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("span",{className:"inline-flex items-center justify-center w-5 h-5 bg-red-100 text-red-700 dark:bg-red-900 dark:text-red-300 rounded border border-red-200 dark:border-red-800 font-bold text-xs",children:"D"}),a.jsx("span",{className:"text-gray-600 dark:text-gray-400 italic",children:"Deleted"})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("span",{className:"inline-flex items-center justify-center w-5 h-5 bg-gray-100 text-gray-700 dark:bg-gray-800 dark:text-gray-300 rounded border border-gray-300 dark:border-gray-600 font-bold text-xs",children:"U"}),a.jsx("span",{className:"text-gray-600 dark:text-gray-400 italic",children:"Untracked"})]})]})})]})]}),re==="changes"&&!n?.error&&a.jsx("div",{className:`flex-1 overflow-y-auto ${t?"pb-mobile-nav":""}`,children:l?a.jsx("div",{className:"flex items-center justify-center h-32",children:a.jsx(Un,{className:"w-6 h-6 animate-spin text-gray-400"})}):n?.hasCommits===!1?a.jsxs("div",{className:"flex flex-col items-center justify-center p-8 text-center",children:[a.jsx(qn,{className:"w-16 h-16 mb-4 opacity-30 text-gray-400 dark:text-gray-500"}),a.jsx("h3",{className:"text-lg font-medium mb-2 text-gray-900 dark:text-white",children:"No commits yet"}),a.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400 mb-6 max-w-md",children:"This repository doesn't have any commits yet. Create your first commit to start tracking changes."}),a.jsx("button",{onClick:zt,disabled:Pt,className:"px-4 py-2 bg-blue-600 text-white rounded-md hover:bg-blue-700 disabled:opacity-50 disabled:cursor-not-allowed flex items-center gap-2",children:Pt?a.jsxs(a.Fragment,{children:[a.jsx(Un,{className:"w-4 h-4 animate-spin"}),a.jsx("span",{children:"Creating Initial Commit..."})]}):a.jsxs(a.Fragment,{children:[a.jsx(Zo,{className:"w-4 h-4"}),a.jsx("span",{children:"Create Initial Commit"})]})})]}):!n||!n.modified?.length&&!n.added?.length&&!n.deleted?.length&&!n.untracked?.length?a.jsxs("div",{className:"flex flex-col items-center justify-center h-32 text-gray-500 dark:text-gray-400",children:[a.jsx(Zo,{className:"w-12 h-12 mb-2 opacity-50"}),a.jsx("p",{className:"text-sm",children:"No changes detected"})]}):a.jsxs("div",{className:t?"pb-4":"",children:[n.modified?.map(ae=>xr(ae,"M")),n.added?.map(ae=>xr(ae,"A")),n.deleted?.map(ae=>xr(ae,"D")),n.untracked?.map(ae=>xr(ae,"U"))]})}),re==="history"&&!n?.error&&a.jsx("div",{className:`flex-1 overflow-y-auto ${t?"pb-mobile-nav":""}`,children:l?a.jsx("div",{className:"flex items-center justify-center h-32",children:a.jsx(Un,{className:"w-6 h-6 animate-spin text-gray-400"})}):ue.length===0?a.jsxs("div",{className:"flex flex-col items-center justify-center h-32 text-gray-500 dark:text-gray-400",children:[a.jsx(cf,{className:"w-12 h-12 mb-2 opacity-50"}),a.jsx("p",{className:"text-sm",children:"No commits found"})]}):a.jsx("div",{className:t?"pb-4":"",children:ue.map(ae=>_n(ae))})}),P&&a.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-4",children:[a.jsx("div",{className:"fixed inset-0 bg-black bg-opacity-50",onClick:()=>q(!1)}),a.jsx("div",{className:"relative bg-white dark:bg-gray-800 rounded-lg shadow-xl max-w-md w-full",children:a.jsxs("div",{className:"p-6",children:[a.jsx("h3",{className:"text-lg font-semibold mb-4",children:"Create New Branch"}),a.jsxs("div",{className:"mb-4",children:[a.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:"Branch Name"}),a.jsx("input",{type:"text",value:D,onChange:ae=>z(ae.target.value),onKeyDown:ae=>{ae.key==="Enter"&&!U&&It()},placeholder:"feature/new-feature",className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md bg-white dark:bg-gray-700 focus:outline-none focus:ring-2 focus:ring-blue-500",autoFocus:!0})]}),a.jsxs("div",{className:"text-xs text-gray-500 dark:text-gray-400 mb-4",children:["This will create a new branch from the current branch (",S,")"]}),a.jsxs("div",{className:"flex justify-end space-x-3",children:[a.jsx("button",{onClick:()=>{q(!1),z("")},className:"px-4 py-2 text-sm text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700 rounded-md",children:"Cancel"}),a.jsx("button",{onClick:It,disabled:!D.trim()||U,className:"px-4 py-2 text-sm bg-blue-600 text-white rounded-md hover:bg-blue-700 disabled:opacity-50 disabled:cursor-not-allowed flex items-center space-x-2",children:U?a.jsxs(a.Fragment,{children:[a.jsx(Un,{className:"w-3 h-3 animate-spin"}),a.jsx("span",{children:"Creating..."})]}):a.jsxs(a.Fragment,{children:[a.jsx(gr,{className:"w-3 h-3"}),a.jsx("span",{children:"Create Branch"})]})})]})]})})]}),Me&&a.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-4",children:[a.jsx("div",{className:"fixed inset-0 bg-black bg-opacity-50",onClick:()=>mt(null)}),a.jsx("div",{className:"relative bg-white dark:bg-gray-800 rounded-lg shadow-xl max-w-md w-full",children:a.jsxs("div",{className:"p-6",children:[a.jsxs("div",{className:"flex items-center mb-4",children:[a.jsx("div",{className:`p-2 rounded-full mr-3 ${Me.type==="discard"||Me.type==="delete"?"bg-red-100 dark:bg-red-900":"bg-yellow-100 dark:bg-yellow-900"}`,children:a.jsx(Vn,{className:`w-5 h-5 ${Me.type==="discard"||Me.type==="delete"?"text-red-600 dark:text-red-400":"text-yellow-600 dark:text-yellow-400"}`})}),a.jsx("h3",{className:"text-lg font-semibold",children:Me.type==="discard"?"Discard Changes":Me.type==="delete"?"Delete File":Me.type==="commit"?"Confirm Commit":Me.type==="pull"?"Confirm Pull":Me.type==="publish"?"Publish Branch":"Confirm Push"})]}),a.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400 mb-6",children:Me.message}),a.jsxs("div",{className:"flex justify-end space-x-3",children:[a.jsx("button",{onClick:()=>mt(null),className:"px-4 py-2 text-sm text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700 rounded-md",children:"Cancel"}),a.jsx("button",{onClick:Pe,className:`px-4 py-2 text-sm text-white rounded-md ${Me.type==="discard"||Me.type==="delete"?"bg-red-600 hover:bg-red-700":Me.type==="commit"?"bg-blue-600 hover:bg-blue-700":Me.type==="pull"?"bg-green-600 hover:bg-green-700":Me.type==="publish"?"bg-purple-600 hover:bg-purple-700":"bg-orange-600 hover:bg-orange-700"} flex items-center space-x-2`,children:Me.type==="discard"?a.jsxs(a.Fragment,{children:[a.jsx(Nr,{className:"w-4 h-4"}),a.jsx("span",{children:"Discard"})]}):Me.type==="delete"?a.jsxs(a.Fragment,{children:[a.jsx(Nr,{className:"w-4 h-4"}),a.jsx("span",{children:"Delete"})]}):Me.type==="commit"?a.jsxs(a.Fragment,{children:[a.jsx(Cr,{className:"w-4 h-4"}),a.jsx("span",{children:"Commit"})]}):Me.type==="pull"?a.jsxs(a.Fragment,{children:[a.jsx(Qs,{className:"w-4 h-4"}),a.jsx("span",{children:"Pull"})]}):Me.type==="publish"?a.jsxs(a.Fragment,{children:[a.jsx(ws,{className:"w-4 h-4"}),a.jsx("span",{children:"Publish"})]}):a.jsxs(a.Fragment,{children:[a.jsx(ws,{className:"w-4 h-4"}),a.jsx("span",{children:"Push"})]})})]})]})})]})]}):a.jsx("div",{className:"h-full flex items-center justify-center text-gray-500 dark:text-gray-400",children:a.jsx("p",{children:"Select a project to view source control"})})}class AG extends ir.Component{constructor(t){super(t),this.state={hasError:!1,error:null,errorInfo:null}}static getDerivedStateFromError(t){return{hasError:!0}}componentDidCatch(t,r){console.error("ErrorBoundary caught an error:",t,r),this.setState({error:t,errorInfo:r})}render(){return this.state.hasError?a.jsx("div",{className:"flex flex-col items-center justify-center p-8 text-center",children:a.jsxs("div",{className:"bg-red-50 border border-red-200 rounded-lg p-6 max-w-md",children:[a.jsxs("div",{className:"flex items-center mb-4",children:[a.jsx("div",{className:"flex-shrink-0",children:a.jsx("svg",{className:"h-5 w-5 text-red-400",viewBox:"0 0 20 20",fill:"currentColor",children:a.jsx("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zM8.707 7.293a1 1 0 00-1.414 1.414L8.586 10l-1.293 1.293a1 1 0 101.414 1.414L10 11.414l1.293 1.293a1 1 0 001.414-1.414L11.414 10l1.293-1.293a1 1 0 00-1.414-1.414L10 8.586 8.707 7.293z",clipRule:"evenodd"})})}),a.jsx("h3",{className:"ml-3 text-sm font-medium text-red-800",children:"Something went wrong"})]}),a.jsxs("div",{className:"text-sm text-red-700",children:[a.jsx("p",{className:"mb-2",children:"An error occurred while loading the chat interface."}),this.props.showDetails&&this.state.error&&a.jsxs("details",{className:"mt-4",children:[a.jsx("summary",{className:"cursor-pointer text-xs font-mono",children:"Error Details"}),a.jsxs("pre",{className:"mt-2 text-xs bg-red-100 p-2 rounded overflow-auto max-h-40",children:[this.state.error.toString(),this.state.errorInfo&&this.state.errorInfo.componentStack]})]})]}),a.jsx("div",{className:"mt-4",children:a.jsx("button",{onClick:()=>{this.setState({hasError:!1,error:null,errorInfo:null}),this.props.onRetry&&this.props.onRetry()},className:"bg-red-600 text-white px-4 py-2 rounded text-sm hover:bg-red-700 focus:outline-none focus:ring-2 focus:ring-red-500",children:"Try Again"})})]})}):this.props.children}}const Pr=({children:e,content:t,position:r="top",className:n="",delay:i=500})=>{const[s,o]=x.useState(!1),[l,c]=x.useState(null),d=()=>{const m=setTimeout(()=>{o(!0)},i);c(m)},u=()=>{l&&(clearTimeout(l),c(null)),o(!1)},p=()=>{switch(r){case"top":return"bottom-full left-1/2 transform -translate-x-1/2 mb-2";case"bottom":return"top-full left-1/2 transform -translate-x-1/2 mt-2";case"left":return"right-full top-1/2 transform -translate-y-1/2 mr-2";case"right":return"left-full top-1/2 transform -translate-y-1/2 ml-2";default:return"bottom-full left-1/2 transform -translate-x-1/2 mb-2"}},h=()=>{switch(r){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"}};return t?a.jsxs("div",{className:"relative inline-block",onMouseEnter:d,onMouseLeave:u,children:[e,s&&a.jsxs("div",{className:Ze("absolute z-50 px-2 py-1 text-xs font-medium text-white bg-gray-900 dark:bg-gray-100 dark:text-gray-900 rounded shadow-lg whitespace-nowrap pointer-events-none","animate-in fade-in-0 zoom-in-95 duration-200",p(),n),children:[t,a.jsx("div",{className:Ze("absolute w-0 h-0 border-4 border-transparent",h())})]})]}):e},X2=({task:e,onClick:t,showParent:r=!1,className:n=""})=>{const s=(l=>{switch(l){case"done":return{icon:ns,bgColor:"bg-green-50 dark:bg-green-950",borderColor:"border-green-200 dark:border-green-800",iconColor:"text-green-600 dark:text-green-400",textColor:"text-green-900 dark:text-green-100",statusText:"Done"};case"in-progress":return{icon:Hi,bgColor:"bg-blue-50 dark:bg-blue-950",borderColor:"border-blue-200 dark:border-blue-800",iconColor:"text-blue-600 dark:text-blue-400",textColor:"text-blue-900 dark:text-blue-100",statusText:"In Progress"};case"review":return{icon:So,bgColor:"bg-amber-50 dark:bg-amber-950",borderColor:"border-amber-200 dark:border-amber-800",iconColor:"text-amber-600 dark:text-amber-400",textColor:"text-amber-900 dark:text-amber-100",statusText:"Review"};case"deferred":return{icon:b4,bgColor:"bg-gray-50 dark:bg-gray-800",borderColor:"border-gray-200 dark:border-gray-700",iconColor:"text-gray-500 dark:text-gray-400",textColor:"text-gray-700 dark:text-gray-300",statusText:"Deferred"};case"cancelled":return{icon:Bt,bgColor:"bg-red-50 dark:bg-red-950",borderColor:"border-red-200 dark:border-red-800",iconColor:"text-red-600 dark:text-red-400",textColor:"text-red-900 dark:text-red-100",statusText:"Cancelled"};case"pending":default:return{icon:ti,bgColor:"bg-slate-50 dark:bg-slate-800",borderColor:"border-slate-200 dark:border-slate-700",iconColor:"text-slate-500 dark:text-slate-400",textColor:"text-slate-900 dark:text-slate-100",statusText:"Pending"}}})(e.status);s.icon;const o=l=>{switch(l){case"high":return a.jsx(Pr,{content:"High Priority",children:a.jsx("div",{className:"w-4 h-4 bg-red-100 dark:bg-red-900/30 rounded flex items-center justify-center",children:a.jsx(j5,{className:"w-2.5 h-2.5 text-red-600 dark:text-red-400"})})});case"medium":return a.jsx(Pr,{content:"Medium Priority",children:a.jsx("div",{className:"w-4 h-4 bg-amber-100 dark:bg-amber-900/30 rounded flex items-center justify-center",children:a.jsx(T6,{className:"w-2.5 h-2.5 text-amber-600 dark:text-amber-400"})})});case"low":return a.jsx(Pr,{content:"Low Priority",children:a.jsx("div",{className:"w-4 h-4 bg-blue-100 dark:bg-blue-900/30 rounded flex items-center justify-center",children:a.jsx(ti,{className:"w-1.5 h-1.5 text-blue-600 dark:text-blue-400 fill-current"})})});default:return a.jsx(Pr,{content:"No Priority Set",children:a.jsx("div",{className:"w-4 h-4 bg-gray-100 dark:bg-gray-800 rounded flex items-center justify-center",children:a.jsx(ti,{className:"w-1.5 h-1.5 text-gray-400 dark:text-gray-500"})})})}};return a.jsxs("div",{className:Ze("bg-white dark:bg-gray-800 rounded-lg border border-gray-200 dark:border-gray-700","hover:shadow-md hover:border-blue-300 dark:hover:border-blue-600 transition-all duration-200 cursor-pointer","p-3 space-y-3",t&&"hover:-translate-y-0.5",n),onClick:t,children:[a.jsxs("div",{className:"flex items-start justify-between gap-2 mb-2",children:[a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsx("div",{className:"flex items-center gap-2 mb-1",children:a.jsx(Pr,{content:`Task ID: ${e.id}`,children:a.jsx("span",{className:"text-xs font-mono text-gray-500 dark:text-gray-400 bg-gray-100 dark:bg-gray-700 px-2 py-0.5 rounded",children:e.id})})}),a.jsx("h3",{className:"font-medium text-sm text-gray-900 dark:text-white line-clamp-2 leading-tight",children:e.title}),r&&e.parentId&&a.jsxs("span",{className:"text-xs text-gray-500 dark:text-gray-400 font-medium",children:["Task ",e.parentId]})]}),a.jsx("div",{className:"flex-shrink-0",children:o(e.priority)})]}),a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx("div",{className:"flex items-center",children:e.dependencies&&Array.isArray(e.dependencies)&&e.dependencies.length>0&&a.jsx(Pr,{content:`Depends on: ${e.dependencies.map(l=>`Task ${l}`).join(", ")}`,children:a.jsxs("div",{className:"flex items-center gap-1 text-xs text-amber-600 dark:text-amber-400",children:[a.jsx(Dh,{className:"w-3 h-3"}),a.jsxs("span",{children:["Depends on: ",e.dependencies.join(", ")]})]})})}),a.jsx(Pr,{content:`Status: ${s.statusText}`,children:a.jsxs("div",{className:"flex items-center gap-1",children:[a.jsx("div",{className:Ze("w-2 h-2 rounded-full",s.iconColor.replace("text-","bg-"))}),a.jsx("span",{className:Ze("text-xs font-medium",s.textColor),children:s.statusText})]})})]}),e.subtasks&&e.subtasks.length>0&&a.jsx("div",{className:"ml-3",children:a.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[a.jsx("span",{className:"text-xs text-gray-500 dark:text-gray-400",children:"Progress:"}),a.jsx(Pr,{content:`${e.subtasks.filter(l=>l.status==="done").length} of ${e.subtasks.length} subtasks completed`,children:a.jsx("div",{className:"flex-1 bg-gray-200 dark:bg-gray-700 rounded-full h-1.5",children:a.jsx("div",{className:Ze("h-full rounded-full transition-all duration-300",e.status==="done"?"bg-green-500":"bg-blue-500"),style:{width:`${Math.round(e.subtasks.filter(l=>l.status==="done").length/e.subtasks.length*100)}%`}})})}),a.jsx(Pr,{content:`${e.subtasks.filter(l=>l.status==="done").length} completed, ${e.subtasks.filter(l=>l.status==="pending").length} pending, ${e.subtasks.filter(l=>l.status==="in-progress").length} in progress`,children:a.jsxs("span",{className:"text-xs text-gray-500 dark:text-gray-400",children:[e.subtasks.filter(l=>l.status==="done").length,"/",e.subtasks.length]})})]})})]})},IG=({currentProject:e,onClose:t,onTaskCreated:r})=>a.jsx("div",{className:"fixed inset-0 bg-black/50 backdrop-blur-sm flex items-center justify-center z-50 p-4",children:a.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow-xl w-full max-w-md border border-gray-200 dark:border-gray-700",children:[a.jsxs("div",{className:"flex items-center justify-between p-6 border-b border-gray-200 dark:border-gray-700",children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("div",{className:"w-8 h-8 bg-blue-100 dark:bg-blue-900/50 rounded-lg flex items-center justify-center",children:a.jsx(Gn,{className:"w-4 h-4 text-blue-600 dark:text-blue-400"})}),a.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white",children:"Create AI-Generated Task"})]}),a.jsx("button",{onClick:t,className:"p-2 text-gray-400 hover:text-gray-600 dark:hover:text-gray-300 rounded-md hover:bg-gray-100 dark:hover:bg-gray-700",children:a.jsx(Bt,{className:"w-5 h-5"})})]}),a.jsxs("div",{className:"p-6 space-y-6",children:[a.jsx("div",{className:"bg-blue-50 dark:bg-blue-900/20 rounded-lg p-4 border border-blue-200 dark:border-blue-800",children:a.jsxs("div",{className:"flex items-start gap-3",children:[a.jsx("div",{className:"w-8 h-8 bg-blue-100 dark:bg-blue-900/50 rounded-lg flex items-center justify-center flex-shrink-0 mt-0.5",children:a.jsx(Gn,{className:"w-4 h-4 text-blue-600 dark:text-blue-400"})}),a.jsxs("div",{className:"flex-1",children:[a.jsx("h4",{className:"font-semibold text-blue-900 dark:text-blue-100 mb-2",children:"💡 Pro Tip: Ask Claude Code Directly!"}),a.jsx("p",{className:"text-sm text-blue-800 dark:text-blue-200 mb-3",children:"You can simply ask Claude Code in the chat to create tasks for you. The AI assistant will automatically generate detailed tasks with research-backed insights."}),a.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded border border-blue-200 dark:border-blue-700 p-3 mb-3",children:[a.jsx("p",{className:"text-xs font-medium text-gray-600 dark:text-gray-400 mb-1",children:"Example:"}),a.jsx("p",{className:"text-sm text-gray-900 dark:text-white font-mono",children:'"Please add a new task to implement user profile image uploads using Cloudinary, research the best approach."'})]}),a.jsxs("p",{className:"text-xs text-blue-700 dark:text-blue-300",children:[a.jsx("strong",{children:"This runs:"})," ",a.jsx("code",{className:"bg-blue-100 dark:bg-blue-900/50 px-1 rounded text-xs",children:'task-master add-task --prompt="Implement user profile image uploads using Cloudinary" --research'})]})]})]})}),a.jsxs("div",{className:"text-center pt-4 border-t border-gray-200 dark:border-gray-700",children:[a.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400 mb-3",children:"For more examples and advanced usage patterns:"}),a.jsx("a",{href:"https://github.com/eyaltoledano/claude-task-master/blob/main/docs/examples.md",target:"_blank",rel:"noopener noreferrer",className:"inline-block text-sm text-blue-600 dark:text-blue-400 hover:text-blue-700 dark:hover:text-blue-300 underline font-medium",children:"View TaskMaster Documentation →"})]}),a.jsx("div",{className:"pt-4",children:a.jsx("button",{onClick:t,className:"w-full px-4 py-2 text-sm font-medium text-gray-700 dark:text-gray-300 bg-white dark:bg-gray-700 border border-gray-300 dark:border-gray-600 rounded-lg hover:bg-gray-50 dark:hover:bg-gray-600 transition-colors",children:"Got it, I'll ask Claude Code directly"})})]})]})}),RG=({tasks:e=[],onTaskClick:t,className:r="",showParentTasks:n=!1,defaultView:i="kanban",currentProject:s,onTaskCreated:o,onShowPRDEditor:l,existingPRDs:c=[],onRefreshPRDs:d})=>{const[u,p]=x.useState(""),[h,m]=x.useState("all"),[g,f]=x.useState("all"),[w,S]=x.useState("id"),[k,E]=x.useState("asc"),[N,C]=x.useState(i),[v,I]=x.useState(!1),[M,j]=x.useState(!1),[T,P]=x.useState(!1),[q,D]=x.useState(!1),[z,U]=x.useState(!1),[G,re]=x.useState(!1),{projectTaskMaster:K,refreshProjects:ue,refreshTasks:R,setCurrentProject:F}=ss();x.useEffect(()=>{const oe=fe=>{G&&!fe.target.closest(".relative")&&re(!1)};return document.addEventListener("mousedown",oe),()=>document.removeEventListener("mousedown",oe)},[G]);const te=x.useMemo(()=>{const oe=new Set(e.map(fe=>fe.status).filter(Boolean));return Array.from(oe).sort()},[e]),_=x.useMemo(()=>{const oe=new Set(e.map(fe=>fe.priority).filter(Boolean));return Array.from(oe).sort()},[e]),Z=x.useMemo(()=>{let oe=e.filter(fe=>{const Ie=u.toLowerCase(),qe=!u||fe.title.toLowerCase().includes(Ie)||fe.description?.toLowerCase().includes(Ie)||fe.id.toString().includes(Ie),ze=h==="all"||fe.status===h,ct=g==="all"||fe.priority===g;return qe&&ze&&ct});return oe.sort((fe,Ie)=>{let qe,ze;switch(w){case"title":qe=fe.title.toLowerCase(),ze=Ie.title.toLowerCase();break;case"status":const ct={pending:1,"in-progress":2,done:3,blocked:4,deferred:5,cancelled:6};qe=ct[fe.status]||99,ze=ct[Ie.status]||99;break;case"priority":const Ye={high:3,medium:2,low:1};qe=Ye[fe.priority]||0,ze=Ye[Ie.priority]||0;break;case"updated":qe=new Date(fe.updatedAt||fe.createdAt||0),ze=new Date(Ie.updatedAt||Ie.createdAt||0);break;case"id":default:const wt=Me=>Me.toString().split(".").map(Pt=>parseInt(Pt,10)),gt=wt(fe.id),et=wt(Ie.id);for(let Me=0;Me<Math.max(gt.length,et.length);Me++){const mt=gt[Me]||0,Pt=et[Me]||0;if(mt!==Pt){qe=mt,ze=Pt;break}}break}return w==="updated"?k==="asc"?qe-ze:ze-qe:typeof qe=="string"?k==="asc"?qe.localeCompare(ze):ze.localeCompare(qe):k==="asc"?qe-ze:ze-qe}),oe},[e,u,h,g,w,k]),me=x.useMemo(()=>{const oe=[{id:"pending",title:"📋 To Do",status:"pending",color:"bg-slate-50 dark:bg-slate-900/50 border-slate-200 dark:border-slate-700",headerColor:"bg-slate-100 dark:bg-slate-800 text-slate-800 dark:text-slate-200"},{id:"in-progress",title:"🚀 In Progress",status:"in-progress",color:"bg-blue-50 dark:bg-blue-900/50 border-blue-200 dark:border-blue-700",headerColor:"bg-blue-100 dark:bg-blue-800 text-blue-800 dark:text-blue-200"},{id:"done",title:"✅ Done",status:"done",color:"bg-emerald-50 dark:bg-emerald-900/50 border-emerald-200 dark:border-emerald-700",headerColor:"bg-emerald-100 dark:bg-emerald-800 text-emerald-800 dark:text-emerald-200"},{id:"blocked",title:"🚫 Blocked",status:"blocked",color:"bg-red-50 dark:bg-red-900/50 border-red-200 dark:border-red-700",headerColor:"bg-red-100 dark:bg-red-800 text-red-800 dark:text-red-200"},{id:"deferred",title:"⏳ Deferred",status:"deferred",color:"bg-amber-50 dark:bg-amber-900/50 border-amber-200 dark:border-amber-700",headerColor:"bg-amber-100 dark:bg-amber-800 text-amber-800 dark:text-amber-200"},{id:"cancelled",title:"❌ Cancelled",status:"cancelled",color:"bg-gray-50 dark:bg-gray-900/50 border-gray-200 dark:border-gray-700",headerColor:"bg-gray-100 dark:bg-gray-800 text-gray-800 dark:text-gray-200"}],fe=["pending","in-progress","done"];return oe.filter(qe=>{const ze=Z.some(Ye=>Ye.status===qe.status),ct=fe.includes(qe.status);return ze||ct}).map(qe=>({...qe,tasks:Z.filter(ze=>ze.status===qe.status)}))},[Z]),ke=oe=>{w===oe?E(k==="asc"?"desc":"asc"):(S(oe),E("asc"))},se=()=>{p(""),m("all"),f("all")},_e=oe=>w!==oe?a.jsx(v5,{className:"w-4 h-4"}):k==="asc"?a.jsx(w5,{className:"w-4 h-4"}):a.jsx(d4,{className:"w-4 h-4"});if(e.length===0){const oe=s?.taskMasterConfigured||s?.taskmaster?.hasTaskmaster||K?.hasTaskmaster;return a.jsxs("div",{className:Ze("text-center py-12",r),children:[oe?a.jsxs("div",{className:"max-w-4xl mx-auto",children:[a.jsxs("div",{className:"bg-gradient-to-r from-blue-50 to-indigo-50 dark:from-blue-950/50 dark:to-indigo-950/50 rounded-xl border border-blue-200 dark:border-blue-800 p-6 mb-6",children:[a.jsxs("div",{className:"flex items-center gap-3 mb-4",children:[a.jsx("div",{className:"w-10 h-10 bg-blue-100 dark:bg-blue-900/50 rounded-lg flex items-center justify-center",children:a.jsx(Fr,{className:"w-5 h-5 text-blue-600 dark:text-blue-400"})}),a.jsxs("div",{children:[a.jsx("h2",{className:"text-xl font-semibold text-gray-900 dark:text-white",children:"Getting Started with TaskMaster"}),a.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400",children:"TaskMaster is initialized! Here's what to do next:"})]})]}),a.jsxs("div",{className:"space-y-4 text-left",children:[a.jsxs("div",{className:"grid gap-3",children:[a.jsxs("div",{className:"flex gap-3 p-3 bg-white dark:bg-gray-800/50 rounded-lg border border-blue-100 dark:border-blue-800/50",children:[a.jsx("div",{className:"flex-shrink-0 w-6 h-6 bg-blue-600 text-white text-xs font-semibold rounded-full flex items-center justify-center",children:"1"}),a.jsxs("div",{children:[a.jsx("h4",{className:"font-medium text-gray-900 dark:text-white mb-1",children:"Create a Product Requirements Document (PRD)"}),a.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400 mb-2",children:"Discuss your project idea and create a PRD that describes what you want to build."}),a.jsxs("button",{onClick:()=>{l?.()},className:"inline-flex items-center gap-1 text-xs bg-purple-100 dark:bg-purple-900/30 text-purple-700 dark:text-purple-300 px-2 py-1 rounded hover:bg-purple-200 dark:hover:bg-purple-900/50 transition-colors",children:[a.jsx(Fr,{className:"w-3 h-3"}),"Add PRD"]}),c.length>0&&a.jsxs("div",{className:"mt-3 pt-3 border-t border-gray-200 dark:border-gray-700",children:[a.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 mb-2",children:"Existing PRDs:"}),a.jsx("div",{className:"flex flex-wrap gap-2",children:c.map(fe=>a.jsxs("button",{onClick:async()=>{try{const Ie=await yt.get(`/taskmaster/prd/${encodeURIComponent(s.name)}/${encodeURIComponent(fe.name)}`);if(Ie.ok){const qe=await Ie.json();l?.({name:fe.name,content:qe.content,isExisting:!0})}else console.error("Failed to load PRD:",Ie.statusText)}catch(Ie){console.error("Error loading PRD:",Ie)}},className:"inline-flex items-center gap-1 text-xs bg-gray-100 dark:bg-gray-700 text-gray-700 dark:text-gray-300 px-2 py-1 rounded hover:bg-gray-200 dark:hover:bg-gray-600 transition-colors",children:[a.jsx(Fr,{className:"w-3 h-3"}),fe.name]},fe.name))})]})]})]}),a.jsxs("div",{className:"flex gap-3 p-3 bg-white dark:bg-gray-800/50 rounded-lg border border-blue-100 dark:border-blue-800/50",children:[a.jsx("div",{className:"flex-shrink-0 w-6 h-6 bg-blue-600 text-white text-xs font-semibold rounded-full flex items-center justify-center",children:"2"}),a.jsxs("div",{children:[a.jsx("h4",{className:"font-medium text-gray-900 dark:text-white mb-1",children:"Generate Tasks from PRD"}),a.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400",children:"Once you have a PRD, ask your AI assistant to parse it and TaskMaster will automatically break it down into manageable tasks with implementation details."})]})]}),a.jsxs("div",{className:"flex gap-3 p-3 bg-white dark:bg-gray-800/50 rounded-lg border border-blue-100 dark:border-blue-800/50",children:[a.jsx("div",{className:"flex-shrink-0 w-6 h-6 bg-blue-600 text-white text-xs font-semibold rounded-full flex items-center justify-center",children:"3"}),a.jsxs("div",{children:[a.jsx("h4",{className:"font-medium text-gray-900 dark:text-white mb-1",children:"Analyze & Expand Tasks"}),a.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400",children:"Ask your AI assistant to analyze task complexity and expand them into detailed subtasks for easier implementation."})]})]}),a.jsxs("div",{className:"flex gap-3 p-3 bg-white dark:bg-gray-800/50 rounded-lg border border-blue-100 dark:border-blue-800/50",children:[a.jsx("div",{className:"flex-shrink-0 w-6 h-6 bg-blue-600 text-white text-xs font-semibold rounded-full flex items-center justify-center",children:"4"}),a.jsxs("div",{children:[a.jsx("h4",{className:"font-medium text-gray-900 dark:text-white mb-1",children:"Start Building"}),a.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400",children:"Ask your AI assistant to begin working on tasks, update their status, and add new tasks as your project evolves."})]})]})]}),a.jsx("div",{className:"flex gap-3 pt-4 border-t border-blue-200 dark:border-blue-700",children:a.jsxs("button",{onClick:fe=>{fe.preventDefault(),fe.stopPropagation(),l?.()},className:"flex items-center gap-2 px-4 py-2 bg-purple-600 hover:bg-purple-700 text-white rounded-lg font-medium transition-colors cursor-pointer",style:{zIndex:10},children:[a.jsx(Fr,{className:"w-4 h-4"}),"Add PRD"]})})]})]}),a.jsx("div",{className:"text-center",children:a.jsxs("div",{className:"text-sm text-gray-500 dark:text-gray-400 mb-2",children:["💡 ",a.jsx("strong",{children:"Tip:"})," Start with a PRD to get the most out of TaskMaster's AI-powered task generation"]})})]}):a.jsxs("div",{className:"max-w-md mx-auto",children:[a.jsx("div",{className:"text-blue-600 dark:text-blue-400 mb-4",children:a.jsx(Ia,{className:"w-12 h-12 mx-auto mb-4"})}),a.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white mb-2",children:"TaskMaster AI is not configured"}),a.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400 mb-6",children:"TaskMaster helps break down complex projects into manageable tasks with AI-powered assistance"}),a.jsxs("div",{className:"mb-6 p-4 bg-blue-50 dark:bg-blue-950 rounded-lg text-left",children:[a.jsx("h4",{className:"text-sm font-medium text-blue-900 dark:text-blue-100 mb-3",children:"🎯 What is TaskMaster?"}),a.jsxs("div",{className:"text-xs text-blue-800 dark:text-blue-200 space-y-1",children:[a.jsxs("p",{children:["• ",a.jsx("strong",{children:"AI-Powered Task Management:"})," Break complex projects into manageable subtasks"]}),a.jsxs("p",{children:["• ",a.jsx("strong",{children:"PRD Templates:"})," Generate tasks from Product Requirements Documents"]}),a.jsxs("p",{children:["• ",a.jsx("strong",{children:"Dependency Tracking:"})," Understand task relationships and execution order"]}),a.jsxs("p",{children:["• ",a.jsx("strong",{children:"Progress Visualization:"})," Kanban boards and detailed task analytics"]}),a.jsxs("p",{children:["• ",a.jsx("strong",{children:"CLI Integration:"})," Use taskmaster commands for advanced workflows"]})]})]}),a.jsxs("button",{onClick:()=>{U(!1),P(!0)},className:"px-4 py-2 bg-blue-600 hover:bg-blue-700 text-white rounded-lg font-medium transition-colors flex items-center gap-2 mx-auto",children:[a.jsx(pa,{className:"w-4 h-4"}),"Initialize TaskMaster AI"]})]}),T&&a.jsx("div",{className:"fixed inset-0 z-50 flex items-start justify-center p-4 pt-16 bg-black/50 backdrop-blur-sm",children:a.jsxs("div",{className:"bg-white dark:bg-gray-900 rounded-lg shadow-xl border border-gray-200 dark:border-gray-700 w-full max-w-4xl h-[600px] flex flex-col",children:[a.jsxs("div",{className:"flex items-center justify-between p-4 border-b border-gray-200 dark:border-gray-700",children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("div",{className:"w-8 h-8 bg-blue-100 dark:bg-blue-900/50 rounded-lg flex items-center justify-center",children:a.jsx(pa,{className:"w-4 h-4 text-blue-600 dark:text-blue-400"})}),a.jsxs("div",{children:[a.jsx("h2",{className:"text-lg font-semibold text-gray-900 dark:text-white",children:"TaskMaster Setup"}),a.jsxs("p",{className:"text-sm text-gray-500 dark:text-gray-400",children:["Interactive CLI for ",s?.displayName]})]})]}),a.jsx("button",{onClick:()=>{P(!1),setTimeout(()=>{ue(),s&&F(s)},1e3)},className:"p-2 text-gray-400 hover:text-gray-600 dark:hover:text-gray-300 rounded-md hover:bg-gray-100 dark:hover:bg-gray-800",children:a.jsx(gr,{className:"w-5 h-5 rotate-45"})})]}),a.jsx("div",{className:"flex-1 p-4",children:a.jsx("div",{className:"h-full bg-black rounded-lg overflow-hidden",onClick:fe=>{const Ie=fe.currentTarget.querySelector(".xterm-screen");Ie&&Ie.focus()},children:a.jsx(Bg,{selectedProject:s,selectedSession:null,isActive:!0,initialCommand:"npx task-master init",isPlainShell:!0,onProcessComplete:fe=>{U(!0),fe===0&&setTimeout(()=>{ue(),s&&F(s)},1e3)}})})}),a.jsx("div",{className:"p-4 border-t border-gray-200 dark:border-gray-700 bg-gray-50 dark:bg-gray-800/50",children:a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx("div",{className:"text-sm text-gray-600 dark:text-gray-400",children:z?a.jsxs("span",{className:"flex items-center gap-2 text-green-600 dark:text-green-400",children:[a.jsx("div",{className:"w-2 h-2 bg-green-500 rounded-full"}),"TaskMaster setup completed! You can now close this window."]}):"TaskMaster initialization will start automatically"}),a.jsx("button",{onClick:()=>{P(!1),U(!1),setTimeout(()=>{ue(),s&&F(s)},1e3)},className:Ze("px-4 py-2 text-sm font-medium rounded-md transition-colors",z?"bg-green-600 hover:bg-green-700 text-white":"text-gray-700 dark:text-gray-300 bg-white dark:bg-gray-700 border border-gray-300 dark:border-gray-600 hover:bg-gray-50 dark:hover:bg-gray-600"),children:z?"Close & Continue":"Close"})]})})]})})]})}return a.jsxs("div",{className:Ze("space-y-4",r),children:[a.jsxs("div",{className:"flex flex-col lg:flex-row gap-3 lg:items-center lg:justify-between",children:[a.jsxs("div",{className:"relative flex-1 max-w-md",children:[a.jsx(si,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 text-gray-400 w-4 h-4"}),a.jsx("input",{type:"text",placeholder:"Search tasks...",value:u,onChange:oe=>p(oe.target.value),className:"pl-10 pr-4 py-2 w-full border border-gray-300 dark:border-gray-600 rounded-lg bg-white dark:bg-gray-800 text-gray-900 dark:text-white focus:ring-2 focus:ring-blue-500 focus:border-blue-500"})]}),a.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[a.jsxs("div",{className:"flex bg-gray-100 dark:bg-gray-800 rounded-lg p-1",children:[a.jsx("button",{onClick:()=>C("kanban"),className:Ze("p-2 rounded-md transition-colors",N==="kanban"?"bg-white dark:bg-gray-700 text-gray-900 dark:text-white shadow-sm":"text-gray-500 dark:text-gray-400 hover:text-gray-700 dark:hover:text-gray-300"),title:"Kanban view",children:a.jsx(U5,{className:"w-4 h-4"})}),a.jsx("button",{onClick:()=>C("list"),className:Ze("p-2 rounded-md transition-colors",N==="list"?"bg-white dark:bg-gray-700 text-gray-900 dark:text-white shadow-sm":"text-gray-500 dark:text-gray-400 hover:text-gray-700 dark:hover:text-gray-300"),title:"List view",children:a.jsx(eo,{className:"w-4 h-4"})}),a.jsx("button",{onClick:()=>C("grid"),className:Ze("p-2 rounded-md transition-colors",N==="grid"?"bg-white dark:bg-gray-700 text-gray-900 dark:text-white shadow-sm":"text-gray-500 dark:text-gray-400 hover:text-gray-700 dark:hover:text-gray-300"),title:"Grid view",children:a.jsx(c6,{className:"w-4 h-4"})})]}),a.jsxs("button",{onClick:()=>I(!v),className:Ze("flex items-center gap-2 px-3 py-2 rounded-lg border transition-colors",v?"bg-blue-50 dark:bg-blue-900 border-blue-200 dark:border-blue-700 text-blue-700 dark:text-blue-300":"bg-white dark:bg-gray-800 border-gray-300 dark:border-gray-600 text-gray-700 dark:text-gray-300 hover:bg-gray-50 dark:hover:bg-gray-700"),children:[a.jsx(r6,{className:"w-4 h-4"}),a.jsx("span",{className:"hidden sm:inline",children:"Filters"}),a.jsx(tn,{className:Ze("w-4 h-4 transition-transform",v&&"rotate-180")})]}),s&&a.jsxs(a.Fragment,{children:[a.jsx("button",{onClick:()=>D(!0),className:"p-2 text-gray-600 dark:text-gray-400 hover:text-blue-600 dark:hover:text-blue-400 hover:bg-gray-100 dark:hover:bg-gray-700 rounded-lg transition-colors border border-gray-300 dark:border-gray-600",title:"TaskMaster Getting Started Guide",children:a.jsx(F5,{className:"w-4 h-4"})}),a.jsx("div",{className:"relative",children:c.length>0?a.jsxs("div",{className:"relative",children:[a.jsxs("button",{onClick:()=>re(!G),className:"flex items-center gap-2 px-3 py-2 bg-purple-600 hover:bg-purple-700 text-white rounded-lg transition-colors font-medium",title:`${c.length} PRD${c.length>1?"s":""} available`,children:[a.jsx(Fr,{className:"w-4 h-4"}),a.jsx("span",{className:"hidden sm:inline",children:"PRDs"}),a.jsx("span",{className:"px-1.5 py-0.5 text-xs bg-purple-500 rounded-full min-w-[1.25rem] text-center",children:c.length}),a.jsx(tn,{className:Ze("w-3 h-3 transition-transform hidden sm:block",G&&"rotate-180")})]}),G&&a.jsx("div",{className:"absolute right-0 top-full mt-2 w-56 bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg shadow-xl z-30",children:a.jsxs("div",{className:"p-2",children:[a.jsxs("button",{onClick:()=>{l?.(),re(!1)},className:"w-full text-left px-3 py-2 text-sm font-medium text-purple-700 dark:text-purple-300 hover:bg-purple-50 dark:hover:bg-purple-900/30 rounded flex items-center gap-2",children:[a.jsx(gr,{className:"w-4 h-4"}),"Create New PRD"]}),a.jsx("div",{className:"border-t border-gray-200 dark:border-gray-700 my-1"}),a.jsx("div",{className:"text-xs text-gray-500 dark:text-gray-400 px-3 py-1 font-medium",children:"Existing PRDs:"}),c.map(oe=>a.jsxs("button",{onClick:async()=>{try{const fe=await yt.get(`/taskmaster/prd/${encodeURIComponent(s.name)}/${encodeURIComponent(oe.name)}`);if(fe.ok){const Ie=await fe.json();l?.({name:oe.name,content:Ie.content,isExisting:!0}),re(!1)}}catch(fe){console.error("Error loading PRD:",fe)}},className:"w-full text-left px-3 py-2 text-sm text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700 rounded flex items-center gap-2",title:`Modified: ${new Date(oe.modified).toLocaleDateString()}`,children:[a.jsx(Fr,{className:"w-4 h-4"}),a.jsx("span",{className:"truncate",children:oe.name})]},oe.name))]})})]}):a.jsxs("button",{onClick:()=>{l?.()},className:"flex items-center gap-2 px-3 py-2 bg-purple-600 hover:bg-purple-700 text-white rounded-lg transition-colors font-medium",title:"Create Product Requirements Document",children:[a.jsx(Fr,{className:"w-4 h-4"}),a.jsx("span",{className:"hidden sm:inline",children:"Add PRD"})]})}),(s?.taskMasterConfigured||s?.taskmaster?.hasTaskmaster||K?.hasTaskmaster||e.length>0)&&a.jsxs("button",{onClick:()=>j(!0),className:"flex items-center gap-2 px-3 py-2 bg-blue-600 hover:bg-blue-700 text-white rounded-lg transition-colors font-medium",title:"Add a new task",children:[a.jsx(gr,{className:"w-4 h-4"}),a.jsx("span",{className:"hidden sm:inline",children:"Add Task"})]})]})]})]}),v&&a.jsxs("div",{className:"bg-gray-50 dark:bg-gray-800 rounded-lg p-4 space-y-4",children:[a.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-4",children:[a.jsxs("div",{children:[a.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1",children:"Status"}),a.jsxs("select",{value:h,onChange:oe=>m(oe.target.value),className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md bg-white dark:bg-gray-800 text-gray-900 dark:text-white focus:ring-2 focus:ring-blue-500",children:[a.jsx("option",{value:"all",children:"All Statuses"}),te.map(oe=>a.jsx("option",{value:oe,children:oe.charAt(0).toUpperCase()+oe.slice(1).replace("-"," ")},oe))]})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1",children:"Priority"}),a.jsxs("select",{value:g,onChange:oe=>f(oe.target.value),className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md bg-white dark:bg-gray-800 text-gray-900 dark:text-white focus:ring-2 focus:ring-blue-500",children:[a.jsx("option",{value:"all",children:"All Priorities"}),_.map(oe=>a.jsx("option",{value:oe,children:oe.charAt(0).toUpperCase()+oe.slice(1)},oe))]})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1",children:"Sort By"}),a.jsxs("select",{value:`${w}-${k}`,onChange:oe=>{const[fe,Ie]=oe.target.value.split("-");S(fe),E(Ie)},className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md bg-white dark:bg-gray-800 text-gray-900 dark:text-white focus:ring-2 focus:ring-blue-500",children:[a.jsx("option",{value:"id-asc",children:"ID (Ascending)"}),a.jsx("option",{value:"id-desc",children:"ID (Descending)"}),a.jsx("option",{value:"title-asc",children:"Title (A-Z)"}),a.jsx("option",{value:"title-desc",children:"Title (Z-A)"}),a.jsx("option",{value:"status-asc",children:"Status (Pending First)"}),a.jsx("option",{value:"status-desc",children:"Status (Done First)"}),a.jsx("option",{value:"priority-asc",children:"Priority (High First)"}),a.jsx("option",{value:"priority-desc",children:"Priority (Low First)"})]})]})]}),a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{className:"text-sm text-gray-600 dark:text-gray-400",children:["Showing ",Z.length," of ",e.length," tasks"]}),a.jsx("button",{onClick:se,className:"text-sm text-blue-600 dark:text-blue-400 hover:text-blue-700 dark:hover:text-blue-300 font-medium",children:"Clear Filters"})]})]}),a.jsxs("div",{className:"flex flex-wrap gap-2",children:[a.jsxs("button",{onClick:()=>ke("id"),className:Ze("flex items-center gap-1 px-3 py-1.5 rounded-md text-sm transition-colors",w==="id"?"bg-blue-100 dark:bg-blue-900 text-blue-700 dark:text-blue-300":"bg-gray-100 dark:bg-gray-800 text-gray-600 dark:text-gray-400 hover:bg-gray-200 dark:hover:bg-gray-700"),children:["ID ",_e("id")]}),a.jsxs("button",{onClick:()=>ke("status"),className:Ze("flex items-center gap-1 px-3 py-1.5 rounded-md text-sm transition-colors",w==="status"?"bg-blue-100 dark:bg-blue-900 text-blue-700 dark:text-blue-300":"bg-gray-100 dark:bg-gray-800 text-gray-600 dark:text-gray-400 hover:bg-gray-200 dark:hover:bg-gray-700"),children:["Status ",_e("status")]}),a.jsxs("button",{onClick:()=>ke("priority"),className:Ze("flex items-center gap-1 px-3 py-1.5 rounded-md text-sm transition-colors",w==="priority"?"bg-blue-100 dark:bg-blue-900 text-blue-700 dark:text-blue-300":"bg-gray-100 dark:bg-gray-800 text-gray-600 dark:text-gray-400 hover:bg-gray-200 dark:hover:bg-gray-700"),children:["Priority ",_e("priority")]})]}),Z.length===0?a.jsx("div",{className:"text-center py-12",children:a.jsxs("div",{className:"text-gray-500 dark:text-gray-400",children:[a.jsx(si,{className:"w-12 h-12 mx-auto mb-4 opacity-50"}),a.jsx("h3",{className:"text-lg font-medium mb-2",children:"No tasks match your filters"}),a.jsx("p",{className:"text-sm",children:"Try adjusting your search or filter criteria."})]})}):N==="kanban"?a.jsx("div",{className:Ze("grid gap-6",me.length===1&&"grid-cols-1 max-w-md mx-auto",me.length===2&&"grid-cols-1 md:grid-cols-2",me.length===3&&"grid-cols-1 md:grid-cols-2 lg:grid-cols-3",me.length===4&&"grid-cols-1 md:grid-cols-2 lg:grid-cols-4",me.length===5&&"grid-cols-1 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-5",me.length>=6&&"grid-cols-1 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-6"),children:me.map(oe=>a.jsxs("div",{className:Ze("rounded-xl border shadow-sm transition-shadow hover:shadow-md",oe.color),children:[a.jsx("div",{className:Ze("px-4 py-3 rounded-t-xl border-b",oe.headerColor),children:a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx("h3",{className:"font-semibold text-sm",children:oe.title}),a.jsx("div",{className:"flex items-center gap-2",children:a.jsx("span",{className:"text-xs font-medium px-2 py-1 bg-white/60 dark:bg-black/20 rounded-full",children:oe.tasks.length})})]})}),a.jsx("div",{className:"p-3 space-y-3 min-h-[200px] max-h-[calc(100vh-300px)] overflow-y-auto",children:oe.tasks.length===0?a.jsxs("div",{className:"text-center py-8 text-gray-400 dark:text-gray-500",children:[a.jsx("div",{className:"w-8 h-8 mx-auto mb-2 rounded-full bg-gray-200 dark:bg-gray-700 flex items-center justify-center",children:a.jsx("div",{className:"w-3 h-3 rounded-full bg-gray-300 dark:bg-gray-600"})}),a.jsx("div",{className:"text-xs font-medium text-gray-500 dark:text-gray-400",children:"No tasks yet"}),a.jsx("div",{className:"text-xs text-gray-400 dark:text-gray-500 mt-1",children:oe.status==="pending"?"Tasks will appear here":oe.status==="in-progress"?"Move tasks here when started":oe.status==="done"?"Completed tasks appear here":"Tasks with this status will appear here"})]}):oe.tasks.map(fe=>a.jsx("div",{className:"transform transition-transform hover:scale-[1.02]",children:a.jsx(X2,{task:fe,onClick:()=>t?.(fe),showParent:n,className:"w-full shadow-sm hover:shadow-md transition-shadow cursor-pointer"})},fe.id))})]},oe.id))}):a.jsx("div",{className:Ze("gap-4",N==="grid"?"grid grid-cols-1 md:grid-cols-2 xl:grid-cols-3":"space-y-4"),children:Z.map(oe=>a.jsx(X2,{task:oe,onClick:()=>t?.(oe),showParent:n,className:N==="grid"?"h-full":""},oe.id))}),M&&a.jsx(IG,{currentProject:s,onClose:()=>j(!1),onTaskCreated:()=>{j(!1),o&&o()}}),q&&a.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-4 bg-black/50 backdrop-blur-sm",children:a.jsxs("div",{className:"bg-white dark:bg-gray-900 rounded-lg shadow-xl border border-gray-200 dark:border-gray-700 w-full max-w-4xl max-h-[90vh] overflow-hidden",children:[a.jsxs("div",{className:"flex items-center justify-between p-6 border-b border-gray-200 dark:border-gray-700",children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("div",{className:"w-10 h-10 bg-blue-100 dark:bg-blue-900/50 rounded-lg flex items-center justify-center",children:a.jsx(Fr,{className:"w-5 h-5 text-blue-600 dark:text-blue-400"})}),a.jsxs("div",{children:[a.jsx("h2",{className:"text-xl font-semibold text-gray-900 dark:text-white",children:"Getting Started with TaskMaster"}),a.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400",children:"Your guide to productive task management"})]})]}),a.jsx("button",{onClick:()=>D(!1),className:"p-2 text-gray-400 hover:text-gray-600 dark:hover:text-gray-300 rounded-lg hover:bg-gray-100 dark:hover:bg-gray-700 transition-colors",children:a.jsx(Bt,{className:"w-5 h-5"})})]}),a.jsx("div",{className:"p-6 overflow-y-auto max-h-[calc(90vh-120px)]",children:a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"flex gap-4 p-4 bg-gradient-to-r from-blue-50 to-indigo-50 dark:from-blue-950/50 dark:to-indigo-950/50 rounded-lg border border-blue-200 dark:border-blue-800",children:[a.jsx("div",{className:"flex-shrink-0 w-8 h-8 bg-blue-600 text-white text-sm font-semibold rounded-full flex items-center justify-center",children:"1"}),a.jsxs("div",{children:[a.jsx("h4",{className:"font-medium text-gray-900 dark:text-white mb-2",children:"Create a Product Requirements Document (PRD)"}),a.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400 mb-3",children:"Discuss your project idea and create a PRD that describes what you want to build."}),a.jsxs("button",{onClick:()=>{l?.(),D(!1)},className:"inline-flex items-center gap-2 text-sm bg-purple-100 dark:bg-purple-900/30 text-purple-700 dark:text-purple-300 px-3 py-1.5 rounded-lg hover:bg-purple-200 dark:hover:bg-purple-900/50 transition-colors",children:[a.jsx(Fr,{className:"w-4 h-4"}),"Add PRD"]})]})]}),a.jsxs("div",{className:"flex gap-4 p-4 bg-gradient-to-r from-green-50 to-emerald-50 dark:from-green-950/50 dark:to-emerald-950/50 rounded-lg border border-green-200 dark:border-green-800",children:[a.jsx("div",{className:"flex-shrink-0 w-8 h-8 bg-green-600 text-white text-sm font-semibold rounded-full flex items-center justify-center",children:"2"}),a.jsxs("div",{children:[a.jsx("h4",{className:"font-medium text-gray-900 dark:text-white mb-2",children:"Generate Tasks from PRD"}),a.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400 mb-3",children:"Once you have a PRD, ask your AI assistant to parse it and TaskMaster will automatically break it down into manageable tasks with implementation details."}),a.jsxs("div",{className:"bg-white dark:bg-gray-800/50 rounded border border-green-200 dark:border-green-700/50 p-3 mb-2",children:[a.jsx("p",{className:"text-xs font-medium text-gray-600 dark:text-gray-400 mb-1",children:"💬 Example:"}),a.jsx("p",{className:"text-xs text-gray-900 dark:text-white font-mono",children:`"I've just initialized a new project with Claude Task Master. I have a PRD at .taskmaster/docs/prd.txt. Can you help me parse it and set up the initial tasks?"`})]})]})]}),a.jsxs("div",{className:"flex gap-4 p-4 bg-gradient-to-r from-amber-50 to-orange-50 dark:from-amber-950/50 dark:to-orange-950/50 rounded-lg border border-amber-200 dark:border-amber-800",children:[a.jsx("div",{className:"flex-shrink-0 w-8 h-8 bg-amber-600 text-white text-sm font-semibold rounded-full flex items-center justify-center",children:"3"}),a.jsxs("div",{children:[a.jsx("h4",{className:"font-medium text-gray-900 dark:text-white mb-2",children:"Analyze & Expand Tasks"}),a.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400 mb-3",children:"Ask your AI assistant to analyze task complexity and expand them into detailed subtasks for easier implementation."}),a.jsxs("div",{className:"bg-white dark:bg-gray-800/50 rounded border border-amber-200 dark:border-amber-700/50 p-3 mb-2",children:[a.jsx("p",{className:"text-xs font-medium text-gray-600 dark:text-gray-400 mb-1",children:"💬 Example:"}),a.jsx("p",{className:"text-xs text-gray-900 dark:text-white font-mono",children:'"Task 5 seems complex. Can you break it down into subtasks?"'})]})]})]}),a.jsxs("div",{className:"flex gap-4 p-4 bg-gradient-to-r from-purple-50 to-pink-50 dark:from-purple-950/50 dark:to-pink-950/50 rounded-lg border border-purple-200 dark:border-purple-800",children:[a.jsx("div",{className:"flex-shrink-0 w-8 h-8 bg-purple-600 text-white text-sm font-semibold rounded-full flex items-center justify-center",children:"4"}),a.jsxs("div",{children:[a.jsx("h4",{className:"font-medium text-gray-900 dark:text-white mb-2",children:"Start Building"}),a.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400 mb-3",children:"Ask your AI assistant to begin working on tasks, update their status, and add new tasks as your project evolves."}),a.jsxs("div",{className:"bg-white dark:bg-gray-800/50 rounded border border-purple-200 dark:border-purple-700/50 p-3 mb-3",children:[a.jsx("p",{className:"text-xs font-medium text-gray-600 dark:text-gray-400 mb-1",children:"💬 Example:"}),a.jsx("p",{className:"text-xs text-gray-900 dark:text-white font-mono",children:'"Please add a new task to implement user profile image uploads using Cloudinary, research the best approach."'})]}),a.jsx("a",{href:"https://github.com/eyaltoledano/claude-task-master/blob/main/docs/examples.md",target:"_blank",rel:"noopener noreferrer",className:"inline-block text-xs text-blue-600 dark:text-blue-400 hover:text-blue-700 dark:hover:text-blue-300 underline",children:"View more examples and usage patterns →"})]})]}),a.jsxs("div",{className:"mt-6 p-4 bg-gray-50 dark:bg-gray-800 rounded-lg border border-gray-200 dark:border-gray-700",children:[a.jsx("h4",{className:"font-medium text-gray-900 dark:text-white mb-3",children:"💡 Pro Tips"}),a.jsxs("ul",{className:"space-y-2 text-sm text-gray-600 dark:text-gray-400",children:[a.jsxs("li",{className:"flex items-start gap-2",children:[a.jsx("span",{className:"w-1.5 h-1.5 bg-blue-500 rounded-full mt-2 flex-shrink-0"}),"Use the search bar to quickly find specific tasks"]}),a.jsxs("li",{className:"flex items-start gap-2",children:[a.jsx("span",{className:"w-1.5 h-1.5 bg-green-500 rounded-full mt-2 flex-shrink-0"}),"Switch between Kanban, List, and Grid views using the view toggles"]}),a.jsxs("li",{className:"flex items-start gap-2",children:[a.jsx("span",{className:"w-1.5 h-1.5 bg-purple-500 rounded-full mt-2 flex-shrink-0"}),"Use filters to focus on specific task statuses or priorities"]}),a.jsxs("li",{className:"flex items-start gap-2",children:[a.jsx("span",{className:"w-1.5 h-1.5 bg-orange-500 rounded-full mt-2 flex-shrink-0"}),"Click on any task to view detailed information and manage subtasks"]})]})]}),a.jsxs("div",{className:"mt-6 p-4 bg-blue-50 dark:bg-blue-950/50 rounded-lg border border-blue-200 dark:border-blue-800",children:[a.jsx("h4",{className:"font-medium text-blue-900 dark:text-blue-100 mb-3",children:"📚 Learn More"}),a.jsx("p",{className:"text-sm text-blue-800 dark:text-blue-200 mb-3",children:"TaskMaster AI is an advanced task management system built for developers. Get documentation, examples, and contribute to the project."}),a.jsxs("a",{href:"https://github.com/eyaltoledano/claude-task-master",target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-2 text-sm bg-blue-600 hover:bg-blue-700 text-white px-3 py-2 rounded-lg font-medium transition-colors",children:[a.jsx("svg",{className:"w-4 h-4",fill:"currentColor",viewBox:"0 0 20 20",children:a.jsx("path",{fillRule:"evenodd",d:"M10 0C4.477 0 0 4.484 0 10.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 0110 4.844c.85.004 1.705.115 2.504.337 1.909-1.296 2.747-1.027 2.747-1.027.546 1.379.203 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.942.359.31.678.921.678 1.856 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.019 10.019 0 0020 10.017C20 4.484 15.522 0 10 0z",clipRule:"evenodd"})}),"View on GitHub",a.jsx("svg",{className:"w-3 h-3",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:a.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"})})]})]})]})})]})})]})},jG=({file:e,onClose:t,projectPath:r,project:n,initialContent:i="",isNewFile:s=!1,onSave:o})=>{const[l,c]=x.useState(i),[d,u]=x.useState(!s),[p,h]=x.useState(!1),[m,g]=x.useState(!1),[f,w]=x.useState(!0),[S,k]=x.useState(!1),[E,N]=x.useState(!1),[C,v]=x.useState(!0),[I,M]=x.useState(""),[j,T]=x.useState(!1),[P,q]=x.useState(!1),[D,z]=x.useState([]),U=x.useRef(null),G=`# Product Requirements Document - Example Project
|
|
943
943
|
|
|
944
944
|
## 1. Overview
|
|
945
945
|
**Product Name:** AI-Powered Task Manager
|
|
@@ -1203,7 +1203,7 @@ File: ${e?.name||"New PRD"}
|
|
|
1203
1203
|
Path: ${e?.path||"Not saved yet"}
|
|
1204
1204
|
|
|
1205
1205
|
${G}`)}finally{u(!1)}})()},[e,r,s]),x.useEffect(()=>{(async()=>{if(!n?.name){console.log("No project name available:",n);return}try{console.log("Fetching PRDs for project:",n.name);const Z=await yt.get(`/taskmaster/prd/${encodeURIComponent(n.name)}`);if(Z.ok){const me=await Z.json();console.log("Fetched existing PRDs:",me.prds),z(me.prds||[])}else console.log("Failed to fetch PRDs:",Z.status,Z.statusText)}catch(Z){console.error("Error fetching existing PRDs:",Z)}})()},[n?.name]);const re=async()=>{if(!l.trim()){alert("Please add content before saving.");return}if(!I.trim()){alert("Please provide a filename for the PRD.");return}const _=I.endsWith(".txt")||I.endsWith(".md")?I:`${I}.txt`,Z=D.find(me=>me.name===_);if(console.log("Save check:",{fullFileName:_,existingPRDs:D,existingFile:Z,isExisting:e?.isExisting,fileObject:e,shouldShowModal:Z&&!e?.isExisting}),Z&&!e?.isExisting){console.log("Showing overwrite confirmation modal"),q(!0);return}await K()},K=async()=>{h(!0);try{const _=I.endsWith(".txt")||I.endsWith(".md")?I:`${I}.txt`,Z=await Ce(`/api/taskmaster/prd/${encodeURIComponent(n?.name)}`,{method:"POST",body:JSON.stringify({fileName:_,content:l})});if(!Z.ok){const ke=await Z.json();throw new Error(ke.message||`Save failed: ${Z.status}`)}k(!0),setTimeout(()=>k(!1),2e3);const me=await yt.get(`/taskmaster/prd/${encodeURIComponent(n.name)}`);if(me.ok){const ke=await me.json();z(ke.prds||[])}o&&await o()}catch(_){console.error("Error saving PRD:",_),alert(`Error saving PRD: ${_.message}`)}finally{h(!1)}},ue=()=>{const _=new Blob([l],{type:"text/markdown"}),Z=URL.createObjectURL(_),me=document.createElement("a");me.href=Z;const ke=I?`${I}.txt`:"prd.txt";me.download=ke,document.body.appendChild(me),me.click(),document.body.removeChild(me),URL.revokeObjectURL(Z)},R=async()=>{if(!l.trim()){alert("Please add content to the PRD before generating tasks.");return}T(!0)},F=()=>{g(!m)};x.useEffect(()=>{const _=Z=>{(Z.ctrlKey||Z.metaKey)&&(Z.key==="s"?(Z.preventDefault(),re()):Z.key==="Escape"&&(Z.preventDefault(),t()))};return document.addEventListener("keydown",_),()=>document.removeEventListener("keydown",_)},[l]);const te=_=>_.replace(/^### (.*$)/gim,"<h3>$1</h3>").replace(/^## (.*$)/gim,"<h2>$1</h2>").replace(/^# (.*$)/gim,"<h1>$1</h1>").replace(/\*\*(.*)\*\*/gim,"<strong>$1</strong>").replace(/\*(.*)\*/gim,"<em>$1</em>").replace(/^\- (.*$)/gim,"<li>$1</li>").replace(/(<li>.*<\/li>)/gims,"<ul>$1</ul>").replace(/\n\n/gim,"</p><p>").replace(/^(?!<[h|u|l])(.*$)/gim,"<p>$1</p>").replace(/<\/ul>\s*<ul>/gim,"");return d?a.jsx("div",{className:"fixed inset-0 z-[200] md:bg-black/50 md:flex md:items-center md:justify-center",children:a.jsx("div",{className:"w-full h-full md:rounded-lg md:w-auto md:h-auto p-8 flex items-center justify-center bg-white dark:bg-gray-900",children:a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("div",{className:"animate-spin rounded-full h-6 w-6 border-b-2 border-blue-600"}),a.jsx("span",{className:"text-gray-900 dark:text-white",children:"Loading PRD..."})]})})}):a.jsxs("div",{className:`fixed inset-0 z-[200] md:bg-black/50 md:flex md:items-center md:justify-center md:p-4 ${m?"md:p-0":""}`,children:[a.jsxs("div",{className:Ze("bg-white dark:bg-gray-900 shadow-2xl flex flex-col","w-full h-full md:rounded-lg md:shadow-2xl",m?"md:w-full md:h-full md:rounded-none":"md:w-full md:max-w-6xl md:h-[85vh] md:max-h-[85vh]"),children:[a.jsxs("div",{className:"flex items-center justify-between p-4 border-b border-gray-200 dark:border-gray-700 flex-shrink-0 min-w-0",children:[a.jsxs("div",{className:"flex items-center gap-3 min-w-0 flex-1",children:[a.jsx("div",{className:"w-8 h-8 bg-purple-600 rounded flex items-center justify-center flex-shrink-0",children:a.jsx(Fr,{className:"w-4 h-4 text-white"})}),a.jsxs("div",{className:"min-w-0 flex-1",children:[a.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center gap-2 min-w-0",children:[a.jsxs("div",{className:"flex items-center gap-1 min-w-0 flex-1",children:[a.jsxs("div",{className:"flex items-center min-w-0 flex-1 bg-gray-50 dark:bg-gray-700 border border-gray-200 dark:border-gray-600 rounded-md px-3 py-2 focus-within:ring-2 focus-within:ring-purple-500 focus-within:border-purple-500 dark:focus-within:ring-purple-400 dark:focus-within:border-purple-400",children:[a.jsx("input",{type:"text",value:I,onChange:_=>{const Z=_.target.value.replace(/[<>:"/\\|?*]/g,"");M(Z)},className:"font-medium text-gray-900 dark:text-white bg-transparent border-none outline-none min-w-0 flex-1 text-base sm:text-sm placeholder-gray-400 dark:placeholder-gray-500",placeholder:"Enter PRD filename",maxLength:100}),a.jsx("span",{className:"text-sm sm:text-xs text-gray-500 dark:text-gray-400 whitespace-nowrap ml-1",children:".txt"})]}),a.jsx("button",{onClick:()=>document.querySelector('input[placeholder="Enter PRD filename"]')?.focus(),className:"p-1 text-gray-400 hover:text-purple-600 dark:hover:text-purple-400 transition-colors",title:"Click to edit filename",children:a.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15.232 5.232l3.536 3.536m-2.036-5.036a2.5 2.5 0 113.536 3.536L6.5 21.036H3v-3.572L16.732 3.732z"})})})]}),a.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0",children:[a.jsx("span",{className:"text-xs bg-purple-100 dark:bg-purple-900 text-purple-600 dark:text-purple-300 px-2 py-1 rounded whitespace-nowrap",children:"📋 PRD"}),s&&a.jsx("span",{className:"text-xs bg-green-100 dark:bg-green-900 text-green-600 dark:text-green-300 px-2 py-1 rounded whitespace-nowrap",children:"✨ New"})]})]}),a.jsx("p",{className:"text-xs sm:text-sm text-gray-500 dark:text-gray-400 truncate mt-1",children:"Product Requirements Document"})]})]}),a.jsxs("div",{className:"flex items-center gap-1 md:gap-2 flex-shrink-0",children:[a.jsx("button",{onClick:()=>N(!E),className:Ze("p-2 md:p-2 rounded-md hover:bg-gray-100 dark:hover:bg-gray-800","min-w-[44px] min-h-[44px] md:min-w-0 md:min-h-0 flex items-center justify-center",E?"text-purple-600 dark:text-purple-400 bg-purple-50 dark:bg-purple-900":"text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-white"),title:E?"Switch to edit mode":"Preview markdown",children:a.jsx(hi,{className:"w-5 h-5 md:w-4 md:h-4"})}),a.jsx("button",{onClick:()=>v(!C),className:Ze("p-2 md:p-2 rounded-md hover:bg-gray-100 dark:hover:bg-gray-800","min-w-[44px] min-h-[44px] md:min-w-0 md:min-h-0 flex items-center justify-center",C?"text-blue-600 dark:text-blue-400 bg-blue-50 dark:bg-blue-900":"text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-white"),title:C?"Disable word wrap":"Enable word wrap",children:a.jsx("span",{className:"text-sm md:text-xs font-mono font-bold",children:"↵"})}),a.jsx("button",{onClick:()=>w(!f),className:"p-2 md:p-2 text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-white rounded-md hover:bg-gray-100 dark:hover:bg-gray-800 min-w-[44px] min-h-[44px] md:min-w-0 md:min-h-0 flex items-center justify-center",title:"Toggle theme",children:a.jsx("span",{className:"text-lg md:text-base",children:f?"☀️":"🌙"})}),a.jsx("button",{onClick:ue,className:"p-2 md:p-2 text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-white rounded-md hover:bg-gray-100 dark:hover:bg-gray-800 min-w-[44px] min-h-[44px] md:min-w-0 md:min-h-0 flex items-center justify-center",title:"Download PRD",children:a.jsx(Qs,{className:"w-5 h-5 md:w-4 md:h-4"})}),a.jsxs("button",{onClick:R,disabled:!l.trim(),className:Ze("px-3 py-2 rounded-md disabled:opacity-50 flex items-center gap-2 transition-colors text-sm font-medium","bg-purple-600 hover:bg-purple-700 text-white","min-h-[44px] md:min-h-0"),title:"Generate tasks from PRD content",children:[a.jsx(Gn,{className:"w-4 h-4"}),a.jsx("span",{className:"hidden md:inline",children:"Generate Tasks"})]}),a.jsx("button",{onClick:re,disabled:p,className:Ze("px-3 py-2 text-white rounded-md disabled:opacity-50 flex items-center gap-2 transition-colors","min-h-[44px] md:min-h-0",S?"bg-green-600 hover:bg-green-700":"bg-purple-600 hover:bg-purple-700"),children:S?a.jsxs(a.Fragment,{children:[a.jsx("svg",{className:"w-5 h-5 md:w-4 md:h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})}),a.jsx("span",{className:"hidden sm:inline",children:"Saved!"})]}):a.jsxs(a.Fragment,{children:[a.jsx(to,{className:"w-5 h-5 md:w-4 md:h-4"}),a.jsx("span",{className:"hidden sm:inline",children:p?"Saving...":"Save PRD"})]})}),a.jsx("button",{onClick:F,className:"hidden md:flex p-2 text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-white rounded-md hover:bg-gray-100 dark:hover:bg-gray-800 items-center justify-center",title:m?"Exit fullscreen":"Fullscreen",children:m?a.jsx(f4,{className:"w-4 h-4"}):a.jsx(Ph,{className:"w-4 h-4"})}),a.jsx("button",{onClick:t,className:"p-2 md:p-2 text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-white rounded-md hover:bg-gray-100 dark:hover:bg-gray-800 min-w-[44px] min-h-[44px] md:min-w-0 md:min-h-0 flex items-center justify-center",title:"Close",children:a.jsx(Bt,{className:"w-6 h-6 md:w-4 md:h-4"})})]})]}),a.jsx("div",{className:"flex-1 overflow-hidden",children:E?a.jsx("div",{className:"h-full overflow-y-auto p-6 prose prose-gray dark:prose-invert max-w-none",children:a.jsx("div",{className:"markdown-preview",dangerouslySetInnerHTML:{__html:te(l)}})}):a.jsx(s4,{ref:U,value:l,onChange:c,extensions:[l4(),...C?[rn.lineWrapping]:[]],theme:f?o4:void 0,height:"100%",style:{fontSize:"14px",height:"100%"},basicSetup:{lineNumbers:!0,foldGutter:!0,dropCursor:!1,allowMultipleSelections:!1,indentOnInput:!0,bracketMatching:!0,closeBrackets:!0,autocompletion:!0,highlightSelectionMatches:!0,searchKeymap:!0}})}),a.jsxs("div",{className:"flex items-center justify-between p-3 border-t border-gray-200 dark:border-gray-700 bg-gray-50 dark:bg-gray-800 flex-shrink-0",children:[a.jsxs("div",{className:"flex items-center gap-4 text-sm text-gray-600 dark:text-gray-400",children:[a.jsxs("span",{children:["Lines: ",l.split(`
|
|
1206
|
-
`).length]}),a.jsxs("span",{children:["Characters: ",l.length]}),a.jsxs("span",{children:["Words: ",l.split(/\s+/).filter(_=>_.length>0).length]}),a.jsx("span",{children:"Format: Markdown"})]}),a.jsx("div",{className:"text-sm text-gray-500 dark:text-gray-400",children:"Press Ctrl+S to save • Esc to close"})]})]}),j&&a.jsx("div",{className:"fixed inset-0 bg-black/50 backdrop-blur-sm flex items-center justify-center z-50 p-4",children:a.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow-xl w-full max-w-md border border-gray-200 dark:border-gray-700",children:[a.jsxs("div",{className:"flex items-center justify-between p-6 border-b border-gray-200 dark:border-gray-700",children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("div",{className:"w-8 h-8 bg-purple-100 dark:bg-purple-900/50 rounded-lg flex items-center justify-center",children:a.jsx(Gn,{className:"w-4 h-4 text-purple-600 dark:text-purple-400"})}),a.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white",children:"Generate Tasks from PRD"})]}),a.jsx("button",{onClick:()=>T(!1),className:"p-2 text-gray-400 hover:text-gray-600 dark:hover:text-gray-300 rounded-md hover:bg-gray-100 dark:hover:bg-gray-700",children:a.jsx(Bt,{className:"w-5 h-5"})})]}),a.jsxs("div",{className:"p-6 space-y-4",children:[a.jsx("div",{className:"bg-purple-50 dark:bg-purple-900/20 rounded-lg p-4 border border-purple-200 dark:border-purple-800",children:a.jsxs("div",{className:"flex items-start gap-3",children:[a.jsx("div",{className:"w-8 h-8 bg-purple-100 dark:bg-purple-900/50 rounded-lg flex items-center justify-center flex-shrink-0 mt-0.5",children:a.jsx(Gn,{className:"w-4 h-4 text-purple-600 dark:text-purple-400"})}),a.jsxs("div",{className:"flex-1",children:[a.jsx("h4",{className:"font-semibold text-purple-900 dark:text-purple-100 mb-2",children:"💡 Pro Tip: Ask Claude Code Directly!"}),a.jsx("p",{className:"text-sm text-purple-800 dark:text-purple-200 mb-3",children:"You can simply ask Claude Code in the chat to parse your PRD and generate tasks. The AI assistant will automatically save your PRD and create detailed tasks with implementation details."}),a.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded border border-purple-200 dark:border-purple-700 p-3 mb-3",children:[a.jsx("p",{className:"text-xs font-medium text-gray-600 dark:text-gray-400 mb-1",children:"💬 Example:"}),a.jsxs("p",{className:"text-xs text-gray-900 dark:text-white font-mono",children:[`"I've just initialized a new project with Claude Task Master. I have a PRD at .taskmaster/docs/`,I.endsWith(".txt")||I.endsWith(".md")?I:`${I}.txt`,'. Can you help me parse it and set up the initial tasks?"']})]}),a.jsxs("p",{className:"text-xs text-purple-700 dark:text-purple-300",children:[a.jsx("strong",{children:"This will:"})," Save your PRD, analyze its content, and generate structured tasks with subtasks, dependencies, and implementation details."]})]})]})}),a.jsxs("div",{className:"text-center pt-4 border-t border-gray-200 dark:border-gray-700",children:[a.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400 mb-3",children:"For more examples and advanced usage patterns:"}),a.jsx("a",{href:"https://github.com/eyaltoledano/claude-task-master/blob/main/docs/examples.md",target:"_blank",rel:"noopener noreferrer",className:"inline-block text-sm text-purple-600 dark:text-purple-400 hover:text-purple-700 dark:hover:text-purple-300 underline font-medium",children:"View TaskMaster Documentation →"})]}),a.jsx("div",{className:"pt-4",children:a.jsx("button",{onClick:()=>T(!1),className:"w-full px-4 py-2 text-sm font-medium text-gray-700 dark:text-gray-300 bg-white dark:bg-gray-700 border border-gray-300 dark:border-gray-600 rounded-lg hover:bg-gray-50 dark:hover:bg-gray-600 transition-colors",children:"Got it, I'll ask Claude Code directly"})})]})]})}),P&&a.jsxs("div",{className:"fixed inset-0 z-[300] flex items-center justify-center p-4",children:[a.jsx("div",{className:"fixed inset-0 bg-black bg-opacity-50",onClick:()=>q(!1)}),a.jsx("div",{className:"relative bg-white dark:bg-gray-800 rounded-lg shadow-xl max-w-md w-full border border-gray-200 dark:border-gray-700",children:a.jsxs("div",{className:"p-6",children:[a.jsxs("div",{className:"flex items-center mb-4",children:[a.jsx("div",{className:"p-2 rounded-full mr-3 bg-yellow-100 dark:bg-yellow-900",children:a.jsx(Vn,{className:"w-5 h-5 text-yellow-600 dark:text-yellow-400"})}),a.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white",children:"File Already Exists"})]}),a.jsxs("p",{className:"text-sm text-gray-600 dark:text-gray-400 mb-6",children:['A PRD file named "',I.endsWith(".txt")||I.endsWith(".md")?I:`${I}.txt`,'" already exists. Do you want to overwrite it with the current content?']}),a.jsxs("div",{className:"flex justify-end space-x-3",children:[a.jsx("button",{onClick:()=>q(!1),className:"px-4 py-2 text-sm text-gray-700 dark:text-gray-300 bg-white dark:bg-gray-700 border border-gray-300 dark:border-gray-600 rounded-md hover:bg-gray-50 dark:hover:bg-gray-600 transition-colors",children:"Cancel"}),a.jsxs("button",{onClick:async()=>{q(!1),await K()},className:"px-4 py-2 text-sm text-white bg-yellow-600 hover:bg-yellow-700 rounded-md flex items-center space-x-2 transition-colors",children:[a.jsx(to,{className:"w-4 h-4"}),a.jsx("span",{children:"Overwrite"})]})]})]})})]})]})};function _G({selectedProject:e,selectedSession:t,activeTab:r,setActiveTab:n,ws:i,sendMessage:s,messages:o,isMobile:l,isPWA:c,onMenuClick:d,isLoading:u,onInputFocusChange:p,onSessionActive:h,onSessionInactive:m,onSessionProcessing:g,onSessionNotProcessing:f,processingSessions:w,onReplaceTemporarySession:S,onNavigateToSession:k,onShowSettings:E,autoExpandTools:N,showRawParameters:C,showThinking:v,autoScrollToBottom:I,sendByCtrlEnter:M,externalMessageUpdate:j}){const{t:T}=Ht(),[P,q]=x.useState(null),[D,z]=x.useState(null),[U,G]=x.useState(!1),[re,K]=x.useState(600),[ue,R]=x.useState(!1),[F,te]=x.useState(!1),_=x.useRef(null),[Z,me]=x.useState(!1),[ke,se]=x.useState(null),[_e,oe]=x.useState([]),[fe,Ie]=x.useState(null),{tasks:qe,currentProject:ze,refreshTasks:ct,setCurrentProject:Ye}=ss(),{tasksEnabled:wt,isTaskMasterInstalled:gt,isTaskMasterReady:et}=os(),Me=wt&>x.useEffect(()=>{e&&e!==ze&&Ye(e)},[e,ze,Ye]),x.useEffect(()=>{!Me&&r==="tasks"&&n("chat")},[Me,r,n]),x.useEffect(()=>{(async()=>{if(!ze?.name){oe([]);return}try{const le=await yt.get(`/taskmaster/prd/${encodeURIComponent(ze.name)}`);if(le.ok){const ve=await le.json();oe(ve.prdFiles||[])}else oe([])}catch(le){console.error("Failed to load existing PRDs:",le),oe([])}})()},[ze?.name]);const mt=(Y,le=null)=>{const ve={name:Y.split("/").pop(),path:Y,projectName:e?.name,diffInfo:le};q(ve)},Pt=()=>{q(null),te(!1)},xe=()=>{te(!F)},at=Y=>{if(typeof Y=="object"&&Y.id&&!Y.title){const le=qe?.find(ve=>ve.id===Y.id);le&&(z(le),G(!0))}else z(Y),G(!0)},de=()=>{G(!1),z(null)},Ee=(Y,le)=>{console.log("Update task status:",Y,le),ct?.()},H=Y=>{l||(R(!0),Y.preventDefault())};return x.useEffect(()=>{const Y=ve=>{if(!ue)return;const Ve=_.current?.parentElement;if(!Ve)return;const It=Ve.getBoundingClientRect(),ft=It.right-ve.clientX,Rt=300,it=It.width*.8;ft>=Rt&&ft<=it&&K(ft)},le=()=>{R(!1)};return ue&&(document.addEventListener("mousemove",Y),document.addEventListener("mouseup",le),document.body.style.cursor="col-resize",document.body.style.userSelect="none"),()=>{document.removeEventListener("mousemove",Y),document.removeEventListener("mouseup",le),document.body.style.cursor="",document.body.style.userSelect=""}},[ue]),u?a.jsxs("div",{className:"h-full flex flex-col",children:[l&&a.jsx("div",{className:"bg-background border-b border-border p-2 sm:p-3 pwa-header-safe flex-shrink-0",children:a.jsx("button",{onClick:d,className:"p-2 text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-white rounded-md hover:bg-gray-100 dark:hover:bg-gray-700 pwa-menu-button",children:a.jsx("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 6h16M4 12h16M4 18h16"})})})}),a.jsx("div",{className:"flex-1 flex items-center justify-center",children:a.jsxs("div",{className:"text-center text-gray-500 dark:text-gray-400",children:[a.jsx("div",{className:"w-12 h-12 mx-auto mb-4",children:a.jsx("div",{className:"w-full h-full rounded-full border-4 border-gray-200 border-t-blue-500",style:{animation:"spin 1s linear infinite",WebkitAnimation:"spin 1s linear infinite",MozAnimation:"spin 1s linear infinite"}})}),a.jsx("h2",{className:"text-xl font-semibold mb-2",children:T("mainContent.loading")}),a.jsx("p",{children:T("mainContent.settingUpWorkspace")})]})})]}):e?a.jsxs("div",{className:"h-full flex flex-col",children:[a.jsx("div",{className:"bg-background border-b border-border p-2 sm:p-3 pwa-header-safe flex-shrink-0",children:a.jsxs("div",{className:"flex items-center justify-between relative",children:[a.jsxs("div",{className:"flex items-center space-x-2 min-w-0 flex-1",children:[l&&a.jsx("button",{onClick:d,onTouchStart:Y=>{Y.preventDefault(),d()},className:"p-2 text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-white rounded-md hover:bg-gray-100 dark:hover:bg-gray-700 touch-manipulation active:scale-95 pwa-menu-button flex-shrink-0",children:a.jsx("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 6h16M4 12h16M4 18h16"})})}),a.jsxs("div",{className:"min-w-0 flex items-center gap-2 flex-1 overflow-x-auto scrollbar-hide",children:[r==="chat"&&t&&a.jsx("div",{className:"w-5 h-5 flex-shrink-0 flex items-center justify-center",children:t.__provider==="cursor"?a.jsx(pn,{className:"w-4 h-4"}):a.jsx(nn,{className:"w-4 h-4"})}),a.jsx("div",{className:"min-w-0 flex-1",children:r==="chat"&&t?a.jsxs("div",{className:"min-w-0",children:[a.jsx("h2",{className:"text-sm sm:text-base font-semibold text-gray-900 dark:text-white whitespace-nowrap overflow-x-auto scrollbar-hide",children:t.__provider==="cursor"?t.name||"Untitled Session":t.summary||"New Session"}),a.jsx("div",{className:"text-xs text-gray-500 dark:text-gray-400 truncate",children:e.displayName})]}):r==="chat"&&!t?a.jsxs("div",{className:"min-w-0",children:[a.jsx("h2",{className:"text-sm sm:text-base font-semibold text-gray-900 dark:text-white",children:T("mainContent.newSession")}),a.jsx("div",{className:"text-xs text-gray-500 dark:text-gray-400 truncate",children:e.displayName})]}):a.jsxs("div",{className:"min-w-0",children:[a.jsx("h2",{className:"text-sm sm:text-base font-semibold text-gray-900 dark:text-white",children:r==="files"?T("mainContent.projectFiles"):r==="git"?T("tabs.git"):r==="tasks"&&Me?"TaskMaster":"Project"}),a.jsx("div",{className:"text-xs text-gray-500 dark:text-gray-400 truncate",children:e.displayName})]})})]})]}),a.jsx("div",{className:"flex-shrink-0 hidden sm:block",children:a.jsxs("div",{className:"relative flex bg-gray-100 dark:bg-gray-800 rounded-lg p-1",children:[a.jsx(Pr,{content:T("tabs.chat"),position:"bottom",children:a.jsx("button",{onClick:()=>n("chat"),className:`relative px-2 sm:px-3 py-1.5 text-xs sm:text-sm font-medium rounded-md ${r==="chat"?"bg-white dark:bg-gray-700 text-gray-900 dark:text-white shadow-sm":"text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-white hover:bg-gray-200 dark:hover:bg-gray-700"}`,children:a.jsxs("span",{className:"flex items-center gap-1 sm:gap-1.5",children:[a.jsx("svg",{className:"w-3 sm:w-3.5 h-3 sm:h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M8 12h.01M12 12h.01M16 12h.01M21 12c0 4.418-4.03 8-9 8a9.863 9.863 0 01-4.255-.949L3 20l1.395-3.72C3.512 15.042 3 13.574 3 12c0-4.418 4.03-8 9-8s9 3.582 9 8z"})}),a.jsx("span",{className:"hidden md:hidden lg:inline",children:T("tabs.chat")})]})})}),a.jsx(Pr,{content:T("tabs.shell"),position:"bottom",children:a.jsx("button",{onClick:()=>n("shell"),className:`relative px-2 sm:px-3 py-1.5 text-xs sm:text-sm font-medium rounded-md transition-all duration-200 ${r==="shell"?"bg-white dark:bg-gray-700 text-gray-900 dark:text-white shadow-sm":"text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-white hover:bg-gray-200 dark:hover:bg-gray-700"}`,children:a.jsxs("span",{className:"flex items-center gap-1 sm:gap-1.5",children:[a.jsx("svg",{className:"w-3 sm:w-3.5 h-3 sm:h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M8 9l3 3-3 3m5 0h3M5 20h14a2 2 0 002-2V6a2 2 0 00-2-2H5a2 2 0 00-2 2v14a2 2 0 002 2z"})}),a.jsx("span",{className:"hidden md:hidden lg:inline",children:T("tabs.shell")})]})})}),a.jsx(Pr,{content:T("tabs.files"),position:"bottom",children:a.jsx("button",{onClick:()=>n("files"),className:`relative px-2 sm:px-3 py-1.5 text-xs sm:text-sm font-medium rounded-md transition-all duration-200 ${r==="files"?"bg-white dark:bg-gray-700 text-gray-900 dark:text-white shadow-sm":"text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-white hover:bg-gray-200 dark:hover:bg-gray-700"}`,children:a.jsxs("span",{className:"flex items-center gap-1 sm:gap-1.5",children:[a.jsx("svg",{className:"w-3 sm:w-3.5 h-3 sm:h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M3 7v10a2 2 0 002 2h14a2 2 0 002-2V9a2 2 0 00-2-2h-5l-2-2H5a2 2 0 00-2 2z"})}),a.jsx("span",{className:"hidden md:hidden lg:inline",children:T("tabs.files")})]})})}),a.jsx(Pr,{content:T("tabs.git"),position:"bottom",children:a.jsx("button",{onClick:()=>n("git"),className:`relative px-2 sm:px-3 py-1.5 text-xs sm:text-sm font-medium rounded-md transition-all duration-200 ${r==="git"?"bg-white dark:bg-gray-700 text-gray-900 dark:text-white shadow-sm":"text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-white hover:bg-gray-200 dark:hover:bg-gray-700"}`,children:a.jsxs("span",{className:"flex items-center gap-1 sm:gap-1.5",children:[a.jsx("svg",{className:"w-3 sm:w-3.5 h-3 sm:h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M13 10V3L4 14h7v7l9-11h-7z"})}),a.jsx("span",{className:"hidden md:hidden lg:inline",children:T("tabs.git")})]})})}),Me&&a.jsx(Pr,{content:T("tabs.tasks"),position:"bottom",children:a.jsx("button",{onClick:()=>n("tasks"),className:`relative px-2 sm:px-3 py-1.5 text-xs sm:text-sm font-medium rounded-md transition-all duration-200 ${r==="tasks"?"bg-white dark:bg-gray-700 text-gray-900 dark:text-white shadow-sm":"text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-white hover:bg-gray-200 dark:hover:bg-gray-700"}`,children:a.jsxs("span",{className:"flex items-center gap-1 sm:gap-1.5",children:[a.jsx("svg",{className:"w-3 sm:w-3.5 h-3 sm:h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5H7a2 2 0 00-2 2v10a2 2 0 002 2h8a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4"})}),a.jsx("span",{className:"hidden md:hidden lg:inline",children:T("tabs.tasks")})]})})})]})})]})}),a.jsxs("div",{className:"flex-1 flex min-h-0 overflow-hidden",children:[a.jsxs("div",{className:`flex-1 flex flex-col min-h-0 overflow-hidden ${P?"mr-0":""} ${F?"hidden":""}`,children:[a.jsx("div",{className:`h-full ${r==="chat"?"block":"hidden"}`,children:a.jsx(AG,{showDetails:!0,children:a.jsx(Mq,{selectedProject:e,selectedSession:t,ws:i,sendMessage:s,messages:o,onFileOpen:mt,onInputFocusChange:p,onSessionActive:h,onSessionInactive:m,onSessionProcessing:g,onSessionNotProcessing:f,processingSessions:w,onReplaceTemporarySession:S,onNavigateToSession:k,onShowSettings:E,autoExpandTools:N,showRawParameters:C,showThinking:v,autoScrollToBottom:I,sendByCtrlEnter:M,externalMessageUpdate:j,onShowAllTasks:wt?()=>n("tasks"):null})})}),r==="files"&&a.jsx("div",{className:"h-full overflow-hidden",children:a.jsx(CG,{selectedProject:e})}),r==="shell"&&a.jsx("div",{className:"h-full w-full overflow-hidden",children:a.jsx(o3,{project:e,session:t,showHeader:!1})}),r==="git"&&a.jsx("div",{className:"h-full overflow-hidden",children:a.jsx(TG,{selectedProject:e,isMobile:l,onFileOpen:mt})}),Me&&a.jsx("div",{className:`h-full ${r==="tasks"?"block":"hidden"}`,children:a.jsx("div",{className:"h-full flex flex-col overflow-hidden",children:a.jsx(RG,{tasks:qe||[],onTaskClick:at,showParentTasks:!0,className:"flex-1 overflow-y-auto p-4",currentProject:ze,onTaskCreated:ct,onShowPRDEditor:(Y=null)=>{se(Y),me(!0)},existingPRDs:_e,onRefreshPRDs:(Y=!1)=>{ze?.name&&yt.get(`/taskmaster/prd/${encodeURIComponent(ze.name)}`).then(le=>le.ok?le.json():Promise.reject()).then(le=>{oe(le.prdFiles||[]),Y&&(Ie("PRD saved successfully!"),setTimeout(()=>Ie(null),3e3))}).catch(le=>console.error("Failed to refresh PRDs:",le))}})})}),a.jsx("div",{className:`h-full overflow-hidden ${r==="preview"?"block":"hidden"}`})]}),P&&!l&&a.jsxs(a.Fragment,{children:[!F&&a.jsx("div",{ref:_,onMouseDown:H,className:"flex-shrink-0 w-1 bg-gray-200 dark:bg-gray-700 hover:bg-blue-500 dark:hover:bg-blue-600 cursor-col-resize transition-colors relative group",title:"Drag to resize",children:a.jsx("div",{className:"absolute inset-y-0 left-1/2 -translate-x-1/2 w-1 bg-blue-500 dark:bg-blue-600 opacity-0 group-hover:opacity-100 transition-opacity"})}),a.jsx("div",{className:`flex-shrink-0 border-l border-gray-200 dark:border-gray-700 h-full overflow-hidden ${F?"flex-1":""}`,style:F?{}:{width:`${re}px`},children:a.jsx(Ih,{file:P,onClose:Pt,projectPath:e?.path,isSidebar:!0,isExpanded:F,onToggleExpand:xe})})]})]}),P&&l&&a.jsx(Ih,{file:P,onClose:Pt,projectPath:e?.path,isSidebar:!1}),Me&&U&&D&&a.jsx(IN,{task:D,isOpen:U,onClose:de,onStatusChange:Ee,onTaskClick:at}),Z&&a.jsx(jG,{project:ze,projectPath:ze?.fullPath||ze?.path,onClose:()=>{me(!1),se(null)},isNewFile:!ke?.isExisting,file:{name:ke?.name||"prd.txt",content:ke?.content||""},onSave:async()=>{me(!1),se(null);try{const Y=await yt.get(`/taskmaster/prd/${encodeURIComponent(ze.name)}`);if(Y.ok){const le=await Y.json();oe(le.prdFiles||[]),Ie("PRD saved successfully!"),setTimeout(()=>Ie(null),3e3)}}catch(Y){console.error("Failed to refresh PRDs:",Y)}ct?.()}}),fe&&a.jsx("div",{className:"fixed bottom-4 right-4 z-50 animate-in slide-in-from-bottom-2 duration-300",children:a.jsxs("div",{className:"bg-green-600 text-white px-4 py-3 rounded-lg shadow-lg flex items-center gap-3",children:[a.jsx("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})}),a.jsx("span",{className:"font-medium",children:fe})]})})]}):a.jsxs("div",{className:"h-full flex flex-col",children:[l&&a.jsx("div",{className:"bg-background border-b border-border p-2 sm:p-3 pwa-header-safe flex-shrink-0",children:a.jsx("button",{onClick:d,className:"p-2 text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-white rounded-md hover:bg-gray-100 dark:hover:bg-gray-700 pwa-menu-button",children:a.jsx("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 6h16M4 12h16M4 18h16"})})})}),a.jsx("div",{className:"flex-1 flex items-center justify-center",children:a.jsxs("div",{className:"text-center text-gray-500 dark:text-gray-400 max-w-md mx-auto px-6",children:[a.jsx("div",{className:"w-16 h-16 mx-auto mb-6 bg-gray-100 dark:bg-gray-800 rounded-full flex items-center justify-center",children:a.jsx("svg",{className:"w-8 h-8 text-gray-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M3 7v10a2 2 0 002 2h14a2 2 0 002-2V9a2 2 0 00-2-2h-5l-2-2H5a2 2 0 00-2 2z"})})}),a.jsx("h2",{className:"text-2xl font-semibold mb-3 text-gray-900 dark:text-white",children:T("mainContent.chooseProject")}),a.jsx("p",{className:"text-gray-600 dark:text-gray-300 mb-6 leading-relaxed",children:T("mainContent.selectProjectDescription")}),a.jsx("div",{className:"bg-blue-50 dark:bg-blue-900/20 rounded-lg p-4 border border-blue-200 dark:border-blue-800",children:a.jsxs("p",{className:"text-sm text-blue-700 dark:text-blue-300",children:["💡 ",a.jsxs("strong",{children:[T("mainContent.tip"),":"]})," ",T(l?"mainContent.createProjectMobile":"mainContent.createProjectDesktop")]})})]})})]})}const LG=ir.memo(_G);function OG({activeTab:e,setActiveTab:t,isInputFocused:r}){const{tasksEnabled:n}=os(),i=[{id:"chat",icon:Wi,onClick:()=>t("chat")},{id:"shell",icon:pa,onClick:()=>t("shell")},{id:"files",icon:ca,onClick:()=>t("files")},{id:"git",icon:qn,onClick:()=>t("git")},...n?[{id:"tasks",icon:W6,onClick:()=>t("tasks")}]:[]];return a.jsx("div",{className:`fixed bottom-0 left-0 right-0 bg-background border-t border-border z-50 ios-bottom-safe transform transition-transform duration-300 ease-in-out shadow-lg ${r?"translate-y-full":"translate-y-0"}`,children:a.jsx("div",{className:"flex items-center justify-around py-1",children:i.map(s=>{const o=s.icon,l=e===s.id;return a.jsxs("button",{onClick:s.onClick,onTouchStart:c=>{c.preventDefault(),s.onClick()},className:`flex items-center justify-center p-2 rounded-lg min-h-[40px] min-w-[40px] relative touch-manipulation ${l?"text-blue-600 dark:text-blue-400":"text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-white"}`,"aria-label":s.id,children:[a.jsx(o,{className:"w-5 h-5"}),l&&a.jsx("div",{className:"absolute top-0 left-1/2 transform -translate-x-1/2 w-6 h-0.5 bg-blue-600 dark:bg-blue-400 rounded-full"})]},s.id)})})})}const Rh="1.14.0",l3=(e,t)=>{const[r,n]=x.useState(!1),[i,s]=x.useState(null),[o,l]=x.useState(null);return x.useEffect(()=>{const c=async()=>{try{const p=await(await fetch(`https://api.github.com/repos/${e}/${t}/releases/latest`)).json();if(p.tag_name){const h=p.tag_name.replace(/^v/,"");s(h),n(Rh!==h),l({title:p.name||p.tag_name,body:p.body||"",htmlUrl:p.html_url||`https://github.com/${e}/${t}/releases/latest`,publishedAt:p.published_at})}else n(!1),s(null),l(null)}catch(u){console.error("Version check failed:",u),n(!1),s(null),l(null)}};c();const d=setInterval(c,300*1e3);return()=>clearInterval(d)},[e,t]),{updateAvailable:r,latestVersion:i,currentVersion:Rh,releaseInfo:o}};function DG(){const{t:e}=Ht("settings"),[t,r]=x.useState([]),[n,i]=x.useState([]),[s,o]=x.useState(!0),[l,c]=x.useState(!1),[d,u]=x.useState(!1),[p,h]=x.useState(""),[m,g]=x.useState(""),[f,w]=x.useState(""),[S,k]=x.useState(""),[E,N]=x.useState({}),[C,v]=x.useState(null),[I,M]=x.useState(null),{updateAvailable:j,latestVersion:T,releaseInfo:P}=l3("siteboon","claudecodeui");x.useEffect(()=>{q()},[]);const q=async()=>{try{o(!0);const F=await(await Ce("/api/settings/api-keys")).json();r(F.apiKeys||[]);const _=await(await Ce("/api/settings/credentials?type=github_token")).json();i(_.credentials||[])}catch(R){console.error("Error fetching settings:",R)}finally{o(!1)}},D=async()=>{if(p.trim())try{const F=await(await Ce("/api/settings/api-keys",{method:"POST",body:JSON.stringify({keyName:p})})).json();F.success&&(M(F.apiKey),h(""),c(!1),q())}catch(R){console.error("Error creating API key:",R)}},z=async R=>{if(confirm(e("apiKeys.confirmDelete")))try{await Ce(`/api/settings/api-keys/${R}`,{method:"DELETE"}),q()}catch(F){console.error("Error deleting API key:",F)}},U=async(R,F)=>{try{await Ce(`/api/settings/api-keys/${R}/toggle`,{method:"PATCH",body:JSON.stringify({isActive:!F})}),q()}catch(te){console.error("Error toggling API key:",te)}},G=async()=>{if(!(!m.trim()||!f.trim()))try{(await(await Ce("/api/settings/credentials",{method:"POST",body:JSON.stringify({credentialName:m,credentialType:"github_token",credentialValue:f,description:S})})).json()).success&&(g(""),w(""),k(""),u(!1),q())}catch(R){console.error("Error creating GitHub credential:",R)}},re=async R=>{if(confirm(e("apiKeys.github.confirmDelete")))try{await Ce(`/api/settings/credentials/${R}`,{method:"DELETE"}),q()}catch(F){console.error("Error deleting GitHub credential:",F)}},K=async(R,F)=>{try{await Ce(`/api/settings/credentials/${R}/toggle`,{method:"PATCH",body:JSON.stringify({isActive:!F})}),q()}catch(te){console.error("Error toggling GitHub credential:",te)}},ue=(R,F)=>{navigator.clipboard.writeText(R),v(F),setTimeout(()=>v(null),2e3)};return s?a.jsx("div",{className:"text-muted-foreground",children:e("apiKeys.loading")}):a.jsxs("div",{className:"space-y-8",children:[I&&a.jsxs("div",{className:"p-4 bg-yellow-500/10 border border-yellow-500/20 rounded-lg",children:[a.jsx("h4",{className:"font-semibold text-yellow-500 mb-2",children:e("apiKeys.newKey.alertTitle")}),a.jsx("p",{className:"text-sm text-muted-foreground mb-3",children:e("apiKeys.newKey.alertMessage")}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("code",{className:"flex-1 px-3 py-2 bg-background/50 rounded font-mono text-sm break-all",children:I.apiKey}),a.jsx(Be,{size:"sm",variant:"outline",onClick:()=>ue(I.apiKey,"new"),children:C==="new"?a.jsx(Cr,{className:"h-4 w-4"}):a.jsx(u4,{className:"h-4 w-4"})})]}),a.jsx(Be,{size:"sm",variant:"ghost",className:"mt-3",onClick:()=>M(null),children:e("apiKeys.newKey.iveSavedIt")})]}),a.jsxs("div",{children:[a.jsxs("div",{className:"flex items-center justify-between mb-4",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(Fh,{className:"h-5 w-5"}),a.jsx("h3",{className:"text-lg font-semibold",children:e("apiKeys.title")})]}),a.jsxs(Be,{size:"sm",onClick:()=>c(!l),children:[a.jsx(gr,{className:"h-4 w-4 mr-1"}),e("apiKeys.newButton")]})]}),a.jsxs("div",{className:"mb-4",children:[a.jsx("p",{className:"text-sm text-muted-foreground mb-2",children:e("apiKeys.description")}),a.jsxs("a",{href:"/api-docs.html",target:"_blank",rel:"noopener noreferrer",className:"text-sm text-primary hover:underline inline-flex items-center gap-1",children:[e("apiKeys.apiDocsLink"),a.jsx(of,{className:"h-3 w-3"})]})]}),l&&a.jsxs("div",{className:"mb-4 p-4 border rounded-lg bg-card",children:[a.jsx(tr,{placeholder:e("apiKeys.form.placeholder"),value:p,onChange:R=>h(R.target.value),className:"mb-2"}),a.jsxs("div",{className:"flex gap-2",children:[a.jsx(Be,{onClick:D,children:e("apiKeys.form.createButton")}),a.jsx(Be,{variant:"outline",onClick:()=>c(!1),children:e("apiKeys.form.cancelButton")})]})]}),a.jsx("div",{className:"space-y-2",children:t.length===0?a.jsx("p",{className:"text-sm text-muted-foreground italic",children:e("apiKeys.empty")}):t.map(R=>a.jsxs("div",{className:"flex items-center justify-between p-3 border rounded-lg",children:[a.jsxs("div",{className:"flex-1",children:[a.jsx("div",{className:"font-medium",children:R.key_name}),a.jsx("code",{className:"text-xs text-muted-foreground",children:R.api_key}),a.jsxs("div",{className:"text-xs text-muted-foreground mt-1",children:[e("apiKeys.list.created")," ",new Date(R.created_at).toLocaleDateString(),R.last_used&&` • ${e("apiKeys.list.lastUsed")} ${new Date(R.last_used).toLocaleDateString()}`]})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(Be,{size:"sm",variant:R.is_active?"outline":"secondary",onClick:()=>U(R.id,R.is_active),children:R.is_active?e("apiKeys.status.active"):e("apiKeys.status.inactive")}),a.jsx(Be,{size:"sm",variant:"ghost",onClick:()=>z(R.id),children:a.jsx(Nr,{className:"h-4 w-4"})})]})]},R.id))})]}),a.jsxs("div",{children:[a.jsxs("div",{className:"flex items-center justify-between mb-4",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(s6,{className:"h-5 w-5"}),a.jsx("h3",{className:"text-lg font-semibold",children:e("apiKeys.github.title")})]}),a.jsxs(Be,{size:"sm",onClick:()=>u(!d),children:[a.jsx(gr,{className:"h-4 w-4 mr-1"}),e("apiKeys.github.addButton")]})]}),a.jsx("p",{className:"text-sm text-muted-foreground mb-4",children:e("apiKeys.github.descriptionAlt")}),d&&a.jsxs("div",{className:"mb-4 p-4 border rounded-lg bg-card space-y-3",children:[a.jsx(tr,{placeholder:e("apiKeys.github.form.namePlaceholder"),value:m,onChange:R=>g(R.target.value)}),a.jsxs("div",{className:"relative",children:[a.jsx(tr,{type:E.new?"text":"password",placeholder:e("apiKeys.github.form.tokenPlaceholder"),value:f,onChange:R=>w(R.target.value),className:"pr-10"}),a.jsx("button",{type:"button",onClick:()=>N({...E,new:!E.new}),className:"absolute right-3 top-2.5 text-muted-foreground hover:text-foreground",children:E.new?a.jsx(p4,{className:"h-4 w-4"}):a.jsx(hi,{className:"h-4 w-4"})})]}),a.jsx(tr,{placeholder:e("apiKeys.github.form.descriptionPlaceholder"),value:S,onChange:R=>k(R.target.value)}),a.jsxs("div",{className:"flex gap-2",children:[a.jsx(Be,{onClick:G,children:e("apiKeys.github.form.addButton")}),a.jsx(Be,{variant:"outline",onClick:()=>{u(!1),g(""),w(""),k("")},children:e("apiKeys.github.form.cancelButton")})]}),a.jsx("a",{href:"https://github.com/settings/tokens",target:"_blank",rel:"noopener noreferrer",className:"text-xs text-primary hover:underline block",children:e("apiKeys.github.form.howToCreate")})]}),a.jsx("div",{className:"space-y-2",children:n.length===0?a.jsx("p",{className:"text-sm text-muted-foreground italic",children:e("apiKeys.github.empty")}):n.map(R=>a.jsxs("div",{className:"flex items-center justify-between p-3 border rounded-lg",children:[a.jsxs("div",{className:"flex-1",children:[a.jsx("div",{className:"font-medium",children:R.credential_name}),R.description&&a.jsx("div",{className:"text-xs text-muted-foreground",children:R.description}),a.jsxs("div",{className:"text-xs text-muted-foreground mt-1",children:[e("apiKeys.github.added")," ",new Date(R.created_at).toLocaleDateString()]})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(Be,{size:"sm",variant:R.is_active?"outline":"secondary",onClick:()=>K(R.id,R.is_active),children:R.is_active?e("apiKeys.status.active"):e("apiKeys.status.inactive")}),a.jsx(Be,{size:"sm",variant:"ghost",onClick:()=>re(R.id),children:a.jsx(Nr,{className:"h-4 w-4"})})]})]},R.id))})]}),a.jsx("div",{className:"pt-6 border-t border-border/50",children:a.jsxs("div",{className:"flex items-center justify-between text-xs italic text-muted-foreground/60",children:[a.jsxs("a",{href:P?.htmlUrl||"https://github.com/siteboon/claudecodeui/releases",target:"_blank",rel:"noopener noreferrer",className:"hover:text-muted-foreground transition-colors",children:["v",Rh]}),j&&T&&a.jsxs("a",{href:P?.htmlUrl||"https://github.com/siteboon/claudecodeui/releases",target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-1.5 px-2 py-0.5 bg-green-500/10 text-green-600 dark:text-green-400 rounded-full hover:bg-green-500/20 transition-colors not-italic font-medium",children:[a.jsx("span",{className:"text-[10px]",children:e("apiKeys.version.updateAvailable",{version:T})}),a.jsx(of,{className:"h-2.5 w-2.5"})]})]})})]})}function MG(){const{t:e}=Ht("settings"),[t,r]=x.useState(""),[n,i]=x.useState(""),[s,o]=x.useState(!1),[l,c]=x.useState(!1),[d,u]=x.useState(null);x.useEffect(()=>{p()},[]);const p=async()=>{try{o(!0);const m=await Ce("/api/user/git-config");if(m.ok){const g=await m.json();r(g.gitName||""),i(g.gitEmail||"")}}catch(m){console.error("Error loading git config:",m)}finally{o(!1)}},h=async()=>{try{c(!0);const m=await Ce("/api/user/git-config",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({gitName:t,gitEmail:n})});if(m.ok)u("success"),setTimeout(()=>u(null),3e3);else{const g=await m.json();u("error"),console.error("Failed to save git config:",g.error)}}catch(m){console.error("Error saving git config:",m),u("error")}finally{c(!1)}};return a.jsx("div",{className:"space-y-8",children:a.jsxs("div",{children:[a.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[a.jsx(qn,{className:"h-5 w-5"}),a.jsx("h3",{className:"text-lg font-semibold",children:e("git.title")})]}),a.jsx("p",{className:"text-sm text-muted-foreground mb-4",children:e("git.description")}),a.jsxs("div",{className:"p-4 border rounded-lg bg-card space-y-3",children:[a.jsxs("div",{children:[a.jsx("label",{htmlFor:"settings-git-name",className:"block text-sm font-medium text-foreground mb-2",children:e("git.name.label")}),a.jsx(tr,{id:"settings-git-name",type:"text",value:t,onChange:m=>r(m.target.value),placeholder:"John Doe",disabled:s,className:"w-full"}),a.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:e("git.name.help")})]}),a.jsxs("div",{children:[a.jsx("label",{htmlFor:"settings-git-email",className:"block text-sm font-medium text-foreground mb-2",children:e("git.email.label")}),a.jsx(tr,{id:"settings-git-email",type:"email",value:n,onChange:m=>i(m.target.value),placeholder:"john@example.com",disabled:s,className:"w-full"}),a.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:e("git.email.help")})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(Be,{onClick:h,disabled:l||!t||!n,children:e(l?"git.actions.saving":"git.actions.save")}),d==="success"&&a.jsxs("div",{className:"text-sm text-green-600 dark:text-green-400 flex items-center gap-2",children:[a.jsx(Cr,{className:"w-4 h-4"}),e("git.status.success")]})]})]})]})})}function FG(){const{t:e}=Ht("settings"),{tasksEnabled:t,setTasksEnabled:r,isTaskMasterInstalled:n,isCheckingInstallation:i}=os();return a.jsx("div",{className:"space-y-8",children:i?a.jsx("div",{className:"bg-gray-50 dark:bg-gray-900/50 border border-gray-200 dark:border-gray-700 rounded-lg p-4",children:a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("div",{className:"animate-spin w-5 h-5 border-2 border-blue-600 border-t-transparent rounded-full"}),a.jsx("span",{className:"text-sm text-muted-foreground",children:e("tasks.checking")})]})}):a.jsxs(a.Fragment,{children:[!n&&a.jsx("div",{className:"bg-orange-50 dark:bg-orange-950/50 border border-orange-200 dark:border-orange-800 rounded-lg p-4",children:a.jsxs("div",{className:"flex items-start gap-3",children:[a.jsx("div",{className:"w-8 h-8 bg-orange-100 dark:bg-orange-900 rounded-full flex items-center justify-center flex-shrink-0 mt-0.5",children:a.jsx("svg",{className:"w-4 h-4 text-orange-600 dark:text-orange-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-2.5L13.732 4c-.77-.833-1.964-.833-2.732 0L4.082 16.5c-.77.833.192 2.5 1.732 2.5z"})})}),a.jsxs("div",{className:"flex-1",children:[a.jsx("div",{className:"font-medium text-orange-900 dark:text-orange-100 mb-2",children:e("tasks.notInstalled.title")}),a.jsxs("div",{className:"text-sm text-orange-800 dark:text-orange-200 space-y-3",children:[a.jsx("p",{children:e("tasks.notInstalled.description")}),a.jsx("div",{className:"bg-orange-100 dark:bg-orange-900/50 rounded-lg p-3 font-mono text-sm",children:a.jsx("code",{children:e("tasks.notInstalled.installCommand")})}),a.jsx("div",{children:a.jsxs("a",{href:"https://github.com/eyaltoledano/claude-task-master",target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-2 text-blue-600 dark:text-blue-400 hover:text-blue-700 dark:hover:text-blue-300 font-medium text-sm",children:[a.jsx("svg",{className:"w-4 h-4",fill:"currentColor",viewBox:"0 0 20 20",children:a.jsx("path",{fillRule:"evenodd",d:"M10 0C4.477 0 0 4.484 0 10.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 0110 4.844c.85.004 1.705.115 2.504.337 1.909-1.296 2.747-1.027 2.747-1.027.546 1.379.203 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.942.359.31.678.921.678 1.856 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.019 10.019 0 0020 10.017C20 4.484 15.522 0 10 0z",clipRule:"evenodd"})}),e("tasks.notInstalled.viewOnGitHub"),a.jsx("svg",{className:"w-3 h-3",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:a.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"})})]})}),a.jsxs("div",{className:"space-y-2",children:[a.jsx("p",{className:"font-medium",children:e("tasks.notInstalled.afterInstallation")}),a.jsxs("ol",{className:"list-decimal list-inside space-y-1 text-xs",children:[a.jsx("li",{children:e("tasks.notInstalled.steps.restart")}),a.jsx("li",{children:e("tasks.notInstalled.steps.autoAvailable")}),a.jsx("li",{children:e("tasks.notInstalled.steps.initCommand")})]})]})]})]})]})}),n&&a.jsx("div",{className:"space-y-4",children:a.jsx("div",{className:"bg-gray-50 dark:bg-gray-900/50 border border-gray-200 dark:border-gray-700 rounded-lg p-4",children:a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{children:[a.jsx("div",{className:"font-medium text-foreground",children:e("tasks.settings.enableLabel")}),a.jsx("div",{className:"text-sm text-muted-foreground mt-1",children:e("tasks.settings.enableDescription")})]}),a.jsxs("label",{className:"relative inline-flex items-center cursor-pointer",children:[a.jsx("input",{type:"checkbox",checked:t,onChange:s=>r(s.target.checked),className:"sr-only peer"}),a.jsx("div",{className:"w-11 h-6 bg-gray-200 peer-focus:outline-none peer-focus:ring-4 peer-focus:ring-blue-300 dark:peer-focus:ring-blue-800 rounded-full peer dark:bg-gray-700 peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white after:border-gray-300 after:border after:rounded-full after:h-5 after:w-5 after:transition-all dark:border-gray-600 peer-checked:bg-blue-600"})]})]})})})]})})}function c3({isOpen:e,onClose:t,provider:r="claude",project:n,onComplete:i,customCommand:s,isAuthenticated:o=!1}){if(!e)return null;const l=()=>{if(s)return s;const u=!1;switch(r){case"claude":return o?"claude setup-token --dangerously-skip-permissions":"claude /login --dangerously-skip-permissions";case"cursor":return"cursor-agent login";case"codex":return u?"codex login --device-auth":"codex login";default:return o?"claude setup-token --dangerously-skip-permissions":"claude /login --dangerously-skip-permissions"}},c=()=>{switch(r){case"claude":return"Claude CLI Login";case"cursor":return"Cursor CLI Login";case"codex":return"Codex CLI Login";default:return"CLI Login"}},d=u=>{i&&i(u),u===0&&t()};return a.jsx("div",{className:"fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-[9999] max-md:items-stretch max-md:justify-stretch",children:a.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow-xl w-full max-w-4xl h-3/4 flex flex-col md:max-w-4xl md:h-3/4 md:rounded-lg md:m-4 max-md:max-w-none max-md:h-full max-md:rounded-none max-md:m-0",children:[a.jsxs("div",{className:"flex items-center justify-between p-4 border-b border-gray-200 dark:border-gray-700",children:[a.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white",children:c()}),a.jsx("button",{onClick:t,className:"text-gray-400 hover:text-gray-600 dark:hover:text-gray-300 transition-colors","aria-label":"Close login modal",children:a.jsx(Bt,{className:"w-6 h-6"})})]}),a.jsx("div",{className:"flex-1 overflow-hidden",children:a.jsx(o3,{project:n,command:l(),onComplete:d,minimal:!0})})]})})}const PG={claude:{name:"Claude",color:"blue",Logo:nn},cursor:{name:"Cursor",color:"purple",Logo:pn},codex:{name:"Codex",color:"gray",Logo:wn}},BG={blue:{border:"border-l-blue-500 md:border-l-blue-500",borderBottom:"border-b-blue-500",bg:"bg-blue-50 dark:bg-blue-900/20",dot:"bg-blue-500"},purple:{border:"border-l-purple-500 md:border-l-purple-500",borderBottom:"border-b-purple-500",bg:"bg-purple-50 dark:bg-purple-900/20",dot:"bg-purple-500"},gray:{border:"border-l-gray-700 dark:border-l-gray-300",borderBottom:"border-b-gray-700 dark:border-b-gray-300",bg:"bg-gray-100 dark:bg-gray-800/50",dot:"bg-gray-700 dark:bg-gray-300"}};function Ya({agentId:e,authStatus:t,isSelected:r,onClick:n,isMobile:i=!1}){const{t:s}=Ht("settings"),o=PG[e],l=BG[o.color],{Logo:c}=o;return i?a.jsx("button",{onClick:n,className:`flex-1 text-center py-3 px-2 border-b-2 transition-colors ${r?`${l.borderBottom} ${l.bg}`:"border-transparent hover:bg-gray-50 dark:hover:bg-gray-800"}`,children:a.jsxs("div",{className:"flex flex-col items-center gap-1",children:[a.jsx(c,{className:"w-5 h-5"}),a.jsx("span",{className:"text-xs font-medium text-foreground",children:o.name}),t?.authenticated&&a.jsx("span",{className:`w-1.5 h-1.5 rounded-full ${l.dot}`})]})}):a.jsxs("button",{onClick:n,className:`w-full text-left p-3 border-l-4 transition-colors ${r?`${l.border} ${l.bg}`:"border-transparent hover:bg-gray-50 dark:hover:bg-gray-800"}`,children:[a.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[a.jsx(c,{className:"w-4 h-4"}),a.jsx("span",{className:"font-medium text-foreground",children:o.name})]}),a.jsx("div",{className:"text-xs text-muted-foreground pl-6",children:t?.loading?a.jsx("span",{className:"text-gray-400",children:s("agents.authStatus.checking")}):t?.authenticated?a.jsxs("div",{className:"flex items-center gap-1",children:[a.jsx("span",{className:`w-1.5 h-1.5 rounded-full ${l.dot}`}),a.jsx("span",{className:"truncate max-w-[120px]",title:t.email,children:t.email||s("agents.authStatus.connected")})]}):a.jsxs("div",{className:"flex items-center gap-1",children:[a.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-gray-400"}),a.jsx("span",{children:s("agents.authStatus.notConnected")})]})})]})}const zG={claude:{name:"Claude",description:"Anthropic Claude AI assistant",Logo:nn,bgClass:"bg-blue-50 dark:bg-blue-900/20",borderClass:"border-blue-200 dark:border-blue-800",textClass:"text-blue-900 dark:text-blue-100",subtextClass:"text-blue-700 dark:text-blue-300",buttonClass:"bg-blue-600 hover:bg-blue-700"},cursor:{name:"Cursor",description:"Cursor AI-powered code editor",Logo:pn,bgClass:"bg-purple-50 dark:bg-purple-900/20",borderClass:"border-purple-200 dark:border-purple-800",textClass:"text-purple-900 dark:text-purple-100",subtextClass:"text-purple-700 dark:text-purple-300",buttonClass:"bg-purple-600 hover:bg-purple-700"},codex:{name:"Codex",description:"OpenAI Codex AI assistant",Logo:wn,bgClass:"bg-gray-100 dark:bg-gray-800/50",borderClass:"border-gray-300 dark:border-gray-600",textClass:"text-gray-900 dark:text-gray-100",subtextClass:"text-gray-700 dark:text-gray-300",buttonClass:"bg-gray-800 hover:bg-gray-900 dark:bg-gray-700 dark:hover:bg-gray-600"}};function UG({agent:e,authStatus:t,onLogin:r}){const{t:n}=Ht("settings"),i=zG[e],{Logo:s}=i;return a.jsxs("div",{className:"space-y-6",children:[a.jsxs("div",{className:"flex items-center gap-3 mb-4",children:[a.jsx(s,{className:"w-6 h-6"}),a.jsxs("div",{children:[a.jsx("h3",{className:"text-lg font-medium text-foreground",children:i.name}),a.jsx("p",{className:"text-sm text-muted-foreground",children:n(`agents.account.${e}.description`)})]})]}),a.jsx("div",{className:`${i.bgClass} border ${i.borderClass} rounded-lg p-4`,children:a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsxs("div",{className:"flex-1",children:[a.jsx("div",{className:`font-medium ${i.textClass}`,children:n("agents.connectionStatus")}),a.jsx("div",{className:`text-sm ${i.subtextClass}`,children:t?.loading?n("agents.authStatus.checkingAuth"):t?.authenticated?n("agents.authStatus.loggedInAs",{email:t.email||n("agents.authStatus.authenticatedUser")}):n("agents.authStatus.notConnected")})]}),a.jsx("div",{children:t?.loading?a.jsx(mn,{variant:"secondary",className:"bg-gray-100 dark:bg-gray-800",children:n("agents.authStatus.checking")}):t?.authenticated?a.jsx(mn,{variant:"success",className:"bg-green-100 text-green-800 dark:bg-green-900/30 dark:text-green-300",children:n("agents.authStatus.connected")}):a.jsx(mn,{variant:"secondary",className:"bg-gray-100 text-gray-800 dark:bg-gray-800 dark:text-gray-300",children:n("agents.authStatus.disconnected")})})]}),a.jsx("div",{className:"border-t border-gray-200 dark:border-gray-700 pt-4",children:a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{children:[a.jsx("div",{className:`font-medium ${i.textClass}`,children:t?.authenticated?n("agents.login.reAuthenticate"):n("agents.login.title")}),a.jsx("div",{className:`text-sm ${i.subtextClass}`,children:t?.authenticated?n("agents.login.reAuthDescription"):n("agents.login.description",{agent:i.name})})]}),a.jsxs(Be,{onClick:r,className:`${i.buttonClass} text-white`,size:"sm",children:[a.jsx(g4,{className:"w-4 h-4 mr-2"}),t?.authenticated?n("agents.login.reLoginButton"):n("agents.login.button")]})]})}),t?.error&&a.jsx("div",{className:"border-t border-gray-200 dark:border-gray-700 pt-4",children:a.jsx("div",{className:"text-sm text-red-600 dark:text-red-400",children:n("agents.error",{error:t.error})})})]})})]})}const $G=["Bash(git log:*)","Bash(git diff:*)","Bash(git status:*)","Write","Read","Edit","Glob","Grep","MultiEdit","Task","TodoWrite","TodoRead","WebFetch","WebSearch"],qG=["Shell(ls)","Shell(mkdir)","Shell(cd)","Shell(cat)","Shell(echo)","Shell(git status)","Shell(git diff)","Shell(git log)","Shell(npm install)","Shell(npm run)","Shell(python)","Shell(node)"];function GG({skipPermissions:e,setSkipPermissions:t,allowedTools:r,setAllowedTools:n,disallowedTools:i,setDisallowedTools:s,newAllowedTool:o,setNewAllowedTool:l,newDisallowedTool:c,setNewDisallowedTool:d}){const{t:u}=Ht("settings"),p=f=>{f&&!r.includes(f)&&(n([...r,f]),l(""))},h=f=>{n(r.filter(w=>w!==f))},m=f=>{f&&!i.includes(f)&&(s([...i,f]),d(""))},g=f=>{s(i.filter(w=>w!==f))};return a.jsxs("div",{className:"space-y-6",children:[a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx(Vn,{className:"w-5 h-5 text-orange-500"}),a.jsx("h3",{className:"text-lg font-medium text-foreground",children:u("permissions.title")})]}),a.jsx("div",{className:"bg-orange-50 dark:bg-orange-900/20 border border-orange-200 dark:border-orange-800 rounded-lg p-4",children:a.jsxs("label",{className:"flex items-center gap-3",children:[a.jsx("input",{type:"checkbox",checked:e,onChange:f=>t(f.target.checked),className:"w-4 h-4 text-blue-600 bg-gray-100 dark:bg-gray-700 border-gray-300 dark:border-gray-600 rounded focus:ring-blue-500 focus:ring-2"}),a.jsxs("div",{children:[a.jsx("div",{className:"font-medium text-orange-900 dark:text-orange-100",children:u("permissions.skipPermissions.label")}),a.jsx("div",{className:"text-sm text-orange-700 dark:text-orange-300",children:u("permissions.skipPermissions.claudeDescription")})]})]})})]}),a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx(Bh,{className:"w-5 h-5 text-green-500"}),a.jsx("h3",{className:"text-lg font-medium text-foreground",children:u("permissions.allowedTools.title")})]}),a.jsx("p",{className:"text-sm text-muted-foreground",children:u("permissions.allowedTools.description")}),a.jsxs("div",{className:"flex flex-col sm:flex-row gap-2",children:[a.jsx(tr,{value:o,onChange:f=>l(f.target.value),placeholder:u("permissions.allowedTools.placeholder"),onKeyPress:f=>{f.key==="Enter"&&(f.preventDefault(),p(o))},className:"flex-1 h-10"}),a.jsxs(Be,{onClick:()=>p(o),disabled:!o,size:"sm",className:"h-10 px-4",children:[a.jsx(gr,{className:"w-4 h-4 mr-2 sm:mr-0"}),a.jsx("span",{className:"sm:hidden",children:u("permissions.actions.add")})]})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx("p",{className:"text-sm font-medium text-gray-700 dark:text-gray-300",children:u("permissions.allowedTools.quickAdd")}),a.jsx("div",{className:"flex flex-wrap gap-2",children:$G.map(f=>a.jsx(Be,{variant:"outline",size:"sm",onClick:()=>p(f),disabled:r.includes(f),className:"text-xs h-8",children:f},f))})]}),a.jsxs("div",{className:"space-y-2",children:[r.map(f=>a.jsxs("div",{className:"flex items-center justify-between bg-green-50 dark:bg-green-900/20 border border-green-200 dark:border-green-800 rounded-lg p-3",children:[a.jsx("span",{className:"font-mono text-sm text-green-800 dark:text-green-200",children:f}),a.jsx(Be,{variant:"ghost",size:"sm",onClick:()=>h(f),className:"text-green-600 hover:text-green-700",children:a.jsx(Bt,{className:"w-4 h-4"})})]},f)),r.length===0&&a.jsx("div",{className:"text-center py-6 text-gray-500 dark:text-gray-400",children:u("permissions.allowedTools.empty")})]})]}),a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx(Vn,{className:"w-5 h-5 text-red-500"}),a.jsx("h3",{className:"text-lg font-medium text-foreground",children:u("permissions.blockedTools.title")})]}),a.jsx("p",{className:"text-sm text-muted-foreground",children:u("permissions.blockedTools.description")}),a.jsxs("div",{className:"flex flex-col sm:flex-row gap-2",children:[a.jsx(tr,{value:c,onChange:f=>d(f.target.value),placeholder:u("permissions.blockedTools.placeholder"),onKeyPress:f=>{f.key==="Enter"&&(f.preventDefault(),m(c))},className:"flex-1 h-10"}),a.jsxs(Be,{onClick:()=>m(c),disabled:!c,size:"sm",className:"h-10 px-4",children:[a.jsx(gr,{className:"w-4 h-4 mr-2 sm:mr-0"}),a.jsx("span",{className:"sm:hidden",children:u("permissions.actions.add")})]})]}),a.jsxs("div",{className:"space-y-2",children:[i.map(f=>a.jsxs("div",{className:"flex items-center justify-between bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800 rounded-lg p-3",children:[a.jsx("span",{className:"font-mono text-sm text-red-800 dark:text-red-200",children:f}),a.jsx(Be,{variant:"ghost",size:"sm",onClick:()=>g(f),className:"text-red-600 hover:text-red-700",children:a.jsx(Bt,{className:"w-4 h-4"})})]},f)),i.length===0&&a.jsx("div",{className:"text-center py-6 text-gray-500 dark:text-gray-400",children:u("permissions.blockedTools.empty")})]})]}),a.jsxs("div",{className:"bg-blue-50 dark:bg-blue-900/20 border border-blue-200 dark:border-blue-800 rounded-lg p-4",children:[a.jsx("h4",{className:"font-medium text-blue-900 dark:text-blue-100 mb-2",children:u("permissions.toolExamples.title")}),a.jsxs("ul",{className:"text-sm text-blue-800 dark:text-blue-200 space-y-1",children:[a.jsxs("li",{children:[a.jsx("code",{className:"bg-blue-100 dark:bg-blue-800 px-1 rounded",children:'"Bash(git log:*)"'})," ",u("permissions.toolExamples.bashGitLog")]}),a.jsxs("li",{children:[a.jsx("code",{className:"bg-blue-100 dark:bg-blue-800 px-1 rounded",children:'"Bash(git diff:*)"'})," ",u("permissions.toolExamples.bashGitDiff")]}),a.jsxs("li",{children:[a.jsx("code",{className:"bg-blue-100 dark:bg-blue-800 px-1 rounded",children:'"Write"'})," ",u("permissions.toolExamples.write")]}),a.jsxs("li",{children:[a.jsx("code",{className:"bg-blue-100 dark:bg-blue-800 px-1 rounded",children:'"Bash(rm:*)"'})," ",u("permissions.toolExamples.bashRm")]})]})]})]})}function HG({skipPermissions:e,setSkipPermissions:t,allowedCommands:r,setAllowedCommands:n,disallowedCommands:i,setDisallowedCommands:s,newAllowedCommand:o,setNewAllowedCommand:l,newDisallowedCommand:c,setNewDisallowedCommand:d}){const{t:u}=Ht("settings"),p=f=>{f&&!r.includes(f)&&(n([...r,f]),l(""))},h=f=>{n(r.filter(w=>w!==f))},m=f=>{f&&!i.includes(f)&&(s([...i,f]),d(""))},g=f=>{s(i.filter(w=>w!==f))};return a.jsxs("div",{className:"space-y-6",children:[a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx(Vn,{className:"w-5 h-5 text-orange-500"}),a.jsx("h3",{className:"text-lg font-medium text-foreground",children:u("permissions.title")})]}),a.jsx("div",{className:"bg-orange-50 dark:bg-orange-900/20 border border-orange-200 dark:border-orange-800 rounded-lg p-4",children:a.jsxs("label",{className:"flex items-center gap-3",children:[a.jsx("input",{type:"checkbox",checked:e,onChange:f=>t(f.target.checked),className:"w-4 h-4 text-purple-600 bg-gray-100 dark:bg-gray-700 border-gray-300 dark:border-gray-600 rounded focus:ring-purple-500 focus:ring-2"}),a.jsxs("div",{children:[a.jsx("div",{className:"font-medium text-orange-900 dark:text-orange-100",children:u("permissions.skipPermissions.label")}),a.jsx("div",{className:"text-sm text-orange-700 dark:text-orange-300",children:u("permissions.skipPermissions.cursorDescription")})]})]})})]}),a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx(Bh,{className:"w-5 h-5 text-green-500"}),a.jsx("h3",{className:"text-lg font-medium text-foreground",children:u("permissions.allowedCommands.title")})]}),a.jsx("p",{className:"text-sm text-muted-foreground",children:u("permissions.allowedCommands.description")}),a.jsxs("div",{className:"flex flex-col sm:flex-row gap-2",children:[a.jsx(tr,{value:o,onChange:f=>l(f.target.value),placeholder:u("permissions.allowedCommands.placeholder"),onKeyPress:f=>{f.key==="Enter"&&(f.preventDefault(),p(o))},className:"flex-1 h-10"}),a.jsxs(Be,{onClick:()=>p(o),disabled:!o,size:"sm",className:"h-10 px-4",children:[a.jsx(gr,{className:"w-4 h-4 mr-2 sm:mr-0"}),a.jsx("span",{className:"sm:hidden",children:u("permissions.actions.add")})]})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx("p",{className:"text-sm font-medium text-gray-700 dark:text-gray-300",children:u("permissions.allowedCommands.quickAdd")}),a.jsx("div",{className:"flex flex-wrap gap-2",children:qG.map(f=>a.jsx(Be,{variant:"outline",size:"sm",onClick:()=>p(f),disabled:r.includes(f),className:"text-xs h-8",children:f},f))})]}),a.jsxs("div",{className:"space-y-2",children:[r.map(f=>a.jsxs("div",{className:"flex items-center justify-between bg-green-50 dark:bg-green-900/20 border border-green-200 dark:border-green-800 rounded-lg p-3",children:[a.jsx("span",{className:"font-mono text-sm text-green-800 dark:text-green-200",children:f}),a.jsx(Be,{variant:"ghost",size:"sm",onClick:()=>h(f),className:"text-green-600 hover:text-green-700",children:a.jsx(Bt,{className:"w-4 h-4"})})]},f)),r.length===0&&a.jsx("div",{className:"text-center py-6 text-gray-500 dark:text-gray-400",children:u("permissions.allowedCommands.empty")})]})]}),a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx(Vn,{className:"w-5 h-5 text-red-500"}),a.jsx("h3",{className:"text-lg font-medium text-foreground",children:u("permissions.blockedCommands.title")})]}),a.jsx("p",{className:"text-sm text-muted-foreground",children:u("permissions.blockedCommands.description")}),a.jsxs("div",{className:"flex flex-col sm:flex-row gap-2",children:[a.jsx(tr,{value:c,onChange:f=>d(f.target.value),placeholder:u("permissions.blockedCommands.placeholder"),onKeyPress:f=>{f.key==="Enter"&&(f.preventDefault(),m(c))},className:"flex-1 h-10"}),a.jsxs(Be,{onClick:()=>m(c),disabled:!c,size:"sm",className:"h-10 px-4",children:[a.jsx(gr,{className:"w-4 h-4 mr-2 sm:mr-0"}),a.jsx("span",{className:"sm:hidden",children:u("permissions.actions.add")})]})]}),a.jsxs("div",{className:"space-y-2",children:[i.map(f=>a.jsxs("div",{className:"flex items-center justify-between bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800 rounded-lg p-3",children:[a.jsx("span",{className:"font-mono text-sm text-red-800 dark:text-red-200",children:f}),a.jsx(Be,{variant:"ghost",size:"sm",onClick:()=>g(f),className:"text-red-600 hover:text-red-700",children:a.jsx(Bt,{className:"w-4 h-4"})})]},f)),i.length===0&&a.jsx("div",{className:"text-center py-6 text-gray-500 dark:text-gray-400",children:u("permissions.blockedCommands.empty")})]})]}),a.jsxs("div",{className:"bg-purple-50 dark:bg-purple-900/20 border border-purple-200 dark:border-purple-800 rounded-lg p-4",children:[a.jsx("h4",{className:"font-medium text-purple-900 dark:text-purple-100 mb-2",children:u("permissions.shellExamples.title")}),a.jsxs("ul",{className:"text-sm text-purple-800 dark:text-purple-200 space-y-1",children:[a.jsxs("li",{children:[a.jsx("code",{className:"bg-purple-100 dark:bg-purple-800 px-1 rounded",children:'"Shell(ls)"'})," ",u("permissions.shellExamples.ls")]}),a.jsxs("li",{children:[a.jsx("code",{className:"bg-purple-100 dark:bg-purple-800 px-1 rounded",children:'"Shell(git status)"'})," ",u("permissions.shellExamples.gitStatus")]}),a.jsxs("li",{children:[a.jsx("code",{className:"bg-purple-100 dark:bg-purple-800 px-1 rounded",children:'"Shell(npm install)"'})," ",u("permissions.shellExamples.npmInstall")]}),a.jsxs("li",{children:[a.jsx("code",{className:"bg-purple-100 dark:bg-purple-800 px-1 rounded",children:'"Shell(rm -rf)"'})," ",u("permissions.shellExamples.rmRf")]})]})]})]})}function WG({permissionMode:e,setPermissionMode:t}){const{t:r}=Ht("settings");return a.jsx("div",{className:"space-y-6",children:a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx(Bh,{className:"w-5 h-5 text-green-500"}),a.jsx("h3",{className:"text-lg font-medium text-foreground",children:r("permissions.codex.permissionMode")})]}),a.jsx("p",{className:"text-sm text-muted-foreground",children:r("permissions.codex.description")}),a.jsx("div",{className:`border rounded-lg p-4 cursor-pointer transition-all ${e==="default"?"bg-gray-100 dark:bg-gray-800 border-gray-400 dark:border-gray-500":"bg-gray-50 dark:bg-gray-900/50 border-gray-200 dark:border-gray-700 hover:border-gray-300 dark:hover:border-gray-600"}`,onClick:()=>t("default"),children:a.jsxs("label",{className:"flex items-start gap-3 cursor-pointer",children:[a.jsx("input",{type:"radio",name:"codexPermissionMode",checked:e==="default",onChange:()=>t("default"),className:"mt-1 w-4 h-4 text-green-600"}),a.jsxs("div",{children:[a.jsx("div",{className:"font-medium text-foreground",children:r("permissions.codex.modes.default.title")}),a.jsx("div",{className:"text-sm text-muted-foreground",children:r("permissions.codex.modes.default.description")})]})]})}),a.jsx("div",{className:`border rounded-lg p-4 cursor-pointer transition-all ${e==="acceptEdits"?"bg-green-50 dark:bg-green-900/20 border-green-400 dark:border-green-600":"bg-gray-50 dark:bg-gray-900/50 border-gray-200 dark:border-gray-700 hover:border-gray-300 dark:hover:border-gray-600"}`,onClick:()=>t("acceptEdits"),children:a.jsxs("label",{className:"flex items-start gap-3 cursor-pointer",children:[a.jsx("input",{type:"radio",name:"codexPermissionMode",checked:e==="acceptEdits",onChange:()=>t("acceptEdits"),className:"mt-1 w-4 h-4 text-green-600"}),a.jsxs("div",{children:[a.jsx("div",{className:"font-medium text-green-900 dark:text-green-100",children:r("permissions.codex.modes.acceptEdits.title")}),a.jsx("div",{className:"text-sm text-green-700 dark:text-green-300",children:r("permissions.codex.modes.acceptEdits.description")})]})]})}),a.jsx("div",{className:`border rounded-lg p-4 cursor-pointer transition-all ${e==="bypassPermissions"?"bg-orange-50 dark:bg-orange-900/20 border-orange-400 dark:border-orange-600":"bg-gray-50 dark:bg-gray-900/50 border-gray-200 dark:border-gray-700 hover:border-gray-300 dark:hover:border-gray-600"}`,onClick:()=>t("bypassPermissions"),children:a.jsxs("label",{className:"flex items-start gap-3 cursor-pointer",children:[a.jsx("input",{type:"radio",name:"codexPermissionMode",checked:e==="bypassPermissions",onChange:()=>t("bypassPermissions"),className:"mt-1 w-4 h-4 text-orange-600"}),a.jsxs("div",{children:[a.jsxs("div",{className:"font-medium text-orange-900 dark:text-orange-100 flex items-center gap-2",children:[r("permissions.codex.modes.bypassPermissions.title"),a.jsx(Vn,{className:"w-4 h-4"})]}),a.jsx("div",{className:"text-sm text-orange-700 dark:text-orange-300",children:r("permissions.codex.modes.bypassPermissions.description")})]})]})}),a.jsxs("details",{className:"text-sm",children:[a.jsx("summary",{className:"cursor-pointer text-muted-foreground hover:text-foreground",children:r("permissions.codex.technicalDetails")}),a.jsxs("div",{className:"mt-2 p-3 bg-gray-50 dark:bg-gray-900/50 rounded-lg text-xs text-muted-foreground space-y-2",children:[a.jsxs("p",{children:[a.jsxs("strong",{children:[r("permissions.codex.modes.default.title"),":"]})," ",r("permissions.codex.technicalInfo.default")]}),a.jsxs("p",{children:[a.jsxs("strong",{children:[r("permissions.codex.modes.acceptEdits.title"),":"]})," ",r("permissions.codex.technicalInfo.acceptEdits")]}),a.jsxs("p",{children:[a.jsxs("strong",{children:[r("permissions.codex.modes.bypassPermissions.title"),":"]})," ",r("permissions.codex.technicalInfo.bypassPermissions")]}),a.jsx("p",{className:"text-xs opacity-75",children:r("permissions.codex.technicalInfo.overrideNote")})]})]})]})})}function _m({agent:e,...t}){return e==="claude"?a.jsx(GG,{...t}):e==="cursor"?a.jsx(HG,{...t}):e==="codex"?a.jsx(WG,{...t}):null}const VG=e=>{switch(e){case"stdio":return a.jsx(pa,{className:"w-4 h-4"});case"sse":return a.jsx(zh,{className:"w-4 h-4"});case"http":return a.jsx(Dm,{className:"w-4 h-4"});default:return a.jsx(Eo,{className:"w-4 h-4"})}};function KG({servers:e,onAdd:t,onEdit:r,onDelete:n,onTest:i,onDiscoverTools:s,testResults:o,serverTools:l,toolsLoading:c}){const{t:d}=Ht("settings");return a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx(Eo,{className:"w-5 h-5 text-purple-500"}),a.jsx("h3",{className:"text-lg font-medium text-foreground",children:d("mcpServers.title")})]}),a.jsx("p",{className:"text-sm text-muted-foreground",children:d("mcpServers.description.claude")}),a.jsx("div",{className:"flex justify-between items-center",children:a.jsxs(Be,{onClick:t,className:"bg-purple-600 hover:bg-purple-700 text-white",size:"sm",children:[a.jsx(gr,{className:"w-4 h-4 mr-2"}),d("mcpServers.addButton")]})}),a.jsxs("div",{className:"space-y-2",children:[e.map(u=>a.jsx("div",{className:"bg-gray-50 dark:bg-gray-900/50 border border-gray-200 dark:border-gray-700 rounded-lg p-4",children:a.jsxs("div",{className:"flex items-start justify-between",children:[a.jsxs("div",{className:"flex-1",children:[a.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[VG(u.type),a.jsx("span",{className:"font-medium text-foreground",children:u.name}),a.jsx(mn,{variant:"outline",className:"text-xs",children:u.type}),a.jsx(mn,{variant:"outline",className:"text-xs",children:u.scope==="local"?d("mcpServers.scope.local"):u.scope==="user"?d("mcpServers.scope.user"):u.scope})]}),a.jsxs("div",{className:"text-sm text-muted-foreground space-y-1",children:[u.type==="stdio"&&u.config?.command&&a.jsxs("div",{children:[d("mcpServers.config.command"),": ",a.jsx("code",{className:"bg-gray-100 dark:bg-gray-800 px-1 rounded text-xs",children:u.config.command})]}),(u.type==="sse"||u.type==="http")&&u.config?.url&&a.jsxs("div",{children:[d("mcpServers.config.url"),": ",a.jsx("code",{className:"bg-gray-100 dark:bg-gray-800 px-1 rounded text-xs",children:u.config.url})]}),u.config?.args&&u.config.args.length>0&&a.jsxs("div",{children:[d("mcpServers.config.args"),": ",a.jsx("code",{className:"bg-gray-100 dark:bg-gray-800 px-1 rounded text-xs",children:u.config.args.join(" ")})]})]}),o?.[u.id]&&a.jsx("div",{className:`mt-2 p-2 rounded text-xs ${o[u.id].success?"bg-green-50 dark:bg-green-900/20 text-green-800 dark:text-green-200":"bg-red-50 dark:bg-red-900/20 text-red-800 dark:text-red-200"}`,children:a.jsx("div",{className:"font-medium",children:o[u.id].message})}),l?.[u.id]&&l[u.id].tools?.length>0&&a.jsxs("div",{className:"mt-2 p-2 rounded text-xs bg-blue-50 dark:bg-blue-900/20 text-blue-800 dark:text-blue-200",children:[a.jsxs("div",{className:"font-medium",children:[d("mcpServers.tools.title")," ",d("mcpServers.tools.count",{count:l[u.id].tools.length})]}),a.jsxs("div",{className:"flex flex-wrap gap-1 mt-1",children:[l[u.id].tools.slice(0,5).map((p,h)=>a.jsx("code",{className:"bg-blue-100 dark:bg-blue-800 px-1 rounded",children:p.name},h)),l[u.id].tools.length>5&&a.jsx("span",{className:"text-xs opacity-75",children:d("mcpServers.tools.more",{count:l[u.id].tools.length-5})})]})]})]}),a.jsxs("div",{className:"flex items-center gap-2 ml-4",children:[a.jsx(Be,{onClick:()=>r(u),variant:"ghost",size:"sm",className:"text-gray-600 hover:text-gray-700",title:d("mcpServers.actions.edit"),children:a.jsx(Vi,{className:"w-4 h-4"})}),a.jsx(Be,{onClick:()=>n(u.id,u.scope),variant:"ghost",size:"sm",className:"text-red-600 hover:text-red-700",title:d("mcpServers.actions.delete"),children:a.jsx(Nr,{className:"w-4 h-4"})})]})]})},u.id)),e.length===0&&a.jsx("div",{className:"text-center py-8 text-gray-500 dark:text-gray-400",children:d("mcpServers.empty")})]})]})}function YG({servers:e,onAdd:t,onEdit:r,onDelete:n}){const{t:i}=Ht("settings");return a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx(Eo,{className:"w-5 h-5 text-purple-500"}),a.jsx("h3",{className:"text-lg font-medium text-foreground",children:i("mcpServers.title")})]}),a.jsx("p",{className:"text-sm text-muted-foreground",children:i("mcpServers.description.cursor")}),a.jsx("div",{className:"flex justify-between items-center",children:a.jsxs(Be,{onClick:t,className:"bg-purple-600 hover:bg-purple-700 text-white",size:"sm",children:[a.jsx(gr,{className:"w-4 h-4 mr-2"}),i("mcpServers.addButton")]})}),a.jsxs("div",{className:"space-y-2",children:[e.map(s=>a.jsx("div",{className:"bg-gray-50 dark:bg-gray-900/50 border border-gray-200 dark:border-gray-700 rounded-lg p-4",children:a.jsxs("div",{className:"flex items-start justify-between",children:[a.jsxs("div",{className:"flex-1",children:[a.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[a.jsx(pa,{className:"w-4 h-4"}),a.jsx("span",{className:"font-medium text-foreground",children:s.name}),a.jsx(mn,{variant:"outline",className:"text-xs",children:"stdio"})]}),a.jsx("div",{className:"text-sm text-muted-foreground",children:s.config?.command&&a.jsxs("div",{children:[i("mcpServers.config.command"),": ",a.jsx("code",{className:"bg-gray-100 dark:bg-gray-800 px-1 rounded text-xs",children:s.config.command})]})})]}),a.jsxs("div",{className:"flex items-center gap-2 ml-4",children:[a.jsx(Be,{onClick:()=>r(s),variant:"ghost",size:"sm",className:"text-gray-600 hover:text-gray-700",title:i("mcpServers.actions.edit"),children:a.jsx(Vi,{className:"w-4 h-4"})}),a.jsx(Be,{onClick:()=>n(s.name),variant:"ghost",size:"sm",className:"text-red-600 hover:text-red-700",title:i("mcpServers.actions.delete"),children:a.jsx(Nr,{className:"w-4 h-4"})})]})]})},s.name||s.id)),e.length===0&&a.jsx("div",{className:"text-center py-8 text-gray-500 dark:text-gray-400",children:i("mcpServers.empty")})]})]})}function XG({servers:e,onAdd:t,onEdit:r,onDelete:n}){const{t:i}=Ht("settings");return a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx(Eo,{className:"w-5 h-5 text-gray-700 dark:text-gray-300"}),a.jsx("h3",{className:"text-lg font-medium text-foreground",children:i("mcpServers.title")})]}),a.jsx("p",{className:"text-sm text-muted-foreground",children:i("mcpServers.description.codex")}),a.jsx("div",{className:"flex justify-between items-center",children:a.jsxs(Be,{onClick:t,className:"bg-gray-800 hover:bg-gray-900 dark:bg-gray-700 dark:hover:bg-gray-600 text-white",size:"sm",children:[a.jsx(gr,{className:"w-4 h-4 mr-2"}),i("mcpServers.addButton")]})}),a.jsxs("div",{className:"space-y-2",children:[e.map(s=>a.jsx("div",{className:"bg-gray-50 dark:bg-gray-900/50 border border-gray-200 dark:border-gray-700 rounded-lg p-4",children:a.jsxs("div",{className:"flex items-start justify-between",children:[a.jsxs("div",{className:"flex-1",children:[a.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[a.jsx(pa,{className:"w-4 h-4"}),a.jsx("span",{className:"font-medium text-foreground",children:s.name}),a.jsx(mn,{variant:"outline",className:"text-xs",children:"stdio"})]}),a.jsxs("div",{className:"text-sm text-muted-foreground space-y-1",children:[s.config?.command&&a.jsxs("div",{children:[i("mcpServers.config.command"),": ",a.jsx("code",{className:"bg-gray-100 dark:bg-gray-800 px-1 rounded text-xs",children:s.config.command})]}),s.config?.args&&s.config.args.length>0&&a.jsxs("div",{children:[i("mcpServers.config.args"),": ",a.jsx("code",{className:"bg-gray-100 dark:bg-gray-800 px-1 rounded text-xs",children:s.config.args.join(" ")})]}),s.config?.env&&Object.keys(s.config.env).length>0&&a.jsxs("div",{children:[i("mcpServers.config.environment"),": ",a.jsx("code",{className:"bg-gray-100 dark:bg-gray-800 px-1 rounded text-xs",children:Object.entries(s.config.env).map(([o,l])=>`${o}=${l}`).join(", ")})]})]})]}),a.jsxs("div",{className:"flex items-center gap-2 ml-4",children:[a.jsx(Be,{onClick:()=>r(s),variant:"ghost",size:"sm",className:"text-gray-600 hover:text-gray-700",title:i("mcpServers.actions.edit"),children:a.jsx(Vi,{className:"w-4 h-4"})}),a.jsx(Be,{onClick:()=>n(s.name),variant:"ghost",size:"sm",className:"text-red-600 hover:text-red-700",title:i("mcpServers.actions.delete"),children:a.jsx(Nr,{className:"w-4 h-4"})})]})]})},s.name)),e.length===0&&a.jsx("div",{className:"text-center py-8 text-gray-500 dark:text-gray-400",children:i("mcpServers.empty")})]}),a.jsxs("div",{className:"bg-gray-100 dark:bg-gray-800/50 border border-gray-300 dark:border-gray-600 rounded-lg p-4",children:[a.jsx("h4",{className:"font-medium text-gray-900 dark:text-gray-100 mb-2",children:i("mcpServers.help.title")}),a.jsx("p",{className:"text-sm text-gray-700 dark:text-gray-300",children:i("mcpServers.help.description")})]})]})}function Lm({agent:e,...t}){return e==="claude"?a.jsx(KG,{...t}):e==="cursor"?a.jsx(YG,{...t}):e==="codex"?a.jsx(XG,{...t}):null}const jh=[{value:"en",label:"English",nativeName:"English"},{value:"zh-CN",label:"Simplified Chinese",nativeName:"简体中文"}];function d3({compact:e=!1}){const{i18n:t,t:r}=Ht("settings"),n=i=>{const s=i.target.value;t.changeLanguage(s)};return e?a.jsxs("div",{className:"flex items-center justify-between p-3 rounded-lg bg-gray-50 dark:bg-gray-800 hover:bg-gray-100 dark:hover:bg-gray-700 transition-colors border border-transparent hover:border-gray-300 dark:hover:border-gray-600",children:[a.jsxs("span",{className:"flex items-center gap-2 text-sm text-gray-900 dark:text-white",children:[a.jsx(h4,{className:"h-4 w-4 text-gray-600 dark:text-gray-400"}),r("account.language")]}),a.jsx("select",{value:t.language,onChange:n,className:"w-[100px] text-sm bg-gray-50 dark:bg-gray-800 border border-gray-300 dark:border-gray-600 text-gray-900 dark:text-gray-100 rounded-lg focus:ring-blue-500 focus:border-blue-500 p-2 focus:outline-none focus:ring-2 focus:ring-blue-500 dark:focus:ring-blue-400",children:jh.map(i=>a.jsx("option",{value:i.value,children:i.nativeName},i.value))})]}):a.jsx("div",{className:"bg-gray-50 dark:bg-gray-900/50 border border-gray-200 dark:border-gray-700 rounded-lg p-4",children:a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{children:[a.jsx("div",{className:"font-medium text-gray-900 dark:text-gray-100 mb-1",children:r("account.languageLabel")}),a.jsx("div",{className:"text-sm text-gray-600 dark:text-gray-400",children:r("account.languageDescription")})]}),a.jsx("select",{value:t.language,onChange:n,className:"text-sm bg-gray-50 dark:bg-gray-800 border border-gray-300 dark:border-gray-600 text-gray-900 dark:text-gray-100 rounded-lg focus:ring-blue-500 focus:border-blue-500 p-2 w-36",children:jh.map(i=>a.jsx("option",{value:i.value,children:i.nativeName},i.value))})]})})}function ZG({isOpen:e,onClose:t,projects:r=[],initialTab:n="agents"}){const{isDarkMode:i,toggleDarkMode:s}=as(),{t:o}=Ht("settings"),[l,c]=x.useState([]),[d,u]=x.useState([]),[p,h]=x.useState(""),[m,g]=x.useState(""),[f,w]=x.useState(!1),[S,k]=x.useState(!1),[E,N]=x.useState(null),[C,v]=x.useState("name"),[I,M]=x.useState([]),[j,T]=x.useState(!1),[P,q]=x.useState(null),[D,z]=x.useState({name:"",type:"stdio",scope:"user",projectPath:"",config:{command:"",args:[],env:{},url:"",headers:{},timeout:3e4},jsonInput:"",importMode:"form"}),[U,G]=x.useState(!1),[re,K]=x.useState({}),[ue,R]=x.useState({}),[F,te]=x.useState({}),[_,Z]=x.useState(n),[me,ke]=x.useState(""),[se,_e]=x.useState("claude"),[oe,fe]=x.useState("account"),[Ie,qe]=x.useState(()=>localStorage.getItem("codeEditorTheme")||"dark"),[ze,ct]=x.useState(()=>localStorage.getItem("codeEditorWordWrap")==="true"),[Ye,wt]=x.useState(()=>localStorage.getItem("codeEditorShowMinimap")!=="false"),[gt,et]=x.useState(()=>localStorage.getItem("codeEditorLineNumbers")!=="false"),[Me,mt]=x.useState(()=>localStorage.getItem("codeEditorFontSize")||"14"),[Pt,xe]=x.useState([]),[at,de]=x.useState([]),[Ee,H]=x.useState(!1),[Y,le]=x.useState(""),[ve,Ve]=x.useState(""),[It,ft]=x.useState([]),[Rt,it]=x.useState([]),[ie,je]=x.useState("default"),[Te,Pe]=x.useState(!1),[Ue,st]=x.useState({name:"",type:"stdio",config:{command:"",args:[],env:{}}}),[Qe,J]=x.useState(null),[Fe,Ke]=x.useState(!1),[Ge,dt]=x.useState(!1),[he,zt]=x.useState(""),[nr,_n]=x.useState(null),[xr,ae]=x.useState({authenticated:!1,email:null,loading:!0,error:null}),[ge,tt]=x.useState({authenticated:!1,email:null,loading:!0,error:null}),[bt,hr]=x.useState({authenticated:!1,email:null,loading:!0,error:null}),ar=async()=>{try{const X=await Ce("/api/cursor/mcp");if(X.ok){const ce=await X.json();ft(ce.servers||[])}else console.error("Failed to fetch Cursor MCP servers")}catch(X){console.error("Error fetching Cursor MCP servers:",X)}},Zr=async()=>{try{const X=await Ce("/api/codex/mcp/config/read");if(X.ok){const Re=await X.json();if(Re.success&&Re.servers){it(Re.servers);return}}const ce=await Ce("/api/codex/mcp/cli/list");if(ce.ok){const Re=await ce.json();if(Re.success&&Re.servers){const ht=Re.servers.map(dr=>({id:dr.name,name:dr.name,type:dr.type||"stdio",scope:"user",config:{command:dr.command||"",args:dr.args||[],env:dr.env||{}}}));it(ht)}}}catch(X){console.error("Error fetching Codex MCP servers:",X)}},Ut=async()=>{try{const X=await Ce("/api/mcp/config/read");if(X.ok){const ht=await X.json();if(ht.success&&ht.servers){M(ht.servers);return}}const ce=await Ce("/api/mcp/cli/list");if(ce.ok){const ht=await ce.json();if(ht.success&&ht.servers){const dr=ht.servers.map(Qr=>({id:Qr.name,name:Qr.name,type:Qr.type,scope:"user",config:{command:Qr.command||"",args:Qr.args||[],env:Qr.env||{},url:Qr.url||"",headers:Qr.headers||{},timeout:3e4},created:new Date().toISOString(),updated:new Date().toISOString()}));M(dr);return}}const Re=await Ce("/api/mcp/servers?scope=user");if(Re.ok){const ht=await Re.json();M(ht.servers||[])}else console.error("Failed to fetch MCP servers")}catch(X){console.error("Error fetching MCP servers:",X)}},cn=async X=>{try{P&&await jr(P.id,"user");const ce=await Ce("/api/mcp/cli/add",{method:"POST",body:JSON.stringify({name:X.name,type:X.type,scope:X.scope,projectPath:X.projectPath,command:X.config?.command,args:X.config?.args||[],url:X.config?.url,headers:X.config?.headers||{},env:X.config?.env||{}})});if(ce.ok){const Re=await ce.json();if(Re.success)return await Ut(),!0;throw new Error(Re.error||"Failed to save server via Claude CLI")}else{const Re=await ce.json();throw new Error(Re.error||"Failed to save server")}}catch(ce){throw console.error("Error saving MCP server:",ce),ce}},jr=async(X,ce="user")=>{try{const Re=await Ce(`/api/mcp/cli/remove/${X}?scope=${ce}`,{method:"DELETE"});if(Re.ok){const ht=await Re.json();if(ht.success)return await Ut(),!0;throw new Error(ht.error||"Failed to delete server via Claude CLI")}else{const ht=await Re.json();throw new Error(ht.error||"Failed to delete server")}}catch(Re){throw console.error("Error deleting MCP server:",Re),Re}},wi=async(X,ce="user")=>{try{const Re=await Ce(`/api/mcp/servers/${X}/test?scope=${ce}`,{method:"POST"});if(Re.ok)return(await Re.json()).testResult;{const ht=await Re.json();throw new Error(ht.error||"Failed to test server")}}catch(Re){throw console.error("Error testing MCP server:",Re),Re}},Ln=async(X,ce="user")=>{try{const Re=await Ce(`/api/mcp/servers/${X}/tools?scope=${ce}`,{method:"POST"});if(Re.ok)return(await Re.json()).toolsResult;{const ht=await Re.json();throw new Error(ht.error||"Failed to discover tools")}}catch(Re){throw console.error("Error discovering MCP tools:",Re),Re}},Pa=async X=>{try{Qe&&await ra(Qe.id);const ce=await Ce("/api/codex/mcp/cli/add",{method:"POST",body:JSON.stringify({name:X.name,command:X.config?.command,args:X.config?.args||[],env:X.config?.env||{}})});if(ce.ok){const Re=await ce.json();if(Re.success)return await Zr(),!0;throw new Error(Re.error||"Failed to save Codex MCP server")}else{const Re=await ce.json();throw new Error(Re.error||"Failed to save server")}}catch(ce){throw console.error("Error saving Codex MCP server:",ce),ce}},ra=async X=>{try{const ce=await Ce(`/api/codex/mcp/cli/remove/${X}`,{method:"DELETE"});if(ce.ok){const Re=await ce.json();if(Re.success)return await Zr(),!0;throw new Error(Re.error||"Failed to delete Codex MCP server")}else{const Re=await ce.json();throw new Error(Re.error||"Failed to delete server")}}catch(ce){throw console.error("Error deleting Codex MCP server:",ce),ce}},_r=()=>{st({name:"",type:"stdio",config:{command:"",args:[],env:{}}}),J(null),Pe(!1)},fs=(X=null)=>{X?(J(X),st({name:X.name,type:X.type||"stdio",config:{command:X.config?.command||"",args:X.config?.args||[],env:X.config?.env||{}}})):_r(),Pe(!0)},gn=async X=>{X.preventDefault(),Ke(!0);try{Qe&&await ra(Qe.name),await Pa(Ue),_r(),N("success")}catch(ce){alert(`Error: ${ce.message}`),N("error")}finally{Ke(!1)}},Ba=async X=>{if(confirm("Are you sure you want to delete this MCP server?"))try{await ra(X),N("success")}catch(ce){alert(`Error: ${ce.message}`),N("error")}};x.useEffect(()=>{e&&(On(),za(),Jr(),Si(),Z(n))},[e,n]),x.useEffect(()=>{localStorage.setItem("codeEditorTheme",Ie),window.dispatchEvent(new Event("codeEditorSettingsChanged"))},[Ie]),x.useEffect(()=>{localStorage.setItem("codeEditorWordWrap",ze.toString()),window.dispatchEvent(new Event("codeEditorSettingsChanged"))},[ze]),x.useEffect(()=>{localStorage.setItem("codeEditorShowMinimap",Ye.toString()),window.dispatchEvent(new Event("codeEditorSettingsChanged"))},[Ye]),x.useEffect(()=>{localStorage.setItem("codeEditorLineNumbers",gt.toString()),window.dispatchEvent(new Event("codeEditorSettingsChanged"))},[gt]),x.useEffect(()=>{localStorage.setItem("codeEditorFontSize",Me),window.dispatchEvent(new Event("codeEditorSettingsChanged"))},[Me]);const On=async()=>{try{const X=localStorage.getItem("claude-settings");if(X){const ht=JSON.parse(X);c(ht.allowedTools||[]),u(ht.disallowedTools||[]),w(ht.skipPermissions||!1),v(ht.projectSortOrder||"name")}else c([]),u([]),w(!1),v("name");const ce=localStorage.getItem("cursor-tools-settings");if(ce){const ht=JSON.parse(ce);xe(ht.allowedCommands||[]),de(ht.disallowedCommands||[]),H(ht.skipPermissions||!1)}else xe([]),de([]),H(!1);const Re=localStorage.getItem("codex-settings");if(Re){const ht=JSON.parse(Re);je(ht.permissionMode||"default")}else je("default");await Ut(),await ar(),await Zr()}catch(X){console.error("Error loading tool settings:",X),c([]),u([]),w(!1),v("name")}},za=async()=>{try{const X=await Ce("/api/cli/claude/status");if(X.ok){const ce=await X.json();ae({authenticated:ce.authenticated,email:ce.email,loading:!1,error:ce.error||null})}else ae({authenticated:!1,email:null,loading:!1,error:"Failed to check authentication status"})}catch(X){console.error("Error checking Claude auth status:",X),ae({authenticated:!1,email:null,loading:!1,error:X.message})}},Jr=async()=>{try{const X=await Ce("/api/cli/cursor/status");if(X.ok){const ce=await X.json();tt({authenticated:ce.authenticated,email:ce.email,loading:!1,error:ce.error||null})}else tt({authenticated:!1,email:null,loading:!1,error:"Failed to check authentication status"})}catch(X){console.error("Error checking Cursor auth status:",X),tt({authenticated:!1,email:null,loading:!1,error:X.message})}},Si=async()=>{try{const X=await Ce("/api/cli/codex/status");if(X.ok){const ce=await X.json();hr({authenticated:ce.authenticated,email:ce.email,loading:!1,error:ce.error||null})}else hr({authenticated:!1,email:null,loading:!1,error:"Failed to check authentication status"})}catch(X){console.error("Error checking Codex auth status:",X),hr({authenticated:!1,email:null,loading:!1,error:X.message})}},fn=()=>{zt("claude"),_n(r?.[0]||{name:"default",fullPath:process.cwd()}),dt(!0)},ya=()=>{zt("cursor"),_n(r?.[0]||{name:"default",fullPath:process.cwd()}),dt(!0)},qo=()=>{zt("codex"),_n(r?.[0]||{name:"default",fullPath:process.cwd()}),dt(!0)},Go=X=>{X===0&&(N("success"),he==="claude"?za():he==="cursor"?Jr():he==="codex"&&Si())},qr=()=>{k(!0),N(null);try{const X={allowedTools:l,disallowedTools:d,skipPermissions:f,projectSortOrder:C,lastUpdated:new Date().toISOString()},ce={allowedCommands:Pt,disallowedCommands:at,skipPermissions:Ee,lastUpdated:new Date().toISOString()},Re={permissionMode:ie,lastUpdated:new Date().toISOString()};localStorage.setItem("claude-settings",JSON.stringify(X)),localStorage.setItem("cursor-tools-settings",JSON.stringify(ce)),localStorage.setItem("codex-settings",JSON.stringify(Re)),N("success"),setTimeout(()=>{t()},1e3)}catch(X){console.error("Error saving tool settings:",X),N("error")}finally{k(!1)}},Dn=()=>{z({name:"",type:"stdio",scope:"user",projectPath:"",config:{command:"",args:[],env:{},url:"",headers:{},timeout:3e4},jsonInput:"",importMode:"form"}),q(null),T(!1),ke("")},Ei=(X=null)=>{X?(q(X),z({name:X.name,type:X.type,scope:X.scope,projectPath:X.projectPath||"",config:{...X.config},raw:X.raw,importMode:"form",jsonInput:""})):Dn(),T(!0)},vt=async X=>{X.preventDefault(),G(!0);try{if(D.importMode==="json"){const ce=await Ce("/api/mcp/cli/add-json",{method:"POST",body:JSON.stringify({name:D.name,jsonConfig:D.jsonInput,scope:D.scope,projectPath:D.projectPath})});if(ce.ok){const Re=await ce.json();if(Re.success)await Ut(),Dn(),N("success");else throw new Error(Re.error||"Failed to add server via JSON")}else{const Re=await ce.json();throw new Error(Re.error||"Failed to add server")}}else await cn(D),Dn(),N("success")}catch(ce){alert(`Error: ${ce.message}`),N("error")}finally{G(!1)}},Ua=async(X,ce)=>{if(confirm("Are you sure you want to delete this MCP server?"))try{await jr(X,ce),N("success")}catch(Re){alert(`Error: ${Re.message}`),N("error")}},na=async(X,ce)=>{try{K({...re,[X]:{loading:!0}});const Re=await wi(X,ce);K({...re,[X]:Re})}catch(Re){K({...re,[X]:{success:!1,message:Re.message,details:[]}})}},bs=async(X,ce)=>{try{te({...F,[X]:!0});const Re=await Ln(X,ce);R({...ue,[X]:Re})}catch{R({...ue,[X]:{success:!1,tools:[],resources:[],prompts:[]}})}finally{te({...F,[X]:!1})}},dn=(X,ce)=>{z(Re=>({...Re,config:{...Re.config,[X]:ce}}))};return e?a.jsxs("div",{className:"modal-backdrop fixed inset-0 flex items-center justify-center z-[9999] md:p-4 bg-background/95",children:[a.jsxs("div",{className:"bg-background border border-border md:rounded-lg shadow-xl w-full md:max-w-4xl h-full md:h-[90vh] flex flex-col",children:[a.jsxs("div",{className:"flex items-center justify-between p-4 md:p-6 border-b border-border flex-shrink-0",children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx(Ia,{className:"w-5 h-5 md:w-6 md:h-6 text-blue-600"}),a.jsx("h2",{className:"text-lg md:text-xl font-semibold text-foreground",children:o("title")})]}),a.jsx(Be,{variant:"ghost",size:"sm",onClick:t,className:"text-muted-foreground hover:text-foreground touch-manipulation",children:a.jsx(Bt,{className:"w-5 h-5"})})]}),a.jsxs("div",{className:"flex-1 overflow-y-auto",children:[a.jsx("div",{className:"border-b border-border",children:a.jsxs("div",{className:"flex px-4 md:px-6",children:[a.jsx("button",{onClick:()=>Z("agents"),className:`px-4 py-3 text-sm font-medium border-b-2 transition-colors ${_==="agents"?"border-blue-600 text-blue-600 dark:text-blue-400":"border-transparent text-muted-foreground hover:text-foreground"}`,children:o("mainTabs.agents")}),a.jsx("button",{onClick:()=>Z("appearance"),className:`px-4 py-3 text-sm font-medium border-b-2 transition-colors ${_==="appearance"?"border-blue-600 text-blue-600 dark:text-blue-400":"border-transparent text-muted-foreground hover:text-foreground"}`,children:o("mainTabs.appearance")}),a.jsxs("button",{onClick:()=>Z("git"),className:`px-4 py-3 text-sm font-medium border-b-2 transition-colors ${_==="git"?"border-blue-600 text-blue-600 dark:text-blue-400":"border-transparent text-muted-foreground hover:text-foreground"}`,children:[a.jsx(qn,{className:"w-4 h-4 inline mr-2"}),o("mainTabs.git")]}),a.jsxs("button",{onClick:()=>Z("api"),className:`px-4 py-3 text-sm font-medium border-b-2 transition-colors ${_==="api"?"border-blue-600 text-blue-600 dark:text-blue-400":"border-transparent text-muted-foreground hover:text-foreground"}`,children:[a.jsx(Fh,{className:"w-4 h-4 inline mr-2"}),o("mainTabs.apiTokens")]}),a.jsx("button",{onClick:()=>Z("tasks"),className:`px-4 py-3 text-sm font-medium border-b-2 transition-colors ${_==="tasks"?"border-blue-600 text-blue-600 dark:text-blue-400":"border-transparent text-muted-foreground hover:text-foreground"}`,children:o("mainTabs.tasks")})]})}),a.jsxs("div",{className:"p-4 md:p-6 space-y-6 md:space-y-8 pb-safe-area-inset-bottom",children:[_==="appearance"&&a.jsx("div",{className:"space-y-6 md:space-y-8",children:_==="appearance"&&a.jsxs("div",{className:"space-y-6 md:space-y-8",children:[a.jsx("div",{className:"space-y-4",children:a.jsx("div",{className:"bg-gray-50 dark:bg-gray-900/50 border border-gray-200 dark:border-gray-700 rounded-lg p-4",children:a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{children:[a.jsx("div",{className:"font-medium text-foreground",children:o("appearanceSettings.darkMode.label")}),a.jsx("div",{className:"text-sm text-muted-foreground",children:o("appearanceSettings.darkMode.description")})]}),a.jsxs("button",{onClick:s,className:"relative inline-flex h-8 w-14 items-center rounded-full bg-gray-200 dark:bg-gray-700 transition-colors duration-200 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2 dark:focus:ring-offset-gray-900",role:"switch","aria-checked":i,"aria-label":"Toggle dark mode",children:[a.jsx("span",{className:"sr-only",children:"Toggle dark mode"}),a.jsx("span",{className:`${i?"translate-x-7":"translate-x-1"} inline-block h-6 w-6 transform rounded-full bg-white shadow-lg transition-transform duration-200 flex items-center justify-center`,children:i?a.jsx(Mm,{className:"w-3.5 h-3.5 text-gray-700"}):a.jsx(Fm,{className:"w-3.5 h-3.5 text-yellow-500"})})]})]})})}),a.jsx("div",{className:"space-y-4",children:a.jsx(d3,{})}),a.jsx("div",{className:"space-y-4",children:a.jsx("div",{className:"bg-gray-50 dark:bg-gray-900/50 border border-gray-200 dark:border-gray-700 rounded-lg p-4",children:a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{children:[a.jsx("div",{className:"font-medium text-foreground",children:o("appearanceSettings.projectSorting.label")}),a.jsx("div",{className:"text-sm text-muted-foreground",children:o("appearanceSettings.projectSorting.description")})]}),a.jsxs("select",{value:C,onChange:X=>v(X.target.value),className:"text-sm bg-gray-50 dark:bg-gray-800 border border-gray-300 dark:border-gray-600 text-gray-900 dark:text-gray-100 rounded-lg focus:ring-blue-500 focus:border-blue-500 p-2 w-32",children:[a.jsx("option",{value:"name",children:o("appearanceSettings.projectSorting.alphabetical")}),a.jsx("option",{value:"date",children:o("appearanceSettings.projectSorting.recentActivity")})]})]})})}),a.jsxs("div",{className:"space-y-4",children:[a.jsx("h3",{className:"text-lg font-semibold text-foreground",children:o("appearanceSettings.codeEditor.title")}),a.jsx("div",{className:"bg-gray-50 dark:bg-gray-900/50 border border-gray-200 dark:border-gray-700 rounded-lg p-4",children:a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{children:[a.jsx("div",{className:"font-medium text-foreground",children:o("appearanceSettings.codeEditor.theme.label")}),a.jsx("div",{className:"text-sm text-muted-foreground",children:o("appearanceSettings.codeEditor.theme.description")})]}),a.jsxs("button",{onClick:()=>qe(Ie==="dark"?"light":"dark"),className:"relative inline-flex h-8 w-14 items-center rounded-full bg-gray-200 dark:bg-gray-700 transition-colors duration-200 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2 dark:focus:ring-offset-gray-900",role:"switch","aria-checked":Ie==="dark","aria-label":"Toggle editor theme",children:[a.jsx("span",{className:"sr-only",children:"Toggle editor theme"}),a.jsx("span",{className:`${Ie==="dark"?"translate-x-7":"translate-x-1"} inline-block h-6 w-6 transform rounded-full bg-white shadow-lg transition-transform duration-200 flex items-center justify-center`,children:Ie==="dark"?a.jsx(Mm,{className:"w-3.5 h-3.5 text-gray-700"}):a.jsx(Fm,{className:"w-3.5 h-3.5 text-yellow-500"})})]})]})}),a.jsx("div",{className:"bg-gray-50 dark:bg-gray-900/50 border border-gray-200 dark:border-gray-700 rounded-lg p-4",children:a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{children:[a.jsx("div",{className:"font-medium text-foreground",children:o("appearanceSettings.codeEditor.wordWrap.label")}),a.jsx("div",{className:"text-sm text-muted-foreground",children:o("appearanceSettings.codeEditor.wordWrap.description")})]}),a.jsxs("button",{onClick:()=>ct(!ze),className:"relative inline-flex h-8 w-14 items-center rounded-full bg-gray-200 dark:bg-gray-700 transition-colors duration-200 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2 dark:focus:ring-offset-gray-900",role:"switch","aria-checked":ze,"aria-label":"Toggle word wrap",children:[a.jsx("span",{className:"sr-only",children:"Toggle word wrap"}),a.jsx("span",{className:`${ze?"translate-x-7":"translate-x-1"} inline-block h-6 w-6 transform rounded-full bg-white shadow-lg transition-transform duration-200`})]})]})}),a.jsx("div",{className:"bg-gray-50 dark:bg-gray-900/50 border border-gray-200 dark:border-gray-700 rounded-lg p-4",children:a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{children:[a.jsx("div",{className:"font-medium text-foreground",children:o("appearanceSettings.codeEditor.showMinimap.label")}),a.jsx("div",{className:"text-sm text-muted-foreground",children:o("appearanceSettings.codeEditor.showMinimap.description")})]}),a.jsxs("button",{onClick:()=>wt(!Ye),className:"relative inline-flex h-8 w-14 items-center rounded-full bg-gray-200 dark:bg-gray-700 transition-colors duration-200 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2 dark:focus:ring-offset-gray-900",role:"switch","aria-checked":Ye,"aria-label":"Toggle minimap",children:[a.jsx("span",{className:"sr-only",children:"Toggle minimap"}),a.jsx("span",{className:`${Ye?"translate-x-7":"translate-x-1"} inline-block h-6 w-6 transform rounded-full bg-white shadow-lg transition-transform duration-200`})]})]})}),a.jsx("div",{className:"bg-gray-50 dark:bg-gray-900/50 border border-gray-200 dark:border-gray-700 rounded-lg p-4",children:a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{children:[a.jsx("div",{className:"font-medium text-foreground",children:o("appearanceSettings.codeEditor.lineNumbers.label")}),a.jsx("div",{className:"text-sm text-muted-foreground",children:o("appearanceSettings.codeEditor.lineNumbers.description")})]}),a.jsxs("button",{onClick:()=>et(!gt),className:"relative inline-flex h-8 w-14 items-center rounded-full bg-gray-200 dark:bg-gray-700 transition-colors duration-200 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2 dark:focus:ring-offset-gray-900",role:"switch","aria-checked":gt,"aria-label":"Toggle line numbers",children:[a.jsx("span",{className:"sr-only",children:"Toggle line numbers"}),a.jsx("span",{className:`${gt?"translate-x-7":"translate-x-1"} inline-block h-6 w-6 transform rounded-full bg-white shadow-lg transition-transform duration-200`})]})]})}),a.jsx("div",{className:"bg-gray-50 dark:bg-gray-900/50 border border-gray-200 dark:border-gray-700 rounded-lg p-4",children:a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{children:[a.jsx("div",{className:"font-medium text-foreground",children:o("appearanceSettings.codeEditor.fontSize.label")}),a.jsx("div",{className:"text-sm text-muted-foreground",children:o("appearanceSettings.codeEditor.fontSize.description")})]}),a.jsxs("select",{value:Me,onChange:X=>mt(X.target.value),className:"text-sm bg-gray-50 dark:bg-gray-800 border border-gray-300 dark:border-gray-600 text-gray-900 dark:text-gray-100 rounded-lg focus:ring-blue-500 focus:border-blue-500 p-2 w-24",children:[a.jsx("option",{value:"10",children:"10px"}),a.jsx("option",{value:"11",children:"11px"}),a.jsx("option",{value:"12",children:"12px"}),a.jsx("option",{value:"13",children:"13px"}),a.jsx("option",{value:"14",children:"14px"}),a.jsx("option",{value:"15",children:"15px"}),a.jsx("option",{value:"16",children:"16px"}),a.jsx("option",{value:"18",children:"18px"}),a.jsx("option",{value:"20",children:"20px"})]})]})})]})]})}),_==="git"&&a.jsx(MG,{}),_==="agents"&&a.jsxs("div",{className:"flex flex-col md:flex-row h-full min-h-[400px] md:min-h-[500px]",children:[a.jsx("div",{className:"md:hidden border-b border-gray-200 dark:border-gray-700 flex-shrink-0",children:a.jsxs("div",{className:"flex",children:[a.jsx(Ya,{agentId:"claude",authStatus:xr,isSelected:se==="claude",onClick:()=>_e("claude"),isMobile:!0}),a.jsx(Ya,{agentId:"cursor",authStatus:ge,isSelected:se==="cursor",onClick:()=>_e("cursor"),isMobile:!0}),a.jsx(Ya,{agentId:"codex",authStatus:bt,isSelected:se==="codex",onClick:()=>_e("codex"),isMobile:!0})]})}),a.jsx("div",{className:"hidden md:block w-48 border-r border-gray-200 dark:border-gray-700 flex-shrink-0",children:a.jsxs("div",{className:"p-2",children:[a.jsx(Ya,{agentId:"claude",authStatus:xr,isSelected:se==="claude",onClick:()=>_e("claude")}),a.jsx(Ya,{agentId:"cursor",authStatus:ge,isSelected:se==="cursor",onClick:()=>_e("cursor")}),a.jsx(Ya,{agentId:"codex",authStatus:bt,isSelected:se==="codex",onClick:()=>_e("codex")})]})}),a.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[a.jsx("div",{className:"border-b border-gray-200 dark:border-gray-700 flex-shrink-0",children:a.jsxs("div",{className:"flex px-2 md:px-4 overflow-x-auto",children:[a.jsx("button",{onClick:()=>fe("account"),className:`px-3 md:px-4 py-2 md:py-3 text-xs md:text-sm font-medium border-b-2 transition-colors whitespace-nowrap ${oe==="account"?"border-blue-600 text-blue-600 dark:text-blue-400":"border-transparent text-muted-foreground hover:text-foreground"}`,children:o("tabs.account")}),a.jsx("button",{onClick:()=>fe("permissions"),className:`px-3 md:px-4 py-2 md:py-3 text-xs md:text-sm font-medium border-b-2 transition-colors whitespace-nowrap ${oe==="permissions"?"border-blue-600 text-blue-600 dark:text-blue-400":"border-transparent text-muted-foreground hover:text-foreground"}`,children:o("tabs.permissions")}),a.jsx("button",{onClick:()=>fe("mcp"),className:`px-3 md:px-4 py-2 md:py-3 text-xs md:text-sm font-medium border-b-2 transition-colors whitespace-nowrap ${oe==="mcp"?"border-blue-600 text-blue-600 dark:text-blue-400":"border-transparent text-muted-foreground hover:text-foreground"}`,children:o("tabs.mcpServers")})]})}),a.jsxs("div",{className:"flex-1 overflow-y-auto p-3 md:p-4",children:[oe==="account"&&a.jsx(UG,{agent:se,authStatus:se==="claude"?xr:se==="cursor"?ge:bt,onLogin:se==="claude"?fn:se==="cursor"?ya:qo}),oe==="permissions"&&se==="claude"&&a.jsx(_m,{agent:"claude",skipPermissions:f,setSkipPermissions:w,allowedTools:l,setAllowedTools:c,disallowedTools:d,setDisallowedTools:u,newAllowedTool:p,setNewAllowedTool:h,newDisallowedTool:m,setNewDisallowedTool:g}),oe==="permissions"&&se==="cursor"&&a.jsx(_m,{agent:"cursor",skipPermissions:Ee,setSkipPermissions:H,allowedCommands:Pt,setAllowedCommands:xe,disallowedCommands:at,setDisallowedCommands:de,newAllowedCommand:Y,setNewAllowedCommand:le,newDisallowedCommand:ve,setNewDisallowedCommand:Ve}),oe==="permissions"&&se==="codex"&&a.jsx(_m,{agent:"codex",permissionMode:ie,setPermissionMode:je}),oe==="mcp"&&se==="claude"&&a.jsx(Lm,{agent:"claude",servers:I,onAdd:()=>Ei(),onEdit:X=>Ei(X),onDelete:(X,ce)=>Ua(X,ce),onTest:(X,ce)=>na(X,ce),onDiscoverTools:(X,ce)=>bs(X,ce),testResults:re,serverTools:ue,toolsLoading:F}),oe==="mcp"&&se==="cursor"&&a.jsx(Lm,{agent:"cursor",servers:It,onAdd:()=>{},onEdit:X=>{},onDelete:X=>{}}),oe==="mcp"&&se==="codex"&&a.jsx(Lm,{agent:"codex",servers:Rt,onAdd:()=>fs(),onEdit:X=>fs(X),onDelete:X=>Ba(X)})]})]})]}),j&&a.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-[110] p-4",children:a.jsxs("div",{className:"bg-background border border-border rounded-lg w-full max-w-2xl max-h-[90vh] overflow-y-auto",children:[a.jsxs("div",{className:"flex items-center justify-between p-4 border-b border-border",children:[a.jsx("h3",{className:"text-lg font-medium text-foreground",children:o(P?"mcpForm.title.edit":"mcpForm.title.add")}),a.jsx(Be,{variant:"ghost",size:"sm",onClick:Dn,children:a.jsx(Bt,{className:"w-4 h-4"})})]}),a.jsxs("form",{onSubmit:vt,className:"p-4 space-y-4",children:[!P&&a.jsxs("div",{className:"flex gap-2 mb-4",children:[a.jsx("button",{type:"button",onClick:()=>z(X=>({...X,importMode:"form"})),className:`px-4 py-2 rounded-lg font-medium transition-colors ${D.importMode==="form"?"bg-blue-600 text-white":"bg-gray-100 dark:bg-gray-800 text-gray-700 dark:text-gray-300 hover:bg-gray-200 dark:hover:bg-gray-700"}`,children:o("mcpForm.importMode.form")}),a.jsx("button",{type:"button",onClick:()=>z(X=>({...X,importMode:"json"})),className:`px-4 py-2 rounded-lg font-medium transition-colors ${D.importMode==="json"?"bg-blue-600 text-white":"bg-gray-100 dark:bg-gray-800 text-gray-700 dark:text-gray-300 hover:bg-gray-200 dark:hover:bg-gray-700"}`,children:o("mcpForm.importMode.json")})]}),D.importMode==="form"&&P&&a.jsxs("div",{className:"bg-gray-50 dark:bg-gray-900/50 border border-gray-200 dark:border-gray-700 rounded-lg p-3",children:[a.jsx("label",{className:"block text-sm font-medium text-foreground mb-2",children:o("mcpForm.scope.label")}),a.jsxs("div",{className:"flex items-center gap-2",children:[D.scope==="user"?a.jsx(Dm,{className:"w-4 h-4"}):a.jsx(Tn,{className:"w-4 h-4"}),a.jsx("span",{className:"text-sm",children:D.scope==="user"?o("mcpForm.scope.userGlobal"):o("mcpForm.scope.projectLocal")}),D.scope==="local"&&D.projectPath&&a.jsxs("span",{className:"text-xs text-muted-foreground",children:["- ",D.projectPath]})]}),a.jsx("p",{className:"text-xs text-muted-foreground mt-2",children:o("mcpForm.scope.cannotChange")})]}),D.importMode==="form"&&!P&&a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{children:[a.jsxs("label",{className:"block text-sm font-medium text-foreground mb-2",children:[o("mcpForm.scope.label")," *"]}),a.jsxs("div",{className:"flex gap-2",children:[a.jsx("button",{type:"button",onClick:()=>z(X=>({...X,scope:"user",projectPath:""})),className:`flex-1 px-4 py-2 rounded-lg font-medium transition-colors ${D.scope==="user"?"bg-blue-600 text-white":"bg-gray-100 dark:bg-gray-800 text-gray-700 dark:text-gray-300 hover:bg-gray-200 dark:hover:bg-gray-700"}`,children:a.jsxs("div",{className:"flex items-center justify-center gap-2",children:[a.jsx(Dm,{className:"w-4 h-4"}),a.jsx("span",{children:o("mcpForm.scope.userGlobal")})]})}),a.jsx("button",{type:"button",onClick:()=>z(X=>({...X,scope:"local"})),className:`flex-1 px-4 py-2 rounded-lg font-medium transition-colors ${D.scope==="local"?"bg-blue-600 text-white":"bg-gray-100 dark:bg-gray-800 text-gray-700 dark:text-gray-300 hover:bg-gray-200 dark:hover:bg-gray-700"}`,children:a.jsxs("div",{className:"flex items-center justify-center gap-2",children:[a.jsx(Tn,{className:"w-4 h-4"}),a.jsx("span",{children:o("mcpForm.scope.projectLocal")})]})})]}),a.jsx("p",{className:"text-xs text-muted-foreground mt-2",children:D.scope==="user"?o("mcpForm.scope.userDescription"):o("mcpForm.scope.projectDescription")})]}),D.scope==="local"&&!P&&a.jsxs("div",{children:[a.jsxs("label",{className:"block text-sm font-medium text-foreground mb-2",children:[o("mcpForm.fields.selectProject")," *"]}),a.jsxs("select",{value:D.projectPath,onChange:X=>z(ce=>({...ce,projectPath:X.target.value})),className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 bg-gray-50 dark:bg-gray-800 text-gray-900 dark:text-gray-100 rounded-lg focus:ring-blue-500 focus:border-blue-500",required:D.scope==="local",children:[a.jsxs("option",{value:"",children:[o("mcpForm.fields.selectProject"),"..."]}),r.map(X=>a.jsx("option",{value:X.path||X.fullPath,children:X.displayName||X.name},X.name))]}),D.projectPath&&a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:o("mcpForm.projectPath",{path:D.projectPath})})]})]}),a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[a.jsxs("div",{className:D.importMode==="json"?"md:col-span-2":"",children:[a.jsxs("label",{className:"block text-sm font-medium text-foreground mb-2",children:[o("mcpForm.fields.serverName")," *"]}),a.jsx(tr,{value:D.name,onChange:X=>{z(ce=>({...ce,name:X.target.value}))},placeholder:o("mcpForm.placeholders.serverName"),required:!0})]}),D.importMode==="form"&&a.jsxs("div",{children:[a.jsxs("label",{className:"block text-sm font-medium text-foreground mb-2",children:[o("mcpForm.fields.transportType")," *"]}),a.jsxs("select",{value:D.type,onChange:X=>{z(ce=>({...ce,type:X.target.value}))},className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 bg-gray-50 dark:bg-gray-800 text-gray-900 dark:text-gray-100 rounded-lg focus:ring-blue-500 focus:border-blue-500",children:[a.jsx("option",{value:"stdio",children:"stdio"}),a.jsx("option",{value:"sse",children:"SSE"}),a.jsx("option",{value:"http",children:"HTTP"})]})]})]}),P&&D.raw&&D.importMode==="form"&&a.jsxs("div",{className:"bg-gray-50 dark:bg-gray-900/50 border border-gray-200 dark:border-gray-700 rounded-lg p-4",children:[a.jsx("h4",{className:"text-sm font-medium text-foreground mb-2",children:o("mcpForm.configDetails",{configFile:P.scope==="global"?"~/.claude.json":"project config"})}),a.jsx("pre",{className:"text-xs bg-gray-100 dark:bg-gray-800 p-3 rounded overflow-x-auto",children:JSON.stringify(D.raw,null,2)})]}),D.importMode==="json"&&a.jsx("div",{className:"space-y-4",children:a.jsxs("div",{children:[a.jsxs("label",{className:"block text-sm font-medium text-foreground mb-2",children:[o("mcpForm.fields.jsonConfig")," *"]}),a.jsx("textarea",{value:D.jsonInput,onChange:X=>{z(ce=>({...ce,jsonInput:X.target.value}));try{if(X.target.value.trim()){const ce=JSON.parse(X.target.value);ce.type?ce.type==="stdio"&&!ce.command?ke(o("mcpForm.validation.stdioRequiresCommand")):(ce.type==="http"||ce.type==="sse")&&!ce.url?ke(o("mcpForm.validation.httpRequiresUrl",{type:ce.type})):ke(""):ke(o("mcpForm.validation.missingType"))}}catch{X.target.value.trim()?ke(o("mcpForm.validation.invalidJson")):ke("")}},className:`w-full px-3 py-2 border ${me?"border-red-500":"border-gray-300 dark:border-gray-600"} bg-gray-50 dark:bg-gray-800 text-gray-900 dark:text-gray-100 rounded-lg focus:ring-blue-500 focus:border-blue-500 font-mono text-sm`,rows:"8",placeholder:`{
|
|
1206
|
+
`).length]}),a.jsxs("span",{children:["Characters: ",l.length]}),a.jsxs("span",{children:["Words: ",l.split(/\s+/).filter(_=>_.length>0).length]}),a.jsx("span",{children:"Format: Markdown"})]}),a.jsx("div",{className:"text-sm text-gray-500 dark:text-gray-400",children:"Press Ctrl+S to save • Esc to close"})]})]}),j&&a.jsx("div",{className:"fixed inset-0 bg-black/50 backdrop-blur-sm flex items-center justify-center z-50 p-4",children:a.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow-xl w-full max-w-md border border-gray-200 dark:border-gray-700",children:[a.jsxs("div",{className:"flex items-center justify-between p-6 border-b border-gray-200 dark:border-gray-700",children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("div",{className:"w-8 h-8 bg-purple-100 dark:bg-purple-900/50 rounded-lg flex items-center justify-center",children:a.jsx(Gn,{className:"w-4 h-4 text-purple-600 dark:text-purple-400"})}),a.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white",children:"Generate Tasks from PRD"})]}),a.jsx("button",{onClick:()=>T(!1),className:"p-2 text-gray-400 hover:text-gray-600 dark:hover:text-gray-300 rounded-md hover:bg-gray-100 dark:hover:bg-gray-700",children:a.jsx(Bt,{className:"w-5 h-5"})})]}),a.jsxs("div",{className:"p-6 space-y-4",children:[a.jsx("div",{className:"bg-purple-50 dark:bg-purple-900/20 rounded-lg p-4 border border-purple-200 dark:border-purple-800",children:a.jsxs("div",{className:"flex items-start gap-3",children:[a.jsx("div",{className:"w-8 h-8 bg-purple-100 dark:bg-purple-900/50 rounded-lg flex items-center justify-center flex-shrink-0 mt-0.5",children:a.jsx(Gn,{className:"w-4 h-4 text-purple-600 dark:text-purple-400"})}),a.jsxs("div",{className:"flex-1",children:[a.jsx("h4",{className:"font-semibold text-purple-900 dark:text-purple-100 mb-2",children:"💡 Pro Tip: Ask Claude Code Directly!"}),a.jsx("p",{className:"text-sm text-purple-800 dark:text-purple-200 mb-3",children:"You can simply ask Claude Code in the chat to parse your PRD and generate tasks. The AI assistant will automatically save your PRD and create detailed tasks with implementation details."}),a.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded border border-purple-200 dark:border-purple-700 p-3 mb-3",children:[a.jsx("p",{className:"text-xs font-medium text-gray-600 dark:text-gray-400 mb-1",children:"💬 Example:"}),a.jsxs("p",{className:"text-xs text-gray-900 dark:text-white font-mono",children:[`"I've just initialized a new project with Claude Task Master. I have a PRD at .taskmaster/docs/`,I.endsWith(".txt")||I.endsWith(".md")?I:`${I}.txt`,'. Can you help me parse it and set up the initial tasks?"']})]}),a.jsxs("p",{className:"text-xs text-purple-700 dark:text-purple-300",children:[a.jsx("strong",{children:"This will:"})," Save your PRD, analyze its content, and generate structured tasks with subtasks, dependencies, and implementation details."]})]})]})}),a.jsxs("div",{className:"text-center pt-4 border-t border-gray-200 dark:border-gray-700",children:[a.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400 mb-3",children:"For more examples and advanced usage patterns:"}),a.jsx("a",{href:"https://github.com/eyaltoledano/claude-task-master/blob/main/docs/examples.md",target:"_blank",rel:"noopener noreferrer",className:"inline-block text-sm text-purple-600 dark:text-purple-400 hover:text-purple-700 dark:hover:text-purple-300 underline font-medium",children:"View TaskMaster Documentation →"})]}),a.jsx("div",{className:"pt-4",children:a.jsx("button",{onClick:()=>T(!1),className:"w-full px-4 py-2 text-sm font-medium text-gray-700 dark:text-gray-300 bg-white dark:bg-gray-700 border border-gray-300 dark:border-gray-600 rounded-lg hover:bg-gray-50 dark:hover:bg-gray-600 transition-colors",children:"Got it, I'll ask Claude Code directly"})})]})]})}),P&&a.jsxs("div",{className:"fixed inset-0 z-[300] flex items-center justify-center p-4",children:[a.jsx("div",{className:"fixed inset-0 bg-black bg-opacity-50",onClick:()=>q(!1)}),a.jsx("div",{className:"relative bg-white dark:bg-gray-800 rounded-lg shadow-xl max-w-md w-full border border-gray-200 dark:border-gray-700",children:a.jsxs("div",{className:"p-6",children:[a.jsxs("div",{className:"flex items-center mb-4",children:[a.jsx("div",{className:"p-2 rounded-full mr-3 bg-yellow-100 dark:bg-yellow-900",children:a.jsx(Vn,{className:"w-5 h-5 text-yellow-600 dark:text-yellow-400"})}),a.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white",children:"File Already Exists"})]}),a.jsxs("p",{className:"text-sm text-gray-600 dark:text-gray-400 mb-6",children:['A PRD file named "',I.endsWith(".txt")||I.endsWith(".md")?I:`${I}.txt`,'" already exists. Do you want to overwrite it with the current content?']}),a.jsxs("div",{className:"flex justify-end space-x-3",children:[a.jsx("button",{onClick:()=>q(!1),className:"px-4 py-2 text-sm text-gray-700 dark:text-gray-300 bg-white dark:bg-gray-700 border border-gray-300 dark:border-gray-600 rounded-md hover:bg-gray-50 dark:hover:bg-gray-600 transition-colors",children:"Cancel"}),a.jsxs("button",{onClick:async()=>{q(!1),await K()},className:"px-4 py-2 text-sm text-white bg-yellow-600 hover:bg-yellow-700 rounded-md flex items-center space-x-2 transition-colors",children:[a.jsx(to,{className:"w-4 h-4"}),a.jsx("span",{children:"Overwrite"})]})]})]})})]})]})};function _G({selectedProject:e,selectedSession:t,activeTab:r,setActiveTab:n,ws:i,sendMessage:s,messages:o,isMobile:l,isPWA:c,onMenuClick:d,isLoading:u,onInputFocusChange:p,onSessionActive:h,onSessionInactive:m,onSessionProcessing:g,onSessionNotProcessing:f,processingSessions:w,onReplaceTemporarySession:S,onNavigateToSession:k,onShowSettings:E,autoExpandTools:N,showRawParameters:C,showThinking:v,autoScrollToBottom:I,sendByCtrlEnter:M,externalMessageUpdate:j}){const{t:T}=Ht(),[P,q]=x.useState(null),[D,z]=x.useState(null),[U,G]=x.useState(!1),[re,K]=x.useState(600),[ue,R]=x.useState(!1),[F,te]=x.useState(!1),_=x.useRef(null),[Z,me]=x.useState(!1),[ke,se]=x.useState(null),[_e,oe]=x.useState([]),[fe,Ie]=x.useState(null),{tasks:qe,currentProject:ze,refreshTasks:ct,setCurrentProject:Ye}=ss(),{tasksEnabled:wt,isTaskMasterInstalled:gt,isTaskMasterReady:et}=os(),Me=wt&>x.useEffect(()=>{e&&e!==ze&&Ye(e)},[e,ze,Ye]),x.useEffect(()=>{!Me&&r==="tasks"&&n("chat")},[Me,r,n]),x.useEffect(()=>{(async()=>{if(!ze?.name){oe([]);return}try{const le=await yt.get(`/taskmaster/prd/${encodeURIComponent(ze.name)}`);if(le.ok){const ve=await le.json();oe(ve.prdFiles||[])}else oe([])}catch(le){console.error("Failed to load existing PRDs:",le),oe([])}})()},[ze?.name]);const mt=(Y,le=null)=>{const ve={name:Y.split("/").pop(),path:Y,projectName:e?.name,diffInfo:le};q(ve)},Pt=()=>{q(null),te(!1)},xe=()=>{te(!F)},at=Y=>{if(typeof Y=="object"&&Y.id&&!Y.title){const le=qe?.find(ve=>ve.id===Y.id);le&&(z(le),G(!0))}else z(Y),G(!0)},ce=()=>{G(!1),z(null)},Ee=(Y,le)=>{console.log("Update task status:",Y,le),ct?.()},H=Y=>{l||(R(!0),Y.preventDefault())};return x.useEffect(()=>{const Y=ve=>{if(!ue)return;const Ve=_.current?.parentElement;if(!Ve)return;const It=Ve.getBoundingClientRect(),ft=It.right-ve.clientX,Rt=300,it=It.width*.8;ft>=Rt&&ft<=it&&K(ft)},le=()=>{R(!1)};return ue&&(document.addEventListener("mousemove",Y),document.addEventListener("mouseup",le),document.body.style.cursor="col-resize",document.body.style.userSelect="none"),()=>{document.removeEventListener("mousemove",Y),document.removeEventListener("mouseup",le),document.body.style.cursor="",document.body.style.userSelect=""}},[ue]),u?a.jsxs("div",{className:"h-full flex flex-col",children:[l&&a.jsx("div",{className:"bg-background border-b border-border p-2 sm:p-3 pwa-header-safe flex-shrink-0",children:a.jsx("button",{onClick:d,className:"p-2 text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-white rounded-md hover:bg-gray-100 dark:hover:bg-gray-700 pwa-menu-button",children:a.jsx("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 6h16M4 12h16M4 18h16"})})})}),a.jsx("div",{className:"flex-1 flex items-center justify-center",children:a.jsxs("div",{className:"text-center text-gray-500 dark:text-gray-400",children:[a.jsx("div",{className:"w-12 h-12 mx-auto mb-4",children:a.jsx("div",{className:"w-full h-full rounded-full border-4 border-gray-200 border-t-blue-500",style:{animation:"spin 1s linear infinite",WebkitAnimation:"spin 1s linear infinite",MozAnimation:"spin 1s linear infinite"}})}),a.jsx("h2",{className:"text-xl font-semibold mb-2",children:T("mainContent.loading")}),a.jsx("p",{children:T("mainContent.settingUpWorkspace")})]})})]}):e?a.jsxs("div",{className:"h-full flex flex-col",children:[a.jsx("div",{className:"bg-background border-b border-border p-2 sm:p-3 pwa-header-safe flex-shrink-0",children:a.jsxs("div",{className:"flex items-center justify-between relative",children:[a.jsxs("div",{className:"flex items-center space-x-2 min-w-0 flex-1",children:[l&&a.jsx("button",{onClick:d,onTouchStart:Y=>{Y.preventDefault(),d()},className:"p-2 text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-white rounded-md hover:bg-gray-100 dark:hover:bg-gray-700 touch-manipulation active:scale-95 pwa-menu-button flex-shrink-0",children:a.jsx("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 6h16M4 12h16M4 18h16"})})}),a.jsxs("div",{className:"min-w-0 flex items-center gap-2 flex-1 overflow-x-auto scrollbar-hide",children:[r==="chat"&&t&&a.jsx("div",{className:"w-5 h-5 flex-shrink-0 flex items-center justify-center",children:t.__provider==="cursor"?a.jsx(pn,{className:"w-4 h-4"}):a.jsx(nn,{className:"w-4 h-4"})}),a.jsx("div",{className:"min-w-0 flex-1",children:r==="chat"&&t?a.jsxs("div",{className:"min-w-0",children:[a.jsx("h2",{className:"text-sm sm:text-base font-semibold text-gray-900 dark:text-white whitespace-nowrap overflow-x-auto scrollbar-hide",children:t.__provider==="cursor"?t.name||"Untitled Session":t.summary||"New Session"}),a.jsx("div",{className:"text-xs text-gray-500 dark:text-gray-400 truncate",children:e.displayName})]}):r==="chat"&&!t?a.jsxs("div",{className:"min-w-0",children:[a.jsx("h2",{className:"text-sm sm:text-base font-semibold text-gray-900 dark:text-white",children:T("mainContent.newSession")}),a.jsx("div",{className:"text-xs text-gray-500 dark:text-gray-400 truncate",children:e.displayName})]}):a.jsxs("div",{className:"min-w-0",children:[a.jsx("h2",{className:"text-sm sm:text-base font-semibold text-gray-900 dark:text-white",children:r==="files"?T("mainContent.projectFiles"):r==="git"?T("tabs.git"):r==="tasks"&&Me?"TaskMaster":"Project"}),a.jsx("div",{className:"text-xs text-gray-500 dark:text-gray-400 truncate",children:e.displayName})]})})]})]}),a.jsx("div",{className:"flex-shrink-0 hidden sm:block",children:a.jsxs("div",{className:"relative flex bg-gray-100 dark:bg-gray-800 rounded-lg p-1",children:[a.jsx(Pr,{content:T("tabs.chat"),position:"bottom",children:a.jsx("button",{onClick:()=>n("chat"),className:`relative px-2 sm:px-3 py-1.5 text-xs sm:text-sm font-medium rounded-md ${r==="chat"?"bg-white dark:bg-gray-700 text-gray-900 dark:text-white shadow-sm":"text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-white hover:bg-gray-200 dark:hover:bg-gray-700"}`,children:a.jsxs("span",{className:"flex items-center gap-1 sm:gap-1.5",children:[a.jsx("svg",{className:"w-3 sm:w-3.5 h-3 sm:h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M8 12h.01M12 12h.01M16 12h.01M21 12c0 4.418-4.03 8-9 8a9.863 9.863 0 01-4.255-.949L3 20l1.395-3.72C3.512 15.042 3 13.574 3 12c0-4.418 4.03-8 9-8s9 3.582 9 8z"})}),a.jsx("span",{className:"hidden md:hidden lg:inline",children:T("tabs.chat")})]})})}),a.jsx(Pr,{content:T("tabs.shell"),position:"bottom",children:a.jsx("button",{onClick:()=>n("shell"),className:`relative px-2 sm:px-3 py-1.5 text-xs sm:text-sm font-medium rounded-md transition-all duration-200 ${r==="shell"?"bg-white dark:bg-gray-700 text-gray-900 dark:text-white shadow-sm":"text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-white hover:bg-gray-200 dark:hover:bg-gray-700"}`,children:a.jsxs("span",{className:"flex items-center gap-1 sm:gap-1.5",children:[a.jsx("svg",{className:"w-3 sm:w-3.5 h-3 sm:h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M8 9l3 3-3 3m5 0h3M5 20h14a2 2 0 002-2V6a2 2 0 00-2-2H5a2 2 0 00-2 2v14a2 2 0 002 2z"})}),a.jsx("span",{className:"hidden md:hidden lg:inline",children:T("tabs.shell")})]})})}),a.jsx(Pr,{content:T("tabs.files"),position:"bottom",children:a.jsx("button",{onClick:()=>n("files"),className:`relative px-2 sm:px-3 py-1.5 text-xs sm:text-sm font-medium rounded-md transition-all duration-200 ${r==="files"?"bg-white dark:bg-gray-700 text-gray-900 dark:text-white shadow-sm":"text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-white hover:bg-gray-200 dark:hover:bg-gray-700"}`,children:a.jsxs("span",{className:"flex items-center gap-1 sm:gap-1.5",children:[a.jsx("svg",{className:"w-3 sm:w-3.5 h-3 sm:h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M3 7v10a2 2 0 002 2h14a2 2 0 002-2V9a2 2 0 00-2-2h-5l-2-2H5a2 2 0 00-2 2z"})}),a.jsx("span",{className:"hidden md:hidden lg:inline",children:T("tabs.files")})]})})}),a.jsx(Pr,{content:T("tabs.git"),position:"bottom",children:a.jsx("button",{onClick:()=>n("git"),className:`relative px-2 sm:px-3 py-1.5 text-xs sm:text-sm font-medium rounded-md transition-all duration-200 ${r==="git"?"bg-white dark:bg-gray-700 text-gray-900 dark:text-white shadow-sm":"text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-white hover:bg-gray-200 dark:hover:bg-gray-700"}`,children:a.jsxs("span",{className:"flex items-center gap-1 sm:gap-1.5",children:[a.jsx("svg",{className:"w-3 sm:w-3.5 h-3 sm:h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M13 10V3L4 14h7v7l9-11h-7z"})}),a.jsx("span",{className:"hidden md:hidden lg:inline",children:T("tabs.git")})]})})}),Me&&a.jsx(Pr,{content:T("tabs.tasks"),position:"bottom",children:a.jsx("button",{onClick:()=>n("tasks"),className:`relative px-2 sm:px-3 py-1.5 text-xs sm:text-sm font-medium rounded-md transition-all duration-200 ${r==="tasks"?"bg-white dark:bg-gray-700 text-gray-900 dark:text-white shadow-sm":"text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-white hover:bg-gray-200 dark:hover:bg-gray-700"}`,children:a.jsxs("span",{className:"flex items-center gap-1 sm:gap-1.5",children:[a.jsx("svg",{className:"w-3 sm:w-3.5 h-3 sm:h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5H7a2 2 0 00-2 2v10a2 2 0 002 2h8a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4"})}),a.jsx("span",{className:"hidden md:hidden lg:inline",children:T("tabs.tasks")})]})})})]})})]})}),a.jsxs("div",{className:"flex-1 flex min-h-0 overflow-hidden",children:[a.jsxs("div",{className:`flex-1 flex flex-col min-h-0 overflow-hidden ${P?"mr-0":""} ${F?"hidden":""}`,children:[a.jsx("div",{className:`h-full ${r==="chat"?"block":"hidden"}`,children:a.jsx(AG,{showDetails:!0,children:a.jsx(Mq,{selectedProject:e,selectedSession:t,ws:i,sendMessage:s,messages:o,onFileOpen:mt,onInputFocusChange:p,onSessionActive:h,onSessionInactive:m,onSessionProcessing:g,onSessionNotProcessing:f,processingSessions:w,onReplaceTemporarySession:S,onNavigateToSession:k,onShowSettings:E,autoExpandTools:N,showRawParameters:C,showThinking:v,autoScrollToBottom:I,sendByCtrlEnter:M,externalMessageUpdate:j,onShowAllTasks:wt?()=>n("tasks"):null})})}),r==="files"&&a.jsx("div",{className:"h-full overflow-hidden",children:a.jsx(CG,{selectedProject:e})}),r==="shell"&&a.jsx("div",{className:"h-full w-full overflow-hidden",children:a.jsx(o3,{project:e,session:t,showHeader:!1})}),r==="git"&&a.jsx("div",{className:"h-full overflow-hidden",children:a.jsx(TG,{selectedProject:e,isMobile:l,onFileOpen:mt})}),Me&&a.jsx("div",{className:`h-full ${r==="tasks"?"block":"hidden"}`,children:a.jsx("div",{className:"h-full flex flex-col overflow-hidden",children:a.jsx(RG,{tasks:qe||[],onTaskClick:at,showParentTasks:!0,className:"flex-1 overflow-y-auto p-4",currentProject:ze,onTaskCreated:ct,onShowPRDEditor:(Y=null)=>{se(Y),me(!0)},existingPRDs:_e,onRefreshPRDs:(Y=!1)=>{ze?.name&&yt.get(`/taskmaster/prd/${encodeURIComponent(ze.name)}`).then(le=>le.ok?le.json():Promise.reject()).then(le=>{oe(le.prdFiles||[]),Y&&(Ie("PRD saved successfully!"),setTimeout(()=>Ie(null),3e3))}).catch(le=>console.error("Failed to refresh PRDs:",le))}})})}),a.jsx("div",{className:`h-full overflow-hidden ${r==="preview"?"block":"hidden"}`})]}),P&&!l&&a.jsxs(a.Fragment,{children:[!F&&a.jsx("div",{ref:_,onMouseDown:H,className:"flex-shrink-0 w-1 bg-gray-200 dark:bg-gray-700 hover:bg-blue-500 dark:hover:bg-blue-600 cursor-col-resize transition-colors relative group",title:"Drag to resize",children:a.jsx("div",{className:"absolute inset-y-0 left-1/2 -translate-x-1/2 w-1 bg-blue-500 dark:bg-blue-600 opacity-0 group-hover:opacity-100 transition-opacity"})}),a.jsx("div",{className:`flex-shrink-0 border-l border-gray-200 dark:border-gray-700 h-full overflow-hidden ${F?"flex-1":""}`,style:F?{}:{width:`${re}px`},children:a.jsx(Ih,{file:P,onClose:Pt,projectPath:e?.path,isSidebar:!0,isExpanded:F,onToggleExpand:xe})})]})]}),P&&l&&a.jsx(Ih,{file:P,onClose:Pt,projectPath:e?.path,isSidebar:!1}),Me&&U&&D&&a.jsx(IN,{task:D,isOpen:U,onClose:ce,onStatusChange:Ee,onTaskClick:at}),Z&&a.jsx(jG,{project:ze,projectPath:ze?.fullPath||ze?.path,onClose:()=>{me(!1),se(null)},isNewFile:!ke?.isExisting,file:{name:ke?.name||"prd.txt",content:ke?.content||""},onSave:async()=>{me(!1),se(null);try{const Y=await yt.get(`/taskmaster/prd/${encodeURIComponent(ze.name)}`);if(Y.ok){const le=await Y.json();oe(le.prdFiles||[]),Ie("PRD saved successfully!"),setTimeout(()=>Ie(null),3e3)}}catch(Y){console.error("Failed to refresh PRDs:",Y)}ct?.()}}),fe&&a.jsx("div",{className:"fixed bottom-4 right-4 z-50 animate-in slide-in-from-bottom-2 duration-300",children:a.jsxs("div",{className:"bg-green-600 text-white px-4 py-3 rounded-lg shadow-lg flex items-center gap-3",children:[a.jsx("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})}),a.jsx("span",{className:"font-medium",children:fe})]})})]}):a.jsxs("div",{className:"h-full flex flex-col",children:[l&&a.jsx("div",{className:"bg-background border-b border-border p-2 sm:p-3 pwa-header-safe flex-shrink-0",children:a.jsx("button",{onClick:d,className:"p-2 text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-white rounded-md hover:bg-gray-100 dark:hover:bg-gray-700 pwa-menu-button",children:a.jsx("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 6h16M4 12h16M4 18h16"})})})}),a.jsx("div",{className:"flex-1 flex items-center justify-center",children:a.jsxs("div",{className:"text-center text-gray-500 dark:text-gray-400 max-w-md mx-auto px-6",children:[a.jsx("div",{className:"w-16 h-16 mx-auto mb-6 bg-gray-100 dark:bg-gray-800 rounded-full flex items-center justify-center",children:a.jsx("svg",{className:"w-8 h-8 text-gray-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M3 7v10a2 2 0 002 2h14a2 2 0 002-2V9a2 2 0 00-2-2h-5l-2-2H5a2 2 0 00-2 2z"})})}),a.jsx("h2",{className:"text-2xl font-semibold mb-3 text-gray-900 dark:text-white",children:T("mainContent.chooseProject")}),a.jsx("p",{className:"text-gray-600 dark:text-gray-300 mb-6 leading-relaxed",children:T("mainContent.selectProjectDescription")}),a.jsx("div",{className:"bg-blue-50 dark:bg-blue-900/20 rounded-lg p-4 border border-blue-200 dark:border-blue-800",children:a.jsxs("p",{className:"text-sm text-blue-700 dark:text-blue-300",children:["💡 ",a.jsxs("strong",{children:[T("mainContent.tip"),":"]})," ",T(l?"mainContent.createProjectMobile":"mainContent.createProjectDesktop")]})})]})})]})}const LG=ir.memo(_G);function OG({activeTab:e,setActiveTab:t,isInputFocused:r}){const{tasksEnabled:n}=os(),i=[{id:"chat",icon:Wi,onClick:()=>t("chat")},{id:"shell",icon:pa,onClick:()=>t("shell")},{id:"files",icon:ca,onClick:()=>t("files")},{id:"git",icon:qn,onClick:()=>t("git")},...n?[{id:"tasks",icon:W6,onClick:()=>t("tasks")}]:[]];return a.jsx("div",{className:`fixed bottom-0 left-0 right-0 bg-background border-t border-border z-50 ios-bottom-safe transform transition-transform duration-300 ease-in-out shadow-lg ${r?"translate-y-full":"translate-y-0"}`,children:a.jsx("div",{className:"flex items-center justify-around py-1",children:i.map(s=>{const o=s.icon,l=e===s.id;return a.jsxs("button",{onClick:s.onClick,onTouchStart:c=>{c.preventDefault(),s.onClick()},className:`flex items-center justify-center p-2 rounded-lg min-h-[40px] min-w-[40px] relative touch-manipulation ${l?"text-blue-600 dark:text-blue-400":"text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-white"}`,"aria-label":s.id,children:[a.jsx(o,{className:"w-5 h-5"}),l&&a.jsx("div",{className:"absolute top-0 left-1/2 transform -translate-x-1/2 w-6 h-0.5 bg-blue-600 dark:bg-blue-400 rounded-full"})]},s.id)})})})}const Rh="1.15.0",l3=(e,t)=>{const[r,n]=x.useState(!1),[i,s]=x.useState(null),[o,l]=x.useState(null);return x.useEffect(()=>{const c=async()=>{try{const p=await(await fetch(`https://api.github.com/repos/${e}/${t}/releases/latest`)).json();if(p.tag_name){const h=p.tag_name.replace(/^v/,"");s(h),n(Rh!==h),l({title:p.name||p.tag_name,body:p.body||"",htmlUrl:p.html_url||`https://github.com/${e}/${t}/releases/latest`,publishedAt:p.published_at})}else n(!1),s(null),l(null)}catch(u){console.error("Version check failed:",u),n(!1),s(null),l(null)}};c();const d=setInterval(c,300*1e3);return()=>clearInterval(d)},[e,t]),{updateAvailable:r,latestVersion:i,currentVersion:Rh,releaseInfo:o}};function DG(){const{t:e}=Ht("settings"),[t,r]=x.useState([]),[n,i]=x.useState([]),[s,o]=x.useState(!0),[l,c]=x.useState(!1),[d,u]=x.useState(!1),[p,h]=x.useState(""),[m,g]=x.useState(""),[f,w]=x.useState(""),[S,k]=x.useState(""),[E,N]=x.useState({}),[C,v]=x.useState(null),[I,M]=x.useState(null),{updateAvailable:j,latestVersion:T,releaseInfo:P}=l3("siteboon","claudecodeui");x.useEffect(()=>{q()},[]);const q=async()=>{try{o(!0);const F=await(await Ce("/api/settings/api-keys")).json();r(F.apiKeys||[]);const _=await(await Ce("/api/settings/credentials?type=github_token")).json();i(_.credentials||[])}catch(R){console.error("Error fetching settings:",R)}finally{o(!1)}},D=async()=>{if(p.trim())try{const F=await(await Ce("/api/settings/api-keys",{method:"POST",body:JSON.stringify({keyName:p})})).json();F.success&&(M(F.apiKey),h(""),c(!1),q())}catch(R){console.error("Error creating API key:",R)}},z=async R=>{if(confirm(e("apiKeys.confirmDelete")))try{await Ce(`/api/settings/api-keys/${R}`,{method:"DELETE"}),q()}catch(F){console.error("Error deleting API key:",F)}},U=async(R,F)=>{try{await Ce(`/api/settings/api-keys/${R}/toggle`,{method:"PATCH",body:JSON.stringify({isActive:!F})}),q()}catch(te){console.error("Error toggling API key:",te)}},G=async()=>{if(!(!m.trim()||!f.trim()))try{(await(await Ce("/api/settings/credentials",{method:"POST",body:JSON.stringify({credentialName:m,credentialType:"github_token",credentialValue:f,description:S})})).json()).success&&(g(""),w(""),k(""),u(!1),q())}catch(R){console.error("Error creating GitHub credential:",R)}},re=async R=>{if(confirm(e("apiKeys.github.confirmDelete")))try{await Ce(`/api/settings/credentials/${R}`,{method:"DELETE"}),q()}catch(F){console.error("Error deleting GitHub credential:",F)}},K=async(R,F)=>{try{await Ce(`/api/settings/credentials/${R}/toggle`,{method:"PATCH",body:JSON.stringify({isActive:!F})}),q()}catch(te){console.error("Error toggling GitHub credential:",te)}},ue=(R,F)=>{navigator.clipboard.writeText(R),v(F),setTimeout(()=>v(null),2e3)};return s?a.jsx("div",{className:"text-muted-foreground",children:e("apiKeys.loading")}):a.jsxs("div",{className:"space-y-8",children:[I&&a.jsxs("div",{className:"p-4 bg-yellow-500/10 border border-yellow-500/20 rounded-lg",children:[a.jsx("h4",{className:"font-semibold text-yellow-500 mb-2",children:e("apiKeys.newKey.alertTitle")}),a.jsx("p",{className:"text-sm text-muted-foreground mb-3",children:e("apiKeys.newKey.alertMessage")}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("code",{className:"flex-1 px-3 py-2 bg-background/50 rounded font-mono text-sm break-all",children:I.apiKey}),a.jsx(Be,{size:"sm",variant:"outline",onClick:()=>ue(I.apiKey,"new"),children:C==="new"?a.jsx(Cr,{className:"h-4 w-4"}):a.jsx(u4,{className:"h-4 w-4"})})]}),a.jsx(Be,{size:"sm",variant:"ghost",className:"mt-3",onClick:()=>M(null),children:e("apiKeys.newKey.iveSavedIt")})]}),a.jsxs("div",{children:[a.jsxs("div",{className:"flex items-center justify-between mb-4",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(Fh,{className:"h-5 w-5"}),a.jsx("h3",{className:"text-lg font-semibold",children:e("apiKeys.title")})]}),a.jsxs(Be,{size:"sm",onClick:()=>c(!l),children:[a.jsx(gr,{className:"h-4 w-4 mr-1"}),e("apiKeys.newButton")]})]}),a.jsxs("div",{className:"mb-4",children:[a.jsx("p",{className:"text-sm text-muted-foreground mb-2",children:e("apiKeys.description")}),a.jsxs("a",{href:"/api-docs.html",target:"_blank",rel:"noopener noreferrer",className:"text-sm text-primary hover:underline inline-flex items-center gap-1",children:[e("apiKeys.apiDocsLink"),a.jsx(of,{className:"h-3 w-3"})]})]}),l&&a.jsxs("div",{className:"mb-4 p-4 border rounded-lg bg-card",children:[a.jsx(tr,{placeholder:e("apiKeys.form.placeholder"),value:p,onChange:R=>h(R.target.value),className:"mb-2"}),a.jsxs("div",{className:"flex gap-2",children:[a.jsx(Be,{onClick:D,children:e("apiKeys.form.createButton")}),a.jsx(Be,{variant:"outline",onClick:()=>c(!1),children:e("apiKeys.form.cancelButton")})]})]}),a.jsx("div",{className:"space-y-2",children:t.length===0?a.jsx("p",{className:"text-sm text-muted-foreground italic",children:e("apiKeys.empty")}):t.map(R=>a.jsxs("div",{className:"flex items-center justify-between p-3 border rounded-lg",children:[a.jsxs("div",{className:"flex-1",children:[a.jsx("div",{className:"font-medium",children:R.key_name}),a.jsx("code",{className:"text-xs text-muted-foreground",children:R.api_key}),a.jsxs("div",{className:"text-xs text-muted-foreground mt-1",children:[e("apiKeys.list.created")," ",new Date(R.created_at).toLocaleDateString(),R.last_used&&` • ${e("apiKeys.list.lastUsed")} ${new Date(R.last_used).toLocaleDateString()}`]})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(Be,{size:"sm",variant:R.is_active?"outline":"secondary",onClick:()=>U(R.id,R.is_active),children:R.is_active?e("apiKeys.status.active"):e("apiKeys.status.inactive")}),a.jsx(Be,{size:"sm",variant:"ghost",onClick:()=>z(R.id),children:a.jsx(Nr,{className:"h-4 w-4"})})]})]},R.id))})]}),a.jsxs("div",{children:[a.jsxs("div",{className:"flex items-center justify-between mb-4",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(s6,{className:"h-5 w-5"}),a.jsx("h3",{className:"text-lg font-semibold",children:e("apiKeys.github.title")})]}),a.jsxs(Be,{size:"sm",onClick:()=>u(!d),children:[a.jsx(gr,{className:"h-4 w-4 mr-1"}),e("apiKeys.github.addButton")]})]}),a.jsx("p",{className:"text-sm text-muted-foreground mb-4",children:e("apiKeys.github.descriptionAlt")}),d&&a.jsxs("div",{className:"mb-4 p-4 border rounded-lg bg-card space-y-3",children:[a.jsx(tr,{placeholder:e("apiKeys.github.form.namePlaceholder"),value:m,onChange:R=>g(R.target.value)}),a.jsxs("div",{className:"relative",children:[a.jsx(tr,{type:E.new?"text":"password",placeholder:e("apiKeys.github.form.tokenPlaceholder"),value:f,onChange:R=>w(R.target.value),className:"pr-10"}),a.jsx("button",{type:"button",onClick:()=>N({...E,new:!E.new}),className:"absolute right-3 top-2.5 text-muted-foreground hover:text-foreground",children:E.new?a.jsx(p4,{className:"h-4 w-4"}):a.jsx(hi,{className:"h-4 w-4"})})]}),a.jsx(tr,{placeholder:e("apiKeys.github.form.descriptionPlaceholder"),value:S,onChange:R=>k(R.target.value)}),a.jsxs("div",{className:"flex gap-2",children:[a.jsx(Be,{onClick:G,children:e("apiKeys.github.form.addButton")}),a.jsx(Be,{variant:"outline",onClick:()=>{u(!1),g(""),w(""),k("")},children:e("apiKeys.github.form.cancelButton")})]}),a.jsx("a",{href:"https://github.com/settings/tokens",target:"_blank",rel:"noopener noreferrer",className:"text-xs text-primary hover:underline block",children:e("apiKeys.github.form.howToCreate")})]}),a.jsx("div",{className:"space-y-2",children:n.length===0?a.jsx("p",{className:"text-sm text-muted-foreground italic",children:e("apiKeys.github.empty")}):n.map(R=>a.jsxs("div",{className:"flex items-center justify-between p-3 border rounded-lg",children:[a.jsxs("div",{className:"flex-1",children:[a.jsx("div",{className:"font-medium",children:R.credential_name}),R.description&&a.jsx("div",{className:"text-xs text-muted-foreground",children:R.description}),a.jsxs("div",{className:"text-xs text-muted-foreground mt-1",children:[e("apiKeys.github.added")," ",new Date(R.created_at).toLocaleDateString()]})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(Be,{size:"sm",variant:R.is_active?"outline":"secondary",onClick:()=>K(R.id,R.is_active),children:R.is_active?e("apiKeys.status.active"):e("apiKeys.status.inactive")}),a.jsx(Be,{size:"sm",variant:"ghost",onClick:()=>re(R.id),children:a.jsx(Nr,{className:"h-4 w-4"})})]})]},R.id))})]}),a.jsx("div",{className:"pt-6 border-t border-border/50",children:a.jsxs("div",{className:"flex items-center justify-between text-xs italic text-muted-foreground/60",children:[a.jsxs("a",{href:P?.htmlUrl||"https://github.com/siteboon/claudecodeui/releases",target:"_blank",rel:"noopener noreferrer",className:"hover:text-muted-foreground transition-colors",children:["v",Rh]}),j&&T&&a.jsxs("a",{href:P?.htmlUrl||"https://github.com/siteboon/claudecodeui/releases",target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-1.5 px-2 py-0.5 bg-green-500/10 text-green-600 dark:text-green-400 rounded-full hover:bg-green-500/20 transition-colors not-italic font-medium",children:[a.jsx("span",{className:"text-[10px]",children:e("apiKeys.version.updateAvailable",{version:T})}),a.jsx(of,{className:"h-2.5 w-2.5"})]})]})})]})}function MG(){const{t:e}=Ht("settings"),[t,r]=x.useState(""),[n,i]=x.useState(""),[s,o]=x.useState(!1),[l,c]=x.useState(!1),[d,u]=x.useState(null);x.useEffect(()=>{p()},[]);const p=async()=>{try{o(!0);const m=await Ce("/api/user/git-config");if(m.ok){const g=await m.json();r(g.gitName||""),i(g.gitEmail||"")}}catch(m){console.error("Error loading git config:",m)}finally{o(!1)}},h=async()=>{try{c(!0);const m=await Ce("/api/user/git-config",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({gitName:t,gitEmail:n})});if(m.ok)u("success"),setTimeout(()=>u(null),3e3);else{const g=await m.json();u("error"),console.error("Failed to save git config:",g.error)}}catch(m){console.error("Error saving git config:",m),u("error")}finally{c(!1)}};return a.jsx("div",{className:"space-y-8",children:a.jsxs("div",{children:[a.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[a.jsx(qn,{className:"h-5 w-5"}),a.jsx("h3",{className:"text-lg font-semibold",children:e("git.title")})]}),a.jsx("p",{className:"text-sm text-muted-foreground mb-4",children:e("git.description")}),a.jsxs("div",{className:"p-4 border rounded-lg bg-card space-y-3",children:[a.jsxs("div",{children:[a.jsx("label",{htmlFor:"settings-git-name",className:"block text-sm font-medium text-foreground mb-2",children:e("git.name.label")}),a.jsx(tr,{id:"settings-git-name",type:"text",value:t,onChange:m=>r(m.target.value),placeholder:"John Doe",disabled:s,className:"w-full"}),a.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:e("git.name.help")})]}),a.jsxs("div",{children:[a.jsx("label",{htmlFor:"settings-git-email",className:"block text-sm font-medium text-foreground mb-2",children:e("git.email.label")}),a.jsx(tr,{id:"settings-git-email",type:"email",value:n,onChange:m=>i(m.target.value),placeholder:"john@example.com",disabled:s,className:"w-full"}),a.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:e("git.email.help")})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(Be,{onClick:h,disabled:l||!t||!n,children:e(l?"git.actions.saving":"git.actions.save")}),d==="success"&&a.jsxs("div",{className:"text-sm text-green-600 dark:text-green-400 flex items-center gap-2",children:[a.jsx(Cr,{className:"w-4 h-4"}),e("git.status.success")]})]})]})]})})}function FG(){const{t:e}=Ht("settings"),{tasksEnabled:t,setTasksEnabled:r,isTaskMasterInstalled:n,isCheckingInstallation:i}=os();return a.jsx("div",{className:"space-y-8",children:i?a.jsx("div",{className:"bg-gray-50 dark:bg-gray-900/50 border border-gray-200 dark:border-gray-700 rounded-lg p-4",children:a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("div",{className:"animate-spin w-5 h-5 border-2 border-blue-600 border-t-transparent rounded-full"}),a.jsx("span",{className:"text-sm text-muted-foreground",children:e("tasks.checking")})]})}):a.jsxs(a.Fragment,{children:[!n&&a.jsx("div",{className:"bg-orange-50 dark:bg-orange-950/50 border border-orange-200 dark:border-orange-800 rounded-lg p-4",children:a.jsxs("div",{className:"flex items-start gap-3",children:[a.jsx("div",{className:"w-8 h-8 bg-orange-100 dark:bg-orange-900 rounded-full flex items-center justify-center flex-shrink-0 mt-0.5",children:a.jsx("svg",{className:"w-4 h-4 text-orange-600 dark:text-orange-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-2.5L13.732 4c-.77-.833-1.964-.833-2.732 0L4.082 16.5c-.77.833.192 2.5 1.732 2.5z"})})}),a.jsxs("div",{className:"flex-1",children:[a.jsx("div",{className:"font-medium text-orange-900 dark:text-orange-100 mb-2",children:e("tasks.notInstalled.title")}),a.jsxs("div",{className:"text-sm text-orange-800 dark:text-orange-200 space-y-3",children:[a.jsx("p",{children:e("tasks.notInstalled.description")}),a.jsx("div",{className:"bg-orange-100 dark:bg-orange-900/50 rounded-lg p-3 font-mono text-sm",children:a.jsx("code",{children:e("tasks.notInstalled.installCommand")})}),a.jsx("div",{children:a.jsxs("a",{href:"https://github.com/eyaltoledano/claude-task-master",target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-2 text-blue-600 dark:text-blue-400 hover:text-blue-700 dark:hover:text-blue-300 font-medium text-sm",children:[a.jsx("svg",{className:"w-4 h-4",fill:"currentColor",viewBox:"0 0 20 20",children:a.jsx("path",{fillRule:"evenodd",d:"M10 0C4.477 0 0 4.484 0 10.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 0110 4.844c.85.004 1.705.115 2.504.337 1.909-1.296 2.747-1.027 2.747-1.027.546 1.379.203 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.942.359.31.678.921.678 1.856 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.019 10.019 0 0020 10.017C20 4.484 15.522 0 10 0z",clipRule:"evenodd"})}),e("tasks.notInstalled.viewOnGitHub"),a.jsx("svg",{className:"w-3 h-3",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:a.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"})})]})}),a.jsxs("div",{className:"space-y-2",children:[a.jsx("p",{className:"font-medium",children:e("tasks.notInstalled.afterInstallation")}),a.jsxs("ol",{className:"list-decimal list-inside space-y-1 text-xs",children:[a.jsx("li",{children:e("tasks.notInstalled.steps.restart")}),a.jsx("li",{children:e("tasks.notInstalled.steps.autoAvailable")}),a.jsx("li",{children:e("tasks.notInstalled.steps.initCommand")})]})]})]})]})]})}),n&&a.jsx("div",{className:"space-y-4",children:a.jsx("div",{className:"bg-gray-50 dark:bg-gray-900/50 border border-gray-200 dark:border-gray-700 rounded-lg p-4",children:a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{children:[a.jsx("div",{className:"font-medium text-foreground",children:e("tasks.settings.enableLabel")}),a.jsx("div",{className:"text-sm text-muted-foreground mt-1",children:e("tasks.settings.enableDescription")})]}),a.jsxs("label",{className:"relative inline-flex items-center cursor-pointer",children:[a.jsx("input",{type:"checkbox",checked:t,onChange:s=>r(s.target.checked),className:"sr-only peer"}),a.jsx("div",{className:"w-11 h-6 bg-gray-200 peer-focus:outline-none peer-focus:ring-4 peer-focus:ring-blue-300 dark:peer-focus:ring-blue-800 rounded-full peer dark:bg-gray-700 peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white after:border-gray-300 after:border after:rounded-full after:h-5 after:w-5 after:transition-all dark:border-gray-600 peer-checked:bg-blue-600"})]})]})})})]})})}function c3({isOpen:e,onClose:t,provider:r="claude",project:n,onComplete:i,customCommand:s,isAuthenticated:o=!1}){if(!e)return null;const l=()=>{if(s)return s;const u=!1;switch(r){case"claude":return o?"claude setup-token --dangerously-skip-permissions":"claude /exit --dangerously-skip-permissions --no-session-persistence";case"cursor":return"cursor-agent login";case"codex":return u?"codex login --device-auth":"codex login";default:return o?"claude setup-token --dangerously-skip-permissions":"claude /exit --dangerously-skip-permissions --no-session-persistence"}},c=()=>{switch(r){case"claude":return"Claude CLI Login";case"cursor":return"Cursor CLI Login";case"codex":return"Codex CLI Login";default:return"CLI Login"}},d=u=>{i&&i(u),u===0&&t()};return a.jsx("div",{className:"fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-[9999] max-md:items-stretch max-md:justify-stretch",children:a.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow-xl w-full max-w-4xl h-3/4 flex flex-col md:max-w-4xl md:h-3/4 md:rounded-lg md:m-4 max-md:max-w-none max-md:h-full max-md:rounded-none max-md:m-0",children:[a.jsxs("div",{className:"flex items-center justify-between p-4 border-b border-gray-200 dark:border-gray-700",children:[a.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white",children:c()}),a.jsx("button",{onClick:t,className:"text-gray-400 hover:text-gray-600 dark:hover:text-gray-300 transition-colors","aria-label":"Close login modal",children:a.jsx(Bt,{className:"w-6 h-6"})})]}),a.jsx("div",{className:"flex-1 overflow-hidden",children:a.jsx(o3,{project:n,command:l(),onComplete:d,minimal:!0})})]})})}const PG={claude:{name:"Claude",color:"blue",Logo:nn},cursor:{name:"Cursor",color:"purple",Logo:pn},codex:{name:"Codex",color:"gray",Logo:wn}},BG={blue:{border:"border-l-blue-500 md:border-l-blue-500",borderBottom:"border-b-blue-500",bg:"bg-blue-50 dark:bg-blue-900/20",dot:"bg-blue-500"},purple:{border:"border-l-purple-500 md:border-l-purple-500",borderBottom:"border-b-purple-500",bg:"bg-purple-50 dark:bg-purple-900/20",dot:"bg-purple-500"},gray:{border:"border-l-gray-700 dark:border-l-gray-300",borderBottom:"border-b-gray-700 dark:border-b-gray-300",bg:"bg-gray-100 dark:bg-gray-800/50",dot:"bg-gray-700 dark:bg-gray-300"}};function Ya({agentId:e,authStatus:t,isSelected:r,onClick:n,isMobile:i=!1}){const{t:s}=Ht("settings"),o=PG[e],l=BG[o.color],{Logo:c}=o;return i?a.jsx("button",{onClick:n,className:`flex-1 text-center py-3 px-2 border-b-2 transition-colors ${r?`${l.borderBottom} ${l.bg}`:"border-transparent hover:bg-gray-50 dark:hover:bg-gray-800"}`,children:a.jsxs("div",{className:"flex flex-col items-center gap-1",children:[a.jsx(c,{className:"w-5 h-5"}),a.jsx("span",{className:"text-xs font-medium text-foreground",children:o.name}),t?.authenticated&&a.jsx("span",{className:`w-1.5 h-1.5 rounded-full ${l.dot}`})]})}):a.jsxs("button",{onClick:n,className:`w-full text-left p-3 border-l-4 transition-colors ${r?`${l.border} ${l.bg}`:"border-transparent hover:bg-gray-50 dark:hover:bg-gray-800"}`,children:[a.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[a.jsx(c,{className:"w-4 h-4"}),a.jsx("span",{className:"font-medium text-foreground",children:o.name})]}),a.jsx("div",{className:"text-xs text-muted-foreground pl-6",children:t?.loading?a.jsx("span",{className:"text-gray-400",children:s("agents.authStatus.checking")}):t?.authenticated?a.jsxs("div",{className:"flex items-center gap-1",children:[a.jsx("span",{className:`w-1.5 h-1.5 rounded-full ${l.dot}`}),a.jsx("span",{className:"truncate max-w-[120px]",title:t.email,children:t.email||s("agents.authStatus.connected")})]}):a.jsxs("div",{className:"flex items-center gap-1",children:[a.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-gray-400"}),a.jsx("span",{children:s("agents.authStatus.notConnected")})]})})]})}const zG={claude:{name:"Claude",description:"Anthropic Claude AI assistant",Logo:nn,bgClass:"bg-blue-50 dark:bg-blue-900/20",borderClass:"border-blue-200 dark:border-blue-800",textClass:"text-blue-900 dark:text-blue-100",subtextClass:"text-blue-700 dark:text-blue-300",buttonClass:"bg-blue-600 hover:bg-blue-700"},cursor:{name:"Cursor",description:"Cursor AI-powered code editor",Logo:pn,bgClass:"bg-purple-50 dark:bg-purple-900/20",borderClass:"border-purple-200 dark:border-purple-800",textClass:"text-purple-900 dark:text-purple-100",subtextClass:"text-purple-700 dark:text-purple-300",buttonClass:"bg-purple-600 hover:bg-purple-700"},codex:{name:"Codex",description:"OpenAI Codex AI assistant",Logo:wn,bgClass:"bg-gray-100 dark:bg-gray-800/50",borderClass:"border-gray-300 dark:border-gray-600",textClass:"text-gray-900 dark:text-gray-100",subtextClass:"text-gray-700 dark:text-gray-300",buttonClass:"bg-gray-800 hover:bg-gray-900 dark:bg-gray-700 dark:hover:bg-gray-600"}};function UG({agent:e,authStatus:t,onLogin:r}){const{t:n}=Ht("settings"),i=zG[e],{Logo:s}=i;return a.jsxs("div",{className:"space-y-6",children:[a.jsxs("div",{className:"flex items-center gap-3 mb-4",children:[a.jsx(s,{className:"w-6 h-6"}),a.jsxs("div",{children:[a.jsx("h3",{className:"text-lg font-medium text-foreground",children:i.name}),a.jsx("p",{className:"text-sm text-muted-foreground",children:n(`agents.account.${e}.description`)})]})]}),a.jsx("div",{className:`${i.bgClass} border ${i.borderClass} rounded-lg p-4`,children:a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsxs("div",{className:"flex-1",children:[a.jsx("div",{className:`font-medium ${i.textClass}`,children:n("agents.connectionStatus")}),a.jsx("div",{className:`text-sm ${i.subtextClass}`,children:t?.loading?n("agents.authStatus.checkingAuth"):t?.authenticated?n("agents.authStatus.loggedInAs",{email:t.email||n("agents.authStatus.authenticatedUser")}):n("agents.authStatus.notConnected")})]}),a.jsx("div",{children:t?.loading?a.jsx(mn,{variant:"secondary",className:"bg-gray-100 dark:bg-gray-800",children:n("agents.authStatus.checking")}):t?.authenticated?a.jsx(mn,{variant:"success",className:"bg-green-100 text-green-800 dark:bg-green-900/30 dark:text-green-300",children:n("agents.authStatus.connected")}):a.jsx(mn,{variant:"secondary",className:"bg-gray-100 text-gray-800 dark:bg-gray-800 dark:text-gray-300",children:n("agents.authStatus.disconnected")})})]}),a.jsx("div",{className:"border-t border-gray-200 dark:border-gray-700 pt-4",children:a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{children:[a.jsx("div",{className:`font-medium ${i.textClass}`,children:t?.authenticated?n("agents.login.reAuthenticate"):n("agents.login.title")}),a.jsx("div",{className:`text-sm ${i.subtextClass}`,children:t?.authenticated?n("agents.login.reAuthDescription"):n("agents.login.description",{agent:i.name})})]}),a.jsxs(Be,{onClick:r,className:`${i.buttonClass} text-white`,size:"sm",children:[a.jsx(g4,{className:"w-4 h-4 mr-2"}),t?.authenticated?n("agents.login.reLoginButton"):n("agents.login.button")]})]})}),t?.error&&a.jsx("div",{className:"border-t border-gray-200 dark:border-gray-700 pt-4",children:a.jsx("div",{className:"text-sm text-red-600 dark:text-red-400",children:n("agents.error",{error:t.error})})})]})})]})}const $G=["Bash(git log:*)","Bash(git diff:*)","Bash(git status:*)","Write","Read","Edit","Glob","Grep","MultiEdit","Task","TodoWrite","TodoRead","WebFetch","WebSearch"],qG=["Shell(ls)","Shell(mkdir)","Shell(cd)","Shell(cat)","Shell(echo)","Shell(git status)","Shell(git diff)","Shell(git log)","Shell(npm install)","Shell(npm run)","Shell(python)","Shell(node)"];function GG({skipPermissions:e,setSkipPermissions:t,allowedTools:r,setAllowedTools:n,disallowedTools:i,setDisallowedTools:s,newAllowedTool:o,setNewAllowedTool:l,newDisallowedTool:c,setNewDisallowedTool:d}){const{t:u}=Ht("settings"),p=f=>{f&&!r.includes(f)&&(n([...r,f]),l(""))},h=f=>{n(r.filter(w=>w!==f))},m=f=>{f&&!i.includes(f)&&(s([...i,f]),d(""))},g=f=>{s(i.filter(w=>w!==f))};return a.jsxs("div",{className:"space-y-6",children:[a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx(Vn,{className:"w-5 h-5 text-orange-500"}),a.jsx("h3",{className:"text-lg font-medium text-foreground",children:u("permissions.title")})]}),a.jsx("div",{className:"bg-orange-50 dark:bg-orange-900/20 border border-orange-200 dark:border-orange-800 rounded-lg p-4",children:a.jsxs("label",{className:"flex items-center gap-3",children:[a.jsx("input",{type:"checkbox",checked:e,onChange:f=>t(f.target.checked),className:"w-4 h-4 text-blue-600 bg-gray-100 dark:bg-gray-700 border-gray-300 dark:border-gray-600 rounded focus:ring-blue-500 focus:ring-2"}),a.jsxs("div",{children:[a.jsx("div",{className:"font-medium text-orange-900 dark:text-orange-100",children:u("permissions.skipPermissions.label")}),a.jsx("div",{className:"text-sm text-orange-700 dark:text-orange-300",children:u("permissions.skipPermissions.claudeDescription")})]})]})})]}),a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx(Bh,{className:"w-5 h-5 text-green-500"}),a.jsx("h3",{className:"text-lg font-medium text-foreground",children:u("permissions.allowedTools.title")})]}),a.jsx("p",{className:"text-sm text-muted-foreground",children:u("permissions.allowedTools.description")}),a.jsxs("div",{className:"flex flex-col sm:flex-row gap-2",children:[a.jsx(tr,{value:o,onChange:f=>l(f.target.value),placeholder:u("permissions.allowedTools.placeholder"),onKeyPress:f=>{f.key==="Enter"&&(f.preventDefault(),p(o))},className:"flex-1 h-10"}),a.jsxs(Be,{onClick:()=>p(o),disabled:!o,size:"sm",className:"h-10 px-4",children:[a.jsx(gr,{className:"w-4 h-4 mr-2 sm:mr-0"}),a.jsx("span",{className:"sm:hidden",children:u("permissions.actions.add")})]})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx("p",{className:"text-sm font-medium text-gray-700 dark:text-gray-300",children:u("permissions.allowedTools.quickAdd")}),a.jsx("div",{className:"flex flex-wrap gap-2",children:$G.map(f=>a.jsx(Be,{variant:"outline",size:"sm",onClick:()=>p(f),disabled:r.includes(f),className:"text-xs h-8",children:f},f))})]}),a.jsxs("div",{className:"space-y-2",children:[r.map(f=>a.jsxs("div",{className:"flex items-center justify-between bg-green-50 dark:bg-green-900/20 border border-green-200 dark:border-green-800 rounded-lg p-3",children:[a.jsx("span",{className:"font-mono text-sm text-green-800 dark:text-green-200",children:f}),a.jsx(Be,{variant:"ghost",size:"sm",onClick:()=>h(f),className:"text-green-600 hover:text-green-700",children:a.jsx(Bt,{className:"w-4 h-4"})})]},f)),r.length===0&&a.jsx("div",{className:"text-center py-6 text-gray-500 dark:text-gray-400",children:u("permissions.allowedTools.empty")})]})]}),a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx(Vn,{className:"w-5 h-5 text-red-500"}),a.jsx("h3",{className:"text-lg font-medium text-foreground",children:u("permissions.blockedTools.title")})]}),a.jsx("p",{className:"text-sm text-muted-foreground",children:u("permissions.blockedTools.description")}),a.jsxs("div",{className:"flex flex-col sm:flex-row gap-2",children:[a.jsx(tr,{value:c,onChange:f=>d(f.target.value),placeholder:u("permissions.blockedTools.placeholder"),onKeyPress:f=>{f.key==="Enter"&&(f.preventDefault(),m(c))},className:"flex-1 h-10"}),a.jsxs(Be,{onClick:()=>m(c),disabled:!c,size:"sm",className:"h-10 px-4",children:[a.jsx(gr,{className:"w-4 h-4 mr-2 sm:mr-0"}),a.jsx("span",{className:"sm:hidden",children:u("permissions.actions.add")})]})]}),a.jsxs("div",{className:"space-y-2",children:[i.map(f=>a.jsxs("div",{className:"flex items-center justify-between bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800 rounded-lg p-3",children:[a.jsx("span",{className:"font-mono text-sm text-red-800 dark:text-red-200",children:f}),a.jsx(Be,{variant:"ghost",size:"sm",onClick:()=>g(f),className:"text-red-600 hover:text-red-700",children:a.jsx(Bt,{className:"w-4 h-4"})})]},f)),i.length===0&&a.jsx("div",{className:"text-center py-6 text-gray-500 dark:text-gray-400",children:u("permissions.blockedTools.empty")})]})]}),a.jsxs("div",{className:"bg-blue-50 dark:bg-blue-900/20 border border-blue-200 dark:border-blue-800 rounded-lg p-4",children:[a.jsx("h4",{className:"font-medium text-blue-900 dark:text-blue-100 mb-2",children:u("permissions.toolExamples.title")}),a.jsxs("ul",{className:"text-sm text-blue-800 dark:text-blue-200 space-y-1",children:[a.jsxs("li",{children:[a.jsx("code",{className:"bg-blue-100 dark:bg-blue-800 px-1 rounded",children:'"Bash(git log:*)"'})," ",u("permissions.toolExamples.bashGitLog")]}),a.jsxs("li",{children:[a.jsx("code",{className:"bg-blue-100 dark:bg-blue-800 px-1 rounded",children:'"Bash(git diff:*)"'})," ",u("permissions.toolExamples.bashGitDiff")]}),a.jsxs("li",{children:[a.jsx("code",{className:"bg-blue-100 dark:bg-blue-800 px-1 rounded",children:'"Write"'})," ",u("permissions.toolExamples.write")]}),a.jsxs("li",{children:[a.jsx("code",{className:"bg-blue-100 dark:bg-blue-800 px-1 rounded",children:'"Bash(rm:*)"'})," ",u("permissions.toolExamples.bashRm")]})]})]})]})}function HG({skipPermissions:e,setSkipPermissions:t,allowedCommands:r,setAllowedCommands:n,disallowedCommands:i,setDisallowedCommands:s,newAllowedCommand:o,setNewAllowedCommand:l,newDisallowedCommand:c,setNewDisallowedCommand:d}){const{t:u}=Ht("settings"),p=f=>{f&&!r.includes(f)&&(n([...r,f]),l(""))},h=f=>{n(r.filter(w=>w!==f))},m=f=>{f&&!i.includes(f)&&(s([...i,f]),d(""))},g=f=>{s(i.filter(w=>w!==f))};return a.jsxs("div",{className:"space-y-6",children:[a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx(Vn,{className:"w-5 h-5 text-orange-500"}),a.jsx("h3",{className:"text-lg font-medium text-foreground",children:u("permissions.title")})]}),a.jsx("div",{className:"bg-orange-50 dark:bg-orange-900/20 border border-orange-200 dark:border-orange-800 rounded-lg p-4",children:a.jsxs("label",{className:"flex items-center gap-3",children:[a.jsx("input",{type:"checkbox",checked:e,onChange:f=>t(f.target.checked),className:"w-4 h-4 text-purple-600 bg-gray-100 dark:bg-gray-700 border-gray-300 dark:border-gray-600 rounded focus:ring-purple-500 focus:ring-2"}),a.jsxs("div",{children:[a.jsx("div",{className:"font-medium text-orange-900 dark:text-orange-100",children:u("permissions.skipPermissions.label")}),a.jsx("div",{className:"text-sm text-orange-700 dark:text-orange-300",children:u("permissions.skipPermissions.cursorDescription")})]})]})})]}),a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx(Bh,{className:"w-5 h-5 text-green-500"}),a.jsx("h3",{className:"text-lg font-medium text-foreground",children:u("permissions.allowedCommands.title")})]}),a.jsx("p",{className:"text-sm text-muted-foreground",children:u("permissions.allowedCommands.description")}),a.jsxs("div",{className:"flex flex-col sm:flex-row gap-2",children:[a.jsx(tr,{value:o,onChange:f=>l(f.target.value),placeholder:u("permissions.allowedCommands.placeholder"),onKeyPress:f=>{f.key==="Enter"&&(f.preventDefault(),p(o))},className:"flex-1 h-10"}),a.jsxs(Be,{onClick:()=>p(o),disabled:!o,size:"sm",className:"h-10 px-4",children:[a.jsx(gr,{className:"w-4 h-4 mr-2 sm:mr-0"}),a.jsx("span",{className:"sm:hidden",children:u("permissions.actions.add")})]})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx("p",{className:"text-sm font-medium text-gray-700 dark:text-gray-300",children:u("permissions.allowedCommands.quickAdd")}),a.jsx("div",{className:"flex flex-wrap gap-2",children:qG.map(f=>a.jsx(Be,{variant:"outline",size:"sm",onClick:()=>p(f),disabled:r.includes(f),className:"text-xs h-8",children:f},f))})]}),a.jsxs("div",{className:"space-y-2",children:[r.map(f=>a.jsxs("div",{className:"flex items-center justify-between bg-green-50 dark:bg-green-900/20 border border-green-200 dark:border-green-800 rounded-lg p-3",children:[a.jsx("span",{className:"font-mono text-sm text-green-800 dark:text-green-200",children:f}),a.jsx(Be,{variant:"ghost",size:"sm",onClick:()=>h(f),className:"text-green-600 hover:text-green-700",children:a.jsx(Bt,{className:"w-4 h-4"})})]},f)),r.length===0&&a.jsx("div",{className:"text-center py-6 text-gray-500 dark:text-gray-400",children:u("permissions.allowedCommands.empty")})]})]}),a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx(Vn,{className:"w-5 h-5 text-red-500"}),a.jsx("h3",{className:"text-lg font-medium text-foreground",children:u("permissions.blockedCommands.title")})]}),a.jsx("p",{className:"text-sm text-muted-foreground",children:u("permissions.blockedCommands.description")}),a.jsxs("div",{className:"flex flex-col sm:flex-row gap-2",children:[a.jsx(tr,{value:c,onChange:f=>d(f.target.value),placeholder:u("permissions.blockedCommands.placeholder"),onKeyPress:f=>{f.key==="Enter"&&(f.preventDefault(),m(c))},className:"flex-1 h-10"}),a.jsxs(Be,{onClick:()=>m(c),disabled:!c,size:"sm",className:"h-10 px-4",children:[a.jsx(gr,{className:"w-4 h-4 mr-2 sm:mr-0"}),a.jsx("span",{className:"sm:hidden",children:u("permissions.actions.add")})]})]}),a.jsxs("div",{className:"space-y-2",children:[i.map(f=>a.jsxs("div",{className:"flex items-center justify-between bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800 rounded-lg p-3",children:[a.jsx("span",{className:"font-mono text-sm text-red-800 dark:text-red-200",children:f}),a.jsx(Be,{variant:"ghost",size:"sm",onClick:()=>g(f),className:"text-red-600 hover:text-red-700",children:a.jsx(Bt,{className:"w-4 h-4"})})]},f)),i.length===0&&a.jsx("div",{className:"text-center py-6 text-gray-500 dark:text-gray-400",children:u("permissions.blockedCommands.empty")})]})]}),a.jsxs("div",{className:"bg-purple-50 dark:bg-purple-900/20 border border-purple-200 dark:border-purple-800 rounded-lg p-4",children:[a.jsx("h4",{className:"font-medium text-purple-900 dark:text-purple-100 mb-2",children:u("permissions.shellExamples.title")}),a.jsxs("ul",{className:"text-sm text-purple-800 dark:text-purple-200 space-y-1",children:[a.jsxs("li",{children:[a.jsx("code",{className:"bg-purple-100 dark:bg-purple-800 px-1 rounded",children:'"Shell(ls)"'})," ",u("permissions.shellExamples.ls")]}),a.jsxs("li",{children:[a.jsx("code",{className:"bg-purple-100 dark:bg-purple-800 px-1 rounded",children:'"Shell(git status)"'})," ",u("permissions.shellExamples.gitStatus")]}),a.jsxs("li",{children:[a.jsx("code",{className:"bg-purple-100 dark:bg-purple-800 px-1 rounded",children:'"Shell(npm install)"'})," ",u("permissions.shellExamples.npmInstall")]}),a.jsxs("li",{children:[a.jsx("code",{className:"bg-purple-100 dark:bg-purple-800 px-1 rounded",children:'"Shell(rm -rf)"'})," ",u("permissions.shellExamples.rmRf")]})]})]})]})}function WG({permissionMode:e,setPermissionMode:t}){const{t:r}=Ht("settings");return a.jsx("div",{className:"space-y-6",children:a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx(Bh,{className:"w-5 h-5 text-green-500"}),a.jsx("h3",{className:"text-lg font-medium text-foreground",children:r("permissions.codex.permissionMode")})]}),a.jsx("p",{className:"text-sm text-muted-foreground",children:r("permissions.codex.description")}),a.jsx("div",{className:`border rounded-lg p-4 cursor-pointer transition-all ${e==="default"?"bg-gray-100 dark:bg-gray-800 border-gray-400 dark:border-gray-500":"bg-gray-50 dark:bg-gray-900/50 border-gray-200 dark:border-gray-700 hover:border-gray-300 dark:hover:border-gray-600"}`,onClick:()=>t("default"),children:a.jsxs("label",{className:"flex items-start gap-3 cursor-pointer",children:[a.jsx("input",{type:"radio",name:"codexPermissionMode",checked:e==="default",onChange:()=>t("default"),className:"mt-1 w-4 h-4 text-green-600"}),a.jsxs("div",{children:[a.jsx("div",{className:"font-medium text-foreground",children:r("permissions.codex.modes.default.title")}),a.jsx("div",{className:"text-sm text-muted-foreground",children:r("permissions.codex.modes.default.description")})]})]})}),a.jsx("div",{className:`border rounded-lg p-4 cursor-pointer transition-all ${e==="acceptEdits"?"bg-green-50 dark:bg-green-900/20 border-green-400 dark:border-green-600":"bg-gray-50 dark:bg-gray-900/50 border-gray-200 dark:border-gray-700 hover:border-gray-300 dark:hover:border-gray-600"}`,onClick:()=>t("acceptEdits"),children:a.jsxs("label",{className:"flex items-start gap-3 cursor-pointer",children:[a.jsx("input",{type:"radio",name:"codexPermissionMode",checked:e==="acceptEdits",onChange:()=>t("acceptEdits"),className:"mt-1 w-4 h-4 text-green-600"}),a.jsxs("div",{children:[a.jsx("div",{className:"font-medium text-green-900 dark:text-green-100",children:r("permissions.codex.modes.acceptEdits.title")}),a.jsx("div",{className:"text-sm text-green-700 dark:text-green-300",children:r("permissions.codex.modes.acceptEdits.description")})]})]})}),a.jsx("div",{className:`border rounded-lg p-4 cursor-pointer transition-all ${e==="bypassPermissions"?"bg-orange-50 dark:bg-orange-900/20 border-orange-400 dark:border-orange-600":"bg-gray-50 dark:bg-gray-900/50 border-gray-200 dark:border-gray-700 hover:border-gray-300 dark:hover:border-gray-600"}`,onClick:()=>t("bypassPermissions"),children:a.jsxs("label",{className:"flex items-start gap-3 cursor-pointer",children:[a.jsx("input",{type:"radio",name:"codexPermissionMode",checked:e==="bypassPermissions",onChange:()=>t("bypassPermissions"),className:"mt-1 w-4 h-4 text-orange-600"}),a.jsxs("div",{children:[a.jsxs("div",{className:"font-medium text-orange-900 dark:text-orange-100 flex items-center gap-2",children:[r("permissions.codex.modes.bypassPermissions.title"),a.jsx(Vn,{className:"w-4 h-4"})]}),a.jsx("div",{className:"text-sm text-orange-700 dark:text-orange-300",children:r("permissions.codex.modes.bypassPermissions.description")})]})]})}),a.jsxs("details",{className:"text-sm",children:[a.jsx("summary",{className:"cursor-pointer text-muted-foreground hover:text-foreground",children:r("permissions.codex.technicalDetails")}),a.jsxs("div",{className:"mt-2 p-3 bg-gray-50 dark:bg-gray-900/50 rounded-lg text-xs text-muted-foreground space-y-2",children:[a.jsxs("p",{children:[a.jsxs("strong",{children:[r("permissions.codex.modes.default.title"),":"]})," ",r("permissions.codex.technicalInfo.default")]}),a.jsxs("p",{children:[a.jsxs("strong",{children:[r("permissions.codex.modes.acceptEdits.title"),":"]})," ",r("permissions.codex.technicalInfo.acceptEdits")]}),a.jsxs("p",{children:[a.jsxs("strong",{children:[r("permissions.codex.modes.bypassPermissions.title"),":"]})," ",r("permissions.codex.technicalInfo.bypassPermissions")]}),a.jsx("p",{className:"text-xs opacity-75",children:r("permissions.codex.technicalInfo.overrideNote")})]})]})]})})}function _m({agent:e,...t}){return e==="claude"?a.jsx(GG,{...t}):e==="cursor"?a.jsx(HG,{...t}):e==="codex"?a.jsx(WG,{...t}):null}const VG=e=>{switch(e){case"stdio":return a.jsx(pa,{className:"w-4 h-4"});case"sse":return a.jsx(zh,{className:"w-4 h-4"});case"http":return a.jsx(Dm,{className:"w-4 h-4"});default:return a.jsx(Eo,{className:"w-4 h-4"})}};function KG({servers:e,onAdd:t,onEdit:r,onDelete:n,onTest:i,onDiscoverTools:s,testResults:o,serverTools:l,toolsLoading:c}){const{t:d}=Ht("settings");return a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx(Eo,{className:"w-5 h-5 text-purple-500"}),a.jsx("h3",{className:"text-lg font-medium text-foreground",children:d("mcpServers.title")})]}),a.jsx("p",{className:"text-sm text-muted-foreground",children:d("mcpServers.description.claude")}),a.jsx("div",{className:"flex justify-between items-center",children:a.jsxs(Be,{onClick:t,className:"bg-purple-600 hover:bg-purple-700 text-white",size:"sm",children:[a.jsx(gr,{className:"w-4 h-4 mr-2"}),d("mcpServers.addButton")]})}),a.jsxs("div",{className:"space-y-2",children:[e.map(u=>a.jsx("div",{className:"bg-gray-50 dark:bg-gray-900/50 border border-gray-200 dark:border-gray-700 rounded-lg p-4",children:a.jsxs("div",{className:"flex items-start justify-between",children:[a.jsxs("div",{className:"flex-1",children:[a.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[VG(u.type),a.jsx("span",{className:"font-medium text-foreground",children:u.name}),a.jsx(mn,{variant:"outline",className:"text-xs",children:u.type}),a.jsx(mn,{variant:"outline",className:"text-xs",children:u.scope==="local"?d("mcpServers.scope.local"):u.scope==="user"?d("mcpServers.scope.user"):u.scope})]}),a.jsxs("div",{className:"text-sm text-muted-foreground space-y-1",children:[u.type==="stdio"&&u.config?.command&&a.jsxs("div",{children:[d("mcpServers.config.command"),": ",a.jsx("code",{className:"bg-gray-100 dark:bg-gray-800 px-1 rounded text-xs",children:u.config.command})]}),(u.type==="sse"||u.type==="http")&&u.config?.url&&a.jsxs("div",{children:[d("mcpServers.config.url"),": ",a.jsx("code",{className:"bg-gray-100 dark:bg-gray-800 px-1 rounded text-xs",children:u.config.url})]}),u.config?.args&&u.config.args.length>0&&a.jsxs("div",{children:[d("mcpServers.config.args"),": ",a.jsx("code",{className:"bg-gray-100 dark:bg-gray-800 px-1 rounded text-xs",children:u.config.args.join(" ")})]})]}),o?.[u.id]&&a.jsx("div",{className:`mt-2 p-2 rounded text-xs ${o[u.id].success?"bg-green-50 dark:bg-green-900/20 text-green-800 dark:text-green-200":"bg-red-50 dark:bg-red-900/20 text-red-800 dark:text-red-200"}`,children:a.jsx("div",{className:"font-medium",children:o[u.id].message})}),l?.[u.id]&&l[u.id].tools?.length>0&&a.jsxs("div",{className:"mt-2 p-2 rounded text-xs bg-blue-50 dark:bg-blue-900/20 text-blue-800 dark:text-blue-200",children:[a.jsxs("div",{className:"font-medium",children:[d("mcpServers.tools.title")," ",d("mcpServers.tools.count",{count:l[u.id].tools.length})]}),a.jsxs("div",{className:"flex flex-wrap gap-1 mt-1",children:[l[u.id].tools.slice(0,5).map((p,h)=>a.jsx("code",{className:"bg-blue-100 dark:bg-blue-800 px-1 rounded",children:p.name},h)),l[u.id].tools.length>5&&a.jsx("span",{className:"text-xs opacity-75",children:d("mcpServers.tools.more",{count:l[u.id].tools.length-5})})]})]})]}),a.jsxs("div",{className:"flex items-center gap-2 ml-4",children:[a.jsx(Be,{onClick:()=>r(u),variant:"ghost",size:"sm",className:"text-gray-600 hover:text-gray-700",title:d("mcpServers.actions.edit"),children:a.jsx(Vi,{className:"w-4 h-4"})}),a.jsx(Be,{onClick:()=>n(u.id,u.scope),variant:"ghost",size:"sm",className:"text-red-600 hover:text-red-700",title:d("mcpServers.actions.delete"),children:a.jsx(Nr,{className:"w-4 h-4"})})]})]})},u.id)),e.length===0&&a.jsx("div",{className:"text-center py-8 text-gray-500 dark:text-gray-400",children:d("mcpServers.empty")})]})]})}function YG({servers:e,onAdd:t,onEdit:r,onDelete:n}){const{t:i}=Ht("settings");return a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx(Eo,{className:"w-5 h-5 text-purple-500"}),a.jsx("h3",{className:"text-lg font-medium text-foreground",children:i("mcpServers.title")})]}),a.jsx("p",{className:"text-sm text-muted-foreground",children:i("mcpServers.description.cursor")}),a.jsx("div",{className:"flex justify-between items-center",children:a.jsxs(Be,{onClick:t,className:"bg-purple-600 hover:bg-purple-700 text-white",size:"sm",children:[a.jsx(gr,{className:"w-4 h-4 mr-2"}),i("mcpServers.addButton")]})}),a.jsxs("div",{className:"space-y-2",children:[e.map(s=>a.jsx("div",{className:"bg-gray-50 dark:bg-gray-900/50 border border-gray-200 dark:border-gray-700 rounded-lg p-4",children:a.jsxs("div",{className:"flex items-start justify-between",children:[a.jsxs("div",{className:"flex-1",children:[a.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[a.jsx(pa,{className:"w-4 h-4"}),a.jsx("span",{className:"font-medium text-foreground",children:s.name}),a.jsx(mn,{variant:"outline",className:"text-xs",children:"stdio"})]}),a.jsx("div",{className:"text-sm text-muted-foreground",children:s.config?.command&&a.jsxs("div",{children:[i("mcpServers.config.command"),": ",a.jsx("code",{className:"bg-gray-100 dark:bg-gray-800 px-1 rounded text-xs",children:s.config.command})]})})]}),a.jsxs("div",{className:"flex items-center gap-2 ml-4",children:[a.jsx(Be,{onClick:()=>r(s),variant:"ghost",size:"sm",className:"text-gray-600 hover:text-gray-700",title:i("mcpServers.actions.edit"),children:a.jsx(Vi,{className:"w-4 h-4"})}),a.jsx(Be,{onClick:()=>n(s.name),variant:"ghost",size:"sm",className:"text-red-600 hover:text-red-700",title:i("mcpServers.actions.delete"),children:a.jsx(Nr,{className:"w-4 h-4"})})]})]})},s.name||s.id)),e.length===0&&a.jsx("div",{className:"text-center py-8 text-gray-500 dark:text-gray-400",children:i("mcpServers.empty")})]})]})}function XG({servers:e,onAdd:t,onEdit:r,onDelete:n}){const{t:i}=Ht("settings");return a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx(Eo,{className:"w-5 h-5 text-gray-700 dark:text-gray-300"}),a.jsx("h3",{className:"text-lg font-medium text-foreground",children:i("mcpServers.title")})]}),a.jsx("p",{className:"text-sm text-muted-foreground",children:i("mcpServers.description.codex")}),a.jsx("div",{className:"flex justify-between items-center",children:a.jsxs(Be,{onClick:t,className:"bg-gray-800 hover:bg-gray-900 dark:bg-gray-700 dark:hover:bg-gray-600 text-white",size:"sm",children:[a.jsx(gr,{className:"w-4 h-4 mr-2"}),i("mcpServers.addButton")]})}),a.jsxs("div",{className:"space-y-2",children:[e.map(s=>a.jsx("div",{className:"bg-gray-50 dark:bg-gray-900/50 border border-gray-200 dark:border-gray-700 rounded-lg p-4",children:a.jsxs("div",{className:"flex items-start justify-between",children:[a.jsxs("div",{className:"flex-1",children:[a.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[a.jsx(pa,{className:"w-4 h-4"}),a.jsx("span",{className:"font-medium text-foreground",children:s.name}),a.jsx(mn,{variant:"outline",className:"text-xs",children:"stdio"})]}),a.jsxs("div",{className:"text-sm text-muted-foreground space-y-1",children:[s.config?.command&&a.jsxs("div",{children:[i("mcpServers.config.command"),": ",a.jsx("code",{className:"bg-gray-100 dark:bg-gray-800 px-1 rounded text-xs",children:s.config.command})]}),s.config?.args&&s.config.args.length>0&&a.jsxs("div",{children:[i("mcpServers.config.args"),": ",a.jsx("code",{className:"bg-gray-100 dark:bg-gray-800 px-1 rounded text-xs",children:s.config.args.join(" ")})]}),s.config?.env&&Object.keys(s.config.env).length>0&&a.jsxs("div",{children:[i("mcpServers.config.environment"),": ",a.jsx("code",{className:"bg-gray-100 dark:bg-gray-800 px-1 rounded text-xs",children:Object.entries(s.config.env).map(([o,l])=>`${o}=${l}`).join(", ")})]})]})]}),a.jsxs("div",{className:"flex items-center gap-2 ml-4",children:[a.jsx(Be,{onClick:()=>r(s),variant:"ghost",size:"sm",className:"text-gray-600 hover:text-gray-700",title:i("mcpServers.actions.edit"),children:a.jsx(Vi,{className:"w-4 h-4"})}),a.jsx(Be,{onClick:()=>n(s.name),variant:"ghost",size:"sm",className:"text-red-600 hover:text-red-700",title:i("mcpServers.actions.delete"),children:a.jsx(Nr,{className:"w-4 h-4"})})]})]})},s.name)),e.length===0&&a.jsx("div",{className:"text-center py-8 text-gray-500 dark:text-gray-400",children:i("mcpServers.empty")})]}),a.jsxs("div",{className:"bg-gray-100 dark:bg-gray-800/50 border border-gray-300 dark:border-gray-600 rounded-lg p-4",children:[a.jsx("h4",{className:"font-medium text-gray-900 dark:text-gray-100 mb-2",children:i("mcpServers.help.title")}),a.jsx("p",{className:"text-sm text-gray-700 dark:text-gray-300",children:i("mcpServers.help.description")})]})]})}function Lm({agent:e,...t}){return e==="claude"?a.jsx(KG,{...t}):e==="cursor"?a.jsx(YG,{...t}):e==="codex"?a.jsx(XG,{...t}):null}const jh=[{value:"en",label:"English",nativeName:"English"},{value:"zh-CN",label:"Simplified Chinese",nativeName:"简体中文"}];function d3({compact:e=!1}){const{i18n:t,t:r}=Ht("settings"),n=i=>{const s=i.target.value;t.changeLanguage(s)};return e?a.jsxs("div",{className:"flex items-center justify-between p-3 rounded-lg bg-gray-50 dark:bg-gray-800 hover:bg-gray-100 dark:hover:bg-gray-700 transition-colors border border-transparent hover:border-gray-300 dark:hover:border-gray-600",children:[a.jsxs("span",{className:"flex items-center gap-2 text-sm text-gray-900 dark:text-white",children:[a.jsx(h4,{className:"h-4 w-4 text-gray-600 dark:text-gray-400"}),r("account.language")]}),a.jsx("select",{value:t.language,onChange:n,className:"w-[100px] text-sm bg-gray-50 dark:bg-gray-800 border border-gray-300 dark:border-gray-600 text-gray-900 dark:text-gray-100 rounded-lg focus:ring-blue-500 focus:border-blue-500 p-2 focus:outline-none focus:ring-2 focus:ring-blue-500 dark:focus:ring-blue-400",children:jh.map(i=>a.jsx("option",{value:i.value,children:i.nativeName},i.value))})]}):a.jsx("div",{className:"bg-gray-50 dark:bg-gray-900/50 border border-gray-200 dark:border-gray-700 rounded-lg p-4",children:a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{children:[a.jsx("div",{className:"font-medium text-gray-900 dark:text-gray-100 mb-1",children:r("account.languageLabel")}),a.jsx("div",{className:"text-sm text-gray-600 dark:text-gray-400",children:r("account.languageDescription")})]}),a.jsx("select",{value:t.language,onChange:n,className:"text-sm bg-gray-50 dark:bg-gray-800 border border-gray-300 dark:border-gray-600 text-gray-900 dark:text-gray-100 rounded-lg focus:ring-blue-500 focus:border-blue-500 p-2 w-36",children:jh.map(i=>a.jsx("option",{value:i.value,children:i.nativeName},i.value))})]})})}function ZG({isOpen:e,onClose:t,projects:r=[],initialTab:n="agents"}){const{isDarkMode:i,toggleDarkMode:s}=as(),{t:o}=Ht("settings"),[l,c]=x.useState([]),[d,u]=x.useState([]),[p,h]=x.useState(""),[m,g]=x.useState(""),[f,w]=x.useState(!1),[S,k]=x.useState(!1),[E,N]=x.useState(null),[C,v]=x.useState("name"),[I,M]=x.useState([]),[j,T]=x.useState(!1),[P,q]=x.useState(null),[D,z]=x.useState({name:"",type:"stdio",scope:"user",projectPath:"",config:{command:"",args:[],env:{},url:"",headers:{},timeout:3e4},jsonInput:"",importMode:"form"}),[U,G]=x.useState(!1),[re,K]=x.useState({}),[ue,R]=x.useState({}),[F,te]=x.useState({}),[_,Z]=x.useState(n),[me,ke]=x.useState(""),[se,_e]=x.useState("claude"),[oe,fe]=x.useState("account"),[Ie,qe]=x.useState(()=>localStorage.getItem("codeEditorTheme")||"dark"),[ze,ct]=x.useState(()=>localStorage.getItem("codeEditorWordWrap")==="true"),[Ye,wt]=x.useState(()=>localStorage.getItem("codeEditorShowMinimap")!=="false"),[gt,et]=x.useState(()=>localStorage.getItem("codeEditorLineNumbers")!=="false"),[Me,mt]=x.useState(()=>localStorage.getItem("codeEditorFontSize")||"14"),[Pt,xe]=x.useState([]),[at,ce]=x.useState([]),[Ee,H]=x.useState(!1),[Y,le]=x.useState(""),[ve,Ve]=x.useState(""),[It,ft]=x.useState([]),[Rt,it]=x.useState([]),[ie,je]=x.useState("default"),[Te,Pe]=x.useState(!1),[Ue,st]=x.useState({name:"",type:"stdio",config:{command:"",args:[],env:{}}}),[Qe,J]=x.useState(null),[Fe,Ke]=x.useState(!1),[Ge,dt]=x.useState(!1),[he,zt]=x.useState(""),[nr,_n]=x.useState(null),[xr,ae]=x.useState({authenticated:!1,email:null,loading:!0,error:null}),[ge,tt]=x.useState({authenticated:!1,email:null,loading:!0,error:null}),[bt,hr]=x.useState({authenticated:!1,email:null,loading:!0,error:null}),ar=async()=>{try{const X=await Ce("/api/cursor/mcp");if(X.ok){const de=await X.json();ft(de.servers||[])}else console.error("Failed to fetch Cursor MCP servers")}catch(X){console.error("Error fetching Cursor MCP servers:",X)}},Zr=async()=>{try{const X=await Ce("/api/codex/mcp/config/read");if(X.ok){const Re=await X.json();if(Re.success&&Re.servers){it(Re.servers);return}}const de=await Ce("/api/codex/mcp/cli/list");if(de.ok){const Re=await de.json();if(Re.success&&Re.servers){const ht=Re.servers.map(dr=>({id:dr.name,name:dr.name,type:dr.type||"stdio",scope:"user",config:{command:dr.command||"",args:dr.args||[],env:dr.env||{}}}));it(ht)}}}catch(X){console.error("Error fetching Codex MCP servers:",X)}},Ut=async()=>{try{const X=await Ce("/api/mcp/config/read");if(X.ok){const ht=await X.json();if(ht.success&&ht.servers){M(ht.servers);return}}const de=await Ce("/api/mcp/cli/list");if(de.ok){const ht=await de.json();if(ht.success&&ht.servers){const dr=ht.servers.map(Qr=>({id:Qr.name,name:Qr.name,type:Qr.type,scope:"user",config:{command:Qr.command||"",args:Qr.args||[],env:Qr.env||{},url:Qr.url||"",headers:Qr.headers||{},timeout:3e4},created:new Date().toISOString(),updated:new Date().toISOString()}));M(dr);return}}const Re=await Ce("/api/mcp/servers?scope=user");if(Re.ok){const ht=await Re.json();M(ht.servers||[])}else console.error("Failed to fetch MCP servers")}catch(X){console.error("Error fetching MCP servers:",X)}},cn=async X=>{try{P&&await jr(P.id,"user");const de=await Ce("/api/mcp/cli/add",{method:"POST",body:JSON.stringify({name:X.name,type:X.type,scope:X.scope,projectPath:X.projectPath,command:X.config?.command,args:X.config?.args||[],url:X.config?.url,headers:X.config?.headers||{},env:X.config?.env||{}})});if(de.ok){const Re=await de.json();if(Re.success)return await Ut(),!0;throw new Error(Re.error||"Failed to save server via Claude CLI")}else{const Re=await de.json();throw new Error(Re.error||"Failed to save server")}}catch(de){throw console.error("Error saving MCP server:",de),de}},jr=async(X,de="user")=>{try{const Re=await Ce(`/api/mcp/cli/remove/${X}?scope=${de}`,{method:"DELETE"});if(Re.ok){const ht=await Re.json();if(ht.success)return await Ut(),!0;throw new Error(ht.error||"Failed to delete server via Claude CLI")}else{const ht=await Re.json();throw new Error(ht.error||"Failed to delete server")}}catch(Re){throw console.error("Error deleting MCP server:",Re),Re}},wi=async(X,de="user")=>{try{const Re=await Ce(`/api/mcp/servers/${X}/test?scope=${de}`,{method:"POST"});if(Re.ok)return(await Re.json()).testResult;{const ht=await Re.json();throw new Error(ht.error||"Failed to test server")}}catch(Re){throw console.error("Error testing MCP server:",Re),Re}},Ln=async(X,de="user")=>{try{const Re=await Ce(`/api/mcp/servers/${X}/tools?scope=${de}`,{method:"POST"});if(Re.ok)return(await Re.json()).toolsResult;{const ht=await Re.json();throw new Error(ht.error||"Failed to discover tools")}}catch(Re){throw console.error("Error discovering MCP tools:",Re),Re}},Pa=async X=>{try{Qe&&await ra(Qe.id);const de=await Ce("/api/codex/mcp/cli/add",{method:"POST",body:JSON.stringify({name:X.name,command:X.config?.command,args:X.config?.args||[],env:X.config?.env||{}})});if(de.ok){const Re=await de.json();if(Re.success)return await Zr(),!0;throw new Error(Re.error||"Failed to save Codex MCP server")}else{const Re=await de.json();throw new Error(Re.error||"Failed to save server")}}catch(de){throw console.error("Error saving Codex MCP server:",de),de}},ra=async X=>{try{const de=await Ce(`/api/codex/mcp/cli/remove/${X}`,{method:"DELETE"});if(de.ok){const Re=await de.json();if(Re.success)return await Zr(),!0;throw new Error(Re.error||"Failed to delete Codex MCP server")}else{const Re=await de.json();throw new Error(Re.error||"Failed to delete server")}}catch(de){throw console.error("Error deleting Codex MCP server:",de),de}},_r=()=>{st({name:"",type:"stdio",config:{command:"",args:[],env:{}}}),J(null),Pe(!1)},fs=(X=null)=>{X?(J(X),st({name:X.name,type:X.type||"stdio",config:{command:X.config?.command||"",args:X.config?.args||[],env:X.config?.env||{}}})):_r(),Pe(!0)},gn=async X=>{X.preventDefault(),Ke(!0);try{Qe&&await ra(Qe.name),await Pa(Ue),_r(),N("success")}catch(de){alert(`Error: ${de.message}`),N("error")}finally{Ke(!1)}},Ba=async X=>{if(confirm("Are you sure you want to delete this MCP server?"))try{await ra(X),N("success")}catch(de){alert(`Error: ${de.message}`),N("error")}};x.useEffect(()=>{e&&(On(),za(),Jr(),Si(),Z(n))},[e,n]),x.useEffect(()=>{localStorage.setItem("codeEditorTheme",Ie),window.dispatchEvent(new Event("codeEditorSettingsChanged"))},[Ie]),x.useEffect(()=>{localStorage.setItem("codeEditorWordWrap",ze.toString()),window.dispatchEvent(new Event("codeEditorSettingsChanged"))},[ze]),x.useEffect(()=>{localStorage.setItem("codeEditorShowMinimap",Ye.toString()),window.dispatchEvent(new Event("codeEditorSettingsChanged"))},[Ye]),x.useEffect(()=>{localStorage.setItem("codeEditorLineNumbers",gt.toString()),window.dispatchEvent(new Event("codeEditorSettingsChanged"))},[gt]),x.useEffect(()=>{localStorage.setItem("codeEditorFontSize",Me),window.dispatchEvent(new Event("codeEditorSettingsChanged"))},[Me]);const On=async()=>{try{const X=localStorage.getItem("claude-settings");if(X){const ht=JSON.parse(X);c(ht.allowedTools||[]),u(ht.disallowedTools||[]),w(ht.skipPermissions||!1),v(ht.projectSortOrder||"name")}else c([]),u([]),w(!1),v("name");const de=localStorage.getItem("cursor-tools-settings");if(de){const ht=JSON.parse(de);xe(ht.allowedCommands||[]),ce(ht.disallowedCommands||[]),H(ht.skipPermissions||!1)}else xe([]),ce([]),H(!1);const Re=localStorage.getItem("codex-settings");if(Re){const ht=JSON.parse(Re);je(ht.permissionMode||"default")}else je("default");await Ut(),await ar(),await Zr()}catch(X){console.error("Error loading tool settings:",X),c([]),u([]),w(!1),v("name")}},za=async()=>{try{const X=await Ce("/api/cli/claude/status");if(X.ok){const de=await X.json();ae({authenticated:de.authenticated,email:de.email,loading:!1,error:de.error||null})}else ae({authenticated:!1,email:null,loading:!1,error:"Failed to check authentication status"})}catch(X){console.error("Error checking Claude auth status:",X),ae({authenticated:!1,email:null,loading:!1,error:X.message})}},Jr=async()=>{try{const X=await Ce("/api/cli/cursor/status");if(X.ok){const de=await X.json();tt({authenticated:de.authenticated,email:de.email,loading:!1,error:de.error||null})}else tt({authenticated:!1,email:null,loading:!1,error:"Failed to check authentication status"})}catch(X){console.error("Error checking Cursor auth status:",X),tt({authenticated:!1,email:null,loading:!1,error:X.message})}},Si=async()=>{try{const X=await Ce("/api/cli/codex/status");if(X.ok){const de=await X.json();hr({authenticated:de.authenticated,email:de.email,loading:!1,error:de.error||null})}else hr({authenticated:!1,email:null,loading:!1,error:"Failed to check authentication status"})}catch(X){console.error("Error checking Codex auth status:",X),hr({authenticated:!1,email:null,loading:!1,error:X.message})}},fn=()=>{zt("claude"),_n(r?.[0]||{name:"default",fullPath:process.cwd()}),dt(!0)},ya=()=>{zt("cursor"),_n(r?.[0]||{name:"default",fullPath:process.cwd()}),dt(!0)},qo=()=>{zt("codex"),_n(r?.[0]||{name:"default",fullPath:process.cwd()}),dt(!0)},Go=X=>{X===0&&(N("success"),he==="claude"?za():he==="cursor"?Jr():he==="codex"&&Si())},qr=()=>{k(!0),N(null);try{const X={allowedTools:l,disallowedTools:d,skipPermissions:f,projectSortOrder:C,lastUpdated:new Date().toISOString()},de={allowedCommands:Pt,disallowedCommands:at,skipPermissions:Ee,lastUpdated:new Date().toISOString()},Re={permissionMode:ie,lastUpdated:new Date().toISOString()};localStorage.setItem("claude-settings",JSON.stringify(X)),localStorage.setItem("cursor-tools-settings",JSON.stringify(de)),localStorage.setItem("codex-settings",JSON.stringify(Re)),N("success"),setTimeout(()=>{t()},1e3)}catch(X){console.error("Error saving tool settings:",X),N("error")}finally{k(!1)}},Dn=()=>{z({name:"",type:"stdio",scope:"user",projectPath:"",config:{command:"",args:[],env:{},url:"",headers:{},timeout:3e4},jsonInput:"",importMode:"form"}),q(null),T(!1),ke("")},Ei=(X=null)=>{X?(q(X),z({name:X.name,type:X.type,scope:X.scope,projectPath:X.projectPath||"",config:{...X.config},raw:X.raw,importMode:"form",jsonInput:""})):Dn(),T(!0)},vt=async X=>{X.preventDefault(),G(!0);try{if(D.importMode==="json"){const de=await Ce("/api/mcp/cli/add-json",{method:"POST",body:JSON.stringify({name:D.name,jsonConfig:D.jsonInput,scope:D.scope,projectPath:D.projectPath})});if(de.ok){const Re=await de.json();if(Re.success)await Ut(),Dn(),N("success");else throw new Error(Re.error||"Failed to add server via JSON")}else{const Re=await de.json();throw new Error(Re.error||"Failed to add server")}}else await cn(D),Dn(),N("success")}catch(de){alert(`Error: ${de.message}`),N("error")}finally{G(!1)}},Ua=async(X,de)=>{if(confirm("Are you sure you want to delete this MCP server?"))try{await jr(X,de),N("success")}catch(Re){alert(`Error: ${Re.message}`),N("error")}},na=async(X,de)=>{try{K({...re,[X]:{loading:!0}});const Re=await wi(X,de);K({...re,[X]:Re})}catch(Re){K({...re,[X]:{success:!1,message:Re.message,details:[]}})}},bs=async(X,de)=>{try{te({...F,[X]:!0});const Re=await Ln(X,de);R({...ue,[X]:Re})}catch{R({...ue,[X]:{success:!1,tools:[],resources:[],prompts:[]}})}finally{te({...F,[X]:!1})}},dn=(X,de)=>{z(Re=>({...Re,config:{...Re.config,[X]:de}}))};return e?a.jsxs("div",{className:"modal-backdrop fixed inset-0 flex items-center justify-center z-[9999] md:p-4 bg-background/95",children:[a.jsxs("div",{className:"bg-background border border-border md:rounded-lg shadow-xl w-full md:max-w-4xl h-full md:h-[90vh] flex flex-col",children:[a.jsxs("div",{className:"flex items-center justify-between p-4 md:p-6 border-b border-border flex-shrink-0",children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx(Ia,{className:"w-5 h-5 md:w-6 md:h-6 text-blue-600"}),a.jsx("h2",{className:"text-lg md:text-xl font-semibold text-foreground",children:o("title")})]}),a.jsx(Be,{variant:"ghost",size:"sm",onClick:t,className:"text-muted-foreground hover:text-foreground touch-manipulation",children:a.jsx(Bt,{className:"w-5 h-5"})})]}),a.jsxs("div",{className:"flex-1 overflow-y-auto",children:[a.jsx("div",{className:"border-b border-border",children:a.jsxs("div",{className:"flex px-4 md:px-6",children:[a.jsx("button",{onClick:()=>Z("agents"),className:`px-4 py-3 text-sm font-medium border-b-2 transition-colors ${_==="agents"?"border-blue-600 text-blue-600 dark:text-blue-400":"border-transparent text-muted-foreground hover:text-foreground"}`,children:o("mainTabs.agents")}),a.jsx("button",{onClick:()=>Z("appearance"),className:`px-4 py-3 text-sm font-medium border-b-2 transition-colors ${_==="appearance"?"border-blue-600 text-blue-600 dark:text-blue-400":"border-transparent text-muted-foreground hover:text-foreground"}`,children:o("mainTabs.appearance")}),a.jsxs("button",{onClick:()=>Z("git"),className:`px-4 py-3 text-sm font-medium border-b-2 transition-colors ${_==="git"?"border-blue-600 text-blue-600 dark:text-blue-400":"border-transparent text-muted-foreground hover:text-foreground"}`,children:[a.jsx(qn,{className:"w-4 h-4 inline mr-2"}),o("mainTabs.git")]}),a.jsxs("button",{onClick:()=>Z("api"),className:`px-4 py-3 text-sm font-medium border-b-2 transition-colors ${_==="api"?"border-blue-600 text-blue-600 dark:text-blue-400":"border-transparent text-muted-foreground hover:text-foreground"}`,children:[a.jsx(Fh,{className:"w-4 h-4 inline mr-2"}),o("mainTabs.apiTokens")]}),a.jsx("button",{onClick:()=>Z("tasks"),className:`px-4 py-3 text-sm font-medium border-b-2 transition-colors ${_==="tasks"?"border-blue-600 text-blue-600 dark:text-blue-400":"border-transparent text-muted-foreground hover:text-foreground"}`,children:o("mainTabs.tasks")})]})}),a.jsxs("div",{className:"p-4 md:p-6 space-y-6 md:space-y-8 pb-safe-area-inset-bottom",children:[_==="appearance"&&a.jsx("div",{className:"space-y-6 md:space-y-8",children:_==="appearance"&&a.jsxs("div",{className:"space-y-6 md:space-y-8",children:[a.jsx("div",{className:"space-y-4",children:a.jsx("div",{className:"bg-gray-50 dark:bg-gray-900/50 border border-gray-200 dark:border-gray-700 rounded-lg p-4",children:a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{children:[a.jsx("div",{className:"font-medium text-foreground",children:o("appearanceSettings.darkMode.label")}),a.jsx("div",{className:"text-sm text-muted-foreground",children:o("appearanceSettings.darkMode.description")})]}),a.jsxs("button",{onClick:s,className:"relative inline-flex h-8 w-14 items-center rounded-full bg-gray-200 dark:bg-gray-700 transition-colors duration-200 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2 dark:focus:ring-offset-gray-900",role:"switch","aria-checked":i,"aria-label":"Toggle dark mode",children:[a.jsx("span",{className:"sr-only",children:"Toggle dark mode"}),a.jsx("span",{className:`${i?"translate-x-7":"translate-x-1"} inline-block h-6 w-6 transform rounded-full bg-white shadow-lg transition-transform duration-200 flex items-center justify-center`,children:i?a.jsx(Mm,{className:"w-3.5 h-3.5 text-gray-700"}):a.jsx(Fm,{className:"w-3.5 h-3.5 text-yellow-500"})})]})]})})}),a.jsx("div",{className:"space-y-4",children:a.jsx(d3,{})}),a.jsx("div",{className:"space-y-4",children:a.jsx("div",{className:"bg-gray-50 dark:bg-gray-900/50 border border-gray-200 dark:border-gray-700 rounded-lg p-4",children:a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{children:[a.jsx("div",{className:"font-medium text-foreground",children:o("appearanceSettings.projectSorting.label")}),a.jsx("div",{className:"text-sm text-muted-foreground",children:o("appearanceSettings.projectSorting.description")})]}),a.jsxs("select",{value:C,onChange:X=>v(X.target.value),className:"text-sm bg-gray-50 dark:bg-gray-800 border border-gray-300 dark:border-gray-600 text-gray-900 dark:text-gray-100 rounded-lg focus:ring-blue-500 focus:border-blue-500 p-2 w-32",children:[a.jsx("option",{value:"name",children:o("appearanceSettings.projectSorting.alphabetical")}),a.jsx("option",{value:"date",children:o("appearanceSettings.projectSorting.recentActivity")})]})]})})}),a.jsxs("div",{className:"space-y-4",children:[a.jsx("h3",{className:"text-lg font-semibold text-foreground",children:o("appearanceSettings.codeEditor.title")}),a.jsx("div",{className:"bg-gray-50 dark:bg-gray-900/50 border border-gray-200 dark:border-gray-700 rounded-lg p-4",children:a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{children:[a.jsx("div",{className:"font-medium text-foreground",children:o("appearanceSettings.codeEditor.theme.label")}),a.jsx("div",{className:"text-sm text-muted-foreground",children:o("appearanceSettings.codeEditor.theme.description")})]}),a.jsxs("button",{onClick:()=>qe(Ie==="dark"?"light":"dark"),className:"relative inline-flex h-8 w-14 items-center rounded-full bg-gray-200 dark:bg-gray-700 transition-colors duration-200 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2 dark:focus:ring-offset-gray-900",role:"switch","aria-checked":Ie==="dark","aria-label":"Toggle editor theme",children:[a.jsx("span",{className:"sr-only",children:"Toggle editor theme"}),a.jsx("span",{className:`${Ie==="dark"?"translate-x-7":"translate-x-1"} inline-block h-6 w-6 transform rounded-full bg-white shadow-lg transition-transform duration-200 flex items-center justify-center`,children:Ie==="dark"?a.jsx(Mm,{className:"w-3.5 h-3.5 text-gray-700"}):a.jsx(Fm,{className:"w-3.5 h-3.5 text-yellow-500"})})]})]})}),a.jsx("div",{className:"bg-gray-50 dark:bg-gray-900/50 border border-gray-200 dark:border-gray-700 rounded-lg p-4",children:a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{children:[a.jsx("div",{className:"font-medium text-foreground",children:o("appearanceSettings.codeEditor.wordWrap.label")}),a.jsx("div",{className:"text-sm text-muted-foreground",children:o("appearanceSettings.codeEditor.wordWrap.description")})]}),a.jsxs("button",{onClick:()=>ct(!ze),className:"relative inline-flex h-8 w-14 items-center rounded-full bg-gray-200 dark:bg-gray-700 transition-colors duration-200 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2 dark:focus:ring-offset-gray-900",role:"switch","aria-checked":ze,"aria-label":"Toggle word wrap",children:[a.jsx("span",{className:"sr-only",children:"Toggle word wrap"}),a.jsx("span",{className:`${ze?"translate-x-7":"translate-x-1"} inline-block h-6 w-6 transform rounded-full bg-white shadow-lg transition-transform duration-200`})]})]})}),a.jsx("div",{className:"bg-gray-50 dark:bg-gray-900/50 border border-gray-200 dark:border-gray-700 rounded-lg p-4",children:a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{children:[a.jsx("div",{className:"font-medium text-foreground",children:o("appearanceSettings.codeEditor.showMinimap.label")}),a.jsx("div",{className:"text-sm text-muted-foreground",children:o("appearanceSettings.codeEditor.showMinimap.description")})]}),a.jsxs("button",{onClick:()=>wt(!Ye),className:"relative inline-flex h-8 w-14 items-center rounded-full bg-gray-200 dark:bg-gray-700 transition-colors duration-200 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2 dark:focus:ring-offset-gray-900",role:"switch","aria-checked":Ye,"aria-label":"Toggle minimap",children:[a.jsx("span",{className:"sr-only",children:"Toggle minimap"}),a.jsx("span",{className:`${Ye?"translate-x-7":"translate-x-1"} inline-block h-6 w-6 transform rounded-full bg-white shadow-lg transition-transform duration-200`})]})]})}),a.jsx("div",{className:"bg-gray-50 dark:bg-gray-900/50 border border-gray-200 dark:border-gray-700 rounded-lg p-4",children:a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{children:[a.jsx("div",{className:"font-medium text-foreground",children:o("appearanceSettings.codeEditor.lineNumbers.label")}),a.jsx("div",{className:"text-sm text-muted-foreground",children:o("appearanceSettings.codeEditor.lineNumbers.description")})]}),a.jsxs("button",{onClick:()=>et(!gt),className:"relative inline-flex h-8 w-14 items-center rounded-full bg-gray-200 dark:bg-gray-700 transition-colors duration-200 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2 dark:focus:ring-offset-gray-900",role:"switch","aria-checked":gt,"aria-label":"Toggle line numbers",children:[a.jsx("span",{className:"sr-only",children:"Toggle line numbers"}),a.jsx("span",{className:`${gt?"translate-x-7":"translate-x-1"} inline-block h-6 w-6 transform rounded-full bg-white shadow-lg transition-transform duration-200`})]})]})}),a.jsx("div",{className:"bg-gray-50 dark:bg-gray-900/50 border border-gray-200 dark:border-gray-700 rounded-lg p-4",children:a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{children:[a.jsx("div",{className:"font-medium text-foreground",children:o("appearanceSettings.codeEditor.fontSize.label")}),a.jsx("div",{className:"text-sm text-muted-foreground",children:o("appearanceSettings.codeEditor.fontSize.description")})]}),a.jsxs("select",{value:Me,onChange:X=>mt(X.target.value),className:"text-sm bg-gray-50 dark:bg-gray-800 border border-gray-300 dark:border-gray-600 text-gray-900 dark:text-gray-100 rounded-lg focus:ring-blue-500 focus:border-blue-500 p-2 w-24",children:[a.jsx("option",{value:"10",children:"10px"}),a.jsx("option",{value:"11",children:"11px"}),a.jsx("option",{value:"12",children:"12px"}),a.jsx("option",{value:"13",children:"13px"}),a.jsx("option",{value:"14",children:"14px"}),a.jsx("option",{value:"15",children:"15px"}),a.jsx("option",{value:"16",children:"16px"}),a.jsx("option",{value:"18",children:"18px"}),a.jsx("option",{value:"20",children:"20px"})]})]})})]})]})}),_==="git"&&a.jsx(MG,{}),_==="agents"&&a.jsxs("div",{className:"flex flex-col md:flex-row h-full min-h-[400px] md:min-h-[500px]",children:[a.jsx("div",{className:"md:hidden border-b border-gray-200 dark:border-gray-700 flex-shrink-0",children:a.jsxs("div",{className:"flex",children:[a.jsx(Ya,{agentId:"claude",authStatus:xr,isSelected:se==="claude",onClick:()=>_e("claude"),isMobile:!0}),a.jsx(Ya,{agentId:"cursor",authStatus:ge,isSelected:se==="cursor",onClick:()=>_e("cursor"),isMobile:!0}),a.jsx(Ya,{agentId:"codex",authStatus:bt,isSelected:se==="codex",onClick:()=>_e("codex"),isMobile:!0})]})}),a.jsx("div",{className:"hidden md:block w-48 border-r border-gray-200 dark:border-gray-700 flex-shrink-0",children:a.jsxs("div",{className:"p-2",children:[a.jsx(Ya,{agentId:"claude",authStatus:xr,isSelected:se==="claude",onClick:()=>_e("claude")}),a.jsx(Ya,{agentId:"cursor",authStatus:ge,isSelected:se==="cursor",onClick:()=>_e("cursor")}),a.jsx(Ya,{agentId:"codex",authStatus:bt,isSelected:se==="codex",onClick:()=>_e("codex")})]})}),a.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[a.jsx("div",{className:"border-b border-gray-200 dark:border-gray-700 flex-shrink-0",children:a.jsxs("div",{className:"flex px-2 md:px-4 overflow-x-auto",children:[a.jsx("button",{onClick:()=>fe("account"),className:`px-3 md:px-4 py-2 md:py-3 text-xs md:text-sm font-medium border-b-2 transition-colors whitespace-nowrap ${oe==="account"?"border-blue-600 text-blue-600 dark:text-blue-400":"border-transparent text-muted-foreground hover:text-foreground"}`,children:o("tabs.account")}),a.jsx("button",{onClick:()=>fe("permissions"),className:`px-3 md:px-4 py-2 md:py-3 text-xs md:text-sm font-medium border-b-2 transition-colors whitespace-nowrap ${oe==="permissions"?"border-blue-600 text-blue-600 dark:text-blue-400":"border-transparent text-muted-foreground hover:text-foreground"}`,children:o("tabs.permissions")}),a.jsx("button",{onClick:()=>fe("mcp"),className:`px-3 md:px-4 py-2 md:py-3 text-xs md:text-sm font-medium border-b-2 transition-colors whitespace-nowrap ${oe==="mcp"?"border-blue-600 text-blue-600 dark:text-blue-400":"border-transparent text-muted-foreground hover:text-foreground"}`,children:o("tabs.mcpServers")})]})}),a.jsxs("div",{className:"flex-1 overflow-y-auto p-3 md:p-4",children:[oe==="account"&&a.jsx(UG,{agent:se,authStatus:se==="claude"?xr:se==="cursor"?ge:bt,onLogin:se==="claude"?fn:se==="cursor"?ya:qo}),oe==="permissions"&&se==="claude"&&a.jsx(_m,{agent:"claude",skipPermissions:f,setSkipPermissions:w,allowedTools:l,setAllowedTools:c,disallowedTools:d,setDisallowedTools:u,newAllowedTool:p,setNewAllowedTool:h,newDisallowedTool:m,setNewDisallowedTool:g}),oe==="permissions"&&se==="cursor"&&a.jsx(_m,{agent:"cursor",skipPermissions:Ee,setSkipPermissions:H,allowedCommands:Pt,setAllowedCommands:xe,disallowedCommands:at,setDisallowedCommands:ce,newAllowedCommand:Y,setNewAllowedCommand:le,newDisallowedCommand:ve,setNewDisallowedCommand:Ve}),oe==="permissions"&&se==="codex"&&a.jsx(_m,{agent:"codex",permissionMode:ie,setPermissionMode:je}),oe==="mcp"&&se==="claude"&&a.jsx(Lm,{agent:"claude",servers:I,onAdd:()=>Ei(),onEdit:X=>Ei(X),onDelete:(X,de)=>Ua(X,de),onTest:(X,de)=>na(X,de),onDiscoverTools:(X,de)=>bs(X,de),testResults:re,serverTools:ue,toolsLoading:F}),oe==="mcp"&&se==="cursor"&&a.jsx(Lm,{agent:"cursor",servers:It,onAdd:()=>{},onEdit:X=>{},onDelete:X=>{}}),oe==="mcp"&&se==="codex"&&a.jsx(Lm,{agent:"codex",servers:Rt,onAdd:()=>fs(),onEdit:X=>fs(X),onDelete:X=>Ba(X)})]})]})]}),j&&a.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-[110] p-4",children:a.jsxs("div",{className:"bg-background border border-border rounded-lg w-full max-w-2xl max-h-[90vh] overflow-y-auto",children:[a.jsxs("div",{className:"flex items-center justify-between p-4 border-b border-border",children:[a.jsx("h3",{className:"text-lg font-medium text-foreground",children:o(P?"mcpForm.title.edit":"mcpForm.title.add")}),a.jsx(Be,{variant:"ghost",size:"sm",onClick:Dn,children:a.jsx(Bt,{className:"w-4 h-4"})})]}),a.jsxs("form",{onSubmit:vt,className:"p-4 space-y-4",children:[!P&&a.jsxs("div",{className:"flex gap-2 mb-4",children:[a.jsx("button",{type:"button",onClick:()=>z(X=>({...X,importMode:"form"})),className:`px-4 py-2 rounded-lg font-medium transition-colors ${D.importMode==="form"?"bg-blue-600 text-white":"bg-gray-100 dark:bg-gray-800 text-gray-700 dark:text-gray-300 hover:bg-gray-200 dark:hover:bg-gray-700"}`,children:o("mcpForm.importMode.form")}),a.jsx("button",{type:"button",onClick:()=>z(X=>({...X,importMode:"json"})),className:`px-4 py-2 rounded-lg font-medium transition-colors ${D.importMode==="json"?"bg-blue-600 text-white":"bg-gray-100 dark:bg-gray-800 text-gray-700 dark:text-gray-300 hover:bg-gray-200 dark:hover:bg-gray-700"}`,children:o("mcpForm.importMode.json")})]}),D.importMode==="form"&&P&&a.jsxs("div",{className:"bg-gray-50 dark:bg-gray-900/50 border border-gray-200 dark:border-gray-700 rounded-lg p-3",children:[a.jsx("label",{className:"block text-sm font-medium text-foreground mb-2",children:o("mcpForm.scope.label")}),a.jsxs("div",{className:"flex items-center gap-2",children:[D.scope==="user"?a.jsx(Dm,{className:"w-4 h-4"}):a.jsx(Tn,{className:"w-4 h-4"}),a.jsx("span",{className:"text-sm",children:D.scope==="user"?o("mcpForm.scope.userGlobal"):o("mcpForm.scope.projectLocal")}),D.scope==="local"&&D.projectPath&&a.jsxs("span",{className:"text-xs text-muted-foreground",children:["- ",D.projectPath]})]}),a.jsx("p",{className:"text-xs text-muted-foreground mt-2",children:o("mcpForm.scope.cannotChange")})]}),D.importMode==="form"&&!P&&a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{children:[a.jsxs("label",{className:"block text-sm font-medium text-foreground mb-2",children:[o("mcpForm.scope.label")," *"]}),a.jsxs("div",{className:"flex gap-2",children:[a.jsx("button",{type:"button",onClick:()=>z(X=>({...X,scope:"user",projectPath:""})),className:`flex-1 px-4 py-2 rounded-lg font-medium transition-colors ${D.scope==="user"?"bg-blue-600 text-white":"bg-gray-100 dark:bg-gray-800 text-gray-700 dark:text-gray-300 hover:bg-gray-200 dark:hover:bg-gray-700"}`,children:a.jsxs("div",{className:"flex items-center justify-center gap-2",children:[a.jsx(Dm,{className:"w-4 h-4"}),a.jsx("span",{children:o("mcpForm.scope.userGlobal")})]})}),a.jsx("button",{type:"button",onClick:()=>z(X=>({...X,scope:"local"})),className:`flex-1 px-4 py-2 rounded-lg font-medium transition-colors ${D.scope==="local"?"bg-blue-600 text-white":"bg-gray-100 dark:bg-gray-800 text-gray-700 dark:text-gray-300 hover:bg-gray-200 dark:hover:bg-gray-700"}`,children:a.jsxs("div",{className:"flex items-center justify-center gap-2",children:[a.jsx(Tn,{className:"w-4 h-4"}),a.jsx("span",{children:o("mcpForm.scope.projectLocal")})]})})]}),a.jsx("p",{className:"text-xs text-muted-foreground mt-2",children:D.scope==="user"?o("mcpForm.scope.userDescription"):o("mcpForm.scope.projectDescription")})]}),D.scope==="local"&&!P&&a.jsxs("div",{children:[a.jsxs("label",{className:"block text-sm font-medium text-foreground mb-2",children:[o("mcpForm.fields.selectProject")," *"]}),a.jsxs("select",{value:D.projectPath,onChange:X=>z(de=>({...de,projectPath:X.target.value})),className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 bg-gray-50 dark:bg-gray-800 text-gray-900 dark:text-gray-100 rounded-lg focus:ring-blue-500 focus:border-blue-500",required:D.scope==="local",children:[a.jsxs("option",{value:"",children:[o("mcpForm.fields.selectProject"),"..."]}),r.map(X=>a.jsx("option",{value:X.path||X.fullPath,children:X.displayName||X.name},X.name))]}),D.projectPath&&a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:o("mcpForm.projectPath",{path:D.projectPath})})]})]}),a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[a.jsxs("div",{className:D.importMode==="json"?"md:col-span-2":"",children:[a.jsxs("label",{className:"block text-sm font-medium text-foreground mb-2",children:[o("mcpForm.fields.serverName")," *"]}),a.jsx(tr,{value:D.name,onChange:X=>{z(de=>({...de,name:X.target.value}))},placeholder:o("mcpForm.placeholders.serverName"),required:!0})]}),D.importMode==="form"&&a.jsxs("div",{children:[a.jsxs("label",{className:"block text-sm font-medium text-foreground mb-2",children:[o("mcpForm.fields.transportType")," *"]}),a.jsxs("select",{value:D.type,onChange:X=>{z(de=>({...de,type:X.target.value}))},className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 bg-gray-50 dark:bg-gray-800 text-gray-900 dark:text-gray-100 rounded-lg focus:ring-blue-500 focus:border-blue-500",children:[a.jsx("option",{value:"stdio",children:"stdio"}),a.jsx("option",{value:"sse",children:"SSE"}),a.jsx("option",{value:"http",children:"HTTP"})]})]})]}),P&&D.raw&&D.importMode==="form"&&a.jsxs("div",{className:"bg-gray-50 dark:bg-gray-900/50 border border-gray-200 dark:border-gray-700 rounded-lg p-4",children:[a.jsx("h4",{className:"text-sm font-medium text-foreground mb-2",children:o("mcpForm.configDetails",{configFile:P.scope==="global"?"~/.claude.json":"project config"})}),a.jsx("pre",{className:"text-xs bg-gray-100 dark:bg-gray-800 p-3 rounded overflow-x-auto",children:JSON.stringify(D.raw,null,2)})]}),D.importMode==="json"&&a.jsx("div",{className:"space-y-4",children:a.jsxs("div",{children:[a.jsxs("label",{className:"block text-sm font-medium text-foreground mb-2",children:[o("mcpForm.fields.jsonConfig")," *"]}),a.jsx("textarea",{value:D.jsonInput,onChange:X=>{z(de=>({...de,jsonInput:X.target.value}));try{if(X.target.value.trim()){const de=JSON.parse(X.target.value);de.type?de.type==="stdio"&&!de.command?ke(o("mcpForm.validation.stdioRequiresCommand")):(de.type==="http"||de.type==="sse")&&!de.url?ke(o("mcpForm.validation.httpRequiresUrl",{type:de.type})):ke(""):ke(o("mcpForm.validation.missingType"))}}catch{X.target.value.trim()?ke(o("mcpForm.validation.invalidJson")):ke("")}},className:`w-full px-3 py-2 border ${me?"border-red-500":"border-gray-300 dark:border-gray-600"} bg-gray-50 dark:bg-gray-800 text-gray-900 dark:text-gray-100 rounded-lg focus:ring-blue-500 focus:border-blue-500 font-mono text-sm`,rows:"8",placeholder:`{
|
|
1207
1207
|
"type": "stdio",
|
|
1208
1208
|
"command": "/path/to/server",
|
|
1209
1209
|
"args": ["--api-key", "abc123"],
|
|
@@ -1212,20 +1212,20 @@ ${G}`)}finally{u(!1)}})()},[e,r,s]),x.useEffect(()=>{(async()=>{if(!n?.name){con
|
|
|
1212
1212
|
}
|
|
1213
1213
|
}`,required:!0}),me&&a.jsx("p",{className:"text-xs text-red-500 mt-1",children:me}),a.jsxs("p",{className:"text-xs text-muted-foreground mt-2",children:[o("mcpForm.validation.jsonHelp"),a.jsx("br",{}),"• stdio: ",'{"type":"stdio","command":"npx","args":["@upstash/context7-mcp"]}',a.jsx("br",{}),"• http/sse: ",'{"type":"http","url":"https://api.example.com/mcp"}']})]})}),D.importMode==="form"&&D.type==="stdio"&&a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{children:[a.jsxs("label",{className:"block text-sm font-medium text-foreground mb-2",children:[o("mcpForm.fields.command")," *"]}),a.jsx(tr,{value:D.config.command,onChange:X=>dn("command",X.target.value),placeholder:"/path/to/mcp-server",required:!0})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-sm font-medium text-foreground mb-2",children:o("mcpForm.fields.arguments")}),a.jsx("textarea",{value:Array.isArray(D.config.args)?D.config.args.join(`
|
|
1214
1214
|
`):"",onChange:X=>dn("args",X.target.value.split(`
|
|
1215
|
-
`).filter(
|
|
1216
|
-
abc123`})]})]}),D.importMode==="form"&&(D.type==="sse"||D.type==="http")&&a.jsxs("div",{children:[a.jsxs("label",{className:"block text-sm font-medium text-foreground mb-2",children:[o("mcpForm.fields.url")," *"]}),a.jsx(tr,{value:D.config.url,onChange:X=>dn("url",X.target.value),placeholder:"https://api.example.com/mcp",type:"url",required:!0})]}),D.importMode==="form"&&a.jsxs("div",{children:[a.jsx("label",{className:"block text-sm font-medium text-foreground mb-2",children:o("mcpForm.fields.envVars")}),a.jsx("textarea",{value:Object.entries(D.config.env||{}).map(([X,
|
|
1217
|
-
`),onChange:X=>{const
|
|
1218
|
-
`).forEach(Re=>{const[ht,...dr]=Re.split("=");ht&&ht.trim()&&(
|
|
1219
|
-
DEBUG=true`})]}),D.importMode==="form"&&(D.type==="sse"||D.type==="http")&&a.jsxs("div",{children:[a.jsx("label",{className:"block text-sm font-medium text-foreground mb-2",children:o("mcpForm.fields.headers")}),a.jsx("textarea",{value:Object.entries(D.config.headers||{}).map(([X,
|
|
1220
|
-
`),onChange:X=>{const
|
|
1221
|
-
`).forEach(Re=>{const[ht,...dr]=Re.split("=");ht&&ht.trim()&&(
|
|
1222
|
-
X-API-Key=your-key`})]}),a.jsxs("div",{className:"flex justify-end gap-2 pt-4",children:[a.jsx(Be,{type:"button",variant:"outline",onClick:Dn,children:o("mcpForm.actions.cancel")}),a.jsx(Be,{type:"submit",disabled:U,className:"bg-purple-600 hover:bg-purple-700 disabled:opacity-50",children:o(U?"mcpForm.actions.saving":P?"mcpForm.actions.updateServer":"mcpForm.actions.addServer")})]})]})]})}),Te&&a.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-[110] p-4",children:a.jsxs("div",{className:"bg-background border border-border rounded-lg w-full max-w-lg max-h-[90vh] overflow-y-auto",children:[a.jsxs("div",{className:"flex items-center justify-between p-4 border-b border-border",children:[a.jsx("h3",{className:"text-lg font-medium text-foreground",children:o(Qe?"mcpForm.title.edit":"mcpForm.title.add")}),a.jsx(Be,{variant:"ghost",size:"sm",onClick:_r,children:a.jsx(Bt,{className:"w-4 h-4"})})]}),a.jsxs("form",{onSubmit:gn,className:"p-4 space-y-4",children:[a.jsxs("div",{children:[a.jsxs("label",{className:"block text-sm font-medium text-foreground mb-2",children:[o("mcpForm.fields.serverName")," *"]}),a.jsx(tr,{value:Ue.name,onChange:X=>st(
|
|
1223
|
-
`),onChange:X=>st(
|
|
1215
|
+
`).filter(de=>de.trim())),className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 bg-gray-50 dark:bg-gray-800 text-gray-900 dark:text-gray-100 rounded-lg focus:ring-blue-500 focus:border-blue-500",rows:"3",placeholder:`--api-key
|
|
1216
|
+
abc123`})]})]}),D.importMode==="form"&&(D.type==="sse"||D.type==="http")&&a.jsxs("div",{children:[a.jsxs("label",{className:"block text-sm font-medium text-foreground mb-2",children:[o("mcpForm.fields.url")," *"]}),a.jsx(tr,{value:D.config.url,onChange:X=>dn("url",X.target.value),placeholder:"https://api.example.com/mcp",type:"url",required:!0})]}),D.importMode==="form"&&a.jsxs("div",{children:[a.jsx("label",{className:"block text-sm font-medium text-foreground mb-2",children:o("mcpForm.fields.envVars")}),a.jsx("textarea",{value:Object.entries(D.config.env||{}).map(([X,de])=>`${X}=${de}`).join(`
|
|
1217
|
+
`),onChange:X=>{const de={};X.target.value.split(`
|
|
1218
|
+
`).forEach(Re=>{const[ht,...dr]=Re.split("=");ht&&ht.trim()&&(de[ht.trim()]=dr.join("=").trim())}),dn("env",de)},className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 bg-gray-50 dark:bg-gray-800 text-gray-900 dark:text-gray-100 rounded-lg focus:ring-blue-500 focus:border-blue-500",rows:"3",placeholder:`API_KEY=your-key
|
|
1219
|
+
DEBUG=true`})]}),D.importMode==="form"&&(D.type==="sse"||D.type==="http")&&a.jsxs("div",{children:[a.jsx("label",{className:"block text-sm font-medium text-foreground mb-2",children:o("mcpForm.fields.headers")}),a.jsx("textarea",{value:Object.entries(D.config.headers||{}).map(([X,de])=>`${X}=${de}`).join(`
|
|
1220
|
+
`),onChange:X=>{const de={};X.target.value.split(`
|
|
1221
|
+
`).forEach(Re=>{const[ht,...dr]=Re.split("=");ht&&ht.trim()&&(de[ht.trim()]=dr.join("=").trim())}),dn("headers",de)},className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 bg-gray-50 dark:bg-gray-800 text-gray-900 dark:text-gray-100 rounded-lg focus:ring-blue-500 focus:border-blue-500",rows:"3",placeholder:`Authorization=Bearer token
|
|
1222
|
+
X-API-Key=your-key`})]}),a.jsxs("div",{className:"flex justify-end gap-2 pt-4",children:[a.jsx(Be,{type:"button",variant:"outline",onClick:Dn,children:o("mcpForm.actions.cancel")}),a.jsx(Be,{type:"submit",disabled:U,className:"bg-purple-600 hover:bg-purple-700 disabled:opacity-50",children:o(U?"mcpForm.actions.saving":P?"mcpForm.actions.updateServer":"mcpForm.actions.addServer")})]})]})]})}),Te&&a.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-[110] p-4",children:a.jsxs("div",{className:"bg-background border border-border rounded-lg w-full max-w-lg max-h-[90vh] overflow-y-auto",children:[a.jsxs("div",{className:"flex items-center justify-between p-4 border-b border-border",children:[a.jsx("h3",{className:"text-lg font-medium text-foreground",children:o(Qe?"mcpForm.title.edit":"mcpForm.title.add")}),a.jsx(Be,{variant:"ghost",size:"sm",onClick:_r,children:a.jsx(Bt,{className:"w-4 h-4"})})]}),a.jsxs("form",{onSubmit:gn,className:"p-4 space-y-4",children:[a.jsxs("div",{children:[a.jsxs("label",{className:"block text-sm font-medium text-foreground mb-2",children:[o("mcpForm.fields.serverName")," *"]}),a.jsx(tr,{value:Ue.name,onChange:X=>st(de=>({...de,name:X.target.value})),placeholder:o("mcpForm.placeholders.serverName"),required:!0})]}),a.jsxs("div",{children:[a.jsxs("label",{className:"block text-sm font-medium text-foreground mb-2",children:[o("mcpForm.fields.command")," *"]}),a.jsx(tr,{value:Ue.config?.command||"",onChange:X=>st(de=>({...de,config:{...de.config,command:X.target.value}})),placeholder:"npx @my-org/mcp-server",required:!0})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-sm font-medium text-foreground mb-2",children:o("mcpForm.fields.arguments")}),a.jsx("textarea",{value:(Ue.config?.args||[]).join(`
|
|
1223
|
+
`),onChange:X=>st(de=>({...de,config:{...de.config,args:X.target.value.split(`
|
|
1224
1224
|
`).filter(Re=>Re.trim())}})),placeholder:`--port
|
|
1225
|
-
3000`,rows:3,className:"w-full px-3 py-2 text-sm bg-background border border-input rounded-md focus:outline-none focus:ring-2 focus:ring-ring"})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-sm font-medium text-foreground mb-2",children:o("mcpForm.fields.envVars")}),a.jsx("textarea",{value:Object.entries(Ue.config?.env||{}).map(([X,
|
|
1226
|
-
`),onChange:X=>{const
|
|
1227
|
-
`).forEach(Re=>{const[ht,...dr]=Re.split("=");ht&&dr.length>0&&(
|
|
1228
|
-
DEBUG=true`,rows:3,className:"w-full px-3 py-2 text-sm bg-background border border-input rounded-md focus:outline-none focus:ring-2 focus:ring-ring"})]}),a.jsxs("div",{className:"flex justify-end gap-2 pt-4 border-t border-border",children:[a.jsx(Be,{type:"button",variant:"outline",onClick:_r,children:o("mcpForm.actions.cancel")}),a.jsx(Be,{type:"submit",disabled:Fe||!Ue.name||!Ue.config?.command,className:"bg-green-600 hover:bg-green-700 text-white",children:o(Fe?"mcpForm.actions.saving":Qe?"mcpForm.actions.updateServer":"mcpForm.actions.addServer")})]})]})]})}),_==="tasks"&&a.jsx("div",{className:"space-y-6 md:space-y-8",children:a.jsx(FG,{})}),_==="api"&&a.jsx("div",{className:"space-y-6 md:space-y-8",children:a.jsx(DG,{})})]})]}),a.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between p-4 md:p-6 border-t border-border flex-shrink-0 gap-3 pb-safe-area-inset-bottom",children:[a.jsxs("div",{className:"flex items-center justify-center sm:justify-start gap-2 order-2 sm:order-1",children:[E==="success"&&a.jsxs("div",{className:"text-green-600 dark:text-green-400 text-sm flex items-center gap-1",children:[a.jsx("svg",{className:"w-4 h-4",fill:"currentColor",viewBox:"0 0 20 20",children:a.jsx("path",{fillRule:"evenodd",d:"M16.707 5.293a1 1 0 010 1.414l-8 8a1 1 0 01-1.414 0l-4-4a1 1 0 011.414-1.414L8 12.586l7.293-7.293a1 1 0 011.414 0z",clipRule:"evenodd"})}),o("saveStatus.success")]}),E==="error"&&a.jsxs("div",{className:"text-red-600 dark:text-red-400 text-sm flex items-center gap-1",children:[a.jsx("svg",{className:"w-4 h-4",fill:"currentColor",viewBox:"0 0 20 20",children:a.jsx("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7 4a1 1 0 11-2 0 1 1 0 012 0zm-1-9a1 1 0 00-1 1v4a1 1 0 102 0V6a1 1 0 00-1-1z",clipRule:"evenodd"})}),o("saveStatus.error")]})]}),a.jsxs("div",{className:"flex items-center gap-3 order-1 sm:order-2",children:[a.jsx(Be,{variant:"outline",onClick:t,disabled:S,className:"flex-1 sm:flex-none h-10 touch-manipulation",children:o("footerActions.cancel")}),a.jsx(Be,{onClick:qr,disabled:S,className:"flex-1 sm:flex-none h-10 bg-blue-600 hover:bg-blue-700 disabled:opacity-50 touch-manipulation",children:S?a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("div",{className:"w-4 h-4 animate-spin rounded-full border-2 border-white border-t-transparent"}),o("saveStatus.saving")]}):o("footerActions.save")})]})]})]}),a.jsx(c3,{isOpen:Ge,onClose:()=>dt(!1),provider:he,project:nr,onComplete:Go,isAuthenticated:he==="claude"?xr.authenticated:he==="cursor"?ge.authenticated:he==="codex"?bt.authenticated:!1},he)]}):null}function JG(){const{isDarkMode:e,toggleDarkMode:t}=as();return a.jsxs("button",{onClick:t,className:"relative inline-flex h-8 w-14 items-center rounded-full bg-gray-200 dark:bg-gray-700 transition-colors duration-200 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2 dark:focus:ring-offset-gray-900",role:"switch","aria-checked":e,"aria-label":"Toggle dark mode",children:[a.jsx("span",{className:"sr-only",children:"Toggle dark mode"}),a.jsx("span",{className:`${e?"translate-x-7":"translate-x-1"} inline-block h-6 w-6 transform rounded-full bg-white shadow-lg transition-transform duration-200 flex items-center justify-center`,children:e?a.jsx("svg",{className:"w-3.5 h-3.5 text-gray-700",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M20.354 15.354A9 9 0 018.646 3.646 9.003 9.003 0 0012 21a9.003 9.003 0 008.354-5.646z"})}):a.jsx("svg",{className:"w-3.5 h-3.5 text-yellow-500",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 3v1m0 16v1m9-9h-1M4 12H3m15.364 6.364l-.707-.707M6.343 6.343l-.707-.707m12.728 0l-.707.707M6.343 17.657l-.707.707M16 12a4 4 0 11-8 0 4 4 0 018 0z"})})})]})}const QG=({isOpen:e,onToggle:t,autoExpandTools:r,onAutoExpandChange:n,showRawParameters:i,onShowRawParametersChange:s,showThinking:o,onShowThinkingChange:l,autoScrollToBottom:c,onAutoScrollChange:d,sendByCtrlEnter:u,onSendByCtrlEnterChange:p,isMobile:h})=>{const{t:m}=Ht("settings"),[g,f]=x.useState(e),[w,S]=x.useState(()=>localStorage.getItem("whisperMode")||"default"),{isDarkMode:k}=as(),[E,N]=x.useState(()=>{const F=localStorage.getItem("quickSettingsHandlePosition");if(F)try{return JSON.parse(F).y??50}catch{return localStorage.removeItem("quickSettingsHandlePosition"),50}return 50}),[C,v]=x.useState(!1),[I,M]=x.useState(0),[j,T]=x.useState(0),[P,q]=x.useState(!1),D=x.useRef(null),z=x.useRef({min:10,max:90}),U=5;x.useEffect(()=>{f(e)},[e]),x.useEffect(()=>{localStorage.setItem("quickSettingsHandlePosition",JSON.stringify({y:E}))},[E]);const G=x.useCallback(()=>h?{bottom:`${window.innerHeight*E/100}px`}:{top:`${E}%`,transform:"translateY(-50%)"},[E,h]),re=x.useCallback(F=>{F.stopPropagation();const te=F.type.includes("touch")?F.touches[0].clientY:F.clientY;M(te),T(E),q(!1),v(!1)},[E]),K=x.useCallback(F=>{if(I===0)return;const te=F.type.includes("touch")?F.touches[0].clientY:F.clientY,_=Math.abs(te-I);if(!C&&_>U&&(v(!0),q(!0),document.body.style.cursor="grabbing",document.body.style.userSelect="none",F.type.includes("touch")&&(document.body.style.overflow="hidden",document.body.style.position="fixed",document.body.style.width="100%")),!C)return;F.type.includes("touch")&&F.preventDefault();const Z=te-I;let me;h?me=-(Z/window.innerHeight)*100:me=Z/window.innerHeight*100;let ke=j+me;ke=Math.max(z.current.min,Math.min(z.current.max,ke)),N(ke)},[C,I,j,h,U]),ue=x.useCallback(()=>{v(!1),M(0),document.body.style.cursor="",document.body.style.userSelect="",document.body.style.overflow="",document.body.style.position="",document.body.style.width=""},[]);x.useEffect(()=>()=>{document.body.style.cursor="",document.body.style.userSelect="",document.body.style.overflow="",document.body.style.position="",document.body.style.width=""},[]),x.useEffect(()=>{if(I!==0){const F=me=>K(me),te=()=>ue(),_=me=>K(me),Z=()=>ue();return document.addEventListener("mousemove",F),document.addEventListener("mouseup",te),document.addEventListener("touchmove",_,{passive:!1}),document.addEventListener("touchend",Z),()=>{document.removeEventListener("mousemove",F),document.removeEventListener("mouseup",te),document.removeEventListener("touchmove",_),document.removeEventListener("touchend",Z)}}},[I,K,ue]);const R=F=>{if(P){F.preventDefault(),q(!1);return}const te=!g;f(te),t(te)};return a.jsxs(a.Fragment,{children:[a.jsx("button",{ref:D,onClick:R,onMouseDown:F=>{re(F)},onTouchStart:F=>{re(F)},className:`fixed ${g?"right-64":"right-0"} z-50 ${C?"":"transition-all duration-150 ease-out"} bg-white dark:bg-gray-800 border ${C?"border-blue-500 dark:border-blue-400":"border-gray-200 dark:border-gray-700"} rounded-l-md p-2 hover:bg-gray-100 dark:hover:bg-gray-700 transition-colors shadow-lg ${C?"cursor-grabbing":"cursor-pointer"} touch-none`,style:{...G(),touchAction:"none",WebkitTouchCallout:"none",WebkitUserSelect:"none"},"aria-label":m(C?"quickSettings.dragHandle.dragging":g?"quickSettings.dragHandle.closePanel":"quickSettings.dragHandle.openPanel"),title:m(C?"quickSettings.dragHandle.draggingStatus":"quickSettings.dragHandle.toggleAndMove"),children:C?a.jsx(u6,{className:"h-5 w-5 text-blue-500 dark:text-blue-400"}):g?a.jsx(Cn,{className:"h-5 w-5 text-gray-600 dark:text-gray-400"}):a.jsx(Mh,{className:"h-5 w-5 text-gray-600 dark:text-gray-400"})}),a.jsx("div",{className:`fixed top-0 right-0 h-full w-64 bg-background border-l border-border shadow-xl transform transition-transform duration-150 ease-out z-40 ${g?"translate-x-0":"translate-x-full"} ${h?"h-screen":""}`,children:a.jsxs("div",{className:"h-full flex flex-col",children:[a.jsx("div",{className:"p-4 border-b border-gray-200 dark:border-gray-700 bg-gray-50 dark:bg-gray-900",children:a.jsxs("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white flex items-center gap-2",children:[a.jsx($6,{className:"h-5 w-5 text-gray-600 dark:text-gray-400"}),m("quickSettings.title")]})}),a.jsxs("div",{className:`flex-1 overflow-y-auto overflow-x-hidden p-4 space-y-6 bg-background ${h?"pb-mobile-nav":""}`,children:[a.jsxs("div",{className:"space-y-2",children:[a.jsx("h4",{className:"text-xs font-semibold uppercase tracking-wider text-gray-500 dark:text-gray-400 mb-2",children:m("quickSettings.sections.appearance")}),a.jsxs("div",{className:"flex items-center justify-between p-3 rounded-lg bg-gray-50 dark:bg-gray-800 hover:bg-gray-100 dark:hover:bg-gray-700 transition-colors border border-transparent hover:border-gray-300 dark:hover:border-gray-600",children:[a.jsxs("span",{className:"flex items-center gap-2 text-sm text-gray-900 dark:text-white",children:[k?a.jsx(Mm,{className:"h-4 w-4 text-gray-600 dark:text-gray-400"}):a.jsx(Fm,{className:"h-4 w-4 text-gray-600 dark:text-gray-400"}),m("quickSettings.darkMode")]}),a.jsx(JG,{})]}),a.jsx("div",{children:a.jsx(d3,{compact:!0})})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx("h4",{className:"text-xs font-semibold uppercase tracking-wider text-gray-500 dark:text-gray-400 mb-2",children:m("quickSettings.sections.toolDisplay")}),a.jsxs("label",{className:"flex items-center justify-between p-3 rounded-lg bg-gray-50 dark:bg-gray-800 hover:bg-gray-100 dark:hover:bg-gray-700 cursor-pointer transition-colors border border-transparent hover:border-gray-300 dark:hover:border-gray-600",children:[a.jsxs("span",{className:"flex items-center gap-2 text-sm text-gray-900 dark:text-white",children:[a.jsx(Ph,{className:"h-4 w-4 text-gray-600 dark:text-gray-400"}),m("quickSettings.autoExpandTools")]}),a.jsx("input",{type:"checkbox",checked:r,onChange:F=>n(F.target.checked),className:"h-4 w-4 rounded border-gray-300 dark:border-gray-600 text-blue-600 dark:text-blue-500 focus:ring-blue-500 focus:ring-2 dark:focus:ring-blue-400 bg-gray-100 dark:bg-gray-800 checked:bg-blue-600 dark:checked:bg-blue-600"})]}),a.jsxs("label",{className:"flex items-center justify-between p-3 rounded-lg bg-gray-50 dark:bg-gray-800 hover:bg-gray-100 dark:hover:bg-gray-700 cursor-pointer transition-colors border border-transparent hover:border-gray-300 dark:hover:border-gray-600",children:[a.jsxs("span",{className:"flex items-center gap-2 text-sm text-gray-900 dark:text-white",children:[a.jsx(hi,{className:"h-4 w-4 text-gray-600 dark:text-gray-400"}),m("quickSettings.showRawParameters")]}),a.jsx("input",{type:"checkbox",checked:i,onChange:F=>s(F.target.checked),className:"h-4 w-4 rounded border-gray-300 dark:border-gray-600 text-blue-600 dark:text-blue-500 focus:ring-blue-500 focus:ring-2 dark:focus:ring-blue-400 bg-gray-100 dark:bg-gray-800 checked:bg-blue-600 dark:checked:bg-blue-600"})]}),a.jsxs("label",{className:"flex items-center justify-between p-3 rounded-lg bg-gray-50 dark:bg-gray-800 hover:bg-gray-100 dark:hover:bg-gray-700 cursor-pointer transition-colors border border-transparent hover:border-gray-300 dark:hover:border-gray-600",children:[a.jsxs("span",{className:"flex items-center gap-2 text-sm text-gray-900 dark:text-white",children:[a.jsx(wo,{className:"h-4 w-4 text-gray-600 dark:text-gray-400"}),m("quickSettings.showThinking")]}),a.jsx("input",{type:"checkbox",checked:o,onChange:F=>l(F.target.checked),className:"h-4 w-4 rounded border-gray-300 dark:border-gray-600 text-blue-600 dark:text-blue-500 focus:ring-blue-500 focus:ring-2 dark:focus:ring-blue-400 bg-gray-100 dark:bg-gray-800 checked:bg-blue-600 dark:checked:bg-blue-600"})]})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx("h4",{className:"text-xs font-semibold uppercase tracking-wider text-gray-500 dark:text-gray-400 mb-2",children:m("quickSettings.sections.viewOptions")}),a.jsxs("label",{className:"flex items-center justify-between p-3 rounded-lg bg-gray-50 dark:bg-gray-800 hover:bg-gray-100 dark:hover:bg-gray-700 cursor-pointer transition-colors border border-transparent hover:border-gray-300 dark:hover:border-gray-600",children:[a.jsxs("span",{className:"flex items-center gap-2 text-sm text-gray-900 dark:text-white",children:[a.jsx(d4,{className:"h-4 w-4 text-gray-600 dark:text-gray-400"}),m("quickSettings.autoScrollToBottom")]}),a.jsx("input",{type:"checkbox",checked:c,onChange:F=>d(F.target.checked),className:"h-4 w-4 rounded border-gray-300 dark:border-gray-600 text-blue-600 dark:text-blue-500 focus:ring-blue-500 focus:ring-2 dark:focus:ring-blue-400 bg-gray-100 dark:bg-gray-800 checked:bg-blue-600 dark:checked:bg-blue-600"})]})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx("h4",{className:"text-xs font-semibold uppercase tracking-wider text-gray-500 dark:text-gray-400 mb-2",children:m("quickSettings.sections.inputSettings")}),a.jsxs("label",{className:"flex items-center justify-between p-3 rounded-lg bg-gray-50 dark:bg-gray-800 hover:bg-gray-100 dark:hover:bg-gray-700 cursor-pointer transition-colors border border-transparent hover:border-gray-300 dark:hover:border-gray-600",children:[a.jsxs("span",{className:"flex items-center gap-2 text-sm text-gray-900 dark:text-white",children:[a.jsx(h4,{className:"h-4 w-4 text-gray-600 dark:text-gray-400"}),m("quickSettings.sendByCtrlEnter")]}),a.jsx("input",{type:"checkbox",checked:u,onChange:F=>p(F.target.checked),className:"h-4 w-4 rounded border-gray-300 dark:border-gray-600 text-blue-600 dark:text-blue-500 focus:ring-blue-500 focus:ring-2 dark:focus:ring-blue-400 bg-gray-100 dark:bg-gray-800 checked:bg-blue-600 dark:checked:bg-blue-600"})]}),a.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 ml-3",children:m("quickSettings.sendByCtrlEnterDescription")})]}),a.jsxs("div",{className:"space-y-2",style:{display:"none"},children:[a.jsx("h4",{className:"text-xs font-semibold uppercase tracking-wider text-gray-500 dark:text-gray-400 mb-2",children:m("quickSettings.sections.whisperDictation")}),a.jsxs("div",{className:"space-y-2",children:[a.jsxs("label",{className:"flex items-start p-3 rounded-lg bg-gray-50 dark:bg-gray-800 hover:bg-gray-100 dark:hover:bg-gray-700 cursor-pointer transition-colors border border-transparent hover:border-gray-300 dark:hover:border-gray-600",children:[a.jsx("input",{type:"radio",name:"whisperMode",value:"default",checked:w==="default",onChange:()=>{S("default"),localStorage.setItem("whisperMode","default"),window.dispatchEvent(new Event("whisperModeChanged"))},className:"mt-0.5 h-4 w-4 border-gray-300 dark:border-gray-600 text-blue-600 dark:text-blue-500 focus:ring-blue-500 dark:focus:ring-blue-400 dark:bg-gray-800 dark:checked:bg-blue-600"}),a.jsxs("div",{className:"ml-3 flex-1",children:[a.jsxs("span",{className:"flex items-center gap-2 text-sm font-medium text-gray-900 dark:text-white",children:[a.jsx(Ws,{className:"h-4 w-4 text-gray-600 dark:text-gray-400"}),m("quickSettings.whisper.modes.default")]}),a.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 mt-1",children:m("quickSettings.whisper.modes.defaultDescription")})]})]}),a.jsxs("label",{className:"flex items-start p-3 rounded-lg bg-gray-50 dark:bg-gray-800 hover:bg-gray-100 dark:hover:bg-gray-700 cursor-pointer transition-colors border border-transparent hover:border-gray-300 dark:hover:border-gray-600",children:[a.jsx("input",{type:"radio",name:"whisperMode",value:"prompt",checked:w==="prompt",onChange:()=>{S("prompt"),localStorage.setItem("whisperMode","prompt"),window.dispatchEvent(new Event("whisperModeChanged"))},className:"mt-0.5 h-4 w-4 border-gray-300 dark:border-gray-600 text-blue-600 dark:text-blue-500 focus:ring-blue-500 dark:focus:ring-blue-400 dark:bg-gray-800 dark:checked:bg-blue-600"}),a.jsxs("div",{className:"ml-3 flex-1",children:[a.jsxs("span",{className:"flex items-center gap-2 text-sm font-medium text-gray-900 dark:text-white",children:[a.jsx(Gn,{className:"h-4 w-4 text-gray-600 dark:text-gray-400"}),m("quickSettings.whisper.modes.prompt")]}),a.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 mt-1",children:m("quickSettings.whisper.modes.promptDescription")})]})]}),a.jsxs("label",{className:"flex items-start p-3 rounded-lg bg-gray-50 dark:bg-gray-800 hover:bg-gray-100 dark:hover:bg-gray-700 cursor-pointer transition-colors border border-transparent hover:border-gray-300 dark:hover:border-gray-600",children:[a.jsx("input",{type:"radio",name:"whisperMode",value:"vibe",checked:w==="vibe"||w==="instructions"||w==="architect",onChange:()=>{S("vibe"),localStorage.setItem("whisperMode","vibe"),window.dispatchEvent(new Event("whisperModeChanged"))},className:"mt-0.5 h-4 w-4 border-gray-300 dark:border-gray-600 text-blue-600 dark:text-blue-500 focus:ring-blue-500 dark:focus:ring-blue-400 dark:bg-gray-800 dark:checked:bg-blue-600"}),a.jsxs("div",{className:"ml-3 flex-1",children:[a.jsxs("span",{className:"flex items-center gap-2 text-sm font-medium text-gray-900 dark:text-white",children:[a.jsx(Fr,{className:"h-4 w-4 text-gray-600 dark:text-gray-400"}),m("quickSettings.whisper.modes.vibe")]}),a.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 mt-1",children:m("quickSettings.whisper.modes.vibeDescription")})]})]})]})]})]})]})}),g&&a.jsx("div",{className:"fixed inset-0 bg-background/80 backdrop-blur-sm z-30 transition-opacity duration-150 ease-out",onClick:R})]})},eH=()=>{const[e,t]=x.useState(""),[r,n]=x.useState(""),[i,s]=x.useState(""),[o,l]=x.useState(!1),[c,d]=x.useState(""),{register:u}=is(),p=async h=>{if(h.preventDefault(),d(""),r!==i){d("Passwords do not match");return}if(e.length<3){d("Username must be at least 3 characters long");return}if(r.length<6){d("Password must be at least 6 characters long");return}l(!0);const m=await u(e,r);m.success||d(m.error),l(!1)};return a.jsx("div",{className:"min-h-screen bg-background flex items-center justify-center p-4",children:a.jsx("div",{className:"w-full max-w-md",children:a.jsxs("div",{className:"bg-card rounded-lg shadow-lg border border-border p-8 space-y-6",children:[a.jsxs("div",{className:"text-center",children:[a.jsx("div",{className:"flex justify-center mb-4",children:a.jsx(nn,{size:64})}),a.jsx("h1",{className:"text-2xl font-bold text-foreground",children:"Welcome to Claude Code UI"}),a.jsx("p",{className:"text-muted-foreground mt-2",children:"Set up your account to get started"})]}),a.jsxs("form",{onSubmit:p,className:"space-y-4",children:[a.jsxs("div",{children:[a.jsx("label",{htmlFor:"username",className:"block text-sm font-medium text-foreground mb-1",children:"Username"}),a.jsx("input",{type:"text",id:"username",value:e,onChange:h=>t(h.target.value),className:"w-full px-3 py-2 border border-border rounded-md bg-background text-foreground focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent",placeholder:"Enter your username",required:!0,disabled:o})]}),a.jsxs("div",{children:[a.jsx("label",{htmlFor:"password",className:"block text-sm font-medium text-foreground mb-1",children:"Password"}),a.jsx("input",{type:"password",id:"password",value:r,onChange:h=>n(h.target.value),className:"w-full px-3 py-2 border border-border rounded-md bg-background text-foreground focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent",placeholder:"Enter your password",required:!0,disabled:o})]}),a.jsxs("div",{children:[a.jsx("label",{htmlFor:"confirmPassword",className:"block text-sm font-medium text-foreground mb-1",children:"Confirm Password"}),a.jsx("input",{type:"password",id:"confirmPassword",value:i,onChange:h=>s(h.target.value),className:"w-full px-3 py-2 border border-border rounded-md bg-background text-foreground focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent",placeholder:"Confirm your password",required:!0,disabled:o})]}),c&&a.jsx("div",{className:"p-3 bg-red-100 dark:bg-red-900/20 border border-red-300 dark:border-red-800 rounded-md",children:a.jsx("p",{className:"text-sm text-red-700 dark:text-red-400",children:c})}),a.jsx("button",{type:"submit",disabled:o,className:"w-full bg-blue-600 hover:bg-blue-700 disabled:bg-blue-400 text-white font-medium py-2 px-4 rounded-md transition-colors duration-200",children:o?"Setting up...":"Create Account"})]}),a.jsx("div",{className:"text-center",children:a.jsx("p",{className:"text-sm text-muted-foreground",children:"This is a single-user system. Only one account can be created."})})]})})})},tH=()=>{const{t:e}=Ht("auth"),[t,r]=x.useState(""),[n,i]=x.useState(""),[s,o]=x.useState(!1),[l,c]=x.useState(""),{login:d}=is(),u=async p=>{if(p.preventDefault(),c(""),!t||!n){c(e("errors.requiredFields"));return}o(!0);const h=await d(t,n);h.success||c(h.error),o(!1)};return a.jsx("div",{className:"min-h-screen bg-background flex items-center justify-center p-4",children:a.jsx("div",{className:"w-full max-w-md",children:a.jsxs("div",{className:"bg-card rounded-lg shadow-lg border border-border p-8 space-y-6",children:[a.jsxs("div",{className:"text-center",children:[a.jsx("div",{className:"flex justify-center mb-4",children:a.jsx("div",{className:"w-16 h-16 bg-primary rounded-lg flex items-center justify-center shadow-sm",children:a.jsx(Wi,{className:"w-8 h-8 text-primary-foreground"})})}),a.jsx("h1",{className:"text-2xl font-bold text-foreground",children:e("login.title")}),a.jsx("p",{className:"text-muted-foreground mt-2",children:e("login.description")})]}),a.jsxs("form",{onSubmit:u,className:"space-y-4",children:[a.jsxs("div",{children:[a.jsx("label",{htmlFor:"username",className:"block text-sm font-medium text-foreground mb-1",children:e("login.username")}),a.jsx("input",{type:"text",id:"username",value:t,onChange:p=>r(p.target.value),className:"w-full px-3 py-2 border border-border rounded-md bg-background text-foreground focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent",placeholder:e("login.placeholders.username"),required:!0,disabled:s})]}),a.jsxs("div",{children:[a.jsx("label",{htmlFor:"password",className:"block text-sm font-medium text-foreground mb-1",children:e("login.password")}),a.jsx("input",{type:"password",id:"password",value:n,onChange:p=>i(p.target.value),className:"w-full px-3 py-2 border border-border rounded-md bg-background text-foreground focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent",placeholder:e("login.placeholders.password"),required:!0,disabled:s})]}),l&&a.jsx("div",{className:"p-3 bg-red-100 dark:bg-red-900/20 border border-red-300 dark:border-red-800 rounded-md",children:a.jsx("p",{className:"text-sm text-red-700 dark:text-red-400",children:l})}),a.jsx("button",{type:"submit",disabled:s,className:"w-full bg-blue-600 hover:bg-blue-700 disabled:bg-blue-400 text-white font-medium py-2 px-4 rounded-md transition-colors duration-200",children:e(s?"login.loading":"login.submit")})]}),a.jsx("div",{className:"text-center",children:a.jsx("p",{className:"text-sm text-muted-foreground",children:"Enter your credentials to access Claude Code UI"})})]})})})},rH=({onComplete:e})=>{const[t,r]=x.useState(0),[n,i]=x.useState(""),[s,o]=x.useState(""),[l,c]=x.useState(!1),[d,u]=x.useState(""),[p,h]=x.useState(null),[m]=x.useState({name:"default",fullPath:""}),[g,f]=x.useState({authenticated:!1,email:null,loading:!0,error:null}),[w,S]=x.useState({authenticated:!1,email:null,loading:!0,error:null}),[k,E]=x.useState({authenticated:!1,email:null,loading:!0,error:null}),{user:N}=is(),C=x.useRef(void 0);x.useEffect(()=>{v()},[]);const v=async()=>{try{const R=await Ce("/api/user/git-config");if(R.ok){const F=await R.json();F.gitName&&i(F.gitName),F.gitEmail&&o(F.gitEmail)}}catch(R){console.error("Error loading git config:",R)}};x.useEffect(()=>{const R=C.current;C.current=p,(R===void 0||R!==null&&p===null)&&(I(),M(),j())},[p]);const I=async()=>{try{const R=await Ce("/api/cli/claude/status");if(R.ok){const F=await R.json();f({authenticated:F.authenticated,email:F.email,loading:!1,error:F.error||null})}else f({authenticated:!1,email:null,loading:!1,error:"Failed to check authentication status"})}catch(R){console.error("Error checking Claude auth status:",R),f({authenticated:!1,email:null,loading:!1,error:R.message})}},M=async()=>{try{const R=await Ce("/api/cli/cursor/status");if(R.ok){const F=await R.json();S({authenticated:F.authenticated,email:F.email,loading:!1,error:F.error||null})}else S({authenticated:!1,email:null,loading:!1,error:"Failed to check authentication status"})}catch(R){console.error("Error checking Cursor auth status:",R),S({authenticated:!1,email:null,loading:!1,error:R.message})}},j=async()=>{try{const R=await Ce("/api/cli/codex/status");if(R.ok){const F=await R.json();E({authenticated:F.authenticated,email:F.email,loading:!1,error:F.error||null})}else E({authenticated:!1,email:null,loading:!1,error:"Failed to check authentication status"})}catch(R){console.error("Error checking Codex auth status:",R),E({authenticated:!1,email:null,loading:!1,error:R.message})}},T=()=>h("claude"),P=()=>h("cursor"),q=()=>h("codex"),D=R=>{R===0&&(p==="claude"?I():p==="cursor"?M():p==="codex"&&j())},z=async()=>{if(u(""),t===0){if(!n.trim()||!s.trim()){u("Both git name and email are required");return}if(!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(s)){u("Please enter a valid email address");return}c(!0);try{const F=await Ce("/api/user/git-config",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({gitName:n,gitEmail:s})});if(!F.ok){const te=await F.json();throw new Error(te.error||"Failed to save git configuration")}r(t+1)}catch(F){u(F.message)}finally{c(!1)}return}r(t+1)},U=()=>{u(""),r(t-1)},G=async()=>{c(!0),u("");try{const R=await Ce("/api/user/complete-onboarding",{method:"POST"});if(!R.ok){const F=await R.json();throw new Error(F.error||"Failed to complete onboarding")}e&&e()}catch(R){u(R.message)}finally{c(!1)}},re=[{title:"Git Configuration",description:"Set up your git identity for commits",icon:qn,required:!0},{title:"Connect Agents",description:"Connect your AI coding assistants",icon:g4,required:!1}],K=()=>{switch(t){case 0:return a.jsxs("div",{className:"space-y-6",children:[a.jsxs("div",{className:"text-center mb-8",children:[a.jsx("div",{className:"w-16 h-16 bg-blue-100 dark:bg-blue-900/30 rounded-full flex items-center justify-center mx-auto mb-4",children:a.jsx(qn,{className:"w-8 h-8 text-blue-600 dark:text-blue-400"})}),a.jsx("h2",{className:"text-2xl font-bold text-foreground mb-2",children:"Git Configuration"}),a.jsx("p",{className:"text-muted-foreground",children:"Configure your git identity to ensure proper attribution for your commits"})]}),a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{children:[a.jsxs("label",{htmlFor:"gitName",className:"flex items-center gap-2 text-sm font-medium text-foreground mb-2",children:[a.jsx(sC,{className:"w-4 h-4"}),"Git Name ",a.jsx("span",{className:"text-red-500",children:"*"})]}),a.jsx("input",{type:"text",id:"gitName",value:n,onChange:R=>i(R.target.value),className:"w-full px-4 py-3 border border-border rounded-lg bg-background text-foreground focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent",placeholder:"John Doe",required:!0,disabled:l}),a.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:"This will be used as: git config --global user.name"})]}),a.jsxs("div",{children:[a.jsxs("label",{htmlFor:"gitEmail",className:"flex items-center gap-2 text-sm font-medium text-foreground mb-2",children:[a.jsx(k6,{className:"w-4 h-4"}),"Git Email ",a.jsx("span",{className:"text-red-500",children:"*"})]}),a.jsx("input",{type:"email",id:"gitEmail",value:s,onChange:R=>o(R.target.value),className:"w-full px-4 py-3 border border-border rounded-lg bg-background text-foreground focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent",placeholder:"john@example.com",required:!0,disabled:l}),a.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:"This will be used as: git config --global user.email"})]})]})]});case 1:return a.jsxs("div",{className:"space-y-6",children:[a.jsxs("div",{className:"text-center mb-6",children:[a.jsx("h2",{className:"text-2xl font-bold text-foreground mb-2",children:"Connect Your AI Agents"}),a.jsx("p",{className:"text-muted-foreground",children:"Login to one or more AI coding assistants. All are optional."})]}),a.jsxs("div",{className:"space-y-3",children:[a.jsx("div",{className:`border rounded-lg p-4 transition-colors ${g.authenticated?"bg-blue-50 dark:bg-blue-900/20 border-blue-200 dark:border-blue-800":"border-border bg-card"}`,children:a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("div",{className:"w-10 h-10 bg-blue-100 dark:bg-blue-900/30 rounded-full flex items-center justify-center",children:a.jsx(nn,{size:20})}),a.jsxs("div",{children:[a.jsxs("div",{className:"font-medium text-foreground flex items-center gap-2",children:["Claude Code",g.authenticated&&a.jsx(Cr,{className:"w-4 h-4 text-green-500"})]}),a.jsx("div",{className:"text-xs text-muted-foreground",children:g.loading?"Checking...":g.authenticated?g.email||"Connected":"Not connected"})]})]}),!g.authenticated&&!g.loading&&a.jsx("button",{onClick:T,className:"bg-blue-600 hover:bg-blue-700 text-white text-sm font-medium py-2 px-4 rounded-lg transition-colors",children:"Login"})]})}),a.jsx("div",{className:`border rounded-lg p-4 transition-colors ${w.authenticated?"bg-purple-50 dark:bg-purple-900/20 border-purple-200 dark:border-purple-800":"border-border bg-card"}`,children:a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("div",{className:"w-10 h-10 bg-purple-100 dark:bg-purple-900/30 rounded-full flex items-center justify-center",children:a.jsx(pn,{size:20})}),a.jsxs("div",{children:[a.jsxs("div",{className:"font-medium text-foreground flex items-center gap-2",children:["Cursor",w.authenticated&&a.jsx(Cr,{className:"w-4 h-4 text-green-500"})]}),a.jsx("div",{className:"text-xs text-muted-foreground",children:w.loading?"Checking...":w.authenticated?w.email||"Connected":"Not connected"})]})]}),!w.authenticated&&!w.loading&&a.jsx("button",{onClick:P,className:"bg-purple-600 hover:bg-purple-700 text-white text-sm font-medium py-2 px-4 rounded-lg transition-colors",children:"Login"})]})}),a.jsx("div",{className:`border rounded-lg p-4 transition-colors ${k.authenticated?"bg-gray-100 dark:bg-gray-800/50 border-gray-300 dark:border-gray-600":"border-border bg-card"}`,children:a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("div",{className:"w-10 h-10 bg-gray-100 dark:bg-gray-800 rounded-full flex items-center justify-center",children:a.jsx(wn,{className:"w-5 h-5"})}),a.jsxs("div",{children:[a.jsxs("div",{className:"font-medium text-foreground flex items-center gap-2",children:["OpenAI Codex",k.authenticated&&a.jsx(Cr,{className:"w-4 h-4 text-green-500"})]}),a.jsx("div",{className:"text-xs text-muted-foreground",children:k.loading?"Checking...":k.authenticated?k.email||"Connected":"Not connected"})]})]}),!k.authenticated&&!k.loading&&a.jsx("button",{onClick:q,className:"bg-gray-800 hover:bg-gray-900 dark:bg-gray-700 dark:hover:bg-gray-600 text-white text-sm font-medium py-2 px-4 rounded-lg transition-colors",children:"Login"})]})})]}),a.jsx("div",{className:"text-center text-sm text-muted-foreground pt-2",children:a.jsx("p",{children:"You can configure these later in Settings."})})]});default:return null}},ue=()=>{switch(t){case 0:return n.trim()&&s.trim()&&/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(s);case 1:return!0;default:return!1}};return a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"min-h-screen bg-background flex items-center justify-center p-4",children:a.jsxs("div",{className:"w-full max-w-2xl",children:[a.jsx("div",{className:"mb-8",children:a.jsx("div",{className:"flex items-center justify-between",children:re.map((R,F)=>a.jsxs(ir.Fragment,{children:[a.jsxs("div",{className:"flex flex-col items-center flex-1",children:[a.jsx("div",{className:`w-12 h-12 rounded-full flex items-center justify-center border-2 transition-colors duration-200 ${F<t?"bg-green-500 border-green-500 text-white":F===t?"bg-blue-600 border-blue-600 text-white":"bg-background border-border text-muted-foreground"}`,children:F<t?a.jsx(Cr,{className:"w-6 h-6"}):typeof R.icon=="function"?a.jsx(R.icon,{}):a.jsx(R.icon,{className:"w-6 h-6"})}),a.jsxs("div",{className:"mt-2 text-center",children:[a.jsx("p",{className:`text-sm font-medium ${F===t?"text-foreground":"text-muted-foreground"}`,children:R.title}),R.required&&a.jsx("span",{className:"text-xs text-red-500",children:"Required"})]})]}),F<re.length-1&&a.jsx("div",{className:`flex-1 h-0.5 mx-2 transition-colors duration-200 ${F<t?"bg-green-500":"bg-border"}`})]},F))})}),a.jsxs("div",{className:"bg-card rounded-lg shadow-lg border border-border p-8",children:[K(),d&&a.jsx("div",{className:"mt-6 p-4 bg-red-100 dark:bg-red-900/20 border border-red-300 dark:border-red-800 rounded-lg",children:a.jsx("p",{className:"text-sm text-red-700 dark:text-red-400",children:d})}),a.jsxs("div",{className:"flex items-center justify-between mt-8 pt-6 border-t border-border",children:[a.jsxs("button",{onClick:U,disabled:t===0||l,className:"flex items-center gap-2 px-4 py-2 text-sm font-medium text-muted-foreground hover:text-foreground disabled:opacity-50 disabled:cursor-not-allowed transition-colors duration-200",children:[a.jsx(Mh,{className:"w-4 h-4"}),"Previous"]}),a.jsx("div",{className:"flex items-center gap-3",children:t<re.length-1?a.jsx("button",{onClick:z,disabled:!ue()||l,className:"flex items-center gap-2 px-6 py-3 bg-blue-600 hover:bg-blue-700 disabled:bg-blue-400 disabled:cursor-not-allowed text-white font-medium rounded-lg transition-colors duration-200",children:l?a.jsxs(a.Fragment,{children:[a.jsx(Ta,{className:"w-4 h-4 animate-spin"}),"Saving..."]}):a.jsxs(a.Fragment,{children:["Next",a.jsx(Cn,{className:"w-4 h-4"})]})}):a.jsx("button",{onClick:G,disabled:l,className:"flex items-center gap-2 px-6 py-3 bg-green-600 hover:bg-green-700 disabled:bg-green-400 disabled:cursor-not-allowed text-white font-medium rounded-lg transition-colors duration-200",children:l?a.jsxs(a.Fragment,{children:[a.jsx(Ta,{className:"w-4 h-4 animate-spin"}),"Completing..."]}):a.jsxs(a.Fragment,{children:[a.jsx(Cr,{className:"w-4 h-4"}),"Complete Setup"]})})})]})]})]})}),p&&a.jsx(c3,{isOpen:!!p,onClose:()=>h(null),provider:p,project:m,onComplete:D})]})},nH=()=>a.jsx("div",{className:"min-h-screen bg-background flex items-center justify-center p-4",children:a.jsxs("div",{className:"text-center",children:[a.jsx("div",{className:"flex justify-center mb-4",children:a.jsx("div",{className:"w-16 h-16 bg-primary rounded-lg flex items-center justify-center shadow-sm",children:a.jsx(Wi,{className:"w-8 h-8 text-primary-foreground"})})}),a.jsx("h1",{className:"text-2xl font-bold text-foreground mb-2",children:"Claude Code UI"}),a.jsxs("div",{className:"flex items-center justify-center space-x-2",children:[a.jsx("div",{className:"w-2 h-2 bg-blue-500 rounded-full animate-bounce"}),a.jsx("div",{className:"w-2 h-2 bg-blue-500 rounded-full animate-bounce",style:{animationDelay:"0.1s"}}),a.jsx("div",{className:"w-2 h-2 bg-blue-500 rounded-full animate-bounce",style:{animationDelay:"0.2s"}})]}),a.jsx("p",{className:"text-muted-foreground mt-2",children:"Loading..."})]})}),aH=({children:e})=>{const{user:t,isLoading:r,needsSetup:n,hasCompletedOnboarding:i,refreshOnboardingStatus:s}=is();return r?a.jsx(nH,{}):n?a.jsx(eH,{}):t?i?e:a.jsx(rH,{onComplete:s}):a.jsx(tH,{})};function Xa(e,t){const[r,n]=x.useState(()=>{if(typeof window>"u")return t;try{const s=window.localStorage.getItem(e);return s?JSON.parse(s):t}catch(s){return console.log(s),t}});return[r,s=>{if(!(typeof window>"u"))try{const o=s instanceof Function?s(r):s;window.localStorage.setItem(e,JSON.stringify(o)),n(o)}catch(o){console.log(o)}}]}const{slice:iH,forEach:sH}=[];function oH(e){return sH.call(iH.call(arguments,1),t=>{if(t)for(const r in t)e[r]===void 0&&(e[r]=t[r])}),e}function lH(e){return typeof e!="string"?!1:[/<\s*script.*?>/i,/<\s*\/\s*script\s*>/i,/<\s*img.*?on\w+\s*=/i,/<\s*\w+\s*on\w+\s*=.*?>/i,/javascript\s*:/i,/vbscript\s*:/i,/expression\s*\(/i,/eval\s*\(/i,/alert\s*\(/i,/document\.cookie/i,/document\.write\s*\(/i,/window\.location/i,/innerHTML/i].some(r=>r.test(e))}const Z2=/^[\u0009\u0020-\u007e\u0080-\u00ff]+$/,cH=function(e,t){const n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{path:"/"},i=encodeURIComponent(t);let s=`${e}=${i}`;if(n.maxAge>0){const o=n.maxAge-0;if(Number.isNaN(o))throw new Error("maxAge should be a Number");s+=`; Max-Age=${Math.floor(o)}`}if(n.domain){if(!Z2.test(n.domain))throw new TypeError("option domain is invalid");s+=`; Domain=${n.domain}`}if(n.path){if(!Z2.test(n.path))throw new TypeError("option path is invalid");s+=`; Path=${n.path}`}if(n.expires){if(typeof n.expires.toUTCString!="function")throw new TypeError("option expires is invalid");s+=`; Expires=${n.expires.toUTCString()}`}if(n.httpOnly&&(s+="; HttpOnly"),n.secure&&(s+="; Secure"),n.sameSite)switch(typeof n.sameSite=="string"?n.sameSite.toLowerCase():n.sameSite){case!0:s+="; SameSite=Strict";break;case"lax":s+="; SameSite=Lax";break;case"strict":s+="; SameSite=Strict";break;case"none":s+="; SameSite=None";break;default:throw new TypeError("option sameSite is invalid")}return n.partitioned&&(s+="; Partitioned"),s},J2={create(e,t,r,n){let i=arguments.length>4&&arguments[4]!==void 0?arguments[4]:{path:"/",sameSite:"strict"};r&&(i.expires=new Date,i.expires.setTime(i.expires.getTime()+r*60*1e3)),n&&(i.domain=n),document.cookie=cH(e,t,i)},read(e){const t=`${e}=`,r=document.cookie.split(";");for(let n=0;n<r.length;n++){let i=r[n];for(;i.charAt(0)===" ";)i=i.substring(1,i.length);if(i.indexOf(t)===0)return i.substring(t.length,i.length)}return null},remove(e,t){this.create(e,"",-1,t)}};var dH={name:"cookie",lookup(e){let{lookupCookie:t}=e;if(t&&typeof document<"u")return J2.read(t)||void 0},cacheUserLanguage(e,t){let{lookupCookie:r,cookieMinutes:n,cookieDomain:i,cookieOptions:s}=t;r&&typeof document<"u"&&J2.create(r,e,n,i,s)}},uH={name:"querystring",lookup(e){let{lookupQuerystring:t}=e,r;if(typeof window<"u"){let{search:n}=window.location;!window.location.search&&window.location.hash?.indexOf("?")>-1&&(n=window.location.hash.substring(window.location.hash.indexOf("?")));const s=n.substring(1).split("&");for(let o=0;o<s.length;o++){const l=s[o].indexOf("=");l>0&&s[o].substring(0,l)===t&&(r=s[o].substring(l+1))}}return r}},pH={name:"hash",lookup(e){let{lookupHash:t,lookupFromHashIndex:r}=e,n;if(typeof window<"u"){const{hash:i}=window.location;if(i&&i.length>2){const s=i.substring(1);if(t){const o=s.split("&");for(let l=0;l<o.length;l++){const c=o[l].indexOf("=");c>0&&o[l].substring(0,c)===t&&(n=o[l].substring(c+1))}}if(n)return n;if(!n&&r>-1){const o=i.match(/\/([a-zA-Z-]*)/g);return Array.isArray(o)?o[typeof r=="number"?r:0]?.replace("/",""):void 0}}}return n}};let Za=null;const Q2=()=>{if(Za!==null)return Za;try{if(Za=typeof window<"u"&&window.localStorage!==null,!Za)return!1;const e="i18next.translate.boo";window.localStorage.setItem(e,"foo"),window.localStorage.removeItem(e)}catch{Za=!1}return Za};var mH={name:"localStorage",lookup(e){let{lookupLocalStorage:t}=e;if(t&&Q2())return window.localStorage.getItem(t)||void 0},cacheUserLanguage(e,t){let{lookupLocalStorage:r}=t;r&&Q2()&&window.localStorage.setItem(r,e)}};let Ja=null;const e4=()=>{if(Ja!==null)return Ja;try{if(Ja=typeof window<"u"&&window.sessionStorage!==null,!Ja)return!1;const e="i18next.translate.boo";window.sessionStorage.setItem(e,"foo"),window.sessionStorage.removeItem(e)}catch{Ja=!1}return Ja};var hH={name:"sessionStorage",lookup(e){let{lookupSessionStorage:t}=e;if(t&&e4())return window.sessionStorage.getItem(t)||void 0},cacheUserLanguage(e,t){let{lookupSessionStorage:r}=t;r&&e4()&&window.sessionStorage.setItem(r,e)}},gH={name:"navigator",lookup(e){const t=[];if(typeof navigator<"u"){const{languages:r,userLanguage:n,language:i}=navigator;if(r)for(let s=0;s<r.length;s++)t.push(r[s]);n&&t.push(n),i&&t.push(i)}return t.length>0?t:void 0}},fH={name:"htmlTag",lookup(e){let{htmlTag:t}=e,r;const n=t||(typeof document<"u"?document.documentElement:null);return n&&typeof n.getAttribute=="function"&&(r=n.getAttribute("lang")),r}},bH={name:"path",lookup(e){let{lookupFromPathIndex:t}=e;if(typeof window>"u")return;const r=window.location.pathname.match(/\/([a-zA-Z-]*)/g);return Array.isArray(r)?r[typeof t=="number"?t:0]?.replace("/",""):void 0}},xH={name:"subdomain",lookup(e){let{lookupFromSubdomainIndex:t}=e;const r=typeof t=="number"?t+1:1,n=typeof window<"u"&&window.location?.hostname?.match(/^(\w{2,5})\.(([a-z0-9-]{1,63}\.[a-z]{2,6})|localhost)/i);if(n)return n[r]}};let u3=!1;try{document.cookie,u3=!0}catch{}const p3=["querystring","cookie","localStorage","sessionStorage","navigator","htmlTag"];u3||p3.splice(1,1);const yH=()=>({order:p3,lookupQuerystring:"lng",lookupCookie:"i18next",lookupLocalStorage:"i18nextLng",lookupSessionStorage:"i18nextLng",caches:["localStorage"],excludeCacheFor:["cimode"],convertDetectedLanguage:e=>e});class m3{constructor(t){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.type="languageDetector",this.detectors={},this.init(t,r)}init(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{languageUtils:{}},r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};this.services=t,this.options=oH(r,this.options||{},yH()),typeof this.options.convertDetectedLanguage=="string"&&this.options.convertDetectedLanguage.indexOf("15897")>-1&&(this.options.convertDetectedLanguage=i=>i.replace("-","_")),this.options.lookupFromUrlIndex&&(this.options.lookupFromPathIndex=this.options.lookupFromUrlIndex),this.i18nOptions=n,this.addDetector(dH),this.addDetector(uH),this.addDetector(mH),this.addDetector(hH),this.addDetector(gH),this.addDetector(fH),this.addDetector(bH),this.addDetector(xH),this.addDetector(pH)}addDetector(t){return this.detectors[t.name]=t,this}detect(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:this.options.order,r=[];return t.forEach(n=>{if(this.detectors[n]){let i=this.detectors[n].lookup(this.options);i&&typeof i=="string"&&(i=[i]),i&&(r=r.concat(i))}}),r=r.filter(n=>n!=null&&!lH(n)).map(n=>this.options.convertDetectedLanguage(n)),this.services&&this.services.languageUtils&&this.services.languageUtils.getBestMatchFromCodes?r:r.length>0?r[0]:null}cacheUserLanguage(t){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.options.caches;r&&(this.options.excludeCacheFor&&this.options.excludeCacheFor.indexOf(t)>-1||r.forEach(n=>{this.detectors[n]&&this.detectors[n].cacheUserLanguage(t,this.options)}))}}m3.type="languageDetector";const vH={save:"Save",cancel:"Cancel",delete:"Delete",create:"Create",edit:"Edit",close:"Close",confirm:"Confirm",submit:"Submit",retry:"Retry",refresh:"Refresh",search:"Search",clear:"Clear",copy:"Copy",download:"Download",upload:"Upload",browse:"Browse"},kH={chat:"Chat",shell:"Shell",files:"Files",git:"Source Control",tasks:"Tasks"},wH={loading:"Loading...",success:"Success",error:"Error",failed:"Failed",pending:"Pending",completed:"Completed",inProgress:"In Progress"},SH={savedSuccessfully:"Saved successfully",deletedSuccessfully:"Deleted successfully",updatedSuccessfully:"Updated successfully",operationFailed:"Operation failed",networkError:"Network error. Please check your connection.",unauthorized:"Unauthorized. Please log in.",notFound:"Not found",invalidInput:"Invalid input",requiredField:"This field is required",unknownError:"An unknown error occurred"},EH={settings:"Settings",home:"Home",back:"Back",next:"Next",previous:"Previous",logout:"Logout"},NH={language:"Language",theme:"Theme",darkMode:"Dark Mode",lightMode:"Light Mode",name:"Name",description:"Description",enabled:"Enabled",disabled:"Disabled",optional:"Optional",version:"Version",select:"Select",selectAll:"Select All",deselectAll:"Deselect All"},CH={justNow:"Just now",minutesAgo:"{{count}} mins ago",hoursAgo:"{{count}} hours ago",daysAgo:"{{count}} days ago",yesterday:"Yesterday"},TH={newFile:"New File",newFolder:"New Folder",rename:"Rename",move:"Move",copyPath:"Copy Path",openInEditor:"Open in Editor"},AH={loading:"Loading Claude Code UI",settingUpWorkspace:"Setting up your workspace...",chooseProject:"Choose Your Project",selectProjectDescription:"Select a project from the sidebar to start coding with Claude. Each project contains your chat sessions and file history.",tip:"Tip",createProjectMobile:"Tap the menu button above to access projects",createProjectDesktop:"Create a new project by clicking the folder icon in the sidebar",newSession:"New Session",untitledSession:"Untitled Session",projectFiles:"Project Files"},IH={loading:"Loading files...",files:"Files",simpleView:"Simple view",compactView:"Compact view",detailedView:"Detailed view",searchPlaceholder:"Search files and folders...",clearSearch:"Clear search",name:"Name",size:"Size",modified:"Modified",permissions:"Permissions",noFilesFound:"No files found",checkProjectPath:"Check if the project path is accessible",noMatchesFound:"No matches found",tryDifferentSearch:"Try a different search term or clear the search",justNow:"just now",minAgo:"{{count}} min ago",hoursAgo:"{{count}} hours ago",daysAgo:"{{count}} days ago"},RH={title:"Create New Project",steps:{type:"Type",configure:"Configure",confirm:"Confirm"},step1:{question:"Do you already have a workspace, or would you like to create a new one?",existing:{title:"Existing Workspace",description:"I already have a workspace on my server and just need to add it to the project list"},new:{title:"New Workspace",description:"Create a new workspace, optionally clone from a GitHub repository"}},step2:{existingPath:"Workspace Path",newPath:"Workspace Path",existingPlaceholder:"/path/to/existing/workspace",newPlaceholder:"/path/to/new/workspace",existingHelp:"Full path to your existing workspace directory",newHelp:"Full path to your workspace directory",githubUrl:"GitHub URL (Optional)",githubPlaceholder:"https://github.com/username/repository",githubHelp:"Optional: provide a GitHub URL to clone a repository",githubAuth:"GitHub Authentication (Optional)",githubAuthHelp:"Only required for private repositories. Public repos can be cloned without authentication.",loadingTokens:"Loading stored tokens...",storedToken:"Stored Token",newToken:"New Token",nonePublic:"None (Public)",selectToken:"Select Token",selectTokenPlaceholder:"-- Select a token --",tokenPlaceholder:"ghp_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",tokenHelp:"This token will be used only for this operation",publicRepoInfo:"Public repositories don't require authentication. You can skip providing a token if cloning a public repo.",noTokensHelp:"No stored tokens available. You can add tokens in Settings → API Keys for easier reuse.",optionalTokenPublic:"GitHub Token (Optional for Public Repos)",tokenPublicPlaceholder:"ghp_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx (leave empty for public repos)"},step3:{reviewConfig:"Review Your Configuration",workspaceType:"Workspace Type:",existingWorkspace:"Existing Workspace",newWorkspace:"New Workspace",path:"Path:",cloneFrom:"Clone From:",authentication:"Authentication:",usingStoredToken:"Using stored token:",usingProvidedToken:"Using provided token",noAuthentication:"No authentication",sshKey:"SSH Key",existingInfo:"The workspace will be added to your project list and will be available for Claude/Cursor sessions.",newWithClone:"The repository will be cloned from this folder.",newEmpty:"The workspace will be added to your project list and will be available for Claude/Cursor sessions.",cloningRepository:"Cloning repository..."},buttons:{cancel:"Cancel",back:"Back",next:"Next",createProject:"Create Project",creating:"Creating...",cloning:"Cloning..."},errors:{selectType:"Please select whether you have an existing workspace or want to create a new one",providePath:"Please provide a workspace path",failedToCreate:"Failed to create workspace",failedToCreateFolder:"Failed to create folder"}},jH={title:"Update Available",newVersionReady:"A new version is ready",currentVersion:"Current Version",latestVersion:"Latest Version",whatsNew:"What's New:",viewFullRelease:"View full release",updateProgress:"Update Progress:",manualUpgrade:"Manual upgrade:",manualUpgradeHint:'Or click "Update Now" to run the update automatically.',updateCompleted:"Update completed successfully!",restartServer:"Please restart the server to apply changes.",updateFailed:"Update failed",buttons:{close:"Close",later:"Later",copyCommand:"Copy Command",updateNow:"Update Now",updating:"Updating..."},ariaLabels:{closeModal:"Close version upgrade modal",showSidebar:"Show sidebar",settings:"Settings",updateAvailable:"Update available",closeSidebar:"Close sidebar"}},_H={buttons:vH,tabs:kH,status:wH,messages:SH,navigation:EH,common:NH,time:CH,fileOperations:TH,mainContent:AH,fileTree:IH,projectWizard:RH,versionUpdate:jH},LH="Settings",OH={account:"Account",permissions:"Permissions",mcpServers:"MCP Servers",appearance:"Appearance"},DH={title:"Account",language:"Language",languageLabel:"Display Language",languageDescription:"Choose your preferred language for the interface",username:"Username",email:"Email",profile:"Profile",changePassword:"Change Password"},MH={title:"MCP Servers",addServer:"Add Server",editServer:"Edit Server",deleteServer:"Delete Server",serverName:"Server Name",serverType:"Server Type",config:"Configuration",testConnection:"Test Connection",status:"Status",connected:"Connected",disconnected:"Disconnected",scope:{label:"Scope",user:"User",project:"Project"}},FH={title:"Appearance",theme:"Theme",codeEditor:"Code Editor",editorTheme:"Editor Theme",wordWrap:"Word Wrap",showMinimap:"Show Minimap",lineNumbers:"Line Numbers",fontSize:"Font Size"},PH={saveChanges:"Save Changes",resetToDefaults:"Reset to Defaults",cancelChanges:"Cancel Changes"},BH={title:"Quick Settings",sections:{appearance:"Appearance",toolDisplay:"Tool Display",viewOptions:"View Options",inputSettings:"Input Settings",whisperDictation:"Whisper Dictation"},darkMode:"Dark Mode",autoExpandTools:"Auto-expand tools",showRawParameters:"Show raw parameters",showThinking:"Show thinking",autoScrollToBottom:"Auto-scroll to bottom",sendByCtrlEnter:"Send by Ctrl+Enter",sendByCtrlEnterDescription:"When enabled, pressing Ctrl+Enter will send the message instead of just Enter. This is useful for IME users to avoid accidental sends.",dragHandle:{dragging:"Dragging handle",closePanel:"Close settings panel",openPanel:"Open settings panel",draggingStatus:"Dragging...",toggleAndMove:"Click to toggle, drag to move"},whisper:{modes:{default:"Default Mode",defaultDescription:"Direct transcription of your speech",prompt:"Prompt Enhancement",promptDescription:"Transform rough ideas into clear, detailed AI prompts",vibe:"Vibe Mode",vibeDescription:"Format ideas as clear agent instructions with details"}}},zH={agents:"Agents",appearance:"Appearance",git:"Git",apiTokens:"API & Tokens",tasks:"Tasks"},UH={darkMode:{label:"Dark Mode",description:"Toggle between light and dark themes"},projectSorting:{label:"Project Sorting",description:"How projects are ordered in the sidebar",alphabetical:"Alphabetical",recentActivity:"Recent Activity"},codeEditor:{title:"Code Editor",theme:{label:"Editor Theme",description:"Default theme for the code editor"},wordWrap:{label:"Word Wrap",description:"Enable word wrapping by default in the editor"},showMinimap:{label:"Show Minimap",description:"Display a minimap for easier navigation in diff view"},lineNumbers:{label:"Show Line Numbers",description:"Display line numbers in the editor"},fontSize:{label:"Font Size",description:"Editor font size in pixels"}}},$H={title:{add:"Add MCP Server",edit:"Edit MCP Server"},importMode:{form:"Form Input",json:"JSON Import"},scope:{label:"Scope",userGlobal:"User (Global)",projectLocal:"Project (Local)",userDescription:"User scope: Available across all projects on your machine",projectDescription:"Local scope: Only available in the selected project",cannotChange:"Scope cannot be changed when editing an existing server"},fields:{serverName:"Server Name",transportType:"Transport Type",command:"Command",arguments:"Arguments (one per line)",jsonConfig:"JSON Configuration",url:"URL",envVars:"Environment Variables (KEY=value, one per line)",headers:"Headers (KEY=value, one per line)",selectProject:"Select a project..."},placeholders:{serverName:"my-server"},validation:{missingType:"Missing required field: type",stdioRequiresCommand:"stdio type requires a command field",httpRequiresUrl:"{{type}} type requires a url field",invalidJson:"Invalid JSON format",jsonHelp:"Paste your MCP server configuration in JSON format. Example formats:",jsonExampleStdio:'• stdio: {"type":"stdio","command":"npx","args":["@upstash/context7-mcp"]}',jsonExampleHttp:'• http/sse: {"type":"http","url":"https://api.example.com/mcp"}'},configDetails:"Configuration Details (from {{configFile}})",projectPath:"Path: {{path}}",actions:{cancel:"Cancel",saving:"Saving...",addServer:"Add Server",updateServer:"Update Server"}},qH={success:"Settings saved successfully!",error:"Failed to save settings",saving:"Saving..."},GH={save:"Save Settings",cancel:"Cancel"},HH={title:"Git Configuration",description:"Configure your git identity for commits. These settings will be applied globally via git config --global",name:{label:"Git Name",help:"Your name for git commits"},email:{label:"Git Email",help:"Your email for git commits"},actions:{save:"Save Configuration",saving:"Saving..."},status:{success:"Saved successfully"}},WH={title:"API Keys",description:"Generate API keys to access the external API from other applications.",newKey:{alertTitle:"⚠️ Save Your API Key",alertMessage:"This is the only time you'll see this key. Store it securely.",iveSavedIt:"I've saved it"},form:{placeholder:"API Key Name (e.g., Production Server)",createButton:"Create",cancelButton:"Cancel"},newButton:"New API Key",empty:"No API keys created yet.",list:{created:"Created:",lastUsed:"Last used:"},confirmDelete:"Are you sure you want to delete this API key?",status:{active:"Active",inactive:"Inactive"},github:{title:"GitHub Tokens",description:"Add GitHub Personal Access Tokens to clone private repositories via the external API.",descriptionAlt:"Add GitHub Personal Access Tokens to clone private repositories. You can also pass tokens directly in API requests without storing them.",addButton:"Add Token",form:{namePlaceholder:"Token Name (e.g., Personal Repos)",tokenPlaceholder:"GitHub Personal Access Token (ghp_...)",descriptionPlaceholder:"Description (optional)",addButton:"Add Token",cancelButton:"Cancel",howToCreate:"How to create a GitHub Personal Access Token →"},empty:"No GitHub tokens added yet.",added:"Added:",confirmDelete:"Are you sure you want to delete this GitHub token?"},apiDocsLink:"API Documentation",documentation:{title:"External API Documentation",description:"Learn how to use the external API to trigger Claude/Cursor sessions from your applications.",viewLink:"View API Documentation →"},loading:"Loading...",version:{updateAvailable:"Update available: v{{version}}"}},VH={checking:"Checking TaskMaster installation...",notInstalled:{title:"TaskMaster AI CLI Not Installed",description:"TaskMaster CLI is required to use task management features. Install it to get started:",installCommand:"npm install -g task-master-ai",viewOnGitHub:"View on GitHub",afterInstallation:"After installation:",steps:{restart:"Restart this application",autoAvailable:"TaskMaster features will automatically become available",initCommand:"Use task-master init in your project directory"}},settings:{enableLabel:"Enable TaskMaster Integration",enableDescription:"Show TaskMaster tasks, banners, and sidebar indicators across the interface"}},KH={authStatus:{checking:"Checking...",connected:"Connected",notConnected:"Not connected",disconnected:"Disconnected",checkingAuth:"Checking authentication status...",loggedInAs:"Logged in as {{email}}",authenticatedUser:"authenticated user"},account:{claude:{description:"Anthropic Claude AI assistant"},cursor:{description:"Cursor AI-powered code editor"},codex:{description:"OpenAI Codex AI assistant"}},connectionStatus:"Connection Status",login:{title:"Login",reAuthenticate:"Re-authenticate",description:"Sign in to your {{agent}} account to enable AI features",reAuthDescription:"Sign in with a different account or refresh credentials",button:"Login",reLoginButton:"Re-login"},error:"Error: {{error}}"},YH={title:"Permission Settings",skipPermissions:{label:"Skip permission prompts (use with caution)",claudeDescription:"Equivalent to --dangerously-skip-permissions flag",cursorDescription:"Equivalent to -f flag in Cursor CLI"},allowedTools:{title:"Allowed Tools",description:"Tools that are automatically allowed without prompting for permission",placeholder:'e.g., "Bash(git log:*)" or "Write"',quickAdd:"Quick add common tools:",empty:"No allowed tools configured"},blockedTools:{title:"Blocked Tools",description:"Tools that are automatically blocked without prompting for permission",placeholder:'e.g., "Bash(rm:*)"',empty:"No blocked tools configured"},allowedCommands:{title:"Allowed Shell Commands",description:"Shell commands that are automatically allowed without prompting",placeholder:'e.g., "Shell(ls)" or "Shell(git status)"',quickAdd:"Quick add common commands:",empty:"No allowed commands configured"},blockedCommands:{title:"Blocked Shell Commands",description:"Shell commands that are automatically blocked",placeholder:'e.g., "Shell(rm -rf)" or "Shell(sudo)"',empty:"No blocked commands configured"},toolExamples:{title:"Tool Pattern Examples:",bashGitLog:"- Allow all git log commands",bashGitDiff:"- Allow all git diff commands",write:"- Allow all Write tool usage",bashRm:"- Block all rm commands (dangerous)"},shellExamples:{title:"Shell Command Examples:",ls:"- Allow ls command",gitStatus:"- Allow git status",npmInstall:"- Allow npm install",rmRf:"- Block recursive delete"},codex:{permissionMode:"Permission Mode",description:"Controls how Codex handles file modifications and command execution",modes:{default:{title:"Default",description:"Only trusted commands (ls, cat, grep, git status, etc.) run automatically. Other commands are skipped. Can write to workspace."},acceptEdits:{title:"Accept Edits",description:"All commands run automatically within the workspace. Full auto mode with sandboxed execution."},bypassPermissions:{title:"Bypass Permissions",description:"Full system access with no restrictions. All commands run automatically with full disk and network access. Use with caution."}},technicalDetails:"Technical details",technicalInfo:{default:"sandboxMode=workspace-write, approvalPolicy=untrusted. Trusted commands: cat, cd, grep, head, ls, pwd, tail, git status/log/diff/show, find (without -exec), etc.",acceptEdits:"sandboxMode=workspace-write, approvalPolicy=never. All commands auto-execute within project directory.",bypassPermissions:"sandboxMode=danger-full-access, approvalPolicy=never. Full system access, use only in trusted environments.",overrideNote:"You can override this per-session using the mode button in the chat interface."}},actions:{add:"Add"}},XH={title:"MCP Servers",description:{claude:"Model Context Protocol servers provide additional tools and data sources to Claude",cursor:"Model Context Protocol servers provide additional tools and data sources to Cursor",codex:"Model Context Protocol servers provide additional tools and data sources to Codex"},addButton:"Add MCP Server",empty:"No MCP servers configured",serverType:"Type",scope:{local:"local",user:"user"},config:{command:"Command",url:"URL",args:"Args",environment:"Environment"},tools:{title:"Tools",count:"({{count}}):",more:"+{{count}} more"},actions:{edit:"Edit server",delete:"Delete server"},help:{title:"About Codex MCP",description:"Codex supports stdio-based MCP servers. You can add servers that extend Codex's capabilities with additional tools and resources."}},ZH={title:LH,tabs:OH,account:DH,mcp:MH,appearance:FH,actions:PH,quickSettings:BH,mainTabs:zH,appearanceSettings:UH,mcpForm:$H,saveStatus:qH,footerActions:GH,git:HH,apiKeys:WH,tasks:VH,agents:KH,permissions:YH,mcpServers:XH},JH={title:"Welcome Back",description:"Sign in to your Claude Code UI account",username:"Username",password:"Password",submit:"Sign In",loading:"Signing in...",errors:{invalidCredentials:"Invalid username or password",requiredFields:"Please fill in all fields",networkError:"Network error. Please try again."},placeholders:{username:"Enter your username",password:"Enter your password"}},QH={title:"Create Account",username:"Username",password:"Password",confirmPassword:"Confirm Password",submit:"Create Account",loading:"Creating account...",errors:{passwordMismatch:"Passwords do not match",usernameTaken:"Username is already taken",weakPassword:"Password is too weak"}},eW={title:"Sign Out",confirm:"Are you sure you want to sign out?",button:"Sign Out"},tW={login:JH,register:QH,logout:eW},rW={title:"Projects",newProject:"New Project",deleteProject:"Delete Project",renameProject:"Rename Project",noProjects:"No projects found",loadingProjects:"Loading projects...",searchPlaceholder:"Search projects...",projectNamePlaceholder:"Project name",starred:"Starred",all:"All",untitledSession:"Untitled Session",newSession:"New Session",codexSession:"Codex Session",fetchingProjects:"Fetching your Claude projects and sessions",projects:"projects",noMatchingProjects:"No matching projects",tryDifferentSearch:"Try adjusting your search term",runClaudeCli:"Run Claude CLI in a project directory to get started"},nW={title:"Claude Code UI",subtitle:"AI coding assistant interface"},aW={title:"Sessions",newSession:"New Session",deleteSession:"Delete Session",renameSession:"Rename Session",noSessions:"No sessions yet",loadingSessions:"Loading sessions...",unnamed:"Unnamed",loading:"Loading...",showMore:"Show more sessions"},iW={viewEnvironments:"View Environments",hideSidebar:"Hide sidebar",createProject:"Create new project",refresh:"Refresh projects and sessions (Ctrl+R)",renameProject:"Rename project (F2)",deleteProject:"Delete empty project (Delete)",addToFavorites:"Add to favorites",removeFromFavorites:"Remove from favorites",editSessionName:"Manually edit session name",deleteSession:"Delete this session permanently",save:"Save",cancel:"Cancel"},sW={chat:"Chat",files:"Files",git:"Git",terminal:"Terminal",tasks:"Tasks"},oW={refresh:"Refresh",settings:"Settings",collapseAll:"Collapse All",expandAll:"Expand All",cancel:"Cancel",save:"Save",delete:"Delete",rename:"Rename"},lW={active:"Active",inactive:"Inactive",thinking:"Thinking...",error:"Error",aborted:"Aborted",unknown:"Unknown"},cW={justNow:"Just now",oneMinuteAgo:"1 min ago",minutesAgo:"{{count}} mins ago",oneHourAgo:"1 hour ago",hoursAgo:"{{count}} hours ago",oneDayAgo:"1 day ago",daysAgo:"{{count}} days ago"},dW={deleteConfirm:"Are you sure you want to delete this?",renameSuccess:"Renamed successfully",deleteSuccess:"Deleted successfully",errorOccurred:"An error occurred",deleteSessionConfirm:"Are you sure you want to delete this session? This action cannot be undone.",deleteProjectConfirm:"Are you sure you want to delete this empty project? This action cannot be undone.",enterProjectPath:"Please enter a project path",deleteSessionFailed:"Failed to delete session. Please try again.",deleteSessionError:"Error deleting session. Please try again.",deleteProjectFailed:"Failed to delete project. Please try again.",deleteProjectError:"Error deleting project. Please try again.",createProjectFailed:"Failed to create project. Please try again.",createProjectError:"Error creating project. Please try again."},uW={updateAvailable:"Update available"},pW={deleteProject:"Delete Project",deleteSession:"Delete Session",confirmDelete:"Are you sure you want to delete",sessionCount_one:"This project contains {{count}} conversation.",sessionCount_other:"This project contains {{count}} conversations.",allConversationsDeleted:"All conversations will be permanently deleted.",cannotUndo:"This action cannot be undone."},mW={projects:rW,app:nW,sessions:aW,tooltips:iW,navigation:sW,actions:oW,status:lW,time:cW,messages:dW,version:uW,deleteConfirmation:pW},hW={copy:"Copy",copied:"Copied",copyCode:"Copy code"},gW={user:"U",error:"Error",tool:"Tool",claude:"Claude",cursor:"Cursor",codex:"Codex"},fW={settings:"Tool Settings",error:"Tool Error",result:"Tool Result",viewParams:"View input parameters",viewRawParams:"View raw parameters",viewDiff:"View edit diff for",creatingFile:"Creating new file:",updatingTodo:"Updating Todo List",read:"Read",readFile:"Read file",updateTodo:"Update todo list",readTodo:"Read todo list",searchResults:"results"},bW={found:"Found {{count}} {{type}}",file:"file",files:"files",pattern:"pattern:",in:"in:"},xW={updated:"File updated successfully",created:"File created successfully",written:"File written successfully",diff:"Diff",newFile:"New File",viewContent:"View file content",viewFullOutput:"View full output ({{count}} chars)",contentDisplayed:"The file content is displayed in the diff view above"},yW={title:"Interactive Prompt",waiting:"Waiting for your response in the CLI",instruction:"Please select an option in your terminal where Claude is running.",selectedOption:"✓ Claude selected option {{number}}",instructionDetail:"In the CLI, you would select this option interactively using arrow keys or by typing the number."},vW={title:"Thinking...",emoji:"💭 Thinking..."},kW={response:"JSON Response"},wW={grant:"Grant permission for {{tool}}",added:"Permission added",addTo:"Adds {{entry}} to Allowed Tools.",retry:"Permission saved. Retry the request to use the tool.",error:"Unable to update permissions. Please try again.",openSettings:"Open settings"},SW={updated:"Todo list has been updated successfully",current:"Current Todo List"},EW={viewPlan:"📋 View implementation plan",title:"Implementation Plan"},NW={resetAt:"Claude usage limit reached. Your limit will reset at **{{time}} {{timezone}}** - {{date}}"},CW={permissionMode:"Permission Mode",modes:{default:"Default Mode",acceptEdits:"Accept Edits",bypassPermissions:"Bypass Permissions",plan:"Plan Mode"},descriptions:{default:"Only trusted commands (ls, cat, grep, git status, etc.) run automatically. Other commands are skipped. Can write to workspace.",acceptEdits:"All commands run automatically within the workspace. Full auto mode with sandboxed execution.",bypassPermissions:"Full system access with no restrictions. All commands run automatically with full disk and network access. Use with caution.",plan:"Planning mode - no commands are executed"},technicalDetails:"Technical details"},TW={placeholder:"Type / for commands, @ for files, or ask {{provider}} anything...",placeholderDefault:"Type your message...",disabled:"Input disabled",attachFiles:"Attach files",attachImages:"Attach images",send:"Send",stop:"Stop",hintText:{ctrlEnter:"Ctrl+Enter to send • Shift+Enter for new line • Tab to change modes • / for slash commands",enter:"Enter to send • Shift+Enter for new line • Tab to change modes • / for slash commands"},clickToChangeMode:"Click to change permission mode (or press Tab in input)",showAllCommands:"Show all commands"},AW={selector:{title:"Thinking Mode",description:"Extended thinking gives Claude more time to evaluate alternatives",active:"Active",tip:"Higher thinking modes take more time but provide more thorough analysis"},modes:{none:{name:"Standard",description:"Regular Claude response",prefix:""},think:{name:"Think",description:"Basic extended thinking",prefix:"think"},thinkHard:{name:"Think Hard",description:"More thorough evaluation",prefix:"think hard"},thinkHarder:{name:"Think Harder",description:"Deep analysis with alternatives",prefix:"think harder"},ultrathink:{name:"Ultrathink",description:"Maximum thinking budget",prefix:"ultrathink"}},buttonTitle:"Thinking mode: {{mode}}"},IW={title:"Choose Your AI Assistant",description:"Select a provider to start a new conversation",selectModel:"Select Model",providerInfo:{anthropic:"by Anthropic",openai:"by OpenAI",cursorEditor:"AI Code Editor"},readyPrompt:{claude:"Ready to use Claude with {{model}}. Start typing your message below.",cursor:"Ready to use Cursor with {{model}}. Start typing your message below.",codex:"Ready to use Codex with {{model}}. Start typing your message below.",default:"Select a provider above to begin"}},RW={continue:{title:"Continue your conversation",description:"Ask questions about your code, request changes, or get help with development tasks"},loading:{olderMessages:"Loading older messages...",sessionMessages:"Loading session messages..."},messages:{showingOf:"Showing {{shown}} of {{total}} messages",scrollToLoad:"Scroll up to load more",showingLast:"Showing last {{count}} messages ({{total}} total)",loadEarlier:"Load earlier messages"}},jW={selectProject:{title:"Select a Project",description:"Choose a project to open an interactive shell in that directory"},status:{newSession:"New Session",initializing:"Initializing...",restarting:"Restarting..."},actions:{disconnect:"Disconnect",disconnectTitle:"Disconnect from shell",restart:"Restart",restartTitle:"Restart Shell (disconnect first)",connect:"Continue in Shell",connectTitle:"Connect to shell"},loading:"Loading terminal...",connecting:"Connecting to shell...",startSession:"Start a new Claude session",resumeSession:"Resume session: {{displayName}}...",runCommand:"Run {{command}} in {{projectName}}",startCli:"Starting Claude CLI in {{projectName}}",defaultCommand:"command"},_W={codeBlock:hW,messageTypes:gW,tools:fW,search:bW,fileOperations:xW,interactive:yW,thinking:vW,json:kW,permissions:wW,todo:SW,plan:EW,usageLimit:NW,codex:CW,input:TW,thinkingMode:AW,providerSelection:IW,session:RW,shell:jW},LW={changes:"changes",previousChange:"Previous change",nextChange:"Next change",hideDiff:"Hide diff highlighting",showDiff:"Show diff highlighting",settings:"Editor Settings",collapse:"Collapse editor",expand:"Expand editor to full width"},OW="Loading {{fileName}}...",DW={showingChanges:"Showing changes"},MW={download:"Download file",save:"Save",saving:"Saving...",saved:"Saved!",exitFullscreen:"Exit fullscreen",fullscreen:"Fullscreen",close:"Close"},FW={lines:"Lines:",characters:"Characters:",shortcuts:"Press Ctrl+S to save • Esc to close"},PW={toolbar:LW,loading:OW,header:DW,actions:MW,footer:FW},BW={save:"保存",cancel:"取消",delete:"删除",create:"创建",edit:"编辑",close:"关闭",confirm:"确认",submit:"提交",retry:"重试",refresh:"刷新",search:"搜索",clear:"清除",copy:"复制",download:"下载",upload:"上传",browse:"浏览"},zW={chat:"聊天",shell:"终端",files:"文件",git:"源代码管理",tasks:"任务"},UW={loading:"加载中...",success:"成功",error:"错误",failed:"失败",pending:"待处理",completed:"已完成",inProgress:"进行中"},$W={savedSuccessfully:"保存成功",deletedSuccessfully:"删除成功",updatedSuccessfully:"更新成功",operationFailed:"操作失败",networkError:"网络错误,请检查您的连接。",unauthorized:"未授权,请登录。",notFound:"未找到",invalidInput:"输入无效",requiredField:"此字段为必填项",unknownError:"发生未知错误"},qW={settings:"设置",home:"首页",back:"返回",next:"下一步",previous:"上一步",logout:"退出登录"},GW={language:"语言",theme:"主题",darkMode:"深色模式",lightMode:"浅色模式",name:"名称",description:"描述",enabled:"已启用",disabled:"已禁用",optional:"可选",version:"版本",select:"选择",selectAll:"全选",deselectAll:"取消全选"},HW={justNow:"刚刚",minutesAgo:"{{count}} 分钟前",hoursAgo:"{{count}} 小时前",daysAgo:"{{count}} 天前",yesterday:"昨天"},WW={newFile:"新建文件",newFolder:"新建文件夹",rename:"重命名",move:"移动",copyPath:"复制路径",openInEditor:"在编辑器中打开"},VW={loading:"正在加载 Claude Code UI",settingUpWorkspace:"正在设置您的工作空间...",chooseProject:"选择您的项目",selectProjectDescription:"从侧边栏选择一个项目以开始使用 Claude 进行编程。每个项目包含您的聊天会话和文件历史。",tip:"提示",createProjectMobile:"点击上方的菜单按钮以访问项目",createProjectDesktop:"点击侧边栏中的文件夹图标以创建新项目",newSession:"新会话",untitledSession:"未命名会话",projectFiles:"项目文件"},KW={loading:"正在加载文件...",files:"文件",simpleView:"简单视图",compactView:"紧凑视图",detailedView:"详细视图",searchPlaceholder:"搜索文件和文件夹...",clearSearch:"清除搜索",name:"名称",size:"大小",modified:"修改时间",permissions:"权限",noFilesFound:"未找到文件",checkProjectPath:"检查项目路径是否可访问",noMatchesFound:"未找到匹配项",tryDifferentSearch:"尝试不同的搜索词或清除搜索",justNow:"刚刚",minAgo:"{{count}} 分钟前",hoursAgo:"{{count}} 小时前",daysAgo:"{{count}} 天前"},YW={title:"创建新项目",steps:{type:"类型",configure:"配置",confirm:"确认"},step1:{question:"您已经有工作区,还是想创建一个新的工作区?",existing:{title:"现有工作区",description:"我的服务器上已经有工作区,只需要将其添加到项目列表中"},new:{title:"新建工作区",description:"创建一个新工作区,可选择从 GitHub 仓库克隆"}},step2:{existingPath:"工作区路径",newPath:"工作区路径",existingPlaceholder:"/path/to/existing/workspace",newPlaceholder:"/path/to/new/workspace",existingHelp:"您现有工作区目录的完整路径",newHelp:"工作区目录的完整路径",githubUrl:"GitHub URL(可选)",githubPlaceholder:"https://github.com/username/repository",githubHelp:"可选:提供 GitHub URL 以克隆仓库",githubAuth:"GitHub 身份验证(可选)",githubAuthHelp:"仅私有仓库需要。公共仓库无需身份验证即可克隆。",loadingTokens:"正在加载已保存的令牌...",storedToken:"已保存的令牌",newToken:"新令牌",nonePublic:"无(公共)",selectToken:"选择令牌",selectTokenPlaceholder:"-- 选择令牌 --",tokenPlaceholder:"ghp_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",tokenHelp:"此令牌仅用于此操作",publicRepoInfo:"公共仓库不需要身份验证。如果克隆公共仓库,可以跳过提供令牌。",noTokensHelp:"没有可用的已保存令牌。您可以在 设置 → API 密钥 中添加令牌以便重复使用。",optionalTokenPublic:"GitHub 令牌(公共仓库可选)",tokenPublicPlaceholder:"ghp_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx(公共仓库可留空)"},step3:{reviewConfig:"查看您的配置",workspaceType:"工作区类型:",existingWorkspace:"现有工作区",newWorkspace:"新建工作区",path:"路径:",cloneFrom:"克隆自:",authentication:"身份验证:",usingStoredToken:"使用已保存的令牌:",usingProvidedToken:"使用提供的令牌",noAuthentication:"无身份验证",sshKey:"SSH 密钥",existingInfo:"工作区将被添加到您的项目列表中,并可用于 Claude/Cursor 会话。",newWithClone:"仓库将从此文件夹克隆。",newEmpty:"工作区将被添加到您的项目列表中,并可用于 Claude/Cursor 会话。",cloningRepository:"正在克隆仓库..."},buttons:{cancel:"取消",back:"返回",next:"下一步",createProject:"创建项目",creating:"创建中...",cloning:"正在克隆..."},errors:{selectType:"请选择您已有现有工作区还是想创建新工作区",providePath:"请提供工作区路径",failedToCreate:"创建工作区失败",failedToCreateFolder:"创建文件夹失败"}},XW={title:"有可用更新",newVersionReady:"新版本已准备就绪",currentVersion:"当前版本",latestVersion:"最新版本",whatsNew:"新内容:",viewFullRelease:"查看完整发布",updateProgress:"更新进度:",manualUpgrade:"手动升级:",manualUpgradeHint:"或点击'立即更新'以自动运行更新。",updateCompleted:"更新成功完成!",restartServer:"请重启服务器以应用更改。",updateFailed:"更新失败",buttons:{close:"关闭",later:"稍后",copyCommand:"复制命令",updateNow:"立即更新",updating:"更新中..."},ariaLabels:{closeModal:"关闭版本升级模态框",showSidebar:"显示侧边栏",settings:"设置",updateAvailable:"有可用更新",closeSidebar:"关闭侧边栏"}},ZW={buttons:BW,tabs:zW,status:UW,messages:$W,navigation:qW,common:GW,time:HW,fileOperations:WW,mainContent:VW,fileTree:KW,projectWizard:YW,versionUpdate:XW},JW="设置",QW={account:"账户",permissions:"权限",mcpServers:"MCP 服务器",appearance:"外观"},eV={title:"账户",language:"语言",languageLabel:"显示语言",languageDescription:"选择您偏好的界面语言",username:"用户名",email:"邮箱",profile:"个人资料",changePassword:"修改密码"},tV={title:"MCP 服务器",addServer:"添加服务器",editServer:"编辑服务器",deleteServer:"删除服务器",serverName:"服务器名称",serverType:"服务器类型",config:"配置",testConnection:"测试连接",status:"状态",connected:"已连接",disconnected:"未连接",scope:{label:"范围",user:"用户",project:"项目"}},rV={title:"外观",theme:"主题",codeEditor:"代码编辑器",editorTheme:"编辑器主题",wordWrap:"自动换行",showMinimap:"显示缩略图",lineNumbers:"行号",fontSize:"字体大小"},nV={saveChanges:"保存更改",resetToDefaults:"重置为默认值",cancelChanges:"取消更改"},aV={title:"快速设置",sections:{appearance:"外观",toolDisplay:"工具显示",viewOptions:"视图选项",inputSettings:"输入设置",whisperDictation:"Whisper 听写"},darkMode:"深色模式",autoExpandTools:"自动展开工具",showRawParameters:"显示原始参数",showThinking:"显示思考过程",autoScrollToBottom:"自动滚动到底部",sendByCtrlEnter:"使用 Ctrl+Enter 发送",sendByCtrlEnterDescription:"启用后,按 Ctrl+Enter 发送消息,而不是仅按 Enter。这对于使用输入法的用户可以避免意外发送。",dragHandle:{dragging:"正在拖拽手柄",closePanel:"关闭设置面板",openPanel:"打开设置面板",draggingStatus:"正在拖拽...",toggleAndMove:"点击切换,拖拽移动"},whisper:{modes:{default:"默认模式",defaultDescription:"直接转录您的语音",prompt:"提示词增强",promptDescription:"将粗略的想法转化为清晰、详细的 AI 提示词",vibe:"Vibe 模式",vibeDescription:"将想法格式化为带有详细说明的清晰智能体指令"}}},iV={agents:"智能体",appearance:"外观",git:"Git",apiTokens:"API 和令牌",tasks:"任务"},sV={darkMode:{label:"深色模式",description:"切换浅色和深色主题"},projectSorting:{label:"项目排序",description:"项目在侧边栏中的排列方式",alphabetical:"按字母顺序",recentActivity:"最近活动"},codeEditor:{title:"代码编辑器",theme:{label:"编辑器主题",description:"代码编辑器的默认主题"},wordWrap:{label:"自动换行",description:"在编辑器中默认启用自动换行"},showMinimap:{label:"显示缩略图",description:"在差异视图中显示缩略图以便于导航"},lineNumbers:{label:"显示行号",description:"在编辑器中显示行号"},fontSize:{label:"字体大小",description:"编辑器字体大小(px)"}}},oV={title:{add:"添加 MCP 服务器",edit:"编辑 MCP 服务器"},importMode:{form:"表单输入",json:"JSON 导入"},scope:{label:"范围",userGlobal:"用户(全局)",projectLocal:"项目(本地)",userDescription:"用户范围:在您机器上的所有项目中可用",projectDescription:"本地范围:仅在选定项目中可用",cannotChange:"编辑现有服务器时无法更改范围"},fields:{serverName:"服务器名称",transportType:"传输类型",command:"命令",arguments:"参数(每行一个)",jsonConfig:"JSON 配置",url:"URL",envVars:"环境变量(KEY=值,每行一个)",headers:"请求头(KEY=值,每行一个)",selectProject:"选择项目..."},placeholders:{serverName:"我的服务"},validation:{missingType:"缺少必填字段:type",stdioRequiresCommand:"stdio 类型需要 command 字段",httpRequiresUrl:"{{type}} 类型需要 url 字段",invalidJson:"无效的 JSON 格式",jsonHelp:"粘贴您的 MCP 服务器配置(JSON 格式)。示例格式:",jsonExampleStdio:'• stdio: {"type":"stdio","command":"npx","args":["@upstash/context7-mcp"]}',jsonExampleHttp:'• http/sse: {"type":"http","url":"https://api.example.com/mcp"}'},configDetails:"配置详细信息(来自 {{configFile}})",projectPath:"路径:{{path}}",actions:{cancel:"取消",saving:"保存中...",addServer:"添加服务器",updateServer:"更新服务器"}},lV={success:"设置保存成功!",error:"保存设置失败",saving:"保存中..."},cV={save:"保存设置",cancel:"取消"},dV={title:"Git 配置",description:"配置您的 git 提交身份。这些设置将通过 git config --global 全局应用",name:{label:"Git 名称",help:"您的 git 提交名称"},email:{label:"Git 邮箱",help:"您的 git 提交邮箱"},actions:{save:"保存配置",saving:"保存中..."},status:{success:"保存成功"}},uV={title:"API 密钥",description:"生成 API 密钥以从其他应用访问外部 API。",newKey:{alertTitle:"⚠️ 保存您的 API 密钥",alertMessage:"这是您唯一一次看到此密钥。请妥善保存。",iveSavedIt:"我已保存"},form:{placeholder:"API 密钥名称(例如:生产服务器)",createButton:"创建",cancelButton:"取消"},newButton:"新建 API 密钥",empty:"尚未创建 API 密钥。",list:{created:"创建时间:",lastUsed:"最后使用:"},confirmDelete:"确定要删除此 API 密钥吗?",status:{active:"激活",inactive:"未激活"},github:{title:"GitHub 令牌",description:"添加 GitHub 个人访问令牌以通过外部 API 克隆私有仓库。",descriptionAlt:"添加 GitHub 个人访问令牌以克隆私有仓库。您也可以直接在 API 请求中传递令牌而无需存储。",addButton:"添加令牌",form:{namePlaceholder:"令牌名称(例如:个人仓库)",tokenPlaceholder:"GitHub 个人访问令牌(ghp_...)",descriptionPlaceholder:"描述(可选)",addButton:"添加令牌",cancelButton:"取消",howToCreate:"如何创建 GitHub 个人访问令牌 →"},empty:"尚未添加 GitHub 令牌。",added:"添加时间:",confirmDelete:"确定要删除此 GitHub 令牌吗?"},apiDocsLink:"API 文档",documentation:{title:"外部 API 文档",description:"了解如何使用外部 API 从您的应用程序触发 Claude/Cursor 会话。",viewLink:"查看 API 文档 →"},loading:"加载中...",version:{updateAvailable:"有可用更新:v{{version}}"}},pV={checking:"正在检查 TaskMaster 安装...",notInstalled:{title:"未安装 TaskMaster AI CLI",description:"需要 TaskMaster CLI 才能使用任务管理功能。安装它以开始使用:",installCommand:"npm install -g task-master-ai",viewOnGitHub:"在 GitHub 上查看",afterInstallation:"安装后:",steps:{restart:"重启此应用程序",autoAvailable:"TaskMaster 功能将自动可用",initCommand:"在项目目录中使用 task-master init"}},settings:{enableLabel:"启用 TaskMaster 集成",enableDescription:"在整个界面中显示 TaskMaster 任务、横幅和侧边栏指示器"}},mV={authStatus:{checking:"检查中...",connected:"已连接",notConnected:"未连接",disconnected:"已断开",checkingAuth:"正在检查认证状态...",loggedInAs:"登录为 {{email}}",authenticatedUser:"已认证用户"},account:{claude:{description:"Anthropic Claude AI 助手"},cursor:{description:"Cursor AI 驱动的代码编辑器"},codex:{description:"OpenAI Codex AI 助手"}},connectionStatus:"连接状态",login:{title:"登录",reAuthenticate:"重新认证",description:"登录您的 {{agent}} 账户以启用 AI 功能",reAuthDescription:"使用其他账户登录或刷新凭据",button:"登录",reLoginButton:"重新登录"},error:"错误:{{error}}"},hV={title:"权限设置",skipPermissions:{label:"跳过权限提示(请谨慎使用)",claudeDescription:"等同于 --dangerously-skip-permissions 标志",cursorDescription:"等同于 Cursor CLI 中的 -f 标志"},allowedTools:{title:"允许的工具",description:"无需权限提示即可自动使用的工具",placeholder:'例如:"Bash(git log:*)" 或 "Write"',quickAdd:"快速添加常用工具:",empty:"未配置允许的工具"},blockedTools:{title:"禁用的工具",description:"无需权限提示即可自动禁用的工具",placeholder:'例如:"Bash(rm:*)"',empty:"未配置禁用的工具"},allowedCommands:{title:"允许的 Shell 命令",description:"无需权限提示即可自动执行的 Shell 命令",placeholder:'例如:"Shell(ls)" 或 "Shell(git status)"',quickAdd:"快速添加常用命令:",empty:"未配置允许的命令"},blockedCommands:{title:"阻止的 Shell 命令",description:"自动阻止的 Shell 命令",placeholder:'例如:"Shell(rm -rf)" 或 "Shell(sudo)"',empty:"未配置阻止的命令"},toolExamples:{title:"工具模式示例:",bashGitLog:"- 允许所有 git log 命令",bashGitDiff:"- 允许所有 git diff 命令",write:"- 允许所有 Write 工具使用",bashRm:"- 阻止所有 rm 命令(危险)"},shellExamples:{title:"Shell 命令示例:",ls:"- 允许 ls 命令",gitStatus:"- 允许 git status",npmInstall:"- 允许 npm install",rmRf:"- 阻止递归删除"},codex:{permissionMode:"权限模式",description:"控制 Codex 如何处理文件修改和命令执行",modes:{default:{title:"默认",description:"只有受信任的命令(ls、cat、grep、git status 等)会自动运行。其他命令将被跳过。可以写入工作区。"},acceptEdits:{title:"接受编辑",description:"所有命令在工作区内自动运行。具有沙箱执行的全自动模式。"},bypassPermissions:{title:"绕过权限",description:"完全系统访问,无任何限制。所有命令自动运行,具有完整的磁盘和网络访问权限。请谨慎使用。"}},technicalDetails:"技术详情",technicalInfo:{default:"sandboxMode=workspace-write, approvalPolicy=untrusted。受信任的命令:cat、cd、grep、head、ls、pwd、tail、git status/log/diff/show、find(不带 -exec)等。",acceptEdits:"sandboxMode=workspace-write, approvalPolicy=never。所有命令在项目目录内自动执行。",bypassPermissions:"sandboxMode=danger-full-access, approvalPolicy=never。完全系统访问权限,仅在可信环境中使用。",overrideNote:"您可以使用聊天界面中的模式按钮按会话覆盖此设置。"}},actions:{add:"添加"}},gV={title:"MCP 服务器",description:{claude:"Model Context Protocol 服务器为 Claude 提供额外的工具和数据源",cursor:"Model Context Protocol 服务器为 Cursor 提供额外的工具和数据源",codex:"Model Context Protocol 服务器为 Codex 提供额外的工具和数据源"},addButton:"添加 MCP 服务器",empty:"未配置 MCP 服务器",serverType:"类型",scope:{local:"本地",user:"用户"},config:{command:"命令",url:"URL",args:"参数",environment:"环境变量"},tools:{title:"工具",count:"({{count}}):",more:"还有 {{count}} 个"},actions:{edit:"编辑服务器",delete:"删除服务器"},help:{title:"关于 Codex MCP",description:"Codex 支持基于 stdio 的 MCP 服务器。您可以添加服务器,通过额外的工具和资源来扩展 Codex 的功能。"}},fV={title:JW,tabs:QW,account:eV,mcp:tV,appearance:rV,actions:nV,quickSettings:aV,mainTabs:iV,appearanceSettings:sV,mcpForm:oV,saveStatus:lV,footerActions:cV,git:dV,apiKeys:uV,tasks:pV,agents:mV,permissions:hV,mcpServers:gV},bV={title:"欢迎回来",description:"登录您的 Claude Code UI 账户",username:"用户名",password:"密码",submit:"登录",loading:"登录中...",errors:{invalidCredentials:"用户名或密码无效",requiredFields:"请填写所有字段",networkError:"网络错误,请重试。"},placeholders:{username:"输入您的用户名",password:"输入您的密码"}},xV={title:"创建账户",username:"用户名",password:"密码",confirmPassword:"确认密码",submit:"创建账户",loading:"创建账户中...",errors:{passwordMismatch:"密码不匹配",usernameTaken:"用户名已被占用",weakPassword:"密码强度太弱"}},yV={title:"退出登录",confirm:"确定要退出登录吗?",button:"退出登录"},vV={login:bV,register:xV,logout:yV},kV={title:"项目",newProject:"新建项目",deleteProject:"删除项目",renameProject:"重命名项目",noProjects:"未找到项目",loadingProjects:"加载项目中...",searchPlaceholder:"搜索项目...",projectNamePlaceholder:"项目名称",starred:"星标",all:"全部",untitledSession:"未命名会话",newSession:"新会话",codexSession:"Codex 会话",fetchingProjects:"正在获取您的 Claude 项目和会话",projects:"项目",noMatchingProjects:"未找到匹配的项目",tryDifferentSearch:"尝试调整您的搜索词",runClaudeCli:"在项目目录中运行 Claude CLI 以开始使用"},wV={title:"Claude Code UI",subtitle:"AI 编程助手"},SV={title:"会话",newSession:"新建会话",deleteSession:"删除会话",renameSession:"重命名会话",noSessions:"暂无会话",loadingSessions:"加载会话中...",unnamed:"未命名",loading:"加载中...",showMore:"显示更多会话"},EV={viewEnvironments:"查看环境",hideSidebar:"隐藏侧边栏",createProject:"创建新项目",refresh:"刷新项目和会话 (Ctrl+R)",renameProject:"重命名项目 (F2)",deleteProject:"删除空项目 (Delete)",addToFavorites:"添加到收藏",removeFromFavorites:"从收藏移除",editSessionName:"手动编辑会话名称",deleteSession:"永久删除此会话",save:"保存",cancel:"取消"},NV={chat:"聊天",files:"文件",git:"Git",terminal:"终端",tasks:"任务"},CV={refresh:"刷新",settings:"设置",collapseAll:"全部折叠",expandAll:"全部展开",cancel:"取消",save:"保存",delete:"删除",rename:"重命名"},TV={active:"活动",inactive:"非活动",thinking:"思考中...",error:"错误",aborted:"已中止",unknown:"未知"},AV={justNow:"刚刚",oneMinuteAgo:"1 分钟前",minutesAgo:"{{count}} 分钟前",oneHourAgo:"1 小时前",hoursAgo:"{{count}} 小时前",oneDayAgo:"1 天前",daysAgo:"{{count}} 天前"},IV={deleteConfirm:"确定要删除吗?",renameSuccess:"重命名成功",deleteSuccess:"删除成功",errorOccurred:"发生错误",deleteSessionConfirm:"确定要删除此会话吗?此操作无法撤销。",deleteProjectConfirm:"确定要删除此空项目吗?此操作无法撤销。",enterProjectPath:"请输入项目路径",deleteSessionFailed:"删除会话失败,请重试。",deleteSessionError:"删除会话时出错,请重试。",deleteProjectFailed:"删除项目失败,请重试。",deleteProjectError:"删除项目时出错,请重试。",createProjectFailed:"创建项目失败,请重试。",createProjectError:"创建项目时出错,请重试。"},RV={updateAvailable:"有可用更新"},jV={deleteProject:"删除项目",deleteSession:"删除会话",confirmDelete:"您确定要删除",sessionCount_one:"此项目包含 {{count}} 个对话。",sessionCount_other:"此项目包含 {{count}} 个对话。",allConversationsDeleted:"所有对话将被永久删除。",cannotUndo:"此操作无法撤销。"},_V={projects:kV,app:wV,sessions:SV,tooltips:EV,navigation:NV,actions:CV,status:TV,time:AV,messages:IV,version:RV,deleteConfirmation:jV},LV={copy:"复制",copied:"已复制",copyCode:"复制代码"},OV={user:"U",error:"错误",tool:"工具",claude:"Claude",cursor:"Cursor",codex:"Codex"},DV={settings:"工具设置",error:"工具错误",result:"工具结果",viewParams:"查看输入参数",viewRawParams:"查看原始参数",viewDiff:"查看编辑差异",creatingFile:"创建新文件:",updatingTodo:"更新待办事项",read:"读取",readFile:"读取文件",updateTodo:"更新待办列表",readTodo:"读取待办列表",searchResults:"结果"},MV={found:"找到 {{count}} 个{{type}}",file:"文件",files:"文件",pattern:"模式:",in:"在:"},FV={updated:"文件更新成功",created:"文件创建成功",written:"文件写入成功",diff:"差异",newFile:"新文件",viewContent:"查看文件内容",viewFullOutput:"查看完整输出({{count}} 个字符)",contentDisplayed:"文件内容显示在上面的差异视图中"},PV={title:"交互式提示",waiting:"等待您在 CLI 中响应",instruction:"请在 Claude 运行的终端中选择一个选项。",selectedOption:"✓ Claude 选择了选项 {{number}}",instructionDetail:"在 CLI 中,您可以使用方向键或输入数字来交互式地选择此选项。"},BV={title:"思考中...",emoji:"💭 思考中..."},zV={response:"JSON 响应"},UV={grant:"授予 {{tool}} 权限",added:"权限已添加",addTo:"将 {{entry}} 添加到允许的工具。",retry:"权限已保存。重试请求以使用该工具。",error:"无法更新权限。请重试。",openSettings:"打开设置"},$V={updated:"待办列表已成功更新",current:"当前待办列表"},qV={viewPlan:"📋 查看实施计划",title:"实施计划"},GV={resetAt:"Claude 使用限制已达到。您的限制将在 **{{time}} {{timezone}}** - {{date}} 重置"},HV={permissionMode:"权限模式",modes:{default:"默认模式",acceptEdits:"编辑模式",bypassPermissions:"无限制模式",plan:"计划模式"},descriptions:{default:"只有受信任的命令(ls、cat、grep、git status 等)自动运行。其他命令将被跳过。可以写入工作区。",acceptEdits:"工作区内的所有命令自动运行。完全自动模式,具有沙盒执行功能。",bypassPermissions:"完全的系统访问,无限制。所有命令自动运行,具有完整的磁盘和网络访问权限。请谨慎使用。",plan:"计划模式 - 不执行任何命令"},technicalDetails:"技术细节"},WV={placeholder:"输入 / 调用命令,@ 选择文件,或向 {{provider}} 提问...",placeholderDefault:"输入您的消息...",disabled:"输入已禁用",attachFiles:"附加文件",attachImages:"附加图片",send:"发送",stop:"停止",hintText:{ctrlEnter:"Ctrl+Enter 发送 • Shift+Enter 换行 • Tab 切换模式 • / 斜杠命令",enter:"Enter 发送 • Shift+Enter 换行 • Tab 切换模式 • / 斜杠命令"},clickToChangeMode:"点击更改权限模式(或在输入框中按 Tab)",showAllCommands:"显示所有命令"},VV={selector:{title:"思考模式",description:"扩展思考给 Claude 更多时间来评估替代方案",active:"激活",tip:"更高的思考模式需要更多时间,但提供更彻底的分析"},modes:{none:{name:"标准",description:"常规 Claude 响应",prefix:""},think:{name:"思考",description:"基本扩展思考",prefix:"思考"},thinkHard:{name:"深入思考",description:"更彻底的评估",prefix:"深入思考"},thinkHarder:{name:"更深入思考",description:"考虑替代方案的深度分析",prefix:"更深入思考"},ultrathink:{name:"超级思考",description:"最大思考预算",prefix:"超级思考"}},buttonTitle:"思考模式:{{mode}}"},KV={title:"选择您的 AI 助手",description:"选择一个供应商以开始新对话",selectModel:"选择模型",providerInfo:{anthropic:"Anthropic",openai:"OpenAI",cursorEditor:"AI 代码编辑器"},readyPrompt:{claude:"已准备好使用 Claude {{model}}。在下方输入您的消息。",cursor:"已准备好使用 Cursor {{model}}。在下方输入您的消息。",codex:"已准备好使用 Codex {{model}}。在下方输入您的消息。",default:"请在上方选择一个供应商以开始"}},YV={continue:{title:"继续您的对话",description:"询问有关代码的问题、请求更改或获取开发任务的帮助"},loading:{olderMessages:"正在加载更早的消息...",sessionMessages:"正在加载会话消息..."},messages:{showingOf:"显示 {{shown}} / {{total}} 条消息",scrollToLoad:"向上滚动以加载更多",showingLast:"显示最近 {{count}} 条消息(共 {{total}} 条)",loadEarlier:"加载更早的消息"}},XV={selectProject:{title:"选择项目",description:"选择一个项目以在该目录中打开交互式 Shell"},status:{newSession:"新会话",initializing:"初始化中...",restarting:"重启中..."},actions:{disconnect:"断开连接",disconnectTitle:"断开 Shell 连接",restart:"重启",restartTitle:"重启 Shell(请先断开连接)",connect:"在 Shell 中继续",connectTitle:"连接到 Shell"},loading:"正在加载终端...",connecting:"正在连接到 Shell...",startSession:"启动新的 Claude 会话",resumeSession:"恢复会话:{{displayName}}...",runCommand:"在 {{projectName}} 中运行 {{command}}",startCli:"在 {{projectName}} 中启动 Claude CLI",defaultCommand:"命令"},ZV={codeBlock:LV,messageTypes:OV,tools:DV,search:MV,fileOperations:FV,interactive:PV,thinking:BV,json:zV,permissions:UV,todo:$V,plan:qV,usageLimit:GV,codex:HV,input:WV,thinkingMode:VV,providerSelection:KV,session:YV,shell:XV},JV={changes:"个更改",previousChange:"上一个更改",nextChange:"下一个更改",hideDiff:"隐藏差异高亮",showDiff:"显示差异高亮",settings:"编辑器设置",collapse:"折叠编辑器",expand:"展开编辑器到全宽"},QV="正在加载 {{fileName}}...",eK={showingChanges:"显示更改"},tK={download:"下载文件",save:"保存",saving:"保存中...",saved:"已保存!",exitFullscreen:"退出全屏",fullscreen:"全屏",close:"关闭"},rK={lines:"行数:",characters:"字符数:",shortcuts:"按 Ctrl+S 保存 • Esc 关闭"},nK={toolbar:JV,loading:QV,header:eK,actions:tK,footer:rK},aK=()=>{try{const e=localStorage.getItem("userLanguage");return e&&jh.some(t=>t.value===e)?e:"en"}catch{return"en"}};br.use(m3).use(wT).init({resources:{en:{common:_H,settings:ZH,auth:tW,sidebar:mW,chat:_W,codeEditor:PW},"zh-CN":{common:ZW,settings:fV,auth:vV,sidebar:_V,chat:ZV,codeEditor:nK}},lng:aK(),fallbackLng:"en",debug:!1,ns:["common","settings","auth","sidebar","chat","codeEditor"],defaultNS:"common",keySeparator:".",nsSeparator:":",saveMissing:!1,interpolation:{escapeValue:!1},react:{useSuspense:!0,bindI18n:"languageChanged",bindI18nStore:!1},detection:{order:["localStorage"],lookupLocalStorage:"userLanguage",caches:["localStorage"]}});br.on("languageChanged",e=>{try{localStorage.setItem("userLanguage",e)}catch(t){console.error("Failed to save language preference:",t)}});function t4(){const e=a5(),{sessionId:t}=i5(),{t:r}=Ht("common"),{updateAvailable:n,latestVersion:i,currentVersion:s,releaseInfo:o}=l3("siteboon","claudecodeui"),[l,c]=x.useState(!1),[d,u]=x.useState([]),[p,h]=x.useState(null),[m,g]=x.useState(null),[f,w]=x.useState("chat"),[S,k]=x.useState(!1),[E,N]=x.useState(!1),[C,v]=x.useState(!0),[I,M]=x.useState(null),[j,T]=x.useState(!1),[P,q]=x.useState(!1),[D,z]=x.useState("agents"),[U,G]=x.useState(!1),[re,K]=Xa("autoExpandTools",!1),[ue,R]=Xa("showRawParameters",!1),[F,te]=Xa("showThinking",!0),[_,Z]=Xa("autoScrollToBottom",!0),[me,ke]=Xa("sendByCtrlEnter",!1),[se,_e]=Xa("sidebarVisible",!0),[oe,fe]=x.useState(new Set),[Ie,qe]=x.useState(new Set),[ze,ct]=x.useState(0),{ws:Ye,sendMessage:wt,messages:gt}=U4(),et=x.useRef(null),[Me,mt]=x.useState(!1);x.useEffect(()=>{const ie=()=>{const je=window.matchMedia("(display-mode: standalone)").matches||window.navigator.standalone||document.referrer.includes("android-app://");mt(je),document.addEventListener("touchstart",{}),je?(document.documentElement.classList.add("pwa-mode"),document.body.classList.add("pwa-mode")):(document.documentElement.classList.remove("pwa-mode"),document.body.classList.remove("pwa-mode"))};return ie(),window.matchMedia("(display-mode: standalone)").addEventListener("change",ie),()=>{window.matchMedia("(display-mode: standalone)").removeEventListener("change",ie)}},[]),x.useEffect(()=>{const ie=()=>{k(window.innerWidth<768)};return ie(),window.addEventListener("resize",ie),()=>window.removeEventListener("resize",ie)},[]),x.useEffect(()=>{xe()},[]);const Pt=(ie,je,Te,Pe)=>{if(!Te||!Pe)return!0;const Ue=ie?.find(Ke=>Ke.name===Te.name),st=je?.find(Ke=>Ke.name===Te.name);if(!Ue||!st)return!1;const Qe=Ue.sessions?.find(Ke=>Ke.id===Pe.id),J=st.sessions?.find(Ke=>Ke.id===Pe.id);return!Qe||!J?!1:Qe.id===J.id&&Qe.title===J.title&&Qe.created_at===J.created_at&&Qe.updated_at===J.updated_at};x.useEffect(()=>{if(gt.length>0){const ie=gt[gt.length-1];if(ie.type==="loading_progress"){et.current&&(clearTimeout(et.current),et.current=null),M(ie),ie.phase==="complete"&&(et.current=setTimeout(()=>{M(null),et.current=null},500));return}if(ie.type==="projects_updated"){if(ie.changedFile&&m&&p){const Ue=ie.changedFile.replace(/\\/g,"/").split("/");Ue.length>=2&&Ue[Ue.length-1].replace(".jsonl","")===m.id&&(oe.has(m.id)||ct(Fe=>Fe+1))}if(m&&oe.has(m.id)||oe.size>0&&Array.from(oe).some(Pe=>Pe.startsWith("new-session-"))){const Pe=ie.projects;if(!Pt(d,Pe,p,m))return}const Te=ie.projects;if(u(Te),p){const Pe=Te.find(Ue=>Ue.name===p.name);Pe&&(JSON.stringify(Pe)!==JSON.stringify(p)&&h(Pe),m&&([...Pe.sessions||[],...Pe.codexSessions||[],...Pe.cursorSessions||[]].find(Qe=>Qe.id===m.id)||g(null)))}}}return()=>{et.current&&(clearTimeout(et.current),et.current=null)}},[gt,p,m,oe]);const xe=async()=>{try{v(!0);const je=await(await yt.projects()).json();for(let Te of je)try{const Pe=`/api/cursor/sessions?projectPath=${encodeURIComponent(Te.fullPath||Te.path)}`,Ue=await Ce(Pe);if(Ue.ok){const st=await Ue.json();st.success&&st.sessions?Te.cursorSessions=st.sessions:Te.cursorSessions=[]}else Te.cursorSessions=[]}catch(Pe){console.error(`Error fetching Cursor sessions for project ${Te.name}:`,Pe),Te.cursorSessions=[]}u(Te=>Te.length===0||je.some((Ue,st)=>{const Qe=Te[st];return Qe?Ue.name!==Qe.name||Ue.displayName!==Qe.displayName||Ue.fullPath!==Qe.fullPath||JSON.stringify(Ue.sessionMeta)!==JSON.stringify(Qe.sessionMeta)||JSON.stringify(Ue.sessions)!==JSON.stringify(Qe.sessions)||JSON.stringify(Ue.cursorSessions)!==JSON.stringify(Qe.cursorSessions):!0})||je.length!==Te.length?je:Te)}catch(ie){console.error("Error fetching projects:",ie)}finally{v(!1)}};window.refreshProjects=xe,window.openSettings=x.useCallback((ie="tools")=>{z(ie),q(!0)},[]),x.useEffect(()=>{if(t&&d.length>0){const ie=!m||m.id!==t;for(const je of d){let Te=je.sessions?.find(Ue=>Ue.id===t);if(Te){h(je),g({...Te,__provider:"claude"}),ie&&w("chat");return}const Pe=je.cursorSessions?.find(Ue=>Ue.id===t);if(Pe){h(je),g({...Pe,__provider:"cursor"}),ie&&w("chat");return}}}},[t,d,e]);const at=ie=>{h(ie),g(null),e("/"),S&&N(!1)},de=ie=>{if(g(ie),f!=="git"&&f!=="preview"&&w("chat"),(localStorage.getItem("selected-provider")||"claude")==="cursor"&&sessionStorage.setItem("cursorSessionId",ie.id),S){const Te=ie.__projectName,Pe=p?.name;Te!==Pe&&N(!1)}e(`/session/${ie.id}`)},Ee=ie=>{h(ie),g(null),w("chat"),e("/"),S&&N(!1)},H=ie=>{m?.id===ie&&(g(null),e("/")),u(je=>je.map(Te=>({...Te,sessions:Te.sessions?.filter(Pe=>Pe.id!==ie)||[],sessionMeta:{...Te.sessionMeta,total:Math.max(0,(Te.sessionMeta?.total||0)-1)}})))},Y=async()=>{try{const je=await(await yt.projects()).json();if(u(Te=>je.some((Ue,st)=>{const Qe=Te[st];return Qe?Ue.name!==Qe.name||Ue.displayName!==Qe.displayName||Ue.fullPath!==Qe.fullPath||JSON.stringify(Ue.sessionMeta)!==JSON.stringify(Qe.sessionMeta)||JSON.stringify(Ue.sessions)!==JSON.stringify(Qe.sessions):!0})||je.length!==Te.length?je:Te),p){const Te=je.find(Pe=>Pe.name===p.name);if(Te&&(JSON.stringify(Te)!==JSON.stringify(p)&&h(Te),m)){const Pe=Te.sessions?.find(Ue=>Ue.id===m.id);Pe&&JSON.stringify(Pe)!==JSON.stringify(m)&&g(Pe)}}}catch(ie){console.error("Error refreshing sidebar:",ie)}},le=ie=>{p?.name===ie&&(h(null),g(null),e("/")),u(je=>je.filter(Te=>Te.name!==ie))},ve=x.useCallback(ie=>{ie&&fe(je=>new Set([...je,ie]))},[]),Ve=x.useCallback(ie=>{ie&&fe(je=>{const Te=new Set(je);return Te.delete(ie),Te})},[]),It=x.useCallback(ie=>{ie&&qe(je=>new Set([...je,ie]))},[]),ft=x.useCallback(ie=>{ie&&qe(je=>{const Te=new Set(je);return Te.delete(ie),Te})},[]),Rt=x.useCallback(ie=>{ie&&fe(je=>{const Te=new Set;for(const Pe of je)Pe.startsWith("new-session-")||Te.add(Pe);return Te.add(ie),Te})},[]),it=()=>{const{t:ie}=Ht("common"),[je,Te]=x.useState(!1),[Pe,Ue]=x.useState(""),[st,Qe]=x.useState("");if(!l)return null;const J=Ke=>Ke?Ke.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,`
|
|
1225
|
+
3000`,rows:3,className:"w-full px-3 py-2 text-sm bg-background border border-input rounded-md focus:outline-none focus:ring-2 focus:ring-ring"})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-sm font-medium text-foreground mb-2",children:o("mcpForm.fields.envVars")}),a.jsx("textarea",{value:Object.entries(Ue.config?.env||{}).map(([X,de])=>`${X}=${de}`).join(`
|
|
1226
|
+
`),onChange:X=>{const de={};X.target.value.split(`
|
|
1227
|
+
`).forEach(Re=>{const[ht,...dr]=Re.split("=");ht&&dr.length>0&&(de[ht.trim()]=dr.join("=").trim())}),st(Re=>({...Re,config:{...Re.config,env:de}}))},placeholder:`API_KEY=xxx
|
|
1228
|
+
DEBUG=true`,rows:3,className:"w-full px-3 py-2 text-sm bg-background border border-input rounded-md focus:outline-none focus:ring-2 focus:ring-ring"})]}),a.jsxs("div",{className:"flex justify-end gap-2 pt-4 border-t border-border",children:[a.jsx(Be,{type:"button",variant:"outline",onClick:_r,children:o("mcpForm.actions.cancel")}),a.jsx(Be,{type:"submit",disabled:Fe||!Ue.name||!Ue.config?.command,className:"bg-green-600 hover:bg-green-700 text-white",children:o(Fe?"mcpForm.actions.saving":Qe?"mcpForm.actions.updateServer":"mcpForm.actions.addServer")})]})]})]})}),_==="tasks"&&a.jsx("div",{className:"space-y-6 md:space-y-8",children:a.jsx(FG,{})}),_==="api"&&a.jsx("div",{className:"space-y-6 md:space-y-8",children:a.jsx(DG,{})})]})]}),a.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between p-4 md:p-6 border-t border-border flex-shrink-0 gap-3 pb-safe-area-inset-bottom",children:[a.jsxs("div",{className:"flex items-center justify-center sm:justify-start gap-2 order-2 sm:order-1",children:[E==="success"&&a.jsxs("div",{className:"text-green-600 dark:text-green-400 text-sm flex items-center gap-1",children:[a.jsx("svg",{className:"w-4 h-4",fill:"currentColor",viewBox:"0 0 20 20",children:a.jsx("path",{fillRule:"evenodd",d:"M16.707 5.293a1 1 0 010 1.414l-8 8a1 1 0 01-1.414 0l-4-4a1 1 0 011.414-1.414L8 12.586l7.293-7.293a1 1 0 011.414 0z",clipRule:"evenodd"})}),o("saveStatus.success")]}),E==="error"&&a.jsxs("div",{className:"text-red-600 dark:text-red-400 text-sm flex items-center gap-1",children:[a.jsx("svg",{className:"w-4 h-4",fill:"currentColor",viewBox:"0 0 20 20",children:a.jsx("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7 4a1 1 0 11-2 0 1 1 0 012 0zm-1-9a1 1 0 00-1 1v4a1 1 0 102 0V6a1 1 0 00-1-1z",clipRule:"evenodd"})}),o("saveStatus.error")]})]}),a.jsxs("div",{className:"flex items-center gap-3 order-1 sm:order-2",children:[a.jsx(Be,{variant:"outline",onClick:t,disabled:S,className:"flex-1 sm:flex-none h-10 touch-manipulation",children:o("footerActions.cancel")}),a.jsx(Be,{onClick:qr,disabled:S,className:"flex-1 sm:flex-none h-10 bg-blue-600 hover:bg-blue-700 disabled:opacity-50 touch-manipulation",children:S?a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("div",{className:"w-4 h-4 animate-spin rounded-full border-2 border-white border-t-transparent"}),o("saveStatus.saving")]}):o("footerActions.save")})]})]})]}),a.jsx(c3,{isOpen:Ge,onClose:()=>dt(!1),provider:he,project:nr,onComplete:Go,isAuthenticated:he==="claude"?xr.authenticated:he==="cursor"?ge.authenticated:he==="codex"?bt.authenticated:!1},he)]}):null}function JG(){const{isDarkMode:e,toggleDarkMode:t}=as();return a.jsxs("button",{onClick:t,className:"relative inline-flex h-8 w-14 items-center rounded-full bg-gray-200 dark:bg-gray-700 transition-colors duration-200 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2 dark:focus:ring-offset-gray-900",role:"switch","aria-checked":e,"aria-label":"Toggle dark mode",children:[a.jsx("span",{className:"sr-only",children:"Toggle dark mode"}),a.jsx("span",{className:`${e?"translate-x-7":"translate-x-1"} inline-block h-6 w-6 transform rounded-full bg-white shadow-lg transition-transform duration-200 flex items-center justify-center`,children:e?a.jsx("svg",{className:"w-3.5 h-3.5 text-gray-700",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M20.354 15.354A9 9 0 018.646 3.646 9.003 9.003 0 0012 21a9.003 9.003 0 008.354-5.646z"})}):a.jsx("svg",{className:"w-3.5 h-3.5 text-yellow-500",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 3v1m0 16v1m9-9h-1M4 12H3m15.364 6.364l-.707-.707M6.343 6.343l-.707-.707m12.728 0l-.707.707M6.343 17.657l-.707.707M16 12a4 4 0 11-8 0 4 4 0 018 0z"})})})]})}const QG=({isOpen:e,onToggle:t,autoExpandTools:r,onAutoExpandChange:n,showRawParameters:i,onShowRawParametersChange:s,showThinking:o,onShowThinkingChange:l,autoScrollToBottom:c,onAutoScrollChange:d,sendByCtrlEnter:u,onSendByCtrlEnterChange:p,isMobile:h})=>{const{t:m}=Ht("settings"),[g,f]=x.useState(e),[w,S]=x.useState(()=>localStorage.getItem("whisperMode")||"default"),{isDarkMode:k}=as(),[E,N]=x.useState(()=>{const F=localStorage.getItem("quickSettingsHandlePosition");if(F)try{return JSON.parse(F).y??50}catch{return localStorage.removeItem("quickSettingsHandlePosition"),50}return 50}),[C,v]=x.useState(!1),[I,M]=x.useState(0),[j,T]=x.useState(0),[P,q]=x.useState(!1),D=x.useRef(null),z=x.useRef({min:10,max:90}),U=5;x.useEffect(()=>{f(e)},[e]),x.useEffect(()=>{localStorage.setItem("quickSettingsHandlePosition",JSON.stringify({y:E}))},[E]);const G=x.useCallback(()=>h?{bottom:`${window.innerHeight*E/100}px`}:{top:`${E}%`,transform:"translateY(-50%)"},[E,h]),re=x.useCallback(F=>{F.stopPropagation();const te=F.type.includes("touch")?F.touches[0].clientY:F.clientY;M(te),T(E),q(!1),v(!1)},[E]),K=x.useCallback(F=>{if(I===0)return;const te=F.type.includes("touch")?F.touches[0].clientY:F.clientY,_=Math.abs(te-I);if(!C&&_>U&&(v(!0),q(!0),document.body.style.cursor="grabbing",document.body.style.userSelect="none",F.type.includes("touch")&&(document.body.style.overflow="hidden",document.body.style.position="fixed",document.body.style.width="100%")),!C)return;F.type.includes("touch")&&F.preventDefault();const Z=te-I;let me;h?me=-(Z/window.innerHeight)*100:me=Z/window.innerHeight*100;let ke=j+me;ke=Math.max(z.current.min,Math.min(z.current.max,ke)),N(ke)},[C,I,j,h,U]),ue=x.useCallback(()=>{v(!1),M(0),document.body.style.cursor="",document.body.style.userSelect="",document.body.style.overflow="",document.body.style.position="",document.body.style.width=""},[]);x.useEffect(()=>()=>{document.body.style.cursor="",document.body.style.userSelect="",document.body.style.overflow="",document.body.style.position="",document.body.style.width=""},[]),x.useEffect(()=>{if(I!==0){const F=me=>K(me),te=()=>ue(),_=me=>K(me),Z=()=>ue();return document.addEventListener("mousemove",F),document.addEventListener("mouseup",te),document.addEventListener("touchmove",_,{passive:!1}),document.addEventListener("touchend",Z),()=>{document.removeEventListener("mousemove",F),document.removeEventListener("mouseup",te),document.removeEventListener("touchmove",_),document.removeEventListener("touchend",Z)}}},[I,K,ue]);const R=F=>{if(P){F.preventDefault(),q(!1);return}const te=!g;f(te),t(te)};return a.jsxs(a.Fragment,{children:[a.jsx("button",{ref:D,onClick:R,onMouseDown:F=>{re(F)},onTouchStart:F=>{re(F)},className:`fixed ${g?"right-64":"right-0"} z-50 ${C?"":"transition-all duration-150 ease-out"} bg-white dark:bg-gray-800 border ${C?"border-blue-500 dark:border-blue-400":"border-gray-200 dark:border-gray-700"} rounded-l-md p-2 hover:bg-gray-100 dark:hover:bg-gray-700 transition-colors shadow-lg ${C?"cursor-grabbing":"cursor-pointer"} touch-none`,style:{...G(),touchAction:"none",WebkitTouchCallout:"none",WebkitUserSelect:"none"},"aria-label":m(C?"quickSettings.dragHandle.dragging":g?"quickSettings.dragHandle.closePanel":"quickSettings.dragHandle.openPanel"),title:m(C?"quickSettings.dragHandle.draggingStatus":"quickSettings.dragHandle.toggleAndMove"),children:C?a.jsx(u6,{className:"h-5 w-5 text-blue-500 dark:text-blue-400"}):g?a.jsx(Cn,{className:"h-5 w-5 text-gray-600 dark:text-gray-400"}):a.jsx(Mh,{className:"h-5 w-5 text-gray-600 dark:text-gray-400"})}),a.jsx("div",{className:`fixed top-0 right-0 h-full w-64 bg-background border-l border-border shadow-xl transform transition-transform duration-150 ease-out z-40 ${g?"translate-x-0":"translate-x-full"} ${h?"h-screen":""}`,children:a.jsxs("div",{className:"h-full flex flex-col",children:[a.jsx("div",{className:"p-4 border-b border-gray-200 dark:border-gray-700 bg-gray-50 dark:bg-gray-900",children:a.jsxs("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white flex items-center gap-2",children:[a.jsx($6,{className:"h-5 w-5 text-gray-600 dark:text-gray-400"}),m("quickSettings.title")]})}),a.jsxs("div",{className:`flex-1 overflow-y-auto overflow-x-hidden p-4 space-y-6 bg-background ${h?"pb-mobile-nav":""}`,children:[a.jsxs("div",{className:"space-y-2",children:[a.jsx("h4",{className:"text-xs font-semibold uppercase tracking-wider text-gray-500 dark:text-gray-400 mb-2",children:m("quickSettings.sections.appearance")}),a.jsxs("div",{className:"flex items-center justify-between p-3 rounded-lg bg-gray-50 dark:bg-gray-800 hover:bg-gray-100 dark:hover:bg-gray-700 transition-colors border border-transparent hover:border-gray-300 dark:hover:border-gray-600",children:[a.jsxs("span",{className:"flex items-center gap-2 text-sm text-gray-900 dark:text-white",children:[k?a.jsx(Mm,{className:"h-4 w-4 text-gray-600 dark:text-gray-400"}):a.jsx(Fm,{className:"h-4 w-4 text-gray-600 dark:text-gray-400"}),m("quickSettings.darkMode")]}),a.jsx(JG,{})]}),a.jsx("div",{children:a.jsx(d3,{compact:!0})})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx("h4",{className:"text-xs font-semibold uppercase tracking-wider text-gray-500 dark:text-gray-400 mb-2",children:m("quickSettings.sections.toolDisplay")}),a.jsxs("label",{className:"flex items-center justify-between p-3 rounded-lg bg-gray-50 dark:bg-gray-800 hover:bg-gray-100 dark:hover:bg-gray-700 cursor-pointer transition-colors border border-transparent hover:border-gray-300 dark:hover:border-gray-600",children:[a.jsxs("span",{className:"flex items-center gap-2 text-sm text-gray-900 dark:text-white",children:[a.jsx(Ph,{className:"h-4 w-4 text-gray-600 dark:text-gray-400"}),m("quickSettings.autoExpandTools")]}),a.jsx("input",{type:"checkbox",checked:r,onChange:F=>n(F.target.checked),className:"h-4 w-4 rounded border-gray-300 dark:border-gray-600 text-blue-600 dark:text-blue-500 focus:ring-blue-500 focus:ring-2 dark:focus:ring-blue-400 bg-gray-100 dark:bg-gray-800 checked:bg-blue-600 dark:checked:bg-blue-600"})]}),a.jsxs("label",{className:"flex items-center justify-between p-3 rounded-lg bg-gray-50 dark:bg-gray-800 hover:bg-gray-100 dark:hover:bg-gray-700 cursor-pointer transition-colors border border-transparent hover:border-gray-300 dark:hover:border-gray-600",children:[a.jsxs("span",{className:"flex items-center gap-2 text-sm text-gray-900 dark:text-white",children:[a.jsx(hi,{className:"h-4 w-4 text-gray-600 dark:text-gray-400"}),m("quickSettings.showRawParameters")]}),a.jsx("input",{type:"checkbox",checked:i,onChange:F=>s(F.target.checked),className:"h-4 w-4 rounded border-gray-300 dark:border-gray-600 text-blue-600 dark:text-blue-500 focus:ring-blue-500 focus:ring-2 dark:focus:ring-blue-400 bg-gray-100 dark:bg-gray-800 checked:bg-blue-600 dark:checked:bg-blue-600"})]}),a.jsxs("label",{className:"flex items-center justify-between p-3 rounded-lg bg-gray-50 dark:bg-gray-800 hover:bg-gray-100 dark:hover:bg-gray-700 cursor-pointer transition-colors border border-transparent hover:border-gray-300 dark:hover:border-gray-600",children:[a.jsxs("span",{className:"flex items-center gap-2 text-sm text-gray-900 dark:text-white",children:[a.jsx(wo,{className:"h-4 w-4 text-gray-600 dark:text-gray-400"}),m("quickSettings.showThinking")]}),a.jsx("input",{type:"checkbox",checked:o,onChange:F=>l(F.target.checked),className:"h-4 w-4 rounded border-gray-300 dark:border-gray-600 text-blue-600 dark:text-blue-500 focus:ring-blue-500 focus:ring-2 dark:focus:ring-blue-400 bg-gray-100 dark:bg-gray-800 checked:bg-blue-600 dark:checked:bg-blue-600"})]})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx("h4",{className:"text-xs font-semibold uppercase tracking-wider text-gray-500 dark:text-gray-400 mb-2",children:m("quickSettings.sections.viewOptions")}),a.jsxs("label",{className:"flex items-center justify-between p-3 rounded-lg bg-gray-50 dark:bg-gray-800 hover:bg-gray-100 dark:hover:bg-gray-700 cursor-pointer transition-colors border border-transparent hover:border-gray-300 dark:hover:border-gray-600",children:[a.jsxs("span",{className:"flex items-center gap-2 text-sm text-gray-900 dark:text-white",children:[a.jsx(d4,{className:"h-4 w-4 text-gray-600 dark:text-gray-400"}),m("quickSettings.autoScrollToBottom")]}),a.jsx("input",{type:"checkbox",checked:c,onChange:F=>d(F.target.checked),className:"h-4 w-4 rounded border-gray-300 dark:border-gray-600 text-blue-600 dark:text-blue-500 focus:ring-blue-500 focus:ring-2 dark:focus:ring-blue-400 bg-gray-100 dark:bg-gray-800 checked:bg-blue-600 dark:checked:bg-blue-600"})]})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx("h4",{className:"text-xs font-semibold uppercase tracking-wider text-gray-500 dark:text-gray-400 mb-2",children:m("quickSettings.sections.inputSettings")}),a.jsxs("label",{className:"flex items-center justify-between p-3 rounded-lg bg-gray-50 dark:bg-gray-800 hover:bg-gray-100 dark:hover:bg-gray-700 cursor-pointer transition-colors border border-transparent hover:border-gray-300 dark:hover:border-gray-600",children:[a.jsxs("span",{className:"flex items-center gap-2 text-sm text-gray-900 dark:text-white",children:[a.jsx(h4,{className:"h-4 w-4 text-gray-600 dark:text-gray-400"}),m("quickSettings.sendByCtrlEnter")]}),a.jsx("input",{type:"checkbox",checked:u,onChange:F=>p(F.target.checked),className:"h-4 w-4 rounded border-gray-300 dark:border-gray-600 text-blue-600 dark:text-blue-500 focus:ring-blue-500 focus:ring-2 dark:focus:ring-blue-400 bg-gray-100 dark:bg-gray-800 checked:bg-blue-600 dark:checked:bg-blue-600"})]}),a.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 ml-3",children:m("quickSettings.sendByCtrlEnterDescription")})]}),a.jsxs("div",{className:"space-y-2",style:{display:"none"},children:[a.jsx("h4",{className:"text-xs font-semibold uppercase tracking-wider text-gray-500 dark:text-gray-400 mb-2",children:m("quickSettings.sections.whisperDictation")}),a.jsxs("div",{className:"space-y-2",children:[a.jsxs("label",{className:"flex items-start p-3 rounded-lg bg-gray-50 dark:bg-gray-800 hover:bg-gray-100 dark:hover:bg-gray-700 cursor-pointer transition-colors border border-transparent hover:border-gray-300 dark:hover:border-gray-600",children:[a.jsx("input",{type:"radio",name:"whisperMode",value:"default",checked:w==="default",onChange:()=>{S("default"),localStorage.setItem("whisperMode","default"),window.dispatchEvent(new Event("whisperModeChanged"))},className:"mt-0.5 h-4 w-4 border-gray-300 dark:border-gray-600 text-blue-600 dark:text-blue-500 focus:ring-blue-500 dark:focus:ring-blue-400 dark:bg-gray-800 dark:checked:bg-blue-600"}),a.jsxs("div",{className:"ml-3 flex-1",children:[a.jsxs("span",{className:"flex items-center gap-2 text-sm font-medium text-gray-900 dark:text-white",children:[a.jsx(Ws,{className:"h-4 w-4 text-gray-600 dark:text-gray-400"}),m("quickSettings.whisper.modes.default")]}),a.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 mt-1",children:m("quickSettings.whisper.modes.defaultDescription")})]})]}),a.jsxs("label",{className:"flex items-start p-3 rounded-lg bg-gray-50 dark:bg-gray-800 hover:bg-gray-100 dark:hover:bg-gray-700 cursor-pointer transition-colors border border-transparent hover:border-gray-300 dark:hover:border-gray-600",children:[a.jsx("input",{type:"radio",name:"whisperMode",value:"prompt",checked:w==="prompt",onChange:()=>{S("prompt"),localStorage.setItem("whisperMode","prompt"),window.dispatchEvent(new Event("whisperModeChanged"))},className:"mt-0.5 h-4 w-4 border-gray-300 dark:border-gray-600 text-blue-600 dark:text-blue-500 focus:ring-blue-500 dark:focus:ring-blue-400 dark:bg-gray-800 dark:checked:bg-blue-600"}),a.jsxs("div",{className:"ml-3 flex-1",children:[a.jsxs("span",{className:"flex items-center gap-2 text-sm font-medium text-gray-900 dark:text-white",children:[a.jsx(Gn,{className:"h-4 w-4 text-gray-600 dark:text-gray-400"}),m("quickSettings.whisper.modes.prompt")]}),a.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 mt-1",children:m("quickSettings.whisper.modes.promptDescription")})]})]}),a.jsxs("label",{className:"flex items-start p-3 rounded-lg bg-gray-50 dark:bg-gray-800 hover:bg-gray-100 dark:hover:bg-gray-700 cursor-pointer transition-colors border border-transparent hover:border-gray-300 dark:hover:border-gray-600",children:[a.jsx("input",{type:"radio",name:"whisperMode",value:"vibe",checked:w==="vibe"||w==="instructions"||w==="architect",onChange:()=>{S("vibe"),localStorage.setItem("whisperMode","vibe"),window.dispatchEvent(new Event("whisperModeChanged"))},className:"mt-0.5 h-4 w-4 border-gray-300 dark:border-gray-600 text-blue-600 dark:text-blue-500 focus:ring-blue-500 dark:focus:ring-blue-400 dark:bg-gray-800 dark:checked:bg-blue-600"}),a.jsxs("div",{className:"ml-3 flex-1",children:[a.jsxs("span",{className:"flex items-center gap-2 text-sm font-medium text-gray-900 dark:text-white",children:[a.jsx(Fr,{className:"h-4 w-4 text-gray-600 dark:text-gray-400"}),m("quickSettings.whisper.modes.vibe")]}),a.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 mt-1",children:m("quickSettings.whisper.modes.vibeDescription")})]})]})]})]})]})]})}),g&&a.jsx("div",{className:"fixed inset-0 bg-background/80 backdrop-blur-sm z-30 transition-opacity duration-150 ease-out",onClick:R})]})},eH=()=>{const[e,t]=x.useState(""),[r,n]=x.useState(""),[i,s]=x.useState(""),[o,l]=x.useState(!1),[c,d]=x.useState(""),{register:u}=is(),p=async h=>{if(h.preventDefault(),d(""),r!==i){d("Passwords do not match");return}if(e.length<3){d("Username must be at least 3 characters long");return}if(r.length<6){d("Password must be at least 6 characters long");return}l(!0);const m=await u(e,r);m.success||d(m.error),l(!1)};return a.jsx("div",{className:"min-h-screen bg-background flex items-center justify-center p-4",children:a.jsx("div",{className:"w-full max-w-md",children:a.jsxs("div",{className:"bg-card rounded-lg shadow-lg border border-border p-8 space-y-6",children:[a.jsxs("div",{className:"text-center",children:[a.jsx("div",{className:"flex justify-center mb-4",children:a.jsx(nn,{size:64})}),a.jsx("h1",{className:"text-2xl font-bold text-foreground",children:"Welcome to Claude Code UI"}),a.jsx("p",{className:"text-muted-foreground mt-2",children:"Set up your account to get started"})]}),a.jsxs("form",{onSubmit:p,className:"space-y-4",children:[a.jsxs("div",{children:[a.jsx("label",{htmlFor:"username",className:"block text-sm font-medium text-foreground mb-1",children:"Username"}),a.jsx("input",{type:"text",id:"username",value:e,onChange:h=>t(h.target.value),className:"w-full px-3 py-2 border border-border rounded-md bg-background text-foreground focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent",placeholder:"Enter your username",required:!0,disabled:o})]}),a.jsxs("div",{children:[a.jsx("label",{htmlFor:"password",className:"block text-sm font-medium text-foreground mb-1",children:"Password"}),a.jsx("input",{type:"password",id:"password",value:r,onChange:h=>n(h.target.value),className:"w-full px-3 py-2 border border-border rounded-md bg-background text-foreground focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent",placeholder:"Enter your password",required:!0,disabled:o})]}),a.jsxs("div",{children:[a.jsx("label",{htmlFor:"confirmPassword",className:"block text-sm font-medium text-foreground mb-1",children:"Confirm Password"}),a.jsx("input",{type:"password",id:"confirmPassword",value:i,onChange:h=>s(h.target.value),className:"w-full px-3 py-2 border border-border rounded-md bg-background text-foreground focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent",placeholder:"Confirm your password",required:!0,disabled:o})]}),c&&a.jsx("div",{className:"p-3 bg-red-100 dark:bg-red-900/20 border border-red-300 dark:border-red-800 rounded-md",children:a.jsx("p",{className:"text-sm text-red-700 dark:text-red-400",children:c})}),a.jsx("button",{type:"submit",disabled:o,className:"w-full bg-blue-600 hover:bg-blue-700 disabled:bg-blue-400 text-white font-medium py-2 px-4 rounded-md transition-colors duration-200",children:o?"Setting up...":"Create Account"})]}),a.jsx("div",{className:"text-center",children:a.jsx("p",{className:"text-sm text-muted-foreground",children:"This is a single-user system. Only one account can be created."})})]})})})},tH=()=>{const{t:e}=Ht("auth"),[t,r]=x.useState(""),[n,i]=x.useState(""),[s,o]=x.useState(!1),[l,c]=x.useState(""),{login:d}=is(),u=async p=>{if(p.preventDefault(),c(""),!t||!n){c(e("errors.requiredFields"));return}o(!0);const h=await d(t,n);h.success||c(h.error),o(!1)};return a.jsx("div",{className:"min-h-screen bg-background flex items-center justify-center p-4",children:a.jsx("div",{className:"w-full max-w-md",children:a.jsxs("div",{className:"bg-card rounded-lg shadow-lg border border-border p-8 space-y-6",children:[a.jsxs("div",{className:"text-center",children:[a.jsx("div",{className:"flex justify-center mb-4",children:a.jsx("div",{className:"w-16 h-16 bg-primary rounded-lg flex items-center justify-center shadow-sm",children:a.jsx(Wi,{className:"w-8 h-8 text-primary-foreground"})})}),a.jsx("h1",{className:"text-2xl font-bold text-foreground",children:e("login.title")}),a.jsx("p",{className:"text-muted-foreground mt-2",children:e("login.description")})]}),a.jsxs("form",{onSubmit:u,className:"space-y-4",children:[a.jsxs("div",{children:[a.jsx("label",{htmlFor:"username",className:"block text-sm font-medium text-foreground mb-1",children:e("login.username")}),a.jsx("input",{type:"text",id:"username",value:t,onChange:p=>r(p.target.value),className:"w-full px-3 py-2 border border-border rounded-md bg-background text-foreground focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent",placeholder:e("login.placeholders.username"),required:!0,disabled:s})]}),a.jsxs("div",{children:[a.jsx("label",{htmlFor:"password",className:"block text-sm font-medium text-foreground mb-1",children:e("login.password")}),a.jsx("input",{type:"password",id:"password",value:n,onChange:p=>i(p.target.value),className:"w-full px-3 py-2 border border-border rounded-md bg-background text-foreground focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent",placeholder:e("login.placeholders.password"),required:!0,disabled:s})]}),l&&a.jsx("div",{className:"p-3 bg-red-100 dark:bg-red-900/20 border border-red-300 dark:border-red-800 rounded-md",children:a.jsx("p",{className:"text-sm text-red-700 dark:text-red-400",children:l})}),a.jsx("button",{type:"submit",disabled:s,className:"w-full bg-blue-600 hover:bg-blue-700 disabled:bg-blue-400 text-white font-medium py-2 px-4 rounded-md transition-colors duration-200",children:e(s?"login.loading":"login.submit")})]}),a.jsx("div",{className:"text-center",children:a.jsx("p",{className:"text-sm text-muted-foreground",children:"Enter your credentials to access Claude Code UI"})})]})})})},rH=({onComplete:e})=>{const[t,r]=x.useState(0),[n,i]=x.useState(""),[s,o]=x.useState(""),[l,c]=x.useState(!1),[d,u]=x.useState(""),[p,h]=x.useState(null),[m]=x.useState({name:"default",fullPath:""}),[g,f]=x.useState({authenticated:!1,email:null,loading:!0,error:null}),[w,S]=x.useState({authenticated:!1,email:null,loading:!0,error:null}),[k,E]=x.useState({authenticated:!1,email:null,loading:!0,error:null}),{user:N}=is(),C=x.useRef(void 0);x.useEffect(()=>{v()},[]);const v=async()=>{try{const R=await Ce("/api/user/git-config");if(R.ok){const F=await R.json();F.gitName&&i(F.gitName),F.gitEmail&&o(F.gitEmail)}}catch(R){console.error("Error loading git config:",R)}};x.useEffect(()=>{const R=C.current;C.current=p,(R===void 0||R!==null&&p===null)&&(I(),M(),j())},[p]);const I=async()=>{try{const R=await Ce("/api/cli/claude/status");if(R.ok){const F=await R.json();f({authenticated:F.authenticated,email:F.email,loading:!1,error:F.error||null})}else f({authenticated:!1,email:null,loading:!1,error:"Failed to check authentication status"})}catch(R){console.error("Error checking Claude auth status:",R),f({authenticated:!1,email:null,loading:!1,error:R.message})}},M=async()=>{try{const R=await Ce("/api/cli/cursor/status");if(R.ok){const F=await R.json();S({authenticated:F.authenticated,email:F.email,loading:!1,error:F.error||null})}else S({authenticated:!1,email:null,loading:!1,error:"Failed to check authentication status"})}catch(R){console.error("Error checking Cursor auth status:",R),S({authenticated:!1,email:null,loading:!1,error:R.message})}},j=async()=>{try{const R=await Ce("/api/cli/codex/status");if(R.ok){const F=await R.json();E({authenticated:F.authenticated,email:F.email,loading:!1,error:F.error||null})}else E({authenticated:!1,email:null,loading:!1,error:"Failed to check authentication status"})}catch(R){console.error("Error checking Codex auth status:",R),E({authenticated:!1,email:null,loading:!1,error:R.message})}},T=()=>h("claude"),P=()=>h("cursor"),q=()=>h("codex"),D=R=>{R===0&&(p==="claude"?I():p==="cursor"?M():p==="codex"&&j())},z=async()=>{if(u(""),t===0){if(!n.trim()||!s.trim()){u("Both git name and email are required");return}if(!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(s)){u("Please enter a valid email address");return}c(!0);try{const F=await Ce("/api/user/git-config",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({gitName:n,gitEmail:s})});if(!F.ok){const te=await F.json();throw new Error(te.error||"Failed to save git configuration")}r(t+1)}catch(F){u(F.message)}finally{c(!1)}return}r(t+1)},U=()=>{u(""),r(t-1)},G=async()=>{c(!0),u("");try{const R=await Ce("/api/user/complete-onboarding",{method:"POST"});if(!R.ok){const F=await R.json();throw new Error(F.error||"Failed to complete onboarding")}e&&e()}catch(R){u(R.message)}finally{c(!1)}},re=[{title:"Git Configuration",description:"Set up your git identity for commits",icon:qn,required:!0},{title:"Connect Agents",description:"Connect your AI coding assistants",icon:g4,required:!1}],K=()=>{switch(t){case 0:return a.jsxs("div",{className:"space-y-6",children:[a.jsxs("div",{className:"text-center mb-8",children:[a.jsx("div",{className:"w-16 h-16 bg-blue-100 dark:bg-blue-900/30 rounded-full flex items-center justify-center mx-auto mb-4",children:a.jsx(qn,{className:"w-8 h-8 text-blue-600 dark:text-blue-400"})}),a.jsx("h2",{className:"text-2xl font-bold text-foreground mb-2",children:"Git Configuration"}),a.jsx("p",{className:"text-muted-foreground",children:"Configure your git identity to ensure proper attribution for your commits"})]}),a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{children:[a.jsxs("label",{htmlFor:"gitName",className:"flex items-center gap-2 text-sm font-medium text-foreground mb-2",children:[a.jsx(sC,{className:"w-4 h-4"}),"Git Name ",a.jsx("span",{className:"text-red-500",children:"*"})]}),a.jsx("input",{type:"text",id:"gitName",value:n,onChange:R=>i(R.target.value),className:"w-full px-4 py-3 border border-border rounded-lg bg-background text-foreground focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent",placeholder:"John Doe",required:!0,disabled:l}),a.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:"This will be used as: git config --global user.name"})]}),a.jsxs("div",{children:[a.jsxs("label",{htmlFor:"gitEmail",className:"flex items-center gap-2 text-sm font-medium text-foreground mb-2",children:[a.jsx(k6,{className:"w-4 h-4"}),"Git Email ",a.jsx("span",{className:"text-red-500",children:"*"})]}),a.jsx("input",{type:"email",id:"gitEmail",value:s,onChange:R=>o(R.target.value),className:"w-full px-4 py-3 border border-border rounded-lg bg-background text-foreground focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent",placeholder:"john@example.com",required:!0,disabled:l}),a.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:"This will be used as: git config --global user.email"})]})]})]});case 1:return a.jsxs("div",{className:"space-y-6",children:[a.jsxs("div",{className:"text-center mb-6",children:[a.jsx("h2",{className:"text-2xl font-bold text-foreground mb-2",children:"Connect Your AI Agents"}),a.jsx("p",{className:"text-muted-foreground",children:"Login to one or more AI coding assistants. All are optional."})]}),a.jsxs("div",{className:"space-y-3",children:[a.jsx("div",{className:`border rounded-lg p-4 transition-colors ${g.authenticated?"bg-blue-50 dark:bg-blue-900/20 border-blue-200 dark:border-blue-800":"border-border bg-card"}`,children:a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("div",{className:"w-10 h-10 bg-blue-100 dark:bg-blue-900/30 rounded-full flex items-center justify-center",children:a.jsx(nn,{size:20})}),a.jsxs("div",{children:[a.jsxs("div",{className:"font-medium text-foreground flex items-center gap-2",children:["Claude Code",g.authenticated&&a.jsx(Cr,{className:"w-4 h-4 text-green-500"})]}),a.jsx("div",{className:"text-xs text-muted-foreground",children:g.loading?"Checking...":g.authenticated?g.email||"Connected":"Not connected"})]})]}),!g.authenticated&&!g.loading&&a.jsx("button",{onClick:T,className:"bg-blue-600 hover:bg-blue-700 text-white text-sm font-medium py-2 px-4 rounded-lg transition-colors",children:"Login"})]})}),a.jsx("div",{className:`border rounded-lg p-4 transition-colors ${w.authenticated?"bg-purple-50 dark:bg-purple-900/20 border-purple-200 dark:border-purple-800":"border-border bg-card"}`,children:a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("div",{className:"w-10 h-10 bg-purple-100 dark:bg-purple-900/30 rounded-full flex items-center justify-center",children:a.jsx(pn,{size:20})}),a.jsxs("div",{children:[a.jsxs("div",{className:"font-medium text-foreground flex items-center gap-2",children:["Cursor",w.authenticated&&a.jsx(Cr,{className:"w-4 h-4 text-green-500"})]}),a.jsx("div",{className:"text-xs text-muted-foreground",children:w.loading?"Checking...":w.authenticated?w.email||"Connected":"Not connected"})]})]}),!w.authenticated&&!w.loading&&a.jsx("button",{onClick:P,className:"bg-purple-600 hover:bg-purple-700 text-white text-sm font-medium py-2 px-4 rounded-lg transition-colors",children:"Login"})]})}),a.jsx("div",{className:`border rounded-lg p-4 transition-colors ${k.authenticated?"bg-gray-100 dark:bg-gray-800/50 border-gray-300 dark:border-gray-600":"border-border bg-card"}`,children:a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("div",{className:"w-10 h-10 bg-gray-100 dark:bg-gray-800 rounded-full flex items-center justify-center",children:a.jsx(wn,{className:"w-5 h-5"})}),a.jsxs("div",{children:[a.jsxs("div",{className:"font-medium text-foreground flex items-center gap-2",children:["OpenAI Codex",k.authenticated&&a.jsx(Cr,{className:"w-4 h-4 text-green-500"})]}),a.jsx("div",{className:"text-xs text-muted-foreground",children:k.loading?"Checking...":k.authenticated?k.email||"Connected":"Not connected"})]})]}),!k.authenticated&&!k.loading&&a.jsx("button",{onClick:q,className:"bg-gray-800 hover:bg-gray-900 dark:bg-gray-700 dark:hover:bg-gray-600 text-white text-sm font-medium py-2 px-4 rounded-lg transition-colors",children:"Login"})]})})]}),a.jsx("div",{className:"text-center text-sm text-muted-foreground pt-2",children:a.jsx("p",{children:"You can configure these later in Settings."})})]});default:return null}},ue=()=>{switch(t){case 0:return n.trim()&&s.trim()&&/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(s);case 1:return!0;default:return!1}};return a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"min-h-screen bg-background flex items-center justify-center p-4",children:a.jsxs("div",{className:"w-full max-w-2xl",children:[a.jsx("div",{className:"mb-8",children:a.jsx("div",{className:"flex items-center justify-between",children:re.map((R,F)=>a.jsxs(ir.Fragment,{children:[a.jsxs("div",{className:"flex flex-col items-center flex-1",children:[a.jsx("div",{className:`w-12 h-12 rounded-full flex items-center justify-center border-2 transition-colors duration-200 ${F<t?"bg-green-500 border-green-500 text-white":F===t?"bg-blue-600 border-blue-600 text-white":"bg-background border-border text-muted-foreground"}`,children:F<t?a.jsx(Cr,{className:"w-6 h-6"}):typeof R.icon=="function"?a.jsx(R.icon,{}):a.jsx(R.icon,{className:"w-6 h-6"})}),a.jsxs("div",{className:"mt-2 text-center",children:[a.jsx("p",{className:`text-sm font-medium ${F===t?"text-foreground":"text-muted-foreground"}`,children:R.title}),R.required&&a.jsx("span",{className:"text-xs text-red-500",children:"Required"})]})]}),F<re.length-1&&a.jsx("div",{className:`flex-1 h-0.5 mx-2 transition-colors duration-200 ${F<t?"bg-green-500":"bg-border"}`})]},F))})}),a.jsxs("div",{className:"bg-card rounded-lg shadow-lg border border-border p-8",children:[K(),d&&a.jsx("div",{className:"mt-6 p-4 bg-red-100 dark:bg-red-900/20 border border-red-300 dark:border-red-800 rounded-lg",children:a.jsx("p",{className:"text-sm text-red-700 dark:text-red-400",children:d})}),a.jsxs("div",{className:"flex items-center justify-between mt-8 pt-6 border-t border-border",children:[a.jsxs("button",{onClick:U,disabled:t===0||l,className:"flex items-center gap-2 px-4 py-2 text-sm font-medium text-muted-foreground hover:text-foreground disabled:opacity-50 disabled:cursor-not-allowed transition-colors duration-200",children:[a.jsx(Mh,{className:"w-4 h-4"}),"Previous"]}),a.jsx("div",{className:"flex items-center gap-3",children:t<re.length-1?a.jsx("button",{onClick:z,disabled:!ue()||l,className:"flex items-center gap-2 px-6 py-3 bg-blue-600 hover:bg-blue-700 disabled:bg-blue-400 disabled:cursor-not-allowed text-white font-medium rounded-lg transition-colors duration-200",children:l?a.jsxs(a.Fragment,{children:[a.jsx(Ta,{className:"w-4 h-4 animate-spin"}),"Saving..."]}):a.jsxs(a.Fragment,{children:["Next",a.jsx(Cn,{className:"w-4 h-4"})]})}):a.jsx("button",{onClick:G,disabled:l,className:"flex items-center gap-2 px-6 py-3 bg-green-600 hover:bg-green-700 disabled:bg-green-400 disabled:cursor-not-allowed text-white font-medium rounded-lg transition-colors duration-200",children:l?a.jsxs(a.Fragment,{children:[a.jsx(Ta,{className:"w-4 h-4 animate-spin"}),"Completing..."]}):a.jsxs(a.Fragment,{children:[a.jsx(Cr,{className:"w-4 h-4"}),"Complete Setup"]})})})]})]})]})}),p&&a.jsx(c3,{isOpen:!!p,onClose:()=>h(null),provider:p,project:m,onComplete:D})]})},nH=()=>a.jsx("div",{className:"min-h-screen bg-background flex items-center justify-center p-4",children:a.jsxs("div",{className:"text-center",children:[a.jsx("div",{className:"flex justify-center mb-4",children:a.jsx("div",{className:"w-16 h-16 bg-primary rounded-lg flex items-center justify-center shadow-sm",children:a.jsx(Wi,{className:"w-8 h-8 text-primary-foreground"})})}),a.jsx("h1",{className:"text-2xl font-bold text-foreground mb-2",children:"Claude Code UI"}),a.jsxs("div",{className:"flex items-center justify-center space-x-2",children:[a.jsx("div",{className:"w-2 h-2 bg-blue-500 rounded-full animate-bounce"}),a.jsx("div",{className:"w-2 h-2 bg-blue-500 rounded-full animate-bounce",style:{animationDelay:"0.1s"}}),a.jsx("div",{className:"w-2 h-2 bg-blue-500 rounded-full animate-bounce",style:{animationDelay:"0.2s"}})]}),a.jsx("p",{className:"text-muted-foreground mt-2",children:"Loading..."})]})}),aH=({children:e})=>{const{user:t,isLoading:r,needsSetup:n,hasCompletedOnboarding:i,refreshOnboardingStatus:s}=is();return r?a.jsx(nH,{}):n?a.jsx(eH,{}):t?i?e:a.jsx(rH,{onComplete:s}):a.jsx(tH,{})};function Xa(e,t){const[r,n]=x.useState(()=>{if(typeof window>"u")return t;try{const s=window.localStorage.getItem(e);return s?JSON.parse(s):t}catch(s){return console.log(s),t}});return[r,s=>{if(!(typeof window>"u"))try{const o=s instanceof Function?s(r):s;window.localStorage.setItem(e,JSON.stringify(o)),n(o)}catch(o){console.log(o)}}]}const{slice:iH,forEach:sH}=[];function oH(e){return sH.call(iH.call(arguments,1),t=>{if(t)for(const r in t)e[r]===void 0&&(e[r]=t[r])}),e}function lH(e){return typeof e!="string"?!1:[/<\s*script.*?>/i,/<\s*\/\s*script\s*>/i,/<\s*img.*?on\w+\s*=/i,/<\s*\w+\s*on\w+\s*=.*?>/i,/javascript\s*:/i,/vbscript\s*:/i,/expression\s*\(/i,/eval\s*\(/i,/alert\s*\(/i,/document\.cookie/i,/document\.write\s*\(/i,/window\.location/i,/innerHTML/i].some(r=>r.test(e))}const Z2=/^[\u0009\u0020-\u007e\u0080-\u00ff]+$/,cH=function(e,t){const n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{path:"/"},i=encodeURIComponent(t);let s=`${e}=${i}`;if(n.maxAge>0){const o=n.maxAge-0;if(Number.isNaN(o))throw new Error("maxAge should be a Number");s+=`; Max-Age=${Math.floor(o)}`}if(n.domain){if(!Z2.test(n.domain))throw new TypeError("option domain is invalid");s+=`; Domain=${n.domain}`}if(n.path){if(!Z2.test(n.path))throw new TypeError("option path is invalid");s+=`; Path=${n.path}`}if(n.expires){if(typeof n.expires.toUTCString!="function")throw new TypeError("option expires is invalid");s+=`; Expires=${n.expires.toUTCString()}`}if(n.httpOnly&&(s+="; HttpOnly"),n.secure&&(s+="; Secure"),n.sameSite)switch(typeof n.sameSite=="string"?n.sameSite.toLowerCase():n.sameSite){case!0:s+="; SameSite=Strict";break;case"lax":s+="; SameSite=Lax";break;case"strict":s+="; SameSite=Strict";break;case"none":s+="; SameSite=None";break;default:throw new TypeError("option sameSite is invalid")}return n.partitioned&&(s+="; Partitioned"),s},J2={create(e,t,r,n){let i=arguments.length>4&&arguments[4]!==void 0?arguments[4]:{path:"/",sameSite:"strict"};r&&(i.expires=new Date,i.expires.setTime(i.expires.getTime()+r*60*1e3)),n&&(i.domain=n),document.cookie=cH(e,t,i)},read(e){const t=`${e}=`,r=document.cookie.split(";");for(let n=0;n<r.length;n++){let i=r[n];for(;i.charAt(0)===" ";)i=i.substring(1,i.length);if(i.indexOf(t)===0)return i.substring(t.length,i.length)}return null},remove(e,t){this.create(e,"",-1,t)}};var dH={name:"cookie",lookup(e){let{lookupCookie:t}=e;if(t&&typeof document<"u")return J2.read(t)||void 0},cacheUserLanguage(e,t){let{lookupCookie:r,cookieMinutes:n,cookieDomain:i,cookieOptions:s}=t;r&&typeof document<"u"&&J2.create(r,e,n,i,s)}},uH={name:"querystring",lookup(e){let{lookupQuerystring:t}=e,r;if(typeof window<"u"){let{search:n}=window.location;!window.location.search&&window.location.hash?.indexOf("?")>-1&&(n=window.location.hash.substring(window.location.hash.indexOf("?")));const s=n.substring(1).split("&");for(let o=0;o<s.length;o++){const l=s[o].indexOf("=");l>0&&s[o].substring(0,l)===t&&(r=s[o].substring(l+1))}}return r}},pH={name:"hash",lookup(e){let{lookupHash:t,lookupFromHashIndex:r}=e,n;if(typeof window<"u"){const{hash:i}=window.location;if(i&&i.length>2){const s=i.substring(1);if(t){const o=s.split("&");for(let l=0;l<o.length;l++){const c=o[l].indexOf("=");c>0&&o[l].substring(0,c)===t&&(n=o[l].substring(c+1))}}if(n)return n;if(!n&&r>-1){const o=i.match(/\/([a-zA-Z-]*)/g);return Array.isArray(o)?o[typeof r=="number"?r:0]?.replace("/",""):void 0}}}return n}};let Za=null;const Q2=()=>{if(Za!==null)return Za;try{if(Za=typeof window<"u"&&window.localStorage!==null,!Za)return!1;const e="i18next.translate.boo";window.localStorage.setItem(e,"foo"),window.localStorage.removeItem(e)}catch{Za=!1}return Za};var mH={name:"localStorage",lookup(e){let{lookupLocalStorage:t}=e;if(t&&Q2())return window.localStorage.getItem(t)||void 0},cacheUserLanguage(e,t){let{lookupLocalStorage:r}=t;r&&Q2()&&window.localStorage.setItem(r,e)}};let Ja=null;const e4=()=>{if(Ja!==null)return Ja;try{if(Ja=typeof window<"u"&&window.sessionStorage!==null,!Ja)return!1;const e="i18next.translate.boo";window.sessionStorage.setItem(e,"foo"),window.sessionStorage.removeItem(e)}catch{Ja=!1}return Ja};var hH={name:"sessionStorage",lookup(e){let{lookupSessionStorage:t}=e;if(t&&e4())return window.sessionStorage.getItem(t)||void 0},cacheUserLanguage(e,t){let{lookupSessionStorage:r}=t;r&&e4()&&window.sessionStorage.setItem(r,e)}},gH={name:"navigator",lookup(e){const t=[];if(typeof navigator<"u"){const{languages:r,userLanguage:n,language:i}=navigator;if(r)for(let s=0;s<r.length;s++)t.push(r[s]);n&&t.push(n),i&&t.push(i)}return t.length>0?t:void 0}},fH={name:"htmlTag",lookup(e){let{htmlTag:t}=e,r;const n=t||(typeof document<"u"?document.documentElement:null);return n&&typeof n.getAttribute=="function"&&(r=n.getAttribute("lang")),r}},bH={name:"path",lookup(e){let{lookupFromPathIndex:t}=e;if(typeof window>"u")return;const r=window.location.pathname.match(/\/([a-zA-Z-]*)/g);return Array.isArray(r)?r[typeof t=="number"?t:0]?.replace("/",""):void 0}},xH={name:"subdomain",lookup(e){let{lookupFromSubdomainIndex:t}=e;const r=typeof t=="number"?t+1:1,n=typeof window<"u"&&window.location?.hostname?.match(/^(\w{2,5})\.(([a-z0-9-]{1,63}\.[a-z]{2,6})|localhost)/i);if(n)return n[r]}};let u3=!1;try{document.cookie,u3=!0}catch{}const p3=["querystring","cookie","localStorage","sessionStorage","navigator","htmlTag"];u3||p3.splice(1,1);const yH=()=>({order:p3,lookupQuerystring:"lng",lookupCookie:"i18next",lookupLocalStorage:"i18nextLng",lookupSessionStorage:"i18nextLng",caches:["localStorage"],excludeCacheFor:["cimode"],convertDetectedLanguage:e=>e});class m3{constructor(t){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.type="languageDetector",this.detectors={},this.init(t,r)}init(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{languageUtils:{}},r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};this.services=t,this.options=oH(r,this.options||{},yH()),typeof this.options.convertDetectedLanguage=="string"&&this.options.convertDetectedLanguage.indexOf("15897")>-1&&(this.options.convertDetectedLanguage=i=>i.replace("-","_")),this.options.lookupFromUrlIndex&&(this.options.lookupFromPathIndex=this.options.lookupFromUrlIndex),this.i18nOptions=n,this.addDetector(dH),this.addDetector(uH),this.addDetector(mH),this.addDetector(hH),this.addDetector(gH),this.addDetector(fH),this.addDetector(bH),this.addDetector(xH),this.addDetector(pH)}addDetector(t){return this.detectors[t.name]=t,this}detect(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:this.options.order,r=[];return t.forEach(n=>{if(this.detectors[n]){let i=this.detectors[n].lookup(this.options);i&&typeof i=="string"&&(i=[i]),i&&(r=r.concat(i))}}),r=r.filter(n=>n!=null&&!lH(n)).map(n=>this.options.convertDetectedLanguage(n)),this.services&&this.services.languageUtils&&this.services.languageUtils.getBestMatchFromCodes?r:r.length>0?r[0]:null}cacheUserLanguage(t){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.options.caches;r&&(this.options.excludeCacheFor&&this.options.excludeCacheFor.indexOf(t)>-1||r.forEach(n=>{this.detectors[n]&&this.detectors[n].cacheUserLanguage(t,this.options)}))}}m3.type="languageDetector";const vH={save:"Save",cancel:"Cancel",delete:"Delete",create:"Create",edit:"Edit",close:"Close",confirm:"Confirm",submit:"Submit",retry:"Retry",refresh:"Refresh",search:"Search",clear:"Clear",copy:"Copy",download:"Download",upload:"Upload",browse:"Browse"},kH={chat:"Chat",shell:"Shell",files:"Files",git:"Source Control",tasks:"Tasks"},wH={loading:"Loading...",success:"Success",error:"Error",failed:"Failed",pending:"Pending",completed:"Completed",inProgress:"In Progress"},SH={savedSuccessfully:"Saved successfully",deletedSuccessfully:"Deleted successfully",updatedSuccessfully:"Updated successfully",operationFailed:"Operation failed",networkError:"Network error. Please check your connection.",unauthorized:"Unauthorized. Please log in.",notFound:"Not found",invalidInput:"Invalid input",requiredField:"This field is required",unknownError:"An unknown error occurred"},EH={settings:"Settings",home:"Home",back:"Back",next:"Next",previous:"Previous",logout:"Logout"},NH={language:"Language",theme:"Theme",darkMode:"Dark Mode",lightMode:"Light Mode",name:"Name",description:"Description",enabled:"Enabled",disabled:"Disabled",optional:"Optional",version:"Version",select:"Select",selectAll:"Select All",deselectAll:"Deselect All"},CH={justNow:"Just now",minutesAgo:"{{count}} mins ago",hoursAgo:"{{count}} hours ago",daysAgo:"{{count}} days ago",yesterday:"Yesterday"},TH={newFile:"New File",newFolder:"New Folder",rename:"Rename",move:"Move",copyPath:"Copy Path",openInEditor:"Open in Editor"},AH={loading:"Loading Claude Code UI",settingUpWorkspace:"Setting up your workspace...",chooseProject:"Choose Your Project",selectProjectDescription:"Select a project from the sidebar to start coding with Claude. Each project contains your chat sessions and file history.",tip:"Tip",createProjectMobile:"Tap the menu button above to access projects",createProjectDesktop:"Create a new project by clicking the folder icon in the sidebar",newSession:"New Session",untitledSession:"Untitled Session",projectFiles:"Project Files"},IH={loading:"Loading files...",files:"Files",simpleView:"Simple view",compactView:"Compact view",detailedView:"Detailed view",searchPlaceholder:"Search files and folders...",clearSearch:"Clear search",name:"Name",size:"Size",modified:"Modified",permissions:"Permissions",noFilesFound:"No files found",checkProjectPath:"Check if the project path is accessible",noMatchesFound:"No matches found",tryDifferentSearch:"Try a different search term or clear the search",justNow:"just now",minAgo:"{{count}} min ago",hoursAgo:"{{count}} hours ago",daysAgo:"{{count}} days ago"},RH={title:"Create New Project",steps:{type:"Type",configure:"Configure",confirm:"Confirm"},step1:{question:"Do you already have a workspace, or would you like to create a new one?",existing:{title:"Existing Workspace",description:"I already have a workspace on my server and just need to add it to the project list"},new:{title:"New Workspace",description:"Create a new workspace, optionally clone from a GitHub repository"}},step2:{existingPath:"Workspace Path",newPath:"Workspace Path",existingPlaceholder:"/path/to/existing/workspace",newPlaceholder:"/path/to/new/workspace",existingHelp:"Full path to your existing workspace directory",newHelp:"Full path to your workspace directory",githubUrl:"GitHub URL (Optional)",githubPlaceholder:"https://github.com/username/repository",githubHelp:"Optional: provide a GitHub URL to clone a repository",githubAuth:"GitHub Authentication (Optional)",githubAuthHelp:"Only required for private repositories. Public repos can be cloned without authentication.",loadingTokens:"Loading stored tokens...",storedToken:"Stored Token",newToken:"New Token",nonePublic:"None (Public)",selectToken:"Select Token",selectTokenPlaceholder:"-- Select a token --",tokenPlaceholder:"ghp_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",tokenHelp:"This token will be used only for this operation",publicRepoInfo:"Public repositories don't require authentication. You can skip providing a token if cloning a public repo.",noTokensHelp:"No stored tokens available. You can add tokens in Settings → API Keys for easier reuse.",optionalTokenPublic:"GitHub Token (Optional for Public Repos)",tokenPublicPlaceholder:"ghp_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx (leave empty for public repos)"},step3:{reviewConfig:"Review Your Configuration",workspaceType:"Workspace Type:",existingWorkspace:"Existing Workspace",newWorkspace:"New Workspace",path:"Path:",cloneFrom:"Clone From:",authentication:"Authentication:",usingStoredToken:"Using stored token:",usingProvidedToken:"Using provided token",noAuthentication:"No authentication",sshKey:"SSH Key",existingInfo:"The workspace will be added to your project list and will be available for Claude/Cursor sessions.",newWithClone:"The repository will be cloned from this folder.",newEmpty:"The workspace will be added to your project list and will be available for Claude/Cursor sessions.",cloningRepository:"Cloning repository..."},buttons:{cancel:"Cancel",back:"Back",next:"Next",createProject:"Create Project",creating:"Creating...",cloning:"Cloning..."},errors:{selectType:"Please select whether you have an existing workspace or want to create a new one",providePath:"Please provide a workspace path",failedToCreate:"Failed to create workspace",failedToCreateFolder:"Failed to create folder"}},jH={title:"Update Available",newVersionReady:"A new version is ready",currentVersion:"Current Version",latestVersion:"Latest Version",whatsNew:"What's New:",viewFullRelease:"View full release",updateProgress:"Update Progress:",manualUpgrade:"Manual upgrade:",manualUpgradeHint:'Or click "Update Now" to run the update automatically.',updateCompleted:"Update completed successfully!",restartServer:"Please restart the server to apply changes.",updateFailed:"Update failed",buttons:{close:"Close",later:"Later",copyCommand:"Copy Command",updateNow:"Update Now",updating:"Updating..."},ariaLabels:{closeModal:"Close version upgrade modal",showSidebar:"Show sidebar",settings:"Settings",updateAvailable:"Update available",closeSidebar:"Close sidebar"}},_H={buttons:vH,tabs:kH,status:wH,messages:SH,navigation:EH,common:NH,time:CH,fileOperations:TH,mainContent:AH,fileTree:IH,projectWizard:RH,versionUpdate:jH},LH="Settings",OH={account:"Account",permissions:"Permissions",mcpServers:"MCP Servers",appearance:"Appearance"},DH={title:"Account",language:"Language",languageLabel:"Display Language",languageDescription:"Choose your preferred language for the interface",username:"Username",email:"Email",profile:"Profile",changePassword:"Change Password"},MH={title:"MCP Servers",addServer:"Add Server",editServer:"Edit Server",deleteServer:"Delete Server",serverName:"Server Name",serverType:"Server Type",config:"Configuration",testConnection:"Test Connection",status:"Status",connected:"Connected",disconnected:"Disconnected",scope:{label:"Scope",user:"User",project:"Project"}},FH={title:"Appearance",theme:"Theme",codeEditor:"Code Editor",editorTheme:"Editor Theme",wordWrap:"Word Wrap",showMinimap:"Show Minimap",lineNumbers:"Line Numbers",fontSize:"Font Size"},PH={saveChanges:"Save Changes",resetToDefaults:"Reset to Defaults",cancelChanges:"Cancel Changes"},BH={title:"Quick Settings",sections:{appearance:"Appearance",toolDisplay:"Tool Display",viewOptions:"View Options",inputSettings:"Input Settings",whisperDictation:"Whisper Dictation"},darkMode:"Dark Mode",autoExpandTools:"Auto-expand tools",showRawParameters:"Show raw parameters",showThinking:"Show thinking",autoScrollToBottom:"Auto-scroll to bottom",sendByCtrlEnter:"Send by Ctrl+Enter",sendByCtrlEnterDescription:"When enabled, pressing Ctrl+Enter will send the message instead of just Enter. This is useful for IME users to avoid accidental sends.",dragHandle:{dragging:"Dragging handle",closePanel:"Close settings panel",openPanel:"Open settings panel",draggingStatus:"Dragging...",toggleAndMove:"Click to toggle, drag to move"},whisper:{modes:{default:"Default Mode",defaultDescription:"Direct transcription of your speech",prompt:"Prompt Enhancement",promptDescription:"Transform rough ideas into clear, detailed AI prompts",vibe:"Vibe Mode",vibeDescription:"Format ideas as clear agent instructions with details"}}},zH={agents:"Agents",appearance:"Appearance",git:"Git",apiTokens:"API & Tokens",tasks:"Tasks"},UH={darkMode:{label:"Dark Mode",description:"Toggle between light and dark themes"},projectSorting:{label:"Project Sorting",description:"How projects are ordered in the sidebar",alphabetical:"Alphabetical",recentActivity:"Recent Activity"},codeEditor:{title:"Code Editor",theme:{label:"Editor Theme",description:"Default theme for the code editor"},wordWrap:{label:"Word Wrap",description:"Enable word wrapping by default in the editor"},showMinimap:{label:"Show Minimap",description:"Display a minimap for easier navigation in diff view"},lineNumbers:{label:"Show Line Numbers",description:"Display line numbers in the editor"},fontSize:{label:"Font Size",description:"Editor font size in pixels"}}},$H={title:{add:"Add MCP Server",edit:"Edit MCP Server"},importMode:{form:"Form Input",json:"JSON Import"},scope:{label:"Scope",userGlobal:"User (Global)",projectLocal:"Project (Local)",userDescription:"User scope: Available across all projects on your machine",projectDescription:"Local scope: Only available in the selected project",cannotChange:"Scope cannot be changed when editing an existing server"},fields:{serverName:"Server Name",transportType:"Transport Type",command:"Command",arguments:"Arguments (one per line)",jsonConfig:"JSON Configuration",url:"URL",envVars:"Environment Variables (KEY=value, one per line)",headers:"Headers (KEY=value, one per line)",selectProject:"Select a project..."},placeholders:{serverName:"my-server"},validation:{missingType:"Missing required field: type",stdioRequiresCommand:"stdio type requires a command field",httpRequiresUrl:"{{type}} type requires a url field",invalidJson:"Invalid JSON format",jsonHelp:"Paste your MCP server configuration in JSON format. Example formats:",jsonExampleStdio:'• stdio: {"type":"stdio","command":"npx","args":["@upstash/context7-mcp"]}',jsonExampleHttp:'• http/sse: {"type":"http","url":"https://api.example.com/mcp"}'},configDetails:"Configuration Details (from {{configFile}})",projectPath:"Path: {{path}}",actions:{cancel:"Cancel",saving:"Saving...",addServer:"Add Server",updateServer:"Update Server"}},qH={success:"Settings saved successfully!",error:"Failed to save settings",saving:"Saving..."},GH={save:"Save Settings",cancel:"Cancel"},HH={title:"Git Configuration",description:"Configure your git identity for commits. These settings will be applied globally via git config --global",name:{label:"Git Name",help:"Your name for git commits"},email:{label:"Git Email",help:"Your email for git commits"},actions:{save:"Save Configuration",saving:"Saving..."},status:{success:"Saved successfully"}},WH={title:"API Keys",description:"Generate API keys to access the external API from other applications.",newKey:{alertTitle:"⚠️ Save Your API Key",alertMessage:"This is the only time you'll see this key. Store it securely.",iveSavedIt:"I've saved it"},form:{placeholder:"API Key Name (e.g., Production Server)",createButton:"Create",cancelButton:"Cancel"},newButton:"New API Key",empty:"No API keys created yet.",list:{created:"Created:",lastUsed:"Last used:"},confirmDelete:"Are you sure you want to delete this API key?",status:{active:"Active",inactive:"Inactive"},github:{title:"GitHub Tokens",description:"Add GitHub Personal Access Tokens to clone private repositories via the external API.",descriptionAlt:"Add GitHub Personal Access Tokens to clone private repositories. You can also pass tokens directly in API requests without storing them.",addButton:"Add Token",form:{namePlaceholder:"Token Name (e.g., Personal Repos)",tokenPlaceholder:"GitHub Personal Access Token (ghp_...)",descriptionPlaceholder:"Description (optional)",addButton:"Add Token",cancelButton:"Cancel",howToCreate:"How to create a GitHub Personal Access Token →"},empty:"No GitHub tokens added yet.",added:"Added:",confirmDelete:"Are you sure you want to delete this GitHub token?"},apiDocsLink:"API Documentation",documentation:{title:"External API Documentation",description:"Learn how to use the external API to trigger Claude/Cursor sessions from your applications.",viewLink:"View API Documentation →"},loading:"Loading...",version:{updateAvailable:"Update available: v{{version}}"}},VH={checking:"Checking TaskMaster installation...",notInstalled:{title:"TaskMaster AI CLI Not Installed",description:"TaskMaster CLI is required to use task management features. Install it to get started:",installCommand:"npm install -g task-master-ai",viewOnGitHub:"View on GitHub",afterInstallation:"After installation:",steps:{restart:"Restart this application",autoAvailable:"TaskMaster features will automatically become available",initCommand:"Use task-master init in your project directory"}},settings:{enableLabel:"Enable TaskMaster Integration",enableDescription:"Show TaskMaster tasks, banners, and sidebar indicators across the interface"}},KH={authStatus:{checking:"Checking...",connected:"Connected",notConnected:"Not connected",disconnected:"Disconnected",checkingAuth:"Checking authentication status...",loggedInAs:"Logged in as {{email}}",authenticatedUser:"authenticated user"},account:{claude:{description:"Anthropic Claude AI assistant"},cursor:{description:"Cursor AI-powered code editor"},codex:{description:"OpenAI Codex AI assistant"}},connectionStatus:"Connection Status",login:{title:"Login",reAuthenticate:"Re-authenticate",description:"Sign in to your {{agent}} account to enable AI features",reAuthDescription:"Sign in with a different account or refresh credentials",button:"Login",reLoginButton:"Re-login"},error:"Error: {{error}}"},YH={title:"Permission Settings",skipPermissions:{label:"Skip permission prompts (use with caution)",claudeDescription:"Equivalent to --dangerously-skip-permissions flag",cursorDescription:"Equivalent to -f flag in Cursor CLI"},allowedTools:{title:"Allowed Tools",description:"Tools that are automatically allowed without prompting for permission",placeholder:'e.g., "Bash(git log:*)" or "Write"',quickAdd:"Quick add common tools:",empty:"No allowed tools configured"},blockedTools:{title:"Blocked Tools",description:"Tools that are automatically blocked without prompting for permission",placeholder:'e.g., "Bash(rm:*)"',empty:"No blocked tools configured"},allowedCommands:{title:"Allowed Shell Commands",description:"Shell commands that are automatically allowed without prompting",placeholder:'e.g., "Shell(ls)" or "Shell(git status)"',quickAdd:"Quick add common commands:",empty:"No allowed commands configured"},blockedCommands:{title:"Blocked Shell Commands",description:"Shell commands that are automatically blocked",placeholder:'e.g., "Shell(rm -rf)" or "Shell(sudo)"',empty:"No blocked commands configured"},toolExamples:{title:"Tool Pattern Examples:",bashGitLog:"- Allow all git log commands",bashGitDiff:"- Allow all git diff commands",write:"- Allow all Write tool usage",bashRm:"- Block all rm commands (dangerous)"},shellExamples:{title:"Shell Command Examples:",ls:"- Allow ls command",gitStatus:"- Allow git status",npmInstall:"- Allow npm install",rmRf:"- Block recursive delete"},codex:{permissionMode:"Permission Mode",description:"Controls how Codex handles file modifications and command execution",modes:{default:{title:"Default",description:"Only trusted commands (ls, cat, grep, git status, etc.) run automatically. Other commands are skipped. Can write to workspace."},acceptEdits:{title:"Accept Edits",description:"All commands run automatically within the workspace. Full auto mode with sandboxed execution."},bypassPermissions:{title:"Bypass Permissions",description:"Full system access with no restrictions. All commands run automatically with full disk and network access. Use with caution."}},technicalDetails:"Technical details",technicalInfo:{default:"sandboxMode=workspace-write, approvalPolicy=untrusted. Trusted commands: cat, cd, grep, head, ls, pwd, tail, git status/log/diff/show, find (without -exec), etc.",acceptEdits:"sandboxMode=workspace-write, approvalPolicy=never. All commands auto-execute within project directory.",bypassPermissions:"sandboxMode=danger-full-access, approvalPolicy=never. Full system access, use only in trusted environments.",overrideNote:"You can override this per-session using the mode button in the chat interface."}},actions:{add:"Add"}},XH={title:"MCP Servers",description:{claude:"Model Context Protocol servers provide additional tools and data sources to Claude",cursor:"Model Context Protocol servers provide additional tools and data sources to Cursor",codex:"Model Context Protocol servers provide additional tools and data sources to Codex"},addButton:"Add MCP Server",empty:"No MCP servers configured",serverType:"Type",scope:{local:"local",user:"user"},config:{command:"Command",url:"URL",args:"Args",environment:"Environment"},tools:{title:"Tools",count:"({{count}}):",more:"+{{count}} more"},actions:{edit:"Edit server",delete:"Delete server"},help:{title:"About Codex MCP",description:"Codex supports stdio-based MCP servers. You can add servers that extend Codex's capabilities with additional tools and resources."}},ZH={title:LH,tabs:OH,account:DH,mcp:MH,appearance:FH,actions:PH,quickSettings:BH,mainTabs:zH,appearanceSettings:UH,mcpForm:$H,saveStatus:qH,footerActions:GH,git:HH,apiKeys:WH,tasks:VH,agents:KH,permissions:YH,mcpServers:XH},JH={title:"Welcome Back",description:"Sign in to your Claude Code UI account",username:"Username",password:"Password",submit:"Sign In",loading:"Signing in...",errors:{invalidCredentials:"Invalid username or password",requiredFields:"Please fill in all fields",networkError:"Network error. Please try again."},placeholders:{username:"Enter your username",password:"Enter your password"}},QH={title:"Create Account",username:"Username",password:"Password",confirmPassword:"Confirm Password",submit:"Create Account",loading:"Creating account...",errors:{passwordMismatch:"Passwords do not match",usernameTaken:"Username is already taken",weakPassword:"Password is too weak"}},eW={title:"Sign Out",confirm:"Are you sure you want to sign out?",button:"Sign Out"},tW={login:JH,register:QH,logout:eW},rW={title:"Projects",newProject:"New Project",deleteProject:"Delete Project",renameProject:"Rename Project",noProjects:"No projects found",loadingProjects:"Loading projects...",searchPlaceholder:"Search projects...",projectNamePlaceholder:"Project name",starred:"Starred",all:"All",untitledSession:"Untitled Session",newSession:"New Session",codexSession:"Codex Session",fetchingProjects:"Fetching your Claude projects and sessions",projects:"projects",noMatchingProjects:"No matching projects",tryDifferentSearch:"Try adjusting your search term",runClaudeCli:"Run Claude CLI in a project directory to get started"},nW={title:"Claude Code UI",subtitle:"AI coding assistant interface"},aW={title:"Sessions",newSession:"New Session",deleteSession:"Delete Session",renameSession:"Rename Session",noSessions:"No sessions yet",loadingSessions:"Loading sessions...",unnamed:"Unnamed",loading:"Loading...",showMore:"Show more sessions"},iW={viewEnvironments:"View Environments",hideSidebar:"Hide sidebar",createProject:"Create new project",refresh:"Refresh projects and sessions (Ctrl+R)",renameProject:"Rename project (F2)",deleteProject:"Delete empty project (Delete)",addToFavorites:"Add to favorites",removeFromFavorites:"Remove from favorites",editSessionName:"Manually edit session name",deleteSession:"Delete this session permanently",save:"Save",cancel:"Cancel"},sW={chat:"Chat",files:"Files",git:"Git",terminal:"Terminal",tasks:"Tasks"},oW={refresh:"Refresh",settings:"Settings",collapseAll:"Collapse All",expandAll:"Expand All",cancel:"Cancel",save:"Save",delete:"Delete",rename:"Rename"},lW={active:"Active",inactive:"Inactive",thinking:"Thinking...",error:"Error",aborted:"Aborted",unknown:"Unknown"},cW={justNow:"Just now",oneMinuteAgo:"1 min ago",minutesAgo:"{{count}} mins ago",oneHourAgo:"1 hour ago",hoursAgo:"{{count}} hours ago",oneDayAgo:"1 day ago",daysAgo:"{{count}} days ago"},dW={deleteConfirm:"Are you sure you want to delete this?",renameSuccess:"Renamed successfully",deleteSuccess:"Deleted successfully",errorOccurred:"An error occurred",deleteSessionConfirm:"Are you sure you want to delete this session? This action cannot be undone.",deleteProjectConfirm:"Are you sure you want to delete this empty project? This action cannot be undone.",enterProjectPath:"Please enter a project path",deleteSessionFailed:"Failed to delete session. Please try again.",deleteSessionError:"Error deleting session. Please try again.",deleteProjectFailed:"Failed to delete project. Please try again.",deleteProjectError:"Error deleting project. Please try again.",createProjectFailed:"Failed to create project. Please try again.",createProjectError:"Error creating project. Please try again."},uW={updateAvailable:"Update available"},pW={deleteProject:"Delete Project",deleteSession:"Delete Session",confirmDelete:"Are you sure you want to delete",sessionCount_one:"This project contains {{count}} conversation.",sessionCount_other:"This project contains {{count}} conversations.",allConversationsDeleted:"All conversations will be permanently deleted.",cannotUndo:"This action cannot be undone."},mW={projects:rW,app:nW,sessions:aW,tooltips:iW,navigation:sW,actions:oW,status:lW,time:cW,messages:dW,version:uW,deleteConfirmation:pW},hW={copy:"Copy",copied:"Copied",copyCode:"Copy code"},gW={user:"U",error:"Error",tool:"Tool",claude:"Claude",cursor:"Cursor",codex:"Codex"},fW={settings:"Tool Settings",error:"Tool Error",result:"Tool Result",viewParams:"View input parameters",viewRawParams:"View raw parameters",viewDiff:"View edit diff for",creatingFile:"Creating new file:",updatingTodo:"Updating Todo List",read:"Read",readFile:"Read file",updateTodo:"Update todo list",readTodo:"Read todo list",searchResults:"results"},bW={found:"Found {{count}} {{type}}",file:"file",files:"files",pattern:"pattern:",in:"in:"},xW={updated:"File updated successfully",created:"File created successfully",written:"File written successfully",diff:"Diff",newFile:"New File",viewContent:"View file content",viewFullOutput:"View full output ({{count}} chars)",contentDisplayed:"The file content is displayed in the diff view above"},yW={title:"Interactive Prompt",waiting:"Waiting for your response in the CLI",instruction:"Please select an option in your terminal where Claude is running.",selectedOption:"✓ Claude selected option {{number}}",instructionDetail:"In the CLI, you would select this option interactively using arrow keys or by typing the number."},vW={title:"Thinking...",emoji:"💭 Thinking..."},kW={response:"JSON Response"},wW={grant:"Grant permission for {{tool}}",added:"Permission added",addTo:"Adds {{entry}} to Allowed Tools.",retry:"Permission saved. Retry the request to use the tool.",error:"Unable to update permissions. Please try again.",openSettings:"Open settings"},SW={updated:"Todo list has been updated successfully",current:"Current Todo List"},EW={viewPlan:"📋 View implementation plan",title:"Implementation Plan"},NW={resetAt:"Claude usage limit reached. Your limit will reset at **{{time}} {{timezone}}** - {{date}}"},CW={permissionMode:"Permission Mode",modes:{default:"Default Mode",acceptEdits:"Accept Edits",bypassPermissions:"Bypass Permissions",plan:"Plan Mode"},descriptions:{default:"Only trusted commands (ls, cat, grep, git status, etc.) run automatically. Other commands are skipped. Can write to workspace.",acceptEdits:"All commands run automatically within the workspace. Full auto mode with sandboxed execution.",bypassPermissions:"Full system access with no restrictions. All commands run automatically with full disk and network access. Use with caution.",plan:"Planning mode - no commands are executed"},technicalDetails:"Technical details"},TW={placeholder:"Type / for commands, @ for files, or ask {{provider}} anything...",placeholderDefault:"Type your message...",disabled:"Input disabled",attachFiles:"Attach files",attachImages:"Attach images",send:"Send",stop:"Stop",hintText:{ctrlEnter:"Ctrl+Enter to send • Shift+Enter for new line • Tab to change modes • / for slash commands",enter:"Enter to send • Shift+Enter for new line • Tab to change modes • / for slash commands"},clickToChangeMode:"Click to change permission mode (or press Tab in input)",showAllCommands:"Show all commands"},AW={selector:{title:"Thinking Mode",description:"Extended thinking gives Claude more time to evaluate alternatives",active:"Active",tip:"Higher thinking modes take more time but provide more thorough analysis"},modes:{none:{name:"Standard",description:"Regular Claude response",prefix:""},think:{name:"Think",description:"Basic extended thinking",prefix:"think"},thinkHard:{name:"Think Hard",description:"More thorough evaluation",prefix:"think hard"},thinkHarder:{name:"Think Harder",description:"Deep analysis with alternatives",prefix:"think harder"},ultrathink:{name:"Ultrathink",description:"Maximum thinking budget",prefix:"ultrathink"}},buttonTitle:"Thinking mode: {{mode}}"},IW={title:"Choose Your AI Assistant",description:"Select a provider to start a new conversation",selectModel:"Select Model",providerInfo:{anthropic:"by Anthropic",openai:"by OpenAI",cursorEditor:"AI Code Editor"},readyPrompt:{claude:"Ready to use Claude with {{model}}. Start typing your message below.",cursor:"Ready to use Cursor with {{model}}. Start typing your message below.",codex:"Ready to use Codex with {{model}}. Start typing your message below.",default:"Select a provider above to begin"}},RW={continue:{title:"Continue your conversation",description:"Ask questions about your code, request changes, or get help with development tasks"},loading:{olderMessages:"Loading older messages...",sessionMessages:"Loading session messages..."},messages:{showingOf:"Showing {{shown}} of {{total}} messages",scrollToLoad:"Scroll up to load more",showingLast:"Showing last {{count}} messages ({{total}} total)",loadEarlier:"Load earlier messages"}},jW={selectProject:{title:"Select a Project",description:"Choose a project to open an interactive shell in that directory"},status:{newSession:"New Session",initializing:"Initializing...",restarting:"Restarting..."},actions:{disconnect:"Disconnect",disconnectTitle:"Disconnect from shell",restart:"Restart",restartTitle:"Restart Shell (disconnect first)",connect:"Continue in Shell",connectTitle:"Connect to shell"},loading:"Loading terminal...",connecting:"Connecting to shell...",startSession:"Start a new Claude session",resumeSession:"Resume session: {{displayName}}...",runCommand:"Run {{command}} in {{projectName}}",startCli:"Starting Claude CLI in {{projectName}}",defaultCommand:"command"},_W={codeBlock:hW,messageTypes:gW,tools:fW,search:bW,fileOperations:xW,interactive:yW,thinking:vW,json:kW,permissions:wW,todo:SW,plan:EW,usageLimit:NW,codex:CW,input:TW,thinkingMode:AW,providerSelection:IW,session:RW,shell:jW},LW={changes:"changes",previousChange:"Previous change",nextChange:"Next change",hideDiff:"Hide diff highlighting",showDiff:"Show diff highlighting",settings:"Editor Settings",collapse:"Collapse editor",expand:"Expand editor to full width"},OW="Loading {{fileName}}...",DW={showingChanges:"Showing changes"},MW={download:"Download file",save:"Save",saving:"Saving...",saved:"Saved!",exitFullscreen:"Exit fullscreen",fullscreen:"Fullscreen",close:"Close"},FW={lines:"Lines:",characters:"Characters:",shortcuts:"Press Ctrl+S to save • Esc to close"},PW={toolbar:LW,loading:OW,header:DW,actions:MW,footer:FW},BW={save:"保存",cancel:"取消",delete:"删除",create:"创建",edit:"编辑",close:"关闭",confirm:"确认",submit:"提交",retry:"重试",refresh:"刷新",search:"搜索",clear:"清除",copy:"复制",download:"下载",upload:"上传",browse:"浏览"},zW={chat:"聊天",shell:"终端",files:"文件",git:"源代码管理",tasks:"任务"},UW={loading:"加载中...",success:"成功",error:"错误",failed:"失败",pending:"待处理",completed:"已完成",inProgress:"进行中"},$W={savedSuccessfully:"保存成功",deletedSuccessfully:"删除成功",updatedSuccessfully:"更新成功",operationFailed:"操作失败",networkError:"网络错误,请检查您的连接。",unauthorized:"未授权,请登录。",notFound:"未找到",invalidInput:"输入无效",requiredField:"此字段为必填项",unknownError:"发生未知错误"},qW={settings:"设置",home:"首页",back:"返回",next:"下一步",previous:"上一步",logout:"退出登录"},GW={language:"语言",theme:"主题",darkMode:"深色模式",lightMode:"浅色模式",name:"名称",description:"描述",enabled:"已启用",disabled:"已禁用",optional:"可选",version:"版本",select:"选择",selectAll:"全选",deselectAll:"取消全选"},HW={justNow:"刚刚",minutesAgo:"{{count}} 分钟前",hoursAgo:"{{count}} 小时前",daysAgo:"{{count}} 天前",yesterday:"昨天"},WW={newFile:"新建文件",newFolder:"新建文件夹",rename:"重命名",move:"移动",copyPath:"复制路径",openInEditor:"在编辑器中打开"},VW={loading:"正在加载 Claude Code UI",settingUpWorkspace:"正在设置您的工作空间...",chooseProject:"选择您的项目",selectProjectDescription:"从侧边栏选择一个项目以开始使用 Claude 进行编程。每个项目包含您的聊天会话和文件历史。",tip:"提示",createProjectMobile:"点击上方的菜单按钮以访问项目",createProjectDesktop:"点击侧边栏中的文件夹图标以创建新项目",newSession:"新会话",untitledSession:"未命名会话",projectFiles:"项目文件"},KW={loading:"正在加载文件...",files:"文件",simpleView:"简单视图",compactView:"紧凑视图",detailedView:"详细视图",searchPlaceholder:"搜索文件和文件夹...",clearSearch:"清除搜索",name:"名称",size:"大小",modified:"修改时间",permissions:"权限",noFilesFound:"未找到文件",checkProjectPath:"检查项目路径是否可访问",noMatchesFound:"未找到匹配项",tryDifferentSearch:"尝试不同的搜索词或清除搜索",justNow:"刚刚",minAgo:"{{count}} 分钟前",hoursAgo:"{{count}} 小时前",daysAgo:"{{count}} 天前"},YW={title:"创建新项目",steps:{type:"类型",configure:"配置",confirm:"确认"},step1:{question:"您已经有工作区,还是想创建一个新的工作区?",existing:{title:"现有工作区",description:"我的服务器上已经有工作区,只需要将其添加到项目列表中"},new:{title:"新建工作区",description:"创建一个新工作区,可选择从 GitHub 仓库克隆"}},step2:{existingPath:"工作区路径",newPath:"工作区路径",existingPlaceholder:"/path/to/existing/workspace",newPlaceholder:"/path/to/new/workspace",existingHelp:"您现有工作区目录的完整路径",newHelp:"工作区目录的完整路径",githubUrl:"GitHub URL(可选)",githubPlaceholder:"https://github.com/username/repository",githubHelp:"可选:提供 GitHub URL 以克隆仓库",githubAuth:"GitHub 身份验证(可选)",githubAuthHelp:"仅私有仓库需要。公共仓库无需身份验证即可克隆。",loadingTokens:"正在加载已保存的令牌...",storedToken:"已保存的令牌",newToken:"新令牌",nonePublic:"无(公共)",selectToken:"选择令牌",selectTokenPlaceholder:"-- 选择令牌 --",tokenPlaceholder:"ghp_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",tokenHelp:"此令牌仅用于此操作",publicRepoInfo:"公共仓库不需要身份验证。如果克隆公共仓库,可以跳过提供令牌。",noTokensHelp:"没有可用的已保存令牌。您可以在 设置 → API 密钥 中添加令牌以便重复使用。",optionalTokenPublic:"GitHub 令牌(公共仓库可选)",tokenPublicPlaceholder:"ghp_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx(公共仓库可留空)"},step3:{reviewConfig:"查看您的配置",workspaceType:"工作区类型:",existingWorkspace:"现有工作区",newWorkspace:"新建工作区",path:"路径:",cloneFrom:"克隆自:",authentication:"身份验证:",usingStoredToken:"使用已保存的令牌:",usingProvidedToken:"使用提供的令牌",noAuthentication:"无身份验证",sshKey:"SSH 密钥",existingInfo:"工作区将被添加到您的项目列表中,并可用于 Claude/Cursor 会话。",newWithClone:"仓库将从此文件夹克隆。",newEmpty:"工作区将被添加到您的项目列表中,并可用于 Claude/Cursor 会话。",cloningRepository:"正在克隆仓库..."},buttons:{cancel:"取消",back:"返回",next:"下一步",createProject:"创建项目",creating:"创建中...",cloning:"正在克隆..."},errors:{selectType:"请选择您已有现有工作区还是想创建新工作区",providePath:"请提供工作区路径",failedToCreate:"创建工作区失败",failedToCreateFolder:"创建文件夹失败"}},XW={title:"有可用更新",newVersionReady:"新版本已准备就绪",currentVersion:"当前版本",latestVersion:"最新版本",whatsNew:"新内容:",viewFullRelease:"查看完整发布",updateProgress:"更新进度:",manualUpgrade:"手动升级:",manualUpgradeHint:"或点击'立即更新'以自动运行更新。",updateCompleted:"更新成功完成!",restartServer:"请重启服务器以应用更改。",updateFailed:"更新失败",buttons:{close:"关闭",later:"稍后",copyCommand:"复制命令",updateNow:"立即更新",updating:"更新中..."},ariaLabels:{closeModal:"关闭版本升级模态框",showSidebar:"显示侧边栏",settings:"设置",updateAvailable:"有可用更新",closeSidebar:"关闭侧边栏"}},ZW={buttons:BW,tabs:zW,status:UW,messages:$W,navigation:qW,common:GW,time:HW,fileOperations:WW,mainContent:VW,fileTree:KW,projectWizard:YW,versionUpdate:XW},JW="设置",QW={account:"账户",permissions:"权限",mcpServers:"MCP 服务器",appearance:"外观"},eV={title:"账户",language:"语言",languageLabel:"显示语言",languageDescription:"选择您偏好的界面语言",username:"用户名",email:"邮箱",profile:"个人资料",changePassword:"修改密码"},tV={title:"MCP 服务器",addServer:"添加服务器",editServer:"编辑服务器",deleteServer:"删除服务器",serverName:"服务器名称",serverType:"服务器类型",config:"配置",testConnection:"测试连接",status:"状态",connected:"已连接",disconnected:"未连接",scope:{label:"范围",user:"用户",project:"项目"}},rV={title:"外观",theme:"主题",codeEditor:"代码编辑器",editorTheme:"编辑器主题",wordWrap:"自动换行",showMinimap:"显示缩略图",lineNumbers:"行号",fontSize:"字体大小"},nV={saveChanges:"保存更改",resetToDefaults:"重置为默认值",cancelChanges:"取消更改"},aV={title:"快速设置",sections:{appearance:"外观",toolDisplay:"工具显示",viewOptions:"视图选项",inputSettings:"输入设置",whisperDictation:"Whisper 听写"},darkMode:"深色模式",autoExpandTools:"自动展开工具",showRawParameters:"显示原始参数",showThinking:"显示思考过程",autoScrollToBottom:"自动滚动到底部",sendByCtrlEnter:"使用 Ctrl+Enter 发送",sendByCtrlEnterDescription:"启用后,按 Ctrl+Enter 发送消息,而不是仅按 Enter。这对于使用输入法的用户可以避免意外发送。",dragHandle:{dragging:"正在拖拽手柄",closePanel:"关闭设置面板",openPanel:"打开设置面板",draggingStatus:"正在拖拽...",toggleAndMove:"点击切换,拖拽移动"},whisper:{modes:{default:"默认模式",defaultDescription:"直接转录您的语音",prompt:"提示词增强",promptDescription:"将粗略的想法转化为清晰、详细的 AI 提示词",vibe:"Vibe 模式",vibeDescription:"将想法格式化为带有详细说明的清晰智能体指令"}}},iV={agents:"智能体",appearance:"外观",git:"Git",apiTokens:"API 和令牌",tasks:"任务"},sV={darkMode:{label:"深色模式",description:"切换浅色和深色主题"},projectSorting:{label:"项目排序",description:"项目在侧边栏中的排列方式",alphabetical:"按字母顺序",recentActivity:"最近活动"},codeEditor:{title:"代码编辑器",theme:{label:"编辑器主题",description:"代码编辑器的默认主题"},wordWrap:{label:"自动换行",description:"在编辑器中默认启用自动换行"},showMinimap:{label:"显示缩略图",description:"在差异视图中显示缩略图以便于导航"},lineNumbers:{label:"显示行号",description:"在编辑器中显示行号"},fontSize:{label:"字体大小",description:"编辑器字体大小(px)"}}},oV={title:{add:"添加 MCP 服务器",edit:"编辑 MCP 服务器"},importMode:{form:"表单输入",json:"JSON 导入"},scope:{label:"范围",userGlobal:"用户(全局)",projectLocal:"项目(本地)",userDescription:"用户范围:在您机器上的所有项目中可用",projectDescription:"本地范围:仅在选定项目中可用",cannotChange:"编辑现有服务器时无法更改范围"},fields:{serverName:"服务器名称",transportType:"传输类型",command:"命令",arguments:"参数(每行一个)",jsonConfig:"JSON 配置",url:"URL",envVars:"环境变量(KEY=值,每行一个)",headers:"请求头(KEY=值,每行一个)",selectProject:"选择项目..."},placeholders:{serverName:"我的服务"},validation:{missingType:"缺少必填字段:type",stdioRequiresCommand:"stdio 类型需要 command 字段",httpRequiresUrl:"{{type}} 类型需要 url 字段",invalidJson:"无效的 JSON 格式",jsonHelp:"粘贴您的 MCP 服务器配置(JSON 格式)。示例格式:",jsonExampleStdio:'• stdio: {"type":"stdio","command":"npx","args":["@upstash/context7-mcp"]}',jsonExampleHttp:'• http/sse: {"type":"http","url":"https://api.example.com/mcp"}'},configDetails:"配置详细信息(来自 {{configFile}})",projectPath:"路径:{{path}}",actions:{cancel:"取消",saving:"保存中...",addServer:"添加服务器",updateServer:"更新服务器"}},lV={success:"设置保存成功!",error:"保存设置失败",saving:"保存中..."},cV={save:"保存设置",cancel:"取消"},dV={title:"Git 配置",description:"配置您的 git 提交身份。这些设置将通过 git config --global 全局应用",name:{label:"Git 名称",help:"您的 git 提交名称"},email:{label:"Git 邮箱",help:"您的 git 提交邮箱"},actions:{save:"保存配置",saving:"保存中..."},status:{success:"保存成功"}},uV={title:"API 密钥",description:"生成 API 密钥以从其他应用访问外部 API。",newKey:{alertTitle:"⚠️ 保存您的 API 密钥",alertMessage:"这是您唯一一次看到此密钥。请妥善保存。",iveSavedIt:"我已保存"},form:{placeholder:"API 密钥名称(例如:生产服务器)",createButton:"创建",cancelButton:"取消"},newButton:"新建 API 密钥",empty:"尚未创建 API 密钥。",list:{created:"创建时间:",lastUsed:"最后使用:"},confirmDelete:"确定要删除此 API 密钥吗?",status:{active:"激活",inactive:"未激活"},github:{title:"GitHub 令牌",description:"添加 GitHub 个人访问令牌以通过外部 API 克隆私有仓库。",descriptionAlt:"添加 GitHub 个人访问令牌以克隆私有仓库。您也可以直接在 API 请求中传递令牌而无需存储。",addButton:"添加令牌",form:{namePlaceholder:"令牌名称(例如:个人仓库)",tokenPlaceholder:"GitHub 个人访问令牌(ghp_...)",descriptionPlaceholder:"描述(可选)",addButton:"添加令牌",cancelButton:"取消",howToCreate:"如何创建 GitHub 个人访问令牌 →"},empty:"尚未添加 GitHub 令牌。",added:"添加时间:",confirmDelete:"确定要删除此 GitHub 令牌吗?"},apiDocsLink:"API 文档",documentation:{title:"外部 API 文档",description:"了解如何使用外部 API 从您的应用程序触发 Claude/Cursor 会话。",viewLink:"查看 API 文档 →"},loading:"加载中...",version:{updateAvailable:"有可用更新:v{{version}}"}},pV={checking:"正在检查 TaskMaster 安装...",notInstalled:{title:"未安装 TaskMaster AI CLI",description:"需要 TaskMaster CLI 才能使用任务管理功能。安装它以开始使用:",installCommand:"npm install -g task-master-ai",viewOnGitHub:"在 GitHub 上查看",afterInstallation:"安装后:",steps:{restart:"重启此应用程序",autoAvailable:"TaskMaster 功能将自动可用",initCommand:"在项目目录中使用 task-master init"}},settings:{enableLabel:"启用 TaskMaster 集成",enableDescription:"在整个界面中显示 TaskMaster 任务、横幅和侧边栏指示器"}},mV={authStatus:{checking:"检查中...",connected:"已连接",notConnected:"未连接",disconnected:"已断开",checkingAuth:"正在检查认证状态...",loggedInAs:"登录为 {{email}}",authenticatedUser:"已认证用户"},account:{claude:{description:"Anthropic Claude AI 助手"},cursor:{description:"Cursor AI 驱动的代码编辑器"},codex:{description:"OpenAI Codex AI 助手"}},connectionStatus:"连接状态",login:{title:"登录",reAuthenticate:"重新认证",description:"登录您的 {{agent}} 账户以启用 AI 功能",reAuthDescription:"使用其他账户登录或刷新凭据",button:"登录",reLoginButton:"重新登录"},error:"错误:{{error}}"},hV={title:"权限设置",skipPermissions:{label:"跳过权限提示(请谨慎使用)",claudeDescription:"等同于 --dangerously-skip-permissions 标志",cursorDescription:"等同于 Cursor CLI 中的 -f 标志"},allowedTools:{title:"允许的工具",description:"无需权限提示即可自动使用的工具",placeholder:'例如:"Bash(git log:*)" 或 "Write"',quickAdd:"快速添加常用工具:",empty:"未配置允许的工具"},blockedTools:{title:"禁用的工具",description:"无需权限提示即可自动禁用的工具",placeholder:'例如:"Bash(rm:*)"',empty:"未配置禁用的工具"},allowedCommands:{title:"允许的 Shell 命令",description:"无需权限提示即可自动执行的 Shell 命令",placeholder:'例如:"Shell(ls)" 或 "Shell(git status)"',quickAdd:"快速添加常用命令:",empty:"未配置允许的命令"},blockedCommands:{title:"阻止的 Shell 命令",description:"自动阻止的 Shell 命令",placeholder:'例如:"Shell(rm -rf)" 或 "Shell(sudo)"',empty:"未配置阻止的命令"},toolExamples:{title:"工具模式示例:",bashGitLog:"- 允许所有 git log 命令",bashGitDiff:"- 允许所有 git diff 命令",write:"- 允许所有 Write 工具使用",bashRm:"- 阻止所有 rm 命令(危险)"},shellExamples:{title:"Shell 命令示例:",ls:"- 允许 ls 命令",gitStatus:"- 允许 git status",npmInstall:"- 允许 npm install",rmRf:"- 阻止递归删除"},codex:{permissionMode:"权限模式",description:"控制 Codex 如何处理文件修改和命令执行",modes:{default:{title:"默认",description:"只有受信任的命令(ls、cat、grep、git status 等)会自动运行。其他命令将被跳过。可以写入工作区。"},acceptEdits:{title:"接受编辑",description:"所有命令在工作区内自动运行。具有沙箱执行的全自动模式。"},bypassPermissions:{title:"绕过权限",description:"完全系统访问,无任何限制。所有命令自动运行,具有完整的磁盘和网络访问权限。请谨慎使用。"}},technicalDetails:"技术详情",technicalInfo:{default:"sandboxMode=workspace-write, approvalPolicy=untrusted。受信任的命令:cat、cd、grep、head、ls、pwd、tail、git status/log/diff/show、find(不带 -exec)等。",acceptEdits:"sandboxMode=workspace-write, approvalPolicy=never。所有命令在项目目录内自动执行。",bypassPermissions:"sandboxMode=danger-full-access, approvalPolicy=never。完全系统访问权限,仅在可信环境中使用。",overrideNote:"您可以使用聊天界面中的模式按钮按会话覆盖此设置。"}},actions:{add:"添加"}},gV={title:"MCP 服务器",description:{claude:"Model Context Protocol 服务器为 Claude 提供额外的工具和数据源",cursor:"Model Context Protocol 服务器为 Cursor 提供额外的工具和数据源",codex:"Model Context Protocol 服务器为 Codex 提供额外的工具和数据源"},addButton:"添加 MCP 服务器",empty:"未配置 MCP 服务器",serverType:"类型",scope:{local:"本地",user:"用户"},config:{command:"命令",url:"URL",args:"参数",environment:"环境变量"},tools:{title:"工具",count:"({{count}}):",more:"还有 {{count}} 个"},actions:{edit:"编辑服务器",delete:"删除服务器"},help:{title:"关于 Codex MCP",description:"Codex 支持基于 stdio 的 MCP 服务器。您可以添加服务器,通过额外的工具和资源来扩展 Codex 的功能。"}},fV={title:JW,tabs:QW,account:eV,mcp:tV,appearance:rV,actions:nV,quickSettings:aV,mainTabs:iV,appearanceSettings:sV,mcpForm:oV,saveStatus:lV,footerActions:cV,git:dV,apiKeys:uV,tasks:pV,agents:mV,permissions:hV,mcpServers:gV},bV={title:"欢迎回来",description:"登录您的 Claude Code UI 账户",username:"用户名",password:"密码",submit:"登录",loading:"登录中...",errors:{invalidCredentials:"用户名或密码无效",requiredFields:"请填写所有字段",networkError:"网络错误,请重试。"},placeholders:{username:"输入您的用户名",password:"输入您的密码"}},xV={title:"创建账户",username:"用户名",password:"密码",confirmPassword:"确认密码",submit:"创建账户",loading:"创建账户中...",errors:{passwordMismatch:"密码不匹配",usernameTaken:"用户名已被占用",weakPassword:"密码强度太弱"}},yV={title:"退出登录",confirm:"确定要退出登录吗?",button:"退出登录"},vV={login:bV,register:xV,logout:yV},kV={title:"项目",newProject:"新建项目",deleteProject:"删除项目",renameProject:"重命名项目",noProjects:"未找到项目",loadingProjects:"加载项目中...",searchPlaceholder:"搜索项目...",projectNamePlaceholder:"项目名称",starred:"星标",all:"全部",untitledSession:"未命名会话",newSession:"新会话",codexSession:"Codex 会话",fetchingProjects:"正在获取您的 Claude 项目和会话",projects:"项目",noMatchingProjects:"未找到匹配的项目",tryDifferentSearch:"尝试调整您的搜索词",runClaudeCli:"在项目目录中运行 Claude CLI 以开始使用"},wV={title:"Claude Code UI",subtitle:"AI 编程助手"},SV={title:"会话",newSession:"新建会话",deleteSession:"删除会话",renameSession:"重命名会话",noSessions:"暂无会话",loadingSessions:"加载会话中...",unnamed:"未命名",loading:"加载中...",showMore:"显示更多会话"},EV={viewEnvironments:"查看环境",hideSidebar:"隐藏侧边栏",createProject:"创建新项目",refresh:"刷新项目和会话 (Ctrl+R)",renameProject:"重命名项目 (F2)",deleteProject:"删除空项目 (Delete)",addToFavorites:"添加到收藏",removeFromFavorites:"从收藏移除",editSessionName:"手动编辑会话名称",deleteSession:"永久删除此会话",save:"保存",cancel:"取消"},NV={chat:"聊天",files:"文件",git:"Git",terminal:"终端",tasks:"任务"},CV={refresh:"刷新",settings:"设置",collapseAll:"全部折叠",expandAll:"全部展开",cancel:"取消",save:"保存",delete:"删除",rename:"重命名"},TV={active:"活动",inactive:"非活动",thinking:"思考中...",error:"错误",aborted:"已中止",unknown:"未知"},AV={justNow:"刚刚",oneMinuteAgo:"1 分钟前",minutesAgo:"{{count}} 分钟前",oneHourAgo:"1 小时前",hoursAgo:"{{count}} 小时前",oneDayAgo:"1 天前",daysAgo:"{{count}} 天前"},IV={deleteConfirm:"确定要删除吗?",renameSuccess:"重命名成功",deleteSuccess:"删除成功",errorOccurred:"发生错误",deleteSessionConfirm:"确定要删除此会话吗?此操作无法撤销。",deleteProjectConfirm:"确定要删除此空项目吗?此操作无法撤销。",enterProjectPath:"请输入项目路径",deleteSessionFailed:"删除会话失败,请重试。",deleteSessionError:"删除会话时出错,请重试。",deleteProjectFailed:"删除项目失败,请重试。",deleteProjectError:"删除项目时出错,请重试。",createProjectFailed:"创建项目失败,请重试。",createProjectError:"创建项目时出错,请重试。"},RV={updateAvailable:"有可用更新"},jV={deleteProject:"删除项目",deleteSession:"删除会话",confirmDelete:"您确定要删除",sessionCount_one:"此项目包含 {{count}} 个对话。",sessionCount_other:"此项目包含 {{count}} 个对话。",allConversationsDeleted:"所有对话将被永久删除。",cannotUndo:"此操作无法撤销。"},_V={projects:kV,app:wV,sessions:SV,tooltips:EV,navigation:NV,actions:CV,status:TV,time:AV,messages:IV,version:RV,deleteConfirmation:jV},LV={copy:"复制",copied:"已复制",copyCode:"复制代码"},OV={user:"U",error:"错误",tool:"工具",claude:"Claude",cursor:"Cursor",codex:"Codex"},DV={settings:"工具设置",error:"工具错误",result:"工具结果",viewParams:"查看输入参数",viewRawParams:"查看原始参数",viewDiff:"查看编辑差异",creatingFile:"创建新文件:",updatingTodo:"更新待办事项",read:"读取",readFile:"读取文件",updateTodo:"更新待办列表",readTodo:"读取待办列表",searchResults:"结果"},MV={found:"找到 {{count}} 个{{type}}",file:"文件",files:"文件",pattern:"模式:",in:"在:"},FV={updated:"文件更新成功",created:"文件创建成功",written:"文件写入成功",diff:"差异",newFile:"新文件",viewContent:"查看文件内容",viewFullOutput:"查看完整输出({{count}} 个字符)",contentDisplayed:"文件内容显示在上面的差异视图中"},PV={title:"交互式提示",waiting:"等待您在 CLI 中响应",instruction:"请在 Claude 运行的终端中选择一个选项。",selectedOption:"✓ Claude 选择了选项 {{number}}",instructionDetail:"在 CLI 中,您可以使用方向键或输入数字来交互式地选择此选项。"},BV={title:"思考中...",emoji:"💭 思考中..."},zV={response:"JSON 响应"},UV={grant:"授予 {{tool}} 权限",added:"权限已添加",addTo:"将 {{entry}} 添加到允许的工具。",retry:"权限已保存。重试请求以使用该工具。",error:"无法更新权限。请重试。",openSettings:"打开设置"},$V={updated:"待办列表已成功更新",current:"当前待办列表"},qV={viewPlan:"📋 查看实施计划",title:"实施计划"},GV={resetAt:"Claude 使用限制已达到。您的限制将在 **{{time}} {{timezone}}** - {{date}} 重置"},HV={permissionMode:"权限模式",modes:{default:"默认模式",acceptEdits:"编辑模式",bypassPermissions:"无限制模式",plan:"计划模式"},descriptions:{default:"只有受信任的命令(ls、cat、grep、git status 等)自动运行。其他命令将被跳过。可以写入工作区。",acceptEdits:"工作区内的所有命令自动运行。完全自动模式,具有沙盒执行功能。",bypassPermissions:"完全的系统访问,无限制。所有命令自动运行,具有完整的磁盘和网络访问权限。请谨慎使用。",plan:"计划模式 - 不执行任何命令"},technicalDetails:"技术细节"},WV={placeholder:"输入 / 调用命令,@ 选择文件,或向 {{provider}} 提问...",placeholderDefault:"输入您的消息...",disabled:"输入已禁用",attachFiles:"附加文件",attachImages:"附加图片",send:"发送",stop:"停止",hintText:{ctrlEnter:"Ctrl+Enter 发送 • Shift+Enter 换行 • Tab 切换模式 • / 斜杠命令",enter:"Enter 发送 • Shift+Enter 换行 • Tab 切换模式 • / 斜杠命令"},clickToChangeMode:"点击更改权限模式(或在输入框中按 Tab)",showAllCommands:"显示所有命令"},VV={selector:{title:"思考模式",description:"扩展思考给 Claude 更多时间来评估替代方案",active:"激活",tip:"更高的思考模式需要更多时间,但提供更彻底的分析"},modes:{none:{name:"标准",description:"常规 Claude 响应",prefix:""},think:{name:"思考",description:"基本扩展思考",prefix:"思考"},thinkHard:{name:"深入思考",description:"更彻底的评估",prefix:"深入思考"},thinkHarder:{name:"更深入思考",description:"考虑替代方案的深度分析",prefix:"更深入思考"},ultrathink:{name:"超级思考",description:"最大思考预算",prefix:"超级思考"}},buttonTitle:"思考模式:{{mode}}"},KV={title:"选择您的 AI 助手",description:"选择一个供应商以开始新对话",selectModel:"选择模型",providerInfo:{anthropic:"Anthropic",openai:"OpenAI",cursorEditor:"AI 代码编辑器"},readyPrompt:{claude:"已准备好使用 Claude {{model}}。在下方输入您的消息。",cursor:"已准备好使用 Cursor {{model}}。在下方输入您的消息。",codex:"已准备好使用 Codex {{model}}。在下方输入您的消息。",default:"请在上方选择一个供应商以开始"}},YV={continue:{title:"继续您的对话",description:"询问有关代码的问题、请求更改或获取开发任务的帮助"},loading:{olderMessages:"正在加载更早的消息...",sessionMessages:"正在加载会话消息..."},messages:{showingOf:"显示 {{shown}} / {{total}} 条消息",scrollToLoad:"向上滚动以加载更多",showingLast:"显示最近 {{count}} 条消息(共 {{total}} 条)",loadEarlier:"加载更早的消息"}},XV={selectProject:{title:"选择项目",description:"选择一个项目以在该目录中打开交互式 Shell"},status:{newSession:"新会话",initializing:"初始化中...",restarting:"重启中..."},actions:{disconnect:"断开连接",disconnectTitle:"断开 Shell 连接",restart:"重启",restartTitle:"重启 Shell(请先断开连接)",connect:"在 Shell 中继续",connectTitle:"连接到 Shell"},loading:"正在加载终端...",connecting:"正在连接到 Shell...",startSession:"启动新的 Claude 会话",resumeSession:"恢复会话:{{displayName}}...",runCommand:"在 {{projectName}} 中运行 {{command}}",startCli:"在 {{projectName}} 中启动 Claude CLI",defaultCommand:"命令"},ZV={codeBlock:LV,messageTypes:OV,tools:DV,search:MV,fileOperations:FV,interactive:PV,thinking:BV,json:zV,permissions:UV,todo:$V,plan:qV,usageLimit:GV,codex:HV,input:WV,thinkingMode:VV,providerSelection:KV,session:YV,shell:XV},JV={changes:"个更改",previousChange:"上一个更改",nextChange:"下一个更改",hideDiff:"隐藏差异高亮",showDiff:"显示差异高亮",settings:"编辑器设置",collapse:"折叠编辑器",expand:"展开编辑器到全宽"},QV="正在加载 {{fileName}}...",eK={showingChanges:"显示更改"},tK={download:"下载文件",save:"保存",saving:"保存中...",saved:"已保存!",exitFullscreen:"退出全屏",fullscreen:"全屏",close:"关闭"},rK={lines:"行数:",characters:"字符数:",shortcuts:"按 Ctrl+S 保存 • Esc 关闭"},nK={toolbar:JV,loading:QV,header:eK,actions:tK,footer:rK},aK=()=>{try{const e=localStorage.getItem("userLanguage");return e&&jh.some(t=>t.value===e)?e:"en"}catch{return"en"}};br.use(m3).use(wT).init({resources:{en:{common:_H,settings:ZH,auth:tW,sidebar:mW,chat:_W,codeEditor:PW},"zh-CN":{common:ZW,settings:fV,auth:vV,sidebar:_V,chat:ZV,codeEditor:nK}},lng:aK(),fallbackLng:"en",debug:!1,ns:["common","settings","auth","sidebar","chat","codeEditor"],defaultNS:"common",keySeparator:".",nsSeparator:":",saveMissing:!1,interpolation:{escapeValue:!1},react:{useSuspense:!0,bindI18n:"languageChanged",bindI18nStore:!1},detection:{order:["localStorage"],lookupLocalStorage:"userLanguage",caches:["localStorage"]}});br.on("languageChanged",e=>{try{localStorage.setItem("userLanguage",e)}catch(t){console.error("Failed to save language preference:",t)}});function t4(){const e=a5(),{sessionId:t}=i5(),{t:r}=Ht("common"),{updateAvailable:n,latestVersion:i,currentVersion:s,releaseInfo:o}=l3("siteboon","claudecodeui"),[l,c]=x.useState(!1),[d,u]=x.useState([]),[p,h]=x.useState(null),[m,g]=x.useState(null),[f,w]=x.useState("chat"),[S,k]=x.useState(!1),[E,N]=x.useState(!1),[C,v]=x.useState(!0),[I,M]=x.useState(null),[j,T]=x.useState(!1),[P,q]=x.useState(!1),[D,z]=x.useState("agents"),[U,G]=x.useState(!1),[re,K]=Xa("autoExpandTools",!1),[ue,R]=Xa("showRawParameters",!1),[F,te]=Xa("showThinking",!0),[_,Z]=Xa("autoScrollToBottom",!0),[me,ke]=Xa("sendByCtrlEnter",!1),[se,_e]=Xa("sidebarVisible",!0),[oe,fe]=x.useState(new Set),[Ie,qe]=x.useState(new Set),[ze,ct]=x.useState(0),{ws:Ye,sendMessage:wt,messages:gt}=U4(),et=x.useRef(null),[Me,mt]=x.useState(!1);x.useEffect(()=>{const ie=()=>{const je=window.matchMedia("(display-mode: standalone)").matches||window.navigator.standalone||document.referrer.includes("android-app://");mt(je),document.addEventListener("touchstart",{}),je?(document.documentElement.classList.add("pwa-mode"),document.body.classList.add("pwa-mode")):(document.documentElement.classList.remove("pwa-mode"),document.body.classList.remove("pwa-mode"))};return ie(),window.matchMedia("(display-mode: standalone)").addEventListener("change",ie),()=>{window.matchMedia("(display-mode: standalone)").removeEventListener("change",ie)}},[]),x.useEffect(()=>{const ie=()=>{k(window.innerWidth<768)};return ie(),window.addEventListener("resize",ie),()=>window.removeEventListener("resize",ie)},[]),x.useEffect(()=>{xe()},[]);const Pt=(ie,je,Te,Pe)=>{if(!Te||!Pe)return!0;const Ue=ie?.find(Ke=>Ke.name===Te.name),st=je?.find(Ke=>Ke.name===Te.name);if(!Ue||!st)return!1;const Qe=Ue.sessions?.find(Ke=>Ke.id===Pe.id),J=st.sessions?.find(Ke=>Ke.id===Pe.id);return!Qe||!J?!1:Qe.id===J.id&&Qe.title===J.title&&Qe.created_at===J.created_at&&Qe.updated_at===J.updated_at};x.useEffect(()=>{if(gt.length>0){const ie=gt[gt.length-1];if(ie.type==="loading_progress"){et.current&&(clearTimeout(et.current),et.current=null),M(ie),ie.phase==="complete"&&(et.current=setTimeout(()=>{M(null),et.current=null},500));return}if(ie.type==="projects_updated"){if(ie.changedFile&&m&&p){const Ue=ie.changedFile.replace(/\\/g,"/").split("/");Ue.length>=2&&Ue[Ue.length-1].replace(".jsonl","")===m.id&&(oe.has(m.id)||ct(Fe=>Fe+1))}if(m&&oe.has(m.id)||oe.size>0&&Array.from(oe).some(Pe=>Pe.startsWith("new-session-"))){const Pe=ie.projects;if(!Pt(d,Pe,p,m))return}const Te=ie.projects;if(u(Te),p){const Pe=Te.find(Ue=>Ue.name===p.name);Pe&&(JSON.stringify(Pe)!==JSON.stringify(p)&&h(Pe),m&&([...Pe.sessions||[],...Pe.codexSessions||[],...Pe.cursorSessions||[]].find(Qe=>Qe.id===m.id)||g(null)))}}}return()=>{et.current&&(clearTimeout(et.current),et.current=null)}},[gt,p,m,oe]);const xe=async()=>{try{v(!0);const je=await(await yt.projects()).json();for(let Te of je)try{const Pe=`/api/cursor/sessions?projectPath=${encodeURIComponent(Te.fullPath||Te.path)}`,Ue=await Ce(Pe);if(Ue.ok){const st=await Ue.json();st.success&&st.sessions?Te.cursorSessions=st.sessions:Te.cursorSessions=[]}else Te.cursorSessions=[]}catch(Pe){console.error(`Error fetching Cursor sessions for project ${Te.name}:`,Pe),Te.cursorSessions=[]}u(Te=>Te.length===0||je.some((Ue,st)=>{const Qe=Te[st];return Qe?Ue.name!==Qe.name||Ue.displayName!==Qe.displayName||Ue.fullPath!==Qe.fullPath||JSON.stringify(Ue.sessionMeta)!==JSON.stringify(Qe.sessionMeta)||JSON.stringify(Ue.sessions)!==JSON.stringify(Qe.sessions)||JSON.stringify(Ue.cursorSessions)!==JSON.stringify(Qe.cursorSessions):!0})||je.length!==Te.length?je:Te)}catch(ie){console.error("Error fetching projects:",ie)}finally{v(!1)}};window.refreshProjects=xe,window.openSettings=x.useCallback((ie="tools")=>{z(ie),q(!0)},[]),x.useEffect(()=>{if(t&&d.length>0){const ie=!m||m.id!==t;for(const je of d){let Te=je.sessions?.find(Ue=>Ue.id===t);if(Te){h(je),g({...Te,__provider:"claude"}),ie&&w("chat");return}const Pe=je.cursorSessions?.find(Ue=>Ue.id===t);if(Pe){h(je),g({...Pe,__provider:"cursor"}),ie&&w("chat");return}}}},[t,d,e]);const at=ie=>{h(ie),g(null),e("/"),S&&N(!1)},ce=ie=>{if(g(ie),f!=="git"&&f!=="preview"&&w("chat"),(localStorage.getItem("selected-provider")||"claude")==="cursor"&&sessionStorage.setItem("cursorSessionId",ie.id),S){const Te=ie.__projectName,Pe=p?.name;Te!==Pe&&N(!1)}e(`/session/${ie.id}`)},Ee=ie=>{h(ie),g(null),w("chat"),e("/"),S&&N(!1)},H=ie=>{m?.id===ie&&(g(null),e("/")),u(je=>je.map(Te=>({...Te,sessions:Te.sessions?.filter(Pe=>Pe.id!==ie)||[],sessionMeta:{...Te.sessionMeta,total:Math.max(0,(Te.sessionMeta?.total||0)-1)}})))},Y=async()=>{try{const je=await(await yt.projects()).json();if(u(Te=>je.some((Ue,st)=>{const Qe=Te[st];return Qe?Ue.name!==Qe.name||Ue.displayName!==Qe.displayName||Ue.fullPath!==Qe.fullPath||JSON.stringify(Ue.sessionMeta)!==JSON.stringify(Qe.sessionMeta)||JSON.stringify(Ue.sessions)!==JSON.stringify(Qe.sessions):!0})||je.length!==Te.length?je:Te),p){const Te=je.find(Pe=>Pe.name===p.name);if(Te&&(JSON.stringify(Te)!==JSON.stringify(p)&&h(Te),m)){const Pe=Te.sessions?.find(Ue=>Ue.id===m.id);Pe&&JSON.stringify(Pe)!==JSON.stringify(m)&&g(Pe)}}}catch(ie){console.error("Error refreshing sidebar:",ie)}},le=ie=>{p?.name===ie&&(h(null),g(null),e("/")),u(je=>je.filter(Te=>Te.name!==ie))},ve=x.useCallback(ie=>{ie&&fe(je=>new Set([...je,ie]))},[]),Ve=x.useCallback(ie=>{ie&&fe(je=>{const Te=new Set(je);return Te.delete(ie),Te})},[]),It=x.useCallback(ie=>{ie&&qe(je=>new Set([...je,ie]))},[]),ft=x.useCallback(ie=>{ie&&qe(je=>{const Te=new Set(je);return Te.delete(ie),Te})},[]),Rt=x.useCallback(ie=>{ie&&fe(je=>{const Te=new Set;for(const Pe of je)Pe.startsWith("new-session-")||Te.add(Pe);return Te.add(ie),Te})},[]),it=()=>{const{t:ie}=Ht("common"),[je,Te]=x.useState(!1),[Pe,Ue]=x.useState(""),[st,Qe]=x.useState("");if(!l)return null;const J=Ke=>Ke?Ke.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,`
|
|
1229
1229
|
|
|
1230
1230
|
`).trim():"",Fe=async()=>{Te(!0),Ue(`Starting update...
|
|
1231
1231
|
`),Qe("");try{const Ke=await Ce("/api/system/update",{method:"POST"}),Ge=await Ke.json();Ke.ok?(Ue(dt=>dt+Ge.output+`
|
|
@@ -1236,4 +1236,4 @@ DEBUG=true`,rows:3,className:"w-full px-3 py-2 text-sm bg-background border bord
|
|
|
1236
1236
|
❌ Update failed: `+(Ge.error||"Unknown error")+`
|
|
1237
1237
|
`))}catch(Ke){Qe(Ke.message),Ue(Ge=>Ge+`
|
|
1238
1238
|
❌ Update failed: `+Ke.message+`
|
|
1239
|
-
`)}finally{Te(!1)}};return a.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center",children:[a.jsx("button",{className:"fixed inset-0 bg-black/50 backdrop-blur-sm",onClick:()=>c(!1),"aria-label":ie("versionUpdate.ariaLabels.closeModal")}),a.jsxs("div",{className:"relative bg-white dark:bg-gray-800 rounded-lg shadow-xl border border-gray-200 dark:border-gray-700 w-full max-w-2xl mx-4 p-6 space-y-4 max-h-[90vh] overflow-y-auto",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("div",{className:"w-10 h-10 bg-blue-100 dark:bg-blue-900/30 rounded-lg flex items-center justify-center",children:a.jsx("svg",{className:"w-5 h-5 text-blue-600 dark:text-blue-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:a.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"})})}),a.jsxs("div",{children:[a.jsx("h2",{className:"text-lg font-semibold text-gray-900 dark:text-white",children:ie("versionUpdate.title")}),a.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400",children:o?.title||ie("versionUpdate.newVersionReady")})]})]}),a.jsx("button",{onClick:()=>c(!1),className:"p-2 text-gray-400 hover:text-gray-600 dark:hover:text-gray-300 rounded-md hover:bg-gray-100 dark:hover:bg-gray-700",children:a.jsx("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),a.jsxs("div",{className:"space-y-3",children:[a.jsxs("div",{className:"flex justify-between items-center p-3 bg-gray-50 dark:bg-gray-700/50 rounded-lg",children:[a.jsx("span",{className:"text-sm font-medium text-gray-700 dark:text-gray-300",children:ie("versionUpdate.currentVersion")}),a.jsx("span",{className:"text-sm text-gray-900 dark:text-white font-mono",children:s})]}),a.jsxs("div",{className:"flex justify-between items-center p-3 bg-blue-50 dark:bg-blue-900/20 rounded-lg border border-blue-200 dark:border-blue-700",children:[a.jsx("span",{className:"text-sm font-medium text-blue-700 dark:text-blue-300",children:ie("versionUpdate.latestVersion")}),a.jsx("span",{className:"text-sm text-blue-900 dark:text-blue-100 font-mono",children:i})]})]}),o?.body&&a.jsxs("div",{className:"space-y-3",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx("h3",{className:"text-sm font-medium text-gray-900 dark:text-white",children:ie("versionUpdate.whatsNew")}),o?.htmlUrl&&a.jsxs("a",{href:o.htmlUrl,target:"_blank",rel:"noopener noreferrer",className:"text-xs text-blue-600 dark:text-blue-400 hover:text-blue-700 dark:hover:text-blue-300 hover:underline flex items-center gap-1",children:[ie("versionUpdate.viewFullRelease"),a.jsx("svg",{className:"w-3 h-3",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:a.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"})})]})]}),a.jsx("div",{className:"bg-gray-50 dark:bg-gray-700/50 rounded-lg p-4 border border-gray-200 dark:border-gray-600 max-h-64 overflow-y-auto",children:a.jsx("div",{className:"text-sm text-gray-700 dark:text-gray-300 whitespace-pre-wrap prose prose-sm dark:prose-invert max-w-none",children:J(o.body)})})]}),Pe&&a.jsxs("div",{className:"space-y-2",children:[a.jsx("h3",{className:"text-sm font-medium text-gray-900 dark:text-white",children:ie("versionUpdate.updateProgress")}),a.jsx("div",{className:"bg-gray-900 dark:bg-gray-950 rounded-lg p-4 border border-gray-700 max-h-48 overflow-y-auto",children:a.jsx("pre",{className:"text-xs text-green-400 font-mono whitespace-pre-wrap",children:Pe})})]}),!je&&!Pe&&a.jsxs("div",{className:"space-y-3",children:[a.jsx("h3",{className:"text-sm font-medium text-gray-900 dark:text-white",children:ie("versionUpdate.manualUpgrade")}),a.jsx("div",{className:"bg-gray-100 dark:bg-gray-800 rounded-lg p-3 border",children:a.jsx("code",{className:"text-sm text-gray-800 dark:text-gray-200 font-mono",children:"git checkout main && git pull && npm install"})}),a.jsx("p",{className:"text-xs text-gray-600 dark:text-gray-400",children:ie("versionUpdate.manualUpgradeHint")})]}),a.jsxs("div",{className:"flex gap-2 pt-2",children:[a.jsx("button",{onClick:()=>c(!1),className:"flex-1 px-4 py-2 text-sm font-medium text-gray-700 dark:text-gray-300 bg-gray-100 dark:bg-gray-700 hover:bg-gray-200 dark:hover:bg-gray-600 rounded-md transition-colors",children:ie(Pe?"versionUpdate.buttons.close":"versionUpdate.buttons.later")}),!Pe&&a.jsxs(a.Fragment,{children:[a.jsx("button",{onClick:()=>{navigator.clipboard.writeText("git checkout main && git pull && npm install")},className:"flex-1 px-4 py-2 text-sm font-medium text-gray-700 dark:text-gray-300 bg-gray-100 dark:bg-gray-700 hover:bg-gray-200 dark:hover:bg-gray-600 rounded-md transition-colors",children:ie("versionUpdate.buttons.copyCommand")}),a.jsx("button",{onClick:Fe,disabled:je,className:"flex-1 px-4 py-2 text-sm font-medium text-white bg-blue-600 hover:bg-blue-700 disabled:bg-blue-400 disabled:cursor-not-allowed rounded-md transition-colors flex items-center justify-center gap-2",children:je?a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"w-4 h-4 border-2 border-white border-t-transparent rounded-full animate-spin"}),ie("versionUpdate.buttons.updating")]}):ie("versionUpdate.buttons.updateNow")})]})]})]})]})};return a.jsxs("div",{className:"fixed inset-0 flex bg-background",children:[!S&&a.jsx("div",{className:`h-full flex-shrink-0 border-r border-border bg-card transition-all duration-300 ${se?"w-80":"w-14"}`,children:a.jsx("div",{className:"h-full overflow-hidden",children:se?a.jsx(Df,{projects:d,selectedProject:p,selectedSession:m,onProjectSelect:at,onSessionSelect:de,onNewSession:Ee,onSessionDelete:H,onProjectDelete:le,isLoading:C,loadingProgress:I,onRefresh:Y,onShowSettings:()=>q(!0),updateAvailable:n,latestVersion:i,currentVersion:s,releaseInfo:o,onShowVersionModal:()=>c(!0),isPWA:Me,isMobile:S,onToggleSidebar:()=>_e(!1)}):a.jsxs("div",{className:"h-full flex flex-col items-center py-4 gap-4",children:[a.jsx("button",{onClick:()=>_e(!0),className:"p-2 hover:bg-accent rounded-md transition-colors duration-200 group","aria-label":r("versionUpdate.ariaLabels.showSidebar"),title:r("versionUpdate.ariaLabels.showSidebar"),children:a.jsx("svg",{className:"w-5 h-5 text-foreground group-hover:scale-110 transition-transform",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M13 5l7 7-7 7M5 5l7 7-7 7"})})}),a.jsx("button",{onClick:()=>q(!0),className:"p-2 hover:bg-accent rounded-md transition-colors duration-200","aria-label":r("versionUpdate.ariaLabels.settings"),title:r("versionUpdate.ariaLabels.settings"),children:a.jsx(Ia,{className:"w-5 h-5 text-muted-foreground hover:text-foreground transition-colors"})}),n&&a.jsxs("button",{onClick:()=>c(!0),className:"relative p-2 hover:bg-accent rounded-md transition-colors duration-200","aria-label":r("versionUpdate.ariaLabels.updateAvailable"),title:r("versionUpdate.ariaLabels.updateAvailable"),children:[a.jsx(Gn,{className:"w-5 h-5 text-blue-500"}),a.jsx("span",{className:"absolute top-1 right-1 w-2 h-2 bg-blue-500 rounded-full animate-pulse"})]})]})})}),S&&a.jsxs("div",{className:`fixed inset-0 z-50 flex transition-all duration-150 ease-out ${E?"opacity-100 visible":"opacity-0 invisible"}`,children:[a.jsx("button",{className:"fixed inset-0 bg-background/80 backdrop-blur-sm transition-opacity duration-150 ease-out",onClick:ie=>{ie.stopPropagation(),N(!1)},onTouchStart:ie=>{ie.preventDefault(),ie.stopPropagation(),N(!1)},"aria-label":r("versionUpdate.ariaLabels.closeSidebar")}),a.jsx("div",{className:`relative w-[85vw] max-w-sm sm:w-80 h-full bg-card border-r border-border transform transition-transform duration-150 ease-out ${E?"translate-x-0":"-translate-x-full"}`,onClick:ie=>ie.stopPropagation(),onTouchStart:ie=>ie.stopPropagation(),children:a.jsx(Df,{projects:d,selectedProject:p,selectedSession:m,onProjectSelect:at,onSessionSelect:de,onNewSession:Ee,onSessionDelete:H,onProjectDelete:le,isLoading:C,loadingProgress:I,onRefresh:Y,onShowSettings:()=>q(!0),updateAvailable:n,latestVersion:i,currentVersion:s,releaseInfo:o,onShowVersionModal:()=>c(!0),isPWA:Me,isMobile:S,onToggleSidebar:()=>_e(!1)})})]}),a.jsx("div",{className:`flex-1 flex flex-col min-w-0 ${S&&!j?"pb-mobile-nav":""}`,children:a.jsx(LG,{selectedProject:p,selectedSession:m,activeTab:f,setActiveTab:w,ws:Ye,sendMessage:wt,messages:gt,isMobile:S,isPWA:Me,onMenuClick:()=>N(!0),isLoading:C,onInputFocusChange:T,onSessionActive:ve,onSessionInactive:Ve,onSessionProcessing:It,onSessionNotProcessing:ft,processingSessions:Ie,onReplaceTemporarySession:Rt,onNavigateToSession:ie=>e(`/session/${ie}`),onShowSettings:()=>q(!0),autoExpandTools:re,showRawParameters:ue,showThinking:F,autoScrollToBottom:_,sendByCtrlEnter:me,externalMessageUpdate:ze})}),S&&a.jsx(OG,{activeTab:f,setActiveTab:w,isInputFocused:j}),f==="chat"&&a.jsx(QG,{isOpen:U,onToggle:G,autoExpandTools:re,onAutoExpandChange:K,showRawParameters:ue,onShowRawParametersChange:R,showThinking:F,onShowThinkingChange:te,autoScrollToBottom:_,onAutoScrollChange:Z,sendByCtrlEnter:me,onSendByCtrlEnterChange:ke,isMobile:S}),a.jsx(ZG,{isOpen:P,onClose:()=>q(!1),projects:d,initialTab:D}),a.jsx(it,{})]})}function iK(){return a.jsx(RT,{i18n:br,children:a.jsx(jT,{children:a.jsx(OT,{children:a.jsx(MT,{children:a.jsx(PT,{children:a.jsx(FT,{children:a.jsx(aH,{children:a.jsx(r5,{basename:window.__ROUTER_BASENAME__||"",children:a.jsxs(n5,{children:[a.jsx(nf,{path:"/",element:a.jsx(t4,{})}),a.jsx(nf,{path:"/session/:sessionId",element:a.jsx(t4,{})})]})})})})})})})})})}"serviceWorker"in navigator&&navigator.serviceWorker.getRegistrations().then(e=>{e.forEach(t=>{t.unregister()})}).catch(e=>{console.warn("Failed to unregister service workers:",e)});u5.createRoot(document.getElementById("root")).render(a.jsx(ir.StrictMode,{children:a.jsx(iK,{})}));
|
|
1239
|
+
`)}finally{Te(!1)}};return a.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center",children:[a.jsx("button",{className:"fixed inset-0 bg-black/50 backdrop-blur-sm",onClick:()=>c(!1),"aria-label":ie("versionUpdate.ariaLabels.closeModal")}),a.jsxs("div",{className:"relative bg-white dark:bg-gray-800 rounded-lg shadow-xl border border-gray-200 dark:border-gray-700 w-full max-w-2xl mx-4 p-6 space-y-4 max-h-[90vh] overflow-y-auto",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("div",{className:"w-10 h-10 bg-blue-100 dark:bg-blue-900/30 rounded-lg flex items-center justify-center",children:a.jsx("svg",{className:"w-5 h-5 text-blue-600 dark:text-blue-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:a.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"})})}),a.jsxs("div",{children:[a.jsx("h2",{className:"text-lg font-semibold text-gray-900 dark:text-white",children:ie("versionUpdate.title")}),a.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400",children:o?.title||ie("versionUpdate.newVersionReady")})]})]}),a.jsx("button",{onClick:()=>c(!1),className:"p-2 text-gray-400 hover:text-gray-600 dark:hover:text-gray-300 rounded-md hover:bg-gray-100 dark:hover:bg-gray-700",children:a.jsx("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),a.jsxs("div",{className:"space-y-3",children:[a.jsxs("div",{className:"flex justify-between items-center p-3 bg-gray-50 dark:bg-gray-700/50 rounded-lg",children:[a.jsx("span",{className:"text-sm font-medium text-gray-700 dark:text-gray-300",children:ie("versionUpdate.currentVersion")}),a.jsx("span",{className:"text-sm text-gray-900 dark:text-white font-mono",children:s})]}),a.jsxs("div",{className:"flex justify-between items-center p-3 bg-blue-50 dark:bg-blue-900/20 rounded-lg border border-blue-200 dark:border-blue-700",children:[a.jsx("span",{className:"text-sm font-medium text-blue-700 dark:text-blue-300",children:ie("versionUpdate.latestVersion")}),a.jsx("span",{className:"text-sm text-blue-900 dark:text-blue-100 font-mono",children:i})]})]}),o?.body&&a.jsxs("div",{className:"space-y-3",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx("h3",{className:"text-sm font-medium text-gray-900 dark:text-white",children:ie("versionUpdate.whatsNew")}),o?.htmlUrl&&a.jsxs("a",{href:o.htmlUrl,target:"_blank",rel:"noopener noreferrer",className:"text-xs text-blue-600 dark:text-blue-400 hover:text-blue-700 dark:hover:text-blue-300 hover:underline flex items-center gap-1",children:[ie("versionUpdate.viewFullRelease"),a.jsx("svg",{className:"w-3 h-3",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:a.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"})})]})]}),a.jsx("div",{className:"bg-gray-50 dark:bg-gray-700/50 rounded-lg p-4 border border-gray-200 dark:border-gray-600 max-h-64 overflow-y-auto",children:a.jsx("div",{className:"text-sm text-gray-700 dark:text-gray-300 whitespace-pre-wrap prose prose-sm dark:prose-invert max-w-none",children:J(o.body)})})]}),Pe&&a.jsxs("div",{className:"space-y-2",children:[a.jsx("h3",{className:"text-sm font-medium text-gray-900 dark:text-white",children:ie("versionUpdate.updateProgress")}),a.jsx("div",{className:"bg-gray-900 dark:bg-gray-950 rounded-lg p-4 border border-gray-700 max-h-48 overflow-y-auto",children:a.jsx("pre",{className:"text-xs text-green-400 font-mono whitespace-pre-wrap",children:Pe})})]}),!je&&!Pe&&a.jsxs("div",{className:"space-y-3",children:[a.jsx("h3",{className:"text-sm font-medium text-gray-900 dark:text-white",children:ie("versionUpdate.manualUpgrade")}),a.jsx("div",{className:"bg-gray-100 dark:bg-gray-800 rounded-lg p-3 border",children:a.jsx("code",{className:"text-sm text-gray-800 dark:text-gray-200 font-mono",children:"git checkout main && git pull && npm install"})}),a.jsx("p",{className:"text-xs text-gray-600 dark:text-gray-400",children:ie("versionUpdate.manualUpgradeHint")})]}),a.jsxs("div",{className:"flex gap-2 pt-2",children:[a.jsx("button",{onClick:()=>c(!1),className:"flex-1 px-4 py-2 text-sm font-medium text-gray-700 dark:text-gray-300 bg-gray-100 dark:bg-gray-700 hover:bg-gray-200 dark:hover:bg-gray-600 rounded-md transition-colors",children:ie(Pe?"versionUpdate.buttons.close":"versionUpdate.buttons.later")}),!Pe&&a.jsxs(a.Fragment,{children:[a.jsx("button",{onClick:()=>{navigator.clipboard.writeText("git checkout main && git pull && npm install")},className:"flex-1 px-4 py-2 text-sm font-medium text-gray-700 dark:text-gray-300 bg-gray-100 dark:bg-gray-700 hover:bg-gray-200 dark:hover:bg-gray-600 rounded-md transition-colors",children:ie("versionUpdate.buttons.copyCommand")}),a.jsx("button",{onClick:Fe,disabled:je,className:"flex-1 px-4 py-2 text-sm font-medium text-white bg-blue-600 hover:bg-blue-700 disabled:bg-blue-400 disabled:cursor-not-allowed rounded-md transition-colors flex items-center justify-center gap-2",children:je?a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"w-4 h-4 border-2 border-white border-t-transparent rounded-full animate-spin"}),ie("versionUpdate.buttons.updating")]}):ie("versionUpdate.buttons.updateNow")})]})]})]})]})};return a.jsxs("div",{className:"fixed inset-0 flex bg-background",children:[!S&&a.jsx("div",{className:`h-full flex-shrink-0 border-r border-border bg-card transition-all duration-300 ${se?"w-80":"w-14"}`,children:a.jsx("div",{className:"h-full overflow-hidden",children:se?a.jsx(Df,{projects:d,selectedProject:p,selectedSession:m,onProjectSelect:at,onSessionSelect:ce,onNewSession:Ee,onSessionDelete:H,onProjectDelete:le,isLoading:C,loadingProgress:I,onRefresh:Y,onShowSettings:()=>q(!0),updateAvailable:n,latestVersion:i,currentVersion:s,releaseInfo:o,onShowVersionModal:()=>c(!0),isPWA:Me,isMobile:S,onToggleSidebar:()=>_e(!1)}):a.jsxs("div",{className:"h-full flex flex-col items-center py-4 gap-4",children:[a.jsx("button",{onClick:()=>_e(!0),className:"p-2 hover:bg-accent rounded-md transition-colors duration-200 group","aria-label":r("versionUpdate.ariaLabels.showSidebar"),title:r("versionUpdate.ariaLabels.showSidebar"),children:a.jsx("svg",{className:"w-5 h-5 text-foreground group-hover:scale-110 transition-transform",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M13 5l7 7-7 7M5 5l7 7-7 7"})})}),a.jsx("button",{onClick:()=>q(!0),className:"p-2 hover:bg-accent rounded-md transition-colors duration-200","aria-label":r("versionUpdate.ariaLabels.settings"),title:r("versionUpdate.ariaLabels.settings"),children:a.jsx(Ia,{className:"w-5 h-5 text-muted-foreground hover:text-foreground transition-colors"})}),n&&a.jsxs("button",{onClick:()=>c(!0),className:"relative p-2 hover:bg-accent rounded-md transition-colors duration-200","aria-label":r("versionUpdate.ariaLabels.updateAvailable"),title:r("versionUpdate.ariaLabels.updateAvailable"),children:[a.jsx(Gn,{className:"w-5 h-5 text-blue-500"}),a.jsx("span",{className:"absolute top-1 right-1 w-2 h-2 bg-blue-500 rounded-full animate-pulse"})]})]})})}),S&&a.jsxs("div",{className:`fixed inset-0 z-50 flex transition-all duration-150 ease-out ${E?"opacity-100 visible":"opacity-0 invisible"}`,children:[a.jsx("button",{className:"fixed inset-0 bg-background/80 backdrop-blur-sm transition-opacity duration-150 ease-out",onClick:ie=>{ie.stopPropagation(),N(!1)},onTouchStart:ie=>{ie.preventDefault(),ie.stopPropagation(),N(!1)},"aria-label":r("versionUpdate.ariaLabels.closeSidebar")}),a.jsx("div",{className:`relative w-[85vw] max-w-sm sm:w-80 h-full bg-card border-r border-border transform transition-transform duration-150 ease-out ${E?"translate-x-0":"-translate-x-full"}`,onClick:ie=>ie.stopPropagation(),onTouchStart:ie=>ie.stopPropagation(),children:a.jsx(Df,{projects:d,selectedProject:p,selectedSession:m,onProjectSelect:at,onSessionSelect:ce,onNewSession:Ee,onSessionDelete:H,onProjectDelete:le,isLoading:C,loadingProgress:I,onRefresh:Y,onShowSettings:()=>q(!0),updateAvailable:n,latestVersion:i,currentVersion:s,releaseInfo:o,onShowVersionModal:()=>c(!0),isPWA:Me,isMobile:S,onToggleSidebar:()=>_e(!1)})})]}),a.jsx("div",{className:`flex-1 flex flex-col min-w-0 ${S&&!j?"pb-mobile-nav":""}`,children:a.jsx(LG,{selectedProject:p,selectedSession:m,activeTab:f,setActiveTab:w,ws:Ye,sendMessage:wt,messages:gt,isMobile:S,isPWA:Me,onMenuClick:()=>N(!0),isLoading:C,onInputFocusChange:T,onSessionActive:ve,onSessionInactive:Ve,onSessionProcessing:It,onSessionNotProcessing:ft,processingSessions:Ie,onReplaceTemporarySession:Rt,onNavigateToSession:ie=>e(`/session/${ie}`),onShowSettings:()=>q(!0),autoExpandTools:re,showRawParameters:ue,showThinking:F,autoScrollToBottom:_,sendByCtrlEnter:me,externalMessageUpdate:ze})}),S&&a.jsx(OG,{activeTab:f,setActiveTab:w,isInputFocused:j}),f==="chat"&&a.jsx(QG,{isOpen:U,onToggle:G,autoExpandTools:re,onAutoExpandChange:K,showRawParameters:ue,onShowRawParametersChange:R,showThinking:F,onShowThinkingChange:te,autoScrollToBottom:_,onAutoScrollChange:Z,sendByCtrlEnter:me,onSendByCtrlEnterChange:ke,isMobile:S}),a.jsx(ZG,{isOpen:P,onClose:()=>q(!1),projects:d,initialTab:D}),a.jsx(it,{})]})}function iK(){return a.jsx(RT,{i18n:br,children:a.jsx(jT,{children:a.jsx(OT,{children:a.jsx(MT,{children:a.jsx(PT,{children:a.jsx(FT,{children:a.jsx(aH,{children:a.jsx(r5,{basename:window.__ROUTER_BASENAME__||"",children:a.jsxs(n5,{children:[a.jsx(nf,{path:"/",element:a.jsx(t4,{})}),a.jsx(nf,{path:"/session/:sessionId",element:a.jsx(t4,{})})]})})})})})})})})})}"serviceWorker"in navigator&&navigator.serviceWorker.getRegistrations().then(e=>{e.forEach(t=>{t.unregister()})}).catch(e=>{console.warn("Failed to unregister service workers:",e)});u5.createRoot(document.getElementById("root")).render(a.jsx(ir.StrictMode,{children:a.jsx(iK,{})}));
|