@kaitranntt/ccs 7.54.0-dev.1 → 7.54.0-dev.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.
- package/README.md +1 -0
- package/dist/cursor/cursor-anthropic-response.d.ts +6 -0
- package/dist/cursor/cursor-anthropic-response.d.ts.map +1 -0
- package/dist/cursor/cursor-anthropic-response.js +190 -0
- package/dist/cursor/cursor-anthropic-response.js.map +1 -0
- package/dist/cursor/cursor-anthropic-translator.d.ts +11 -0
- package/dist/cursor/cursor-anthropic-translator.d.ts.map +1 -0
- package/dist/cursor/cursor-anthropic-translator.js +167 -0
- package/dist/cursor/cursor-anthropic-translator.js.map +1 -0
- package/dist/cursor/cursor-anthropic-types.d.ts +46 -0
- package/dist/cursor/cursor-anthropic-types.d.ts.map +1 -0
- package/dist/cursor/cursor-anthropic-types.js +3 -0
- package/dist/cursor/cursor-anthropic-types.js.map +1 -0
- package/dist/cursor/cursor-daemon-entry.d.ts.map +1 -1
- package/dist/cursor/cursor-daemon-entry.js +53 -24
- package/dist/cursor/cursor-daemon-entry.js.map +1 -1
- package/dist/cursor/cursor-models.d.ts.map +1 -1
- package/dist/cursor/cursor-models.js +36 -2
- package/dist/cursor/cursor-models.js.map +1 -1
- package/dist/glmt/sse-parser.d.ts +2 -0
- package/dist/glmt/sse-parser.d.ts.map +1 -1
- package/dist/glmt/sse-parser.js +4 -0
- package/dist/glmt/sse-parser.js.map +1 -1
- package/dist/shared/provider-preset-catalog.d.ts +1 -1
- package/dist/shared/provider-preset-catalog.d.ts.map +1 -1
- package/dist/shared/provider-preset-catalog.js +15 -0
- package/dist/shared/provider-preset-catalog.js.map +1 -1
- package/dist/ui/assets/{accounts-CZEg1_PX.js → accounts-CrNRfOOP.js} +1 -1
- package/dist/ui/assets/{alert-dialog-DhwS38kc.js → alert-dialog-0GYXcDLu.js} +1 -1
- package/dist/ui/assets/{api-sWNND4wP.js → api-Du9rjWhx.js} +1 -1
- package/dist/ui/assets/{auth-section-nJIpOcnm.js → auth-section-DMcsqZyo.js} +1 -1
- package/dist/ui/assets/{backups-section-D3A6hmrU.js → backups-section-Bu4mUdGV.js} +1 -1
- package/dist/ui/assets/{checkbox-CZrxD1iS.js → checkbox-DiyJL_k4.js} +1 -1
- package/dist/ui/assets/{claude-extension-BjInaILv.js → claude-extension-CUlLIos9.js} +1 -1
- package/dist/ui/assets/{cliproxy-BGiSCGkl.js → cliproxy-DS95Joc9.js} +1 -1
- package/dist/ui/assets/{cliproxy-control-panel-CKO2Sn9B.js → cliproxy-control-panel-BNUMUGIt.js} +1 -1
- package/dist/ui/assets/{confirm-dialog-DTKxwrat.js → confirm-dialog-DTWvVQlx.js} +1 -1
- package/dist/ui/assets/{copilot-CuRngdBg.js → copilot-p2K9Y5LR.js} +1 -1
- package/dist/ui/assets/{cursor-Dxo0uIiU.js → cursor-5SbcR5sW.js} +1 -1
- package/dist/ui/assets/{droid-Cl8QsJJL.js → droid-DxdiLHHD.js} +1 -1
- package/dist/ui/assets/{globalenv-section-C3dxxoD9.js → globalenv-section-B9l_4XUg.js} +1 -1
- package/dist/ui/assets/{health-BUifaDU7.js → health-DDs2IlMm.js} +1 -1
- package/dist/ui/assets/{index-CYo-E5rU.js → index-Cy76XBS9.js} +1 -1
- package/dist/ui/assets/{index-xayyyR26.js → index-D3yHEBlf.js} +1 -1
- package/dist/ui/assets/{index-Cw9Urr0S.js → index-JgHDFSHt.js} +3 -3
- package/dist/ui/assets/{index-CPdceT1C.js → index-X7b7NDPo.js} +1 -1
- package/dist/ui/assets/{index-BOsbrhaa.js → index-awSrtRcI.js} +1 -1
- package/dist/ui/assets/{proxy-status-widget-D94htBPb.js → proxy-status-widget-DEkHz7X-.js} +1 -1
- package/dist/ui/assets/{separator-3fBbTn-V.js → separator-BFr5KvfF.js} +1 -1
- package/dist/ui/assets/{shared-q_FNNbjD.js → shared-BwP9MOQi.js} +1 -1
- package/dist/ui/assets/{switch-5N8qBdBr.js → switch-w7IoOY5x.js} +1 -1
- package/dist/ui/assets/{updates-CubQ54J0.js → updates--SN_PZnJ.js} +1 -1
- package/dist/ui/icons/novita.svg +9 -0
- package/dist/ui/index.html +1 -1
- package/package.json +1 -1
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{j as e}from"./radix-ui-BR1vy4kf.js";import{r as l}from"./react-vendor-CNOkPC89.js";import{a as Ve,u as bs,b as zs}from"./tanstack-e99Cjjy2.js";import{d as R,C as ks,b as Cs,c as B,P as Ae,a as Z,a8 as ee,L as X,I as ce,r as Be,s as Ge,t as $e,v as Qe,w as je,a9 as As,aa as Js,ab as Ws,ac as Ys,u as Ss,ad as ze,ae as Je,af as We,ag as Ye,ah as Ps,ai as ls,aj as Xs,ak as Zs,W as Ds,al as Fe,am as Ms,Y as be,B as V,an as Ue,ao as cs,ap as et,aq as st,ar as tt,as as at,at as ds,au as us,av as nt,x as Ts,n as Xe,aw as it,ax as rt,ay as ot,m as lt,az as ct,aA as dt,aB as ut,aC as mt,aD as xt,aE as pt,aF as ht,aG as pe,T as he,p as ge,q as fe,aH as gt,aI as ft,aJ as jt,aK as ms,aL as vt,aM as Nt,aN as yt,aO as wt,aP as bt,aQ as kt,aR as Ct,Q as At,R as St,U as xs,V as ps,aS as Pt,aT as Dt,aU as Mt,aV as Tt,aW as Ot,aX as Et,aY as _t,aZ as Rt,a_ as Lt,a$ as It,b0 as Ft,b1 as Ut,S as Ht}from"./index-Cw9Urr0S.js";import{C as He}from"./default-ports-1QQSffYX.js";import{t as q}from"./notifications-B2HqRBj7.js";import{C as Os,L as W,o as me,Q as qt,l as ne,n as Es,as as Ze,R as es,p as xe,a4 as Ne,T as Se,a2 as Kt,at as _s,ar as Vt,au as Pe,Z as ye,O as Rs,h as Bt,t as Ls,av as Gt,aj as $t,X as ss,a3 as Is,m as Qt,x as zt,y as Fs,z as qe,aw as Jt,u as hs,ax as Wt,ai as Us,v as Yt,ay as gs,am as Xt,az as Hs}from"./icons-DrEfTmfX.js";import{R as ke,A as fs,D as _e,i as Zt,a as ea,P as sa}from"./proxy-status-widget-D94htBPb.js";import{C as Ce}from"./checkbox-CZrxD1iS.js";import{C as ta}from"./confirm-dialog-DTKxwrat.js";import{S as ts}from"./separator-3fBbTn-V.js";import{S as qs}from"./switch-5N8qBdBr.js";import"./utils-CzKF5WmX.js";import"./form-utils-Bcoyqxpq.js";import"./code-highlight-BRUf_pqB.js";import"./alert-dialog-DhwS38kc.js";const ve={agy:{provider:"agy",displayName:"Antigravity",defaultModel:"claude-opus-4-6-thinking",models:[{id:"claude-opus-4-6-thinking",name:"Claude Opus 4.6 Thinking",description:"Latest flagship, extended thinking",extendedContext:!1,presetMapping:{default:"claude-opus-4-6-thinking",opus:"claude-opus-4-6-thinking",sonnet:"claude-sonnet-4-6",haiku:"claude-sonnet-4-6"}},{id:"claude-sonnet-4-6",name:"Claude Sonnet 4.6",description:"Latest Sonnet with thinking budget support",presetMapping:{default:"claude-sonnet-4-6",opus:"claude-opus-4-6-thinking",sonnet:"claude-sonnet-4-6",haiku:"claude-sonnet-4-6"}},{id:"gemini-3-pro-preview",name:"Gemini 3 Pro",description:"Google latest model via Antigravity",extendedContext:!0,presetMapping:{default:"gemini-3-pro-preview",opus:"gemini-3-pro-preview",sonnet:"gemini-3-pro-preview",haiku:"gemini-3-flash-preview"}},{id:"gemini-3-flash-preview",name:"Gemini 3 Flash",description:"Fast Gemini model via Antigravity",extendedContext:!0,presetMapping:{default:"gemini-3-flash-preview",opus:"gemini-3-pro-preview",sonnet:"gemini-3-pro-preview",haiku:"gemini-3-flash-preview"}}]},gemini:{provider:"gemini",displayName:"Gemini",defaultModel:"gemini-2.5-pro",models:[{id:"gemini-3-pro-preview",name:"Gemini 3 Pro",tier:"paid",description:"Latest model, requires paid Google account",extendedContext:!0,presetMapping:{default:"gemini-3-pro-preview",opus:"gemini-3-pro-preview",sonnet:"gemini-3-pro-preview",haiku:"gemini-3-flash-preview"}},{id:"gemini-3-flash-preview",name:"Gemini 3 Flash",tier:"paid",description:"Fast Gemini 3 model, requires paid Google account",extendedContext:!0,presetMapping:{default:"gemini-3-flash-preview",opus:"gemini-3-pro-preview",sonnet:"gemini-3-pro-preview",haiku:"gemini-3-flash-preview"}},{id:"gemini-2.5-pro",name:"Gemini 2.5 Pro",description:"Stable, works with free Google account",extendedContext:!0,presetMapping:{default:"gemini-2.5-pro",opus:"gemini-2.5-pro",sonnet:"gemini-2.5-pro",haiku:"gemini-2.5-flash"}}]},codex:{provider:"codex",displayName:"Codex",defaultModel:"gpt-5.3-codex",models:[{id:"gpt-5.3-codex",name:"GPT-5.3 Codex",description:"Supports up to xhigh effort",presetMapping:{default:"gpt-5.3-codex",opus:"gpt-5.3-codex",sonnet:"gpt-5.3-codex",haiku:"gpt-5.1-codex-mini"}},{id:"gpt-5.2-codex",name:"GPT-5.2 Codex",description:"Previous stable Codex model",presetMapping:{default:"gpt-5.2-codex",opus:"gpt-5.2-codex",sonnet:"gpt-5.2-codex",haiku:"gpt-5.1-codex-mini"}},{id:"gpt-5-mini",name:"GPT-5 Mini",description:"Fast, capped at high effort (no xhigh)",presetMapping:{default:"gpt-5-mini",opus:"gpt-5.3-codex",sonnet:"gpt-5-mini",haiku:"gpt-5-mini"}},{id:"gpt-5.1-codex-max",name:"Codex Max (5.1)",description:"Legacy most capable Codex model",presetMapping:{default:"gpt-5.1-codex-max",opus:"gpt-5.1-codex-max",sonnet:"gpt-5.1-codex-max",haiku:"gpt-5.1-codex-mini"}},{id:"gpt-5.2",name:"GPT 5.2",description:"Latest GPT model",presetMapping:{default:"gpt-5.2",opus:"gpt-5.2",sonnet:"gpt-5.2",haiku:"gpt-5.2"}},{id:"gpt-5.1-codex-mini",name:"Codex Mini",description:"Fast and efficient Codex model"}]},qwen:{provider:"qwen",displayName:"Qwen",defaultModel:"qwen3-coder-plus",models:[{id:"qwen3-coder-plus",name:"Qwen3 Coder Plus",description:"Code-focused model (1M context)",presetMapping:{default:"qwen3-coder-plus",opus:"qwen3-max",sonnet:"qwen3-coder-plus",haiku:"qwen3-coder-flash"}},{id:"qwen3-max",name:"Qwen3 Max",description:"Flagship model (256K context)",presetMapping:{default:"qwen3-max",opus:"qwen3-max",sonnet:"qwen3-coder-plus",haiku:"qwen3-coder-flash"}},{id:"qwen3-max-preview",name:"Qwen3 Max Preview",description:"Preview with thinking support (256K)",presetMapping:{default:"qwen3-max-preview",opus:"qwen3-max-preview",sonnet:"qwen3-max",haiku:"qwen3-coder-flash"}},{id:"qwen3-235b",name:"Qwen3 235B",description:"Large 235B A22B model",presetMapping:{default:"qwen3-235b",opus:"qwen3-max",sonnet:"qwen3-235b",haiku:"qwen3-coder-flash"}},{id:"qwen3-vl-plus",name:"Qwen3 VL Plus",description:"Vision-language multimodal"},{id:"qwen3-coder-flash",name:"Qwen3 Coder Flash",description:"Fast code generation"},{id:"qwen3-32b",name:"Qwen3 32B",description:"Qwen3 32B model"}]},iflow:{provider:"iflow",displayName:"iFlow",defaultModel:"qwen3-coder-plus",models:[{id:"qwen3-coder-plus",name:"Qwen3 Coder Plus",description:"Recommended default for iFlow accounts",presetMapping:{default:"qwen3-coder-plus",opus:"qwen3-coder-plus",sonnet:"qwen3-coder-plus",haiku:"qwen3-coder-plus"}},{id:"qwen3-max",name:"Qwen3 Max",description:"Flagship Qwen model via iFlow"},{id:"kimi-k2",name:"Kimi K2",description:"Kimi model currently available via iFlow"},{id:"deepseek-v3.2",name:"DeepSeek V3.2",description:"Current DeepSeek V3.2 model via iFlow"},{id:"deepseek-r1",name:"DeepSeek R1",description:"Reasoning-focused DeepSeek model"},{id:"glm-4.6",name:"GLM 4.6",description:"Zhipu GLM 4.6 via iFlow"},{id:"qwen3-vl-plus",name:"Qwen3 VL Plus",description:"Vision-language model"}]},kimi:{provider:"kimi",displayName:"Kimi (Moonshot)",defaultModel:"kimi-k2.5",models:[{id:"kimi-k2.5",name:"Kimi K2.5",description:"Latest multimodal model (262K context)",presetMapping:{default:"kimi-k2.5",opus:"kimi-k2.5",sonnet:"kimi-k2-thinking",haiku:"kimi-k2"}},{id:"kimi-k2-thinking",name:"Kimi K2 Thinking",description:"Extended reasoning model",presetMapping:{default:"kimi-k2-thinking",opus:"kimi-k2.5",sonnet:"kimi-k2-thinking",haiku:"kimi-k2"}},{id:"kimi-k2",name:"Kimi K2",description:"Flagship coding model"}]},kiro:{provider:"kiro",displayName:"Kiro (AWS)",defaultModel:"kiro-claude-sonnet-4-5",models:[{id:"kiro-claude-opus-4-5",name:"Kiro Claude Opus 4.5",description:"Claude Opus 4.5 via Kiro (2.2x credit)",presetMapping:{default:"kiro-claude-opus-4-5",opus:"kiro-claude-opus-4-5",sonnet:"kiro-claude-sonnet-4-5",haiku:"kiro-claude-haiku-4-5"}},{id:"kiro-claude-sonnet-4-5",name:"Kiro Claude Sonnet 4.5",description:"Claude Sonnet 4.5 via Kiro (1.3x credit)",presetMapping:{default:"kiro-claude-sonnet-4-5",opus:"kiro-claude-opus-4-5",sonnet:"kiro-claude-sonnet-4-5",haiku:"kiro-claude-haiku-4-5"}},{id:"kiro-claude-sonnet-4",name:"Kiro Claude Sonnet 4",description:"Claude Sonnet 4 via Kiro (1.3x credit)",presetMapping:{default:"kiro-claude-sonnet-4",opus:"kiro-claude-opus-4-5",sonnet:"kiro-claude-sonnet-4",haiku:"kiro-claude-haiku-4-5"}},{id:"kiro-claude-haiku-4-5",name:"Kiro Claude Haiku 4.5",description:"Claude Haiku 4.5 via Kiro (0.4x credit)"}]},ghcp:{provider:"ghcp",displayName:"GitHub Copilot (OAuth)",defaultModel:"claude-sonnet-4.5",models:[{id:"claude-opus-4.5",name:"Claude Opus 4.5",description:"Anthropic Claude Opus 4.5 via GitHub Copilot",presetMapping:{default:"claude-opus-4.5",opus:"claude-opus-4.5",sonnet:"claude-sonnet-4.5",haiku:"claude-haiku-4.5"}},{id:"claude-sonnet-4.5",name:"Claude Sonnet 4.5",description:"Anthropic Claude Sonnet 4.5 via GitHub Copilot",presetMapping:{default:"claude-sonnet-4.5",opus:"claude-opus-4.5",sonnet:"claude-sonnet-4.5",haiku:"claude-haiku-4.5"}},{id:"claude-sonnet-4",name:"Claude Sonnet 4",description:"Anthropic Claude Sonnet 4 via GitHub Copilot"},{id:"claude-haiku-4.5",name:"Claude Haiku 4.5",description:"Anthropic Claude Haiku 4.5 via GitHub Copilot"},{id:"gpt-5.2",name:"GPT-5.2",description:"OpenAI GPT-5.2 via GitHub Copilot",presetMapping:{default:"gpt-5.2",opus:"gpt-5.2",sonnet:"gpt-5.1",haiku:"gpt-5-mini"}},{id:"gpt-5.1",name:"GPT-5.1",description:"OpenAI GPT-5.1 via GitHub Copilot"},{id:"gpt-5",name:"GPT-5",description:"OpenAI GPT-5 via GitHub Copilot"},{id:"gpt-5-mini",name:"GPT-5 Mini",description:"OpenAI GPT-5 Mini via GitHub Copilot"},{id:"gemini-3-pro",name:"Gemini 3 Pro",description:"Google Gemini 3 Pro via GitHub Copilot"}]},claude:{provider:"claude",displayName:"Claude (Anthropic)",defaultModel:"claude-sonnet-4-6",models:[{id:"claude-opus-4-6",name:"Claude Opus 4.6",description:"Latest flagship model",extendedContext:!0,presetMapping:{default:"claude-opus-4-6",opus:"claude-opus-4-6",sonnet:"claude-sonnet-4-6",haiku:"claude-haiku-4-5-20251001"}},{id:"claude-sonnet-4-6",name:"Claude Sonnet 4.6",description:"Balanced performance and speed",extendedContext:!0,presetMapping:{default:"claude-sonnet-4-6",opus:"claude-opus-4-6",sonnet:"claude-sonnet-4-6",haiku:"claude-haiku-4-5-20251001"}},{id:"claude-opus-4-5-20251101",name:"Claude Opus 4.5",description:"Most capable Claude model",extendedContext:!0,presetMapping:{default:"claude-opus-4-5-20251101",opus:"claude-opus-4-5-20251101",sonnet:"claude-sonnet-4-5-20250929",haiku:"claude-haiku-4-5-20251001"}},{id:"claude-sonnet-4-5-20250929",name:"Claude Sonnet 4.5",description:"Balanced performance and speed",extendedContext:!0,presetMapping:{default:"claude-sonnet-4-5-20250929",opus:"claude-opus-4-5-20251101",sonnet:"claude-sonnet-4-5-20250929",haiku:"claude-haiku-4-5-20251001"}},{id:"claude-sonnet-4-20250514",name:"Claude Sonnet 4",description:"Previous generation Sonnet",extendedContext:!0,presetMapping:{default:"claude-sonnet-4-20250514",opus:"claude-opus-4-5-20251101",sonnet:"claude-sonnet-4-20250514",haiku:"claude-haiku-4-5-20251001"}},{id:"claude-haiku-4-5-20251001",name:"Claude Haiku 4.5",description:"Fast and efficient"}]}},Re="ccs-internal-managed";async function aa(){try{const s=await fetch("/api/settings/auth/tokens/raw");return s.ok?(await s.json())?.apiKey?.value??Re:Re}catch{return Re}}async function Ke(s,a){const t=ve[s];if(!t)return{success:!1};const n=t.models.find(x=>x.id===t.defaultModel)||t.models[0],i=n?.presetMapping||{default:t.defaultModel,opus:t.defaultModel,sonnet:t.defaultModel,haiku:t.defaultModel},c=await aa(),o={env:{ANTHROPIC_BASE_URL:`http://127.0.0.1:${He}/api/provider/${s}`,ANTHROPIC_AUTH_TOKEN:c,ANTHROPIC_MODEL:i.default,ANTHROPIC_DEFAULT_OPUS_MODEL:i.opus,ANTHROPIC_DEFAULT_SONNET_MODEL:i.sonnet,ANTHROPIC_DEFAULT_HAIKU_MODEL:i.haiku}};try{return{success:(await fetch(`/api/settings/${s}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({settings:o})})).ok,presetName:n?.name||t.defaultModel}}catch{return{success:!1}}}function na({currentProgress:s,allSteps:a}){return e.jsx("div",{className:"flex justify-center gap-1 pt-2",children:a.map((t,n)=>e.jsx("div",{className:`w-2 h-2 rounded-full transition-colors ${s>=n?"bg-primary":"bg-muted"}`},t))})}function ia({providers:s,onSelect:a}){return e.jsx("div",{className:"grid gap-2",children:s.map(t=>e.jsxs("button",{onClick:()=>a(t.id),className:"flex items-center justify-between p-3 border rounded-lg hover:bg-muted/50 transition-colors text-left",children:[e.jsxs("div",{children:[e.jsx("div",{className:"font-medium",children:t.name}),e.jsx("div",{className:"text-xs text-muted-foreground",children:t.description})]}),e.jsx(Os,{className:"w-4 h-4 text-muted-foreground"})]},t.id))})}function ra({selectedProvider:s,providers:a,authCommand:t,isRefreshing:n,isPending:i,onBack:c,onStartAuth:u,onRefresh:o}){const[x,h]=l.useState(!1),y=async m=>{await navigator.clipboard.writeText(m),h(!0),setTimeout(()=>h(!1),2e3)};return e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"text-center space-y-3",children:[e.jsxs("p",{className:"text-sm text-muted-foreground",children:["Authenticate with ",a.find(m=>m.id===s)?.name," to add an account"]}),e.jsx(R,{onClick:u,disabled:i,className:"w-full gap-2",size:"lg",children:i?e.jsxs(e.Fragment,{children:[e.jsx(W,{className:"w-4 h-4 animate-spin"}),"Authenticating..."]}):e.jsxs(e.Fragment,{children:[e.jsx(me,{className:"w-4 h-4"}),"Authenticate in Browser"]})}),i&&e.jsx("p",{className:"text-xs text-muted-foreground",children:"Complete the OAuth flow in your browser..."})]}),e.jsxs("div",{className:"relative",children:[e.jsx("div",{className:"absolute inset-0 flex items-center",children:e.jsx("span",{className:"w-full border-t"})}),e.jsx("div",{className:"relative flex justify-center text-xs uppercase",children:e.jsx("span",{className:"bg-background px-2 text-muted-foreground",children:"Or use terminal"})})]}),e.jsx(ks,{children:e.jsxs(Cs,{className:"p-4 space-y-3",children:[e.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[e.jsx(qt,{className:"w-4 h-4"}),"Run this command in your terminal:"]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("code",{className:"flex-1 px-3 py-2 bg-muted rounded-md font-mono text-sm",children:t}),e.jsx(R,{variant:"outline",size:"icon",onClick:()=>y(t),children:x?e.jsx(ne,{className:"w-4 h-4 text-green-500"}):e.jsx(Es,{className:"w-4 h-4"})})]})]})}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs(R,{variant:"ghost",onClick:c,disabled:i,children:[e.jsx(Ze,{className:"w-4 h-4 mr-2"}),"Back"]}),e.jsxs(R,{variant:"outline",onClick:o,disabled:n||i,children:[e.jsx(es,{className:`w-4 h-4 mr-2 ${n?"animate-spin":""}`}),n?"Checking...":"Refresh Status"]})]})]})}function oa({accounts:s,privacyMode:a,onSelect:t,onAddNew:n,onBack:i}){return e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wide",children:["Select an account (",s.length,")"]}),e.jsx("div",{className:"grid gap-2 max-h-[320px] overflow-y-auto pr-1",children:s.map(c=>e.jsxs("button",{type:"button",onClick:()=>t(c),className:"flex items-center justify-between p-3 border rounded-lg hover:bg-muted/50 transition-colors text-left",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"w-8 h-8 rounded-full bg-muted flex items-center justify-center",children:e.jsx(xe,{className:"w-4 h-4 text-muted-foreground"})}),e.jsxs("div",{children:[e.jsx("div",{className:B("font-medium",a&&Ae),children:c.email||c.id}),c.isDefault&&e.jsx("div",{className:"text-xs text-muted-foreground",children:"Default account"})]})]}),e.jsx(Os,{className:"w-4 h-4 text-muted-foreground"})]},c.id))}),e.jsxs("div",{className:"relative",children:[e.jsx("div",{className:"absolute inset-0 flex items-center",children:e.jsx("span",{className:"w-full border-t"})}),e.jsx("div",{className:"relative flex justify-center text-xs uppercase",children:e.jsx("span",{className:"bg-background px-2 text-muted-foreground",children:"Or"})})]}),e.jsxs("button",{type:"button",className:"w-full flex items-center gap-3 p-3 border-2 border-dashed border-primary/50 rounded-lg hover:border-primary hover:bg-primary/5 transition-colors text-left",onClick:n,children:[e.jsx("div",{className:"w-8 h-8 rounded-full bg-primary/10 flex items-center justify-center shrink-0",children:e.jsx(me,{className:"w-4 h-4 text-primary"})}),e.jsxs("div",{children:[e.jsx("div",{className:"font-medium text-primary",children:"Add new account"}),e.jsx("div",{className:"text-xs text-muted-foreground",children:"Authenticate with a different account"})]})]}),e.jsx("div",{className:"flex items-center justify-between pt-2",children:e.jsxs(R,{variant:"ghost",onClick:i,children:[e.jsx(Ze,{className:"w-4 h-4 mr-2"}),"Back"]})})]})}const js="__custom__";function la({selectedProvider:s,selectedAccount:a,variantName:t,modelName:n,isPending:i,privacyMode:c,onVariantNameChange:u,onModelChange:o,onBack:x,onSkip:h,onCreate:y}){const{t:m}=Z(),r=ve[s]?.models||[],C=n&&!r.some(f=>f.id===n),[v,w]=l.useState(C),N=s==="agy"&&n.trim().length>0?ee(n):!1,g=f=>{f===js?(w(!0),o("")):(w(!1),o(f))};return e.jsxs("div",{className:"space-y-4",children:[a&&e.jsxs("div",{className:"flex items-center gap-2 p-2 bg-muted/50 rounded-md text-sm",children:[e.jsx(xe,{className:"w-4 h-4"}),e.jsxs("span",{children:[m("setupVariant.using")," ",e.jsx("span",{className:B(c&&Ae),children:a.email||a.id})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(X,{htmlFor:"variant-name",children:m("setupVariant.variantNameRequired")}),e.jsx(ce,{id:"variant-name",value:t,onChange:f=>u(f.target.value),placeholder:m("setupVariant.variantNamePlaceholder")}),e.jsxs("div",{className:"text-xs text-muted-foreground",children:[m("setupVariant.invokeHintPrefix")," ccs ",t||"<name>",' "prompt"']})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(X,{children:m("setupVariant.model")}),v?e.jsxs("div",{className:"space-y-2",children:[e.jsx(ce,{value:n,onChange:f=>o(f.target.value),placeholder:m("setupVariant.modelPlaceholder")}),N&&e.jsx("p",{className:"text-xs text-destructive",children:"Antigravity denylist: Claude Opus 4.5 and Claude Sonnet 4.5 are deprecated."}),e.jsx("button",{type:"button",className:"text-xs text-primary hover:underline",onClick:()=>{w(!1),s==="agy"&&ee(n)&&o("")},children:m("setupVariant.choosePresetInstead")})]}):e.jsxs(Be,{value:r.some(f=>f.id===n)?n:"",onValueChange:g,children:[e.jsx(Ge,{children:e.jsx($e,{placeholder:m("setupVariant.selectModel")})}),e.jsxs(Qe,{children:[r.map(f=>e.jsx(je,{value:f.id,children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{children:f.name}),f.description&&e.jsxs("span",{className:"text-xs text-muted-foreground",children:["- ",f.description]})]})},f.id)),e.jsx(je,{value:js,children:e.jsx("span",{className:"text-primary",children:m("setupVariant.customModelName")})})]})]}),e.jsx("div",{className:"text-xs text-muted-foreground",children:v?m("setupVariant.enterAnyModel"):m("setupVariant.defaultModel",{model:ve[s]?.defaultModel||m("setupVariant.providerDefault")})})]}),e.jsxs("div",{className:"flex items-center justify-between pt-2",children:[e.jsxs(R,{variant:"ghost",onClick:x,children:[e.jsx(Ze,{className:"w-4 h-4 mr-2"}),m("setupVariant.back")]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(R,{variant:"ghost",onClick:h,children:m("setupVariant.skip")}),e.jsx(R,{onClick:y,disabled:!t||i||N,children:m(i?"setupVariant.creating":"setupVariant.createVariant")})]})]}),e.jsx("p",{className:"text-xs text-center text-muted-foreground",children:m("setupVariant.skipHint")})]})}function ca({variantName:s,onClose:a}){return e.jsxs("div",{className:"space-y-4 text-center",children:[e.jsx("div",{className:"flex justify-center",children:e.jsx("div",{className:"w-16 h-16 bg-green-100 dark:bg-green-900/30 rounded-full flex items-center justify-center",children:e.jsx(ne,{className:"w-8 h-8 text-green-600 dark:text-green-400"})})}),e.jsxs("div",{children:[e.jsx("div",{className:"font-semibold text-lg",children:"Variant Created!"}),e.jsx("div",{className:"text-sm text-muted-foreground",children:"Your custom variant is ready to use"})]}),e.jsx(ks,{children:e.jsxs(Cs,{className:"p-4 space-y-2",children:[e.jsx("div",{className:"text-sm text-muted-foreground",children:"Usage:"}),e.jsxs("code",{className:"block px-3 py-2 bg-muted rounded-md font-mono text-sm",children:["ccs ",s,' "your prompt here"']})]})}),e.jsx(R,{onClick:a,className:"w-full",children:"Done"})]})}function da({open:s,onClose:a}){const[t,n]=l.useState("provider"),[i,c]=l.useState(""),[u,o]=l.useState(null),[x,h]=l.useState(""),[y,m]=l.useState(""),[r,C]=l.useState(!1),[v,w]=l.useState(!1),{data:N,refetch:g}=As(),f=Js(),E=Ws(),A=Ys(),{privacyMode:F}=Ss(),P=N?.authStatus.find(M=>M.provider===i),p=l.useMemo(()=>P?.accounts||[],[P?.accounts]);l.useEffect(()=>{if(!s){const M=setTimeout(()=>{n("provider"),c(""),o(null),h(""),m(""),w(!1)},0);return()=>clearTimeout(M)}},[s]),l.useEffect(()=>{if(t==="auth"&&p.length>0&&!v){const M=setTimeout(()=>{n("account")},0);return()=>clearTimeout(M)}},[t,p,v]);const U=async()=>{C(!0),await g(),C(!1)},b=()=>{const M=(P?.accounts?.length||0)===0;E.mutate({provider:i},{onSuccess:async _=>{if(M){const H=await Ke(i);H.success&&H.presetName?q.success(`Applied "${H.presetName}" preset`):H.success||q.warning(Ds.t("commonToast.accountAddedPresetFailed"))}_.account&&(o(_.account),n("variant")),g()}})},S=M=>{c(M),(N?.authStatus.find(G=>G.provider===M)?.accounts||[]).length===0?n("auth"):n("account")},O=M=>{o(M),n("variant")},j=async()=>{if(!(!x||!i))try{await f.mutateAsync({name:x,provider:i,model:y||void 0,account:u?.id}),n("success")}catch(M){console.error("Failed to create variant:",M)}},k=`ccs ${i} --auth --add`,K=Zs(t),I=M=>{if(!M&&(E.isPending&&i&&A.mutate(i),t==="success"||t==="provider")){a();return}};return e.jsx(ze,{open:s,onOpenChange:I,children:e.jsxs(Je,{className:"sm:max-w-lg",onPointerDownOutside:M=>{t!=="success"&&t!=="provider"&&M.preventDefault()},onEscapeKeyDown:M=>{(E.isPending||f.isPending)&&M.preventDefault()},children:[e.jsxs(We,{children:[e.jsxs(Ye,{className:"flex items-center gap-2",children:[e.jsx(Ne,{className:"w-5 h-5 text-primary"}),"Quick Setup Wizard"]}),e.jsxs(Ps,{children:[t==="provider"&&"Select a provider to get started",t==="auth"&&"Authenticate with your provider",t==="account"&&"Select which account to use",t==="variant"&&"Create your custom variant",t==="success"&&"Setup complete!"]})]}),e.jsxs("div",{className:"space-y-4 py-4",children:[t==="provider"&&e.jsx(ia,{providers:ls,onSelect:S}),t==="auth"&&e.jsx(ra,{selectedProvider:i,providers:ls,authCommand:k,isRefreshing:r,isPending:E.isPending,onBack:()=>n("provider"),onStartAuth:b,onRefresh:U}),t==="account"&&e.jsx(oa,{accounts:p,privacyMode:F,onSelect:O,onAddNew:()=>{w(!0),n("auth")},onBack:()=>n("provider")}),t==="variant"&&e.jsx(la,{selectedProvider:i,selectedAccount:u,variantName:x,modelName:y,isPending:f.isPending,privacyMode:F,onVariantNameChange:h,onModelChange:m,onBack:()=>p.length>0?n("account"):n("provider"),onSkip:a,onCreate:j}),t==="success"&&e.jsx(ca,{variantName:x,onClose:a})]}),e.jsx(na,{currentProgress:K,allSteps:Xs})]})})}const ua=3e3,ma=300*1e3;async function Le(s){const a=await s.text();if(!a)return{};try{return JSON.parse(a)}catch{const t=s.status>=400?`Request failed with status ${s.status}`:void 0;return t?{error:t}:{}}}const le={provider:null,isAuthenticating:!1,error:null,authUrl:null,oauthState:null,isSubmittingCallback:!1,isDeviceCodeFlow:!1};function xa(){const[s,a]=l.useState(le),t=l.useRef(null),n=l.useRef(null),i=l.useRef(0),c=l.useRef(!1),u=Ve(),o=l.useCallback(()=>{n.current&&(clearInterval(n.current),n.current=null)},[]);l.useEffect(()=>()=>{t.current?.abort(),o(),c.current=!1},[o]);const x=l.useCallback(async(r,C)=>{if(Date.now()-i.current>ma){o(),a(v=>({...v,isAuthenticating:!1,error:"Authentication timed out. Please try again."}));return}try{const w=await(await fetch(`/api/cliproxy/auth/${r}/status?state=${encodeURIComponent(C)}`)).json();if(w.status==="ok")o(),u.invalidateQueries({queryKey:["cliproxy-auth"]}),u.invalidateQueries({queryKey:["account-quota"]}),q.success(`${r} authentication successful`),c.current=!1,a(le);else if(w.status==="auth_url"){const N=w.url||w.auth_url;N&&(a(g=>({...g,authUrl:N})),c.current||(c.current=!0,window.open(N,"_blank")))}else if(w.status==="device_code"){o();const N=w.user_code&&w.verification_url?`Open ${w.verification_url} and enter code: ${w.user_code}`:"Switch to Device Code method and try again.";q.error("Provider returned Device Code flow in callback mode"),a(g=>({...g,isAuthenticating:!1,error:N}))}else if(w.status==="error"){o();const N=w.error||"Authentication failed";q.error(N),a(g=>({...g,isAuthenticating:!1,error:N}))}}catch{}},[u,o]),h=l.useCallback(async(r,C)=>{if(!Fe(r)){a({...le,error:`Unknown provider: ${r}`});return}t.current?.abort(),o(),c.current=!1;const v=new AbortController;t.current=v;const N=(C?.flowType||(Ms(r)?"device_code":"authorization_code"))==="device_code",g=C?.startEndpoint||(N?"start":"start-url"),f={nickname:C?.nickname,kiroMethod:C?.kiroMethod,riskAcknowledgement:C?.riskAcknowledgement};a({provider:r,isAuthenticating:!0,error:null,authUrl:null,oauthState:null,isSubmittingCallback:!1,isDeviceCodeFlow:N});try{if(g==="start")fetch(`/api/cliproxy/auth/${r}/start`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(f),signal:v.signal}).then(async E=>{const A=await Le(E),F=A.success===!0;if(E.ok&&F)u.invalidateQueries({queryKey:["cliproxy-auth"]}),u.invalidateQueries({queryKey:["account-quota"]}),c.current=!1,a(le);else{const P=typeof A.error=="string"?A.error:"Authentication failed";q.error(P),a(p=>({...p,isAuthenticating:!1,error:P}))}}).catch(E=>{if(E instanceof Error&&E.name==="AbortError")return;const A=E instanceof Error?E.message:"Authentication failed";q.error(A),a(F=>({...F,isAuthenticating:!1,error:A}))});else{const E=await fetch(`/api/cliproxy/auth/${r}/start-url`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(f),signal:v.signal}),A=await Le(E),F=A.success===!0;if(!E.ok||!F){const U=typeof A.error=="string"?A.error:"Failed to start OAuth";throw new Error(U)}const P=typeof A.authUrl=="string"?A.authUrl:null,p=typeof A.state=="string"?A.state:null;a(U=>({...U,authUrl:P,oauthState:p})),P&&(c.current=!0,window.open(P,"_blank")),p&&(i.current=Date.now(),n.current=setInterval(()=>{x(r,p)},ua))}}catch(E){if(E instanceof Error&&E.name==="AbortError"){c.current=!1,a(le);return}const A=E instanceof Error?E.message:"Authentication failed";q.error(A),a(F=>({...F,isAuthenticating:!1,error:A}))}},[x,o,u]),y=l.useCallback(()=>{const r=s.provider;t.current?.abort(),o(),c.current=!1,a(le),r&&be.cliproxy.auth.cancel(r).catch(()=>{})},[s.provider,o]),m=l.useCallback(async r=>{if(s.provider){a(C=>({...C,isSubmittingCallback:!0,error:null}));try{const C=await fetch(`/api/cliproxy/auth/${s.provider}/submit-callback`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({redirectUrl:r})}),v=await Le(C),w=v.success===!0;if(C.ok&&w)o(),u.invalidateQueries({queryKey:["cliproxy-auth"]}),u.invalidateQueries({queryKey:["account-quota"]}),q.success(`${s.provider} authentication successful`),a(le);else{const N=typeof v.error=="string"?v.error:"Callback submission failed";throw new Error(N)}}catch(C){const v=C instanceof Error?C.message:"Failed to submit callback";q.error(v),a(w=>({...w,isSubmittingCallback:!1,error:v}))}}},[s.provider,u,o]);return l.useMemo(()=>({...s,startAuth:h,cancelAuth:y,submitCallback:m}),[s,h,y,m])}function Ks({className:s,showAcknowledgement:a=!1,acknowledgementPhrase:t=ke,acknowledgementText:n="",onAcknowledgementTextChange:i,disabled:c=!1,showProxySettingsLink:u=!1}){const{t:o}=Z(),x=o("accountSafetyWarning.title"),h=o("accountSafetyWarning.subtitle"),y=o("accountSafetyWarning.firstLine"),m=o("accountSafetyWarning.secondLine"),r="https://github.com/kaitranntt/ccs/issues/509",C=o("accountSafetyWarning.issueLabel"),v=o("accountSafetyWarning.proxySettingsLabel");return e.jsxs("section",{role:"alert",className:B("relative overflow-hidden rounded-xl border border-amber-500/30 bg-gradient-to-br from-amber-50 via-background to-rose-50/70 shadow-sm dark:from-amber-950/20 dark:to-rose-950/20",s),children:[e.jsx("div",{className:"absolute inset-x-0 top-0 h-0.5 bg-gradient-to-r from-amber-500 via-orange-500 to-rose-500"}),e.jsxs("div",{className:"space-y-3 p-4",children:[e.jsxs("div",{className:"flex items-start justify-between gap-3",children:[e.jsxs("div",{className:"flex items-start gap-2.5",children:[e.jsx("div",{className:"mt-0.5 inline-flex h-7 w-7 items-center justify-center rounded-md bg-amber-500/15 text-amber-700 dark:text-amber-400",children:e.jsx(Se,{className:"h-4 w-4"})}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-semibold leading-5",children:x}),e.jsx("p",{className:"text-xs text-muted-foreground",children:h})]})]}),e.jsx(V,{variant:"outline",className:"border-amber-500/40 text-amber-700 dark:text-amber-300",children:"High Risk"})]}),e.jsxs("div",{className:"space-y-2 text-sm leading-relaxed",children:[e.jsx("p",{children:y}),e.jsx("p",{className:"font-medium text-amber-900 dark:text-amber-200",children:m}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"CCS is provided as-is and does not take responsibility for suspension, bans, or access loss from upstream providers."})]}),e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsxs("a",{href:r,target:"_blank",rel:"noreferrer",className:"inline-flex items-center gap-1.5 rounded-md border border-amber-500/30 bg-amber-500/10 px-2.5 py-1 text-xs font-medium text-amber-800 transition-colors hover:bg-amber-500/15 dark:text-amber-200",children:[C,e.jsx(me,{className:"h-3.5 w-3.5"})]}),u&&e.jsxs("a",{href:"/settings?tab=proxy",className:"inline-flex items-center gap-1.5 rounded-md border border-amber-500/30 bg-amber-500/10 px-2.5 py-1 text-xs font-medium text-amber-800 transition-colors hover:bg-amber-500/15 dark:text-amber-200",children:[e.jsx(Kt,{className:"h-3.5 w-3.5"}),v]}),e.jsx("span",{className:"rounded-md border border-border/70 bg-muted/60 px-2.5 py-1 text-xs text-muted-foreground",children:"Applies to CLI and dashboard auth"})]}),a&&i&&e.jsxs("div",{className:"rounded-lg border border-amber-500/25 bg-amber-500/5 p-2.5",children:[e.jsxs(X,{htmlFor:"account-risk-ack-text",className:"text-xs leading-5",children:["Type exact phrase to continue:"," ",e.jsx("code",{className:"rounded bg-muted px-1 py-0.5 font-mono",children:t})]}),e.jsx(ce,{id:"account-risk-ack-text",value:n,onChange:w=>i(w.target.value),placeholder:t,disabled:c,className:"mt-2 font-mono text-xs"})]})]})]})}function pa({className:s,value:a,onChange:t,disabled:n=!1}){const{t:i}=Z(),c=[a.reviewedIssue509,a.understandsBanRisk,a.acceptsFullResponsibility,a.typedPhrase.trim().replace(/\s+/g," ").toUpperCase()===fs].filter(Boolean).length,u=c/4*100,o=x=>{t({...a,...x})};return e.jsxs("section",{role:"alert",className:B("relative overflow-hidden rounded-xl border border-rose-500/35 bg-gradient-to-br from-rose-50 via-background to-amber-50/70 p-4 shadow-sm dark:from-rose-950/20 dark:to-amber-950/20",s),children:[e.jsx("div",{className:"absolute inset-x-0 top-0 h-0.5 bg-gradient-to-r from-rose-500 via-orange-500 to-amber-500"}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-start justify-between gap-3",children:[e.jsxs("div",{className:"flex items-start gap-2.5",children:[e.jsx("div",{className:"mt-0.5 inline-flex h-7 w-7 items-center justify-center rounded-md bg-rose-500/15 text-rose-700 dark:text-rose-300",children:e.jsx(Se,{className:"h-4 w-4"})}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-sm font-semibold leading-5",children:i("antigravityChecklist.title")}),e.jsx("p",{className:"text-xs text-muted-foreground",children:i("antigravityChecklist.subtitle")})]})]}),e.jsx(V,{variant:"outline",className:"border-rose-500/40 text-rose-700 dark:text-rose-300",children:i("antigravityChecklist.mandatory")})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsxs("div",{className:"flex items-center justify-between text-xs text-muted-foreground",children:[e.jsx("span",{children:i("antigravityChecklist.completion")}),e.jsx("span",{children:i("antigravityChecklist.stepsCount",{current:c})})]}),e.jsx(Ue,{value:u,className:"h-2"})]}),e.jsxs("div",{className:"space-y-3 rounded-lg border border-rose-500/20 bg-rose-500/5 p-3",children:[e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx(Ce,{id:"agy-step-reviewed-issue",checked:a.reviewedIssue509,onCheckedChange:x=>o({reviewedIssue509:!!x}),disabled:n}),e.jsx(X,{htmlFor:"agy-step-reviewed-issue",className:"text-xs leading-5",children:"Step 1: I reviewed issue #509 and understand AGY OAuth can trigger account bans/suspensions."})]}),e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx(Ce,{id:"agy-step-understands-risk",checked:a.understandsBanRisk,onCheckedChange:x=>o({understandsBanRisk:!!x}),disabled:n}),e.jsx(X,{htmlFor:"agy-step-understands-risk",className:"text-xs leading-5",children:"Step 2: I understand this OAuth action is my own decision and I accept the upstream risk."})]}),e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx(Ce,{id:"agy-step-accept-responsibility",checked:a.acceptsFullResponsibility,onCheckedChange:x=>o({acceptsFullResponsibility:!!x}),disabled:n}),e.jsx(X,{htmlFor:"agy-step-accept-responsibility",className:"text-xs leading-5",children:"Step 3: I accept full responsibility. CCS is not liable for suspension, bans, or access loss."})]})]}),e.jsxs("div",{className:"space-y-2 rounded-lg border border-amber-500/25 bg-amber-500/5 p-3",children:[e.jsxs("div",{className:"flex items-center gap-1.5 text-xs font-medium text-amber-800 dark:text-amber-200",children:[e.jsx(_s,{className:"h-3.5 w-3.5"}),"Step 4: Type exact phrase to continue"]}),e.jsx(ce,{value:a.typedPhrase,onChange:x=>o({typedPhrase:x.target.value}),placeholder:fs,disabled:n,className:"font-mono text-xs"})]}),e.jsx("div",{className:"flex flex-wrap items-center gap-2 text-xs",children:e.jsxs("a",{href:"https://github.com/kaitranntt/ccs/issues/509",target:"_blank",rel:"noreferrer",className:"inline-flex items-center gap-1.5 rounded-md border border-rose-500/30 bg-rose-500/10 px-2.5 py-1 font-medium text-rose-800 transition-colors hover:bg-rose-500/15 dark:text-rose-200",children:["Read issue #509",e.jsx(me,{className:"h-3.5 w-3.5"})]})})]})]})}function ha(s){return s.trim().replace(/\s+/g," ").toUpperCase()}function ga({open:s,onClose:a,provider:t,displayName:n,isFirstAccount:i=!1}){const[c,u]=l.useState(""),[o,x]=l.useState(""),[h,y]=l.useState(!1),[m,r]=l.useState(null),[C,v]=l.useState(""),[w,N]=l.useState(_e),[g,f]=l.useState(!1),[E,A]=l.useState(!1),[F,P]=l.useState(cs),{t:p}=Z(),U=l.useRef(!1),b=xa(),S=et(),O=t==="kiro",j=t==="gemini",k=t==="agy"&&!g,K=t==="agy"&&E,I=Zt(w),M=ha(C)===ke,_=Ms(t),H=st(t),G=tt(F),se=O?G.flowType==="device_code":_,z=b.isAuthenticating||S.isPending,Y=c.trim(),te=m||b.error,d=l.useCallback(async()=>{const D=await fetch("/api/settings/auth/antigravity-risk");if(!D.ok)throw new Error("Failed to load Antigravity power user setting");return(await D.json()).antigravityAckBypass===!0},[]),T=()=>{u(""),x(""),y(!1),r(null),v(""),N(_e),f(!1),A(!1),P(cs),U.current=!1,a()};l.useEffect(()=>{s&&(v(""),N(_e),r(null))},[t,s]),l.useEffect(()=>{let D=!1;if(!s||t!=="agy"){f(!1),A(!1);return}return(async()=>{try{A(!0);const ae=await d();D||f(ae)}catch{D||f(!1)}finally{D||A(!1)}})(),()=>{D=!0}},[d,s,t]),l.useEffect(()=>{if(!s||t!=="agy"||!b.error||!g)return;const D=b.error.toLowerCase();if(!(D.includes("agy_risk_ack_required")||D.includes("responsibility acknowledgement")||D.includes("responsibility checklist")))return;let ae=!1;return(async()=>{try{A(!0);const we=await d();if(ae)return;f(we),we||r("Power user mode is off. Complete the AGY checklist and retry.")}catch{if(ae)return;f(!1),r("Power user mode is off. Complete the AGY checklist and retry.")}finally{ae||A(!1)}})(),()=>{ae=!0}},[g,b.error,d,s,t]),l.useEffect(()=>{!b.isAuthenticating&&!b.error&&b.provider===null&&s&&U.current&&(U.current=!1,(async()=>{try{const ie=await Ke(t);ie.success&&ie.presetName&&i&&q.success(`Applied "${ie.presetName}" preset`)}catch{}T()})())},[b.isAuthenticating,b.error,b.provider]);const $=()=>{b.cancelAuth(),T()},de=async()=>{b.authUrl&&(await navigator.clipboard.writeText(b.authUrl),y(!0),setTimeout(()=>y(!1),2e3))},De=()=>{o.trim()&&b.submitCallback(o.trim())},Me=()=>{if(K){r("Loading Antigravity safety settings. Please wait a moment and retry.");return}if(k&&!I){r("Complete all Antigravity responsibility steps before authenticating this provider.");return}if(j&&!M){r(`Type "${ke}" to acknowledge the account safety warning before authenticating this provider.`);return}if(H&&!Y){r(`Nickname is required for ${n} accounts.`);return}r(null),U.current=!0,b.startAuth(t,{nickname:Y||void 0,kiroMethod:O?F:void 0,flowType:O?G.flowType:void 0,startEndpoint:O?G.startEndpoint:void 0,riskAcknowledgement:k?{version:ea,reviewedIssue509:w.reviewedIssue509,understandsBanRisk:w.understandsBanRisk,acceptsFullResponsibility:w.acceptsFullResponsibility,typedPhrase:w.typedPhrase}:void 0})},Te=()=>{U.current=!0,S.mutate(void 0,{onSuccess:async()=>{const D=await Ke("kiro");D.success&&D.presetName&&i&&q.success(`Applied "${D.presetName}" preset`),T()}})},Oe=D=>{D||$()},J=b.isAuthenticating;return e.jsx(ze,{open:s,onOpenChange:Oe,children:e.jsxs(Je,{className:"sm:max-w-md",onInteractOutside:D=>{J&&D.preventDefault()},children:[e.jsxs(We,{children:[e.jsx(Ye,{children:p("addAccountDialog.title",{displayName:n})}),e.jsx(Ps,{children:p(O?"addAccountDialog.descKiro":se?"addAccountDialog.descDeviceCode":"addAccountDialog.descOauth")})]}),e.jsxs("div",{className:"space-y-4 py-4",children:[k&&!J&&e.jsx(pa,{value:w,onChange:D=>{N(D),r(null)},disabled:z}),t==="agy"&&g&&!J&&e.jsxs("div",{className:"rounded-lg border border-amber-400/35 bg-amber-50/70 p-3 text-xs text-amber-900 dark:border-amber-800/60 dark:bg-amber-950/25 dark:text-amber-100",children:[e.jsxs("div",{className:"mb-1.5 flex items-center gap-1.5 font-semibold",children:[e.jsx(_s,{className:"h-3.5 w-3.5"}),p("addAccountDialog.powerUserEnabled")]}),p("addAccountDialog.powerUserSkipped")]}),j&&!J&&e.jsx(Ks,{showAcknowledgement:!0,acknowledgementPhrase:ke,acknowledgementText:C,onAcknowledgementTextChange:D=>{v(D),r(null)},disabled:z}),O&&!J&&e.jsxs("div",{className:"space-y-2",children:[e.jsx(X,{htmlFor:"kiro-auth-method",children:p("addAccountDialog.authMethod")}),e.jsxs(Be,{value:F,onValueChange:D=>{P(D),r(null)},children:[e.jsx(Ge,{id:"kiro-auth-method",children:e.jsx($e,{placeholder:p("addAccountDialog.selectKiroAuthMethod")})}),e.jsx(Qe,{children:at.map(D=>e.jsx(je,{value:D.id,children:D.label},D.id))})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:G.description})]}),!J&&e.jsxs("div",{className:"space-y-2",children:[e.jsx(X,{htmlFor:"nickname",children:p(H?"addAccountDialog.nicknameRequired":"addAccountDialog.nicknameOptional")}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(xe,{className:"w-4 h-4 text-muted-foreground"}),e.jsx(ce,{id:"nickname",value:c,onChange:D=>{u(D.target.value),r(null)},placeholder:p("addAccountDialog.nicknamePlaceholder"),disabled:z,className:"flex-1"})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:p(H?"addAccountDialog.nicknameRequiredHint":"addAccountDialog.nicknameOptionalHint")})]}),J&&e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"text-center",children:[e.jsxs("p",{className:"text-sm text-muted-foreground",children:[e.jsx(W,{className:"w-4 h-4 inline mr-2 animate-spin"}),p("addAccountDialog.waitingForAuth")]}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:b.isDeviceCodeFlow?p("addAccountDialog.deviceCodeHint"):p("addAccountDialog.browserHint")})]}),b.authUrl&&!b.isDeviceCodeFlow&&e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(X,{className:"text-xs",children:p("addAccountDialog.openUrlLabel")}),e.jsxs("div",{className:"p-3 bg-muted rounded-md",children:[e.jsx("p",{className:"text-xs text-muted-foreground break-all font-mono line-clamp-3",children:b.authUrl}),e.jsxs("div",{className:"flex gap-2 mt-2",children:[e.jsx(R,{variant:"outline",size:"sm",onClick:de,children:h?e.jsxs(e.Fragment,{children:[e.jsx(ne,{className:"w-3 h-3 mr-1"}),p("addAccountDialog.copied")]}):e.jsxs(e.Fragment,{children:[e.jsx(Es,{className:"w-3 h-3 mr-1"}),p("addAccountDialog.copy")]})}),e.jsxs(R,{variant:"outline",size:"sm",onClick:()=>{if(!b.authUrl)return;const D=window.open(b.authUrl,"_blank");(!D||D.closed||typeof D.closed>"u")&&q.warning(p("addAccountDialog.popupBlocked"),{duration:5e3})},children:[e.jsx(me,{className:"w-3 h-3 mr-1"}),p("addAccountDialog.open")]})]})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(X,{htmlFor:"callback-url",className:"text-xs",children:p("addAccountDialog.redirectPasteLabel")}),e.jsx(ce,{id:"callback-url",value:o,onChange:D=>x(D.target.value),placeholder:p("addAccountDialog.callbackPlaceholder"),className:"font-mono text-xs"}),e.jsx(R,{variant:"secondary",size:"sm",onClick:De,disabled:!o.trim()||b.isSubmittingCallback,children:b.isSubmittingCallback?e.jsxs(e.Fragment,{children:[e.jsx(W,{className:"w-3 h-3 mr-1 animate-spin"}),p("addAccountDialog.submitting")]}):p("addAccountDialog.submitCallback")})]})]}),!b.authUrl&&!b.isDeviceCodeFlow&&e.jsx("p",{className:"text-xs text-center text-muted-foreground",children:p("addAccountDialog.preparingUrl")})]}),te&&e.jsx("p",{className:"text-xs text-center text-destructive",children:te}),S.isPending&&e.jsxs("p",{className:"text-sm text-center text-muted-foreground",children:[e.jsx(W,{className:"w-4 h-4 inline mr-2 animate-spin"}),p("addAccountDialog.importingToken")]}),e.jsxs("div",{className:"flex items-center justify-end gap-2 pt-2",children:[e.jsx(R,{variant:"ghost",onClick:$,children:p("addAccountDialog.cancel")}),O&&!J&&e.jsx(R,{variant:"outline",onClick:Te,disabled:z,children:S.isPending?e.jsxs(e.Fragment,{children:[e.jsx(W,{className:"w-4 h-4 mr-2 animate-spin"}),p("addAccountDialog.importing")]}):e.jsxs(e.Fragment,{children:[e.jsx(Vt,{className:"w-4 h-4 mr-2"}),p("addAccountDialog.importFromIde")]})}),!J&&e.jsxs(R,{onClick:Me,disabled:z||K||H&&!Y||k&&!I||j&&!M,children:[e.jsx(me,{className:"w-4 h-4 mr-2"}),p("addAccountDialog.authenticate")]})]})]})]})})}const as="[1m]";function fa(s){return s.toLowerCase().startsWith("gemini-")}function ns(s){return s.toLowerCase().endsWith(as.toLowerCase())}function ja(s){return!s||ns(s)?s:`${s}${as}`}function Vs(s){return s&&(ns(s)?s.slice(0,-as.length):s)}const vs=["ANTHROPIC_MODEL"],va=["ANTHROPIC_BASE_URL","ANTHROPIC_AUTH_TOKEN"];function Na(s){const a=s?.env||{};return va.filter(t=>!a[t]?.trim())}function ya(s){const[a,t]=l.useState(null),[n,i]=l.useState(!1),c=Ve(),{data:u,isLoading:o,refetch:x}=bs({queryKey:["settings",s],queryFn:async()=>{const S=await fetch(`/api/settings/${s}/raw`);return S.ok?S.json():{profile:s,settings:{env:{}},mtime:Date.now(),path:`~/.ccs/profiles/${s}/settings.json`}}}),h=u?.settings,y=l.useMemo(()=>a!==null?a:h?JSON.stringify(h,null,2):`{
|
|
1
|
+
import{j as e}from"./radix-ui-BR1vy4kf.js";import{r as l}from"./react-vendor-CNOkPC89.js";import{a as Ve,u as bs,b as zs}from"./tanstack-e99Cjjy2.js";import{d as R,C as ks,b as Cs,c as B,P as Ae,a as Z,a8 as ee,L as X,I as ce,r as Be,s as Ge,t as $e,v as Qe,w as je,a9 as As,aa as Js,ab as Ws,ac as Ys,u as Ss,ad as ze,ae as Je,af as We,ag as Ye,ah as Ps,ai as ls,aj as Xs,ak as Zs,W as Ds,al as Fe,am as Ms,Y as be,B as V,an as Ue,ao as cs,ap as et,aq as st,ar as tt,as as at,at as ds,au as us,av as nt,x as Ts,n as Xe,aw as it,ax as rt,ay as ot,m as lt,az as ct,aA as dt,aB as ut,aC as mt,aD as xt,aE as pt,aF as ht,aG as pe,T as he,p as ge,q as fe,aH as gt,aI as ft,aJ as jt,aK as ms,aL as vt,aM as Nt,aN as yt,aO as wt,aP as bt,aQ as kt,aR as Ct,Q as At,R as St,U as xs,V as ps,aS as Pt,aT as Dt,aU as Mt,aV as Tt,aW as Ot,aX as Et,aY as _t,aZ as Rt,a_ as Lt,a$ as It,b0 as Ft,b1 as Ut,S as Ht}from"./index-JgHDFSHt.js";import{C as He}from"./default-ports-1QQSffYX.js";import{t as q}from"./notifications-B2HqRBj7.js";import{C as Os,L as W,o as me,Q as qt,l as ne,n as Es,as as Ze,R as es,p as xe,a4 as Ne,T as Se,a2 as Kt,at as _s,ar as Vt,au as Pe,Z as ye,O as Rs,h as Bt,t as Ls,av as Gt,aj as $t,X as ss,a3 as Is,m as Qt,x as zt,y as Fs,z as qe,aw as Jt,u as hs,ax as Wt,ai as Us,v as Yt,ay as gs,am as Xt,az as Hs}from"./icons-DrEfTmfX.js";import{R as ke,A as fs,D as _e,i as Zt,a as ea,P as sa}from"./proxy-status-widget-DEkHz7X-.js";import{C as Ce}from"./checkbox-DiyJL_k4.js";import{C as ta}from"./confirm-dialog-DTWvVQlx.js";import{S as ts}from"./separator-BFr5KvfF.js";import{S as qs}from"./switch-w7IoOY5x.js";import"./utils-CzKF5WmX.js";import"./form-utils-Bcoyqxpq.js";import"./code-highlight-BRUf_pqB.js";import"./alert-dialog-0GYXcDLu.js";const ve={agy:{provider:"agy",displayName:"Antigravity",defaultModel:"claude-opus-4-6-thinking",models:[{id:"claude-opus-4-6-thinking",name:"Claude Opus 4.6 Thinking",description:"Latest flagship, extended thinking",extendedContext:!1,presetMapping:{default:"claude-opus-4-6-thinking",opus:"claude-opus-4-6-thinking",sonnet:"claude-sonnet-4-6",haiku:"claude-sonnet-4-6"}},{id:"claude-sonnet-4-6",name:"Claude Sonnet 4.6",description:"Latest Sonnet with thinking budget support",presetMapping:{default:"claude-sonnet-4-6",opus:"claude-opus-4-6-thinking",sonnet:"claude-sonnet-4-6",haiku:"claude-sonnet-4-6"}},{id:"gemini-3-pro-preview",name:"Gemini 3 Pro",description:"Google latest model via Antigravity",extendedContext:!0,presetMapping:{default:"gemini-3-pro-preview",opus:"gemini-3-pro-preview",sonnet:"gemini-3-pro-preview",haiku:"gemini-3-flash-preview"}},{id:"gemini-3-flash-preview",name:"Gemini 3 Flash",description:"Fast Gemini model via Antigravity",extendedContext:!0,presetMapping:{default:"gemini-3-flash-preview",opus:"gemini-3-pro-preview",sonnet:"gemini-3-pro-preview",haiku:"gemini-3-flash-preview"}}]},gemini:{provider:"gemini",displayName:"Gemini",defaultModel:"gemini-2.5-pro",models:[{id:"gemini-3-pro-preview",name:"Gemini 3 Pro",tier:"paid",description:"Latest model, requires paid Google account",extendedContext:!0,presetMapping:{default:"gemini-3-pro-preview",opus:"gemini-3-pro-preview",sonnet:"gemini-3-pro-preview",haiku:"gemini-3-flash-preview"}},{id:"gemini-3-flash-preview",name:"Gemini 3 Flash",tier:"paid",description:"Fast Gemini 3 model, requires paid Google account",extendedContext:!0,presetMapping:{default:"gemini-3-flash-preview",opus:"gemini-3-pro-preview",sonnet:"gemini-3-pro-preview",haiku:"gemini-3-flash-preview"}},{id:"gemini-2.5-pro",name:"Gemini 2.5 Pro",description:"Stable, works with free Google account",extendedContext:!0,presetMapping:{default:"gemini-2.5-pro",opus:"gemini-2.5-pro",sonnet:"gemini-2.5-pro",haiku:"gemini-2.5-flash"}}]},codex:{provider:"codex",displayName:"Codex",defaultModel:"gpt-5.3-codex",models:[{id:"gpt-5.3-codex",name:"GPT-5.3 Codex",description:"Supports up to xhigh effort",presetMapping:{default:"gpt-5.3-codex",opus:"gpt-5.3-codex",sonnet:"gpt-5.3-codex",haiku:"gpt-5.1-codex-mini"}},{id:"gpt-5.2-codex",name:"GPT-5.2 Codex",description:"Previous stable Codex model",presetMapping:{default:"gpt-5.2-codex",opus:"gpt-5.2-codex",sonnet:"gpt-5.2-codex",haiku:"gpt-5.1-codex-mini"}},{id:"gpt-5-mini",name:"GPT-5 Mini",description:"Fast, capped at high effort (no xhigh)",presetMapping:{default:"gpt-5-mini",opus:"gpt-5.3-codex",sonnet:"gpt-5-mini",haiku:"gpt-5-mini"}},{id:"gpt-5.1-codex-max",name:"Codex Max (5.1)",description:"Legacy most capable Codex model",presetMapping:{default:"gpt-5.1-codex-max",opus:"gpt-5.1-codex-max",sonnet:"gpt-5.1-codex-max",haiku:"gpt-5.1-codex-mini"}},{id:"gpt-5.2",name:"GPT 5.2",description:"Latest GPT model",presetMapping:{default:"gpt-5.2",opus:"gpt-5.2",sonnet:"gpt-5.2",haiku:"gpt-5.2"}},{id:"gpt-5.1-codex-mini",name:"Codex Mini",description:"Fast and efficient Codex model"}]},qwen:{provider:"qwen",displayName:"Qwen",defaultModel:"qwen3-coder-plus",models:[{id:"qwen3-coder-plus",name:"Qwen3 Coder Plus",description:"Code-focused model (1M context)",presetMapping:{default:"qwen3-coder-plus",opus:"qwen3-max",sonnet:"qwen3-coder-plus",haiku:"qwen3-coder-flash"}},{id:"qwen3-max",name:"Qwen3 Max",description:"Flagship model (256K context)",presetMapping:{default:"qwen3-max",opus:"qwen3-max",sonnet:"qwen3-coder-plus",haiku:"qwen3-coder-flash"}},{id:"qwen3-max-preview",name:"Qwen3 Max Preview",description:"Preview with thinking support (256K)",presetMapping:{default:"qwen3-max-preview",opus:"qwen3-max-preview",sonnet:"qwen3-max",haiku:"qwen3-coder-flash"}},{id:"qwen3-235b",name:"Qwen3 235B",description:"Large 235B A22B model",presetMapping:{default:"qwen3-235b",opus:"qwen3-max",sonnet:"qwen3-235b",haiku:"qwen3-coder-flash"}},{id:"qwen3-vl-plus",name:"Qwen3 VL Plus",description:"Vision-language multimodal"},{id:"qwen3-coder-flash",name:"Qwen3 Coder Flash",description:"Fast code generation"},{id:"qwen3-32b",name:"Qwen3 32B",description:"Qwen3 32B model"}]},iflow:{provider:"iflow",displayName:"iFlow",defaultModel:"qwen3-coder-plus",models:[{id:"qwen3-coder-plus",name:"Qwen3 Coder Plus",description:"Recommended default for iFlow accounts",presetMapping:{default:"qwen3-coder-plus",opus:"qwen3-coder-plus",sonnet:"qwen3-coder-plus",haiku:"qwen3-coder-plus"}},{id:"qwen3-max",name:"Qwen3 Max",description:"Flagship Qwen model via iFlow"},{id:"kimi-k2",name:"Kimi K2",description:"Kimi model currently available via iFlow"},{id:"deepseek-v3.2",name:"DeepSeek V3.2",description:"Current DeepSeek V3.2 model via iFlow"},{id:"deepseek-r1",name:"DeepSeek R1",description:"Reasoning-focused DeepSeek model"},{id:"glm-4.6",name:"GLM 4.6",description:"Zhipu GLM 4.6 via iFlow"},{id:"qwen3-vl-plus",name:"Qwen3 VL Plus",description:"Vision-language model"}]},kimi:{provider:"kimi",displayName:"Kimi (Moonshot)",defaultModel:"kimi-k2.5",models:[{id:"kimi-k2.5",name:"Kimi K2.5",description:"Latest multimodal model (262K context)",presetMapping:{default:"kimi-k2.5",opus:"kimi-k2.5",sonnet:"kimi-k2-thinking",haiku:"kimi-k2"}},{id:"kimi-k2-thinking",name:"Kimi K2 Thinking",description:"Extended reasoning model",presetMapping:{default:"kimi-k2-thinking",opus:"kimi-k2.5",sonnet:"kimi-k2-thinking",haiku:"kimi-k2"}},{id:"kimi-k2",name:"Kimi K2",description:"Flagship coding model"}]},kiro:{provider:"kiro",displayName:"Kiro (AWS)",defaultModel:"kiro-claude-sonnet-4-5",models:[{id:"kiro-claude-opus-4-5",name:"Kiro Claude Opus 4.5",description:"Claude Opus 4.5 via Kiro (2.2x credit)",presetMapping:{default:"kiro-claude-opus-4-5",opus:"kiro-claude-opus-4-5",sonnet:"kiro-claude-sonnet-4-5",haiku:"kiro-claude-haiku-4-5"}},{id:"kiro-claude-sonnet-4-5",name:"Kiro Claude Sonnet 4.5",description:"Claude Sonnet 4.5 via Kiro (1.3x credit)",presetMapping:{default:"kiro-claude-sonnet-4-5",opus:"kiro-claude-opus-4-5",sonnet:"kiro-claude-sonnet-4-5",haiku:"kiro-claude-haiku-4-5"}},{id:"kiro-claude-sonnet-4",name:"Kiro Claude Sonnet 4",description:"Claude Sonnet 4 via Kiro (1.3x credit)",presetMapping:{default:"kiro-claude-sonnet-4",opus:"kiro-claude-opus-4-5",sonnet:"kiro-claude-sonnet-4",haiku:"kiro-claude-haiku-4-5"}},{id:"kiro-claude-haiku-4-5",name:"Kiro Claude Haiku 4.5",description:"Claude Haiku 4.5 via Kiro (0.4x credit)"}]},ghcp:{provider:"ghcp",displayName:"GitHub Copilot (OAuth)",defaultModel:"claude-sonnet-4.5",models:[{id:"claude-opus-4.5",name:"Claude Opus 4.5",description:"Anthropic Claude Opus 4.5 via GitHub Copilot",presetMapping:{default:"claude-opus-4.5",opus:"claude-opus-4.5",sonnet:"claude-sonnet-4.5",haiku:"claude-haiku-4.5"}},{id:"claude-sonnet-4.5",name:"Claude Sonnet 4.5",description:"Anthropic Claude Sonnet 4.5 via GitHub Copilot",presetMapping:{default:"claude-sonnet-4.5",opus:"claude-opus-4.5",sonnet:"claude-sonnet-4.5",haiku:"claude-haiku-4.5"}},{id:"claude-sonnet-4",name:"Claude Sonnet 4",description:"Anthropic Claude Sonnet 4 via GitHub Copilot"},{id:"claude-haiku-4.5",name:"Claude Haiku 4.5",description:"Anthropic Claude Haiku 4.5 via GitHub Copilot"},{id:"gpt-5.2",name:"GPT-5.2",description:"OpenAI GPT-5.2 via GitHub Copilot",presetMapping:{default:"gpt-5.2",opus:"gpt-5.2",sonnet:"gpt-5.1",haiku:"gpt-5-mini"}},{id:"gpt-5.1",name:"GPT-5.1",description:"OpenAI GPT-5.1 via GitHub Copilot"},{id:"gpt-5",name:"GPT-5",description:"OpenAI GPT-5 via GitHub Copilot"},{id:"gpt-5-mini",name:"GPT-5 Mini",description:"OpenAI GPT-5 Mini via GitHub Copilot"},{id:"gemini-3-pro",name:"Gemini 3 Pro",description:"Google Gemini 3 Pro via GitHub Copilot"}]},claude:{provider:"claude",displayName:"Claude (Anthropic)",defaultModel:"claude-sonnet-4-6",models:[{id:"claude-opus-4-6",name:"Claude Opus 4.6",description:"Latest flagship model",extendedContext:!0,presetMapping:{default:"claude-opus-4-6",opus:"claude-opus-4-6",sonnet:"claude-sonnet-4-6",haiku:"claude-haiku-4-5-20251001"}},{id:"claude-sonnet-4-6",name:"Claude Sonnet 4.6",description:"Balanced performance and speed",extendedContext:!0,presetMapping:{default:"claude-sonnet-4-6",opus:"claude-opus-4-6",sonnet:"claude-sonnet-4-6",haiku:"claude-haiku-4-5-20251001"}},{id:"claude-opus-4-5-20251101",name:"Claude Opus 4.5",description:"Most capable Claude model",extendedContext:!0,presetMapping:{default:"claude-opus-4-5-20251101",opus:"claude-opus-4-5-20251101",sonnet:"claude-sonnet-4-5-20250929",haiku:"claude-haiku-4-5-20251001"}},{id:"claude-sonnet-4-5-20250929",name:"Claude Sonnet 4.5",description:"Balanced performance and speed",extendedContext:!0,presetMapping:{default:"claude-sonnet-4-5-20250929",opus:"claude-opus-4-5-20251101",sonnet:"claude-sonnet-4-5-20250929",haiku:"claude-haiku-4-5-20251001"}},{id:"claude-sonnet-4-20250514",name:"Claude Sonnet 4",description:"Previous generation Sonnet",extendedContext:!0,presetMapping:{default:"claude-sonnet-4-20250514",opus:"claude-opus-4-5-20251101",sonnet:"claude-sonnet-4-20250514",haiku:"claude-haiku-4-5-20251001"}},{id:"claude-haiku-4-5-20251001",name:"Claude Haiku 4.5",description:"Fast and efficient"}]}},Re="ccs-internal-managed";async function aa(){try{const s=await fetch("/api/settings/auth/tokens/raw");return s.ok?(await s.json())?.apiKey?.value??Re:Re}catch{return Re}}async function Ke(s,a){const t=ve[s];if(!t)return{success:!1};const n=t.models.find(x=>x.id===t.defaultModel)||t.models[0],i=n?.presetMapping||{default:t.defaultModel,opus:t.defaultModel,sonnet:t.defaultModel,haiku:t.defaultModel},c=await aa(),o={env:{ANTHROPIC_BASE_URL:`http://127.0.0.1:${He}/api/provider/${s}`,ANTHROPIC_AUTH_TOKEN:c,ANTHROPIC_MODEL:i.default,ANTHROPIC_DEFAULT_OPUS_MODEL:i.opus,ANTHROPIC_DEFAULT_SONNET_MODEL:i.sonnet,ANTHROPIC_DEFAULT_HAIKU_MODEL:i.haiku}};try{return{success:(await fetch(`/api/settings/${s}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({settings:o})})).ok,presetName:n?.name||t.defaultModel}}catch{return{success:!1}}}function na({currentProgress:s,allSteps:a}){return e.jsx("div",{className:"flex justify-center gap-1 pt-2",children:a.map((t,n)=>e.jsx("div",{className:`w-2 h-2 rounded-full transition-colors ${s>=n?"bg-primary":"bg-muted"}`},t))})}function ia({providers:s,onSelect:a}){return e.jsx("div",{className:"grid gap-2",children:s.map(t=>e.jsxs("button",{onClick:()=>a(t.id),className:"flex items-center justify-between p-3 border rounded-lg hover:bg-muted/50 transition-colors text-left",children:[e.jsxs("div",{children:[e.jsx("div",{className:"font-medium",children:t.name}),e.jsx("div",{className:"text-xs text-muted-foreground",children:t.description})]}),e.jsx(Os,{className:"w-4 h-4 text-muted-foreground"})]},t.id))})}function ra({selectedProvider:s,providers:a,authCommand:t,isRefreshing:n,isPending:i,onBack:c,onStartAuth:u,onRefresh:o}){const[x,h]=l.useState(!1),y=async m=>{await navigator.clipboard.writeText(m),h(!0),setTimeout(()=>h(!1),2e3)};return e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"text-center space-y-3",children:[e.jsxs("p",{className:"text-sm text-muted-foreground",children:["Authenticate with ",a.find(m=>m.id===s)?.name," to add an account"]}),e.jsx(R,{onClick:u,disabled:i,className:"w-full gap-2",size:"lg",children:i?e.jsxs(e.Fragment,{children:[e.jsx(W,{className:"w-4 h-4 animate-spin"}),"Authenticating..."]}):e.jsxs(e.Fragment,{children:[e.jsx(me,{className:"w-4 h-4"}),"Authenticate in Browser"]})}),i&&e.jsx("p",{className:"text-xs text-muted-foreground",children:"Complete the OAuth flow in your browser..."})]}),e.jsxs("div",{className:"relative",children:[e.jsx("div",{className:"absolute inset-0 flex items-center",children:e.jsx("span",{className:"w-full border-t"})}),e.jsx("div",{className:"relative flex justify-center text-xs uppercase",children:e.jsx("span",{className:"bg-background px-2 text-muted-foreground",children:"Or use terminal"})})]}),e.jsx(ks,{children:e.jsxs(Cs,{className:"p-4 space-y-3",children:[e.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[e.jsx(qt,{className:"w-4 h-4"}),"Run this command in your terminal:"]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("code",{className:"flex-1 px-3 py-2 bg-muted rounded-md font-mono text-sm",children:t}),e.jsx(R,{variant:"outline",size:"icon",onClick:()=>y(t),children:x?e.jsx(ne,{className:"w-4 h-4 text-green-500"}):e.jsx(Es,{className:"w-4 h-4"})})]})]})}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs(R,{variant:"ghost",onClick:c,disabled:i,children:[e.jsx(Ze,{className:"w-4 h-4 mr-2"}),"Back"]}),e.jsxs(R,{variant:"outline",onClick:o,disabled:n||i,children:[e.jsx(es,{className:`w-4 h-4 mr-2 ${n?"animate-spin":""}`}),n?"Checking...":"Refresh Status"]})]})]})}function oa({accounts:s,privacyMode:a,onSelect:t,onAddNew:n,onBack:i}){return e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wide",children:["Select an account (",s.length,")"]}),e.jsx("div",{className:"grid gap-2 max-h-[320px] overflow-y-auto pr-1",children:s.map(c=>e.jsxs("button",{type:"button",onClick:()=>t(c),className:"flex items-center justify-between p-3 border rounded-lg hover:bg-muted/50 transition-colors text-left",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"w-8 h-8 rounded-full bg-muted flex items-center justify-center",children:e.jsx(xe,{className:"w-4 h-4 text-muted-foreground"})}),e.jsxs("div",{children:[e.jsx("div",{className:B("font-medium",a&&Ae),children:c.email||c.id}),c.isDefault&&e.jsx("div",{className:"text-xs text-muted-foreground",children:"Default account"})]})]}),e.jsx(Os,{className:"w-4 h-4 text-muted-foreground"})]},c.id))}),e.jsxs("div",{className:"relative",children:[e.jsx("div",{className:"absolute inset-0 flex items-center",children:e.jsx("span",{className:"w-full border-t"})}),e.jsx("div",{className:"relative flex justify-center text-xs uppercase",children:e.jsx("span",{className:"bg-background px-2 text-muted-foreground",children:"Or"})})]}),e.jsxs("button",{type:"button",className:"w-full flex items-center gap-3 p-3 border-2 border-dashed border-primary/50 rounded-lg hover:border-primary hover:bg-primary/5 transition-colors text-left",onClick:n,children:[e.jsx("div",{className:"w-8 h-8 rounded-full bg-primary/10 flex items-center justify-center shrink-0",children:e.jsx(me,{className:"w-4 h-4 text-primary"})}),e.jsxs("div",{children:[e.jsx("div",{className:"font-medium text-primary",children:"Add new account"}),e.jsx("div",{className:"text-xs text-muted-foreground",children:"Authenticate with a different account"})]})]}),e.jsx("div",{className:"flex items-center justify-between pt-2",children:e.jsxs(R,{variant:"ghost",onClick:i,children:[e.jsx(Ze,{className:"w-4 h-4 mr-2"}),"Back"]})})]})}const js="__custom__";function la({selectedProvider:s,selectedAccount:a,variantName:t,modelName:n,isPending:i,privacyMode:c,onVariantNameChange:u,onModelChange:o,onBack:x,onSkip:h,onCreate:y}){const{t:m}=Z(),r=ve[s]?.models||[],C=n&&!r.some(f=>f.id===n),[v,w]=l.useState(C),N=s==="agy"&&n.trim().length>0?ee(n):!1,g=f=>{f===js?(w(!0),o("")):(w(!1),o(f))};return e.jsxs("div",{className:"space-y-4",children:[a&&e.jsxs("div",{className:"flex items-center gap-2 p-2 bg-muted/50 rounded-md text-sm",children:[e.jsx(xe,{className:"w-4 h-4"}),e.jsxs("span",{children:[m("setupVariant.using")," ",e.jsx("span",{className:B(c&&Ae),children:a.email||a.id})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(X,{htmlFor:"variant-name",children:m("setupVariant.variantNameRequired")}),e.jsx(ce,{id:"variant-name",value:t,onChange:f=>u(f.target.value),placeholder:m("setupVariant.variantNamePlaceholder")}),e.jsxs("div",{className:"text-xs text-muted-foreground",children:[m("setupVariant.invokeHintPrefix")," ccs ",t||"<name>",' "prompt"']})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(X,{children:m("setupVariant.model")}),v?e.jsxs("div",{className:"space-y-2",children:[e.jsx(ce,{value:n,onChange:f=>o(f.target.value),placeholder:m("setupVariant.modelPlaceholder")}),N&&e.jsx("p",{className:"text-xs text-destructive",children:"Antigravity denylist: Claude Opus 4.5 and Claude Sonnet 4.5 are deprecated."}),e.jsx("button",{type:"button",className:"text-xs text-primary hover:underline",onClick:()=>{w(!1),s==="agy"&&ee(n)&&o("")},children:m("setupVariant.choosePresetInstead")})]}):e.jsxs(Be,{value:r.some(f=>f.id===n)?n:"",onValueChange:g,children:[e.jsx(Ge,{children:e.jsx($e,{placeholder:m("setupVariant.selectModel")})}),e.jsxs(Qe,{children:[r.map(f=>e.jsx(je,{value:f.id,children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{children:f.name}),f.description&&e.jsxs("span",{className:"text-xs text-muted-foreground",children:["- ",f.description]})]})},f.id)),e.jsx(je,{value:js,children:e.jsx("span",{className:"text-primary",children:m("setupVariant.customModelName")})})]})]}),e.jsx("div",{className:"text-xs text-muted-foreground",children:v?m("setupVariant.enterAnyModel"):m("setupVariant.defaultModel",{model:ve[s]?.defaultModel||m("setupVariant.providerDefault")})})]}),e.jsxs("div",{className:"flex items-center justify-between pt-2",children:[e.jsxs(R,{variant:"ghost",onClick:x,children:[e.jsx(Ze,{className:"w-4 h-4 mr-2"}),m("setupVariant.back")]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(R,{variant:"ghost",onClick:h,children:m("setupVariant.skip")}),e.jsx(R,{onClick:y,disabled:!t||i||N,children:m(i?"setupVariant.creating":"setupVariant.createVariant")})]})]}),e.jsx("p",{className:"text-xs text-center text-muted-foreground",children:m("setupVariant.skipHint")})]})}function ca({variantName:s,onClose:a}){return e.jsxs("div",{className:"space-y-4 text-center",children:[e.jsx("div",{className:"flex justify-center",children:e.jsx("div",{className:"w-16 h-16 bg-green-100 dark:bg-green-900/30 rounded-full flex items-center justify-center",children:e.jsx(ne,{className:"w-8 h-8 text-green-600 dark:text-green-400"})})}),e.jsxs("div",{children:[e.jsx("div",{className:"font-semibold text-lg",children:"Variant Created!"}),e.jsx("div",{className:"text-sm text-muted-foreground",children:"Your custom variant is ready to use"})]}),e.jsx(ks,{children:e.jsxs(Cs,{className:"p-4 space-y-2",children:[e.jsx("div",{className:"text-sm text-muted-foreground",children:"Usage:"}),e.jsxs("code",{className:"block px-3 py-2 bg-muted rounded-md font-mono text-sm",children:["ccs ",s,' "your prompt here"']})]})}),e.jsx(R,{onClick:a,className:"w-full",children:"Done"})]})}function da({open:s,onClose:a}){const[t,n]=l.useState("provider"),[i,c]=l.useState(""),[u,o]=l.useState(null),[x,h]=l.useState(""),[y,m]=l.useState(""),[r,C]=l.useState(!1),[v,w]=l.useState(!1),{data:N,refetch:g}=As(),f=Js(),E=Ws(),A=Ys(),{privacyMode:F}=Ss(),P=N?.authStatus.find(M=>M.provider===i),p=l.useMemo(()=>P?.accounts||[],[P?.accounts]);l.useEffect(()=>{if(!s){const M=setTimeout(()=>{n("provider"),c(""),o(null),h(""),m(""),w(!1)},0);return()=>clearTimeout(M)}},[s]),l.useEffect(()=>{if(t==="auth"&&p.length>0&&!v){const M=setTimeout(()=>{n("account")},0);return()=>clearTimeout(M)}},[t,p,v]);const U=async()=>{C(!0),await g(),C(!1)},b=()=>{const M=(P?.accounts?.length||0)===0;E.mutate({provider:i},{onSuccess:async _=>{if(M){const H=await Ke(i);H.success&&H.presetName?q.success(`Applied "${H.presetName}" preset`):H.success||q.warning(Ds.t("commonToast.accountAddedPresetFailed"))}_.account&&(o(_.account),n("variant")),g()}})},S=M=>{c(M),(N?.authStatus.find(G=>G.provider===M)?.accounts||[]).length===0?n("auth"):n("account")},O=M=>{o(M),n("variant")},j=async()=>{if(!(!x||!i))try{await f.mutateAsync({name:x,provider:i,model:y||void 0,account:u?.id}),n("success")}catch(M){console.error("Failed to create variant:",M)}},k=`ccs ${i} --auth --add`,K=Zs(t),I=M=>{if(!M&&(E.isPending&&i&&A.mutate(i),t==="success"||t==="provider")){a();return}};return e.jsx(ze,{open:s,onOpenChange:I,children:e.jsxs(Je,{className:"sm:max-w-lg",onPointerDownOutside:M=>{t!=="success"&&t!=="provider"&&M.preventDefault()},onEscapeKeyDown:M=>{(E.isPending||f.isPending)&&M.preventDefault()},children:[e.jsxs(We,{children:[e.jsxs(Ye,{className:"flex items-center gap-2",children:[e.jsx(Ne,{className:"w-5 h-5 text-primary"}),"Quick Setup Wizard"]}),e.jsxs(Ps,{children:[t==="provider"&&"Select a provider to get started",t==="auth"&&"Authenticate with your provider",t==="account"&&"Select which account to use",t==="variant"&&"Create your custom variant",t==="success"&&"Setup complete!"]})]}),e.jsxs("div",{className:"space-y-4 py-4",children:[t==="provider"&&e.jsx(ia,{providers:ls,onSelect:S}),t==="auth"&&e.jsx(ra,{selectedProvider:i,providers:ls,authCommand:k,isRefreshing:r,isPending:E.isPending,onBack:()=>n("provider"),onStartAuth:b,onRefresh:U}),t==="account"&&e.jsx(oa,{accounts:p,privacyMode:F,onSelect:O,onAddNew:()=>{w(!0),n("auth")},onBack:()=>n("provider")}),t==="variant"&&e.jsx(la,{selectedProvider:i,selectedAccount:u,variantName:x,modelName:y,isPending:f.isPending,privacyMode:F,onVariantNameChange:h,onModelChange:m,onBack:()=>p.length>0?n("account"):n("provider"),onSkip:a,onCreate:j}),t==="success"&&e.jsx(ca,{variantName:x,onClose:a})]}),e.jsx(na,{currentProgress:K,allSteps:Xs})]})})}const ua=3e3,ma=300*1e3;async function Le(s){const a=await s.text();if(!a)return{};try{return JSON.parse(a)}catch{const t=s.status>=400?`Request failed with status ${s.status}`:void 0;return t?{error:t}:{}}}const le={provider:null,isAuthenticating:!1,error:null,authUrl:null,oauthState:null,isSubmittingCallback:!1,isDeviceCodeFlow:!1};function xa(){const[s,a]=l.useState(le),t=l.useRef(null),n=l.useRef(null),i=l.useRef(0),c=l.useRef(!1),u=Ve(),o=l.useCallback(()=>{n.current&&(clearInterval(n.current),n.current=null)},[]);l.useEffect(()=>()=>{t.current?.abort(),o(),c.current=!1},[o]);const x=l.useCallback(async(r,C)=>{if(Date.now()-i.current>ma){o(),a(v=>({...v,isAuthenticating:!1,error:"Authentication timed out. Please try again."}));return}try{const w=await(await fetch(`/api/cliproxy/auth/${r}/status?state=${encodeURIComponent(C)}`)).json();if(w.status==="ok")o(),u.invalidateQueries({queryKey:["cliproxy-auth"]}),u.invalidateQueries({queryKey:["account-quota"]}),q.success(`${r} authentication successful`),c.current=!1,a(le);else if(w.status==="auth_url"){const N=w.url||w.auth_url;N&&(a(g=>({...g,authUrl:N})),c.current||(c.current=!0,window.open(N,"_blank")))}else if(w.status==="device_code"){o();const N=w.user_code&&w.verification_url?`Open ${w.verification_url} and enter code: ${w.user_code}`:"Switch to Device Code method and try again.";q.error("Provider returned Device Code flow in callback mode"),a(g=>({...g,isAuthenticating:!1,error:N}))}else if(w.status==="error"){o();const N=w.error||"Authentication failed";q.error(N),a(g=>({...g,isAuthenticating:!1,error:N}))}}catch{}},[u,o]),h=l.useCallback(async(r,C)=>{if(!Fe(r)){a({...le,error:`Unknown provider: ${r}`});return}t.current?.abort(),o(),c.current=!1;const v=new AbortController;t.current=v;const N=(C?.flowType||(Ms(r)?"device_code":"authorization_code"))==="device_code",g=C?.startEndpoint||(N?"start":"start-url"),f={nickname:C?.nickname,kiroMethod:C?.kiroMethod,riskAcknowledgement:C?.riskAcknowledgement};a({provider:r,isAuthenticating:!0,error:null,authUrl:null,oauthState:null,isSubmittingCallback:!1,isDeviceCodeFlow:N});try{if(g==="start")fetch(`/api/cliproxy/auth/${r}/start`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(f),signal:v.signal}).then(async E=>{const A=await Le(E),F=A.success===!0;if(E.ok&&F)u.invalidateQueries({queryKey:["cliproxy-auth"]}),u.invalidateQueries({queryKey:["account-quota"]}),c.current=!1,a(le);else{const P=typeof A.error=="string"?A.error:"Authentication failed";q.error(P),a(p=>({...p,isAuthenticating:!1,error:P}))}}).catch(E=>{if(E instanceof Error&&E.name==="AbortError")return;const A=E instanceof Error?E.message:"Authentication failed";q.error(A),a(F=>({...F,isAuthenticating:!1,error:A}))});else{const E=await fetch(`/api/cliproxy/auth/${r}/start-url`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(f),signal:v.signal}),A=await Le(E),F=A.success===!0;if(!E.ok||!F){const U=typeof A.error=="string"?A.error:"Failed to start OAuth";throw new Error(U)}const P=typeof A.authUrl=="string"?A.authUrl:null,p=typeof A.state=="string"?A.state:null;a(U=>({...U,authUrl:P,oauthState:p})),P&&(c.current=!0,window.open(P,"_blank")),p&&(i.current=Date.now(),n.current=setInterval(()=>{x(r,p)},ua))}}catch(E){if(E instanceof Error&&E.name==="AbortError"){c.current=!1,a(le);return}const A=E instanceof Error?E.message:"Authentication failed";q.error(A),a(F=>({...F,isAuthenticating:!1,error:A}))}},[x,o,u]),y=l.useCallback(()=>{const r=s.provider;t.current?.abort(),o(),c.current=!1,a(le),r&&be.cliproxy.auth.cancel(r).catch(()=>{})},[s.provider,o]),m=l.useCallback(async r=>{if(s.provider){a(C=>({...C,isSubmittingCallback:!0,error:null}));try{const C=await fetch(`/api/cliproxy/auth/${s.provider}/submit-callback`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({redirectUrl:r})}),v=await Le(C),w=v.success===!0;if(C.ok&&w)o(),u.invalidateQueries({queryKey:["cliproxy-auth"]}),u.invalidateQueries({queryKey:["account-quota"]}),q.success(`${s.provider} authentication successful`),a(le);else{const N=typeof v.error=="string"?v.error:"Callback submission failed";throw new Error(N)}}catch(C){const v=C instanceof Error?C.message:"Failed to submit callback";q.error(v),a(w=>({...w,isSubmittingCallback:!1,error:v}))}}},[s.provider,u,o]);return l.useMemo(()=>({...s,startAuth:h,cancelAuth:y,submitCallback:m}),[s,h,y,m])}function Ks({className:s,showAcknowledgement:a=!1,acknowledgementPhrase:t=ke,acknowledgementText:n="",onAcknowledgementTextChange:i,disabled:c=!1,showProxySettingsLink:u=!1}){const{t:o}=Z(),x=o("accountSafetyWarning.title"),h=o("accountSafetyWarning.subtitle"),y=o("accountSafetyWarning.firstLine"),m=o("accountSafetyWarning.secondLine"),r="https://github.com/kaitranntt/ccs/issues/509",C=o("accountSafetyWarning.issueLabel"),v=o("accountSafetyWarning.proxySettingsLabel");return e.jsxs("section",{role:"alert",className:B("relative overflow-hidden rounded-xl border border-amber-500/30 bg-gradient-to-br from-amber-50 via-background to-rose-50/70 shadow-sm dark:from-amber-950/20 dark:to-rose-950/20",s),children:[e.jsx("div",{className:"absolute inset-x-0 top-0 h-0.5 bg-gradient-to-r from-amber-500 via-orange-500 to-rose-500"}),e.jsxs("div",{className:"space-y-3 p-4",children:[e.jsxs("div",{className:"flex items-start justify-between gap-3",children:[e.jsxs("div",{className:"flex items-start gap-2.5",children:[e.jsx("div",{className:"mt-0.5 inline-flex h-7 w-7 items-center justify-center rounded-md bg-amber-500/15 text-amber-700 dark:text-amber-400",children:e.jsx(Se,{className:"h-4 w-4"})}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-semibold leading-5",children:x}),e.jsx("p",{className:"text-xs text-muted-foreground",children:h})]})]}),e.jsx(V,{variant:"outline",className:"border-amber-500/40 text-amber-700 dark:text-amber-300",children:"High Risk"})]}),e.jsxs("div",{className:"space-y-2 text-sm leading-relaxed",children:[e.jsx("p",{children:y}),e.jsx("p",{className:"font-medium text-amber-900 dark:text-amber-200",children:m}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"CCS is provided as-is and does not take responsibility for suspension, bans, or access loss from upstream providers."})]}),e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsxs("a",{href:r,target:"_blank",rel:"noreferrer",className:"inline-flex items-center gap-1.5 rounded-md border border-amber-500/30 bg-amber-500/10 px-2.5 py-1 text-xs font-medium text-amber-800 transition-colors hover:bg-amber-500/15 dark:text-amber-200",children:[C,e.jsx(me,{className:"h-3.5 w-3.5"})]}),u&&e.jsxs("a",{href:"/settings?tab=proxy",className:"inline-flex items-center gap-1.5 rounded-md border border-amber-500/30 bg-amber-500/10 px-2.5 py-1 text-xs font-medium text-amber-800 transition-colors hover:bg-amber-500/15 dark:text-amber-200",children:[e.jsx(Kt,{className:"h-3.5 w-3.5"}),v]}),e.jsx("span",{className:"rounded-md border border-border/70 bg-muted/60 px-2.5 py-1 text-xs text-muted-foreground",children:"Applies to CLI and dashboard auth"})]}),a&&i&&e.jsxs("div",{className:"rounded-lg border border-amber-500/25 bg-amber-500/5 p-2.5",children:[e.jsxs(X,{htmlFor:"account-risk-ack-text",className:"text-xs leading-5",children:["Type exact phrase to continue:"," ",e.jsx("code",{className:"rounded bg-muted px-1 py-0.5 font-mono",children:t})]}),e.jsx(ce,{id:"account-risk-ack-text",value:n,onChange:w=>i(w.target.value),placeholder:t,disabled:c,className:"mt-2 font-mono text-xs"})]})]})]})}function pa({className:s,value:a,onChange:t,disabled:n=!1}){const{t:i}=Z(),c=[a.reviewedIssue509,a.understandsBanRisk,a.acceptsFullResponsibility,a.typedPhrase.trim().replace(/\s+/g," ").toUpperCase()===fs].filter(Boolean).length,u=c/4*100,o=x=>{t({...a,...x})};return e.jsxs("section",{role:"alert",className:B("relative overflow-hidden rounded-xl border border-rose-500/35 bg-gradient-to-br from-rose-50 via-background to-amber-50/70 p-4 shadow-sm dark:from-rose-950/20 dark:to-amber-950/20",s),children:[e.jsx("div",{className:"absolute inset-x-0 top-0 h-0.5 bg-gradient-to-r from-rose-500 via-orange-500 to-amber-500"}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-start justify-between gap-3",children:[e.jsxs("div",{className:"flex items-start gap-2.5",children:[e.jsx("div",{className:"mt-0.5 inline-flex h-7 w-7 items-center justify-center rounded-md bg-rose-500/15 text-rose-700 dark:text-rose-300",children:e.jsx(Se,{className:"h-4 w-4"})}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-sm font-semibold leading-5",children:i("antigravityChecklist.title")}),e.jsx("p",{className:"text-xs text-muted-foreground",children:i("antigravityChecklist.subtitle")})]})]}),e.jsx(V,{variant:"outline",className:"border-rose-500/40 text-rose-700 dark:text-rose-300",children:i("antigravityChecklist.mandatory")})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsxs("div",{className:"flex items-center justify-between text-xs text-muted-foreground",children:[e.jsx("span",{children:i("antigravityChecklist.completion")}),e.jsx("span",{children:i("antigravityChecklist.stepsCount",{current:c})})]}),e.jsx(Ue,{value:u,className:"h-2"})]}),e.jsxs("div",{className:"space-y-3 rounded-lg border border-rose-500/20 bg-rose-500/5 p-3",children:[e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx(Ce,{id:"agy-step-reviewed-issue",checked:a.reviewedIssue509,onCheckedChange:x=>o({reviewedIssue509:!!x}),disabled:n}),e.jsx(X,{htmlFor:"agy-step-reviewed-issue",className:"text-xs leading-5",children:"Step 1: I reviewed issue #509 and understand AGY OAuth can trigger account bans/suspensions."})]}),e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx(Ce,{id:"agy-step-understands-risk",checked:a.understandsBanRisk,onCheckedChange:x=>o({understandsBanRisk:!!x}),disabled:n}),e.jsx(X,{htmlFor:"agy-step-understands-risk",className:"text-xs leading-5",children:"Step 2: I understand this OAuth action is my own decision and I accept the upstream risk."})]}),e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx(Ce,{id:"agy-step-accept-responsibility",checked:a.acceptsFullResponsibility,onCheckedChange:x=>o({acceptsFullResponsibility:!!x}),disabled:n}),e.jsx(X,{htmlFor:"agy-step-accept-responsibility",className:"text-xs leading-5",children:"Step 3: I accept full responsibility. CCS is not liable for suspension, bans, or access loss."})]})]}),e.jsxs("div",{className:"space-y-2 rounded-lg border border-amber-500/25 bg-amber-500/5 p-3",children:[e.jsxs("div",{className:"flex items-center gap-1.5 text-xs font-medium text-amber-800 dark:text-amber-200",children:[e.jsx(_s,{className:"h-3.5 w-3.5"}),"Step 4: Type exact phrase to continue"]}),e.jsx(ce,{value:a.typedPhrase,onChange:x=>o({typedPhrase:x.target.value}),placeholder:fs,disabled:n,className:"font-mono text-xs"})]}),e.jsx("div",{className:"flex flex-wrap items-center gap-2 text-xs",children:e.jsxs("a",{href:"https://github.com/kaitranntt/ccs/issues/509",target:"_blank",rel:"noreferrer",className:"inline-flex items-center gap-1.5 rounded-md border border-rose-500/30 bg-rose-500/10 px-2.5 py-1 font-medium text-rose-800 transition-colors hover:bg-rose-500/15 dark:text-rose-200",children:["Read issue #509",e.jsx(me,{className:"h-3.5 w-3.5"})]})})]})]})}function ha(s){return s.trim().replace(/\s+/g," ").toUpperCase()}function ga({open:s,onClose:a,provider:t,displayName:n,isFirstAccount:i=!1}){const[c,u]=l.useState(""),[o,x]=l.useState(""),[h,y]=l.useState(!1),[m,r]=l.useState(null),[C,v]=l.useState(""),[w,N]=l.useState(_e),[g,f]=l.useState(!1),[E,A]=l.useState(!1),[F,P]=l.useState(cs),{t:p}=Z(),U=l.useRef(!1),b=xa(),S=et(),O=t==="kiro",j=t==="gemini",k=t==="agy"&&!g,K=t==="agy"&&E,I=Zt(w),M=ha(C)===ke,_=Ms(t),H=st(t),G=tt(F),se=O?G.flowType==="device_code":_,z=b.isAuthenticating||S.isPending,Y=c.trim(),te=m||b.error,d=l.useCallback(async()=>{const D=await fetch("/api/settings/auth/antigravity-risk");if(!D.ok)throw new Error("Failed to load Antigravity power user setting");return(await D.json()).antigravityAckBypass===!0},[]),T=()=>{u(""),x(""),y(!1),r(null),v(""),N(_e),f(!1),A(!1),P(cs),U.current=!1,a()};l.useEffect(()=>{s&&(v(""),N(_e),r(null))},[t,s]),l.useEffect(()=>{let D=!1;if(!s||t!=="agy"){f(!1),A(!1);return}return(async()=>{try{A(!0);const ae=await d();D||f(ae)}catch{D||f(!1)}finally{D||A(!1)}})(),()=>{D=!0}},[d,s,t]),l.useEffect(()=>{if(!s||t!=="agy"||!b.error||!g)return;const D=b.error.toLowerCase();if(!(D.includes("agy_risk_ack_required")||D.includes("responsibility acknowledgement")||D.includes("responsibility checklist")))return;let ae=!1;return(async()=>{try{A(!0);const we=await d();if(ae)return;f(we),we||r("Power user mode is off. Complete the AGY checklist and retry.")}catch{if(ae)return;f(!1),r("Power user mode is off. Complete the AGY checklist and retry.")}finally{ae||A(!1)}})(),()=>{ae=!0}},[g,b.error,d,s,t]),l.useEffect(()=>{!b.isAuthenticating&&!b.error&&b.provider===null&&s&&U.current&&(U.current=!1,(async()=>{try{const ie=await Ke(t);ie.success&&ie.presetName&&i&&q.success(`Applied "${ie.presetName}" preset`)}catch{}T()})())},[b.isAuthenticating,b.error,b.provider]);const $=()=>{b.cancelAuth(),T()},de=async()=>{b.authUrl&&(await navigator.clipboard.writeText(b.authUrl),y(!0),setTimeout(()=>y(!1),2e3))},De=()=>{o.trim()&&b.submitCallback(o.trim())},Me=()=>{if(K){r("Loading Antigravity safety settings. Please wait a moment and retry.");return}if(k&&!I){r("Complete all Antigravity responsibility steps before authenticating this provider.");return}if(j&&!M){r(`Type "${ke}" to acknowledge the account safety warning before authenticating this provider.`);return}if(H&&!Y){r(`Nickname is required for ${n} accounts.`);return}r(null),U.current=!0,b.startAuth(t,{nickname:Y||void 0,kiroMethod:O?F:void 0,flowType:O?G.flowType:void 0,startEndpoint:O?G.startEndpoint:void 0,riskAcknowledgement:k?{version:ea,reviewedIssue509:w.reviewedIssue509,understandsBanRisk:w.understandsBanRisk,acceptsFullResponsibility:w.acceptsFullResponsibility,typedPhrase:w.typedPhrase}:void 0})},Te=()=>{U.current=!0,S.mutate(void 0,{onSuccess:async()=>{const D=await Ke("kiro");D.success&&D.presetName&&i&&q.success(`Applied "${D.presetName}" preset`),T()}})},Oe=D=>{D||$()},J=b.isAuthenticating;return e.jsx(ze,{open:s,onOpenChange:Oe,children:e.jsxs(Je,{className:"sm:max-w-md",onInteractOutside:D=>{J&&D.preventDefault()},children:[e.jsxs(We,{children:[e.jsx(Ye,{children:p("addAccountDialog.title",{displayName:n})}),e.jsx(Ps,{children:p(O?"addAccountDialog.descKiro":se?"addAccountDialog.descDeviceCode":"addAccountDialog.descOauth")})]}),e.jsxs("div",{className:"space-y-4 py-4",children:[k&&!J&&e.jsx(pa,{value:w,onChange:D=>{N(D),r(null)},disabled:z}),t==="agy"&&g&&!J&&e.jsxs("div",{className:"rounded-lg border border-amber-400/35 bg-amber-50/70 p-3 text-xs text-amber-900 dark:border-amber-800/60 dark:bg-amber-950/25 dark:text-amber-100",children:[e.jsxs("div",{className:"mb-1.5 flex items-center gap-1.5 font-semibold",children:[e.jsx(_s,{className:"h-3.5 w-3.5"}),p("addAccountDialog.powerUserEnabled")]}),p("addAccountDialog.powerUserSkipped")]}),j&&!J&&e.jsx(Ks,{showAcknowledgement:!0,acknowledgementPhrase:ke,acknowledgementText:C,onAcknowledgementTextChange:D=>{v(D),r(null)},disabled:z}),O&&!J&&e.jsxs("div",{className:"space-y-2",children:[e.jsx(X,{htmlFor:"kiro-auth-method",children:p("addAccountDialog.authMethod")}),e.jsxs(Be,{value:F,onValueChange:D=>{P(D),r(null)},children:[e.jsx(Ge,{id:"kiro-auth-method",children:e.jsx($e,{placeholder:p("addAccountDialog.selectKiroAuthMethod")})}),e.jsx(Qe,{children:at.map(D=>e.jsx(je,{value:D.id,children:D.label},D.id))})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:G.description})]}),!J&&e.jsxs("div",{className:"space-y-2",children:[e.jsx(X,{htmlFor:"nickname",children:p(H?"addAccountDialog.nicknameRequired":"addAccountDialog.nicknameOptional")}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(xe,{className:"w-4 h-4 text-muted-foreground"}),e.jsx(ce,{id:"nickname",value:c,onChange:D=>{u(D.target.value),r(null)},placeholder:p("addAccountDialog.nicknamePlaceholder"),disabled:z,className:"flex-1"})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:p(H?"addAccountDialog.nicknameRequiredHint":"addAccountDialog.nicknameOptionalHint")})]}),J&&e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"text-center",children:[e.jsxs("p",{className:"text-sm text-muted-foreground",children:[e.jsx(W,{className:"w-4 h-4 inline mr-2 animate-spin"}),p("addAccountDialog.waitingForAuth")]}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:b.isDeviceCodeFlow?p("addAccountDialog.deviceCodeHint"):p("addAccountDialog.browserHint")})]}),b.authUrl&&!b.isDeviceCodeFlow&&e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(X,{className:"text-xs",children:p("addAccountDialog.openUrlLabel")}),e.jsxs("div",{className:"p-3 bg-muted rounded-md",children:[e.jsx("p",{className:"text-xs text-muted-foreground break-all font-mono line-clamp-3",children:b.authUrl}),e.jsxs("div",{className:"flex gap-2 mt-2",children:[e.jsx(R,{variant:"outline",size:"sm",onClick:de,children:h?e.jsxs(e.Fragment,{children:[e.jsx(ne,{className:"w-3 h-3 mr-1"}),p("addAccountDialog.copied")]}):e.jsxs(e.Fragment,{children:[e.jsx(Es,{className:"w-3 h-3 mr-1"}),p("addAccountDialog.copy")]})}),e.jsxs(R,{variant:"outline",size:"sm",onClick:()=>{if(!b.authUrl)return;const D=window.open(b.authUrl,"_blank");(!D||D.closed||typeof D.closed>"u")&&q.warning(p("addAccountDialog.popupBlocked"),{duration:5e3})},children:[e.jsx(me,{className:"w-3 h-3 mr-1"}),p("addAccountDialog.open")]})]})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(X,{htmlFor:"callback-url",className:"text-xs",children:p("addAccountDialog.redirectPasteLabel")}),e.jsx(ce,{id:"callback-url",value:o,onChange:D=>x(D.target.value),placeholder:p("addAccountDialog.callbackPlaceholder"),className:"font-mono text-xs"}),e.jsx(R,{variant:"secondary",size:"sm",onClick:De,disabled:!o.trim()||b.isSubmittingCallback,children:b.isSubmittingCallback?e.jsxs(e.Fragment,{children:[e.jsx(W,{className:"w-3 h-3 mr-1 animate-spin"}),p("addAccountDialog.submitting")]}):p("addAccountDialog.submitCallback")})]})]}),!b.authUrl&&!b.isDeviceCodeFlow&&e.jsx("p",{className:"text-xs text-center text-muted-foreground",children:p("addAccountDialog.preparingUrl")})]}),te&&e.jsx("p",{className:"text-xs text-center text-destructive",children:te}),S.isPending&&e.jsxs("p",{className:"text-sm text-center text-muted-foreground",children:[e.jsx(W,{className:"w-4 h-4 inline mr-2 animate-spin"}),p("addAccountDialog.importingToken")]}),e.jsxs("div",{className:"flex items-center justify-end gap-2 pt-2",children:[e.jsx(R,{variant:"ghost",onClick:$,children:p("addAccountDialog.cancel")}),O&&!J&&e.jsx(R,{variant:"outline",onClick:Te,disabled:z,children:S.isPending?e.jsxs(e.Fragment,{children:[e.jsx(W,{className:"w-4 h-4 mr-2 animate-spin"}),p("addAccountDialog.importing")]}):e.jsxs(e.Fragment,{children:[e.jsx(Vt,{className:"w-4 h-4 mr-2"}),p("addAccountDialog.importFromIde")]})}),!J&&e.jsxs(R,{onClick:Me,disabled:z||K||H&&!Y||k&&!I||j&&!M,children:[e.jsx(me,{className:"w-4 h-4 mr-2"}),p("addAccountDialog.authenticate")]})]})]})]})})}const as="[1m]";function fa(s){return s.toLowerCase().startsWith("gemini-")}function ns(s){return s.toLowerCase().endsWith(as.toLowerCase())}function ja(s){return!s||ns(s)?s:`${s}${as}`}function Vs(s){return s&&(ns(s)?s.slice(0,-as.length):s)}const vs=["ANTHROPIC_MODEL"],va=["ANTHROPIC_BASE_URL","ANTHROPIC_AUTH_TOKEN"];function Na(s){const a=s?.env||{};return va.filter(t=>!a[t]?.trim())}function ya(s){const[a,t]=l.useState(null),[n,i]=l.useState(!1),c=Ve(),{data:u,isLoading:o,refetch:x}=bs({queryKey:["settings",s],queryFn:async()=>{const S=await fetch(`/api/settings/${s}/raw`);return S.ok?S.json():{profile:s,settings:{env:{}},mtime:Date.now(),path:`~/.ccs/profiles/${s}/settings.json`}}}),h=u?.settings,y=l.useMemo(()=>a!==null?a:h?JSON.stringify(h,null,2):`{
|
|
2
2
|
"env": {}
|
|
3
3
|
}`,[a,h]),m=l.useCallback(S=>{t(S)},[]),r=l.useMemo(()=>{try{return JSON.parse(y)}catch{return h||{env:{}}}},[y,h]),C=r?.env?.ANTHROPIC_MODEL,v=r?.env?.ANTHROPIC_DEFAULT_OPUS_MODEL,w=r?.env?.ANTHROPIC_DEFAULT_SONNET_MODEL,N=r?.env?.ANTHROPIC_DEFAULT_HAIKU_MODEL,g=l.useMemo(()=>{const S=r?.env||{};return vs.some(O=>{const j=S[O];return j&&ns(j)})},[r]),f=l.useCallback((S,O)=>{const j={...r?.env||{},[S]:O},k={...r,env:j};t(JSON.stringify(k,null,2))},[r]),E=l.useCallback(S=>{const O=r?.env||{},j={};for(const I of vs){const M=O[I];M&&(j[I]=S?ja(M):Vs(M))}const k={...O,...j};delete k.CCS_EXTENDED_CONTEXT;const K={...r,env:k};t(JSON.stringify(K,null,2))},[r]),A=l.useCallback(S=>{const O={...r?.env||{},...S},j={...r,env:O};t(JSON.stringify(j,null,2))},[r]),F=l.useMemo(()=>{try{return JSON.parse(y),!0}catch{return!1}},[y]),P=l.useMemo(()=>a===null?!1:a!==JSON.stringify(h,null,2),[a,h]),p=l.useMemo(()=>Na(r),[r]),U=zs({mutationFn:async()=>{const S=JSON.parse(y),O=await fetch(`/api/settings/${s}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({settings:S,expectedMtime:u?.mtime})});if(O.status===409)throw new Error("CONFLICT");if(!O.ok)throw new Error("Failed to save");return O.json()},onSuccess:S=>{c.invalidateQueries({queryKey:["settings",s]}),t(null),S?.warning?q.success("Settings saved",{description:S.warning}):q.success("Settings saved")},onError:S=>{S.message==="CONFLICT"?i(!0):q.error(S.message)}}),b=async S=>{i(!1),S?(await x(),U.mutate()):t(null)};return{data:u,isLoading:o,refetch:x,rawJsonContent:y,rawJsonEdits:a,isRawJsonValid:F,hasChanges:P,currentSettings:r,currentModel:C,opusModel:v,sonnetModel:w,haikuModel:N,extendedContextEnabled:g,toggleExtendedContext:E,handleRawJsonChange:m,updateEnvValue:f,updateEnvValues:A,saveMutation:{mutate:()=>U.mutate(),isPending:U.isPending},conflictDialog:n,setConflictDialog:i,handleConflictResolve:b,missingRequiredFields:p}}const wa=/-(medium|high|xhigh)$/i;function ba(s){if(!s)return;const a=s.trim().match(wa);if(a?.[1])return a[1].toLowerCase()}function Ie(s){if(!s)return null;const a=ba(s);return a?{label:`Pinned ${a}`,explicit:!0}:{label:"Auto effort",explicit:!1}}function oe({label:s,description:a,value:t,onChange:n,catalog:i,allModels:c,disabled:u}){const{t:o}=Z(),x=new Set(i?.models.map(m=>m.id)||[]),h=i?.provider==="codex",y=h?Ie(t):null;return e.jsxs("div",{className:"space-y-1.5",children:[e.jsxs("div",{children:[e.jsx("label",{className:"text-xs font-medium",children:s}),a&&e.jsx("p",{className:"text-[10px] text-muted-foreground",children:a})]}),e.jsxs(Be,{value:t||"",onValueChange:n,disabled:u,children:[e.jsx(Ge,{className:"h-9",children:e.jsx($e,{placeholder:o("providerModelSelector.selectModel"),children:t&&e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"truncate font-mono text-xs",children:t}),y&&e.jsx(V,{variant:y.explicit?"secondary":"outline",className:"text-[9px] h-4 px-1 uppercase",children:y.label})]})})}),e.jsxs(Qe,{className:"max-h-[300px]",children:[i&&i.models.length>0&&e.jsxs(ds,{children:[e.jsx(us,{className:"text-xs text-primary",children:o("providerModelSelector.recommended")}),i.models.map(m=>{const r=h?Ie(m.id):null;return e.jsx(je,{value:m.id,children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"truncate font-mono text-xs",children:m.id}),m.tier==="paid"&&e.jsx(V,{variant:"outline",className:"text-[9px] h-4 px-1",children:o("providerModelSelector.paid")}),r&&e.jsx(V,{variant:r.explicit?"secondary":"outline",className:"text-[9px] h-4 px-1 uppercase",children:r.label}),t===m.id&&e.jsx(ne,{className:"w-3 h-3 text-primary ml-auto"})]})},m.id)})]}),c.length>0&&e.jsxs(ds,{children:[e.jsx(us,{className:"text-xs text-muted-foreground",children:o("providerModelSelector.allModelsCount",{count:c.length})}),c.filter(m=>!x.has(m.id)).map(m=>{const r=h?Ie(m.id):null;return e.jsx(je,{value:m.id,children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"truncate font-mono text-xs",children:m.id}),r&&e.jsx(V,{variant:r.explicit?"secondary":"outline",className:"text-[9px] h-4 px-1 uppercase",children:r.label}),t===m.id&&e.jsx(ne,{className:"w-3 h-3 text-primary ml-auto"})]})},m.id)})]}),(!i||i.models.length===0)&&c.length===0&&e.jsx("div",{className:"py-2 px-3 text-xs text-muted-foreground",children:o("providerModelSelector.noModelsAvailable")})]})]})]})}function ka({open:s,onClose:a,currentValues:t,onApply:n,onSave:i,isSaving:c,catalog:u,allModels:o}){const{t:x}=Z(),[h,y]=l.useState(t),[m,r]=l.useState(""),C=v=>{v?(y(t),r("")):a()};return e.jsx(ze,{open:s,onOpenChange:C,children:e.jsxs(Je,{className:"sm:max-w-md",children:[e.jsx(We,{children:e.jsxs(Ye,{className:"flex items-center gap-2",children:[e.jsx(Ne,{className:"w-4 h-4"}),x("customPresetDialog.title")]})}),e.jsxs("div",{className:"space-y-4 py-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(X,{htmlFor:"preset-name",children:x("customPresetDialog.presetNameOptional")}),e.jsx(ce,{id:"preset-name",value:m,onChange:v=>r(v.target.value),placeholder:x("customPresetDialog.presetNamePlaceholder"),className:"text-sm"})]}),e.jsx(ts,{}),u?.provider==="codex"&&e.jsxs("p",{className:"text-[11px] text-muted-foreground rounded-md border bg-muted/30 px-2.5 py-2",children:[x("customPresetDialog.codexTipPrefix")," ",e.jsx("code",{children:"-medium"}),", ",e.jsx("code",{children:"-high"}),", and"," ",e.jsx("code",{children:"-xhigh"})," ",x("customPresetDialog.codexTipSuffix")]}),e.jsx(oe,{label:x("customPresetDialog.defaultModel"),description:x("customPresetDialog.defaultModelDesc"),value:h.default,onChange:v=>y({...h,default:v}),catalog:u,allModels:o}),e.jsx(oe,{label:x("customPresetDialog.opusModel"),description:x("customPresetDialog.opusModelDesc"),value:h.opus,onChange:v=>y({...h,opus:v}),catalog:u,allModels:o}),e.jsx(oe,{label:x("customPresetDialog.sonnetModel"),description:x("customPresetDialog.sonnetModelDesc"),value:h.sonnet,onChange:v=>y({...h,sonnet:v}),catalog:u,allModels:o}),e.jsx(oe,{label:x("customPresetDialog.haikuModel"),description:x("customPresetDialog.haikuModelDesc"),value:h.haiku,onChange:v=>y({...h,haiku:v}),catalog:u,allModels:o})]}),e.jsxs(nt,{className:"gap-2 sm:gap-0",children:[e.jsx(R,{variant:"outline",onClick:a,children:x("customPresetDialog.cancel")}),i&&e.jsxs(R,{variant:"secondary",onClick:()=>i(h,m||void 0),disabled:c||!m.trim(),children:[c?e.jsx(W,{className:"w-4 h-4 mr-1 animate-spin"}):e.jsx(Pe,{className:"w-4 h-4 mr-1"}),x("customPresetDialog.savePreset")]}),e.jsxs(R,{onClick:()=>n(h,m||void 0),children:[e.jsx(ye,{className:"w-4 h-4 mr-1"}),x("customPresetDialog.applyPreset")]})]})]})})}function ue({label:s,command:a}){return e.jsxs("div",{children:[e.jsx("label",{className:"text-xs text-muted-foreground",children:s}),e.jsxs("div",{className:"mt-1 flex gap-2",children:[e.jsx("code",{className:"flex-1 px-2 py-1.5 bg-muted rounded text-xs font-mono truncate",children:a}),e.jsx(Ts,{value:a,size:"icon",className:"h-6 w-6"})]})]})}function Ca({provider:s,displayName:a,defaultTarget:t,data:n,authStatus:i}){const c=t||"claude",u=c==="droid";return e.jsx(Xe,{className:"h-full",children:e.jsxs("div",{className:"p-4 space-y-6",children:[e.jsxs("div",{children:[e.jsxs("h3",{className:"text-sm font-medium flex items-center gap-2 mb-3",children:[e.jsx(Rs,{className:"w-4 h-4"}),"Provider Information"]}),e.jsxs("div",{className:"space-y-3 bg-card rounded-lg border p-4 shadow-sm",children:[e.jsxs("div",{className:"grid grid-cols-[100px_1fr] gap-2 text-sm items-center",children:[e.jsx("span",{className:"font-medium text-muted-foreground",children:"Provider"}),e.jsx("span",{className:"font-mono",children:a})]}),n&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"grid grid-cols-[100px_1fr] gap-2 text-sm items-center",children:[e.jsx("span",{className:"font-medium text-muted-foreground",children:"File Path"}),e.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[e.jsx("code",{className:"bg-muted px-1.5 py-0.5 rounded text-xs break-all",children:n.path}),e.jsx(Ts,{value:n.path,size:"icon",className:"h-5 w-5"})]})]}),e.jsxs("div",{className:"grid grid-cols-[100px_1fr] gap-2 text-sm items-center",children:[e.jsx("span",{className:"font-medium text-muted-foreground",children:"Last Modified"}),e.jsx("span",{className:"text-xs",children:new Date(n.mtime).toLocaleString()})]})]}),e.jsxs("div",{className:"grid grid-cols-[100px_1fr] gap-2 text-sm items-center",children:[e.jsx("span",{className:"font-medium text-muted-foreground",children:"Status"}),i.authenticated?e.jsxs(V,{variant:"outline",className:"w-fit text-green-600 border-green-200 bg-green-50",children:[e.jsx(Bt,{className:"w-3 h-3 mr-1"}),"Authenticated"]}):e.jsx(V,{variant:"outline",className:"w-fit text-muted-foreground",children:"Not connected"})]}),e.jsxs("div",{className:"grid grid-cols-[100px_1fr] gap-2 text-sm items-center",children:[e.jsx("span",{className:"font-medium text-muted-foreground",children:"Default Target"}),e.jsx("span",{className:"font-mono",children:c})]})]})]}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-sm font-medium mb-3",children:"Quick Usage"}),e.jsxs("div",{className:"space-y-3 bg-card rounded-lg border p-4 shadow-sm",children:[e.jsx(ue,{label:"Run with prompt",command:`ccs ${s} "your prompt"`}),e.jsx(ue,{label:u?"Droid alias (explicit)":"Run on Droid",command:u?`ccsd ${s} "your prompt"`:`ccs ${s} --target droid "your prompt"`}),e.jsx(ue,{label:u?"Override to Claude":"Override target",command:`ccs ${s} --target claude "your prompt"`}),e.jsx(ue,{label:"Change model",command:`ccs ${s} --config`}),e.jsx(ue,{label:"Add account",command:`ccs ${s} --add`}),e.jsx(ue,{label:"List accounts",command:`ccs ${s} --accounts`})]})]})]})})}const Aa={sm:{container:"w-6 h-6",icon:"w-4 h-4",text:"text-xs"},md:{container:"w-8 h-8",icon:"w-5 h-5",text:"text-sm"},lg:{container:"w-12 h-12",icon:"w-8 h-8",text:"text-lg"}};function is({provider:s,className:a,size:t="md"}){const n=it(s),i=Aa[t],c=rt(s);return e.jsx("div",{className:B("flex items-center justify-center rounded-md",c&&(ot(s)?"bg-gray-900 p-1":"bg-white p-1"),i.container,a),children:c?e.jsx("img",{src:c,alt:`${s} logo`,className:B(i.icon,"object-contain")}):e.jsx("span",{className:B("font-semibold",n.textClass,i.text),children:n.letter})})}function Sa({displayName:s,logoProvider:a,provider:t,data:n,isLoading:i,hasChanges:c,isRawJsonValid:u,isSaving:o,isRemoteMode:x,port:h,onRefetch:y,onSave:m}){return e.jsxs("div",{className:"px-6 py-4 border-b bg-background flex items-center justify-between shrink-0",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(is,{provider:a||t,size:"lg"}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("h2",{className:"text-lg font-semibold",children:s}),x&&e.jsxs(V,{variant:"secondary",className:"text-xs gap-1 bg-blue-100 text-blue-700 dark:bg-blue-900/30 dark:text-blue-400",children:[e.jsx(Ls,{className:"w-3 h-3"}),"Remote"]}),h&&e.jsxs(V,{variant:"outline",className:"text-xs gap-1 font-mono",children:[e.jsx(Gt,{className:"w-3 h-3"}),":",h]}),!x&&n?.path&&e.jsx(V,{variant:"outline",className:"text-xs",children:n.path.replace(/^.*[\\/]/,"")})]}),x?e.jsx("p",{className:"text-xs text-blue-600 dark:text-blue-400 mt-0.5",children:"Traffic auto-routed to remote server"}):n&&e.jsxs("p",{className:"text-xs text-muted-foreground mt-0.5",children:["Last modified: ",new Date(n.mtime).toLocaleString()]})]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(R,{variant:"ghost",size:"sm",onClick:y,disabled:i,children:e.jsx(es,{className:`w-4 h-4 ${i?"animate-spin":""}`})}),e.jsx(R,{size:"sm",onClick:m,disabled:o||!c||!u,children:o?e.jsxs(e.Fragment,{children:[e.jsx(W,{className:"w-4 h-4 mr-1 animate-spin"}),"Saving..."]}):e.jsxs(e.Fragment,{children:[e.jsx($t,{className:"w-4 h-4 mr-1"}),"Save"]})})]})]})}function Pa({model:s,provider:a,enabled:t,onToggle:n,disabled:i,className:c}){if(!s?.extendedContext)return null;const u=fa(s.id);return e.jsxs("div",{className:B("rounded-lg border p-3 space-y-2",t?"border-primary/50 bg-primary/5":"border-border bg-muted/30",c),children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(ye,{className:B("w-4 h-4",t?"text-primary":"text-muted-foreground")}),e.jsx("span",{className:"text-sm font-medium",children:"Extended Context"}),e.jsx(V,{variant:t?"default":"secondary",className:"text-[10px] h-5 px-1.5",children:"1M tokens"})]}),e.jsx(qs,{checked:t,onCheckedChange:n,disabled:i})]}),e.jsxs("div",{className:"flex items-start gap-2 text-xs text-muted-foreground",children:[e.jsx(Rs,{className:"w-3.5 h-3.5 mt-0.5 shrink-0"}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{children:"Enables 1M token context window instead of default 200K."}),e.jsx("p",{className:"text-[10px]",children:u?e.jsxs("span",{className:"text-primary",children:["Auto-enabled for ",a," Gemini models"]}):e.jsxs("span",{children:["Opt-in for ",a," Claude models via --1m flag"]})}),t&&e.jsx("p",{className:"text-amber-600 dark:text-amber-500",children:"Note: 2x input pricing applies for tokens beyond 200K"})]})]})]})}function Da({catalog:s,savedPresets:a,currentModel:t,opusModel:n,sonnetModel:i,haikuModel:c,providerModels:u,provider:o,extendedContextEnabled:x,onExtendedContextToggle:h,onApplyPreset:y,onUpdateEnvValue:m,onOpenCustomPreset:r,onDeletePreset:C,isDeletePending:v}){const w=s&&s.models.length>0||a.length>0,N=l.useMemo(()=>{if(!s||!t)return;const g=Vs(t);return s.models.find(f=>f.id===g)},[s,t]);return e.jsxs(e.Fragment,{children:[w&&e.jsxs("div",{children:[e.jsxs("h3",{className:"text-sm font-medium mb-2 flex items-center gap-2",children:[e.jsx(Ne,{className:"w-4 h-4"}),"Presets"]}),e.jsx("p",{className:"text-xs text-muted-foreground mb-3",children:"Apply pre-configured model mappings"}),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[s?.models.slice(0,4).map(g=>e.jsxs(R,{variant:"outline",size:"sm",className:"text-xs h-7 gap-1",onClick:()=>{const f=g.presetMapping||{default:g.id,opus:g.id,sonnet:g.id,haiku:g.id};y({ANTHROPIC_MODEL:f.default,ANTHROPIC_DEFAULT_OPUS_MODEL:f.opus,ANTHROPIC_DEFAULT_SONNET_MODEL:f.sonnet,ANTHROPIC_DEFAULT_HAIKU_MODEL:f.haiku})},children:[e.jsx(ye,{className:"w-3 h-3"}),g.name]},g.id)),a.map(g=>e.jsxs("div",{className:"group relative",children:[e.jsxs(R,{variant:"secondary",size:"sm",className:"text-xs h-7 gap-1 pr-6",onClick:()=>{y({ANTHROPIC_MODEL:g.default,ANTHROPIC_DEFAULT_OPUS_MODEL:g.opus,ANTHROPIC_DEFAULT_SONNET_MODEL:g.sonnet,ANTHROPIC_DEFAULT_HAIKU_MODEL:g.haiku})},children:[e.jsx(Pe,{className:"w-3 h-3 fill-current"}),g.name]}),e.jsx(R,{variant:"ghost",size:"icon",className:"absolute right-0 top-0 h-7 w-5 opacity-0 group-hover:opacity-100 hover:text-destructive",onClick:f=>{f.stopPropagation(),C(g.name)},disabled:v,children:e.jsx(ss,{className:"w-3 h-3"})})]},g.name)),e.jsxs(R,{variant:"outline",size:"sm",className:"text-xs h-7 gap-1 border-primary/50 text-primary hover:bg-primary/10 hover:border-primary",onClick:r,children:[e.jsx(Is,{className:"w-3 h-3"}),"Custom"]})]})]}),e.jsx(ts,{}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-sm font-medium mb-2",children:"Model Mapping"}),e.jsx("p",{className:"text-xs text-muted-foreground mb-4",children:"Configure which models to use for each tier"}),o==="codex"&&e.jsxs("p",{className:"text-[11px] text-muted-foreground mb-3 rounded-md border bg-muted/30 px-2.5 py-2",children:["Codex tip: suffixes ",e.jsx("code",{children:"-medium"}),", ",e.jsx("code",{children:"-high"}),", and ",e.jsx("code",{children:"-xhigh"})," ","pin reasoning effort. Unsuffixed models use Thinking settings."]}),e.jsxs("div",{className:"space-y-4",children:[e.jsx(oe,{label:"Default Model",description:"Used when no specific tier is requested",value:t,onChange:g=>m("ANTHROPIC_MODEL",g),catalog:s,allModels:u}),N?.extendedContext&&h&&e.jsx(Pa,{model:N,provider:o,enabled:x??!1,onToggle:h}),e.jsx(oe,{label:"Opus (Most capable)",description:"For complex reasoning tasks",value:n,onChange:g=>m("ANTHROPIC_DEFAULT_OPUS_MODEL",g),catalog:s,allModels:u}),e.jsx(oe,{label:"Sonnet (Balanced)",description:"Balance of speed and capability",value:i,onChange:g=>m("ANTHROPIC_DEFAULT_SONNET_MODEL",g),catalog:s,allModels:u}),e.jsx(oe,{label:"Haiku (Fast)",description:"Quick responses for simple tasks",value:c,onChange:g=>m("ANTHROPIC_DEFAULT_HAIKU_MODEL",g),catalog:s,allModels:u})]})]})]})}function Ns(s){const a=Math.max(0,Math.min(100,s));return a<=20?"bg-destructive":a<=50?"bg-yellow-500":"bg-green-500"}function ys(s){if(!s)return"";try{const a=new Date(s),n=new Date().getTime()-a.getTime();if(n<0)return"just now";const i=Math.floor(n/(1e3*60)),c=Math.floor(n/(1e3*60*60)),u=Math.floor(n/(1e3*60*60*24));return u>0?`${u}d ago`:c>0?`${c}h ago`:i>0?`${i}m ago`:"just now"}catch{return""}}function Ma(s){if(!s)return!1;try{const a=new Date(s);return new Date().getTime()-a.getTime()<3600*1e3}catch{return!1}}function Ta({account:s,onSetDefault:a,onRemove:t,onPauseToggle:n,isRemoving:i,isPausingAccount:c,privacyMode:u,showQuota:o,selectable:x,selected:h,onSelectChange:y}){const{t:m}=Z(),r=s.provider.toLowerCase(),C=r==="codex",v=r==="claude"||r==="anthropic",{data:w}=lt(o),{data:N,isLoading:g}=ct(r,s.id,o),f=w?.accountStats?.[s.email||s.id]?.lastUsedAt,E=Ma(f),A=dt(s.provider,N),F=ut(s.provider,N),P=C&&N&&mt(N)?xt(N.windows):null,p=[{label:"5h",value:P?.fiveHourWindow?.remainingPercent??null},{label:"Weekly",value:P?.weeklyWindow?.remainingPercent??null}].filter(I=>I.value!==null),U=v&&N&&pt(N)?[{label:"5h",value:N.coreUsage?.fiveHour?.remainingPercent??N.windows.find(I=>I.rateLimitType==="five_hour")?.remainingPercent??null},{label:"Weekly",value:N.coreUsage?.weekly?.remainingPercent??N.windows.find(I=>["seven_day","seven_day_opus","seven_day_sonnet","seven_day_oauth_apps","seven_day_cowork"].includes(I.rateLimitType))?.remainingPercent??null}].filter(I=>I.value!==null):[],b=C?p:v?U:[],S=A!==null?vt(A):null,O=S!==null?Number(S):null,j=ht(N),k=j?.label==="Reauth"?Qt:j?.tone==="warning"?Se:zt,K=j?.tone==="warning"?"border-amber-500/50 text-amber-600 dark:text-amber-400":j?.tone==="destructive"?"border-destructive/50 text-destructive":"border-muted-foreground/50 text-muted-foreground";return e.jsxs("div",{className:B("flex flex-col gap-2 p-3 rounded-lg border transition-colors overflow-hidden",s.isDefault?"border-primary/30 bg-primary/5":"border-border hover:bg-muted/30",s.paused&&"opacity-75",h&&"ring-2 ring-primary/50 bg-primary/5"),children:[e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsxs("div",{className:"flex items-center gap-3 min-w-0 flex-1",children:[x&&e.jsx("button",{type:"button",onClick:()=>y?.(!h),className:B("flex items-center justify-center w-5 h-5 rounded border-2 transition-colors shrink-0",h?"bg-primary border-primary text-primary-foreground":"border-muted-foreground/30 hover:border-primary/50"),"aria-label":h?"Deselect account":"Select account",children:h&&e.jsx(ne,{className:"w-3 h-3"})}),n&&e.jsx(pe,{children:e.jsxs(he,{children:[e.jsx(ge,{asChild:!0,children:e.jsx(R,{variant:"ghost",size:"icon",className:"h-7 w-7 shrink-0",onClick:()=>n(!s.paused),disabled:c,children:c?e.jsx(W,{className:"w-4 h-4 animate-spin"}):s.paused?e.jsx(Fs,{className:"w-4 h-4 text-emerald-500"}):e.jsx(qe,{className:"w-4 h-4 text-muted-foreground hover:text-foreground"})})}),e.jsx(fe,{side:"top",children:s.paused?"Resume account":"Pause account"})]})}),e.jsxs("div",{className:"relative shrink-0",children:[e.jsx("div",{className:B("flex items-center justify-center w-8 h-8 rounded-full",s.isDefault?"bg-primary/10":"bg-muted"),children:e.jsx(xe,{className:"w-4 h-4"})}),s.tier&&s.tier!=="unknown"&&s.tier!=="free"&&e.jsx("span",{className:B("absolute -bottom-0.5 -right-0.5 text-[7px] font-bold uppercase px-1 py-px rounded","ring-1 ring-background",s.tier==="ultra"?"bg-violet-500/20 text-violet-600 dark:bg-violet-500/30 dark:text-violet-300":"bg-yellow-500/20 text-yellow-700 dark:bg-yellow-500/25 dark:text-yellow-400"),children:s.tier==="ultra"?"U":"P"})]}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:B("font-medium text-sm truncate",u&&Ae),children:s.email||s.id}),s.isDefault&&e.jsxs(V,{variant:"secondary",className:"text-[10px] h-4 px-1.5 gap-0.5",children:[e.jsx(Pe,{className:"w-2.5 h-2.5 fill-current"}),"Default"]}),s.paused&&e.jsxs(V,{variant:"outline",className:"text-[10px] h-4 px-1.5 border-yellow-500 text-yellow-600",children:[e.jsx(qe,{className:"w-2 h-2 mr-0.5"}),"Paused"]})]}),s.provider==="agy"&&e.jsx("div",{className:"flex items-center gap-1.5 mt-1",children:s.projectId?e.jsx(pe,{children:e.jsxs(he,{children:[e.jsx(ge,{asChild:!0,children:e.jsxs("div",{className:"flex items-center gap-1 text-xs text-muted-foreground",children:[e.jsx(Jt,{className:"w-3 h-3","aria-hidden":"true"}),e.jsx("span",{className:B("font-mono max-w-[180px] truncate",u&&Ae),title:s.projectId,children:s.projectId})]})}),e.jsx(fe,{side:"bottom",children:e.jsx("p",{className:"text-xs",children:"GCP Project ID (read-only)"})})]})}):e.jsx(pe,{children:e.jsxs(he,{children:[e.jsx(ge,{asChild:!0,children:e.jsxs("div",{className:"flex items-center gap-1 text-xs text-amber-600 dark:text-amber-500",children:[e.jsx(Se,{className:"w-3 h-3","aria-label":"Warning"}),e.jsx("span",{children:"Project ID: N/A"})]})}),e.jsx(fe,{side:"bottom",className:"max-w-[250px]",children:e.jsxs("div",{className:"text-xs space-y-1",children:[e.jsx("p",{className:"font-medium text-amber-600",children:"Missing Project ID"}),e.jsx("p",{children:"This may cause errors. Remove the account and re-add it to fetch the project ID."})]})})]})})}),s.lastUsedAt&&e.jsxs("div",{className:"flex items-center gap-1 text-xs text-muted-foreground mt-0.5",children:[e.jsx(hs,{className:"w-3 h-3"}),"Last used: ",new Date(s.lastUsedAt).toLocaleDateString()]})]})]}),e.jsxs(gt,{children:[e.jsx(ft,{asChild:!0,children:e.jsx(R,{variant:"ghost",size:"icon",className:"h-7 w-7 shrink-0",children:e.jsx(Wt,{className:"w-4 h-4"})})}),e.jsxs(jt,{align:"end",children:[!s.isDefault&&e.jsxs(ms,{onClick:a,children:[e.jsx(Pe,{className:"w-4 h-4 mr-2"}),"Set as default"]}),e.jsxs(ms,{className:"text-destructive focus:text-destructive",onClick:t,disabled:i,children:[e.jsx(Us,{className:"w-4 h-4 mr-2"}),i?"Removing...":"Remove account"]})]})]})]}),o&&e.jsx("div",{className:"pl-11",children:g?e.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[e.jsx(W,{className:"w-3 h-3 animate-spin"}),e.jsx("span",{children:"Loading quota..."})]}):O!==null?e.jsxs("div",{className:"space-y-1.5",children:[e.jsx("div",{className:"flex items-center gap-1.5 text-xs",children:E?e.jsxs(e.Fragment,{children:[e.jsx(Yt,{className:"w-3 h-3 text-emerald-500"}),e.jsxs("span",{className:"text-emerald-600 dark:text-emerald-400",children:["Active · ",ys(f)]})]}):f?e.jsxs(e.Fragment,{children:[e.jsx(hs,{className:"w-3 h-3 text-muted-foreground"}),e.jsxs("span",{className:"text-muted-foreground",children:["Last used ",ys(f)]})]}):e.jsxs(e.Fragment,{children:[e.jsx(gs,{className:"w-3 h-3 text-muted-foreground"}),e.jsx("span",{className:"text-muted-foreground",children:"Not used yet"})]})}),e.jsx(pe,{children:e.jsxs(he,{children:[e.jsx(ge,{asChild:!0,children:b.length>0?e.jsx("div",{className:"space-y-1.5",children:b.map(I=>e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"w-10 text-[10px] text-muted-foreground",children:I.label}),e.jsx(Ue,{value:Math.max(0,Math.min(100,I.value)),className:"h-2 flex-1",indicatorClassName:Ns(I.value)}),e.jsxs("span",{className:"text-xs font-medium w-10 text-right",children:[I.value,"%"]})]},I.label))}):e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Ue,{value:Math.max(0,Math.min(100,O)),className:"h-2 flex-1",indicatorClassName:Ns(O)}),e.jsxs("span",{className:"text-xs font-medium w-10 text-right",children:[S,"%"]})]})}),e.jsx(fe,{side:"bottom",className:"max-w-xs",children:e.jsx(Nt,{quota:N,resetTime:F})})]})})]}):N?.success?e.jsx("div",{className:"flex items-center gap-1.5",children:e.jsxs(V,{variant:"outline",className:"text-[10px] h-5 px-2 gap-1 border-muted-foreground/50 text-muted-foreground",children:[e.jsx(gs,{className:"w-3 h-3"}),m("accountCard.quotaUnavailable")]})}):j?e.jsx(pe,{children:e.jsxs(he,{children:[e.jsx(ge,{asChild:!0,children:e.jsx("div",{className:"flex items-center gap-1.5",children:e.jsxs(V,{variant:"outline",className:B("text-[10px] h-5 px-2 gap-1",K),children:[e.jsx(k,{className:"w-3 h-3"}),j.label]})})}),e.jsx(fe,{side:"bottom",className:"max-w-[260px]",children:e.jsxs("div",{className:"space-y-1 text-xs",children:[e.jsx("p",{children:j.summary}),j.actionHint&&e.jsx("p",{className:"text-muted-foreground",children:j.actionHint}),j.technicalDetail&&e.jsx("p",{className:"font-mono text-[11px] text-muted-foreground",children:j.technicalDetail}),j.rawDetail&&e.jsx("pre",{className:"whitespace-pre-wrap break-all rounded bg-muted/40 px-2 py-1 font-mono text-[10px] text-muted-foreground",children:j.rawDetail})]})})]})}):null})]})}function Oa({selectedCount:s,onPauseSelected:a,onResumeSelected:t,onClearSelection:n,isPausing:i,isResuming:c}){if(s<1)return null;const u=i||c;return e.jsxs("div",{className:"flex items-center gap-3 p-2 bg-muted/50 rounded-lg border mt-2",children:[e.jsxs("span",{className:"text-sm text-muted-foreground",children:[s," selected"]}),e.jsx(R,{variant:"ghost",size:"sm",className:"text-xs h-6 px-2",onClick:n,disabled:u,children:"Clear"}),e.jsxs("div",{className:"flex gap-2 ml-auto",children:[e.jsxs(R,{size:"sm",variant:"outline",className:"h-7 text-xs gap-1",onClick:a,disabled:u,children:[i?e.jsx(W,{className:"w-3 h-3 animate-spin"}):e.jsx(qe,{className:"w-3 h-3"}),"Pause Selected"]}),e.jsxs(R,{size:"sm",variant:"outline",className:"h-7 text-xs gap-1",onClick:t,disabled:u,children:[c?e.jsx(W,{className:"w-3 h-3 animate-spin"}):e.jsx(Fs,{className:"w-3 h-3"}),"Resume Selected"]})]})]})}function Ea({accounts:s,onAddAccount:a,onSetDefault:t,onRemoveAccount:n,onPauseToggle:i,onSoloMode:c,onBulkPause:u,onBulkResume:o,isRemovingAccount:x,isPausingAccount:h,isSoloingAccount:y,isBulkPausing:m,isBulkResuming:r,privacyMode:C,showQuota:v,isKiro:w,kiroNoIncognito:N,onKiroNoIncognitoChange:g,kiroSettingsLoading:f}){const[E,A]=l.useState(new Set),F=l.useMemo(()=>new Set(s.map(_=>_.id)),[s]),P=l.useMemo(()=>new Set([...E].filter(_=>F.has(_))),[E,F]),p=!!(u&&o),U=P.size,b=s.length>0&&P.size===s.length,S=P.size>0&&P.size<s.length,O=l.useCallback(_=>{A(H=>{const G=new Set(H);return G.has(_)?G.delete(_):G.add(_),G})},[]),j=l.useCallback(()=>{A(new Set(s.map(_=>_.id)))},[s]),k=l.useCallback(()=>{A(new Set)},[]),K=l.useCallback(()=>{b?k():j()},[b,j,k]),I=l.useCallback(()=>{u&&P.size>0&&(u(Array.from(P)),A(new Set))},[u,P]),M=l.useCallback(()=>{o&&P.size>0&&(o(Array.from(P)),A(new Set))},[o,P]);return e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center justify-between mb-3",children:[e.jsxs("h3",{className:"text-sm font-medium flex items-center gap-2",children:[p&&s.length>0&&e.jsx(Ce,{checked:b,onCheckedChange:K,"aria-label":"Select all accounts",className:S?"data-[state=checked]:bg-primary/50":"",...S?{"data-state":"indeterminate"}:{}}),e.jsx(xe,{className:"w-4 h-4"}),"Accounts",s.length>0&&e.jsx(V,{variant:"secondary",className:"text-xs",children:s.length})]}),e.jsxs(R,{variant:"default",size:"sm",className:"h-7 text-xs gap-1",onClick:a,children:[e.jsx(Is,{className:"w-3 h-3"}),"Add"]})]}),p&&U>0&&e.jsx(Oa,{selectedCount:U,onPauseSelected:I,onResumeSelected:M,onClearSelection:k,isPausing:!!m,isResuming:!!r}),s.length>0?e.jsx("div",{className:"space-y-2",children:s.map(_=>e.jsx(Ta,{account:_,onSetDefault:()=>t(_.id),onRemove:()=>n(_.id),onPauseToggle:i?H=>i(_.id,H):void 0,onSoloMode:c?()=>c(_.id):void 0,isRemoving:x,isPausingAccount:h,isSoloingAccount:y,privacyMode:C,showQuota:v,selectable:p,selected:P.has(_.id),onSelectChange:()=>O(_.id)},_.id))}):e.jsxs("div",{className:"py-6 text-center text-muted-foreground bg-muted/30 rounded-lg border border-dashed",children:[e.jsx(xe,{className:"w-8 h-8 mx-auto mb-2 opacity-50"}),e.jsx("p",{className:"text-sm",children:"No accounts connected"}),e.jsx("p",{className:"text-xs opacity-70",children:"Add an account to get started"})]}),w&&g&&e.jsx("div",{className:"mt-3 pt-3 border-t border-dashed",children:e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[e.jsx(Ls,{className:"w-3.5 h-3.5"}),e.jsx("span",{children:"Use incognito"})]}),e.jsx(qs,{checked:!N,onCheckedChange:_=>g(!_),disabled:f,className:"scale-90"})]})})]})}function _a({provider:s,catalog:a,savedPresets:t,currentModel:n,opusModel:i,sonnetModel:c,haikuModel:u,providerModels:o,extendedContextEnabled:x,onExtendedContextToggle:h,onApplyPreset:y,onUpdateEnvValue:m,onOpenCustomPreset:r,onDeletePreset:C,isDeletePending:v,accounts:w,onAddAccount:N,onSetDefault:g,onRemoveAccount:f,onPauseToggle:E,onSoloMode:A,onBulkPause:F,onBulkResume:P,isRemovingAccount:p,isPausingAccount:U,isSoloingAccount:b,isBulkPausing:S,isBulkResuming:O,privacyMode:j,isRemoteMode:k}){const K=s.toLowerCase(),I=(yt.includes(K)||["anthropic","antigravity","gemini-cli","copilot","github-copilot"].includes(K))&&!k,M=s==="kiro",[_,H]=l.useState(!0),[G,se]=l.useState(!0),[z,Y]=l.useState(!1),te=l.useCallback(async()=>{if(M)try{se(!0);const $=(await be.config.get()).cliproxy;H($?.kiro_no_incognito??!0)}catch{H(!0)}finally{se(!1)}},[M]),d=l.useCallback(async T=>{H(T),Y(!0);try{const $=await be.config.get(),de=$.cliproxy??{};await be.config.update({...$,cliproxy:{...de,kiro_no_incognito:T}})}catch{H(!T)}finally{Y(!1)}},[]);return l.useEffect(()=>{te()},[te]),e.jsx(Xe,{className:"flex-1",children:e.jsxs("div",{className:"p-4 space-y-6",children:[e.jsx(Da,{catalog:a,savedPresets:t,currentModel:n,opusModel:i,sonnetModel:c,haikuModel:u,providerModels:o,provider:s,extendedContextEnabled:x,onExtendedContextToggle:h,onApplyPreset:y,onUpdateEnvValue:m,onOpenCustomPreset:r,onDeletePreset:C,isDeletePending:v}),e.jsx(ts,{}),e.jsx(Ea,{accounts:w,onAddAccount:N,onSetDefault:g,onRemoveAccount:f,onPauseToggle:E,onSoloMode:A,onBulkPause:F,onBulkResume:P,isRemovingAccount:p,isPausingAccount:U,isSoloingAccount:b,isBulkPausing:S,isBulkResuming:O,privacyMode:j,showQuota:I,isKiro:M,kiroNoIncognito:_,onKiroNoIncognitoChange:d,kiroSettingsLoading:G||z})]})})}function ws({provider:s,displayName:a,authStatus:t,catalog:n,logoProvider:i,baseProvider:c,isRemoteMode:u,port:o,defaultTarget:x,onAddAccount:h,onSetDefault:y,onRemoveAccount:m,onPauseToggle:r,onSoloMode:C,onBulkPause:v,onBulkResume:w,isRemovingAccount:N,isPausingAccount:g,isSoloingAccount:f,isBulkPausing:E,isBulkResuming:A}){const[F,P]=l.useState(!1),{privacyMode:p}=Ss(),{data:U}=wt(),{data:b}=bt(s),S=kt(),O=Ct(),j=c||s,k=j.toLowerCase()==="agy",K=l.useMemo(()=>{const L=b?.presets||[];return k?L.filter(Q=>!ee(Q.default)&&!ee(Q.opus)&&!ee(Q.sonnet)&&!ee(Q.haiku)):L},[k,b?.presets]),I=l.useMemo(()=>{if(!U?.models)return[];const Q={gemini:["google"],agy:["antigravity"],codex:["openai"],qwen:["alibaba","qwen"],iflow:["iflow"],kiro:["kiro","aws"],ghcp:["github","copilot"],kimi:["kimi","moonshot"]}[j.toLowerCase()]||[j.toLowerCase()];return U.models.filter(re=>Q.some(Ee=>re.owned_by.toLowerCase().includes(Ee))?k?!ee(re.id):!0:!1)},[k,U,j]),M=(c||s).toLowerCase(),{data:_,isLoading:H,refetch:G,rawJsonContent:se,rawJsonEdits:z,isRawJsonValid:Y,hasChanges:te,currentModel:d,opusModel:T,sonnetModel:$,haikuModel:de,extendedContextEnabled:De,toggleExtendedContext:Me,handleRawJsonChange:Te,updateEnvValue:Oe,updateEnvValues:J,saveMutation:D,conflictDialog:ie,handleConflictResolve:ae,missingRequiredFields:rs}=ya(s),we=l.useMemo(()=>(t.accounts||[]).map(L=>({...L,provider:L.provider||c||s})),[t.accounts,c,s]),{data:Bs}=bs({queryKey:["auth-tokens-raw"],queryFn:async()=>{const L=await fetch("/api/settings/auth/tokens/raw");return L.ok?L.json():{apiKey:{value:"ccs-internal-managed"}}},staleTime:6e4}),os=Bs?.apiKey?.value??"ccs-internal-managed",Gs=L=>{if(k&&[L.ANTHROPIC_MODEL,L.ANTHROPIC_DEFAULT_OPUS_MODEL,L.ANTHROPIC_DEFAULT_SONNET_MODEL,L.ANTHROPIC_DEFAULT_HAIKU_MODEL].some(re=>typeof re=="string"&&ee(re))){q.error("Antigravity denylist: Claude Opus 4.5 and Claude Sonnet 4.5 are deprecated.");return}J({ANTHROPIC_BASE_URL:`http://127.0.0.1:${o??He}/api/provider/${M}`,ANTHROPIC_AUTH_TOKEN:os,...L}),q.success(`Applied "${L.ANTHROPIC_MODEL?.split("/").pop()||"preset"}" preset`)},$s=(L,Q)=>{if(k&&[L.default,L.opus,L.sonnet,L.haiku].some(Ee=>ee(Ee))){q.error("Antigravity denylist: Claude Opus 4.5 and Claude Sonnet 4.5 are deprecated.");return}J({ANTHROPIC_BASE_URL:`http://127.0.0.1:${o??He}/api/provider/${M}`,ANTHROPIC_AUTH_TOKEN:os,ANTHROPIC_MODEL:L.default,ANTHROPIC_DEFAULT_OPUS_MODEL:L.opus,ANTHROPIC_DEFAULT_SONNET_MODEL:L.sonnet,ANTHROPIC_DEFAULT_HAIKU_MODEL:L.haiku}),q.success(`Applied ${Q?`"${Q}"`:"custom"} preset`),P(!1)},Qs=(L,Q)=>{if(!Q){q.error(Ds.t("commonToast.enterPresetName"));return}if(k&&[L.default,L.opus,L.sonnet,L.haiku].some(re=>ee(re))){q.error("Antigravity denylist: Claude Opus 4.5 and Claude Sonnet 4.5 are deprecated.");return}S.mutate({profile:s,data:{name:Q,...L}}),P(!1)};return e.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[e.jsx(Sa,{provider:s,displayName:a,logoProvider:i,data:_,isLoading:H,hasChanges:te,isRawJsonValid:Y,isSaving:D.isPending,isRemoteMode:u,port:o,onRefetch:G,onSave:()=>D.mutate()}),H?e.jsxs("div",{className:"flex-1 flex items-center justify-center",children:[e.jsx(W,{className:"w-8 h-8 animate-spin text-muted-foreground"}),e.jsx("span",{className:"ml-3 text-muted-foreground",children:"Loading settings..."})]}):e.jsxs("div",{className:"flex-1 grid grid-cols-[40%_60%] divide-x overflow-hidden",children:[e.jsx("div",{className:"flex flex-col overflow-hidden bg-muted/5",children:e.jsxs(At,{defaultValue:"config",className:"h-full flex flex-col",children:[e.jsx("div",{className:"px-4 pt-4 shrink-0",children:e.jsxs(St,{className:"w-full",children:[e.jsx(xs,{value:"config",className:"flex-1",children:"Model Config"}),e.jsx(xs,{value:"info",className:"flex-1",children:"Info & Usage"})]})}),e.jsxs("div",{className:"flex-1 overflow-hidden flex flex-col",children:[e.jsx(ps,{value:"config",className:"flex-1 mt-0 border-0 p-0 data-[state=inactive]:hidden flex flex-col overflow-hidden",children:e.jsx(_a,{provider:s,catalog:n,savedPresets:K,currentModel:d,opusModel:T,sonnetModel:$,haikuModel:de,providerModels:I,extendedContextEnabled:De,onExtendedContextToggle:Me,onApplyPreset:Gs,onUpdateEnvValue:Oe,onOpenCustomPreset:()=>P(!0),onDeletePreset:L=>O.mutate({profile:s,name:L}),isDeletePending:O.isPending,accounts:we,onAddAccount:h,onSetDefault:y,onRemoveAccount:m,onPauseToggle:r,onSoloMode:C,onBulkPause:v,onBulkResume:w,isRemovingAccount:N,isPausingAccount:g,isSoloingAccount:f,isBulkPausing:E,isBulkResuming:A,privacyMode:p,isRemoteMode:u})}),e.jsx(ps,{value:"info",className:"h-full mt-0 border-0 p-0 data-[state=inactive]:hidden",children:e.jsx(Ca,{provider:s,displayName:a,defaultTarget:x,data:_,authStatus:t})})]})]})}),e.jsxs("div",{className:"flex flex-col overflow-hidden",children:[e.jsxs("div",{className:"px-6 py-2 bg-muted/30 border-b flex items-center gap-2 shrink-0 h-[45px]",children:[e.jsx(Xt,{className:"w-4 h-4 text-muted-foreground"}),e.jsx("span",{className:"text-sm font-medium text-muted-foreground",children:"Raw Configuration (JSON)"})]}),e.jsx(Pt,{rawJsonContent:se,isRawJsonValid:Y,rawJsonEdits:z,onRawJsonChange:Te,profileEnv:_?.settings?.env,missingRequiredFields:rs})]})]}),e.jsx(ta,{open:ie,title:"File Modified Externally",description:"This settings file was modified by another process. Overwrite with your changes or discard?",confirmText:"Overwrite",variant:"destructive",onConfirm:()=>ae(!0),onCancel:()=>ae(!1)}),e.jsx(ka,{open:F,onClose:()=>P(!1),currentValues:{default:d||"",opus:T||"",sonnet:$||"",haiku:de||""},onApply:$s,onSave:Qs,isSaving:S.isPending,catalog:n,allModels:I})]})}function Ra({status:s,isSelected:a,onSelect:t}){const{t:n}=Z(),i=s.accounts?.length||0;return e.jsxs("button",{className:B("w-full flex items-center gap-3 px-3 py-2.5 rounded-lg transition-colors cursor-pointer text-left",a?"bg-primary/10 border border-primary/20":"hover:bg-muted border border-transparent"),onClick:t,children:[e.jsx(is,{provider:s.provider,size:"md"}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"font-medium text-sm truncate",children:s.displayName}),i>0&&e.jsx(V,{variant:"secondary",className:"text-[10px] h-4 px-1",children:i})]}),e.jsx("div",{className:"flex items-center gap-1.5 mt-0.5",children:s.authenticated?e.jsxs(e.Fragment,{children:[e.jsx(ne,{className:"w-3 h-3 text-green-600"}),e.jsx("span",{className:"text-xs text-green-600",children:n("cliproxyPage.connected")})]}):e.jsxs(e.Fragment,{children:[e.jsx(ss,{className:"w-3 h-3 text-muted-foreground"}),e.jsx("span",{className:"text-xs text-muted-foreground",children:n("cliproxyPage.notConnected")})]})})]})]})}function La({variant:s,parentAuth:a,isSelected:t,onSelect:n,onDelete:i,isDeleting:c}){const{t:u}=Z();return e.jsxs("button",{className:B("group w-full flex items-center gap-3 px-3 py-2 rounded-lg transition-colors cursor-pointer text-left pl-6",t?"bg-primary/10 border border-primary/20":"hover:bg-muted border border-transparent"),onClick:n,children:[e.jsxs("div",{className:"relative",children:[e.jsx(is,{provider:s.provider,size:"sm"}),e.jsx(Hs,{className:"w-2.5 h-2.5 absolute -bottom-0.5 -right-0.5 text-muted-foreground"})]}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"font-medium text-sm truncate",children:s.name}),e.jsx(V,{variant:"outline",className:"text-[9px] h-4 px-1",children:u("cliproxyPage.variant")}),e.jsx(V,{variant:"outline",className:"text-[9px] h-4 px-1 uppercase",children:s.target||"claude"})]}),e.jsx("div",{className:"flex items-center gap-1.5 mt-0.5",children:a?.authenticated?e.jsxs(e.Fragment,{children:[e.jsx(ne,{className:"w-3 h-3 text-green-600"}),e.jsx("span",{className:"text-xs text-muted-foreground truncate",children:u("cliproxyPage.viaProvider",{provider:s.provider})})]}):e.jsxs(e.Fragment,{children:[e.jsx(ss,{className:"w-3 h-3 text-muted-foreground"}),e.jsx("span",{className:"text-xs text-muted-foreground",children:u("cliproxyPage.parentNotConnected")})]})})]}),e.jsx(R,{variant:"ghost",size:"icon",className:"h-6 w-6 opacity-0 group-hover:opacity-100 hover:text-destructive",onClick:o=>{o.stopPropagation(),i()},disabled:c,children:e.jsx(Us,{className:"w-3 h-3"})})]})}function Ia({onSetup:s}){const{t:a}=Z();return e.jsx("div",{className:"flex-1 flex items-center justify-center bg-muted/20",children:e.jsxs("div",{className:"text-center max-w-md px-8",children:[e.jsx("div",{className:"w-16 h-16 rounded-full bg-muted flex items-center justify-center mx-auto mb-6",children:e.jsx(ye,{className:"w-8 h-8 text-muted-foreground"})}),e.jsx("h2",{className:"text-xl font-semibold mb-2",children:a("cliproxyPage.emptyTitle")}),e.jsx("p",{className:"text-muted-foreground mb-4",children:a("cliproxyPage.emptyDesc")}),e.jsxs("p",{className:"text-xs text-muted-foreground mb-6",children:[a("cliproxyPage.emptyControlPanelPrefix")," ",e.jsx("a",{href:"/cliproxy/control-panel",className:"text-primary hover:underline",children:a("cliproxyPage.controlPanel")}),"."]}),e.jsxs(R,{onClick:s,className:"gap-2",children:[e.jsx(Ne,{className:"w-4 h-4"}),a("cliproxyPage.quickSetup")]})]})})}function en(){const{t:s}=Z(),a=Ve(),{data:t,isLoading:n}=As(),{data:i,isFetching:c}=Dt(),{data:u}=Mt(),o=Tt(),x=Ot(),h=Et(),y=_t(),m=Rt(),r=Lt(),C=It(),v=Ft(),[w,N]=l.useState(()=>{if(typeof window<"u"){const T=new URLSearchParams(window.location.search).get("provider")?.trim().toLowerCase();return T&&Fe(T)?T:localStorage.getItem("cliproxy-selected-provider")}return null}),[g,f]=l.useState(null),[E,A]=l.useState(!1),[F,P]=l.useState(()=>{if(typeof window>"u")return null;const d=new URLSearchParams(window.location.search),T=d.get("provider")?.trim().toLowerCase();return d.get("action")!=="auth"||!T||!Fe(T)?null:{provider:T,displayName:Ut(T),isFirstAccount:!1}}),p=l.useMemo(()=>t?.authStatus||[],[t?.authStatus]),U=t?.source==="remote",b=l.useMemo(()=>i?.variants||[],[i?.variants]),S=d=>{N(d),d&&localStorage.setItem("cliproxy-selected-provider",d)},O=l.useMemo(()=>g?null:w&&p.some(d=>d.provider===w)?w:p.length>0&&(p.find(T=>(T.accounts?.length||0)>0)?.provider||p[0]?.provider)||null,[w,g,p]),j=p.find(d=>d.provider===O),k=b.find(d=>d.name===g),K=k?p.find(d=>d.provider===k.provider):void 0,I=(k?.provider||j?.provider||"").toLowerCase().trim(),M=I==="gemini"||I==="agy",_=()=>{a.invalidateQueries({queryKey:["cliproxy"]}),a.invalidateQueries({queryKey:["cliproxy-auth"]})},H=(d,T,$)=>{h.isPending||y.isPending||($?h.mutate({provider:d,accountId:T}):y.mutate({provider:d,accountId:T}))},G=(d,T)=>{m.isPending||m.mutate({provider:d,accountId:T})},se=(d,T)=>{r.isPending||r.mutate({provider:d,accountIds:T})},z=(d,T)=>{C.isPending||C.mutate({provider:d,accountIds:T})},Y=d=>{S(d),f(null)},te=d=>{f(d),S(null)};return e.jsxs("div",{className:"h-[calc(100vh-100px)] flex",children:[e.jsxs("div",{className:"w-80 border-r flex flex-col bg-muted/30",children:[e.jsxs("div",{className:"p-4 border-b bg-background",children:[e.jsxs("div",{className:"flex items-center justify-between mb-1",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(ye,{className:"w-5 h-5 text-primary"}),e.jsx("h1",{className:"font-semibold",children:u?.backendLabel??"CLIProxy"})]}),e.jsx(R,{variant:"ghost",size:"icon",className:"h-8 w-8",onClick:_,disabled:c,children:e.jsx(es,{className:B("w-4 h-4",c&&"animate-spin")})})]}),e.jsx("p",{className:"text-xs text-muted-foreground mb-3",children:s("cliproxyPage.accountManagement")}),e.jsxs(R,{variant:"default",size:"sm",className:"w-full gap-2",onClick:()=>A(!0),children:[e.jsx(Ne,{className:"w-4 h-4"}),s("cliproxyPage.quickSetup")]})]}),e.jsx(Xe,{className:"flex-1",children:e.jsxs("div",{className:"p-2",children:[e.jsx("div",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wide px-3 py-2",children:s("cliproxyPage.providers")}),n?e.jsx("div",{className:"space-y-2 px-2",children:[1,2,3,4].map(d=>e.jsx(Ht,{className:"h-14 w-full rounded-lg"},d))}):e.jsx("div",{className:"space-y-1",children:p.map(d=>e.jsx(Ra,{status:d,isSelected:O===d.provider,onSelect:()=>Y(d.provider)},d.provider))}),b.length>0&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wide px-3 py-2 mt-4 flex items-center gap-1.5",children:[e.jsx(Hs,{className:"w-3 h-3"}),s("cliproxyPage.variants")]}),e.jsx("div",{className:"space-y-1",children:b.map(d=>e.jsx(La,{variant:d,parentAuth:p.find(T=>T.provider===d.provider),isSelected:g===d.name,onSelect:()=>te(d.name),onDelete:()=>v.mutate(d.name),isDeleting:v.isPending},d.name))})]})]})}),e.jsx("div",{className:"p-3 border-t",children:e.jsx(sa,{})}),e.jsx("div",{className:"p-3 border-t bg-background text-xs text-muted-foreground",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{children:s("cliproxyPage.providerCount",{count:p.length})}),e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(ne,{className:"w-3 h-3 text-green-600"}),s("cliproxyPage.connectedCount",{count:p.filter(d=>d.authenticated).length})]})]})})]}),e.jsxs("div",{className:"flex-1 flex flex-col min-w-0 bg-background",children:[M&&e.jsx(Ks,{showProxySettingsLink:!0,className:"mx-4 mt-4"}),k&&K?e.jsx(ws,{provider:k.name,displayName:s("cliproxyPage.variantDisplay",{name:k.name,provider:k.provider}),authStatus:K,catalog:ve[k.provider],logoProvider:k.provider,baseProvider:k.provider,defaultTarget:k.target,isRemoteMode:U,port:k.port,onAddAccount:()=>P({provider:k.provider,displayName:K.displayName,isFirstAccount:(K.accounts?.length||0)===0}),onSetDefault:d=>o.mutate({provider:k.provider,accountId:d}),onRemoveAccount:d=>x.mutate({provider:k.provider,accountId:d}),onPauseToggle:(d,T)=>H(k.provider,d,T),onSoloMode:d=>G(k.provider,d),onBulkPause:d=>se(k.provider,d),onBulkResume:d=>z(k.provider,d),isRemovingAccount:x.isPending,isPausingAccount:h.isPending||y.isPending,isSoloingAccount:m.isPending,isBulkPausing:r.isPending,isBulkResuming:C.isPending}):j?e.jsx(ws,{provider:j.provider,displayName:j.displayName,authStatus:j,catalog:ve[j.provider],isRemoteMode:U,onAddAccount:()=>P({provider:j.provider,displayName:j.displayName,isFirstAccount:(j.accounts?.length||0)===0}),onSetDefault:d=>o.mutate({provider:j.provider,accountId:d}),onRemoveAccount:d=>x.mutate({provider:j.provider,accountId:d}),onPauseToggle:(d,T)=>H(j.provider,d,T),onSoloMode:d=>G(j.provider,d),onBulkPause:d=>se(j.provider,d),onBulkResume:d=>z(j.provider,d),isRemovingAccount:x.isPending,isPausingAccount:h.isPending||y.isPending,isSoloingAccount:m.isPending,isBulkPausing:r.isPending,isBulkResuming:C.isPending}):e.jsx(Ia,{onSetup:()=>A(!0)})]}),e.jsx(da,{open:E,onClose:()=>A(!1)}),e.jsx(ga,{open:F!==null,onClose:()=>P(null),provider:F?.provider||"",displayName:F?.displayName||"",isFirstAccount:F?.isFirstAccount||!1})]})}export{en as CliproxyPage};
|
package/dist/ui/assets/{cliproxy-control-panel-CKO2Sn9B.js → cliproxy-control-panel-BNUMUGIt.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as e}from"./radix-ui-BR1vy4kf.js";import{r as s}from"./react-vendor-CNOkPC89.js";import{u as k}from"./tanstack-e99Cjjy2.js";import{Y as K,b2 as M}from"./index-
|
|
1
|
+
import{j as e}from"./radix-ui-BR1vy4kf.js";import{r as s}from"./react-vendor-CNOkPC89.js";import{u as k}from"./tanstack-e99Cjjy2.js";import{Y as K,b2 as M}from"./index-JgHDFSHt.js";import{C as P}from"./default-ports-1QQSffYX.js";import{G as F,R as L,x as H,t as q,K as G,d as W,X as _}from"./icons-DrEfTmfX.js";import"./notifications-B2HqRBj7.js";import"./utils-CzKF5WmX.js";import"./form-utils-Bcoyqxpq.js";import"./code-highlight-BRUf_pqB.js";function z({port:c=P}){const i=s.useRef(null),[$,b]=s.useState(null),[R,E]=s.useState(0),[g,m]=s.useState(null),[I,d]=s.useState(!1),[S,T]=s.useState(!0),{data:j,error:f}=k({queryKey:["cliproxy-server-config"],queryFn:()=>K.cliproxyServer.get(),staleTime:3e4}),{data:y}=k({queryKey:["auth-tokens-raw"],queryFn:async()=>{const t=await fetch(M("/settings/auth/tokens/raw"));if(!t.ok)throw new Error("Failed to fetch auth tokens");return t.json()},staleTime:3e4});s.useEffect(()=>{f&&console.warn("[ControlPanelEmbed] Config fetch failed, using local mode:",f)},[f]);const{managementUrl:n,checkUrl:u,authToken:r,isRemote:l,displayHost:x}=s.useMemo(()=>{const t=j?.remote;if(t?.enabled&&t?.host){const a=t.protocol||"http",o=t.port||(a==="https"?443:P),v=a==="https"&&o===443||a==="http"&&o===80?"":`:${o}`,w=`${a}://${t.host}${v}`;return{managementUrl:`${w}/management.html`,checkUrl:`${w}/`,authToken:t.auth_token||void 0,isRemote:!0,displayHost:`${t.host}${v}`}}const h=y?.managementSecret?.value||"ccs";return{managementUrl:`http://localhost:${c}/management.html`,checkUrl:`http://localhost:${c}/`,authToken:h,isRemote:!1,displayHost:`localhost:${c}`}},[j,y,c]),p=$===n,N=!p;s.useEffect(()=>{const t=new AbortController,h=async()=>{try{(await fetch(u,{signal:t.signal})).ok?(d(!0),m(null)):(d(!1),m(l?`Remote CLIProxy at ${x} returned an error`:"CLIProxy returned an error"))}catch(o){if(o instanceof Error&&o.name==="AbortError")return;d(!1),m(l?`Remote CLIProxy at ${x} is not reachable`:"CLIProxy is not running")}},a=setTimeout(()=>t.abort(),2e3);return h().finally(()=>clearTimeout(a)),()=>t.abort()},[u,l,x]);const C=s.useCallback(()=>{if(!(!p||!i.current?.contentWindow||!r))try{const t=u.replace(/\/$/,"");if(!i.current.src.startsWith(t)){console.warn("[ControlPanelEmbed] Iframe origin mismatch, skipping postMessage");return}i.current.contentWindow.postMessage({type:"ccs-auto-login",apiBase:t,managementKey:r},t)}catch(t){console.debug("[ControlPanelEmbed] postMessage failed - cross-origin:",t)}},[r,u,p]);s.useEffect(()=>{C()},[C]);const U=s.useCallback(()=>{b(n)},[n]),A=()=>{b(null),E(t=>t+1),m(null),d(!1)};return!I&&g?e.jsxs("div",{className:"flex-1 flex flex-col",children:[e.jsxs("div",{className:"flex items-center justify-between p-4 border-b",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(F,{className:"w-5 h-5 text-primary"}),e.jsx("h2",{className:"font-semibold",children:"CLIProxy Control Panel"})]}),e.jsxs("button",{className:"inline-flex items-center gap-2 px-3 py-1.5 text-sm border rounded-md hover:bg-muted",onClick:A,children:[e.jsx(L,{className:"w-4 h-4"}),"Retry"]})]}),e.jsx("div",{className:"flex-1 flex items-center justify-center bg-muted/20",children:e.jsxs("div",{className:"text-center max-w-md px-8",children:[e.jsx("div",{className:"w-16 h-16 rounded-full bg-destructive/10 flex items-center justify-center mx-auto mb-6",children:e.jsx(H,{className:"w-8 h-8 text-destructive"})}),e.jsx("h3",{className:"text-lg font-semibold mb-2",children:"CLIProxy Not Available"}),e.jsx("p",{className:"text-muted-foreground mb-4",children:g}),e.jsxs("p",{className:"text-sm text-muted-foreground",children:["Start a CLIProxy session with"," ",e.jsx("code",{className:"bg-muted px-1 rounded",children:"ccs gemini"})," or run"," ",e.jsx("code",{className:"bg-muted px-1 rounded",children:"ccs config"})," which auto-starts it."]})]})})]}):e.jsxs("div",{className:"flex-1 flex flex-col relative",children:[S&&!N&&e.jsx("div",{className:"absolute top-2 left-1/2 -translate-x-1/2 z-20",children:e.jsxs("div",{className:"flex items-center gap-2 px-3 py-1.5 bg-blue-50 dark:bg-blue-950 border border-blue-200 dark:border-blue-800 rounded-md text-sm",children:[l&&e.jsxs(e.Fragment,{children:[e.jsx(q,{className:"h-3.5 w-3.5 text-green-600"}),e.jsx("span",{className:"text-green-600 font-medium",children:"Remote"}),e.jsx("span",{className:"text-blue-300 dark:text-blue-700",children:"|"})]}),e.jsx(G,{className:"h-3.5 w-3.5 text-blue-600"}),e.jsxs("span",{children:["Key:"," ",e.jsx("code",{className:"bg-blue-100 dark:bg-blue-900 px-1 rounded font-mono font-semibold",children:r&&r.length>4?`***${r.slice(-4)}`:r||"ccs"})]}),e.jsx("a",{href:"/settings?tab=auth",className:"text-blue-600 hover:text-blue-800 dark:hover:text-blue-400",title:"Manage auth tokens",children:e.jsx(W,{className:"h-3.5 w-3.5"})}),e.jsx("button",{className:"text-blue-600 hover:text-blue-800 dark:hover:text-blue-400",onClick:()=>T(!1),children:e.jsx(_,{className:"h-3.5 w-3.5"})})]})}),N&&e.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-background/80 z-10",children:e.jsxs("div",{className:"text-center",children:[e.jsx(L,{className:"w-8 h-8 animate-spin text-primary mx-auto mb-2"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:l?`Loading Control Panel from ${x}...`:"Loading Control Panel..."})]})}),e.jsx("iframe",{ref:i,src:n,className:"flex-1 w-full border-0",title:"CLIProxy Management Panel",onLoad:U},`${n}:${R}`)]})}function te(){return e.jsx("div",{className:"h-[calc(100vh-100px)] flex flex-col",children:e.jsx(z,{})})}export{te as CliproxyControlPanelPage};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as e}from"./radix-ui-BR1vy4kf.js";import{A as c,a as d,b as g,c as x,d as h,e as j,f as A,g as D}from"./alert-dialog-
|
|
1
|
+
import{j as e}from"./radix-ui-BR1vy4kf.js";import{A as c,a as d,b as g,c as x,d as h,e as j,f as A,g as D}from"./alert-dialog-0GYXcDLu.js";function f({open:i,onConfirm:l,onCancel:r,title:s,description:t,confirmText:a="Confirm",variant:o="default"}){return e.jsx(c,{open:i,onOpenChange:n=>!n&&r(),children:e.jsxs(d,{children:[e.jsxs(g,{children:[e.jsx(x,{children:s}),e.jsx(h,{children:t})]}),e.jsxs(j,{children:[e.jsx(A,{onClick:r,children:"Cancel"}),e.jsx(D,{onClick:l,className:o==="destructive"?"bg-red-600 hover:bg-red-700 text-white":"",children:a})]})]})})}export{f as C};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{j as e}from"./radix-ui-BR1vy4kf.js";import{b2 as w,b3 as Me,B as S,d as v,a as ne,r as he,s as ge,t as fe,v as je,at as Le,au as Re,w as H,V as ie,n as V,L as T,I as ce,x as Ne,b4 as Ae,S as b,b5 as Oe,b6 as Ee,b7 as _e,Q as qe,R as De,U as Y,b8 as Ie,c as se}from"./index-Cw9Urr0S.js";import{r as N}from"./react-vendor-CNOkPC89.js";import{a as Ue,u as _,b as M}from"./tanstack-e99Cjjy2.js";import{C as Ke}from"./confirm-dialog-DTKxwrat.js";import{R as we,L as ve,aj as Qe,l as Je,a4 as $e,Z as de,O as ze,T as be,am as Be,b as Ge,a6 as He,ar as Ve,aA as me,K as We,N as Xe,aB as Ye,v as ye,w as Se}from"./icons-DrEfTmfX.js";import{S as ae}from"./separator-3fBbTn-V.js";import{S as Z}from"./switch-5N8qBdBr.js";import{t as q}from"./notifications-B2HqRBj7.js";import"./utils-CzKF5WmX.js";import"./form-utils-Bcoyqxpq.js";import"./code-highlight-BRUf_pqB.js";import"./alert-dialog-DhwS38kc.js";async function Ze(){const t=await fetch(w("/copilot/status"));if(!t.ok)throw new Error("Failed to fetch copilot status");return t.json()}async function et(){const t=await fetch(w("/copilot/config"));if(!t.ok)throw new Error("Failed to fetch copilot config");return t.json()}async function tt(){const t=await fetch(w("/copilot/models"));if(!t.ok)throw new Error("Failed to fetch copilot models");return t.json()}async function st(){const t=await fetch(w("/copilot/settings/raw"));if(!t.ok)throw new Error("Failed to fetch copilot raw settings");return t.json()}async function at(t){const s=await fetch(w("/copilot/config"),{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)});if(!s.ok)throw new Error("Failed to update copilot config");return s.json()}async function nt(t){const s=await fetch(w("/copilot/settings/raw"),{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)});if(s.status===409)throw new Me("Copilot raw settings changed externally");if(!s.ok)throw new Error("Failed to save copilot raw settings");return s.json()}async function it(){const t=await fetch(w("/copilot/auth/start"),{method:"POST"});if(!t.ok)throw new Error("Failed to start auth");return t.json()}async function ot(){const t=await fetch(w("/copilot/daemon/start"),{method:"POST"});if(!t.ok)throw new Error("Failed to start daemon");return t.json()}async function lt(){const t=await fetch(w("/copilot/daemon/stop"),{method:"POST"});if(!t.ok)throw new Error("Failed to stop daemon");return t.json()}async function rt(){const t=await fetch(w("/copilot/info"));if(!t.ok)throw new Error("Failed to fetch copilot info");return t.json()}async function ct(t){const s=await fetch(w("/copilot/install"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t?{version:t}:{})});if(!s.ok)throw new Error("Failed to install copilot-api");return s.json()}function Ce(){const t=Ue(),s=_({queryKey:["copilot-status"],queryFn:Ze,refetchInterval:5e3}),i=_({queryKey:["copilot-config"],queryFn:et}),c=_({queryKey:["copilot-models"],queryFn:tt}),n=_({queryKey:["copilot-raw-settings"],queryFn:st}),d=_({queryKey:["copilot-info"],queryFn:rt}),r=M({mutationFn:at,onSuccess:()=>{t.invalidateQueries({queryKey:["copilot-status"]}),t.invalidateQueries({queryKey:["copilot-config"]}),t.invalidateQueries({queryKey:["copilot-raw-settings"]})}}),u=M({mutationFn:nt,onSuccess:()=>{t.invalidateQueries({queryKey:["copilot-status"]}),t.invalidateQueries({queryKey:["copilot-config"]}),t.invalidateQueries({queryKey:["copilot-raw-settings"]})}}),o=M({mutationFn:it,onSuccess:()=>{t.invalidateQueries({queryKey:["copilot-status"]})}}),p=M({mutationFn:ot,onSuccess:()=>{t.invalidateQueries({queryKey:["copilot-status"]})}}),g=M({mutationFn:lt,onSuccess:()=>{t.invalidateQueries({queryKey:["copilot-status"]})}}),l=M({mutationFn:ct,onSuccess:()=>{t.invalidateQueries({queryKey:["copilot-status"]}),t.invalidateQueries({queryKey:["copilot-info"]})}});return N.useMemo(()=>({status:s.data,statusLoading:s.isLoading,statusError:s.error,refetchStatus:s.refetch,config:i.data,configLoading:i.isLoading,models:c.data?.models??[],currentModel:c.data?.current,modelsLoading:c.isLoading,rawSettings:n.data,rawSettingsLoading:n.isLoading,refetchRawSettings:n.refetch,updateConfig:r.mutate,updateConfigAsync:r.mutateAsync,isUpdating:r.isPending,saveRawSettings:u.mutate,saveRawSettingsAsync:u.mutateAsync,isSavingRawSettings:u.isPending,startAuth:o.mutate,startAuthAsync:o.mutateAsync,isAuthenticating:o.isPending,authResult:o.data,startDaemon:p.mutate,isStartingDaemon:p.isPending,stopDaemon:g.mutate,isStoppingDaemon:g.isPending,info:d.data,infoLoading:d.isLoading,refetchInfo:d.refetch,install:l.mutate,installAsync:l.mutateAsync,isInstalling:l.isPending}),[s.data,s.isLoading,s.error,s.refetch,i.data,i.isLoading,c.data,c.isLoading,n.data,n.isLoading,n.refetch,r.mutate,r.mutateAsync,r.isPending,u.mutate,u.mutateAsync,u.isPending,o.mutate,o.mutateAsync,o.isPending,o.data,p.mutate,p.isPending,g.mutate,g.isPending,d.data,d.isLoading,d.refetch,l.mutate,l.mutateAsync,l.isPending])}function dt({rawSettings:t,rawSettingsLoading:s,isUpdating:i,isSavingRawSettings:c,hasChanges:n,isRawJsonValid:d,onRefresh:r,onSave:u}){return e.jsxs("div",{className:"px-6 py-4 border-b bg-background flex items-center justify-between shrink-0",children:[e.jsx("div",{className:"flex items-center gap-3",children:e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("h2",{className:"text-lg font-semibold",children:"Copilot Configuration"}),t&&e.jsx(S,{variant:"outline",className:"text-xs",children:"copilot.settings.json"})]}),t&&e.jsxs("p",{className:"text-xs text-muted-foreground mt-0.5",children:["Last modified:"," ",t.exists?new Date(t.mtime).toLocaleString():"Never saved"]})]})}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(v,{variant:"ghost",size:"sm",onClick:r,disabled:s,children:e.jsx(we,{className:`w-4 h-4 ${s?"animate-spin":""}`})}),e.jsx(v,{size:"sm",onClick:u,disabled:i||c||!n||!d,children:i||c?e.jsxs(e.Fragment,{children:[e.jsx(ve,{className:"w-4 h-4 mr-1 animate-spin"}),"Saving..."]}):e.jsxs(e.Fragment,{children:[e.jsx(Qe,{className:"w-4 h-4 mr-1"}),"Save"]})})]})]})}const mt=[{name:"GPT-4.1 (Free)",description:"Free tier - no premium usage",default:"gpt-4.1",opus:"gpt-4.1",sonnet:"gpt-4.1",haiku:"gpt-4.1"},{name:"GPT-5 Mini (Free)",description:"Free tier - lightweight model",default:"gpt-5-mini",opus:"gpt-5-mini",sonnet:"gpt-5-mini",haiku:"gpt-5-mini"}],ut=[{name:"Claude Opus 4.5",description:"Pro+ (3x) - Most capable reasoning",default:"claude-opus-4.5",opus:"claude-opus-4.5",sonnet:"claude-sonnet-4.5",haiku:"claude-haiku-4.5"},{name:"Claude Sonnet 4.5",description:"Pro+ (1x) - Balanced performance",default:"claude-sonnet-4.5",opus:"claude-opus-4.5",sonnet:"claude-sonnet-4.5",haiku:"claude-haiku-4.5"},{name:"GPT-5.2",description:"Pro+ (1x) - Latest OpenAI (Preview)",default:"gpt-5.2",opus:"gpt-5.2",sonnet:"gpt-5.1",haiku:"gpt-5-mini"},{name:"GPT-5.1 Codex Max",description:"Pro+ (1x) - Best for coding",default:"gpt-5.1-codex-max",opus:"gpt-5.1-codex-max",sonnet:"gpt-5.1-codex",haiku:"gpt-5.1-codex-mini"},{name:"Gemini 2.5 Pro",description:"Pro+ (1x) - Google latest",default:"gemini-2.5-pro",opus:"gemini-2.5-pro",sonnet:"gemini-2.5-pro",haiku:"gemini-3-flash"}];function ue(t){switch(t){case"free":return"bg-green-100 text-green-700 border-green-200";case"pro":return"bg-blue-100 text-blue-700 border-blue-200";case"pro+":return"bg-purple-100 text-purple-700 border-purple-200";case"business":return"bg-orange-100 text-orange-700 border-orange-200";case"enterprise":return"bg-red-100 text-red-700 border-red-200";default:return"bg-muted text-muted-foreground"}}function xt(t){return t==null?null:t===0?"Free":t<1?`${t}x`:t===1?"1x":`${t}x`}function z({label:t,description:s,value:i,onChange:c,models:n,disabled:d}){const{t:r}=ne(),u=n.find(o=>o.id===i);return e.jsxs("div",{className:"space-y-1.5",children:[e.jsxs("div",{children:[e.jsx("label",{className:"text-xs font-medium",children:t}),s&&e.jsx("p",{className:"text-[10px] text-muted-foreground",children:s})]}),e.jsxs(he,{value:i||"",onValueChange:c,disabled:d,children:[e.jsx(ge,{className:"h-9",children:e.jsx(fe,{placeholder:r("componentModelSelector.selectModel"),children:i&&e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"truncate font-mono text-xs",children:i}),u?.minPlan&&e.jsx(S,{variant:"outline",className:`text-[9px] px-1 py-0 h-4 ${ue(u.minPlan)}`,children:u.minPlan})]})})}),e.jsx(je,{className:"max-h-[300px]",children:e.jsxs(Le,{children:[e.jsx(Re,{className:"text-xs text-muted-foreground",children:r("componentModelSelector.availableModelsCount",{count:n.length})}),n.map(o=>e.jsx(H,{value:o.id,children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"truncate font-mono text-xs",children:o.name||o.id}),o.minPlan&&e.jsx(S,{variant:"outline",className:`text-[9px] px-1 py-0 h-4 ${ue(o.minPlan)}`,children:o.minPlan}),o.multiplier!==void 0&&e.jsx("span",{className:"text-[9px] text-muted-foreground",children:xt(o.multiplier)}),o.preview&&e.jsx(S,{variant:"secondary",className:"text-[9px] px-1 py-0 h-4",children:r("componentModelSelector.preview")}),i===o.id&&e.jsx(Je,{className:"w-3 h-3 text-primary ml-auto"})]})},o.id))]})})]})]})}function ee(t){if(t>=1e6){const s=t/1e6;return s%1===0?`${s}M`:`${s.toFixed(1)}M`}if(t>=1e3){const s=t/1e3;return s%1===0?`${s}K`:`${s.toFixed(1)}K`}return`${t}`}function pt(t){if(!t?.limits)return null;const s=[];return t.limits.maxPromptTokens&&s.push(`prompt ${ee(t.limits.maxPromptTokens)}`),t.limits.maxContextWindowTokens&&s.push(`context ${ee(t.limits.maxContextWindowTokens)}`),t.limits.maxOutputTokens&&s.push(`output ${ee(t.limits.maxOutputTokens)}`),s.length>0?s.join(" | "):null}function ht({currentModel:t,opusModel:s,sonnetModel:i,haikuModel:c,models:n,modelsLoading:d,onApplyPreset:r,onUpdateModel:u,onUpdateOpusModel:o,onUpdateSonnetModel:p,onUpdateHaikuModel:g}){const l=[{label:"Default",id:t},{label:"Opus",id:s||t},{label:"Sonnet",id:i||t},{label:"Haiku",id:c||t}].map(({label:a,id:x})=>{const y=n.find(P=>P.id===x),C=pt(y);return C?{label:a,id:x,limits:C}:null}).filter(a=>a!==null);return e.jsx(ie,{value:"config",className:"flex-1 mt-0 border-0 p-0 data-[state=inactive]:hidden flex flex-col overflow-hidden",children:e.jsx(V,{className:"flex-1",children:e.jsxs("div",{className:"p-4 space-y-6",children:[e.jsxs("div",{children:[e.jsxs("h3",{className:"text-sm font-medium mb-2 flex items-center gap-2",children:[e.jsx($e,{className:"w-4 h-4"}),"Presets"]}),e.jsx("p",{className:"text-xs text-muted-foreground mb-3",children:"Apply pre-configured model mappings"}),e.jsxs("div",{className:"mb-4",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[e.jsx(S,{variant:"outline",className:"text-[10px] bg-green-100 text-green-700 border-green-200",children:"Free Tier"}),e.jsx("span",{className:"text-[10px] text-muted-foreground",children:"No premium usage count"})]}),e.jsx("div",{className:"flex flex-wrap gap-2",children:mt.map(a=>e.jsxs(v,{variant:"outline",size:"sm",className:"text-xs h-7 gap-1",onClick:()=>r(a),title:a.description,children:[e.jsx(de,{className:"w-3 h-3 text-green-600"}),a.name]},a.name))})]}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[e.jsx(S,{variant:"outline",className:"text-[10px] bg-blue-100 text-blue-700 border-blue-200",children:"Pro+ Required"}),e.jsx("span",{className:"text-[10px] text-muted-foreground",children:"Uses premium request quota"})]}),e.jsx("div",{className:"flex flex-wrap gap-2",children:ut.map(a=>e.jsxs(v,{variant:"outline",size:"sm",className:"text-xs h-7 gap-1",onClick:()=>r(a),title:a.description,children:[e.jsx(de,{className:"w-3 h-3"}),a.name]},a.name))})]})]}),e.jsx(ae,{}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-sm font-medium mb-2",children:"Model Mapping"}),e.jsx("p",{className:"text-xs text-muted-foreground mb-4",children:"Configure which models to use for each tier"}),e.jsxs("div",{className:"mb-4 rounded-lg border border-amber-500/30 bg-amber-500/10 p-3 text-xs text-amber-900 dark:text-amber-200",children:[e.jsx("p",{className:"font-medium",children:"GitHub Copilot controls prompt/context limits upstream."}),e.jsx("p",{className:"mt-1",children:"CCS can switch Copilot models, but it cannot increase the provider's max prompt or context window."}),l.length>0?e.jsx("div",{className:"mt-2 space-y-1 text-[11px] font-mono",children:l.map(a=>e.jsxs("p",{children:[a.label,": ",a.id," (",a.limits,")"]},`${a.label}-${a.id}`))}):e.jsx("p",{className:"mt-2 text-[11px] font-mono",children:"Start the daemon to inspect live model limits from GitHub Copilot metadata."})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsx(z,{label:"Default Model",description:"Used when no specific tier is requested",value:t,onChange:u,models:n,disabled:d}),e.jsx(z,{label:"Opus (Most capable)",description:"For complex reasoning tasks",value:s||t,onChange:o,models:n,disabled:d}),e.jsx(z,{label:"Sonnet (Balanced)",description:"Balance of speed and capability",value:i||t,onChange:p,models:n,disabled:d}),e.jsx(z,{label:"Haiku (Fast)",description:"Quick responses for simple tasks",value:c||t,onChange:g,models:n,disabled:d})]})]})]})})})}function gt({enabled:t,autoStart:s,port:i,accountType:c,rateLimit:n,waitOnLimit:d,onUpdateEnabled:r,onUpdateAutoStart:u,onUpdatePort:o,onUpdateAccountType:p,onUpdateRateLimit:g,onUpdateWaitOnLimit:l}){const{t:a}=ne();return e.jsx(ie,{value:"settings",className:"flex-1 mt-0 border-0 p-0 data-[state=inactive]:hidden flex flex-col overflow-hidden",children:e.jsx(V,{className:"flex-1",children:e.jsxs("div",{className:"p-4 space-y-6",children:[e.jsxs("div",{className:"flex items-center justify-between rounded-lg border p-4",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(T,{htmlFor:"enabled",className:"text-sm font-medium",children:a("copilotSettings.enableCopilot")}),e.jsx("p",{className:"text-xs text-muted-foreground",children:a("copilotSettings.enableCopilotDesc")})]}),e.jsx(Z,{id:"enabled",checked:t,onCheckedChange:r})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsx("h3",{className:"text-sm font-medium",children:a("copilotSettings.basicSettings")}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{htmlFor:"port",className:"text-xs",children:a("copilotPage.port")}),e.jsx(ce,{id:"port",type:"number",value:i,onChange:x=>o(parseInt(x.target.value,10)),min:1024,max:65535,className:"max-w-[150px] h-8"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{htmlFor:"account-type",className:"text-xs",children:a("copilotSettings.accountType")}),e.jsxs(he,{value:c,onValueChange:p,children:[e.jsx(ge,{id:"account-type",className:"max-w-[150px] h-8",children:e.jsx(fe,{})}),e.jsxs(je,{children:[e.jsx(H,{value:"individual",children:a("copilotSettings.accountTypeIndividual")}),e.jsx(H,{value:"business",children:a("copilotSettings.accountTypeBusiness")}),e.jsx(H,{value:"enterprise",children:a("copilotSettings.accountTypeEnterprise")})]})]})]})]}),e.jsx(ae,{}),e.jsxs("div",{className:"space-y-4",children:[e.jsx("h3",{className:"text-sm font-medium",children:a("copilotSettings.rateLimiting")}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{htmlFor:"rate-limit",className:"text-xs",children:a("copilotSettings.rateLimitSeconds")}),e.jsx(ce,{id:"rate-limit",type:"number",value:n,onChange:x=>g(x.target.value),placeholder:a("copilotSettings.noLimit"),min:0,className:"max-w-[150px] h-8"})]}),e.jsxs("div",{className:"flex items-center justify-between rounded-lg border p-3",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(T,{htmlFor:"wait-on-limit",className:"text-xs",children:a("copilotSettings.waitOnRateLimit")}),e.jsx("p",{className:"text-[10px] text-muted-foreground",children:a("copilotSettings.waitOnRateLimitDesc")})]}),e.jsx(Z,{id:"wait-on-limit",checked:d,onCheckedChange:l})]})]}),e.jsx(ae,{}),e.jsxs("div",{className:"space-y-4",children:[e.jsx("h3",{className:"text-sm font-medium",children:a("copilotSettings.daemonSettings")}),e.jsxs("div",{className:"flex items-center justify-between rounded-lg border p-3",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(T,{htmlFor:"auto-start",className:"text-xs",children:a("copilotSettings.autoStartDaemon")}),e.jsx("p",{className:"text-[10px] text-muted-foreground",children:a("copilotSettings.autoStartDaemonDesc")})]}),e.jsx(Z,{id:"auto-start",checked:s,onCheckedChange:u})]})]})]})})})}function B({label:t,command:s}){return e.jsxs("div",{children:[e.jsx("label",{className:"text-xs text-muted-foreground",children:t}),e.jsxs("div",{className:"mt-1 flex gap-2",children:[e.jsx("code",{className:"flex-1 px-2 py-1.5 bg-muted rounded text-xs font-mono truncate",children:s}),e.jsx(Ne,{value:s,size:"icon",className:"h-6 w-6"})]})]})}function ft({rawSettings:t}){return e.jsx(ie,{value:"info",className:"h-full mt-0 border-0 p-0 data-[state=inactive]:hidden",children:e.jsx(V,{className:"h-full",children:e.jsxs("div",{className:"p-4 space-y-6",children:[e.jsxs("div",{children:[e.jsxs("h3",{className:"text-sm font-medium flex items-center gap-2 mb-3",children:[e.jsx(ze,{className:"w-4 h-4"}),"Configuration Info"]}),e.jsxs("div",{className:"space-y-3 bg-card rounded-lg border p-4 shadow-sm",children:[e.jsxs("div",{className:"grid grid-cols-[100px_1fr] gap-2 text-sm items-center",children:[e.jsx("span",{className:"font-medium text-muted-foreground",children:"Provider"}),e.jsx("span",{className:"font-mono",children:"GitHub Copilot"})]}),t&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"grid grid-cols-[100px_1fr] gap-2 text-sm items-center",children:[e.jsx("span",{className:"font-medium text-muted-foreground",children:"File Path"}),e.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[e.jsx("code",{className:"bg-muted px-1.5 py-0.5 rounded text-xs break-all",children:t.path}),e.jsx(Ne,{value:t.path,size:"icon",className:"h-5 w-5"})]})]}),e.jsxs("div",{className:"grid grid-cols-[100px_1fr] gap-2 text-sm items-center",children:[e.jsx("span",{className:"font-medium text-muted-foreground",children:"Status"}),e.jsx(S,{variant:"outline",className:t.exists?"w-fit text-green-600 border-green-200 bg-green-50":"w-fit text-muted-foreground",children:t.exists?"File exists":"Using defaults"})]})]})]})]}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-sm font-medium mb-3",children:"Quick Usage"}),e.jsxs("div",{className:"space-y-3 bg-card rounded-lg border p-4 shadow-sm",children:[e.jsx(B,{label:"Run with Copilot",command:"ccs copilot"}),e.jsx(B,{label:"Authenticate",command:"ccs copilot auth"}),e.jsx(B,{label:"Start daemon",command:"ccs copilot --start"}),e.jsx(B,{label:"Stop daemon",command:"ccs copilot --stop"})]})]})]})})})}const jt=["ANTHROPIC_BASE_URL","ANTHROPIC_AUTH_TOKEN"];function xe(t){const s=t?.env||{};return jt.filter(i=>!s[i]?.trim())}function pe(t){if(!t||t.length===0)return[];const s=new Map;return t.forEach(i=>{s.set(i.message,i)}),[...s.values()]}function Nt(){const{config:t,configLoading:s,models:i,modelsLoading:c,rawSettings:n,rawSettingsLoading:d,updateConfigAsync:r,isUpdating:u,saveRawSettingsAsync:o,isSavingRawSettings:p,refetchRawSettings:g}=Ce(),[l,a]=N.useState({}),[x,y]=N.useState(null),[C,P]=N.useState(!1),D=l.enabled??t?.enabled??!1,I=l.autoStart??t?.auto_start??!1,L=l.port??t?.port??4141,U=l.accountType??t?.account_type??"individual",R=l.model??t?.model??"claude-sonnet-4-6",A=l.rateLimit??t?.rate_limit?.toString()??"",f=l.waitOnLimit??t?.wait_on_limit??!0,K=l.opusModel??t?.opus_model??"",Q=l.sonnetModel??t?.sonnet_model??"",J=l.haikuModel??t?.haiku_model??"",$=(h,j)=>{a(O=>({...O,[h]:j}))},W=h=>{a(j=>({...j,model:h.default,opusModel:h.opus,sonnetModel:h.sonnet,haikuModel:h.haiku})),q.success(`Applied "${h.name}" preset`)},k=N.useMemo(()=>x!==null?x:n?.settings?JSON.stringify(n.settings,null,2):`{
|
|
1
|
+
import{j as e}from"./radix-ui-BR1vy4kf.js";import{b2 as w,b3 as Me,B as S,d as v,a as ne,r as he,s as ge,t as fe,v as je,at as Le,au as Re,w as H,V as ie,n as V,L as T,I as ce,x as Ne,b4 as Ae,S as b,b5 as Oe,b6 as Ee,b7 as _e,Q as qe,R as De,U as Y,b8 as Ie,c as se}from"./index-JgHDFSHt.js";import{r as N}from"./react-vendor-CNOkPC89.js";import{a as Ue,u as _,b as M}from"./tanstack-e99Cjjy2.js";import{C as Ke}from"./confirm-dialog-DTWvVQlx.js";import{R as we,L as ve,aj as Qe,l as Je,a4 as $e,Z as de,O as ze,T as be,am as Be,b as Ge,a6 as He,ar as Ve,aA as me,K as We,N as Xe,aB as Ye,v as ye,w as Se}from"./icons-DrEfTmfX.js";import{S as ae}from"./separator-BFr5KvfF.js";import{S as Z}from"./switch-w7IoOY5x.js";import{t as q}from"./notifications-B2HqRBj7.js";import"./utils-CzKF5WmX.js";import"./form-utils-Bcoyqxpq.js";import"./code-highlight-BRUf_pqB.js";import"./alert-dialog-0GYXcDLu.js";async function Ze(){const t=await fetch(w("/copilot/status"));if(!t.ok)throw new Error("Failed to fetch copilot status");return t.json()}async function et(){const t=await fetch(w("/copilot/config"));if(!t.ok)throw new Error("Failed to fetch copilot config");return t.json()}async function tt(){const t=await fetch(w("/copilot/models"));if(!t.ok)throw new Error("Failed to fetch copilot models");return t.json()}async function st(){const t=await fetch(w("/copilot/settings/raw"));if(!t.ok)throw new Error("Failed to fetch copilot raw settings");return t.json()}async function at(t){const s=await fetch(w("/copilot/config"),{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)});if(!s.ok)throw new Error("Failed to update copilot config");return s.json()}async function nt(t){const s=await fetch(w("/copilot/settings/raw"),{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)});if(s.status===409)throw new Me("Copilot raw settings changed externally");if(!s.ok)throw new Error("Failed to save copilot raw settings");return s.json()}async function it(){const t=await fetch(w("/copilot/auth/start"),{method:"POST"});if(!t.ok)throw new Error("Failed to start auth");return t.json()}async function ot(){const t=await fetch(w("/copilot/daemon/start"),{method:"POST"});if(!t.ok)throw new Error("Failed to start daemon");return t.json()}async function lt(){const t=await fetch(w("/copilot/daemon/stop"),{method:"POST"});if(!t.ok)throw new Error("Failed to stop daemon");return t.json()}async function rt(){const t=await fetch(w("/copilot/info"));if(!t.ok)throw new Error("Failed to fetch copilot info");return t.json()}async function ct(t){const s=await fetch(w("/copilot/install"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t?{version:t}:{})});if(!s.ok)throw new Error("Failed to install copilot-api");return s.json()}function Ce(){const t=Ue(),s=_({queryKey:["copilot-status"],queryFn:Ze,refetchInterval:5e3}),i=_({queryKey:["copilot-config"],queryFn:et}),c=_({queryKey:["copilot-models"],queryFn:tt}),n=_({queryKey:["copilot-raw-settings"],queryFn:st}),d=_({queryKey:["copilot-info"],queryFn:rt}),r=M({mutationFn:at,onSuccess:()=>{t.invalidateQueries({queryKey:["copilot-status"]}),t.invalidateQueries({queryKey:["copilot-config"]}),t.invalidateQueries({queryKey:["copilot-raw-settings"]})}}),u=M({mutationFn:nt,onSuccess:()=>{t.invalidateQueries({queryKey:["copilot-status"]}),t.invalidateQueries({queryKey:["copilot-config"]}),t.invalidateQueries({queryKey:["copilot-raw-settings"]})}}),o=M({mutationFn:it,onSuccess:()=>{t.invalidateQueries({queryKey:["copilot-status"]})}}),p=M({mutationFn:ot,onSuccess:()=>{t.invalidateQueries({queryKey:["copilot-status"]})}}),g=M({mutationFn:lt,onSuccess:()=>{t.invalidateQueries({queryKey:["copilot-status"]})}}),l=M({mutationFn:ct,onSuccess:()=>{t.invalidateQueries({queryKey:["copilot-status"]}),t.invalidateQueries({queryKey:["copilot-info"]})}});return N.useMemo(()=>({status:s.data,statusLoading:s.isLoading,statusError:s.error,refetchStatus:s.refetch,config:i.data,configLoading:i.isLoading,models:c.data?.models??[],currentModel:c.data?.current,modelsLoading:c.isLoading,rawSettings:n.data,rawSettingsLoading:n.isLoading,refetchRawSettings:n.refetch,updateConfig:r.mutate,updateConfigAsync:r.mutateAsync,isUpdating:r.isPending,saveRawSettings:u.mutate,saveRawSettingsAsync:u.mutateAsync,isSavingRawSettings:u.isPending,startAuth:o.mutate,startAuthAsync:o.mutateAsync,isAuthenticating:o.isPending,authResult:o.data,startDaemon:p.mutate,isStartingDaemon:p.isPending,stopDaemon:g.mutate,isStoppingDaemon:g.isPending,info:d.data,infoLoading:d.isLoading,refetchInfo:d.refetch,install:l.mutate,installAsync:l.mutateAsync,isInstalling:l.isPending}),[s.data,s.isLoading,s.error,s.refetch,i.data,i.isLoading,c.data,c.isLoading,n.data,n.isLoading,n.refetch,r.mutate,r.mutateAsync,r.isPending,u.mutate,u.mutateAsync,u.isPending,o.mutate,o.mutateAsync,o.isPending,o.data,p.mutate,p.isPending,g.mutate,g.isPending,d.data,d.isLoading,d.refetch,l.mutate,l.mutateAsync,l.isPending])}function dt({rawSettings:t,rawSettingsLoading:s,isUpdating:i,isSavingRawSettings:c,hasChanges:n,isRawJsonValid:d,onRefresh:r,onSave:u}){return e.jsxs("div",{className:"px-6 py-4 border-b bg-background flex items-center justify-between shrink-0",children:[e.jsx("div",{className:"flex items-center gap-3",children:e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("h2",{className:"text-lg font-semibold",children:"Copilot Configuration"}),t&&e.jsx(S,{variant:"outline",className:"text-xs",children:"copilot.settings.json"})]}),t&&e.jsxs("p",{className:"text-xs text-muted-foreground mt-0.5",children:["Last modified:"," ",t.exists?new Date(t.mtime).toLocaleString():"Never saved"]})]})}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(v,{variant:"ghost",size:"sm",onClick:r,disabled:s,children:e.jsx(we,{className:`w-4 h-4 ${s?"animate-spin":""}`})}),e.jsx(v,{size:"sm",onClick:u,disabled:i||c||!n||!d,children:i||c?e.jsxs(e.Fragment,{children:[e.jsx(ve,{className:"w-4 h-4 mr-1 animate-spin"}),"Saving..."]}):e.jsxs(e.Fragment,{children:[e.jsx(Qe,{className:"w-4 h-4 mr-1"}),"Save"]})})]})]})}const mt=[{name:"GPT-4.1 (Free)",description:"Free tier - no premium usage",default:"gpt-4.1",opus:"gpt-4.1",sonnet:"gpt-4.1",haiku:"gpt-4.1"},{name:"GPT-5 Mini (Free)",description:"Free tier - lightweight model",default:"gpt-5-mini",opus:"gpt-5-mini",sonnet:"gpt-5-mini",haiku:"gpt-5-mini"}],ut=[{name:"Claude Opus 4.5",description:"Pro+ (3x) - Most capable reasoning",default:"claude-opus-4.5",opus:"claude-opus-4.5",sonnet:"claude-sonnet-4.5",haiku:"claude-haiku-4.5"},{name:"Claude Sonnet 4.5",description:"Pro+ (1x) - Balanced performance",default:"claude-sonnet-4.5",opus:"claude-opus-4.5",sonnet:"claude-sonnet-4.5",haiku:"claude-haiku-4.5"},{name:"GPT-5.2",description:"Pro+ (1x) - Latest OpenAI (Preview)",default:"gpt-5.2",opus:"gpt-5.2",sonnet:"gpt-5.1",haiku:"gpt-5-mini"},{name:"GPT-5.1 Codex Max",description:"Pro+ (1x) - Best for coding",default:"gpt-5.1-codex-max",opus:"gpt-5.1-codex-max",sonnet:"gpt-5.1-codex",haiku:"gpt-5.1-codex-mini"},{name:"Gemini 2.5 Pro",description:"Pro+ (1x) - Google latest",default:"gemini-2.5-pro",opus:"gemini-2.5-pro",sonnet:"gemini-2.5-pro",haiku:"gemini-3-flash"}];function ue(t){switch(t){case"free":return"bg-green-100 text-green-700 border-green-200";case"pro":return"bg-blue-100 text-blue-700 border-blue-200";case"pro+":return"bg-purple-100 text-purple-700 border-purple-200";case"business":return"bg-orange-100 text-orange-700 border-orange-200";case"enterprise":return"bg-red-100 text-red-700 border-red-200";default:return"bg-muted text-muted-foreground"}}function xt(t){return t==null?null:t===0?"Free":t<1?`${t}x`:t===1?"1x":`${t}x`}function z({label:t,description:s,value:i,onChange:c,models:n,disabled:d}){const{t:r}=ne(),u=n.find(o=>o.id===i);return e.jsxs("div",{className:"space-y-1.5",children:[e.jsxs("div",{children:[e.jsx("label",{className:"text-xs font-medium",children:t}),s&&e.jsx("p",{className:"text-[10px] text-muted-foreground",children:s})]}),e.jsxs(he,{value:i||"",onValueChange:c,disabled:d,children:[e.jsx(ge,{className:"h-9",children:e.jsx(fe,{placeholder:r("componentModelSelector.selectModel"),children:i&&e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"truncate font-mono text-xs",children:i}),u?.minPlan&&e.jsx(S,{variant:"outline",className:`text-[9px] px-1 py-0 h-4 ${ue(u.minPlan)}`,children:u.minPlan})]})})}),e.jsx(je,{className:"max-h-[300px]",children:e.jsxs(Le,{children:[e.jsx(Re,{className:"text-xs text-muted-foreground",children:r("componentModelSelector.availableModelsCount",{count:n.length})}),n.map(o=>e.jsx(H,{value:o.id,children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"truncate font-mono text-xs",children:o.name||o.id}),o.minPlan&&e.jsx(S,{variant:"outline",className:`text-[9px] px-1 py-0 h-4 ${ue(o.minPlan)}`,children:o.minPlan}),o.multiplier!==void 0&&e.jsx("span",{className:"text-[9px] text-muted-foreground",children:xt(o.multiplier)}),o.preview&&e.jsx(S,{variant:"secondary",className:"text-[9px] px-1 py-0 h-4",children:r("componentModelSelector.preview")}),i===o.id&&e.jsx(Je,{className:"w-3 h-3 text-primary ml-auto"})]})},o.id))]})})]})]})}function ee(t){if(t>=1e6){const s=t/1e6;return s%1===0?`${s}M`:`${s.toFixed(1)}M`}if(t>=1e3){const s=t/1e3;return s%1===0?`${s}K`:`${s.toFixed(1)}K`}return`${t}`}function pt(t){if(!t?.limits)return null;const s=[];return t.limits.maxPromptTokens&&s.push(`prompt ${ee(t.limits.maxPromptTokens)}`),t.limits.maxContextWindowTokens&&s.push(`context ${ee(t.limits.maxContextWindowTokens)}`),t.limits.maxOutputTokens&&s.push(`output ${ee(t.limits.maxOutputTokens)}`),s.length>0?s.join(" | "):null}function ht({currentModel:t,opusModel:s,sonnetModel:i,haikuModel:c,models:n,modelsLoading:d,onApplyPreset:r,onUpdateModel:u,onUpdateOpusModel:o,onUpdateSonnetModel:p,onUpdateHaikuModel:g}){const l=[{label:"Default",id:t},{label:"Opus",id:s||t},{label:"Sonnet",id:i||t},{label:"Haiku",id:c||t}].map(({label:a,id:x})=>{const y=n.find(P=>P.id===x),C=pt(y);return C?{label:a,id:x,limits:C}:null}).filter(a=>a!==null);return e.jsx(ie,{value:"config",className:"flex-1 mt-0 border-0 p-0 data-[state=inactive]:hidden flex flex-col overflow-hidden",children:e.jsx(V,{className:"flex-1",children:e.jsxs("div",{className:"p-4 space-y-6",children:[e.jsxs("div",{children:[e.jsxs("h3",{className:"text-sm font-medium mb-2 flex items-center gap-2",children:[e.jsx($e,{className:"w-4 h-4"}),"Presets"]}),e.jsx("p",{className:"text-xs text-muted-foreground mb-3",children:"Apply pre-configured model mappings"}),e.jsxs("div",{className:"mb-4",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[e.jsx(S,{variant:"outline",className:"text-[10px] bg-green-100 text-green-700 border-green-200",children:"Free Tier"}),e.jsx("span",{className:"text-[10px] text-muted-foreground",children:"No premium usage count"})]}),e.jsx("div",{className:"flex flex-wrap gap-2",children:mt.map(a=>e.jsxs(v,{variant:"outline",size:"sm",className:"text-xs h-7 gap-1",onClick:()=>r(a),title:a.description,children:[e.jsx(de,{className:"w-3 h-3 text-green-600"}),a.name]},a.name))})]}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[e.jsx(S,{variant:"outline",className:"text-[10px] bg-blue-100 text-blue-700 border-blue-200",children:"Pro+ Required"}),e.jsx("span",{className:"text-[10px] text-muted-foreground",children:"Uses premium request quota"})]}),e.jsx("div",{className:"flex flex-wrap gap-2",children:ut.map(a=>e.jsxs(v,{variant:"outline",size:"sm",className:"text-xs h-7 gap-1",onClick:()=>r(a),title:a.description,children:[e.jsx(de,{className:"w-3 h-3"}),a.name]},a.name))})]})]}),e.jsx(ae,{}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-sm font-medium mb-2",children:"Model Mapping"}),e.jsx("p",{className:"text-xs text-muted-foreground mb-4",children:"Configure which models to use for each tier"}),e.jsxs("div",{className:"mb-4 rounded-lg border border-amber-500/30 bg-amber-500/10 p-3 text-xs text-amber-900 dark:text-amber-200",children:[e.jsx("p",{className:"font-medium",children:"GitHub Copilot controls prompt/context limits upstream."}),e.jsx("p",{className:"mt-1",children:"CCS can switch Copilot models, but it cannot increase the provider's max prompt or context window."}),l.length>0?e.jsx("div",{className:"mt-2 space-y-1 text-[11px] font-mono",children:l.map(a=>e.jsxs("p",{children:[a.label,": ",a.id," (",a.limits,")"]},`${a.label}-${a.id}`))}):e.jsx("p",{className:"mt-2 text-[11px] font-mono",children:"Start the daemon to inspect live model limits from GitHub Copilot metadata."})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsx(z,{label:"Default Model",description:"Used when no specific tier is requested",value:t,onChange:u,models:n,disabled:d}),e.jsx(z,{label:"Opus (Most capable)",description:"For complex reasoning tasks",value:s||t,onChange:o,models:n,disabled:d}),e.jsx(z,{label:"Sonnet (Balanced)",description:"Balance of speed and capability",value:i||t,onChange:p,models:n,disabled:d}),e.jsx(z,{label:"Haiku (Fast)",description:"Quick responses for simple tasks",value:c||t,onChange:g,models:n,disabled:d})]})]})]})})})}function gt({enabled:t,autoStart:s,port:i,accountType:c,rateLimit:n,waitOnLimit:d,onUpdateEnabled:r,onUpdateAutoStart:u,onUpdatePort:o,onUpdateAccountType:p,onUpdateRateLimit:g,onUpdateWaitOnLimit:l}){const{t:a}=ne();return e.jsx(ie,{value:"settings",className:"flex-1 mt-0 border-0 p-0 data-[state=inactive]:hidden flex flex-col overflow-hidden",children:e.jsx(V,{className:"flex-1",children:e.jsxs("div",{className:"p-4 space-y-6",children:[e.jsxs("div",{className:"flex items-center justify-between rounded-lg border p-4",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(T,{htmlFor:"enabled",className:"text-sm font-medium",children:a("copilotSettings.enableCopilot")}),e.jsx("p",{className:"text-xs text-muted-foreground",children:a("copilotSettings.enableCopilotDesc")})]}),e.jsx(Z,{id:"enabled",checked:t,onCheckedChange:r})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsx("h3",{className:"text-sm font-medium",children:a("copilotSettings.basicSettings")}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{htmlFor:"port",className:"text-xs",children:a("copilotPage.port")}),e.jsx(ce,{id:"port",type:"number",value:i,onChange:x=>o(parseInt(x.target.value,10)),min:1024,max:65535,className:"max-w-[150px] h-8"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{htmlFor:"account-type",className:"text-xs",children:a("copilotSettings.accountType")}),e.jsxs(he,{value:c,onValueChange:p,children:[e.jsx(ge,{id:"account-type",className:"max-w-[150px] h-8",children:e.jsx(fe,{})}),e.jsxs(je,{children:[e.jsx(H,{value:"individual",children:a("copilotSettings.accountTypeIndividual")}),e.jsx(H,{value:"business",children:a("copilotSettings.accountTypeBusiness")}),e.jsx(H,{value:"enterprise",children:a("copilotSettings.accountTypeEnterprise")})]})]})]})]}),e.jsx(ae,{}),e.jsxs("div",{className:"space-y-4",children:[e.jsx("h3",{className:"text-sm font-medium",children:a("copilotSettings.rateLimiting")}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{htmlFor:"rate-limit",className:"text-xs",children:a("copilotSettings.rateLimitSeconds")}),e.jsx(ce,{id:"rate-limit",type:"number",value:n,onChange:x=>g(x.target.value),placeholder:a("copilotSettings.noLimit"),min:0,className:"max-w-[150px] h-8"})]}),e.jsxs("div",{className:"flex items-center justify-between rounded-lg border p-3",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(T,{htmlFor:"wait-on-limit",className:"text-xs",children:a("copilotSettings.waitOnRateLimit")}),e.jsx("p",{className:"text-[10px] text-muted-foreground",children:a("copilotSettings.waitOnRateLimitDesc")})]}),e.jsx(Z,{id:"wait-on-limit",checked:d,onCheckedChange:l})]})]}),e.jsx(ae,{}),e.jsxs("div",{className:"space-y-4",children:[e.jsx("h3",{className:"text-sm font-medium",children:a("copilotSettings.daemonSettings")}),e.jsxs("div",{className:"flex items-center justify-between rounded-lg border p-3",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(T,{htmlFor:"auto-start",className:"text-xs",children:a("copilotSettings.autoStartDaemon")}),e.jsx("p",{className:"text-[10px] text-muted-foreground",children:a("copilotSettings.autoStartDaemonDesc")})]}),e.jsx(Z,{id:"auto-start",checked:s,onCheckedChange:u})]})]})]})})})}function B({label:t,command:s}){return e.jsxs("div",{children:[e.jsx("label",{className:"text-xs text-muted-foreground",children:t}),e.jsxs("div",{className:"mt-1 flex gap-2",children:[e.jsx("code",{className:"flex-1 px-2 py-1.5 bg-muted rounded text-xs font-mono truncate",children:s}),e.jsx(Ne,{value:s,size:"icon",className:"h-6 w-6"})]})]})}function ft({rawSettings:t}){return e.jsx(ie,{value:"info",className:"h-full mt-0 border-0 p-0 data-[state=inactive]:hidden",children:e.jsx(V,{className:"h-full",children:e.jsxs("div",{className:"p-4 space-y-6",children:[e.jsxs("div",{children:[e.jsxs("h3",{className:"text-sm font-medium flex items-center gap-2 mb-3",children:[e.jsx(ze,{className:"w-4 h-4"}),"Configuration Info"]}),e.jsxs("div",{className:"space-y-3 bg-card rounded-lg border p-4 shadow-sm",children:[e.jsxs("div",{className:"grid grid-cols-[100px_1fr] gap-2 text-sm items-center",children:[e.jsx("span",{className:"font-medium text-muted-foreground",children:"Provider"}),e.jsx("span",{className:"font-mono",children:"GitHub Copilot"})]}),t&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"grid grid-cols-[100px_1fr] gap-2 text-sm items-center",children:[e.jsx("span",{className:"font-medium text-muted-foreground",children:"File Path"}),e.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[e.jsx("code",{className:"bg-muted px-1.5 py-0.5 rounded text-xs break-all",children:t.path}),e.jsx(Ne,{value:t.path,size:"icon",className:"h-5 w-5"})]})]}),e.jsxs("div",{className:"grid grid-cols-[100px_1fr] gap-2 text-sm items-center",children:[e.jsx("span",{className:"font-medium text-muted-foreground",children:"Status"}),e.jsx(S,{variant:"outline",className:t.exists?"w-fit text-green-600 border-green-200 bg-green-50":"w-fit text-muted-foreground",children:t.exists?"File exists":"Using defaults"})]})]})]})]}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-sm font-medium mb-3",children:"Quick Usage"}),e.jsxs("div",{className:"space-y-3 bg-card rounded-lg border p-4 shadow-sm",children:[e.jsx(B,{label:"Run with Copilot",command:"ccs copilot"}),e.jsx(B,{label:"Authenticate",command:"ccs copilot auth"}),e.jsx(B,{label:"Start daemon",command:"ccs copilot --start"}),e.jsx(B,{label:"Stop daemon",command:"ccs copilot --stop"})]})]})]})})})}const jt=["ANTHROPIC_BASE_URL","ANTHROPIC_AUTH_TOKEN"];function xe(t){const s=t?.env||{};return jt.filter(i=>!s[i]?.trim())}function pe(t){if(!t||t.length===0)return[];const s=new Map;return t.forEach(i=>{s.set(i.message,i)}),[...s.values()]}function Nt(){const{config:t,configLoading:s,models:i,modelsLoading:c,rawSettings:n,rawSettingsLoading:d,updateConfigAsync:r,isUpdating:u,saveRawSettingsAsync:o,isSavingRawSettings:p,refetchRawSettings:g}=Ce(),[l,a]=N.useState({}),[x,y]=N.useState(null),[C,P]=N.useState(!1),D=l.enabled??t?.enabled??!1,I=l.autoStart??t?.auto_start??!1,L=l.port??t?.port??4141,U=l.accountType??t?.account_type??"individual",R=l.model??t?.model??"claude-sonnet-4-6",A=l.rateLimit??t?.rate_limit?.toString()??"",f=l.waitOnLimit??t?.wait_on_limit??!0,K=l.opusModel??t?.opus_model??"",Q=l.sonnetModel??t?.sonnet_model??"",J=l.haikuModel??t?.haiku_model??"",$=(h,j)=>{a(O=>({...O,[h]:j}))},W=h=>{a(j=>({...j,model:h.default,opusModel:h.opus,sonnetModel:h.sonnet,haikuModel:h.haiku})),q.success(`Applied "${h.name}" preset`)},k=N.useMemo(()=>x!==null?x:n?.settings?JSON.stringify(n.settings,null,2):`{
|
|
2
2
|
"env": {}
|
|
3
3
|
}`,[x,n]),m=N.useCallback(h=>{y(h)},[]),oe=N.useMemo(()=>{try{return JSON.parse(k),!0}catch{return!1}},[k]),Pe=N.useMemo(()=>{const h=Object.keys(l).length>0,j=x!==null&&x!==JSON.stringify(n?.settings,null,2);return h||j},[l,x,n]),le=N.useMemo(()=>{if(x!==null)try{return JSON.parse(x)}catch{return n?.settings}return n?.settings},[x,n?.settings]),ke=N.useMemo(()=>xe(le),[le]),Fe=N.useMemo(()=>pe([...t?.warnings??[],...n?.warnings??[]]),[t?.warnings,n?.warnings]),re=async({overwriteRawSettings:h=!1}={})=>{try{const j=[];if(Object.keys(l).length>0){const F=await r({enabled:D,auto_start:I,port:L,account_type:U,model:R,rate_limit:A?parseInt(A,10):null,wait_on_limit:f,opus_model:K||void 0,sonnet_model:Q||void 0,haiku_model:J||void 0});j.push(...F.warnings??[])}let O=[];if(x!==null&&oe){const F=JSON.parse(k);O=xe(F);const Te=await o({settings:F,expectedMtime:h?void 0:n?.mtime});j.push(...Te.warnings??[])}const X=pe(j),E=[];X.length>0&&E.push(X.map(F=>F.message).join(" ")),O.length>0&&E.push(`Missing fields will use defaults: ${O.join(", ")}`),X.length>0?q.warning("Copilot configuration saved with model adjustments",{description:E.join(" ")}):E.length>0?q.success("Copilot configuration saved",{description:E.join(" ")}):q.success("Copilot configuration saved"),a({}),y(null)}catch(j){Ae(j)?P(!0):q.error("Failed to save settings")}};return{configLoading:s,rawSettingsLoading:d,modelsLoading:c,isUpdating:u,isSavingRawSettings:p,models:i,rawSettings:n,rawJsonContent:k,rawJsonEdits:x,enabled:D,autoStart:I,port:L,accountType:U,currentModel:R,rateLimit:A,waitOnLimit:f,opusModel:K,sonnetModel:Q,haikuModel:J,isRawJsonValid:oe,hasChanges:Pe,normalizationWarnings:Fe,conflictDialog:C,updateField:$,applyPreset:W,handleRawJsonChange:m,handleSave:re,handleConflictResolve:async h=>{P(!1),h?await re({overwriteRawSettings:!0}):y(null)},refetchRawSettings:g,missingRequiredFields:ke}}function wt(){const{configLoading:t,rawSettingsLoading:s,modelsLoading:i,isUpdating:c,isSavingRawSettings:n,models:d,rawSettings:r,rawJsonContent:u,rawJsonEdits:o,enabled:p,autoStart:g,port:l,accountType:a,currentModel:x,rateLimit:y,waitOnLimit:C,opusModel:P,sonnetModel:D,haikuModel:I,isRawJsonValid:L,hasChanges:U,normalizationWarnings:R,conflictDialog:A,updateField:f,applyPreset:K,handleRawJsonChange:Q,handleSave:J,handleConflictResolve:$,refetchRawSettings:W,missingRequiredFields:k}=Nt();return t||s?e.jsxs("div",{className:"space-y-6",children:[e.jsx(b,{className:"h-10 w-full"}),e.jsx(b,{className:"h-10 w-full"}),e.jsx(b,{className:"h-10 w-full"}),e.jsx(b,{className:"h-10 w-full"})]}):e.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[e.jsx(dt,{rawSettings:r,rawSettingsLoading:s,isUpdating:c,isSavingRawSettings:n,hasChanges:U,isRawJsonValid:L,onRefresh:()=>W(),onSave:J}),R.length>0&&e.jsx("div",{className:"px-6 pt-4 shrink-0",children:e.jsxs(Oe,{variant:"warning",children:[e.jsx(be,{className:"h-4 w-4"}),e.jsx(Ee,{children:"Deprecated Copilot models detected"}),e.jsxs(_e,{className:"space-y-2",children:[e.jsx("p",{children:"Loading this page did not rewrite your files. Save the Copilot configuration to persist these replacements."}),e.jsx("div",{className:"space-y-1",children:R.map(m=>e.jsx("p",{children:m.message},m.message))})]})]})}),e.jsxs("div",{className:"flex-1 flex divide-x overflow-hidden",children:[e.jsx("div",{className:"w-[540px] shrink-0 flex flex-col overflow-hidden bg-muted/5",children:e.jsx("div",{className:"h-full flex flex-col",children:e.jsxs(qe,{defaultValue:"config",className:"h-full flex flex-col",children:[e.jsx("div",{className:"px-4 pt-4 shrink-0",children:e.jsxs(De,{className:"w-full",children:[e.jsx(Y,{value:"config",className:"flex-1",children:"Model Config"}),e.jsx(Y,{value:"settings",className:"flex-1",children:"Settings"}),e.jsx(Y,{value:"info",className:"flex-1",children:"Info"})]})}),e.jsxs("div",{className:"flex-1 overflow-hidden flex flex-col",children:[e.jsx(ht,{currentModel:x,opusModel:P,sonnetModel:D,haikuModel:I,models:d,modelsLoading:i,onApplyPreset:K,onUpdateModel:m=>f("model",m),onUpdateOpusModel:m=>f("opusModel",m),onUpdateSonnetModel:m=>f("sonnetModel",m),onUpdateHaikuModel:m=>f("haikuModel",m)}),e.jsx(gt,{enabled:p,autoStart:g,port:l,accountType:a,rateLimit:y,waitOnLimit:C,onUpdateEnabled:m=>f("enabled",m),onUpdateAutoStart:m=>f("autoStart",m),onUpdatePort:m=>f("port",m),onUpdateAccountType:m=>f("accountType",m),onUpdateRateLimit:m=>f("rateLimit",m),onUpdateWaitOnLimit:m=>f("waitOnLimit",m)}),e.jsx(ft,{rawSettings:r})]})]})})}),e.jsxs("div",{className:"flex-1 min-w-0 flex flex-col overflow-hidden",children:[e.jsxs("div",{className:"px-6 py-2 bg-muted/30 border-b flex items-center gap-2 shrink-0 h-[45px]",children:[e.jsx(Be,{className:"w-4 h-4 text-muted-foreground"}),e.jsx("span",{className:"text-sm font-medium text-muted-foreground",children:"Raw Configuration (JSON)"})]}),e.jsx(Ie,{rawJsonContent:u,isRawJsonValid:L,rawJsonEdits:o,rawSettingsEnv:r?.settings?.env,onChange:Q,missingRequiredFields:k})]})]}),e.jsx(Ke,{open:A,title:"File Modified Externally",description:"This settings file was modified by another process. Overwrite with your changes or discard?",confirmText:"Overwrite",variant:"destructive",onConfirm:()=>$(!0),onCancel:()=>$(!1)})]})}function te({title:t,children:s}){return e.jsxs("div",{className:"space-y-2",children:[e.jsx("div",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wide px-3",children:t}),e.jsx("div",{className:"space-y-1",children:s})]})}function G({icon:t,label:s,status:i,statusText:c,variant:n="default"}){return e.jsxs("div",{className:"flex items-center gap-3 px-3 py-2 rounded-lg bg-muted/50",children:[e.jsx(t,{className:"w-4 h-4 text-muted-foreground shrink-0"}),e.jsx("div",{className:"flex-1 min-w-0",children:e.jsx("span",{className:"text-sm",children:s})}),e.jsx("div",{className:"flex items-center gap-1.5",children:i?e.jsxs(e.Fragment,{children:[e.jsx(ye,{className:se("w-4 h-4",n==="warning"?"text-yellow-500":"text-green-500")}),e.jsx("span",{className:se("text-xs",n==="warning"?"text-yellow-500":"text-green-500"),children:c||"Yes"})]}):e.jsxs(e.Fragment,{children:[e.jsx(Se,{className:"w-4 h-4 text-muted-foreground"}),e.jsx("span",{className:"text-xs text-muted-foreground",children:c||"No"})]})})]})}function vt(){return e.jsxs("div",{className:"space-y-4 p-4",children:[e.jsx(b,{className:"h-8 w-full"}),e.jsx(b,{className:"h-12 w-full"}),e.jsx(b,{className:"h-12 w-full"}),e.jsx(b,{className:"h-12 w-full"})]})}function _t(){const{t}=ne(),{status:s,statusLoading:i,refetchStatus:c,startAuth:n,isAuthenticating:d,startDaemon:r,isStartingDaemon:u,stopDaemon:o,isStoppingDaemon:p,install:g,isInstalling:l}=Ce();return e.jsxs("div",{className:"h-[calc(100vh-100px)] flex",children:[e.jsxs("div",{className:"w-80 border-r flex flex-col bg-muted/30 shrink-0",children:[e.jsxs("div",{className:"p-4 border-b bg-background",children:[e.jsxs("div",{className:"flex items-center justify-between mb-1",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Ge,{className:"w-5 h-5 text-primary"}),e.jsx("h1",{className:"font-semibold",children:t("copilotPage.title")})]}),e.jsx(v,{variant:"ghost",size:"icon",className:"h-8 w-8",onClick:()=>c(),disabled:i,children:e.jsx(we,{className:se("w-4 h-4",i&&"animate-spin")})})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:t("copilotPage.subtitle")})]}),e.jsx(V,{className:"flex-1",children:i?e.jsx(vt,{}):e.jsxs("div",{className:"p-3 space-y-4",children:[e.jsxs("div",{className:"rounded-md border border-yellow-500/50 bg-yellow-500/15 p-3 space-y-1.5",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(be,{className:"h-4 w-4 text-yellow-600 dark:text-yellow-400 shrink-0"}),e.jsx("span",{className:"text-xs font-semibold text-yellow-800 dark:text-yellow-200",children:t("copilotPage.unofficialTitle")})]}),e.jsxs("ul",{className:"text-[11px] text-yellow-700 dark:text-yellow-300 space-y-0.5 pl-6 list-disc",children:[e.jsx("li",{children:t("copilotPage.unofficialItem1")}),e.jsx("li",{children:t("copilotPage.unofficialItem2")}),e.jsx("li",{children:t("copilotPage.unofficialItem3")})]})]}),e.jsxs(te,{title:t("copilotPage.setup"),children:[e.jsx(G,{icon:He,label:"copilot-api",status:s?.installed??!1,statusText:s?.installed?s.version?`v${s.version}`:t("copilotPage.installed"):t("copilotPage.missing")}),!s?.installed&&e.jsx(v,{size:"sm",className:"w-full mt-2",onClick:()=>g(void 0),disabled:l,children:l?e.jsxs(e.Fragment,{children:[e.jsx(ve,{className:"w-3.5 h-3.5 mr-1.5 animate-spin"}),t("copilotPage.installing")]}):e.jsxs(e.Fragment,{children:[e.jsx(Ve,{className:"w-3.5 h-3.5 mr-1.5"}),t("copilotPage.installCopilotApi")]})}),s?.installed&&e.jsx(G,{icon:me,label:t("copilotPage.integration"),status:s?.enabled??!1,statusText:s?.enabled?t("copilotPage.enabled"):t("copilotPage.disabled")})]}),s?.installed&&e.jsxs(te,{title:t("copilotPage.auth"),children:[e.jsx(G,{icon:We,label:t("copilotPage.github"),status:s?.authenticated??!1,statusText:s?.authenticated?t("copilotPage.connected"):t("copilotPage.notConnected")}),!s?.authenticated&&e.jsx(v,{size:"sm",className:"w-full mt-2",onClick:()=>n(),disabled:d,children:t(d?"copilotPage.authenticating":"copilotPage.authenticate")})]}),s?.authenticated&&e.jsxs(te,{title:t("copilotPage.daemon"),children:[e.jsx(G,{icon:Xe,label:t("copilotPage.status"),status:s?.daemon_running??!1,statusText:s?.daemon_running?t("copilotPage.running"):t("copilotPage.stopped")}),e.jsxs("div",{className:"px-3 py-1 text-xs text-muted-foreground",children:[t("copilotPage.port"),": ",s?.port??4141]}),e.jsx("div",{className:"px-1",children:s?.daemon_running?e.jsxs(v,{size:"sm",variant:"outline",className:"w-full",onClick:()=>o(),disabled:p,children:[e.jsx(Ye,{className:"w-3.5 h-3.5 mr-1.5"}),t(p?"copilotPage.stopping":"copilotPage.stop")]}):e.jsxs(v,{size:"sm",variant:"outline",className:"w-full",onClick:()=>r(),disabled:u,children:[e.jsx(me,{className:"w-3.5 h-3.5 mr-1.5"}),t(u?"copilotPage.starting":"copilotPage.start")]})})]})]})}),e.jsx("div",{className:"p-3 border-t bg-background text-xs text-muted-foreground",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{children:t("copilotPage.proxy")}),s?.daemon_running?e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(ye,{className:"w-3 h-3 text-green-500"}),t("copilotPage.active")]}):e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(Se,{className:"w-3 h-3 text-muted-foreground"}),t("copilotPage.inactive")]})]})})]}),e.jsx("div",{className:"flex-1 flex flex-col min-w-0 bg-background overflow-hidden",children:e.jsx(wt,{})})]})}export{_t as CopilotPage};
|