@kaitranntt/ccs 7.9.0-dev.1 → 7.9.0
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/dist/cliproxy/index.d.ts +0 -2
- package/dist/cliproxy/index.d.ts.map +1 -1
- package/dist/cliproxy/index.js +1 -3
- package/dist/cliproxy/index.js.map +1 -1
- package/dist/cliproxy/stats-fetcher.d.ts +0 -4
- package/dist/cliproxy/stats-fetcher.d.ts.map +1 -1
- package/dist/cliproxy/stats-fetcher.js.map +1 -1
- package/dist/ui/assets/accounts-CZms_PBW.js +1 -0
- package/dist/ui/assets/{alert-dialog-zpnBn2CA.js → alert-dialog-sKmXLtjs.js} +1 -1
- package/dist/ui/assets/api-TANgowVA.js +1 -0
- package/dist/ui/assets/auth-section-Ddg5Cdd6.js +1 -0
- package/dist/ui/assets/{card-dTUi3LxW.js → card-CfgEo_Fi.js} +1 -1
- package/dist/ui/assets/cliproxy-BpCuX751.js +3 -0
- package/dist/ui/assets/cliproxy-control-panel-Cp0Tweyl.js +1 -0
- package/dist/ui/assets/{confirm-dialog-ByfOsjk9.js → confirm-dialog-Dut98zdb.js} +1 -1
- package/dist/ui/assets/{copilot-BQscualu.js → copilot-DvOZJmtw.js} +3 -3
- package/dist/ui/assets/globalenv-section-DlnizwvB.js +1 -0
- package/dist/ui/assets/{health-DTRd-dXk.js → health-D1M4owiM.js} +1 -1
- package/dist/ui/assets/icons-CMYcel9O.js +1 -0
- package/dist/ui/assets/index-BCBypoXT.js +1 -0
- package/dist/ui/assets/index-BXkzlgVE.js +1 -0
- package/dist/ui/assets/{index-Bfwze8tN.js → index-Bdp0Hpgh.js} +1 -1
- package/dist/ui/assets/index-D-LYJymx.js +47 -0
- package/dist/ui/assets/index-DQAJ1wqP.css +1 -0
- package/dist/ui/assets/{shared-BgDSyHKz.js → shared-Dgmje0CZ.js} +1 -1
- package/dist/ui/assets/{switch-B0PXGFIv.js → switch-MkSHHW1_.js} +1 -1
- package/dist/ui/index.html +3 -3
- package/dist/web-server/routes/cliproxy-stats-routes.d.ts.map +1 -1
- package/dist/web-server/routes/cliproxy-stats-routes.js +5 -89
- package/dist/web-server/routes/cliproxy-stats-routes.js.map +1 -1
- package/package.json +1 -1
- package/dist/cliproxy/quota-fetcher.d.ts +0 -46
- package/dist/cliproxy/quota-fetcher.d.ts.map +0 -1
- package/dist/cliproxy/quota-fetcher.js +0 -406
- package/dist/cliproxy/quota-fetcher.js.map +0 -1
- package/dist/ui/assets/accounts-CmzZXhfc.js +0 -1
- package/dist/ui/assets/api-DFbZVPK4.js +0 -1
- package/dist/ui/assets/auth-section-YgJ7Cv--.js +0 -1
- package/dist/ui/assets/cliproxy-CsqKCFzj.js +0 -3
- package/dist/ui/assets/cliproxy-control-panel-BRCh_7b3.js +0 -1
- package/dist/ui/assets/globalenv-section-BEpPTvKo.js +0 -1
- package/dist/ui/assets/icons-CwFZAiDB.js +0 -1
- package/dist/ui/assets/index-BLoAjpcw.js +0 -1
- package/dist/ui/assets/index-CEZrgkam.js +0 -1
- package/dist/ui/assets/index-QeBLfRj8.js +0 -47
- package/dist/ui/assets/index-oS2cgEFl.css +0 -1
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import{j as e,W as as,X as ns,Y as is,Z as rs,_ as os}from"./radix-ui-uXQB-q0u.js";import{r as g}from"./react-vendor-B_CU-WTZ.js";import{u as De,a as _e,b as ls}from"./tanstack-Coed0rqz.js";import{a as j,c as k,P as ie,L as Y,I as re,O as Le,Q as Ee,U as Ie,V as Re,W as te,X as Fe,Y as cs,Z as Ue,u as He,_ as oe,$ as le,a0 as ce,a1 as de,a2 as Ge,a3 as ds,a4 as we,a5 as be,B as _,a6 as ms,m as $e,i as me,h as us,a7 as xs,a8 as ps,a9 as hs,T as gs,k as fs,aa as js,l as vs,ab as Ns,ac as ws,ad as W,ae as bs,af as ys,ag as Cs,ah as ks,D as As,E as Ss,F as ye,G as Ce,ai as Ps,aj as Ms,ak as Os,al as Ts,am as Ds,an as _s,ao as Ls,ap as Es,aq as Is,S as Rs}from"./index-QeBLfRj8.js";import{t as L}from"./notifications-dJQY2-U6.js";import{b as Ke,L as $,m as ue,t as Fs,j as K,l as Us,ag as xe,a0 as G,ah as z,Q as B,ai as Hs,aj as Z,Z as ee,I as Gs,f as $s,Y as pe,ak as Ks,aa as Vs,X as he,O as Ve,q as X,al as qs,a9 as qe,n as zs,am as Qs,ad as Bs,A as ke,an as Ae,ao as Se,U as Js,ap as Ws,aq as Xs,ar as ze}from"./icons-CwFZAiDB.js";import{C as Qe,a as Be}from"./card-dTUi3LxW.js";import{S as ge,C as Ys}from"./confirm-dialog-ByfOsjk9.js";import{S as Zs}from"./switch-B0PXGFIv.js";import"./utils-CzKF5WmX.js";import"./form-utils-kUVlZZAO.js";import"./code-highlight-DKN39ySy.js";import"./alert-dialog-zpnBn2CA.js";const Q={agy:{provider:"agy",displayName:"Antigravity",defaultModel:"gemini-claude-opus-4-5-thinking",models:[{id:"gemini-claude-opus-4-5-thinking",name:"Claude Opus 4.5 Thinking",description:"Most capable, extended thinking",presetMapping:{default:"gemini-claude-opus-4-5-thinking",opus:"gemini-claude-opus-4-5-thinking",sonnet:"gemini-claude-sonnet-4-5-thinking",haiku:"gemini-claude-sonnet-4-5"}},{id:"gemini-claude-sonnet-4-5-thinking",name:"Claude Sonnet 4.5 Thinking",description:"Balanced with extended thinking",presetMapping:{default:"gemini-claude-sonnet-4-5-thinking",opus:"gemini-claude-opus-4-5-thinking",sonnet:"gemini-claude-sonnet-4-5-thinking",haiku:"gemini-claude-sonnet-4-5"}},{id:"gemini-claude-sonnet-4-5",name:"Claude Sonnet 4.5",description:"Fast and capable",presetMapping:{default:"gemini-claude-sonnet-4-5",opus:"gemini-claude-opus-4-5-thinking",sonnet:"gemini-claude-sonnet-4-5",haiku:"gemini-claude-sonnet-4-5"}},{id:"gemini-3-pro-preview",name:"Gemini 3 Pro",description:"Google latest model via Antigravity",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",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",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",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",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.1-codex-max",models:[{id:"gpt-5.1-codex-max",name:"Codex Max (5.1)",description:"Most capable Codex model",presetMapping:{default:"gpt-5.1-codex-max",opus:"gpt-5.1-codex-max-high",sonnet:"gpt-5.1-codex-max",haiku:"gpt-5.1-codex-mini-high"}},{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:"qwen-coder-plus",models:[{id:"qwen-coder-plus",name:"Qwen Coder Plus",description:"Alibaba code-focused model"},{id:"qwen-max",name:"Qwen Max",description:"Most capable Qwen model"}]},iflow:{provider:"iflow",displayName:"iFlow",defaultModel:"iflow-default",models:[{id:"iflow-default",name:"iFlow Default",description:"Default iFlow 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"}]}},ae=8317;async function ne(s){const a=Q[s];if(!a)return{success:!1};const t=a.models[0],n=t?.presetMapping||{default:a.defaultModel,opus:a.defaultModel,sonnet:a.defaultModel,haiku:a.defaultModel},i={env:{ANTHROPIC_BASE_URL:`http://127.0.0.1:${ae}/api/provider/${s}`,ANTHROPIC_AUTH_TOKEN:"ccs-internal-managed",ANTHROPIC_MODEL:n.default,ANTHROPIC_DEFAULT_OPUS_MODEL:n.opus,ANTHROPIC_DEFAULT_SONNET_MODEL:n.sonnet,ANTHROPIC_DEFAULT_HAIKU_MODEL:n.haiku}};try{return{success:(await fetch(`/api/settings/${s}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({settings:i})})).ok,presetName:t?.name||a.defaultModel}}catch{return{success:!1}}}const Pe=[{id:"gemini",name:"Google Gemini",description:"Gemini Pro/Flash models"},{id:"codex",name:"OpenAI Codex",description:"GPT-4 and codex models"},{id:"agy",name:"Antigravity",description:"Antigravity AI models"},{id:"qwen",name:"Alibaba Qwen",description:"Qwen Code models"},{id:"iflow",name:"iFlow",description:"iFlow AI models"},{id:"kiro",name:"Kiro (AWS)",description:"AWS CodeWhisperer models"},{id:"ghcp",name:"GitHub Copilot (OAuth)",description:"GitHub Copilot via OAuth"}],Je=["provider","auth","variant","success"];function et(s){return s==="account"?1:Je.indexOf(s)}function st({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 tt({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(Ke,{className:"w-4 h-4 text-muted-foreground"})]},t.id))})}function at({selectedProvider:s,providers:a,authCommand:t,isRefreshing:n,isPending:i,onBack:c,onStartAuth:l,onRefresh:d}){const[r,m]=g.useState(!1),u=async x=>{await navigator.clipboard.writeText(x),m(!0),setTimeout(()=>m(!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(x=>x.id===s)?.name," to add an account"]}),e.jsx(j,{onClick:l,disabled:i,className:"w-full gap-2",size:"lg",children:i?e.jsxs(e.Fragment,{children:[e.jsx($,{className:"w-4 h-4 animate-spin"}),"Authenticating..."]}):e.jsxs(e.Fragment,{children:[e.jsx(ue,{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(Qe,{children:e.jsxs(Be,{className:"p-4 space-y-3",children:[e.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[e.jsx(Fs,{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(j,{variant:"outline",size:"icon",onClick:()=>u(t),children:r?e.jsx(K,{className:"w-4 h-4 text-green-500"}):e.jsx(Us,{className:"w-4 h-4"})})]})]})}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs(j,{variant:"ghost",onClick:c,disabled:i,children:[e.jsx(xe,{className:"w-4 h-4 mr-2"}),"Back"]}),e.jsxs(j,{variant:"outline",onClick:d,disabled:n||i,children:[e.jsx(G,{className:`w-4 h-4 mr-2 ${n?"animate-spin":""}`}),n?"Checking...":"Refresh Status"]})]})]})}function nt({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",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(z,{className:"w-4 h-4 text-muted-foreground"})}),e.jsxs("div",{children:[e.jsx("div",{className:k("font-medium",a&&ie),children:c.email||c.id}),c.isDefault&&e.jsx("div",{className:"text-xs text-muted-foreground",children:"Default account"})]})]}),e.jsx(Ke,{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(ue,{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(j,{variant:"ghost",onClick:i,children:[e.jsx(xe,{className:"w-4 h-4 mr-2"}),"Back"]})})]})}function it({selectedProvider:s,selectedAccount:a,variantName:t,modelName:n,isPending:i,privacyMode:c,onVariantNameChange:l,onModelChange:d,onBack:r,onSkip:m,onCreate:u}){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(z,{className:"w-4 h-4"}),e.jsxs("span",{children:["Using:"," ",e.jsx("span",{className:k(c&&ie),children:a.email||a.id})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(Y,{htmlFor:"variant-name",children:"Variant Name *"}),e.jsx(re,{id:"variant-name",value:t,onChange:x=>l(x.target.value),placeholder:"e.g., my-gemini, g3, flash"}),e.jsxs("div",{className:"text-xs text-muted-foreground",children:["Use this name to invoke: ccs ",t||"<name>",' "prompt"']})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(Y,{children:"Model"}),e.jsxs(Le,{value:n,onValueChange:d,children:[e.jsx(Ee,{children:e.jsx(Ie,{placeholder:"Select a model"})}),e.jsx(Re,{children:Q[s]?.models.map(x=>e.jsx(te,{value:x.id,children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{children:x.name}),x.description&&e.jsxs("span",{className:"text-xs text-muted-foreground",children:["- ",x.description]})]})},x.id))})]}),e.jsxs("div",{className:"text-xs text-muted-foreground",children:["Default: ",Q[s]?.defaultModel||"provider default"]})]}),e.jsxs("div",{className:"flex items-center justify-between pt-2",children:[e.jsxs(j,{variant:"ghost",onClick:r,children:[e.jsx(xe,{className:"w-4 h-4 mr-2"}),"Back"]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(j,{variant:"ghost",onClick:m,children:"Skip"}),e.jsx(j,{onClick:u,disabled:!t||i,children:i?"Creating...":"Create Variant"})]})]}),e.jsx("p",{className:"text-xs text-center text-muted-foreground",children:"Skip if you just wanted to add an account without creating a variant"})]})}function rt({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(K,{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(Qe,{children:e.jsxs(Be,{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(j,{onClick:a,className:"w-full",children:"Done"})]})}function ot({open:s,onClose:a}){const[t,n]=g.useState("provider"),[i,c]=g.useState(""),[l,d]=g.useState(null),[r,m]=g.useState(""),[u,x]=g.useState(""),[f,o]=g.useState(!1),[h,A]=g.useState(!1),{data:y,refetch:O}=Fe(),P=cs(),M=Ue(),{privacyMode:b}=He(),v=y?.authStatus.find(w=>w.provider===i),C=g.useMemo(()=>v?.accounts||[],[v?.accounts]);g.useEffect(()=>{if(!s){const w=setTimeout(()=>{n("provider"),c(""),d(null),m(""),x(""),A(!1)},0);return()=>clearTimeout(w)}},[s]),g.useEffect(()=>{if(t==="auth"&&C.length>0&&!h){const w=setTimeout(()=>{n("account")},0);return()=>clearTimeout(w)}},[t,C,h]);const N=async()=>{o(!0),await O(),o(!1)},S=()=>{const w=(v?.accounts?.length||0)===0;M.mutate({provider:i},{onSuccess:async q=>{if(w){const U=await ne(i);U.success&&U.presetName?L.success(`Applied "${U.presetName}" preset`):U.success||L.warning("Account added, but failed to apply default preset")}q.account&&(d(q.account),n("variant")),O()}})},T=w=>{c(w),(y?.authStatus.find(se=>se.provider===w)?.accounts||[]).length===0?n("auth"):n("account")},p=w=>{d(w),n("variant")},I=async()=>{if(!(!r||!i))try{await P.mutateAsync({name:r,provider:i,model:u||void 0,account:l?.id}),n("success")}catch(w){console.error("Failed to create variant:",w)}},R=`ccs ${i} --auth --add`,E=et(t),V=w=>{if(!w&&(t==="success"||t==="provider")){a();return}};return e.jsx(oe,{open:s,onOpenChange:V,children:e.jsxs(le,{className:"sm:max-w-lg",onPointerDownOutside:w=>{t!=="success"&&t!=="provider"&&w.preventDefault()},onEscapeKeyDown:w=>{(M.isPending||P.isPending)&&w.preventDefault()},children:[e.jsxs(ce,{children:[e.jsxs(de,{className:"flex items-center gap-2",children:[e.jsx(B,{className:"w-5 h-5 text-primary"}),"Quick Setup Wizard"]}),e.jsxs(Ge,{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(tt,{providers:Pe,onSelect:T}),t==="auth"&&e.jsx(at,{selectedProvider:i,providers:Pe,authCommand:R,isRefreshing:f,isPending:M.isPending,onBack:()=>n("provider"),onStartAuth:S,onRefresh:N}),t==="account"&&e.jsx(nt,{accounts:C,privacyMode:b,onSelect:p,onAddNew:()=>{A(!0),n("auth")},onBack:()=>n("provider")}),t==="variant"&&e.jsx(it,{selectedProvider:i,selectedAccount:l,variantName:r,modelName:u,isPending:P.isPending,privacyMode:b,onVariantNameChange:m,onModelChange:x,onBack:()=>C.length>0?n("account"):n("provider"),onSkip:a,onCreate:I}),t==="success"&&e.jsx(rt,{variantName:r,onClose:a})]}),e.jsx(st,{currentProgress:E,allSteps:Je})]})})}function lt({open:s,onClose:a,provider:t,displayName:n,isFirstAccount:i=!1}){const[c,l]=g.useState(""),d=Ue(),r=ds(),m=t==="kiro",u=d.isPending||r.isPending,x=()=>{d.mutate({provider:t,nickname:c.trim()||void 0},{onSuccess:async()=>{if(i){const h=await ne(t);h.success&&h.presetName?L.success(`Applied "${h.presetName}" preset`):h.success||L.warning("Account added, but failed to apply default preset")}l(""),a()}})},f=()=>{r.mutate(void 0,{onSuccess:async()=>{if(i){const h=await ne("kiro");h.success&&h.presetName&&L.success(`Applied "${h.presetName}" preset`)}l(""),a()}})},o=h=>{!h&&!u&&(l(""),a())};return e.jsx(oe,{open:s,onOpenChange:o,children:e.jsxs(le,{className:"sm:max-w-md",children:[e.jsxs(ce,{children:[e.jsxs(de,{children:["Add ",n," Account"]}),e.jsx(Ge,{children:m?"Authenticate via browser or import an existing token from Kiro IDE.":"Click the button below to authenticate a new account. A browser window will open for OAuth."})]}),e.jsxs("div",{className:"space-y-4 py-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(Y,{htmlFor:"nickname",children:"Nickname (optional)"}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(z,{className:"w-4 h-4 text-muted-foreground"}),e.jsx(re,{id:"nickname",value:c,onChange:h=>l(h.target.value),placeholder:"e.g., work, personal",disabled:u,className:"flex-1"})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"A friendly name to identify this account. Auto-generated from email if left empty."})]}),e.jsxs("div",{className:"flex items-center justify-end gap-2 pt-2",children:[e.jsx(j,{variant:"ghost",onClick:a,disabled:u,children:"Cancel"}),m&&e.jsx(j,{variant:"outline",onClick:f,disabled:u,children:r.isPending?e.jsxs(e.Fragment,{children:[e.jsx($,{className:"w-4 h-4 mr-2 animate-spin"}),"Importing..."]}):e.jsxs(e.Fragment,{children:[e.jsx(Hs,{className:"w-4 h-4 mr-2"}),"Import from IDE"]})}),e.jsx(j,{onClick:x,disabled:u,children:d.isPending?e.jsxs(e.Fragment,{children:[e.jsx($,{className:"w-4 h-4 mr-2 animate-spin"}),"Authenticating..."]}):e.jsxs(e.Fragment,{children:[e.jsx(ue,{className:"w-4 h-4 mr-2"}),"Authenticate"]})})]}),d.isPending&&e.jsx("p",{className:"text-sm text-center text-muted-foreground",children:"Complete the OAuth flow in your browser..."}),r.isPending&&e.jsx("p",{className:"text-sm text-center text-muted-foreground",children:"Importing token from Kiro IDE..."})]})]})})}function ct(s){const[a,t]=g.useState(null),[n,i]=g.useState(!1),c=De(),{data:l,isLoading:d,refetch:r}=_e({queryKey:["settings",s],queryFn:async()=>{const N=await fetch(`/api/settings/${s}/raw`);return N.ok?N.json():{profile:s,settings:{env:{}},mtime:Date.now(),path:`~/.ccs/profiles/${s}/settings.json`}}}),m=l?.settings,u=g.useMemo(()=>a!==null?a:m?JSON.stringify(m,null,2):`{
|
|
2
|
-
"env": {}
|
|
3
|
-
}`,[a,m]),x=g.useCallback(N=>{t(N)},[]),f=g.useMemo(()=>{try{return JSON.parse(u)}catch{return m||{env:{}}}},[u,m]),o=f?.env?.ANTHROPIC_MODEL,h=f?.env?.ANTHROPIC_DEFAULT_OPUS_MODEL,A=f?.env?.ANTHROPIC_DEFAULT_SONNET_MODEL,y=f?.env?.ANTHROPIC_DEFAULT_HAIKU_MODEL,O=g.useCallback((N,S)=>{const T={...f?.env||{},[N]:S},p={...f,env:T};t(JSON.stringify(p,null,2))},[f]),P=g.useCallback(N=>{const S={...f?.env||{},...N},T={...f,env:S};t(JSON.stringify(T,null,2))},[f]),M=g.useMemo(()=>{try{return JSON.parse(u),!0}catch{return!1}},[u]),b=g.useMemo(()=>a===null?!1:a!==JSON.stringify(m,null,2),[a,m]),v=ls({mutationFn:async()=>{const N=JSON.parse(u),S=await fetch(`/api/settings/${s}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({settings:N,expectedMtime:l?.mtime})});if(S.status===409)throw new Error("CONFLICT");if(!S.ok)throw new Error("Failed to save");return S.json()},onSuccess:()=>{c.invalidateQueries({queryKey:["settings",s]}),t(null),L.success("Settings saved")},onError:N=>{N.message==="CONFLICT"?i(!0):L.error(N.message)}}),C=async N=>{i(!1),N?(await r(),v.mutate()):t(null)};return{data:l,isLoading:d,refetch:r,rawJsonContent:u,rawJsonEdits:a,isRawJsonValid:M,hasChanges:b,currentSettings:f,currentModel:o,opusModel:h,sonnetModel:A,haikuModel:y,handleRawJsonChange:x,updateEnvValue:O,updateEnvValues:P,saveMutation:{mutate:()=>v.mutate(),isPending:v.isPending},conflictDialog:n,setConflictDialog:i,handleConflictResolve:C}}function F({label:s,description:a,value:t,onChange:n,catalog:i,allModels:c,disabled:l}){const d=new Set(i?.models.map(r=>r.id)||[]);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(Le,{value:t||"",onValueChange:n,disabled:l,children:[e.jsx(Ee,{className:"h-9",children:e.jsx(Ie,{placeholder:"Select model",children:t&&e.jsx("span",{className:"truncate font-mono text-xs",children:t})})}),e.jsxs(Re,{className:"max-h-[300px]",children:[i&&i.models.length>0&&e.jsxs(we,{children:[e.jsx(be,{className:"text-xs text-primary",children:"Recommended"}),i.models.map(r=>e.jsx(te,{value:r.id,children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"truncate font-mono text-xs",children:r.id}),r.tier==="paid"&&e.jsx(_,{variant:"outline",className:"text-[9px] h-4 px-1",children:"PAID"}),t===r.id&&e.jsx(K,{className:"w-3 h-3 text-primary ml-auto"})]})},r.id))]}),c.length>0&&e.jsxs(we,{children:[e.jsxs(be,{className:"text-xs text-muted-foreground",children:["All Models (",c.length,")"]}),c.filter(r=>!d.has(r.id)).map(r=>e.jsx(te,{value:r.id,children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"truncate font-mono text-xs",children:r.id}),t===r.id&&e.jsx(K,{className:"w-3 h-3 text-primary ml-auto"})]})},r.id))]}),(!i||i.models.length===0)&&c.length===0&&e.jsx("div",{className:"py-2 px-3 text-xs text-muted-foreground",children:"No models available"})]})]})]})}function dt({open:s,onClose:a,currentValues:t,onApply:n,onSave:i,isSaving:c,catalog:l,allModels:d}){const[r,m]=g.useState(t),[u,x]=g.useState(""),f=o=>{o?(m(t),x("")):a()};return e.jsx(oe,{open:s,onOpenChange:f,children:e.jsxs(le,{className:"sm:max-w-md",children:[e.jsx(ce,{children:e.jsxs(de,{className:"flex items-center gap-2",children:[e.jsx(B,{className:"w-4 h-4"}),"Custom Preset"]})}),e.jsxs("div",{className:"space-y-4 py-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(Y,{htmlFor:"preset-name",children:"Preset Name (optional)"}),e.jsx(re,{id:"preset-name",value:u,onChange:o=>x(o.target.value),placeholder:"e.g., My Custom Config",className:"text-sm"})]}),e.jsx(ge,{}),e.jsx(F,{label:"Default Model",description:"Used when no specific tier is requested",value:r.default,onChange:o=>m({...r,default:o}),catalog:l,allModels:d}),e.jsx(F,{label:"Opus (Most capable)",description:"For complex reasoning tasks",value:r.opus,onChange:o=>m({...r,opus:o}),catalog:l,allModels:d}),e.jsx(F,{label:"Sonnet (Balanced)",description:"Balance of speed and capability",value:r.sonnet,onChange:o=>m({...r,sonnet:o}),catalog:l,allModels:d}),e.jsx(F,{label:"Haiku (Fast)",description:"Quick responses for simple tasks",value:r.haiku,onChange:o=>m({...r,haiku:o}),catalog:l,allModels:d})]}),e.jsxs(ms,{className:"gap-2 sm:gap-0",children:[e.jsx(j,{variant:"outline",onClick:a,children:"Cancel"}),i&&e.jsxs(j,{variant:"secondary",onClick:()=>i(r,u||void 0),disabled:c||!u.trim(),children:[c?e.jsx($,{className:"w-4 h-4 mr-1 animate-spin"}):e.jsx(Z,{className:"w-4 h-4 mr-1"}),"Save Preset"]}),e.jsxs(j,{onClick:()=>n(r,u||void 0),children:[e.jsx(ee,{className:"w-4 h-4 mr-1"}),"Apply Preset"]})]})]})})}function J({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($e,{value:a,size:"icon",className:"h-6 w-6"})]})]})}function mt({provider:s,displayName:a,data:t,authStatus:n}){return e.jsx(me,{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(Gs,{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})]}),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($e,{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:"Last Modified"}),e.jsx("span",{className:"text-xs",children:new Date(t.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"}),n.authenticated?e.jsxs(_,{variant:"outline",className:"w-fit text-green-600 border-green-200 bg-green-50",children:[e.jsx($s,{className:"w-3 h-3 mr-1"}),"Authenticated"]}):e.jsx(_,{variant:"outline",className:"w-fit text-muted-foreground",children:"Not connected"})]})]})]}),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(J,{label:"Run with prompt",command:`ccs ${s} "your prompt"`}),e.jsx(J,{label:"Change model",command:`ccs ${s} --config`}),e.jsx(J,{label:"Add account",command:`ccs ${s} --add`}),e.jsx(J,{label:"List accounts",command:`ccs ${s} --accounts`})]})]})]})})}const ut={gemini:"/assets/providers/gemini-color.svg",codex:"/assets/providers/openai.svg",agy:"/assets/providers/agy.png",qwen:"/assets/providers/qwen-color.svg",iflow:"/assets/providers/iflow.png",kiro:"/assets/providers/kiro.png",ghcp:"/assets/providers/copilot.svg"},xt={gemini:{text:"text-blue-600",letter:"G"},claude:{text:"text-orange-600",letter:"C"},codex:{text:"text-emerald-600",letter:"X"},agy:{text:"text-violet-600",letter:"A"},qwen:{text:"text-cyan-600",letter:"Q"},iflow:{text:"text-indigo-600",letter:"i"},kiro:{text:"text-teal-600",letter:"K"},ghcp:{text:"text-green-600",letter:"C"}},pt={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 fe({provider:s,className:a,size:t="md"}){const n=s.toLowerCase(),i=xt[n]||{text:"text-gray-600",letter:s[0]?.toUpperCase()||"?"},c=pt[t],l=ut[n];return e.jsx("div",{className:k("flex items-center justify-center rounded-md",l&&"bg-white p-1",c.container,a),children:l?e.jsx("img",{src:l,alt:`${s} logo`,className:k(c.icon,"object-contain")}):e.jsx("span",{className:k("font-semibold",i.text,c.text),children:i.letter})})}function ht({displayName:s,logoProvider:a,provider:t,data:n,isLoading:i,hasChanges:c,isRawJsonValid:l,isSaving:d,isRemoteMode:r,port:m,onRefetch:u,onSave:x}){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(fe,{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}),r&&e.jsxs(_,{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(pe,{className:"w-3 h-3"}),"Remote"]}),m&&e.jsxs(_,{variant:"outline",className:"text-xs gap-1 font-mono",children:[e.jsx(Ks,{className:"w-3 h-3"}),":",m]}),!r&&n?.path&&e.jsx(_,{variant:"outline",className:"text-xs",children:n.path.replace(/^.*[\\/]/,"")})]}),r?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(j,{variant:"ghost",size:"sm",onClick:u,disabled:i,children:e.jsx(G,{className:`w-4 h-4 ${i?"animate-spin":""}`})}),e.jsx(j,{size:"sm",onClick:x,disabled:d||!c||!l,children:d?e.jsxs(e.Fragment,{children:[e.jsx($,{className:"w-4 h-4 mr-1 animate-spin"}),"Saving..."]}):e.jsxs(e.Fragment,{children:[e.jsx(Vs,{className:"w-4 h-4 mr-1"}),"Save"]})})]})]})}function gt({catalog:s,savedPresets:a,currentModel:t,opusModel:n,sonnetModel:i,haikuModel:c,providerModels:l,onApplyPreset:d,onUpdateEnvValue:r,onOpenCustomPreset:m,onDeletePreset:u,isDeletePending:x}){const f=s&&s.models.length>0||a.length>0;return e.jsxs(e.Fragment,{children:[f&&e.jsxs("div",{children:[e.jsxs("h3",{className:"text-sm font-medium mb-2 flex items-center gap-2",children:[e.jsx(B,{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(o=>e.jsxs(j,{variant:"outline",size:"sm",className:"text-xs h-7 gap-1",onClick:()=>{const h=o.presetMapping||{default:o.id,opus:o.id,sonnet:o.id,haiku:o.id};d({ANTHROPIC_MODEL:h.default,ANTHROPIC_DEFAULT_OPUS_MODEL:h.opus,ANTHROPIC_DEFAULT_SONNET_MODEL:h.sonnet,ANTHROPIC_DEFAULT_HAIKU_MODEL:h.haiku})},children:[e.jsx(ee,{className:"w-3 h-3"}),o.name]},o.id)),a.map(o=>e.jsxs("div",{className:"group relative",children:[e.jsxs(j,{variant:"secondary",size:"sm",className:"text-xs h-7 gap-1 pr-6",onClick:()=>{d({ANTHROPIC_MODEL:o.default,ANTHROPIC_DEFAULT_OPUS_MODEL:o.opus,ANTHROPIC_DEFAULT_SONNET_MODEL:o.sonnet,ANTHROPIC_DEFAULT_HAIKU_MODEL:o.haiku})},children:[e.jsx(Z,{className:"w-3 h-3 fill-current"}),o.name]}),e.jsx(j,{variant:"ghost",size:"icon",className:"absolute right-0 top-0 h-7 w-5 opacity-0 group-hover:opacity-100 hover:text-destructive",onClick:h=>{h.stopPropagation(),u(o.name)},disabled:x,children:e.jsx(he,{className:"w-3 h-3"})})]},o.name)),e.jsxs(j,{variant:"outline",size:"sm",className:"text-xs h-7 gap-1 border-primary/50 text-primary hover:bg-primary/10 hover:border-primary",onClick:m,children:[e.jsx(Ve,{className:"w-3 h-3"}),"Custom"]})]})]}),e.jsx(ge,{}),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:"space-y-4",children:[e.jsx(F,{label:"Default Model",description:"Used when no specific tier is requested",value:t,onChange:o=>r("ANTHROPIC_MODEL",o),catalog:s,allModels:l}),e.jsx(F,{label:"Opus (Most capable)",description:"For complex reasoning tasks",value:n,onChange:o=>r("ANTHROPIC_DEFAULT_OPUS_MODEL",o),catalog:s,allModels:l}),e.jsx(F,{label:"Sonnet (Balanced)",description:"Balance of speed and capability",value:i,onChange:o=>r("ANTHROPIC_DEFAULT_SONNET_MODEL",o),catalog:s,allModels:l}),e.jsx(F,{label:"Haiku (Fast)",description:"Quick responses for simple tasks",value:c,onChange:o=>r("ANTHROPIC_DEFAULT_HAIKU_MODEL",o),catalog:s,allModels:l})]})]})]})}function ft({...s}){return e.jsx(as,{"data-slot":"dropdown-menu",...s})}function jt({...s}){return e.jsx(ns,{"data-slot":"dropdown-menu-trigger",...s})}function vt({className:s,sideOffset:a=4,...t}){return e.jsx(is,{children:e.jsx(rs,{"data-slot":"dropdown-menu-content",sideOffset:a,className:k("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 max-h-(--radix-dropdown-menu-content-available-height) min-w-[8rem] origin-(--radix-dropdown-menu-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border p-1 shadow-md bg-white dark:bg-zinc-950",s),...t})})}function Me({className:s,inset:a,variant:t="default",...n}){return e.jsx(os,{"data-slot":"dropdown-menu-item","data-inset":a,"data-variant":t,className:k("focus:bg-accent focus:text-accent-foreground data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 dark:data-[variant=destructive]:focus:bg-destructive/20 data-[variant=destructive]:focus:text-destructive data-[variant=destructive]:*:[svg]:!text-destructive [&_svg:not([class*='text-'])]:text-muted-foreground focus:[&_svg:not([class*='text-'])]:text-current relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 data-[inset]:pl-8 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",s),...n})}function Nt(s){return s<=20?"bg-destructive":s<=50?"bg-yellow-500":"bg-green-500"}function Oe(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)),l=Math.floor(n/(1e3*60*60*24));return l>0?`${l}d ago`:c>0?`${c}h ago`:i>0?`${i}m ago`:"just now"}catch{return""}}function wt(s){if(!s)return!1;try{const a=new Date(s);return new Date().getTime()-a.getTime()<3600*1e3}catch{return!1}}function bt({account:s,onSetDefault:a,onRemove:t,isRemoving:n,privacyMode:i,showQuota:c}){const{data:l}=us(c&&s.provider==="agy"),{data:d,isLoading:r}=xs(s.provider,s.id,c&&s.provider==="agy"),m=l?.accountStats?.[s.email||s.id]?.lastUsedAt,u=wt(m),x=d?.success&&d.models.length>0?Math.round(d.models.reduce((o,h)=>o+h.percentage,0)/d.models.length):null,f=d?.success&&d.models.length>0?ps(d.models):null;return e.jsxs("div",{className:k("flex flex-col gap-2 p-3 rounded-lg border transition-colors",s.isDefault?"border-primary/30 bg-primary/5":"border-border hover:bg-muted/30"),children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:k("flex items-center justify-center w-8 h-8 rounded-full",s.isDefault?"bg-primary/10":"bg-muted"),children:e.jsx(z,{className:"w-4 h-4"})}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:k("font-medium text-sm",i&&ie),children:s.email||s.id}),s.isDefault&&e.jsxs(_,{variant:"secondary",className:"text-[10px] h-4 px-1.5 gap-0.5",children:[e.jsx(Z,{className:"w-2.5 h-2.5 fill-current"}),"Default"]})]}),s.lastUsedAt&&e.jsxs("div",{className:"flex items-center gap-1 text-xs text-muted-foreground mt-0.5",children:[e.jsx(X,{className:"w-3 h-3"}),"Last used: ",new Date(s.lastUsedAt).toLocaleDateString()]})]})]}),e.jsxs(ft,{children:[e.jsx(jt,{asChild:!0,children:e.jsx(j,{variant:"ghost",size:"icon",className:"h-7 w-7",children:e.jsx(qs,{className:"w-4 h-4"})})}),e.jsxs(vt,{align:"end",children:[!s.isDefault&&e.jsxs(Me,{onClick:a,children:[e.jsx(Z,{className:"w-4 h-4 mr-2"}),"Set as default"]}),e.jsxs(Me,{className:"text-destructive focus:text-destructive",onClick:t,disabled:n,children:[e.jsx(qe,{className:"w-4 h-4 mr-2"}),n?"Removing...":"Remove account"]})]})]})]}),c&&s.provider==="agy"&&e.jsx("div",{className:"pl-11",children:r?e.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[e.jsx($,{className:"w-3 h-3 animate-spin"}),e.jsx("span",{children:"Loading quota..."})]}):x!==null?e.jsxs("div",{className:"space-y-1.5",children:[e.jsx("div",{className:"flex items-center gap-1.5 text-xs",children:u?e.jsxs(e.Fragment,{children:[e.jsx(zs,{className:"w-3 h-3 text-emerald-500"}),e.jsxs("span",{className:"text-emerald-600 dark:text-emerald-400",children:["Active · ",Oe(m)]})]}):m?e.jsxs(e.Fragment,{children:[e.jsx(X,{className:"w-3 h-3 text-muted-foreground"}),e.jsxs("span",{className:"text-muted-foreground",children:["Last used ",Oe(m)]})]}):e.jsxs(e.Fragment,{children:[e.jsx(Qs,{className:"w-3 h-3 text-muted-foreground"}),e.jsx("span",{className:"text-muted-foreground",children:"Not used yet"})]})}),e.jsx(hs,{children:e.jsxs(gs,{children:[e.jsx(fs,{asChild:!0,children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(js,{value:x,className:"h-2 flex-1",indicatorClassName:Nt(x)}),e.jsxs("span",{className:"text-xs font-medium w-10 text-right",children:[x,"%"]})]})}),e.jsx(vs,{side:"bottom",className:"max-w-xs",children:e.jsxs("div",{className:"text-xs space-y-1",children:[e.jsx("p",{className:"font-medium",children:"Model Quotas:"}),Ns(d?.models||[]).map(o=>e.jsxs("div",{className:"flex justify-between gap-4",children:[e.jsx("span",{className:"truncate",children:o.displayName||o.name}),e.jsxs("span",{className:"font-mono",children:[o.percentage,"%"]})]},o.name)),f&&e.jsxs("div",{className:"flex items-center gap-1.5 mt-2 pt-2 border-t border-border/50",children:[e.jsx(X,{className:"w-3 h-3 text-blue-400"}),e.jsxs("span",{className:"text-blue-400 font-medium",children:["Resets ",ws(f)]})]})]})})]})})]}):d?.error?e.jsx("div",{className:"text-xs text-muted-foreground",children:d.error}):null})]})}function yt({accounts:s,onAddAccount:a,onSetDefault:t,onRemoveAccount:n,isRemovingAccount:i,privacyMode:c,showQuota:l,isKiro:d,kiroNoIncognito:r,onKiroNoIncognitoChange:m,kiroSettingsLoading:u}){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:[e.jsx(z,{className:"w-4 h-4"}),"Accounts",s.length>0&&e.jsx(_,{variant:"secondary",className:"text-xs",children:s.length})]}),e.jsxs(j,{variant:"default",size:"sm",className:"h-7 text-xs gap-1",onClick:a,children:[e.jsx(Ve,{className:"w-3 h-3"}),"Add"]})]}),s.length>0?e.jsx("div",{className:"space-y-2",children:s.map(x=>e.jsx(bt,{account:x,onSetDefault:()=>t(x.id),onRemove:()=>n(x.id),isRemoving:i,privacyMode:c,showQuota:l},x.id))}):e.jsxs("div",{className:"py-6 text-center text-muted-foreground bg-muted/30 rounded-lg border border-dashed",children:[e.jsx(z,{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"})]}),d&&m&&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(pe,{className:"w-3.5 h-3.5"}),e.jsx("span",{children:"Use incognito"})]}),e.jsx(Zs,{checked:!r,onCheckedChange:x=>m(!x),disabled:u,className:"scale-90"})]})})]})}function Ct({provider:s,catalog:a,savedPresets:t,currentModel:n,opusModel:i,sonnetModel:c,haikuModel:l,providerModels:d,onApplyPreset:r,onUpdateEnvValue:m,onOpenCustomPreset:u,onDeletePreset:x,isDeletePending:f,accounts:o,onAddAccount:h,onSetDefault:A,onRemoveAccount:y,isRemovingAccount:O,privacyMode:P}){const M=s==="kiro",[b,v]=g.useState(!0),[C,N]=g.useState(!0),[S,T]=g.useState(!1),p=g.useCallback(async()=>{if(M)try{N(!0);const E=(await W.config.get()).cliproxy;v(E?.kiro_no_incognito??!0)}catch{v(!0)}finally{N(!1)}},[M]),I=g.useCallback(async R=>{v(R),T(!0);try{const E=await W.config.get(),V=E.cliproxy??{};await W.config.update({...E,cliproxy:{...V,kiro_no_incognito:R}})}catch{v(!R)}finally{T(!1)}},[]);return g.useEffect(()=>{p()},[p]),e.jsx(me,{className:"flex-1",children:e.jsxs("div",{className:"p-4 space-y-6",children:[e.jsx(gt,{catalog:a,savedPresets:t,currentModel:n,opusModel:i,sonnetModel:c,haikuModel:l,providerModels:d,onApplyPreset:r,onUpdateEnvValue:m,onOpenCustomPreset:u,onDeletePreset:x,isDeletePending:f}),e.jsx(ge,{}),e.jsx(yt,{accounts:o,onAddAccount:h,onSetDefault:A,onRemoveAccount:y,isRemovingAccount:O,privacyMode:P,showQuota:s==="agy",isKiro:M,kiroNoIncognito:b,onKiroNoIncognitoChange:I,kiroSettingsLoading:C||S})]})})}function Te({provider:s,displayName:a,authStatus:t,catalog:n,logoProvider:i,baseProvider:c,isRemoteMode:l,port:d,onAddAccount:r,onSetDefault:m,onRemoveAccount:u,isRemovingAccount:x}){const[f,o]=g.useState(!1),{privacyMode:h}=He(),{data:A}=bs(),{data:y}=ys(s),O=Cs(),P=ks(),M=y?.presets||[],b=c||s,v=g.useMemo(()=>{if(!A?.models)return[];const H={gemini:["google"],agy:["antigravity"],codex:["openai"],qwen:["alibaba","qwen"],iflow:["iflow"],kiro:["kiro","aws"],ghcp:["github","copilot"]}[b.toLowerCase()]||[b.toLowerCase()];return A.models.filter(ss=>H.some(ts=>ss.owned_by.toLowerCase().includes(ts)))},[A,b]),{data:C,isLoading:N,refetch:S,rawJsonContent:T,rawJsonEdits:p,isRawJsonValid:I,hasChanges:R,currentModel:E,opusModel:V,sonnetModel:w,haikuModel:q,handleRawJsonChange:U,updateEnvValue:se,updateEnvValues:je,saveMutation:ve,conflictDialog:We,handleConflictResolve:Ne}=ct(s),Xe=t.accounts||[],Ye=D=>{je({ANTHROPIC_BASE_URL:`http://127.0.0.1:${ae}/api/provider/${s}`,ANTHROPIC_AUTH_TOKEN:"ccs-internal-managed",...D}),L.success(`Applied "${D.ANTHROPIC_MODEL?.split("/").pop()||"preset"}" preset`)},Ze=(D,H)=>{je({ANTHROPIC_BASE_URL:`http://127.0.0.1:${ae}/api/provider/${s}`,ANTHROPIC_AUTH_TOKEN:"ccs-internal-managed",ANTHROPIC_MODEL:D.default,ANTHROPIC_DEFAULT_OPUS_MODEL:D.opus,ANTHROPIC_DEFAULT_SONNET_MODEL:D.sonnet,ANTHROPIC_DEFAULT_HAIKU_MODEL:D.haiku}),L.success(`Applied ${H?`"${H}"`:"custom"} preset`),o(!1)},es=(D,H)=>{if(!H){L.error("Please enter a preset name to save");return}O.mutate({profile:s,data:{name:H,...D}}),o(!1)};return e.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[e.jsx(ht,{provider:s,displayName:a,logoProvider:i,data:C,isLoading:N,hasChanges:R,isRawJsonValid:I,isSaving:ve.isPending,isRemoteMode:l,port:d,onRefetch:S,onSave:()=>ve.mutate()}),N?e.jsxs("div",{className:"flex-1 flex items-center justify-center",children:[e.jsx($,{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(As,{defaultValue:"config",className:"h-full flex flex-col",children:[e.jsx("div",{className:"px-4 pt-4 shrink-0",children:e.jsxs(Ss,{className:"w-full",children:[e.jsx(ye,{value:"config",className:"flex-1",children:"Model Config"}),e.jsx(ye,{value:"info",className:"flex-1",children:"Info & Usage"})]})}),e.jsxs("div",{className:"flex-1 overflow-hidden flex flex-col",children:[e.jsx(Ce,{value:"config",className:"flex-1 mt-0 border-0 p-0 data-[state=inactive]:hidden flex flex-col overflow-hidden",children:e.jsx(Ct,{provider:s,catalog:n,savedPresets:M,currentModel:E,opusModel:V,sonnetModel:w,haikuModel:q,providerModels:v,onApplyPreset:Ye,onUpdateEnvValue:se,onOpenCustomPreset:()=>o(!0),onDeletePreset:D=>P.mutate({profile:s,name:D}),isDeletePending:P.isPending,accounts:Xe,onAddAccount:r,onSetDefault:m,onRemoveAccount:u,isRemovingAccount:x,privacyMode:h})}),e.jsx(Ce,{value:"info",className:"h-full mt-0 border-0 p-0 data-[state=inactive]:hidden",children:e.jsx(mt,{provider:s,displayName:a,data:C,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(Bs,{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(Ps,{rawJsonContent:T,isRawJsonValid:I,rawJsonEdits:p,onRawJsonChange:U,profileEnv:C?.settings?.env})]})]}),e.jsx(Ys,{open:We,title:"File Modified Externally",description:"This settings file was modified by another process. Overwrite with your changes or discard?",confirmText:"Overwrite",variant:"destructive",onConfirm:()=>Ne(!0),onCancel:()=>Ne(!1)}),e.jsx(dt,{open:f,onClose:()=>o(!1),currentValues:{default:E||"",opus:V||"",sonnet:w||"",haiku:q||""},onApply:Ze,onSave:es,isSaving:O.isPending,catalog:n,allModels:v})]})}function kt(s){if(!s)return"";const a=new Date(s).getTime(),n=Date.now()-a,i=Math.floor(n/(1e3*60*60)),c=Math.floor(n%(1e3*60*60)/(1e3*60));return i>0?`${i}h ${c}m`:`${c}m`}function At(s){if(!s)return"";const a=Date.now()-s,t=Math.floor(a/(1e3*60)),n=Math.floor(a/(1e3*60*60));return t<1?"just now":t<60?`${t}m ago`:`${n}h ago`}function St(){const{data:s,isLoading:a}=Ms(),{data:t}=Os(),n=Ts(),i=Ds(),{data:c}=_e({queryKey:["cliproxy-server-config"],queryFn:()=>W.cliproxyServer.get(),staleTime:3e4}),l=c?.remote,d=l?.enabled&&l?.host,r=s?.running??!1,m=n.isPending||i.isPending,u=t?.hasUpdate??!1,x=d?(()=>{const o=l.protocol||"http",h=l.port||(o==="https"?443:80);return o==="https"&&h===443||o==="http"&&h===80?l.host:`${l.host}:${h}`})():null,f=async()=>{await i.mutateAsync(),await new Promise(o=>setTimeout(o,500)),n.mutate()};return d?e.jsxs("div",{className:k("rounded-lg border p-3 transition-colors","border-blue-500/30 bg-blue-500/5"),children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(pe,{className:"w-4 h-4 text-blue-500"}),e.jsx("span",{className:"text-sm font-medium",children:"Remote Proxy"}),e.jsx(_,{variant:"secondary",className:"text-[10px] h-4 px-1.5 bg-blue-100 text-blue-700 dark:bg-blue-900/30 dark:text-blue-400",children:"Active"})]}),e.jsx(ke,{className:"w-3 h-3 text-blue-600"})]}),e.jsxs("div",{className:"mt-2 text-xs text-muted-foreground",children:[e.jsx("div",{className:"flex items-center gap-1 mb-1",children:e.jsx("span",{className:"font-mono",children:x})}),e.jsx("p",{className:"text-[10px] text-muted-foreground/70 leading-tight",children:"Traffic auto-routed to remote server"})]})]}):e.jsxs("div",{className:k("rounded-lg border p-3 transition-colors",r?"border-green-500/30 bg-green-500/5":"border-muted bg-muted/30"),children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:k("w-2 h-2 rounded-full",r?"bg-green-500 animate-pulse":"bg-muted-foreground/30")}),e.jsx("span",{className:"text-sm font-medium",children:"CLIProxy Plus"}),u&&e.jsxs(_,{variant:"secondary",className:"text-[10px] h-4 px-1.5 gap-0.5 bg-amber-100 text-amber-700 dark:bg-amber-900/30 dark:text-amber-400",title:`Update: v${t?.currentVersion} -> v${t?.latestVersion}`,children:[e.jsx(Ae,{className:"w-2.5 h-2.5"}),"Update"]})]}),e.jsx("div",{className:"flex items-center gap-1",children:a?e.jsx(G,{className:"w-3 h-3 animate-spin text-muted-foreground"}):r?e.jsx(ke,{className:"w-3 h-3 text-green-600"}):e.jsx(Se,{className:"w-3 h-3 text-muted-foreground"})})]}),r&&s?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"mt-2 flex items-center gap-4 text-xs text-muted-foreground",children:[e.jsxs("span",{className:"flex items-center gap-1",children:["Port ",s.port]}),s.sessionCount!==void 0&&s.sessionCount>0&&e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(Js,{className:"w-3 h-3"}),s.sessionCount," session",s.sessionCount!==1?"s":""]}),s.startedAt&&e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(X,{className:"w-3 h-3"}),kt(s.startedAt)]})]}),e.jsxs("div",{className:"mt-2 flex items-center gap-2",children:[e.jsxs(j,{variant:u?"default":"outline",size:"sm",className:k("h-7 text-xs gap-1 flex-1",u&&"bg-sidebar-accent hover:bg-sidebar-accent/90 text-sidebar-accent-foreground"),onClick:f,disabled:m,title:u?`Restart to update: v${t?.currentVersion} -> v${t?.latestVersion}`:"Restart CLIProxy service",children:[m?e.jsx(G,{className:"w-3 h-3 animate-spin"}):u?e.jsx(Ae,{className:"w-3 h-3"}):e.jsx(Ws,{className:"w-3 h-3"}),u?"Update":"Restart"]}),e.jsxs(j,{variant:"outline",size:"sm",className:"h-7 text-xs gap-1 hover:bg-destructive/10 hover:text-destructive hover:border-destructive/30",onClick:()=>i.mutate(),disabled:m,title:"Stop CLIProxy service",children:[i.isPending?e.jsx(G,{className:"w-3 h-3 animate-spin"}):e.jsx(Xs,{className:"w-3 h-3"}),"Stop"]})]})]}):e.jsxs("div",{className:"mt-2 flex items-center justify-between",children:[e.jsx("span",{className:"text-xs text-muted-foreground",children:"Not running"}),e.jsxs(j,{variant:"outline",size:"sm",className:"h-7 text-xs gap-1",onClick:()=>n.mutate(),disabled:n.isPending,children:[n.isPending?e.jsx(G,{className:"w-3 h-3 animate-spin"}):e.jsx(Se,{className:"w-3 h-3"}),"Start"]})]}),t?.currentVersion&&e.jsxs("div",{className:"mt-2 pt-2 border-t border-muted flex items-center justify-between text-[10px] text-muted-foreground/70",children:[e.jsxs("span",{children:["v",t.currentVersion]}),t.checkedAt&&e.jsxs("span",{title:new Date(t.checkedAt).toLocaleString(),children:["Synced ",At(t.checkedAt)]})]})]})}function Pt({status:s,isSelected:a,onSelect:t}){const n=s.accounts?.length||0;return e.jsxs("button",{className:k("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(fe,{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}),n>0&&e.jsx(_,{variant:"secondary",className:"text-[10px] h-4 px-1",children:n})]}),e.jsx("div",{className:"flex items-center gap-1.5 mt-0.5",children:s.authenticated?e.jsxs(e.Fragment,{children:[e.jsx(K,{className:"w-3 h-3 text-green-600"}),e.jsx("span",{className:"text-xs text-green-600",children:"Connected"})]}):e.jsxs(e.Fragment,{children:[e.jsx(he,{className:"w-3 h-3 text-muted-foreground"}),e.jsx("span",{className:"text-xs text-muted-foreground",children:"Not connected"})]})})]})]})}function Mt({variant:s,parentAuth:a,isSelected:t,onSelect:n,onDelete:i,isDeleting:c}){return e.jsxs("button",{className:k("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(fe,{provider:s.provider,size:"sm"}),e.jsx(ze,{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(_,{variant:"outline",className:"text-[9px] h-4 px-1",children:"variant"})]}),e.jsx("div",{className:"flex items-center gap-1.5 mt-0.5",children:a?.authenticated?e.jsxs(e.Fragment,{children:[e.jsx(K,{className:"w-3 h-3 text-green-600"}),e.jsxs("span",{className:"text-xs text-muted-foreground truncate",children:["via ",s.provider]})]}):e.jsxs(e.Fragment,{children:[e.jsx(he,{className:"w-3 h-3 text-muted-foreground"}),e.jsx("span",{className:"text-xs text-muted-foreground",children:"Parent not connected"})]})})]}),e.jsx(j,{variant:"ghost",size:"icon",className:"h-6 w-6 opacity-0 group-hover:opacity-100 hover:text-destructive",onClick:l=>{l.stopPropagation(),i()},disabled:c,children:e.jsx(qe,{className:"w-3 h-3"})})]})}function Ot({onSetup:s}){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(ee,{className:"w-8 h-8 text-muted-foreground"})}),e.jsx("h2",{className:"text-xl font-semibold mb-2",children:"CCS Profile Manager"}),e.jsx("p",{className:"text-muted-foreground mb-4",children:"Manage OAuth authentication, account preferences, and model selection for CLIProxy providers. Configure how CCS routes requests to different AI backends."}),e.jsxs("p",{className:"text-xs text-muted-foreground mb-6",children:["For live usage stats and real-time monitoring, visit the"," ",e.jsx("a",{href:"/cliproxy/control-panel",className:"text-primary hover:underline",children:"Control Panel"}),"."]}),e.jsxs(j,{onClick:s,className:"gap-2",children:[e.jsx(B,{className:"w-4 h-4"}),"Quick Setup"]})]})})}function Vt(){const s=De(),{data:a,isLoading:t}=Fe(),{data:n,isFetching:i}=_s(),c=Ls(),l=Es(),d=Is(),[r,m]=g.useState(null),[u,x]=g.useState(null),[f,o]=g.useState(!1),[h,A]=g.useState(null),y=g.useMemo(()=>a?.authStatus||[],[a?.authStatus]),O=a?.source==="remote",P=g.useMemo(()=>n?.variants||[],[n?.variants]),M=g.useMemo(()=>u?null:r&&y.some(p=>p.provider===r)?r:y.length>0?y[0].provider:null,[r,u,y]),b=y.find(p=>p.provider===M),v=P.find(p=>p.name===u),C=v?y.find(p=>p.provider===v.provider):void 0,N=()=>{s.invalidateQueries({queryKey:["cliproxy"]}),s.invalidateQueries({queryKey:["cliproxy-auth"]})},S=p=>{m(p),x(null)},T=p=>{x(p),m(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(ee,{className:"w-5 h-5 text-primary"}),e.jsx("h1",{className:"font-semibold",children:"CLIProxy Plus"})]}),e.jsx(j,{variant:"ghost",size:"icon",className:"h-8 w-8",onClick:N,disabled:i,children:e.jsx(G,{className:k("w-4 h-4",i&&"animate-spin")})})]}),e.jsx("p",{className:"text-xs text-muted-foreground mb-3",children:"CCS-level account management"}),e.jsxs(j,{variant:"default",size:"sm",className:"w-full gap-2",onClick:()=>o(!0),children:[e.jsx(B,{className:"w-4 h-4"}),"Quick Setup"]})]}),e.jsx(me,{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:"Providers"}),t?e.jsx("div",{className:"space-y-2 px-2",children:[1,2,3,4].map(p=>e.jsx(Rs,{className:"h-14 w-full rounded-lg"},p))}):e.jsx("div",{className:"space-y-1",children:y.map(p=>e.jsx(Pt,{status:p,isSelected:M===p.provider,onSelect:()=>S(p.provider)},p.provider))}),P.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(ze,{className:"w-3 h-3"}),"Variants"]}),e.jsx("div",{className:"space-y-1",children:P.map(p=>e.jsx(Mt,{variant:p,parentAuth:y.find(I=>I.provider===p.provider),isSelected:u===p.name,onSelect:()=>T(p.name),onDelete:()=>d.mutate(p.name),isDeleting:d.isPending},p.name))})]})]})}),e.jsx("div",{className:"p-3 border-t",children:e.jsx(St,{})}),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.jsxs("span",{children:[y.length," provider",y.length!==1?"s":""]}),e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(K,{className:"w-3 h-3 text-green-600"}),y.filter(p=>p.authenticated).length," connected"]})]})})]}),e.jsx("div",{className:"flex-1 flex flex-col min-w-0 bg-background",children:v&&C?e.jsx(Te,{provider:v.name,displayName:`${v.name} (${v.provider} variant)`,authStatus:C,catalog:Q[v.provider],logoProvider:v.provider,baseProvider:v.provider,isRemoteMode:O,port:v.port,onAddAccount:()=>A({provider:v.provider,displayName:C.displayName,isFirstAccount:(C.accounts?.length||0)===0}),onSetDefault:p=>c.mutate({provider:v.provider,accountId:p}),onRemoveAccount:p=>l.mutate({provider:v.provider,accountId:p}),isRemovingAccount:l.isPending}):b?e.jsx(Te,{provider:b.provider,displayName:b.displayName,authStatus:b,catalog:Q[b.provider],isRemoteMode:O,onAddAccount:()=>A({provider:b.provider,displayName:b.displayName,isFirstAccount:(b.accounts?.length||0)===0}),onSetDefault:p=>c.mutate({provider:b.provider,accountId:p}),onRemoveAccount:p=>l.mutate({provider:b.provider,accountId:p}),isRemovingAccount:l.isPending}):e.jsx(Ot,{onSetup:()=>o(!0)})}),e.jsx(ot,{open:f,onClose:()=>o(!1)}),e.jsx(lt,{open:h!==null,onClose:()=>A(null),provider:h?.provider||"",displayName:h?.displayName||"",isFirstAccount:h?.isFirstAccount||!1})]})}export{Vt as CliproxyPage};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{j as e}from"./radix-ui-uXQB-q0u.js";import{r as s}from"./react-vendor-B_CU-WTZ.js";import{a as w}from"./tanstack-Coed0rqz.js";import{ad as I}from"./index-QeBLfRj8.js";import{G as R,a0 as v,V as S,Y as T,K as U,S as K,X as M}from"./icons-CwFZAiDB.js";import"./notifications-dJQY2-U6.js";import"./utils-CzKF5WmX.js";import"./form-utils-kUVlZZAO.js";import"./code-highlight-DKN39ySy.js";const A=8317;function F({port:c=A}){const n=s.useRef(null),[f,p]=s.useState(!0),[b,i]=s.useState(null),[k,m]=s.useState(!1),[P,L]=s.useState(!0),{data:g,error:h}=w({queryKey:["cliproxy-server-config"],queryFn:()=>I.cliproxyServer.get(),staleTime:3e4}),{data:j}=w({queryKey:["auth-tokens-raw"],queryFn:async()=>{const t=await fetch("/api/settings/auth/tokens/raw");if(!t.ok)throw new Error("Failed to fetch auth tokens");return t.json()},staleTime:3e4});s.useEffect(()=>{h&&console.warn("[ControlPanelEmbed] Config fetch failed, using local mode:",h)},[h]);const{managementUrl:y,checkUrl:d,authToken:r,isRemote:l,displayHost:u}=s.useMemo(()=>{const t=g?.remote;if(t?.enabled&&t?.host){const o=t.protocol||"http",a=t.port||(o==="https"?443:80),N=o==="https"&&a===443||o==="http"&&a===80?"":`:${a}`,C=`${o}://${t.host}${N}`;return{managementUrl:`${C}/management.html`,checkUrl:`${C}/`,authToken:t.auth_token||void 0,isRemote:!0,displayHost:`${t.host}${N}`}}const x=j?.managementSecret?.value||"ccs";return{managementUrl:`http://localhost:${c}/management.html`,checkUrl:`http://localhost:${c}/`,authToken:x,isRemote:!1,displayHost:`localhost:${c}`}},[g,j,c]);s.useEffect(()=>{const t=new AbortController,x=async()=>{try{(await fetch(d,{signal:t.signal})).ok?(m(!0),i(null)):(m(!1),i(l?`Remote CLIProxy at ${u} returned an error`:"CLIProxy returned an error"))}catch(a){if(a instanceof Error&&a.name==="AbortError")return;m(!1),i(l?`Remote CLIProxy at ${u} is not reachable`:"CLIProxy is not running")}},o=setTimeout(()=>t.abort(),2e3);return x().finally(()=>clearTimeout(o)),()=>t.abort()},[d,l,u]);const $=s.useCallback(()=>{if(p(!1),n.current?.contentWindow&&r)try{const t=d.replace(/\/$/,"");if(!n.current.src.startsWith(t)){console.warn("[ControlPanelEmbed] Iframe origin mismatch, skipping postMessage");return}n.current.contentWindow.postMessage({type:"ccs-auto-login",apiBase:t,managementKey:r},t)}catch(t){console.debug("[ControlPanelEmbed] postMessage failed - cross-origin:",t)}},[d,r]),E=()=>{p(!0),i(null),m(!1),n.current&&(n.current.src=y)};return!k&&b?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(R,{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:E,children:[e.jsx(v,{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(S,{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:b}),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:[P&&!f&&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(T,{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(U,{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(K,{className:"h-3.5 w-3.5"})}),e.jsx("button",{className:"text-blue-600 hover:text-blue-800 dark:hover:text-blue-400",onClick:()=>L(!1),children:e.jsx(M,{className:"h-3.5 w-3.5"})})]})}),f&&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(v,{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 ${u}...`:"Loading Control Panel..."})]})}),e.jsx("iframe",{ref:n,src:y,className:"flex-1 w-full border-0",title:"CLIProxy Management Panel",onLoad:$})]})}function B(){return e.jsx("div",{className:"h-[calc(100vh-100px)] flex flex-col",children:e.jsx(F,{})})}export{B as CliproxyControlPanelPage};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{j as e}from"./radix-ui-uXQB-q0u.js";import{r as c}from"./react-vendor-B_CU-WTZ.js";import{az as N,aA as C,aB as w,aw as y,ay as G,i as S,a as b,I as p}from"./index-QeBLfRj8.js";import{S as k}from"./switch-B0PXGFIv.js";import{a0 as j,V as A,n as R,a9 as L,O as V}from"./icons-CwFZAiDB.js";import"./tanstack-Coed0rqz.js";import"./notifications-dJQY2-U6.js";import"./utils-CzKF5WmX.js";import"./form-utils-kUVlZZAO.js";import"./code-highlight-DKN39ySy.js";function _(){const{state:s}=N(),a=C(),[l,d]=c.useState(""),[m,v]=c.useState(""),u=c.useCallback(async()=>{try{a.setGlobalEnvLoading(!0),a.setGlobalEnvError(null);const t=await fetch("/api/global-env");if(!t.ok)throw new Error("Failed to load Global Env config");const o=await t.json();a.setGlobalEnvConfig(o)}catch(t){a.setGlobalEnvError(t.message)}finally{a.setGlobalEnvLoading(!1)}},[a]),i=c.useCallback(async t=>{const o=s.globalEnvConfig;if(!o)return;const x={...o,...t};a.setGlobalEnvConfig(x);try{a.setGlobalEnvSaving(!0),a.setGlobalEnvError(null);const r=await fetch("/api/global-env",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(x)});if(!r.ok){const n=await r.json();throw new Error(n.error||"Failed to save")}const h=await r.json();a.setGlobalEnvConfig(h.config),a.setGlobalEnvSuccess(!0),setTimeout(()=>a.setGlobalEnvSuccess(!1),1500)}catch(r){a.setGlobalEnvConfig(o),a.setGlobalEnvError(r.message)}finally{a.setGlobalEnvSaving(!1)}},[s.globalEnvConfig,a]),f=c.useCallback(()=>{if(!l.trim()||!s.globalEnvConfig)return;const t={...s.globalEnvConfig.env,[l.trim()]:m};i({env:t}),d(""),v("")},[l,m,s.globalEnvConfig,i]),g=c.useCallback(t=>{if(!s.globalEnvConfig)return;const o={...s.globalEnvConfig.env};delete o[t],i({env:o})},[s.globalEnvConfig,i]);return{config:s.globalEnvConfig,loading:s.globalEnvLoading,saving:s.globalEnvSaving,error:s.globalEnvError,success:s.globalEnvSuccess,newEnvKey:l,setNewEnvKey:d,newEnvValue:m,setNewEnvValue:v,fetchConfig:u,saveConfig:i,addEnvVar:f,removeEnvVar:g}}function F(){const{config:s,loading:a,saving:l,error:d,success:m,newEnvKey:v,setNewEnvKey:u,newEnvValue:i,setNewEnvValue:f,fetchConfig:g,saveConfig:t,addEnvVar:o,removeEnvVar:x}=_(),{fetchRawConfig:r}=w();c.useEffect(()=>{g(),r()},[g,r]);const h=()=>{t({enabled:!s?.enabled})};return a?e.jsx("div",{className:"flex-1 flex items-center justify-center",children:e.jsxs("div",{className:"flex items-center gap-3 text-muted-foreground",children:[e.jsx(j,{className:"w-5 h-5 animate-spin"}),e.jsx("span",{children:"Loading..."})]})}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:`absolute left-5 right-5 top-20 z-10 transition-all duration-200 ease-out ${d||m?"opacity-100 translate-y-0":"opacity-0 -translate-y-2 pointer-events-none"}`,children:[d&&e.jsxs(y,{variant:"destructive",className:"py-2 shadow-lg",children:[e.jsx(A,{className:"h-4 w-4"}),e.jsx(G,{children:d})]}),m&&e.jsxs("div",{className:"flex items-center gap-2 px-3 py-2 rounded-md border border-green-200 bg-green-50 text-green-700 shadow-lg dark:border-green-900/50 dark:bg-green-900/90 dark:text-green-300",children:[e.jsx(R,{className:"h-4 w-4 shrink-0"}),e.jsx("span",{className:"text-sm font-medium",children:"Saved"})]})]}),e.jsx(S,{className:"flex-1",children:e.jsxs("div",{className:"p-5 space-y-6",children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:"Environment variables injected into all non-Claude subscription profiles (gemini, codex, agy, ghcp, etc.)"}),e.jsxs("div",{className:"flex items-center justify-between p-4 rounded-lg bg-muted/50",children:[e.jsxs("div",{children:[e.jsx("p",{className:"font-medium",children:s?.enabled?"Global Env enabled":"Global Env disabled"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:s?.enabled?"Env vars will be injected into third-party profiles":"Env vars will not be injected"})]}),e.jsx(k,{checked:s?.enabled??!0,onCheckedChange:h})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsx("h3",{className:"text-base font-medium",children:"Environment Variables"}),s?.env&&Object.keys(s.env).length>0?e.jsx("div",{className:"space-y-2",children:Object.entries(s.env).map(([n,E])=>e.jsxs("div",{className:"flex items-center gap-2 p-3 rounded-lg border bg-background",children:[e.jsx("code",{className:"flex-1 font-mono text-sm truncate",children:n}),e.jsx("span",{className:"text-muted-foreground",children:"="}),e.jsx("code",{className:"font-mono text-sm px-2 py-1 bg-muted rounded",children:E}),e.jsx(b,{variant:"ghost",size:"sm",onClick:()=>x(n),disabled:l,className:"h-8 w-8 p-0 text-destructive hover:text-destructive hover:bg-destructive/10",children:e.jsx(L,{className:"w-4 h-4"})})]},n))}):e.jsx("div",{className:"p-4 rounded-lg border border-dashed text-center text-muted-foreground",children:e.jsx("p",{children:"No environment variables configured"})}),e.jsxs("div",{className:"p-4 rounded-lg border bg-muted/30",children:[e.jsx("h4",{className:"text-sm font-medium mb-3",children:"Add New Variable"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(p,{value:v,onChange:n=>u(n.target.value.toUpperCase()),placeholder:"KEY_NAME",className:"flex-1 font-mono text-sm h-9",disabled:l}),e.jsx("span",{className:"flex items-center text-muted-foreground",children:"="}),e.jsx(p,{value:i,onChange:n=>f(n.target.value),placeholder:"value",className:"flex-1 font-mono text-sm h-9",disabled:l}),e.jsxs(b,{size:"sm",onClick:o,disabled:l||!v.trim(),className:"h-9",children:[e.jsx(V,{className:"w-4 h-4 mr-1"}),"Add"]})]})]}),e.jsxs("div",{className:"p-4 rounded-lg border bg-muted/30",children:[e.jsx("h4",{className:"text-sm font-medium mb-3",children:"Quick Add Common Variables"}),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[[{key:"DISABLE_BUG_COMMAND",value:"1"},{key:"DISABLE_ERROR_REPORTING",value:"1"},{key:"DISABLE_TELEMETRY",value:"1"}].map(({key:n,value:E})=>!s?.env?.[n]&&e.jsxs(b,{variant:"outline",size:"sm",onClick:()=>{u(n),f(E)},className:"text-xs font-mono",children:["+ ",n]},n)),s?.env&&["DISABLE_BUG_COMMAND","DISABLE_ERROR_REPORTING","DISABLE_TELEMETRY"].every(n=>s.env[n])&&e.jsx("span",{className:"text-sm text-muted-foreground",children:"All common variables are configured"})]})]})]})]})}),e.jsx("div",{className:"p-4 border-t bg-background",children:e.jsxs(b,{variant:"outline",size:"sm",onClick:()=>{g(),r()},disabled:a||l,className:"w-full",children:[e.jsx(j,{className:`w-4 h-4 mr-2 ${a?"animate-spin":""}`}),"Refresh"]})})]})}export{F as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as y}from"./react-vendor-B_CU-WTZ.js";const _=t=>t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),M=t=>t.replace(/^([A-Z])|[\s-_]+(\w)/g,(a,c,o)=>o?o.toUpperCase():c.toLowerCase()),d=t=>{const a=M(t);return a.charAt(0).toUpperCase()+a.slice(1)},r=(...t)=>t.filter((a,c,o)=>!!a&&a.trim()!==""&&o.indexOf(a)===c).join(" ").trim(),x=t=>{for(const a in t)if(a.startsWith("aria-")||a==="role"||a==="title")return!0};var m={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};const v=y.forwardRef(({color:t="currentColor",size:a=24,strokeWidth:c=2,absoluteStrokeWidth:o,className:s="",children:n,iconNode:k,...h},i)=>y.createElement("svg",{ref:i,...m,width:a,height:a,stroke:t,strokeWidth:o?Number(c)*24/Number(a):c,className:r("lucide",s),...!n&&!x(h)&&{"aria-hidden":"true"},...h},[...k.map(([p,l])=>y.createElement(p,l)),...Array.isArray(n)?n:[n]]));const e=(t,a)=>{const c=y.forwardRef(({className:o,...s},n)=>y.createElement(v,{ref:n,iconNode:a,className:r(`lucide-${_(d(t))}`,`lucide-${t}`,o),...s}));return c.displayName=d(t),c};const f=[["path",{d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2",key:"169zse"}]],t0=e("activity",f);const g=[["path",{d:"M17 7 7 17",key:"15tmo1"}],["path",{d:"M17 17H7V7",key:"1org7z"}]],c0=e("arrow-down-left",g);const w=[["path",{d:"m7 7 10 10",key:"1fmybs"}],["path",{d:"M17 7v10H7",key:"6fjiku"}]],o0=e("arrow-down-right",w);const $=[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]],n0=e("arrow-left",$);const N=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]],y0=e("arrow-right",N);const u=[["path",{d:"M7 7h10v10",key:"1tivn9"}],["path",{d:"M7 17 17 7",key:"1vkiza"}]],s0=e("arrow-up-right",u);const z=[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]],h0=e("arrow-up",z);const b=[["path",{d:"M12 7v14",key:"1akyts"}],["path",{d:"M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z",key:"ruj8y"}]],d0=e("book-open",b);const C=[["path",{d:"M12 8V4H8",key:"hb8ula"}],["rect",{width:"16",height:"12",x:"4",y:"8",rx:"2",key:"enze0r"}],["path",{d:"M2 14h2",key:"vft8re"}],["path",{d:"M20 14h2",key:"4cs60a"}],["path",{d:"M15 13v2",key:"1xurst"}],["path",{d:"M9 13v2",key:"rq6x2g"}]],r0=e("bot",C);const j=[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M3 10h18",key:"8toen8"}]],k0=e("calendar",j);const q=[["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}],["path",{d:"M18 17V9",key:"2bz60n"}],["path",{d:"M13 17V5",key:"1frdt8"}],["path",{d:"M8 17v-3",key:"17ska0"}]],i0=e("chart-column",q);const A=[["path",{d:"M21 12c.552 0 1.005-.449.95-.998a10 10 0 0 0-8.953-8.951c-.55-.055-.998.398-.998.95v8a1 1 0 0 0 1 1z",key:"pzmjnu"}],["path",{d:"M21.21 15.89A10 10 0 1 1 8 2.83",key:"k2fpak"}]],p0=e("chart-pie",A);const H=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],l0=e("check",H);const V=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],_0=e("chevron-down",V);const L=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],M0=e("chevron-left",L);const S=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],x0=e("chevron-right",S);const R=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],m0=e("chevron-up",R);const E=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]],v0=e("circle-alert",E);const P=[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]],f0=e("circle-check-big",P);const U=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],g0=e("circle-check",U);const B=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]],w0=e("circle-question-mark",B);const D=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]],$0=e("circle-x",D);const G=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],N0=e("circle",G);const O=[["path",{d:"M12 6v6l4 2",key:"mmk7yg"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],u0=e("clock",O);const W=[["path",{d:"M17.5 19H9a7 7 0 1 1 6.71-9h1.79a4.5 4.5 0 1 1 0 9Z",key:"p7xjir"}]],z0=e("cloud",W);const F=[["path",{d:"m18 16 4-4-4-4",key:"1inbqp"}],["path",{d:"m6 8-4 4 4 4",key:"15zrgr"}],["path",{d:"m14.5 4-5 16",key:"e7oirm"}]],b0=e("code-xml",F);const T=[["path",{d:"m16 18 6-6-6-6",key:"eg8j8"}],["path",{d:"m8 6-6 6 6 6",key:"ppft3o"}]],C0=e("code",T);const Z=[["circle",{cx:"8",cy:"8",r:"6",key:"3yglwk"}],["path",{d:"M18.09 10.37A6 6 0 1 1 10.34 18",key:"t5s6rm"}],["path",{d:"M7 6h1v4",key:"1obek4"}],["path",{d:"m16.71 13.88.7.71-2.82 2.82",key:"1rbuyh"}]],j0=e("coins",Z);const I=[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]],q0=e("copy",I);const K=[["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M17 20v2",key:"1rnc9c"}],["path",{d:"M17 2v2",key:"11trls"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M2 17h2",key:"7oei6x"}],["path",{d:"M2 7h2",key:"asdhe0"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"M20 17h2",key:"1fpfkl"}],["path",{d:"M20 7h2",key:"1o8tra"}],["path",{d:"M7 20v2",key:"4gnj0m"}],["path",{d:"M7 2v2",key:"1i4yhu"}],["rect",{x:"4",y:"4",width:"16",height:"16",rx:"2",key:"1vbyd7"}],["rect",{x:"8",y:"8",width:"8",height:"8",rx:"1",key:"z9xiuo"}]],A0=e("cpu",K);const X=[["ellipse",{cx:"12",cy:"5",rx:"9",ry:"3",key:"msslwz"}],["path",{d:"M3 5V19A9 3 0 0 0 21 19V5",key:"1wlel7"}],["path",{d:"M3 12A9 3 0 0 0 21 12",key:"mv7ke4"}]],H0=e("database",X);const Q=[["line",{x1:"12",x2:"12",y1:"2",y2:"22",key:"7eqyqh"}],["path",{d:"M17 5H9.5a3.5 3.5 0 0 0 0 7h5a3.5 3.5 0 0 1 0 7H6",key:"1b0p4s"}]],V0=e("dollar-sign",Q);const J=[["path",{d:"M12 15V3",key:"m9g1x1"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["path",{d:"m7 10 5 5 5-5",key:"brsn70"}]],L0=e("download",J);const Y=[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"19",cy:"12",r:"1",key:"1wjl8i"}],["circle",{cx:"5",cy:"12",r:"1",key:"1pcz8c"}]],S0=e("ellipsis",Y);const e1=[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]],R0=e("external-link",e1);const a1=[["path",{d:"M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49",key:"ct8e1f"}],["path",{d:"M14.084 14.158a3 3 0 0 1-4.242-4.242",key:"151rxh"}],["path",{d:"M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143",key:"13bj9a"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]],E0=e("eye-off",a1);const t1=[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],P0=e("eye",t1);const c1=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1",key:"1oajmo"}],["path",{d:"M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1",key:"mpwhp6"}]],U0=e("file-braces",c1);const o1=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 12.5 8 15l2 2.5",key:"1tg20x"}],["path",{d:"m14 12.5 2 2.5-2 2.5",key:"yinavb"}]],B0=e("file-code",o1);const n1=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]],D0=e("file-exclamation-point",n1);const y1=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]],G0=e("file-text",y1);const s1=[["path",{d:"m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2",key:"usdka0"}]],O0=e("folder-open",s1);const h1=[["path",{d:"m12 14 4-4",key:"9kzdfg"}],["path",{d:"M3.34 19a10 10 0 1 1 17.32 0",key:"19p75a"}]],W0=e("gauge",h1);const d1=[["line",{x1:"6",x2:"6",y1:"3",y2:"15",key:"17qcm7"}],["circle",{cx:"18",cy:"6",r:"3",key:"1h7g24"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}],["path",{d:"M18 9a9 9 0 0 1-9 9",key:"n2h4wq"}]],F0=e("git-branch",d1);const r1=[["path",{d:"M15 22v-4a4.8 4.8 0 0 0-1-3.5c3 0 6-2 6-5.5.08-1.25-.27-2.48-1-3.5.28-1.15.28-2.35 0-3.5 0 0-1 0-3 1.5-2.64-.5-5.36-.5-8 0C6 2 5 2 5 2c-.3 1.15-.3 2.35 0 3.5A5.403 5.403 0 0 0 4 9c0 3.5 3 5.5 6 5.5-.39.49-.68 1.05-.85 1.65-.17.6-.22 1.23-.15 1.85v4",key:"tonef"}],["path",{d:"M9 18c-4.51 2-5-2-7-2",key:"9comsn"}]],T0=e("github",r1);const k1=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20",key:"13o1zl"}],["path",{d:"M2 12h20",key:"9i4pu4"}]],Z0=e("globe",k1);const i1=[["circle",{cx:"12",cy:"9",r:"1",key:"124mty"}],["circle",{cx:"19",cy:"9",r:"1",key:"1ruzo2"}],["circle",{cx:"5",cy:"9",r:"1",key:"1a8b28"}],["circle",{cx:"12",cy:"15",r:"1",key:"1e56xg"}],["circle",{cx:"19",cy:"15",r:"1",key:"1a92ep"}],["circle",{cx:"5",cy:"15",r:"1",key:"5r1jwy"}]],I0=e("grip-horizontal",i1);const p1=[["circle",{cx:"9",cy:"12",r:"1",key:"1vctgf"}],["circle",{cx:"9",cy:"5",r:"1",key:"hp0tcf"}],["circle",{cx:"9",cy:"19",r:"1",key:"fkjjf6"}],["circle",{cx:"15",cy:"12",r:"1",key:"1tmaij"}],["circle",{cx:"15",cy:"5",r:"1",key:"19l28e"}],["circle",{cx:"15",cy:"19",r:"1",key:"f4zoj3"}]],K0=e("grip-vertical",p1);const l1=[["path",{d:"M2 9.5a5.5 5.5 0 0 1 9.591-3.676.56.56 0 0 0 .818 0A5.49 5.49 0 0 1 22 9.5c0 2.29-1.5 4-3 5.5l-5.492 5.313a2 2 0 0 1-3 .019L5 15c-1.5-1.5-3-3.2-3-5.5",key:"mvr1a0"}]],X0=e("heart",l1);const _1=[["path",{d:"M15 21v-8a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v8",key:"5wwlr5"}],["path",{d:"M3 10a2 2 0 0 1 .709-1.528l7-6a2 2 0 0 1 2.582 0l7 6A2 2 0 0 1 21 10v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z",key:"r6nss1"}]],Q0=e("house",_1);const M1=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]],J0=e("info",M1);const x1=[["path",{d:"M2.586 17.414A2 2 0 0 0 2 18.828V21a1 1 0 0 0 1 1h3a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h1a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h.172a2 2 0 0 0 1.414-.586l.814-.814a6.5 6.5 0 1 0-4-4z",key:"1s6t7t"}],["circle",{cx:"16.5",cy:"7.5",r:".5",fill:"currentColor",key:"w0ekpg"}]],Y0=e("key-round",x1);const m1=[["path",{d:"m15.5 7.5 2.3 2.3a1 1 0 0 0 1.4 0l2.1-2.1a1 1 0 0 0 0-1.4L19 4",key:"g0fldk"}],["path",{d:"m21 2-9.6 9.6",key:"1j0ho8"}],["circle",{cx:"7.5",cy:"15.5",r:"5.5",key:"yqb3hr"}]],e2=e("key",m1);const v1=[["path",{d:"M18 5a2 2 0 0 1 2 2v8.526a2 2 0 0 0 .212.897l1.068 2.127a1 1 0 0 1-.9 1.45H3.62a1 1 0 0 1-.9-1.45l1.068-2.127A2 2 0 0 0 4 15.526V7a2 2 0 0 1 2-2z",key:"1pdavp"}],["path",{d:"M20.054 15.987H3.946",key:"14rxg9"}]],a2=e("laptop",v1);const f1=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],t2=e("loader-circle",f1);const g1=[["rect",{width:"20",height:"14",x:"2",y:"3",rx:"2",key:"48i651"}],["line",{x1:"8",x2:"16",y1:"21",y2:"21",key:"1svkeh"}],["line",{x1:"12",x2:"12",y1:"17",y2:"21",key:"vw1qmm"}]],c2=e("monitor",g1);const w1=[["path",{d:"M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401",key:"kfwtm"}]],o2=e("moon",w1);const $1=[["rect",{x:"16",y:"16",width:"6",height:"6",rx:"1",key:"4q2zg0"}],["rect",{x:"2",y:"16",width:"6",height:"6",rx:"1",key:"8cvhb9"}],["rect",{x:"9",y:"2",width:"6",height:"6",rx:"1",key:"1egb70"}],["path",{d:"M5 16v-3a1 1 0 0 1 1-1h12a1 1 0 0 1 1 1v3",key:"1jsf9p"}],["path",{d:"M12 12V8",key:"2874zd"}]],n2=e("network",$1);const N1=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}]],y2=e("panel-left",N1);const u1=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],s2=e("plus",u1);const z1=[["path",{d:"M18.36 6.64A9 9 0 0 1 20.77 15",key:"dxknvb"}],["path",{d:"M6.16 6.16a9 9 0 1 0 12.68 12.68",key:"1x7qb5"}],["path",{d:"M12 2v4",key:"3427ic"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]],h2=e("power-off",z1);const b1=[["path",{d:"M12 2v10",key:"mnfbl"}],["path",{d:"M18.4 6.6a9 9 0 1 1-12.77.04",key:"obofu9"}]],d2=e("power",b1);const C1=[["path",{d:"M16.247 7.761a6 6 0 0 1 0 8.478",key:"1fwjs5"}],["path",{d:"M19.075 4.933a10 10 0 0 1 0 14.134",key:"ehdyv1"}],["path",{d:"M4.925 19.067a10 10 0 0 1 0-14.134",key:"1q22gi"}],["path",{d:"M7.753 16.239a6 6 0 0 1 0-8.478",key:"r2q7qm"}],["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}]],r2=e("radio",C1);const j1=[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]],k2=e("refresh-cw",j1);const q1=[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]],i2=e("rotate-ccw",q1);const A1=[["path",{d:"M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8",key:"1p45f6"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}]],p2=e("rotate-cw",A1);const H1=[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]],l2=e("save",H1);const V1=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],_2=e("search",V1);const L1=[["rect",{width:"20",height:"8",x:"2",y:"2",rx:"2",ry:"2",key:"ngkwjq"}],["rect",{width:"20",height:"8",x:"2",y:"14",rx:"2",ry:"2",key:"iecqi9"}],["line",{x1:"6",x2:"6.01",y1:"6",y2:"6",key:"16zg32"}],["line",{x1:"6",x2:"6.01",y1:"18",y2:"18",key:"nzw8ys"}]],M2=e("server",L1);const S1=[["path",{d:"M14 17H5",key:"gfn3mx"}],["path",{d:"M19 7h-9",key:"6i9tg"}],["circle",{cx:"17",cy:"17",r:"3",key:"18b49y"}],["circle",{cx:"7",cy:"7",r:"3",key:"dfmy0x"}]],x2=e("settings-2",S1);const R1=[["path",{d:"M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915",key:"1i5ecw"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],m2=e("settings",R1);const E1=[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],v2=e("shield-check",E1);const P1=[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}]],f2=e("shield",P1);const U1=[["path",{d:"M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z",key:"1s2grr"}],["path",{d:"M20 2v4",key:"1rf3ol"}],["path",{d:"M22 4h-4",key:"gwowj6"}],["circle",{cx:"4",cy:"20",r:"2",key:"6kqj1y"}]],g2=e("sparkles",U1);const B1=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]],w2=e("square",B1);const D1=[["path",{d:"M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z",key:"r04s7s"}]],$2=e("star",D1);const G1=[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"m4.93 4.93 1.41 1.41",key:"149t6j"}],["path",{d:"m17.66 17.66 1.41 1.41",key:"ptbguv"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m6.34 17.66-1.41 1.41",key:"1m8zz5"}],["path",{d:"m19.07 4.93-1.41 1.41",key:"1shlcs"}]],N2=e("sun",G1);const O1=[["path",{d:"M12 19h8",key:"baeox8"}],["path",{d:"m4 17 6-6-6-6",key:"1yngyt"}]],u2=e("terminal",O1);const W1=[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]],z2=e("trash-2",W1);const F1=[["path",{d:"M16 7h6v6",key:"box55l"}],["path",{d:"m22 7-8.5 8.5-5-5L2 17",key:"1t1m79"}]],b2=e("trending-up",F1);const T1=[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]],C2=e("triangle-alert",T1);const Z1=[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]],j2=e("user",Z1);const I1=[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["path",{d:"M16 3.128a4 4 0 0 1 0 7.744",key:"16gr8j"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}]],q2=e("users",I1);const K1=[["path",{d:"m21.64 3.64-1.28-1.28a1.21 1.21 0 0 0-1.72 0L2.36 18.64a1.21 1.21 0 0 0 0 1.72l1.28 1.28a1.2 1.2 0 0 0 1.72 0L21.64 5.36a1.2 1.2 0 0 0 0-1.72",key:"ul74o6"}],["path",{d:"m14 7 3 3",key:"1r5n42"}],["path",{d:"M5 6v4",key:"ilb8ba"}],["path",{d:"M19 14v4",key:"blhpug"}],["path",{d:"M10 2v2",key:"7u0qdc"}],["path",{d:"M7 8H3",key:"zfb6yr"}],["path",{d:"M21 16h-4",key:"1cnmox"}],["path",{d:"M11 3H9",key:"1obp7u"}]],A2=e("wand-sparkles",K1);const X1=[["path",{d:"M12 20h.01",key:"zekei9"}],["path",{d:"M8.5 16.429a5 5 0 0 1 7 0",key:"1bycff"}],["path",{d:"M5 12.859a10 10 0 0 1 5.17-2.69",key:"1dl1wf"}],["path",{d:"M19 12.859a10 10 0 0 0-2.007-1.523",key:"4k23kn"}],["path",{d:"M2 8.82a15 15 0 0 1 4.177-2.643",key:"1grhjp"}],["path",{d:"M22 8.82a15 15 0 0 0-11.288-3.764",key:"z3jwby"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]],H2=e("wifi-off",X1);const Q1=[["path",{d:"M12 20h.01",key:"zekei9"}],["path",{d:"M2 8.82a15 15 0 0 1 20 0",key:"dnpr2z"}],["path",{d:"M5 12.859a10 10 0 0 1 14 0",key:"1x1e6c"}],["path",{d:"M8.5 16.429a5 5 0 0 1 7 0",key:"1bycff"}]],V2=e("wifi",Q1);const J1=[["path",{d:"M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.106-3.105c.32-.322.863-.22.983.218a6 6 0 0 1-8.259 7.057l-7.91 7.91a1 1 0 0 1-2.999-3l7.91-7.91a6 6 0 0 1 7.057-8.259c.438.12.54.662.219.984z",key:"1ngwbx"}]],L2=e("wrench",J1);const Y1=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],S2=e("x",Y1);const e0=[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]],R2=e("zap",e0);export{B0 as $,t0 as A,d0 as B,i0 as C,m0 as D,E0 as E,O0 as F,W0 as G,Q0 as H,J0 as I,_0 as J,e2 as K,t2 as L,o2 as M,x2 as N,s2 as O,y2 as P,g2 as Q,i2 as R,m2 as S,C2 as T,q2 as U,v0 as V,H2 as W,S2 as X,Z0 as Y,R2 as Z,M2 as _,T0 as a,k2 as a0,M0 as a1,V0 as a2,H0 as a3,o0 as a4,k0 as a5,j0 as a6,b2 as a7,p0 as a8,z2 as a9,l2 as aa,_2 as ab,A2 as ac,b0 as ad,y0 as ae,U0 as af,n0 as ag,j2 as ah,L0 as ai,$2 as aj,n2 as ak,S0 as al,w0 as am,h0 as an,d2 as ao,p2 as ap,w2 as aq,F0 as ar,h2 as as,L2 as at,c2 as au,r0 as av,z0 as aw,a2 as ax,v2 as ay,x0 as b,N2 as c,P0 as d,V2 as e,f2 as f,X0 as g,f0 as h,N0 as i,l0 as j,Y0 as k,q0 as l,R0 as m,g0 as n,$0 as o,K0 as p,u0 as q,r2 as r,A0 as s,u2 as t,C0 as u,s0 as v,c0 as w,G0 as x,D0 as y,I0 as z};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{j as e}from"./radix-ui-uXQB-q0u.js";import{r as p}from"./react-vendor-B_CU-WTZ.js";import{az as G,aA as J,ad as L,I as S,O as K,Q as X,U as Y,V as Z,W as $,a as B,aB as ee,aw as te,ay as se,i as re}from"./index-QeBLfRj8.js";import{S as A}from"./switch-B0PXGFIv.js";import{aw as _,a0 as I,e as oe,n as F,W as ae,V as ne,ax as le}from"./icons-CwFZAiDB.js";import"./tanstack-Coed0rqz.js";import"./notifications-dJQY2-U6.js";import"./utils-CzKF5WmX.js";import"./form-utils-kUVlZZAO.js";import"./code-highlight-DKN39ySy.js";function ce(){const{state:s}=G(),t=J(),[n,l]=p.useState(null),[u,f]=p.useState(null),[h,d]=p.useState(null),[j,y]=p.useState(null),b=p.useCallback(async()=>{try{t.setProxyLoading(!0),t.setProxyError(null);const a=await L.cliproxyServer.get();t.setProxyConfig(a)}catch(a){t.setProxyError(a.message)}finally{t.setProxyLoading(!1)}},[t]),v=p.useCallback(async a=>{const c=s.proxyConfig;if(!c)return;const m={remote:{...c.remote,...a.remote},fallback:{...c.fallback,...a.fallback},local:{...c.local,...a.local}};t.setProxyConfig(m),t.setProxyTestResult(null);try{t.setProxySaving(!0),t.setProxyError(null);const r=await L.cliproxyServer.update(a);t.setProxyConfig(r),t.setProxySuccess(!0),setTimeout(()=>t.setProxySuccess(!1),1500)}catch(r){t.setProxyConfig(c),t.setProxyError(r.message)}finally{t.setProxySaving(!1)}},[s.proxyConfig,t]),N=p.useCallback(async a=>{const{host:c,port:m,protocol:r,authToken:i}=a;if(!c){t.setProxyError("Host is required");return}try{t.setProxyTesting(!0),t.setProxyError(null),t.setProxyTestResult(null);const g=m?parseInt(m,10):void 0,x=await L.cliproxyServer.test({host:c,port:g||void 0,protocol:r,authToken:i||void 0});t.setProxyTestResult(x)}catch(g){t.setProxyError(g.message)}finally{t.setProxyTesting(!1)}},[t]);return{config:s.proxyConfig,loading:s.proxyLoading,saving:s.proxySaving,error:s.proxyError,success:s.proxySuccess,testResult:s.proxyTestResult,testing:s.proxyTesting,editedHost:n,setEditedHost:l,editedPort:u,setEditedPort:f,editedAuthToken:h,setEditedAuthToken:d,editedLocalPort:j,setEditedLocalPort:y,fetchConfig:b,saveConfig:v,testConnection:N}}function ie({config:s,saving:t,displayLocalPort:n,setEditedLocalPort:l,onSaveLocalPort:u,onSaveConfig:f}){const h=s.local;return e.jsxs("div",{className:"space-y-3",children:[e.jsx("h3",{className:"text-base font-medium",children:"Local Proxy"}),e.jsxs("div",{className:"space-y-3 p-4 rounded-lg border bg-muted/30",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx("label",{className:"text-sm text-muted-foreground",children:"Port"}),e.jsx(S,{type:"number",value:n,onChange:d=>l(d.target.value),onBlur:u,placeholder:"8317",className:"font-mono max-w-32",disabled:t})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("p",{className:"font-medium text-sm",children:"Auto-start"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Start local proxy automatically when needed"})]}),e.jsx(A,{checked:h.auto_start??!0,onCheckedChange:d=>f({local:{...h,auto_start:d}}),disabled:t})]})]})]})}function de({config:s,saving:t,testing:n,testResult:l,displayHost:u,displayPort:f,displayAuthToken:h,setEditedHost:d,setEditedPort:j,setEditedAuthToken:y,onSaveHost:b,onSavePort:v,onSaveAuthToken:N,onSaveConfig:a,onTestConnection:c}){const m=s.remote,r=i=>i==="https"?443:8317;return e.jsxs("div",{className:"space-y-4 p-4 rounded-lg border bg-muted/30",children:[e.jsxs("h4",{className:"text-sm font-medium flex items-center gap-2",children:[e.jsx(_,{className:"w-4 h-4"}),"Remote Server Configuration"]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("label",{className:"text-sm text-muted-foreground",children:"Host"}),e.jsx(S,{value:u,onChange:i=>d(i.target.value),onBlur:b,placeholder:"192.168.1.100 or proxy.example.com",className:"font-mono",disabled:t})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsxs("label",{className:"text-sm text-muted-foreground",children:["Port"," ",e.jsxs("span",{className:"text-xs opacity-70",children:["(default: ",r(s.remote.protocol||"http"),")"]})]}),e.jsx(S,{type:"text",inputMode:"numeric",value:f,onChange:i=>j(i.target.value.replace(/\D/g,"")),onBlur:v,placeholder:`Leave empty for ${r(s.remote.protocol||"http")}`,className:"font-mono",disabled:t})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("label",{className:"text-sm text-muted-foreground",children:"Protocol"}),e.jsxs(K,{value:s.remote.protocol||"http",onValueChange:i=>a({remote:{...m,protocol:i}}),disabled:t,children:[e.jsx(X,{children:e.jsx(Y,{})}),e.jsxs(Z,{children:[e.jsx($,{value:"http",children:"HTTP"}),e.jsx($,{value:"https",children:"HTTPS"})]})]})]})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("label",{className:"text-sm text-muted-foreground",children:"Auth Token (optional)"}),e.jsx(S,{type:"password",value:h,onChange:i=>y(i.target.value),onBlur:N,placeholder:"Bearer token for authentication",className:"font-mono",disabled:t})]}),e.jsxs("div",{className:"space-y-3 pt-2",children:[e.jsx(B,{onClick:c,disabled:n||!u,variant:"outline",className:"w-full",children:n?e.jsxs(e.Fragment,{children:[e.jsx(I,{className:"w-4 h-4 mr-2 animate-spin"}),"Testing..."]}):e.jsxs(e.Fragment,{children:[e.jsx(oe,{className:"w-4 h-4 mr-2"}),"Test Connection"]})}),l&&e.jsx("div",{className:`p-3 rounded-md ${l.reachable?"bg-green-50 border border-green-200 dark:bg-green-900/20 dark:border-green-900/50":"bg-red-50 border border-red-200 dark:bg-red-900/20 dark:border-red-900/50"}`,children:e.jsx("div",{className:"flex items-center gap-2",children:l.reachable?e.jsxs(e.Fragment,{children:[e.jsx(F,{className:"w-4 h-4 text-green-600 dark:text-green-400"}),e.jsxs("span",{className:"text-sm font-medium text-green-700 dark:text-green-300",children:["Connected (",l.latencyMs,"ms)"]})]}):e.jsxs(e.Fragment,{children:[e.jsx(ae,{className:"w-4 h-4 text-red-600 dark:text-red-400"}),e.jsx("span",{className:"text-sm font-medium text-red-700 dark:text-red-300",children:l.error||"Connection failed"})]})})})]})]})}function ve(){const{config:s,loading:t,saving:n,error:l,success:u,testResult:f,testing:h,editedHost:d,setEditedHost:j,editedPort:y,setEditedPort:b,editedAuthToken:v,setEditedAuthToken:N,editedLocalPort:a,setEditedLocalPort:c,fetchConfig:m,saveConfig:r,testConnection:i}=ce(),{fetchRawConfig:g}=ee();if(p.useEffect(()=>{m(),g()},[m,g]),t||!s)return e.jsx("div",{className:"flex-1 flex items-center justify-center",children:e.jsxs("div",{className:"flex items-center gap-3 text-muted-foreground",children:[e.jsx(I,{className:"w-5 h-5 animate-spin"}),e.jsx("span",{children:"Loading..."})]})});const x=s.remote.enabled??!1,C=s.remote,P=s.fallback,M=s.remote.host??"",V=s.remote.port!==void 0?s.remote.port.toString():"",W=s.remote.auth_token??"",z=(s.local.port??8317).toString(),w=d??M,T=y??V,E=v??W,R=a??z,D=()=>{const o=d??w;o!==s.remote.host&&r({remote:{...C,host:o}}),j(null)},O=()=>{const o=y??T,k=o===""?void 0:parseInt(o,10),H=k&&!isNaN(k)&&k>0?k:void 0;H!==s.remote.port&&r({remote:{...C,port:H}}),b(null)},U=()=>{const o=v??E;o!==s.remote.auth_token&&r({remote:{...C,auth_token:o}}),N(null)},q=()=>{const o=parseInt(a??R,10);!isNaN(o)&&o!==s.local.port&&r({local:{...s.local,port:o}}),c(null)},Q=()=>{i({host:w,port:T,protocol:s.remote.protocol||"http",authToken:E})};return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:`absolute left-5 right-5 top-20 z-10 transition-all duration-200 ease-out ${l||u?"opacity-100 translate-y-0":"opacity-0 -translate-y-2 pointer-events-none"}`,children:[l&&e.jsxs(te,{variant:"destructive",className:"py-2 shadow-lg",children:[e.jsx(ne,{className:"h-4 w-4"}),e.jsx(se,{children:l})]}),u&&e.jsxs("div",{className:"flex items-center gap-2 px-3 py-2 rounded-md border border-green-200 bg-green-50 text-green-700 shadow-lg dark:border-green-900/50 dark:bg-green-900/90 dark:text-green-300",children:[e.jsx(F,{className:"h-4 w-4 shrink-0"}),e.jsx("span",{className:"text-sm font-medium",children:"Saved"})]})]}),e.jsx(re,{className:"flex-1",children:e.jsxs("div",{className:"p-5 space-y-6",children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:"Configure local or remote CLIProxy Plus connection for proxy-based profiles"}),e.jsxs("div",{className:"space-y-3",children:[e.jsx("h3",{className:"text-base font-medium",children:"Connection Mode"}),e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsxs("button",{onClick:()=>r({remote:{...C,enabled:!1}}),disabled:n,className:`p-4 rounded-lg border-2 text-left transition-all ${x?"border-border hover:border-muted-foreground/50":"border-primary bg-primary/5"}`,children:[e.jsxs("div",{className:"flex items-center gap-3 mb-2",children:[e.jsx(le,{className:`w-5 h-5 ${x?"text-muted-foreground":"text-primary"}`}),e.jsx("span",{className:"font-medium",children:"Local"})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Run CLIProxy Plus binary on this machine"})]}),e.jsxs("button",{onClick:()=>r({remote:{...C,enabled:!0}}),disabled:n,className:`p-4 rounded-lg border-2 text-left transition-all ${x?"border-primary bg-primary/5":"border-border hover:border-muted-foreground/50"}`,children:[e.jsxs("div",{className:"flex items-center gap-3 mb-2",children:[e.jsx(_,{className:`w-5 h-5 ${x?"text-primary":"text-muted-foreground"}`}),e.jsx("span",{className:"font-medium",children:"Remote"})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Connect to a remote CLIProxy Plus server"})]})]})]}),x&&e.jsx(de,{config:s,saving:n,testing:h,testResult:f,displayHost:w,displayPort:T,displayAuthToken:E,setEditedHost:j,setEditedPort:b,setEditedAuthToken:N,onSaveHost:D,onSavePort:O,onSaveAuthToken:U,onSaveConfig:r,onTestConnection:Q}),e.jsxs("div",{className:"space-y-3",children:[e.jsx("h3",{className:"text-base font-medium",children:"Fallback Settings"}),e.jsxs("div",{className:"space-y-3 p-4 rounded-lg border bg-muted/30",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("p",{className:"font-medium text-sm",children:"Enable fallback to local"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Use local proxy if remote is unreachable"})]}),e.jsx(A,{checked:P.enabled??!0,onCheckedChange:o=>r({fallback:{...P,enabled:o}}),disabled:n||!x})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("p",{className:"font-medium text-sm",children:"Auto-start local proxy"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Automatically start local proxy on fallback"})]}),e.jsx(A,{checked:P.auto_start??!1,onCheckedChange:o=>r({fallback:{...P,auto_start:o}}),disabled:n||!x||!P.enabled})]})]})]}),!x&&e.jsx(ie,{config:s,saving:n,displayLocalPort:R,setEditedLocalPort:c,onSaveLocalPort:q,onSaveConfig:r})]})}),e.jsx("div",{className:"p-4 border-t bg-background",children:e.jsxs(B,{variant:"outline",size:"sm",onClick:()=>{m(),g()},disabled:t||n,className:"w-full",children:[e.jsx(I,{className:`w-4 h-4 mr-2 ${t?"animate-spin":""}`}),"Refresh"]})})]})}export{ve as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{j as e}from"./radix-ui-uXQB-q0u.js";import{r as i}from"./react-vendor-B_CU-WTZ.js";import{az as $,aA as P,I as F,aB as U,aw as B,ay as _,i as z,a as A}from"./index-QeBLfRj8.js";import{S as K}from"./switch-B0PXGFIv.js";import{t as D,j as q,D as J,J as V,m as Y,a0 as L,V as X,n as Z}from"./icons-CwFZAiDB.js";import"./tanstack-Coed0rqz.js";import"./notifications-dJQY2-U6.js";import"./utils-CzKF5WmX.js";import"./form-utils-kUVlZZAO.js";import"./code-highlight-DKN39ySy.js";function Q(){const{state:s}=$(),a=P(),[d,l]=i.useState(""),[o,m]=i.useState(""),[f,h]=i.useState(!1),[j,u]=i.useState(!1),S=i.useCallback(async()=>{try{a.setWebSearchLoading(!0),a.setWebSearchError(null);const t=await fetch("/api/websearch");if(!t.ok)throw new Error("Failed to load WebSearch config");const r=await t.json();a.setWebSearchConfig(r)}catch(t){a.setWebSearchError(t.message)}finally{a.setWebSearchLoading(!1)}},[a]),v=i.useCallback(async()=>{try{a.setWebSearchStatusLoading(!0);const t=await fetch("/api/websearch/status");if(!t.ok)throw new Error("Failed to load status");const r=await t.json();a.setWebSearchStatus(r)}catch{}finally{a.setWebSearchStatusLoading(!1)}},[a]),p=i.useCallback(async t=>{const r=s.webSearchConfig;if(!r)return;const w={...r,...t};a.setWebSearchConfig(w);try{a.setWebSearchSaving(!0),a.setWebSearchError(null);const n=await fetch("/api/websearch",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(w)});if(!n.ok){const k=await n.json();throw new Error(k.error||"Failed to save")}const C=await n.json();a.setWebSearchConfig(C.websearch),a.setWebSearchSuccess(!0),setTimeout(()=>a.setWebSearchSuccess(!1),1500)}catch(n){a.setWebSearchConfig(r),a.setWebSearchError(n.message)}finally{a.setWebSearchSaving(!1)}},[s.webSearchConfig,a]);i.useEffect(()=>{s.webSearchConfig&&(l(s.webSearchConfig.providers?.gemini?.model??"gemini-2.5-flash"),m(s.webSearchConfig.providers?.opencode?.model??"opencode/grok-code"))},[s.webSearchConfig]);const x=i.useCallback(async()=>{const t=s.webSearchConfig?.providers?.gemini?.model??"gemini-2.5-flash";if(d!==t){const r=s.webSearchConfig?.providers||{};await p({providers:{...r,gemini:{...r.gemini,model:d}}}),h(!0),setTimeout(()=>h(!1),2e3)}},[d,s.webSearchConfig,p]),g=i.useCallback(async()=>{const t=s.webSearchConfig?.providers?.opencode?.model??"opencode/grok-code";if(o!==t){const r=s.webSearchConfig?.providers||{};await p({providers:{...r,opencode:{...r.opencode,model:o}}}),u(!0),setTimeout(()=>u(!1),2e3)}},[o,s.webSearchConfig,p]);return{config:s.webSearchConfig,status:s.webSearchStatus,loading:s.webSearchLoading,statusLoading:s.webSearchStatusLoading,saving:s.webSearchSaving,error:s.webSearchError,success:s.webSearchSuccess,geminiModelInput:d,setGeminiModelInput:l,opencodeModelInput:o,setOpencodeModelInput:m,geminiModelSaved:f,opencodeModelSaved:j,fetchConfig:S,fetchStatus:v,saveConfig:p,saveGeminiModel:x,saveOpencodeModel:g}}function O({name:s,label:a,badge:d,badgeColor:l,enabled:o,installed:m,statusLoading:f,saving:h,onToggle:j,modelInput:u,setModelInput:S,onModelBlur:v,modelSaved:p,modelPlaceholder:x,showHint:g,setShowHint:t,installCmd:r,docsUrl:w,hintColor:n}){const C=l==="green"?"bg-green-500/10 text-green-600":l==="blue"?"bg-blue-500/10 text-blue-600":"bg-purple-500/10 text-purple-600",k=n==="amber"?"bg-amber-50 dark:bg-amber-900/20 text-amber-700 dark:text-amber-300":n==="blue"?"bg-blue-50 dark:bg-blue-900/20 text-blue-700 dark:text-blue-300":"bg-purple-50 dark:bg-purple-900/20 text-purple-700 dark:text-purple-300",y=n==="amber"?"bg-amber-100 dark:bg-amber-900/40":n==="blue"?"bg-blue-100 dark:bg-blue-900/40":"bg-purple-100 dark:bg-purple-900/40",E=n==="amber"?"text-amber-600 dark:text-amber-400":n==="blue"?"text-blue-600 dark:text-blue-400":"text-purple-600 dark:text-purple-400",M=s==="opencode"?"OpenCode":s.charAt(0).toUpperCase()+s.slice(1);return e.jsxs("div",{className:`rounded-lg border transition-colors ${o?"border-primary border-l-4":"border-border"}`,children:[e.jsxs("div",{className:"flex items-center justify-between p-4",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(D,{className:`w-5 h-5 ${o?"text-primary":"text-muted-foreground"}`}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("p",{className:"font-mono font-medium",children:s}),e.jsx("span",{className:`text-xs px-1.5 py-0.5 rounded font-medium ${C}`,children:d}),m?e.jsx("span",{className:"text-xs px-1.5 py-0.5 rounded bg-green-500/10 text-green-600 font-medium",children:"installed"}):e.jsx("span",{className:"text-xs px-1.5 py-0.5 rounded bg-amber-500/10 text-amber-600 font-medium",children:"not installed"})]}),e.jsx("p",{className:"text-sm text-muted-foreground",children:a})]})]}),e.jsx(K,{checked:o,onCheckedChange:j,disabled:h||!m})]}),o&&u!==void 0&&S&&v&&e.jsx("div",{className:"px-4 pb-4 pt-0",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("label",{className:"text-sm text-muted-foreground whitespace-nowrap",children:"Model:"}),e.jsx(F,{value:u,onChange:I=>S(I.target.value),onBlur:v,placeholder:x,className:"h-8 text-sm font-mono",disabled:h}),p&&e.jsxs("span",{className:"flex items-center gap-1 text-green-600 dark:text-green-400 text-xs animate-in fade-in duration-200",children:[e.jsx(q,{className:"w-3.5 h-3.5"}),"Saved"]})]})}),!m&&!f&&e.jsxs("div",{className:"px-4 pb-4 pt-0 border-t border-border/50",children:[e.jsxs("button",{onClick:()=>t(!g),className:`flex items-center gap-2 text-sm hover:underline w-full py-2 ${E}`,children:[g?e.jsx(J,{className:"w-4 h-4"}):e.jsx(V,{className:"w-4 h-4"}),"How to install ",M," CLI"]}),g&&e.jsxs("div",{className:`mt-2 p-3 rounded-md text-sm ${k}`,children:[e.jsxs("p",{className:"mb-2",children:["Install globally"," ",d==="GROK_API_KEY"?"(requires xAI API key)":"(FREE tier available)",":"]}),e.jsx("code",{className:`text-sm px-2 py-1 rounded font-mono block mb-2 ${y}`,children:r}),e.jsxs("a",{href:w,target:"_blank",rel:"noopener noreferrer",className:"hover:underline inline-flex items-center gap-1",children:[e.jsx(Y,{className:"w-3 h-3"}),"View documentation"]})]})]})]})}function ce(){const{config:s,status:a,loading:d,statusLoading:l,saving:o,error:m,success:f,geminiModelInput:h,setGeminiModelInput:j,opencodeModelInput:u,setOpencodeModelInput:S,geminiModelSaved:v,opencodeModelSaved:p,fetchConfig:x,fetchStatus:g,saveConfig:t,saveGeminiModel:r,saveOpencodeModel:w}=Q(),{fetchRawConfig:n}=U(),[C,k]=i.useState(!1),[y,E]=i.useState(!1),[M,I]=i.useState(!1);i.useEffect(()=>{x(),g(),n()},[x,g,n]);const N=s?.providers?.gemini?.enabled??!1,W=s?.providers?.grok?.enabled??!1,G=s?.providers?.opencode?.enabled??!1,H=()=>{const c=s?.providers||{},b=c.gemini?.enabled??!1;t({enabled:!b||W||G,providers:{...c,gemini:{...c.gemini,enabled:!b}}})},R=()=>{const c=s?.providers||{},b=c.grok?.enabled??!1;t({enabled:N||!b||G,providers:{...c,grok:{...c.grok,enabled:!b}}})},T=()=>{const c=s?.providers||{},b=c.opencode?.enabled??!1;t({enabled:N||W||!b,providers:{...c,opencode:{...c.opencode,enabled:!b}}})};return d?e.jsx("div",{className:"flex-1 flex items-center justify-center",children:e.jsxs("div",{className:"flex items-center gap-3 text-muted-foreground",children:[e.jsx(L,{className:"w-5 h-5 animate-spin"}),e.jsx("span",{children:"Loading..."})]})}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:`absolute left-5 right-5 top-20 z-10 transition-all duration-200 ease-out ${m||f?"opacity-100 translate-y-0":"opacity-0 -translate-y-2 pointer-events-none"}`,children:[m&&e.jsxs(B,{variant:"destructive",className:"py-2 shadow-lg",children:[e.jsx(X,{className:"h-4 w-4"}),e.jsx(_,{children:m})]}),f&&e.jsxs("div",{className:"flex items-center gap-2 px-3 py-2 rounded-md border border-green-200 bg-green-50 text-green-700 shadow-lg dark:border-green-900/50 dark:bg-green-900/90 dark:text-green-300",children:[e.jsx(Z,{className:"h-4 w-4 shrink-0"}),e.jsx("span",{className:"text-sm font-medium",children:"Saved"})]})]}),e.jsx(z,{className:"flex-1",children:e.jsxs("div",{className:"p-5 space-y-6",children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:"CLI-based web search for third-party profiles (gemini, codex, agy, etc.)"}),e.jsxs("div",{className:"flex items-center justify-between p-4 rounded-lg bg-muted/50",children:[e.jsxs("div",{children:[e.jsx("p",{className:"font-medium",children:N?"WebSearch enabled":"WebSearch disabled"}),l?e.jsx("p",{className:"text-sm text-muted-foreground",children:"Checking status..."}):a?.readiness?e.jsx("p",{className:"text-sm text-muted-foreground",children:a.readiness.message}):null]}),e.jsx(A,{variant:"ghost",size:"sm",onClick:g,disabled:l,children:e.jsx(L,{className:`w-4 h-4 ${l?"animate-spin":""}`})})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsx("h3",{className:"text-base font-medium",children:"Providers"}),e.jsx(O,{name:"gemini",label:"Google Gemini CLI (1000 req/day free)",badge:"FREE",badgeColor:"green",enabled:N,installed:a?.geminiCli?.installed??!1,statusLoading:l,saving:o,onToggle:H,modelInput:h,setModelInput:j,onModelBlur:r,modelSaved:v,modelPlaceholder:"gemini-2.5-flash",showHint:C,setShowHint:k,installCmd:"npm install -g @google/gemini-cli",docsUrl:"https://github.com/google-gemini/gemini-cli",hintColor:"amber"}),e.jsx(O,{name:"opencode",label:"OpenCode (web search via Zen)",badge:"FREE",badgeColor:"green",enabled:G,installed:a?.opencodeCli?.installed??!1,statusLoading:l,saving:o,onToggle:T,modelInput:u,setModelInput:S,onModelBlur:w,modelSaved:p,modelPlaceholder:"opencode/grok-code",showHint:y,setShowHint:E,installCmd:"curl -fsSL https://opencode.ai/install | bash",docsUrl:"https://github.com/sst/opencode",hintColor:"purple"}),e.jsx(O,{name:"grok",label:"xAI Grok CLI (web + X search)",badge:"GROK_API_KEY",badgeColor:"blue",enabled:W,installed:a?.grokCli?.installed??!1,statusLoading:l,saving:o,onToggle:R,showHint:M,setShowHint:I,installCmd:"npm install -g @vibe-kit/grok-cli",docsUrl:"https://github.com/superagent-ai/grok-cli",hintColor:"blue"})]})]})}),e.jsx("div",{className:"p-4 border-t bg-background",children:e.jsxs(A,{variant:"outline",size:"sm",onClick:()=>{x(),n()},disabled:d||o,className:"w-full",children:[e.jsx(L,{className:`w-4 h-4 mr-2 ${d?"animate-spin":""}`}),"Refresh"]})})]})}export{ce as default};
|