@siteboon/claude-code-ui 1.16.2 → 1.16.3

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.
@@ -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&&gt;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:`{
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&&gt;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.16.2",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";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"}},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"],
package/dist/index.html CHANGED
@@ -25,7 +25,7 @@
25
25
 
26
26
  <!-- Prevent zoom on iOS -->
27
27
  <meta name="format-detection" content="telephone=no" />
28
- <script type="module" crossorigin src="/assets/index-CHjSV-rX.js"></script>
28
+ <script type="module" crossorigin src="/assets/index-D9u4X-u6.js"></script>
29
29
  <link rel="modulepreload" crossorigin href="/assets/vendor-react-DcyRfQm3.js">
30
30
  <link rel="modulepreload" crossorigin href="/assets/vendor-codemirror-CJLzwpLB.js">
31
31
  <link rel="modulepreload" crossorigin href="/assets/vendor-xterm-DfaPXD3y.js">
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@siteboon/claude-code-ui",
3
- "version": "1.16.2",
3
+ "version": "1.16.3",
4
4
  "description": "A web-based UI for Claude Code CLI",
5
5
  "type": "module",
6
6
  "main": "server/index.js",