@kaitranntt/ccs 7.50.0-dev.1 → 7.50.0-dev.10

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.
Files changed (208) hide show
  1. package/README.md +65 -4
  2. package/config/base-iflow.settings.json +4 -4
  3. package/dist/api/services/profile-writer.d.ts +1 -1
  4. package/dist/api/services/profile-writer.d.ts.map +1 -1
  5. package/dist/api/services/profile-writer.js +18 -5
  6. package/dist/api/services/profile-writer.js.map +1 -1
  7. package/dist/auth/account-context.d.ts +11 -0
  8. package/dist/auth/account-context.d.ts.map +1 -1
  9. package/dist/auth/account-context.js +42 -8
  10. package/dist/auth/account-context.js.map +1 -1
  11. package/dist/auth/auth-commands.d.ts.map +1 -1
  12. package/dist/auth/auth-commands.js +9 -0
  13. package/dist/auth/auth-commands.js.map +1 -1
  14. package/dist/auth/commands/create-command-env.d.ts +3 -0
  15. package/dist/auth/commands/create-command-env.d.ts.map +1 -0
  16. package/dist/auth/commands/create-command-env.js +55 -0
  17. package/dist/auth/commands/create-command-env.js.map +1 -0
  18. package/dist/auth/commands/create-command.d.ts.map +1 -1
  19. package/dist/auth/commands/create-command.js +136 -30
  20. package/dist/auth/commands/create-command.js.map +1 -1
  21. package/dist/auth/commands/list-command.d.ts.map +1 -1
  22. package/dist/auth/commands/list-command.js +5 -1
  23. package/dist/auth/commands/list-command.js.map +1 -1
  24. package/dist/auth/commands/show-command.d.ts.map +1 -1
  25. package/dist/auth/commands/show-command.js +1 -0
  26. package/dist/auth/commands/show-command.js.map +1 -1
  27. package/dist/auth/commands/types.d.ts +3 -0
  28. package/dist/auth/commands/types.d.ts.map +1 -1
  29. package/dist/auth/commands/types.js +24 -0
  30. package/dist/auth/commands/types.js.map +1 -1
  31. package/dist/auth/profile-detector.d.ts.map +1 -1
  32. package/dist/auth/profile-detector.js +1 -0
  33. package/dist/auth/profile-detector.js.map +1 -1
  34. package/dist/auth/profile-registry.d.ts +2 -0
  35. package/dist/auth/profile-registry.d.ts.map +1 -1
  36. package/dist/auth/profile-registry.js +45 -7
  37. package/dist/auth/profile-registry.js.map +1 -1
  38. package/dist/ccs.js +46 -8
  39. package/dist/ccs.js.map +1 -1
  40. package/dist/cliproxy/account-safety.d.ts.map +1 -1
  41. package/dist/cliproxy/account-safety.js +4 -0
  42. package/dist/cliproxy/account-safety.js.map +1 -1
  43. package/dist/cliproxy/antigravity-responsibility.d.ts +36 -0
  44. package/dist/cliproxy/antigravity-responsibility.d.ts.map +1 -0
  45. package/dist/cliproxy/antigravity-responsibility.js +171 -0
  46. package/dist/cliproxy/antigravity-responsibility.js.map +1 -0
  47. package/dist/cliproxy/auth/auth-types.d.ts +2 -0
  48. package/dist/cliproxy/auth/auth-types.d.ts.map +1 -1
  49. package/dist/cliproxy/auth/oauth-handler.d.ts.map +1 -1
  50. package/dist/cliproxy/auth/oauth-handler.js +18 -0
  51. package/dist/cliproxy/auth/oauth-handler.js.map +1 -1
  52. package/dist/cliproxy/config/env-builder.d.ts.map +1 -1
  53. package/dist/cliproxy/config/env-builder.js +57 -0
  54. package/dist/cliproxy/config/env-builder.js.map +1 -1
  55. package/dist/cliproxy/config/generator.d.ts +2 -1
  56. package/dist/cliproxy/config/generator.d.ts.map +1 -1
  57. package/dist/cliproxy/config/generator.js +18 -8
  58. package/dist/cliproxy/config/generator.js.map +1 -1
  59. package/dist/cliproxy/executor/index.d.ts.map +1 -1
  60. package/dist/cliproxy/executor/index.js +30 -0
  61. package/dist/cliproxy/executor/index.js.map +1 -1
  62. package/dist/commands/help-command.d.ts.map +1 -1
  63. package/dist/commands/help-command.js +11 -1
  64. package/dist/commands/help-command.js.map +1 -1
  65. package/dist/config/migration-manager.d.ts.map +1 -1
  66. package/dist/config/migration-manager.js +19 -0
  67. package/dist/config/migration-manager.js.map +1 -1
  68. package/dist/config/unified-config-loader.d.ts +11 -1
  69. package/dist/config/unified-config-loader.d.ts.map +1 -1
  70. package/dist/config/unified-config-loader.js +127 -59
  71. package/dist/config/unified-config-loader.js.map +1 -1
  72. package/dist/config/unified-config-types.d.ts +16 -0
  73. package/dist/config/unified-config-types.d.ts.map +1 -1
  74. package/dist/config/unified-config-types.js +8 -1
  75. package/dist/config/unified-config-types.js.map +1 -1
  76. package/dist/management/instance-manager.d.ts +1 -0
  77. package/dist/management/instance-manager.d.ts.map +1 -1
  78. package/dist/management/instance-manager.js +14 -8
  79. package/dist/management/instance-manager.js.map +1 -1
  80. package/dist/management/profile-context-sync-lock.d.ts +14 -0
  81. package/dist/management/profile-context-sync-lock.d.ts.map +1 -0
  82. package/dist/management/profile-context-sync-lock.js +174 -0
  83. package/dist/management/profile-context-sync-lock.js.map +1 -0
  84. package/dist/management/shared-manager.d.ts +18 -0
  85. package/dist/management/shared-manager.d.ts.map +1 -1
  86. package/dist/management/shared-manager.js +145 -6
  87. package/dist/management/shared-manager.js.map +1 -1
  88. package/dist/targets/droid-adapter.d.ts +1 -1
  89. package/dist/targets/droid-adapter.d.ts.map +1 -1
  90. package/dist/targets/droid-adapter.js +16 -4
  91. package/dist/targets/droid-adapter.js.map +1 -1
  92. package/dist/targets/droid-config-manager.d.ts +9 -1
  93. package/dist/targets/droid-config-manager.d.ts.map +1 -1
  94. package/dist/targets/droid-config-manager.js +131 -3
  95. package/dist/targets/droid-config-manager.js.map +1 -1
  96. package/dist/targets/droid-provider.d.ts +40 -0
  97. package/dist/targets/droid-provider.d.ts.map +1 -0
  98. package/dist/targets/droid-provider.js +140 -0
  99. package/dist/targets/droid-provider.js.map +1 -0
  100. package/dist/targets/droid-reasoning-runtime.d.ts +14 -0
  101. package/dist/targets/droid-reasoning-runtime.d.ts.map +1 -0
  102. package/dist/targets/droid-reasoning-runtime.js +42 -0
  103. package/dist/targets/droid-reasoning-runtime.js.map +1 -0
  104. package/dist/targets/index.d.ts +2 -0
  105. package/dist/targets/index.d.ts.map +1 -1
  106. package/dist/targets/index.js +4 -1
  107. package/dist/targets/index.js.map +1 -1
  108. package/dist/targets/target-adapter.d.ts +6 -0
  109. package/dist/targets/target-adapter.d.ts.map +1 -1
  110. package/dist/types/config.d.ts +2 -0
  111. package/dist/types/config.d.ts.map +1 -1
  112. package/dist/types/config.js.map +1 -1
  113. package/dist/ui/assets/accounts-y2u0CVK8.js +1 -0
  114. package/dist/ui/assets/{alert-dialog-DmrIcJav.js → alert-dialog-CetY4Iww.js} +1 -1
  115. package/dist/ui/assets/api-5q1FT1uL.js +1 -0
  116. package/dist/ui/assets/auth-section-CaQeee-F.js +1 -0
  117. package/dist/ui/assets/{backups-section-jwtuA5Ay.js → backups-section-hF88BjYJ.js} +1 -1
  118. package/dist/ui/assets/{checkbox-CNqHZx7Z.js → checkbox-Dhm5Fzkb.js} +1 -1
  119. package/dist/ui/assets/cliproxy-BeYNWmY_.js +3 -0
  120. package/dist/ui/assets/{cliproxy-control-panel--WUVyBIk.js → cliproxy-control-panel-CJELeI80.js} +1 -1
  121. package/dist/ui/assets/{confirm-dialog-CQNxkz9X.js → confirm-dialog-Dn3SrwNV.js} +1 -1
  122. package/dist/ui/assets/{copilot-DLxxmnsW.js → copilot-vwT-4_V4.js} +1 -1
  123. package/dist/ui/assets/{cursor-YRIza7sP.js → cursor-CN3lIX63.js} +1 -1
  124. package/dist/ui/assets/droid-DBP2yCY7.js +2 -0
  125. package/dist/ui/assets/globalenv-section-DNKAJasL.js +1 -0
  126. package/dist/ui/assets/{health-BWPd6F4h.js → health-C7tNiLzc.js} +1 -1
  127. package/dist/ui/assets/icons-DrewC9c3.js +1 -0
  128. package/dist/ui/assets/index-C8-ef-r7.js +1 -0
  129. package/dist/ui/assets/{index-D244tv89.js → index-MGh88HoC.js} +1 -1
  130. package/dist/ui/assets/{index-BlldLmNl.js → index-QBUSDLTx.js} +1 -1
  131. package/dist/ui/assets/index-k-HuyjpO.js +47 -0
  132. package/dist/ui/assets/index-s-oTl3hW.css +1 -0
  133. package/dist/ui/assets/index-uYnNU6Ut.js +1 -0
  134. package/dist/ui/assets/proxy-status-widget-CIm5vKY7.js +1 -0
  135. package/dist/ui/assets/{radix-ui-DIWAxjEp.js → radix-ui-C1Gpgz6I.js} +1 -1
  136. package/dist/ui/assets/{separator-OcJLDgYQ.js → separator-BLVyAGAm.js} +1 -1
  137. package/dist/ui/assets/shared-CHH09ZNi.js +8 -0
  138. package/dist/ui/assets/{switch-s8pp-m8L.js → switch-CwLyB4JK.js} +1 -1
  139. package/dist/ui/assets/{tanstack-Hn82hibe.js → tanstack-DDJIhNJd.js} +1 -1
  140. package/dist/ui/assets/{updates-BQRhDVbP.js → updates-VlxL3aum.js} +1 -1
  141. package/dist/ui/index.html +5 -5
  142. package/dist/web-server/model-pricing.d.ts.map +1 -1
  143. package/dist/web-server/model-pricing.js +114 -22
  144. package/dist/web-server/model-pricing.js.map +1 -1
  145. package/dist/web-server/routes/account-route-helpers.d.ts +20 -0
  146. package/dist/web-server/routes/account-route-helpers.d.ts.map +1 -0
  147. package/dist/web-server/routes/account-route-helpers.js +34 -0
  148. package/dist/web-server/routes/account-route-helpers.js.map +1 -0
  149. package/dist/web-server/routes/account-routes.d.ts.map +1 -1
  150. package/dist/web-server/routes/account-routes.js +160 -27
  151. package/dist/web-server/routes/account-routes.js.map +1 -1
  152. package/dist/web-server/routes/cliproxy-auth-routes.d.ts.map +1 -1
  153. package/dist/web-server/routes/cliproxy-auth-routes.js +58 -24
  154. package/dist/web-server/routes/cliproxy-auth-routes.js.map +1 -1
  155. package/dist/web-server/routes/config-routes.d.ts.map +1 -1
  156. package/dist/web-server/routes/config-routes.js +73 -0
  157. package/dist/web-server/routes/config-routes.js.map +1 -1
  158. package/dist/web-server/routes/droid-routes.d.ts +3 -0
  159. package/dist/web-server/routes/droid-routes.d.ts.map +1 -0
  160. package/dist/web-server/routes/droid-routes.js +61 -0
  161. package/dist/web-server/routes/droid-routes.js.map +1 -0
  162. package/dist/web-server/routes/index.d.ts.map +1 -1
  163. package/dist/web-server/routes/index.js +3 -0
  164. package/dist/web-server/routes/index.js.map +1 -1
  165. package/dist/web-server/routes/profile-routes.d.ts.map +1 -1
  166. package/dist/web-server/routes/profile-routes.js +29 -3
  167. package/dist/web-server/routes/profile-routes.js.map +1 -1
  168. package/dist/web-server/routes/route-helpers.d.ts +2 -1
  169. package/dist/web-server/routes/route-helpers.d.ts.map +1 -1
  170. package/dist/web-server/routes/route-helpers.js +20 -1
  171. package/dist/web-server/routes/route-helpers.js.map +1 -1
  172. package/dist/web-server/routes/settings-routes.d.ts.map +1 -1
  173. package/dist/web-server/routes/settings-routes.js +110 -12
  174. package/dist/web-server/routes/settings-routes.js.map +1 -1
  175. package/dist/web-server/services/compatible-cli-docs-registry.d.ts +23 -0
  176. package/dist/web-server/services/compatible-cli-docs-registry.d.ts.map +1 -0
  177. package/dist/web-server/services/compatible-cli-docs-registry.js +81 -0
  178. package/dist/web-server/services/compatible-cli-docs-registry.js.map +1 -0
  179. package/dist/web-server/services/compatible-cli-json-file-service.d.ts +41 -0
  180. package/dist/web-server/services/compatible-cli-json-file-service.d.ts.map +1 -0
  181. package/dist/web-server/services/compatible-cli-json-file-service.js +205 -0
  182. package/dist/web-server/services/compatible-cli-json-file-service.js.map +1 -0
  183. package/dist/web-server/services/compatible-cli-types.d.ts +82 -0
  184. package/dist/web-server/services/compatible-cli-types.d.ts.map +1 -0
  185. package/dist/web-server/services/compatible-cli-types.js +3 -0
  186. package/dist/web-server/services/compatible-cli-types.js.map +1 -0
  187. package/dist/web-server/services/droid-dashboard-service.d.ts +29 -0
  188. package/dist/web-server/services/droid-dashboard-service.d.ts.map +1 -0
  189. package/dist/web-server/services/droid-dashboard-service.js +238 -0
  190. package/dist/web-server/services/droid-dashboard-service.js.map +1 -0
  191. package/dist/web-server/shared-routes.d.ts.map +1 -1
  192. package/dist/web-server/shared-routes.js +350 -52
  193. package/dist/web-server/shared-routes.js.map +1 -1
  194. package/lib/hooks/websearch-transformer.cjs +78 -52
  195. package/package.json +4 -2
  196. package/scripts/maintainability-check.js +163 -0
  197. package/dist/ui/assets/accounts-BKK-Lc16.js +0 -1
  198. package/dist/ui/assets/api-DzTwRtww.js +0 -1
  199. package/dist/ui/assets/auth-section-CP_2r8oJ.js +0 -1
  200. package/dist/ui/assets/cliproxy-CtO9BwgG.js +0 -3
  201. package/dist/ui/assets/globalenv-section-vUSIK5rf.js +0 -1
  202. package/dist/ui/assets/icons-Dk2sL3Mr.js +0 -1
  203. package/dist/ui/assets/index-B9dJZNls.js +0 -1
  204. package/dist/ui/assets/index-BZdHAol5.js +0 -1
  205. package/dist/ui/assets/index-DEDy1J8t.css +0 -1
  206. package/dist/ui/assets/index-PWMOllOf.js +0 -47
  207. package/dist/ui/assets/proxy-status-widget-MlyNgoPh.js +0 -1
  208. package/dist/ui/assets/shared-LxAdbm4g.js +0 -1
@@ -1,3 +0,0 @@
1
- import{j as e}from"./radix-ui-DIWAxjEp.js";import{r as o}from"./react-vendor-CNOkPC89.js";import{a as ke,u as rs,b as Fs}from"./tanstack-Hn82hibe.js";import{b as T,C as os,a as ls,c as G,P as he,L as Y,I as le,q as Ce,r as ye,s as Se,t as Ae,v as ce,a1 as cs,a2 as Us,a3 as Hs,a4 as Ks,u as ds,a5 as Pe,a6 as Me,a7 as Te,a8 as Oe,a9 as us,aa as Qe,ab as qs,ac as Gs,ad as $s,ae as ms,W as pe,B as U,af as Be,ag as Qs,ah as Bs,ai as zs,aj as Vs,ak as ze,al as Ve,am as Js,w as xs,m as Ee,an as Ws,ao as Xs,ap as Ys,l as Zs,aq as et,ar as st,as as tt,at,au as nt,av as it,aw as te,T as ae,o as ne,p as ie,ax as rt,ay as ot,az as lt,aA as Je,aB as We,aC as ct,aD as dt,aE as ut,aF as mt,aG as xt,aH as pt,aI as ht,O as ft,Q as gt,R as Xe,U as Ye,aJ as jt,aK as vt,aL as Nt,aM as wt,aN as bt,aO as kt,aP as Ct,aQ as yt,aR as St,aS as At,aT as Pt,S as Mt}from"./index-PWMOllOf.js";import{C as Ne}from"./default-ports-1QQSffYX.js";import{t as H}from"./notifications-B2HqRBj7.js";import{b as ps,L as z,m as de,y as Tt,j as W,l as hs,an as _e,R as De,n as oe,a0 as me,T as fs,ao as Ot,ap as fe,Z as xe,I as gs,f as Et,a2 as js,aq as _t,ah as Dt,X as Re,$ as vs,s as Ns,t as we,ar as Rt,p as Ze,as as Lt,ag as ws,q as It,at as es,k as Ft,a1 as Ut,ak as Ht,au as bs}from"./icons-Dk2sL3Mr.js";import{C as ks}from"./checkbox-CNqHZx7Z.js";import{C as Kt}from"./confirm-dialog-CQNxkz9X.js";import{S as Le}from"./separator-OcJLDgYQ.js";import{S as Cs}from"./switch-s8pp-m8L.js";import{P as qt}from"./proxy-status-widget-MlyNgoPh.js";import"./utils-CzKF5WmX.js";import"./form-utils-Cn_Uld6y.js";import"./code-highlight-BRUf_pqB.js";import"./alert-dialog-DmrIcJav.js";const ue={agy:{provider:"agy",displayName:"Antigravity",defaultModel:"claude-opus-4-6-thinking",models:[{id:"claude-opus-4-6-thinking",name:"Claude Opus 4.6 Thinking",description:"Latest flagship, extended thinking",extendedContext:!1,presetMapping:{default:"claude-opus-4-6-thinking",opus:"claude-opus-4-6-thinking",sonnet:"claude-sonnet-4-6-thinking",haiku:"claude-sonnet-4-6"}},{id:"claude-opus-4-5-thinking",name:"Claude Opus 4.5 Thinking",description:"Previous flagship, extended thinking",presetMapping:{default:"claude-opus-4-5-thinking",opus:"claude-opus-4-5-thinking",sonnet:"claude-sonnet-4-6-thinking",haiku:"claude-sonnet-4-6"}},{id:"claude-sonnet-4-6-thinking",name:"Claude Sonnet 4.6 Thinking",description:"Latest Sonnet with extended thinking",presetMapping:{default:"claude-sonnet-4-6-thinking",opus:"claude-opus-4-6-thinking",sonnet:"claude-sonnet-4-6-thinking",haiku:"claude-sonnet-4-6"}},{id:"claude-sonnet-4-6",name:"Claude Sonnet 4.6",description:"Latest Sonnet baseline",presetMapping:{default:"claude-sonnet-4-6",opus:"claude-opus-4-6-thinking",sonnet:"claude-sonnet-4-6",haiku:"claude-sonnet-4-6"}},{id:"claude-sonnet-4-5-thinking",name:"Claude Sonnet 4.5 Thinking",description:"Balanced with extended thinking",presetMapping:{default:"claude-sonnet-4-5-thinking",opus:"claude-opus-4-6-thinking",sonnet:"claude-sonnet-4-5-thinking",haiku:"claude-sonnet-4-5"}},{id:"claude-sonnet-4-5",name:"Claude Sonnet 4.5",description:"Fast and capable",presetMapping:{default:"claude-sonnet-4-5",opus:"claude-opus-4-6-thinking",sonnet:"claude-sonnet-4-5",haiku:"claude-sonnet-4-5"}},{id:"gemini-3-pro-preview",name:"Gemini 3 Pro",description:"Google latest model via Antigravity",extendedContext:!0,presetMapping:{default:"gemini-3-pro-preview",opus:"gemini-3-pro-preview",sonnet:"gemini-3-pro-preview",haiku:"gemini-3-flash-preview"}},{id:"gemini-3-flash-preview",name:"Gemini 3 Flash",description:"Fast Gemini model via Antigravity",extendedContext:!0,presetMapping:{default:"gemini-3-flash-preview",opus:"gemini-3-pro-preview",sonnet:"gemini-3-pro-preview",haiku:"gemini-3-flash-preview"}}]},gemini:{provider:"gemini",displayName:"Gemini",defaultModel:"gemini-2.5-pro",models:[{id:"gemini-3-pro-preview",name:"Gemini 3 Pro",tier:"paid",description:"Latest model, requires paid Google account",extendedContext:!0,presetMapping:{default:"gemini-3-pro-preview",opus:"gemini-3-pro-preview",sonnet:"gemini-3-pro-preview",haiku:"gemini-3-flash-preview"}},{id:"gemini-3-flash-preview",name:"Gemini 3 Flash",tier:"paid",description:"Fast Gemini 3 model, requires paid Google account",extendedContext:!0,presetMapping:{default:"gemini-3-flash-preview",opus:"gemini-3-pro-preview",sonnet:"gemini-3-pro-preview",haiku:"gemini-3-flash-preview"}},{id:"gemini-2.5-pro",name:"Gemini 2.5 Pro",description:"Stable, works with free Google account",extendedContext:!0,presetMapping:{default:"gemini-2.5-pro",opus:"gemini-2.5-pro",sonnet:"gemini-2.5-pro",haiku:"gemini-2.5-flash"}}]},codex:{provider:"codex",displayName:"Codex",defaultModel:"gpt-5.3-codex",models:[{id:"gpt-5.3-codex",name:"GPT-5.3 Codex",description:"Supports up to xhigh effort",presetMapping:{default:"gpt-5.3-codex",opus:"gpt-5.3-codex",sonnet:"gpt-5.3-codex",haiku:"gpt-5-mini"}},{id:"gpt-5.2-codex",name:"GPT-5.2 Codex",description:"Previous stable Codex model",presetMapping:{default:"gpt-5.2-codex",opus:"gpt-5.2-codex",sonnet:"gpt-5.2-codex",haiku:"gpt-5-mini"}},{id:"gpt-5-mini",name:"GPT-5 Mini",description:"Fast, capped at high effort (no xhigh)",presetMapping:{default:"gpt-5-mini",opus:"gpt-5.3-codex",sonnet:"gpt-5-mini",haiku:"gpt-5-mini"}},{id:"gpt-5.1-codex-max",name:"Codex Max (5.1)",description:"Legacy most capable Codex model",presetMapping:{default:"gpt-5.1-codex-max",opus:"gpt-5.1-codex-max",sonnet:"gpt-5.1-codex-max",haiku:"gpt-5.1-codex-mini"}},{id:"gpt-5.2",name:"GPT 5.2",description:"Latest GPT model",presetMapping:{default:"gpt-5.2",opus:"gpt-5.2",sonnet:"gpt-5.2",haiku:"gpt-5.2"}},{id:"gpt-5.1-codex-mini",name:"Codex Mini",description:"Fast and efficient Codex model"}]},qwen:{provider:"qwen",displayName:"Qwen",defaultModel:"qwen3-coder-plus",models:[{id:"qwen3-coder-plus",name:"Qwen3 Coder Plus",description:"Code-focused model (1M context)",presetMapping:{default:"qwen3-coder-plus",opus:"qwen3-max",sonnet:"qwen3-coder-plus",haiku:"qwen3-coder-flash"}},{id:"qwen3-max",name:"Qwen3 Max",description:"Flagship model (256K context)",presetMapping:{default:"qwen3-max",opus:"qwen3-max",sonnet:"qwen3-coder-plus",haiku:"qwen3-coder-flash"}},{id:"qwen3-max-preview",name:"Qwen3 Max Preview",description:"Preview with thinking support (256K)",presetMapping:{default:"qwen3-max-preview",opus:"qwen3-max-preview",sonnet:"qwen3-max",haiku:"qwen3-coder-flash"}},{id:"qwen3-235b",name:"Qwen3 235B",description:"Large 235B A22B model",presetMapping:{default:"qwen3-235b",opus:"qwen3-max",sonnet:"qwen3-235b",haiku:"qwen3-coder-flash"}},{id:"qwen3-vl-plus",name:"Qwen3 VL Plus",description:"Vision-language multimodal"},{id:"qwen3-coder-flash",name:"Qwen3 Coder Flash",description:"Fast code generation"},{id:"qwen3-32b",name:"Qwen3 32B",description:"Qwen3 32B model"}]},iflow:{provider:"iflow",displayName:"iFlow",defaultModel:"iflow-default",models:[{id:"iflow-default",name:"iFlow Default",description:"Default iFlow model"}]},kimi:{provider:"kimi",displayName:"Kimi (Moonshot)",defaultModel:"kimi-k2.5",models:[{id:"kimi-k2.5",name:"Kimi K2.5",description:"Latest multimodal model (262K context)",presetMapping:{default:"kimi-k2.5",opus:"kimi-k2.5",sonnet:"kimi-k2-thinking",haiku:"kimi-k2"}},{id:"kimi-k2-thinking",name:"Kimi K2 Thinking",description:"Extended reasoning model",presetMapping:{default:"kimi-k2-thinking",opus:"kimi-k2.5",sonnet:"kimi-k2-thinking",haiku:"kimi-k2"}},{id:"kimi-k2",name:"Kimi K2",description:"Flagship coding model"}]},kiro:{provider:"kiro",displayName:"Kiro (AWS)",defaultModel:"kiro-claude-sonnet-4-5",models:[{id:"kiro-claude-opus-4-5",name:"Kiro Claude Opus 4.5",description:"Claude Opus 4.5 via Kiro (2.2x credit)",presetMapping:{default:"kiro-claude-opus-4-5",opus:"kiro-claude-opus-4-5",sonnet:"kiro-claude-sonnet-4-5",haiku:"kiro-claude-haiku-4-5"}},{id:"kiro-claude-sonnet-4-5",name:"Kiro Claude Sonnet 4.5",description:"Claude Sonnet 4.5 via Kiro (1.3x credit)",presetMapping:{default:"kiro-claude-sonnet-4-5",opus:"kiro-claude-opus-4-5",sonnet:"kiro-claude-sonnet-4-5",haiku:"kiro-claude-haiku-4-5"}},{id:"kiro-claude-sonnet-4",name:"Kiro Claude Sonnet 4",description:"Claude Sonnet 4 via Kiro (1.3x credit)",presetMapping:{default:"kiro-claude-sonnet-4",opus:"kiro-claude-opus-4-5",sonnet:"kiro-claude-sonnet-4",haiku:"kiro-claude-haiku-4-5"}},{id:"kiro-claude-haiku-4-5",name:"Kiro Claude Haiku 4.5",description:"Claude Haiku 4.5 via Kiro (0.4x credit)"}]},ghcp:{provider:"ghcp",displayName:"GitHub Copilot (OAuth)",defaultModel:"claude-sonnet-4.5",models:[{id:"claude-opus-4.5",name:"Claude Opus 4.5",description:"Anthropic Claude Opus 4.5 via GitHub Copilot",presetMapping:{default:"claude-opus-4.5",opus:"claude-opus-4.5",sonnet:"claude-sonnet-4.5",haiku:"claude-haiku-4.5"}},{id:"claude-sonnet-4.5",name:"Claude Sonnet 4.5",description:"Anthropic Claude Sonnet 4.5 via GitHub Copilot",presetMapping:{default:"claude-sonnet-4.5",opus:"claude-opus-4.5",sonnet:"claude-sonnet-4.5",haiku:"claude-haiku-4.5"}},{id:"claude-sonnet-4",name:"Claude Sonnet 4",description:"Anthropic Claude Sonnet 4 via GitHub Copilot"},{id:"claude-haiku-4.5",name:"Claude Haiku 4.5",description:"Anthropic Claude Haiku 4.5 via GitHub Copilot"},{id:"gpt-5.2",name:"GPT-5.2",description:"OpenAI GPT-5.2 via GitHub Copilot",presetMapping:{default:"gpt-5.2",opus:"gpt-5.2",sonnet:"gpt-5.1",haiku:"gpt-5-mini"}},{id:"gpt-5.1",name:"GPT-5.1",description:"OpenAI GPT-5.1 via GitHub Copilot"},{id:"gpt-5",name:"GPT-5",description:"OpenAI GPT-5 via GitHub Copilot"},{id:"gpt-5-mini",name:"GPT-5 Mini",description:"OpenAI GPT-5 Mini via GitHub Copilot"},{id:"gemini-3-pro",name:"Gemini 3 Pro",description:"Google Gemini 3 Pro via GitHub Copilot"}]},claude:{provider:"claude",displayName:"Claude (Anthropic)",defaultModel:"claude-sonnet-4-5-20250929",models:[{id:"claude-opus-4-6",name:"Claude Opus 4.6",description:"Latest flagship model",extendedContext:!0,presetMapping:{default:"claude-opus-4-6",opus:"claude-opus-4-6",sonnet:"claude-sonnet-4-5-20250929",haiku:"claude-haiku-4-5-20251001"}},{id:"claude-opus-4-5-20251101",name:"Claude Opus 4.5",description:"Most capable Claude model",extendedContext:!0,presetMapping:{default:"claude-opus-4-5-20251101",opus:"claude-opus-4-5-20251101",sonnet:"claude-sonnet-4-5-20250929",haiku:"claude-haiku-4-5-20251001"}},{id:"claude-sonnet-4-5-20250929",name:"Claude Sonnet 4.5",description:"Balanced performance and speed",extendedContext:!0,presetMapping:{default:"claude-sonnet-4-5-20250929",opus:"claude-opus-4-5-20251101",sonnet:"claude-sonnet-4-5-20250929",haiku:"claude-haiku-4-5-20251001"}},{id:"claude-sonnet-4-20250514",name:"Claude Sonnet 4",description:"Previous generation Sonnet",extendedContext:!0,presetMapping:{default:"claude-sonnet-4-20250514",opus:"claude-opus-4-5-20251101",sonnet:"claude-sonnet-4-20250514",haiku:"claude-haiku-4-5-20251001"}},{id:"claude-haiku-4-5-20251001",name:"Claude Haiku 4.5",description:"Fast and efficient"}]}},je="ccs-internal-managed";async function Gt(){try{const s=await fetch("/api/settings/auth/tokens/raw");return s.ok?(await s.json())?.apiKey?.value??je:je}catch{return je}}async function be(s,a){const t=ue[s];if(!t)return{success:!1};const n=t.models[0],i=n?.presetMapping||{default:t.defaultModel,opus:t.defaultModel,sonnet:t.defaultModel,haiku:t.defaultModel},r=await Gt(),d={env:{ANTHROPIC_BASE_URL:`http://127.0.0.1:${Ne}/api/provider/${s}`,ANTHROPIC_AUTH_TOKEN:r,ANTHROPIC_MODEL:i.default,ANTHROPIC_DEFAULT_OPUS_MODEL:i.opus,ANTHROPIC_DEFAULT_SONNET_MODEL:i.sonnet,ANTHROPIC_DEFAULT_HAIKU_MODEL:i.haiku}};try{return{success:(await fetch(`/api/settings/${s}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({settings:d})})).ok,presetName:n?.name||t.defaultModel}}catch{return{success:!1}}}function $t({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 Qt({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(ps,{className:"w-4 h-4 text-muted-foreground"})]},t.id))})}function Bt({selectedProvider:s,providers:a,authCommand:t,isRefreshing:n,isPending:i,onBack:r,onStartAuth:c,onRefresh:d}){const[g,f]=o.useState(!1),m=async w=>{await navigator.clipboard.writeText(w),f(!0),setTimeout(()=>f(!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(w=>w.id===s)?.name," to add an account"]}),e.jsx(T,{onClick:c,disabled:i,className:"w-full gap-2",size:"lg",children:i?e.jsxs(e.Fragment,{children:[e.jsx(z,{className:"w-4 h-4 animate-spin"}),"Authenticating..."]}):e.jsxs(e.Fragment,{children:[e.jsx(de,{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(os,{children:e.jsxs(ls,{className:"p-4 space-y-3",children:[e.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[e.jsx(Tt,{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(T,{variant:"outline",size:"icon",onClick:()=>m(t),children:g?e.jsx(W,{className:"w-4 h-4 text-green-500"}):e.jsx(hs,{className:"w-4 h-4"})})]})]})}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs(T,{variant:"ghost",onClick:r,disabled:i,children:[e.jsx(_e,{className:"w-4 h-4 mr-2"}),"Back"]}),e.jsxs(T,{variant:"outline",onClick:d,disabled:n||i,children:[e.jsx(De,{className:`w-4 h-4 mr-2 ${n?"animate-spin":""}`}),n?"Checking...":"Refresh Status"]})]})]})}function zt({accounts:s,privacyMode:a,onSelect:t,onAddNew:n,onBack:i}){return e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wide",children:["Select an account (",s.length,")"]}),e.jsx("div",{className:"grid gap-2 max-h-[320px] overflow-y-auto pr-1",children:s.map(r=>e.jsxs("button",{type:"button",onClick:()=>t(r),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(oe,{className:"w-4 h-4 text-muted-foreground"})}),e.jsxs("div",{children:[e.jsx("div",{className:G("font-medium",a&&he),children:r.email||r.id}),r.isDefault&&e.jsx("div",{className:"text-xs text-muted-foreground",children:"Default account"})]})]}),e.jsx(ps,{className:"w-4 h-4 text-muted-foreground"})]},r.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(de,{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(T,{variant:"ghost",onClick:i,children:[e.jsx(_e,{className:"w-4 h-4 mr-2"}),"Back"]})})]})}const ss="__custom__";function Vt({selectedProvider:s,selectedAccount:a,variantName:t,modelName:n,isPending:i,privacyMode:r,onVariantNameChange:c,onModelChange:d,onBack:g,onSkip:f,onCreate:m}){const w=ue[s]?.models||[],u=n&&!w.some(v=>v.id===n),[j,A]=o.useState(u),x=v=>{v===ss?(A(!0),d("")):(A(!1),d(v))};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(oe,{className:"w-4 h-4"}),e.jsxs("span",{children:["Using:"," ",e.jsx("span",{className:G(r&&he),children:a.email||a.id})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(Y,{htmlFor:"variant-name",children:"Variant Name *"}),e.jsx(le,{id:"variant-name",value:t,onChange:v=>c(v.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"}),j?e.jsxs("div",{className:"space-y-2",children:[e.jsx(le,{value:n,onChange:v=>d(v.target.value),placeholder:"e.g., gemini-2.5-pro, claude-opus-4-5"}),e.jsx("button",{type:"button",className:"text-xs text-primary hover:underline",onClick:()=>A(!1),children:"Choose from presets instead"})]}):e.jsxs(Ce,{value:w.some(v=>v.id===n)?n:"",onValueChange:x,children:[e.jsx(ye,{children:e.jsx(Se,{placeholder:"Select a model"})}),e.jsxs(Ae,{children:[w.map(v=>e.jsx(ce,{value:v.id,children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{children:v.name}),v.description&&e.jsxs("span",{className:"text-xs text-muted-foreground",children:["- ",v.description]})]})},v.id)),e.jsx(ce,{value:ss,children:e.jsx("span",{className:"text-primary",children:"Custom model name..."})})]})]}),e.jsx("div",{className:"text-xs text-muted-foreground",children:j?"Enter any model name supported by CLIProxy":`Default: ${ue[s]?.defaultModel||"provider default"}`})]}),e.jsxs("div",{className:"flex items-center justify-between pt-2",children:[e.jsxs(T,{variant:"ghost",onClick:g,children:[e.jsx(_e,{className:"w-4 h-4 mr-2"}),"Back"]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(T,{variant:"ghost",onClick:f,children:"Skip"}),e.jsx(T,{onClick:m,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 Jt({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(W,{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(os,{children:e.jsxs(ls,{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(T,{onClick:a,className:"w-full",children:"Done"})]})}function Wt({open:s,onClose:a}){const[t,n]=o.useState("provider"),[i,r]=o.useState(""),[c,d]=o.useState(null),[g,f]=o.useState(""),[m,w]=o.useState(""),[u,j]=o.useState(!1),[A,x]=o.useState(!1),{data:v,refetch:p}=cs(),N=Us(),y=Hs(),b=Ks(),{privacyMode:O}=ds(),C=v?.authStatus.find(P=>P.provider===i),R=o.useMemo(()=>C?.accounts||[],[C?.accounts]);o.useEffect(()=>{if(!s){const P=setTimeout(()=>{n("provider"),r(""),d(null),f(""),w(""),x(!1)},0);return()=>clearTimeout(P)}},[s]),o.useEffect(()=>{if(t==="auth"&&R.length>0&&!A){const P=setTimeout(()=>{n("account")},0);return()=>clearTimeout(P)}},[t,R,A]);const _=async()=>{j(!0),await p(),j(!1)},F=()=>{const P=(C?.accounts?.length||0)===0;y.mutate({provider:i},{onSuccess:async M=>{if(P){const L=await be(i);L.success&&L.presetName?H.success(`Applied "${L.presetName}" preset`):L.success||H.warning("Account added, but failed to apply default preset")}M.account&&(d(M.account),n("variant")),p()}})},k=P=>{r(P),(v?.authStatus.find(Q=>Q.provider===P)?.accounts||[]).length===0?n("auth"):n("account")},h=P=>{d(P),n("variant")},S=async()=>{if(!(!g||!i))try{await N.mutateAsync({name:g,provider:i,model:m||void 0,account:c?.id}),n("success")}catch(P){console.error("Failed to create variant:",P)}},D=`ccs ${i} --auth --add`,q=Gs(t),$=P=>{if(!P&&(y.isPending&&i&&b.mutate(i),t==="success"||t==="provider")){a();return}};return e.jsx(Pe,{open:s,onOpenChange:$,children:e.jsxs(Me,{className:"sm:max-w-lg",onPointerDownOutside:P=>{t!=="success"&&t!=="provider"&&P.preventDefault()},onEscapeKeyDown:P=>{(y.isPending||N.isPending)&&P.preventDefault()},children:[e.jsxs(Te,{children:[e.jsxs(Oe,{className:"flex items-center gap-2",children:[e.jsx(me,{className:"w-5 h-5 text-primary"}),"Quick Setup Wizard"]}),e.jsxs(us,{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(Qt,{providers:Qe,onSelect:k}),t==="auth"&&e.jsx(Bt,{selectedProvider:i,providers:Qe,authCommand:D,isRefreshing:u,isPending:y.isPending,onBack:()=>n("provider"),onStartAuth:F,onRefresh:_}),t==="account"&&e.jsx(zt,{accounts:R,privacyMode:O,onSelect:h,onAddNew:()=>{x(!0),n("auth")},onBack:()=>n("provider")}),t==="variant"&&e.jsx(Vt,{selectedProvider:i,selectedAccount:c,variantName:g,modelName:m,isPending:N.isPending,privacyMode:O,onVariantNameChange:f,onModelChange:w,onBack:()=>R.length>0?n("account"):n("provider"),onSkip:a,onCreate:S}),t==="success"&&e.jsx(Jt,{variantName:g,onClose:a})]}),e.jsx($t,{currentProgress:q,allSteps:qs})]})})}const Xt=3e3,Yt=300*1e3,se={provider:null,isAuthenticating:!1,error:null,authUrl:null,oauthState:null,isSubmittingCallback:!1,isDeviceCodeFlow:!1};function Zt(){const[s,a]=o.useState(se),t=o.useRef(null),n=o.useRef(null),i=o.useRef(0),r=o.useRef(!1),c=ke(),d=o.useCallback(()=>{n.current&&(clearInterval(n.current),n.current=null)},[]);o.useEffect(()=>()=>{t.current?.abort(),d(),r.current=!1},[d]);const g=o.useCallback(async(u,j)=>{if(Date.now()-i.current>Yt){d(),a(A=>({...A,isAuthenticating:!1,error:"Authentication timed out. Please try again."}));return}try{const x=await(await fetch(`/api/cliproxy/auth/${u}/status?state=${encodeURIComponent(j)}`)).json();if(x.status==="ok")d(),c.invalidateQueries({queryKey:["cliproxy-auth"]}),c.invalidateQueries({queryKey:["account-quota"]}),H.success(`${u} authentication successful`),r.current=!1,a(se);else if(x.status==="auth_url"){const v=x.url||x.auth_url;v&&(a(p=>({...p,authUrl:v})),r.current||(r.current=!0,window.open(v,"_blank")))}else if(x.status==="device_code"){d();const v=x.user_code&&x.verification_url?`Open ${x.verification_url} and enter code: ${x.user_code}`:"Switch to Device Code method and try again.";H.error("Provider returned Device Code flow in callback mode"),a(p=>({...p,isAuthenticating:!1,error:v}))}else if(x.status==="error"){d();const v=x.error||"Authentication failed";H.error(v),a(p=>({...p,isAuthenticating:!1,error:v}))}}catch{}},[c,d]),f=o.useCallback(async(u,j)=>{if(!$s(u)){a({...se,error:`Unknown provider: ${u}`});return}t.current?.abort(),d(),r.current=!1;const A=new AbortController;t.current=A;const v=(j?.flowType||(ms(u)?"device_code":"authorization_code"))==="device_code",p=j?.startEndpoint||(v?"start":"start-url"),N={nickname:j?.nickname,kiroMethod:j?.kiroMethod};a({provider:u,isAuthenticating:!0,error:null,authUrl:null,oauthState:null,isSubmittingCallback:!1,isDeviceCodeFlow:v});try{if(p==="start")fetch(`/api/cliproxy/auth/${u}/start`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(N),signal:A.signal}).then(async y=>{const b=await y.json();if(y.ok&&b.success)c.invalidateQueries({queryKey:["cliproxy-auth"]}),c.invalidateQueries({queryKey:["account-quota"]}),r.current=!1,a(se);else{const O=b.error||"Authentication failed";H.error(O),a(C=>({...C,isAuthenticating:!1,error:O}))}}).catch(y=>{if(y instanceof Error&&y.name==="AbortError")return;const b=y instanceof Error?y.message:"Authentication failed";H.error(b),a(O=>({...O,isAuthenticating:!1,error:b}))});else{const y=await fetch(`/api/cliproxy/auth/${u}/start-url`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(N),signal:A.signal}),b=await y.json();if(!y.ok||!b.success)throw new Error(b.error||"Failed to start OAuth");a(O=>({...O,authUrl:b.authUrl||null,oauthState:b.state})),b.authUrl&&(r.current=!0,window.open(b.authUrl,"_blank")),b.state&&(i.current=Date.now(),n.current=setInterval(()=>{g(u,b.state)},Xt))}}catch(y){if(y instanceof Error&&y.name==="AbortError"){r.current=!1,a(se);return}const b=y instanceof Error?y.message:"Authentication failed";H.error(b),a(O=>({...O,isAuthenticating:!1,error:b}))}},[g,d,c]),m=o.useCallback(()=>{const u=s.provider;t.current?.abort(),d(),r.current=!1,a(se),u&&pe.cliproxy.auth.cancel(u).catch(()=>{})},[s.provider,d]),w=o.useCallback(async u=>{if(s.provider){a(j=>({...j,isSubmittingCallback:!0,error:null}));try{const j=await fetch(`/api/cliproxy/auth/${s.provider}/submit-callback`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({redirectUrl:u})}),A=await j.json();if(j.ok&&A.success)d(),c.invalidateQueries({queryKey:["cliproxy-auth"]}),c.invalidateQueries({queryKey:["account-quota"]}),H.success(`${s.provider} authentication successful`),a(se);else throw new Error(A.error||"Callback submission failed")}catch(j){const A=j instanceof Error?j.message:"Failed to submit callback";H.error(A),a(x=>({...x,isSubmittingCallback:!1,error:A}))}}},[s.provider,c,d]);return o.useMemo(()=>({...s,startAuth:f,cancelAuth:m,submitCallback:w}),[s,f,m,w])}function ys({className:s,showAcknowledgement:a=!1,acknowledged:t=!1,onAcknowledgedChange:n,disabled:i=!1}){return e.jsxs("section",{role:"alert",className:G("relative overflow-hidden rounded-xl border border-amber-500/30 bg-gradient-to-br from-amber-50 via-background to-rose-50/70 shadow-sm dark:from-amber-950/20 dark:to-rose-950/20",s),children:[e.jsx("div",{className:"absolute inset-x-0 top-0 h-0.5 bg-gradient-to-r from-amber-500 via-orange-500 to-rose-500"}),e.jsxs("div",{className:"space-y-3 p-4",children:[e.jsxs("div",{className:"flex items-start justify-between gap-3",children:[e.jsxs("div",{className:"flex items-start gap-2.5",children:[e.jsx("div",{className:"mt-0.5 inline-flex h-7 w-7 items-center justify-center rounded-md bg-amber-500/15 text-amber-700 dark:text-amber-400",children:e.jsx(fs,{className:"h-4 w-4"})}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-semibold leading-5",children:"Account Safety Warning"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Issue #509 · Shared Gemini + AGY account risk"})]})]}),e.jsx(U,{variant:"outline",className:"border-amber-500/40 text-amber-700 dark:text-amber-300",children:"High Risk"})]}),e.jsxs("div",{className:"space-y-2 text-sm leading-relaxed",children:[e.jsxs("p",{children:["Using one Google account for both ",e.jsx("code",{className:"font-mono",children:"ccs gemini"})," and"," ",e.jsx("code",{className:"font-mono",children:"ccs agy"})," can trigger account disable/ban."]}),e.jsx("p",{className:"font-medium text-amber-900 dark:text-amber-200",children:"If you want to keep Google AI access, do not continue this shared-account setup."}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"CCS is provided as-is and does not take responsibility for suspension, bans, or access loss from upstream providers."})]}),e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsxs("a",{href:"https://github.com/kaitranntt/ccs/issues/509",target:"_blank",rel:"noreferrer",className:"inline-flex items-center gap-1.5 rounded-md border border-amber-500/30 bg-amber-500/10 px-2.5 py-1 text-xs font-medium text-amber-800 transition-colors hover:bg-amber-500/15 dark:text-amber-200",children:["Read issue #509",e.jsx(de,{className:"h-3.5 w-3.5"})]}),e.jsx("span",{className:"rounded-md border border-border/70 bg-muted/60 px-2.5 py-1 text-xs text-muted-foreground",children:"Applies to CLI and dashboard auth"})]}),a&&n&&e.jsx("div",{className:"rounded-lg border border-amber-500/25 bg-amber-500/5 p-2.5",children:e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx(ks,{id:"account-risk-ack",checked:t,onCheckedChange:r=>n(!!r),disabled:i}),e.jsx(Y,{htmlFor:"account-risk-ack",className:"text-xs leading-5",children:"I understand this risk and that CCS takes no responsibility if I continue this setup."})]})})]})]})}function ea({open:s,onClose:a,provider:t,displayName:n,isFirstAccount:i=!1}){const[r,c]=o.useState(""),[d,g]=o.useState(""),[f,m]=o.useState(!1),[w,u]=o.useState(null),[j,A]=o.useState(!1),[x,v]=o.useState(Be),p=o.useRef(!1),N=Zt(),y=Qs(),b=t==="kiro",O=t==="gemini"||t==="agy",C=ms(t),R=Bs(t),_=zs(x),F=b?_.flowType==="device_code":C,k=N.isAuthenticating||y.isPending,h=r.trim(),S=w||N.error,D=()=>{c(""),g(""),m(!1),u(null),A(!1),v(Be),p.current=!1,a()};o.useEffect(()=>{s&&(A(!1),u(null))},[t,s]),o.useEffect(()=>{!N.isAuthenticating&&!N.error&&N.provider===null&&s&&p.current&&(p.current=!1,(async()=>{try{const V=await be(t);V.success&&V.presetName&&i&&H.success(`Applied "${V.presetName}" preset`)}catch{}D()})())},[N.isAuthenticating,N.error,N.provider]);const q=()=>{N.cancelAuth(),D()},$=async()=>{N.authUrl&&(await navigator.clipboard.writeText(N.authUrl),m(!0),setTimeout(()=>m(!1),2e3))},P=()=>{d.trim()&&N.submitCallback(d.trim())},M=()=>{if(O&&!j){u("Please acknowledge the account safety warning before authenticating this provider.");return}if(R&&!h){u(`Nickname is required for ${n} accounts.`);return}u(null),p.current=!0,N.startAuth(t,{nickname:h||void 0,kiroMethod:b?x:void 0,flowType:b?_.flowType:void 0,startEndpoint:b?_.startEndpoint:void 0})},L=()=>{p.current=!0,y.mutate(void 0,{onSuccess:async()=>{const E=await be("kiro");E.success&&E.presetName&&i&&H.success(`Applied "${E.presetName}" preset`),D()}})},Q=E=>{E||q()},B=N.isAuthenticating;return e.jsx(Pe,{open:s,onOpenChange:Q,children:e.jsxs(Me,{className:"sm:max-w-md",onInteractOutside:E=>{B&&E.preventDefault()},children:[e.jsxs(Te,{children:[e.jsxs(Oe,{children:["Add ",n," Account"]}),e.jsx(us,{children:b?"Choose a Kiro auth method, then authenticate via browser or import from Kiro IDE.":F?"Click Authenticate. A verification code will appear for you to enter on the provider website.":"Click Authenticate to get an OAuth URL. Open it in any browser to sign in."})]}),e.jsxs("div",{className:"space-y-4 py-4",children:[O&&!B&&e.jsx(ys,{showAcknowledgement:!0,acknowledged:j,onAcknowledgedChange:E=>{A(E),u(null)},disabled:k}),b&&!B&&e.jsxs("div",{className:"space-y-2",children:[e.jsx(Y,{htmlFor:"kiro-auth-method",children:"Auth Method"}),e.jsxs(Ce,{value:x,onValueChange:E=>{v(E),u(null)},children:[e.jsx(ye,{id:"kiro-auth-method",children:e.jsx(Se,{placeholder:"Select Kiro auth method"})}),e.jsx(Ae,{children:Vs.map(E=>e.jsx(ce,{value:E.id,children:E.label},E.id))})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:_.description})]}),!B&&e.jsxs("div",{className:"space-y-2",children:[e.jsx(Y,{htmlFor:"nickname",children:R?"Nickname (required)":"Nickname (optional)"}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(oe,{className:"w-4 h-4 text-muted-foreground"}),e.jsx(le,{id:"nickname",value:r,onChange:E=>{c(E.target.value),u(null)},placeholder:"e.g., work, personal",disabled:k,className:"flex-1"})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:R?"Required for this provider. Use a unique friendly name (e.g., work, personal).":"A friendly name to identify this account. Auto-generated from email if left empty."})]}),B&&e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"text-center",children:[e.jsxs("p",{className:"text-sm text-muted-foreground",children:[e.jsx(z,{className:"w-4 h-4 inline mr-2 animate-spin"}),"Waiting for authentication..."]}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:N.isDeviceCodeFlow?"A verification code dialog will appear shortly. Enter the code on the provider website.":"Complete the authentication in your browser. This dialog closes automatically."})]}),N.authUrl&&!N.isDeviceCodeFlow&&e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(Y,{className:"text-xs",children:"Open this URL in any browser to sign in:"}),e.jsxs("div",{className:"p-3 bg-muted rounded-md",children:[e.jsx("p",{className:"text-xs text-muted-foreground break-all font-mono line-clamp-3",children:N.authUrl}),e.jsxs("div",{className:"flex gap-2 mt-2",children:[e.jsx(T,{variant:"outline",size:"sm",onClick:$,children:f?e.jsxs(e.Fragment,{children:[e.jsx(W,{className:"w-3 h-3 mr-1"}),"Copied"]}):e.jsxs(e.Fragment,{children:[e.jsx(hs,{className:"w-3 h-3 mr-1"}),"Copy"]})}),e.jsxs(T,{variant:"outline",size:"sm",onClick:()=>{if(!N.authUrl)return;const E=window.open(N.authUrl,"_blank");(!E||E.closed||typeof E.closed>"u")&&H.warning("Popup blocked. Copy the URL above and open it manually in your browser.",{duration:5e3})},children:[e.jsx(de,{className:"w-3 h-3 mr-1"}),"Open"]})]})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(Y,{htmlFor:"callback-url",className:"text-xs",children:"Redirect didn't work? Paste the callback URL:"}),e.jsx(le,{id:"callback-url",value:d,onChange:E=>g(E.target.value),placeholder:"Paste the redirect URL here...",className:"font-mono text-xs"}),e.jsx(T,{variant:"secondary",size:"sm",onClick:P,disabled:!d.trim()||N.isSubmittingCallback,children:N.isSubmittingCallback?e.jsxs(e.Fragment,{children:[e.jsx(z,{className:"w-3 h-3 mr-1 animate-spin"}),"Submitting..."]}):"Submit Callback"})]})]}),!N.authUrl&&!N.isDeviceCodeFlow&&e.jsx("p",{className:"text-xs text-center text-muted-foreground",children:"Preparing sign-in URL..."})]}),S&&e.jsx("p",{className:"text-xs text-center text-destructive",children:S}),y.isPending&&e.jsxs("p",{className:"text-sm text-center text-muted-foreground",children:[e.jsx(z,{className:"w-4 h-4 inline mr-2 animate-spin"}),"Importing token from Kiro IDE..."]}),e.jsxs("div",{className:"flex items-center justify-end gap-2 pt-2",children:[e.jsx(T,{variant:"ghost",onClick:q,children:"Cancel"}),b&&!B&&e.jsx(T,{variant:"outline",onClick:L,disabled:k,children:y.isPending?e.jsxs(e.Fragment,{children:[e.jsx(z,{className:"w-4 h-4 mr-2 animate-spin"}),"Importing..."]}):e.jsxs(e.Fragment,{children:[e.jsx(Ot,{className:"w-4 h-4 mr-2"}),"Import from IDE"]})}),!B&&e.jsxs(T,{onClick:M,disabled:k||R&&!h||O&&!j,children:[e.jsx(de,{className:"w-4 h-4 mr-2"}),"Authenticate"]})]})]})]})})}const Ie="[1m]";function sa(s){return s.toLowerCase().startsWith("gemini-")}function Fe(s){return s.toLowerCase().endsWith(Ie.toLowerCase())}function ta(s){return!s||Fe(s)?s:`${s}${Ie}`}function Ss(s){return s&&(Fe(s)?s.slice(0,-Ie.length):s)}const ts=["ANTHROPIC_MODEL"],aa=["ANTHROPIC_BASE_URL","ANTHROPIC_AUTH_TOKEN"];function na(s){const a=s?.env||{};return aa.filter(t=>!a[t]?.trim())}function ia(s){const[a,t]=o.useState(null),[n,i]=o.useState(!1),r=ke(),{data:c,isLoading:d,refetch:g}=rs({queryKey:["settings",s],queryFn:async()=>{const k=await fetch(`/api/settings/${s}/raw`);return k.ok?k.json():{profile:s,settings:{env:{}},mtime:Date.now(),path:`~/.ccs/profiles/${s}/settings.json`}}}),f=c?.settings,m=o.useMemo(()=>a!==null?a:f?JSON.stringify(f,null,2):`{
2
- "env": {}
3
- }`,[a,f]),w=o.useCallback(k=>{t(k)},[]),u=o.useMemo(()=>{try{return JSON.parse(m)}catch{return f||{env:{}}}},[m,f]),j=u?.env?.ANTHROPIC_MODEL,A=u?.env?.ANTHROPIC_DEFAULT_OPUS_MODEL,x=u?.env?.ANTHROPIC_DEFAULT_SONNET_MODEL,v=u?.env?.ANTHROPIC_DEFAULT_HAIKU_MODEL,p=o.useMemo(()=>{const k=u?.env||{};return ts.some(h=>{const S=k[h];return S&&Fe(S)})},[u]),N=o.useCallback((k,h)=>{const S={...u?.env||{},[k]:h},D={...u,env:S};t(JSON.stringify(D,null,2))},[u]),y=o.useCallback(k=>{const h=u?.env||{},S={};for(const $ of ts){const P=h[$];P&&(S[$]=k?ta(P):Ss(P))}const D={...h,...S};delete D.CCS_EXTENDED_CONTEXT;const q={...u,env:D};t(JSON.stringify(q,null,2))},[u]),b=o.useCallback(k=>{const h={...u?.env||{},...k},S={...u,env:h};t(JSON.stringify(S,null,2))},[u]),O=o.useMemo(()=>{try{return JSON.parse(m),!0}catch{return!1}},[m]),C=o.useMemo(()=>a===null?!1:a!==JSON.stringify(f,null,2),[a,f]),R=o.useMemo(()=>na(u),[u]),_=Fs({mutationFn:async()=>{const k=JSON.parse(m),h=await fetch(`/api/settings/${s}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({settings:k,expectedMtime:c?.mtime})});if(h.status===409)throw new Error("CONFLICT");if(!h.ok)throw new Error("Failed to save");return h.json()},onSuccess:k=>{r.invalidateQueries({queryKey:["settings",s]}),t(null),k?.warning?H.success("Settings saved",{description:k.warning}):H.success("Settings saved")},onError:k=>{k.message==="CONFLICT"?i(!0):H.error(k.message)}}),F=async k=>{i(!1),k?(await g(),_.mutate()):t(null)};return{data:c,isLoading:d,refetch:g,rawJsonContent:m,rawJsonEdits:a,isRawJsonValid:O,hasChanges:C,currentSettings:u,currentModel:j,opusModel:A,sonnetModel:x,haikuModel:v,extendedContextEnabled:p,toggleExtendedContext:y,handleRawJsonChange:w,updateEnvValue:N,updateEnvValues:b,saveMutation:{mutate:()=>_.mutate(),isPending:_.isPending},conflictDialog:n,setConflictDialog:i,handleConflictResolve:F,missingRequiredFields:R}}const ra=/-(medium|high|xhigh)$/i;function oa(s){if(!s)return;const a=s.trim().match(ra);if(a?.[1])return a[1].toLowerCase()}function ve(s){if(!s)return null;const a=oa(s);return a?{label:`Pinned ${a}`,explicit:!0}:{label:"Auto effort",explicit:!1}}function Z({label:s,description:a,value:t,onChange:n,catalog:i,allModels:r,disabled:c}){const d=new Set(i?.models.map(m=>m.id)||[]),g=i?.provider==="codex",f=g?ve(t):null;return e.jsxs("div",{className:"space-y-1.5",children:[e.jsxs("div",{children:[e.jsx("label",{className:"text-xs font-medium",children:s}),a&&e.jsx("p",{className:"text-[10px] text-muted-foreground",children:a})]}),e.jsxs(Ce,{value:t||"",onValueChange:n,disabled:c,children:[e.jsx(ye,{className:"h-9",children:e.jsx(Se,{placeholder:"Select model",children:t&&e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"truncate font-mono text-xs",children:t}),f&&e.jsx(U,{variant:f.explicit?"secondary":"outline",className:"text-[9px] h-4 px-1 uppercase",children:f.label})]})})}),e.jsxs(Ae,{className:"max-h-[300px]",children:[i&&i.models.length>0&&e.jsxs(ze,{children:[e.jsx(Ve,{className:"text-xs text-primary",children:"Recommended"}),i.models.map(m=>{const w=g?ve(m.id):null;return e.jsx(ce,{value:m.id,children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"truncate font-mono text-xs",children:m.id}),m.tier==="paid"&&e.jsx(U,{variant:"outline",className:"text-[9px] h-4 px-1",children:"PAID"}),w&&e.jsx(U,{variant:w.explicit?"secondary":"outline",className:"text-[9px] h-4 px-1 uppercase",children:w.label}),t===m.id&&e.jsx(W,{className:"w-3 h-3 text-primary ml-auto"})]})},m.id)})]}),r.length>0&&e.jsxs(ze,{children:[e.jsxs(Ve,{className:"text-xs text-muted-foreground",children:["All Models (",r.length,")"]}),r.filter(m=>!d.has(m.id)).map(m=>{const w=g?ve(m.id):null;return e.jsx(ce,{value:m.id,children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"truncate font-mono text-xs",children:m.id}),w&&e.jsx(U,{variant:w.explicit?"secondary":"outline",className:"text-[9px] h-4 px-1 uppercase",children:w.label}),t===m.id&&e.jsx(W,{className:"w-3 h-3 text-primary ml-auto"})]})},m.id)})]}),(!i||i.models.length===0)&&r.length===0&&e.jsx("div",{className:"py-2 px-3 text-xs text-muted-foreground",children:"No models available"})]})]})]})}function la({open:s,onClose:a,currentValues:t,onApply:n,onSave:i,isSaving:r,catalog:c,allModels:d}){const[g,f]=o.useState(t),[m,w]=o.useState(""),u=j=>{j?(f(t),w("")):a()};return e.jsx(Pe,{open:s,onOpenChange:u,children:e.jsxs(Me,{className:"sm:max-w-md",children:[e.jsx(Te,{children:e.jsxs(Oe,{className:"flex items-center gap-2",children:[e.jsx(me,{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(le,{id:"preset-name",value:m,onChange:j=>w(j.target.value),placeholder:"e.g., My Custom Config",className:"text-sm"})]}),e.jsx(Le,{}),c?.provider==="codex"&&e.jsxs("p",{className:"text-[11px] text-muted-foreground rounded-md border bg-muted/30 px-2.5 py-2",children:["Codex tip: suffixes ",e.jsx("code",{children:"-medium"}),", ",e.jsx("code",{children:"-high"}),", and ",e.jsx("code",{children:"-xhigh"})," ","pin effort. Unsuffixed models use Thinking settings."]}),e.jsx(Z,{label:"Default Model",description:"Used when no specific tier is requested",value:g.default,onChange:j=>f({...g,default:j}),catalog:c,allModels:d}),e.jsx(Z,{label:"Opus (Most capable)",description:"For complex reasoning tasks",value:g.opus,onChange:j=>f({...g,opus:j}),catalog:c,allModels:d}),e.jsx(Z,{label:"Sonnet (Balanced)",description:"Balance of speed and capability",value:g.sonnet,onChange:j=>f({...g,sonnet:j}),catalog:c,allModels:d}),e.jsx(Z,{label:"Haiku (Fast)",description:"Quick responses for simple tasks",value:g.haiku,onChange:j=>f({...g,haiku:j}),catalog:c,allModels:d})]}),e.jsxs(Js,{className:"gap-2 sm:gap-0",children:[e.jsx(T,{variant:"outline",onClick:a,children:"Cancel"}),i&&e.jsxs(T,{variant:"secondary",onClick:()=>i(g,m||void 0),disabled:r||!m.trim(),children:[r?e.jsx(z,{className:"w-4 h-4 mr-1 animate-spin"}):e.jsx(fe,{className:"w-4 h-4 mr-1"}),"Save Preset"]}),e.jsxs(T,{onClick:()=>n(g,m||void 0),children:[e.jsx(xe,{className:"w-4 h-4 mr-1"}),"Apply Preset"]})]})]})})}function re({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(xs,{value:a,size:"icon",className:"h-6 w-6"})]})]})}function ca({provider:s,displayName:a,defaultTarget:t,data:n,authStatus:i}){const r=t||"claude",c=r==="droid";return e.jsx(Ee,{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})]}),n&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"grid grid-cols-[100px_1fr] gap-2 text-sm items-center",children:[e.jsx("span",{className:"font-medium text-muted-foreground",children:"File Path"}),e.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[e.jsx("code",{className:"bg-muted px-1.5 py-0.5 rounded text-xs break-all",children:n.path}),e.jsx(xs,{value:n.path,size:"icon",className:"h-5 w-5"})]})]}),e.jsxs("div",{className:"grid grid-cols-[100px_1fr] gap-2 text-sm items-center",children:[e.jsx("span",{className:"font-medium text-muted-foreground",children:"Last Modified"}),e.jsx("span",{className:"text-xs",children:new Date(n.mtime).toLocaleString()})]})]}),e.jsxs("div",{className:"grid grid-cols-[100px_1fr] gap-2 text-sm items-center",children:[e.jsx("span",{className:"font-medium text-muted-foreground",children:"Status"}),i.authenticated?e.jsxs(U,{variant:"outline",className:"w-fit text-green-600 border-green-200 bg-green-50",children:[e.jsx(Et,{className:"w-3 h-3 mr-1"}),"Authenticated"]}):e.jsx(U,{variant:"outline",className:"w-fit text-muted-foreground",children:"Not connected"})]}),e.jsxs("div",{className:"grid grid-cols-[100px_1fr] gap-2 text-sm items-center",children:[e.jsx("span",{className:"font-medium text-muted-foreground",children:"Default Target"}),e.jsx("span",{className:"font-mono",children:r})]})]})]}),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(re,{label:"Run with prompt",command:`ccs ${s} "your prompt"`}),e.jsx(re,{label:c?"Droid alias (explicit)":"Run on Droid",command:c?`ccsd ${s} "your prompt"`:`ccs ${s} --target droid "your prompt"`}),e.jsx(re,{label:c?"Override to Claude":"Override target",command:`ccs ${s} --target claude "your prompt"`}),e.jsx(re,{label:"Change model",command:`ccs ${s} --config`}),e.jsx(re,{label:"Add account",command:`ccs ${s} --add`}),e.jsx(re,{label:"List accounts",command:`ccs ${s} --accounts`})]})]})]})})}const da={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 Ue({provider:s,className:a,size:t="md"}){const n=Ws(s),i=da[t],r=Xs(s);return e.jsx("div",{className:G("flex items-center justify-center rounded-md",r&&(Ys(s)?"bg-gray-900 p-1":"bg-white p-1"),i.container,a),children:r?e.jsx("img",{src:r,alt:`${s} logo`,className:G(i.icon,"object-contain")}):e.jsx("span",{className:G("font-semibold",n.textClass,i.text),children:n.letter})})}function ua({displayName:s,logoProvider:a,provider:t,data:n,isLoading:i,hasChanges:r,isRawJsonValid:c,isSaving:d,isRemoteMode:g,port:f,onRefetch:m,onSave:w}){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(Ue,{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}),g&&e.jsxs(U,{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(js,{className:"w-3 h-3"}),"Remote"]}),f&&e.jsxs(U,{variant:"outline",className:"text-xs gap-1 font-mono",children:[e.jsx(_t,{className:"w-3 h-3"}),":",f]}),!g&&n?.path&&e.jsx(U,{variant:"outline",className:"text-xs",children:n.path.replace(/^.*[\\/]/,"")})]}),g?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(T,{variant:"ghost",size:"sm",onClick:m,disabled:i,children:e.jsx(De,{className:`w-4 h-4 ${i?"animate-spin":""}`})}),e.jsx(T,{size:"sm",onClick:w,disabled:d||!r||!c,children:d?e.jsxs(e.Fragment,{children:[e.jsx(z,{className:"w-4 h-4 mr-1 animate-spin"}),"Saving..."]}):e.jsxs(e.Fragment,{children:[e.jsx(Dt,{className:"w-4 h-4 mr-1"}),"Save"]})})]})]})}function ma({model:s,provider:a,enabled:t,onToggle:n,disabled:i,className:r}){if(!s?.extendedContext)return null;const c=sa(s.id);return e.jsxs("div",{className:G("rounded-lg border p-3 space-y-2",t?"border-primary/50 bg-primary/5":"border-border bg-muted/30",r),children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(xe,{className:G("w-4 h-4",t?"text-primary":"text-muted-foreground")}),e.jsx("span",{className:"text-sm font-medium",children:"Extended Context"}),e.jsx(U,{variant:t?"default":"secondary",className:"text-[10px] h-5 px-1.5",children:"1M tokens"})]}),e.jsx(Cs,{checked:t,onCheckedChange:n,disabled:i})]}),e.jsxs("div",{className:"flex items-start gap-2 text-xs text-muted-foreground",children:[e.jsx(gs,{className:"w-3.5 h-3.5 mt-0.5 shrink-0"}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{children:"Enables 1M token context window instead of default 200K."}),e.jsx("p",{className:"text-[10px]",children:c?e.jsxs("span",{className:"text-primary",children:["Auto-enabled for ",a," Gemini models"]}):e.jsxs("span",{children:["Opt-in for ",a," Claude models via --1m flag"]})}),t&&e.jsx("p",{className:"text-amber-600 dark:text-amber-500",children:"Note: 2x input pricing applies for tokens beyond 200K"})]})]})]})}function xa({catalog:s,savedPresets:a,currentModel:t,opusModel:n,sonnetModel:i,haikuModel:r,providerModels:c,provider:d,extendedContextEnabled:g,onExtendedContextToggle:f,onApplyPreset:m,onUpdateEnvValue:w,onOpenCustomPreset:u,onDeletePreset:j,isDeletePending:A}){const x=s&&s.models.length>0||a.length>0,v=o.useMemo(()=>{if(!s||!t)return;const p=Ss(t);return s.models.find(N=>N.id===p)},[s,t]);return e.jsxs(e.Fragment,{children:[x&&e.jsxs("div",{children:[e.jsxs("h3",{className:"text-sm font-medium mb-2 flex items-center gap-2",children:[e.jsx(me,{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(p=>e.jsxs(T,{variant:"outline",size:"sm",className:"text-xs h-7 gap-1",onClick:()=>{const N=p.presetMapping||{default:p.id,opus:p.id,sonnet:p.id,haiku:p.id};m({ANTHROPIC_MODEL:N.default,ANTHROPIC_DEFAULT_OPUS_MODEL:N.opus,ANTHROPIC_DEFAULT_SONNET_MODEL:N.sonnet,ANTHROPIC_DEFAULT_HAIKU_MODEL:N.haiku})},children:[e.jsx(xe,{className:"w-3 h-3"}),p.name]},p.id)),a.map(p=>e.jsxs("div",{className:"group relative",children:[e.jsxs(T,{variant:"secondary",size:"sm",className:"text-xs h-7 gap-1 pr-6",onClick:()=>{m({ANTHROPIC_MODEL:p.default,ANTHROPIC_DEFAULT_OPUS_MODEL:p.opus,ANTHROPIC_DEFAULT_SONNET_MODEL:p.sonnet,ANTHROPIC_DEFAULT_HAIKU_MODEL:p.haiku})},children:[e.jsx(fe,{className:"w-3 h-3 fill-current"}),p.name]}),e.jsx(T,{variant:"ghost",size:"icon",className:"absolute right-0 top-0 h-7 w-5 opacity-0 group-hover:opacity-100 hover:text-destructive",onClick:N=>{N.stopPropagation(),j(p.name)},disabled:A,children:e.jsx(Re,{className:"w-3 h-3"})})]},p.name)),e.jsxs(T,{variant:"outline",size:"sm",className:"text-xs h-7 gap-1 border-primary/50 text-primary hover:bg-primary/10 hover:border-primary",onClick:u,children:[e.jsx(vs,{className:"w-3 h-3"}),"Custom"]})]})]}),e.jsx(Le,{}),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"}),d==="codex"&&e.jsxs("p",{className:"text-[11px] text-muted-foreground mb-3 rounded-md border bg-muted/30 px-2.5 py-2",children:["Codex tip: suffixes ",e.jsx("code",{children:"-medium"}),", ",e.jsx("code",{children:"-high"}),", and ",e.jsx("code",{children:"-xhigh"})," ","pin reasoning effort. Unsuffixed models use Thinking settings."]}),e.jsxs("div",{className:"space-y-4",children:[e.jsx(Z,{label:"Default Model",description:"Used when no specific tier is requested",value:t,onChange:p=>w("ANTHROPIC_MODEL",p),catalog:s,allModels:c}),v?.extendedContext&&f&&e.jsx(ma,{model:v,provider:d,enabled:g??!1,onToggle:f}),e.jsx(Z,{label:"Opus (Most capable)",description:"For complex reasoning tasks",value:n,onChange:p=>w("ANTHROPIC_DEFAULT_OPUS_MODEL",p),catalog:s,allModels:c}),e.jsx(Z,{label:"Sonnet (Balanced)",description:"Balance of speed and capability",value:i,onChange:p=>w("ANTHROPIC_DEFAULT_SONNET_MODEL",p),catalog:s,allModels:c}),e.jsx(Z,{label:"Haiku (Fast)",description:"Quick responses for simple tasks",value:r,onChange:p=>w("ANTHROPIC_DEFAULT_HAIKU_MODEL",p),catalog:s,allModels:c})]})]})]})}function as(s){const a=Math.max(0,Math.min(100,s));return a<=20?"bg-destructive":a<=50?"bg-yellow-500":"bg-green-500"}function ns(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)),r=Math.floor(n/(1e3*60*60)),c=Math.floor(n/(1e3*60*60*24));return c>0?`${c}d ago`:r>0?`${r}h ago`:i>0?`${i}m ago`:"just now"}catch{return""}}function pa(s){if(!s)return!1;try{const a=new Date(s);return new Date().getTime()-a.getTime()<3600*1e3}catch{return!1}}function ha({account:s,onSetDefault:a,onRemove:t,onPauseToggle:n,isRemoving:i,isPausingAccount:r,privacyMode:c,showQuota:d,selectable:g,selected:f,onSelectChange:m}){const w=s.provider.toLowerCase(),u=w==="codex",j=w==="claude"||w==="anthropic",{data:A}=Zs(d),{data:x,isLoading:v}=et(w,s.id,d),p=A?.accountStats?.[s.email||s.id]?.lastUsedAt,N=pa(p),y=st(s.provider,x),b=tt(s.provider,x),O=u&&x&&at(x)?nt(x.windows):null,C=[{label:"5h",value:O?.fiveHourWindow?.remainingPercent??null},{label:"Weekly",value:O?.weeklyWindow?.remainingPercent??null}].filter(h=>h.value!==null),R=j&&x&&it(x)?[{label:"5h",value:x.coreUsage?.fiveHour?.remainingPercent??x.windows.find(h=>h.rateLimitType==="five_hour")?.remainingPercent??null},{label:"Weekly",value:x.coreUsage?.weekly?.remainingPercent??x.windows.find(h=>["seven_day","seven_day_opus","seven_day_sonnet","seven_day_oauth_apps","seven_day_cowork"].includes(h.rateLimitType))?.remainingPercent??null}].filter(h=>h.value!==null):[],_=u?C:j?R:[],F=y!==null?ct(y):null,k=F!==null?Number(F):null;return e.jsxs("div",{className:G("flex flex-col gap-2 p-3 rounded-lg border transition-colors overflow-hidden",s.isDefault?"border-primary/30 bg-primary/5":"border-border hover:bg-muted/30",s.paused&&"opacity-75",f&&"ring-2 ring-primary/50 bg-primary/5"),children:[e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsxs("div",{className:"flex items-center gap-3 min-w-0 flex-1",children:[g&&e.jsx("button",{type:"button",onClick:()=>m?.(!f),className:G("flex items-center justify-center w-5 h-5 rounded border-2 transition-colors shrink-0",f?"bg-primary border-primary text-primary-foreground":"border-muted-foreground/30 hover:border-primary/50"),"aria-label":f?"Deselect account":"Select account",children:f&&e.jsx(W,{className:"w-3 h-3"})}),n&&e.jsx(te,{children:e.jsxs(ae,{children:[e.jsx(ne,{asChild:!0,children:e.jsx(T,{variant:"ghost",size:"icon",className:"h-7 w-7 shrink-0",onClick:()=>n(!s.paused),disabled:r,children:r?e.jsx(z,{className:"w-4 h-4 animate-spin"}):s.paused?e.jsx(Ns,{className:"w-4 h-4 text-emerald-500"}):e.jsx(we,{className:"w-4 h-4 text-muted-foreground hover:text-foreground"})})}),e.jsx(ie,{side:"top",children:s.paused?"Resume account":"Pause account"})]})}),e.jsxs("div",{className:"relative shrink-0",children:[e.jsx("div",{className:G("flex items-center justify-center w-8 h-8 rounded-full",s.isDefault?"bg-primary/10":"bg-muted"),children:e.jsx(oe,{className:"w-4 h-4"})}),s.tier&&s.tier!=="unknown"&&s.tier!=="free"&&e.jsx("span",{className:G("absolute -bottom-0.5 -right-0.5 text-[7px] font-bold uppercase px-1 py-px rounded","ring-1 ring-background",s.tier==="ultra"?"bg-violet-500/20 text-violet-600 dark:bg-violet-500/30 dark:text-violet-300":"bg-yellow-500/20 text-yellow-700 dark:bg-yellow-500/25 dark:text-yellow-400"),children:s.tier==="ultra"?"U":"P"})]}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:G("font-medium text-sm truncate",c&&he),children:s.email||s.id}),s.isDefault&&e.jsxs(U,{variant:"secondary",className:"text-[10px] h-4 px-1.5 gap-0.5",children:[e.jsx(fe,{className:"w-2.5 h-2.5 fill-current"}),"Default"]}),s.paused&&e.jsxs(U,{variant:"outline",className:"text-[10px] h-4 px-1.5 border-yellow-500 text-yellow-600",children:[e.jsx(we,{className:"w-2 h-2 mr-0.5"}),"Paused"]})]}),s.provider==="agy"&&e.jsx("div",{className:"flex items-center gap-1.5 mt-1",children:s.projectId?e.jsx(te,{children:e.jsxs(ae,{children:[e.jsx(ne,{asChild:!0,children:e.jsxs("div",{className:"flex items-center gap-1 text-xs text-muted-foreground",children:[e.jsx(Rt,{className:"w-3 h-3","aria-hidden":"true"}),e.jsx("span",{className:G("font-mono max-w-[180px] truncate",c&&he),title:s.projectId,children:s.projectId})]})}),e.jsx(ie,{side:"bottom",children:e.jsx("p",{className:"text-xs",children:"GCP Project ID (read-only)"})})]})}):e.jsx(te,{children:e.jsxs(ae,{children:[e.jsx(ne,{asChild:!0,children:e.jsxs("div",{className:"flex items-center gap-1 text-xs text-amber-600 dark:text-amber-500",children:[e.jsx(fs,{className:"w-3 h-3","aria-label":"Warning"}),e.jsx("span",{children:"Project ID: N/A"})]})}),e.jsx(ie,{side:"bottom",className:"max-w-[250px]",children:e.jsxs("div",{className:"text-xs space-y-1",children:[e.jsx("p",{className:"font-medium text-amber-600",children:"Missing Project ID"}),e.jsx("p",{children:"This may cause errors. Remove the account and re-add it to fetch the project ID."})]})})]})})}),s.lastUsedAt&&e.jsxs("div",{className:"flex items-center gap-1 text-xs text-muted-foreground mt-0.5",children:[e.jsx(Ze,{className:"w-3 h-3"}),"Last used: ",new Date(s.lastUsedAt).toLocaleDateString()]})]})]}),e.jsxs(rt,{children:[e.jsx(ot,{asChild:!0,children:e.jsx(T,{variant:"ghost",size:"icon",className:"h-7 w-7 shrink-0",children:e.jsx(Lt,{className:"w-4 h-4"})})}),e.jsxs(lt,{align:"end",children:[!s.isDefault&&e.jsxs(Je,{onClick:a,children:[e.jsx(fe,{className:"w-4 h-4 mr-2"}),"Set as default"]}),e.jsxs(Je,{className:"text-destructive focus:text-destructive",onClick:t,disabled:i,children:[e.jsx(ws,{className:"w-4 h-4 mr-2"}),i?"Removing...":"Remove account"]})]})]})]}),d&&e.jsx("div",{className:"pl-11",children:v?e.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[e.jsx(z,{className:"w-3 h-3 animate-spin"}),e.jsx("span",{children:"Loading quota..."})]}):k!==null?e.jsxs("div",{className:"space-y-1.5",children:[e.jsx("div",{className:"flex items-center gap-1.5 text-xs",children:N?e.jsxs(e.Fragment,{children:[e.jsx(It,{className:"w-3 h-3 text-emerald-500"}),e.jsxs("span",{className:"text-emerald-600 dark:text-emerald-400",children:["Active · ",ns(p)]})]}):p?e.jsxs(e.Fragment,{children:[e.jsx(Ze,{className:"w-3 h-3 text-muted-foreground"}),e.jsxs("span",{className:"text-muted-foreground",children:["Last used ",ns(p)]})]}):e.jsxs(e.Fragment,{children:[e.jsx(es,{className:"w-3 h-3 text-muted-foreground"}),e.jsx("span",{className:"text-muted-foreground",children:"Not used yet"})]})}),e.jsx(te,{children:e.jsxs(ae,{children:[e.jsx(ne,{asChild:!0,children:_.length>0?e.jsx("div",{className:"space-y-1.5",children:_.map(h=>e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"w-10 text-[10px] text-muted-foreground",children:h.label}),e.jsx(We,{value:Math.max(0,Math.min(100,h.value)),className:"h-2 flex-1",indicatorClassName:as(h.value)}),e.jsxs("span",{className:"text-xs font-medium w-10 text-right",children:[h.value,"%"]})]},h.label))}):e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(We,{value:Math.max(0,Math.min(100,k)),className:"h-2 flex-1",indicatorClassName:as(k)}),e.jsxs("span",{className:"text-xs font-medium w-10 text-right",children:[F,"%"]})]})}),e.jsx(ie,{side:"bottom",className:"max-w-xs",children:e.jsx(dt,{quota:x,resetTime:b})})]})})]}):x?.success?e.jsx("div",{className:"flex items-center gap-1.5",children:e.jsxs(U,{variant:"outline",className:"text-[10px] h-5 px-2 gap-1 border-muted-foreground/50 text-muted-foreground",children:[e.jsx(es,{className:"w-3 h-3"}),"No limits"]})}):x?.needsReauth?e.jsx(te,{children:e.jsxs(ae,{children:[e.jsx(ne,{asChild:!0,children:e.jsx("div",{className:"flex items-center gap-1.5",children:e.jsxs(U,{variant:"outline",className:"text-[10px] h-5 px-2 gap-1 border-amber-500/50 text-amber-600 dark:text-amber-400",children:[e.jsx(Ft,{className:"w-3 h-3"}),"Reauth"]})})}),e.jsx(ie,{side:"bottom",className:"max-w-[220px]",children:e.jsx("p",{className:"text-xs",children:x.error?.includes("No refresh token")?"No refresh token available. Remove and re-add account to fix.":x.error?.includes("refresh")||x.error?.includes("Invalid")?`Auto-refresh failed: ${x.error}`:`Token issue: ${x.error||"Re-authenticate required"}`})})]})}):x?.error||x&&!x.success?e.jsx(te,{children:e.jsxs(ae,{children:[e.jsx(ne,{asChild:!0,children:e.jsx("div",{className:"flex items-center gap-1.5",children:e.jsxs(U,{variant:"outline",className:"text-[10px] h-5 px-2 gap-1 border-muted-foreground/50 text-muted-foreground",children:[e.jsx(Ut,{className:"w-3 h-3"}),"N/A"]})})}),e.jsx(ie,{side:"bottom",children:e.jsx("p",{className:"text-xs",children:x?.error||"Quota information unavailable"})})]})}):null})]})}function fa({selectedCount:s,onPauseSelected:a,onResumeSelected:t,onClearSelection:n,isPausing:i,isResuming:r}){if(s<1)return null;const c=i||r;return e.jsxs("div",{className:"flex items-center gap-3 p-2 bg-muted/50 rounded-lg border mt-2",children:[e.jsxs("span",{className:"text-sm text-muted-foreground",children:[s," selected"]}),e.jsx(T,{variant:"ghost",size:"sm",className:"text-xs h-6 px-2",onClick:n,disabled:c,children:"Clear"}),e.jsxs("div",{className:"flex gap-2 ml-auto",children:[e.jsxs(T,{size:"sm",variant:"outline",className:"h-7 text-xs gap-1",onClick:a,disabled:c,children:[i?e.jsx(z,{className:"w-3 h-3 animate-spin"}):e.jsx(we,{className:"w-3 h-3"}),"Pause Selected"]}),e.jsxs(T,{size:"sm",variant:"outline",className:"h-7 text-xs gap-1",onClick:t,disabled:c,children:[r?e.jsx(z,{className:"w-3 h-3 animate-spin"}):e.jsx(Ns,{className:"w-3 h-3"}),"Resume Selected"]})]})]})}function ga({accounts:s,onAddAccount:a,onSetDefault:t,onRemoveAccount:n,onPauseToggle:i,onSoloMode:r,onBulkPause:c,onBulkResume:d,isRemovingAccount:g,isPausingAccount:f,isSoloingAccount:m,isBulkPausing:w,isBulkResuming:u,privacyMode:j,showQuota:A,isKiro:x,kiroNoIncognito:v,onKiroNoIncognitoChange:p,kiroSettingsLoading:N}){const[y,b]=o.useState(new Set),O=o.useMemo(()=>new Set(s.map(M=>M.id)),[s]),C=o.useMemo(()=>new Set([...y].filter(M=>O.has(M))),[y,O]),R=!!(c&&d),_=C.size,F=s.length>0&&C.size===s.length,k=C.size>0&&C.size<s.length,h=o.useCallback(M=>{b(L=>{const Q=new Set(L);return Q.has(M)?Q.delete(M):Q.add(M),Q})},[]),S=o.useCallback(()=>{b(new Set(s.map(M=>M.id)))},[s]),D=o.useCallback(()=>{b(new Set)},[]),q=o.useCallback(()=>{F?D():S()},[F,S,D]),$=o.useCallback(()=>{c&&C.size>0&&(c(Array.from(C)),b(new Set))},[c,C]),P=o.useCallback(()=>{d&&C.size>0&&(d(Array.from(C)),b(new Set))},[d,C]);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:[R&&s.length>0&&e.jsx(ks,{checked:F,onCheckedChange:q,"aria-label":"Select all accounts",className:k?"data-[state=checked]:bg-primary/50":"",...k?{"data-state":"indeterminate"}:{}}),e.jsx(oe,{className:"w-4 h-4"}),"Accounts",s.length>0&&e.jsx(U,{variant:"secondary",className:"text-xs",children:s.length})]}),e.jsxs(T,{variant:"default",size:"sm",className:"h-7 text-xs gap-1",onClick:a,children:[e.jsx(vs,{className:"w-3 h-3"}),"Add"]})]}),R&&_>0&&e.jsx(fa,{selectedCount:_,onPauseSelected:$,onResumeSelected:P,onClearSelection:D,isPausing:!!w,isResuming:!!u}),s.length>0?e.jsx("div",{className:"space-y-2",children:s.map(M=>e.jsx(ha,{account:M,onSetDefault:()=>t(M.id),onRemove:()=>n(M.id),onPauseToggle:i?L=>i(M.id,L):void 0,onSoloMode:r?()=>r(M.id):void 0,isRemoving:g,isPausingAccount:f,isSoloingAccount:m,privacyMode:j,showQuota:A,selectable:R,selected:C.has(M.id),onSelectChange:()=>h(M.id)},M.id))}):e.jsxs("div",{className:"py-6 text-center text-muted-foreground bg-muted/30 rounded-lg border border-dashed",children:[e.jsx(oe,{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"})]}),x&&p&&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(js,{className:"w-3.5 h-3.5"}),e.jsx("span",{children:"Use incognito"})]}),e.jsx(Cs,{checked:!v,onCheckedChange:M=>p(!M),disabled:N,className:"scale-90"})]})})]})}function ja({provider:s,catalog:a,savedPresets:t,currentModel:n,opusModel:i,sonnetModel:r,haikuModel:c,providerModels:d,extendedContextEnabled:g,onExtendedContextToggle:f,onApplyPreset:m,onUpdateEnvValue:w,onOpenCustomPreset:u,onDeletePreset:j,isDeletePending:A,accounts:x,onAddAccount:v,onSetDefault:p,onRemoveAccount:N,onPauseToggle:y,onSoloMode:b,onBulkPause:O,onBulkResume:C,isRemovingAccount:R,isPausingAccount:_,isSoloingAccount:F,isBulkPausing:k,isBulkResuming:h,privacyMode:S,isRemoteMode:D}){const q=s.toLowerCase(),$=(ut.includes(q)||["anthropic","antigravity","gemini-cli","copilot","github-copilot"].includes(q))&&!D,P=s==="kiro",[M,L]=o.useState(!0),[Q,B]=o.useState(!0),[E,V]=o.useState(!1),l=o.useCallback(async()=>{if(P)try{B(!0);const ee=(await pe.config.get()).cliproxy;L(ee?.kiro_no_incognito??!0)}catch{L(!0)}finally{B(!1)}},[P]),I=o.useCallback(async J=>{L(J),V(!0);try{const ee=await pe.config.get(),ge=ee.cliproxy??{};await pe.config.update({...ee,cliproxy:{...ge,kiro_no_incognito:J}})}catch{L(!J)}finally{V(!1)}},[]);return o.useEffect(()=>{l()},[l]),e.jsx(Ee,{className:"flex-1",children:e.jsxs("div",{className:"p-4 space-y-6",children:[e.jsx(xa,{catalog:a,savedPresets:t,currentModel:n,opusModel:i,sonnetModel:r,haikuModel:c,providerModels:d,provider:s,extendedContextEnabled:g,onExtendedContextToggle:f,onApplyPreset:m,onUpdateEnvValue:w,onOpenCustomPreset:u,onDeletePreset:j,isDeletePending:A}),e.jsx(Le,{}),e.jsx(ga,{accounts:x,onAddAccount:v,onSetDefault:p,onRemoveAccount:N,onPauseToggle:y,onSoloMode:b,onBulkPause:O,onBulkResume:C,isRemovingAccount:R,isPausingAccount:_,isSoloingAccount:F,isBulkPausing:k,isBulkResuming:h,privacyMode:S,showQuota:$,isKiro:P,kiroNoIncognito:M,onKiroNoIncognitoChange:I,kiroSettingsLoading:Q||E})]})})}function is({provider:s,displayName:a,authStatus:t,catalog:n,logoProvider:i,baseProvider:r,isRemoteMode:c,port:d,defaultTarget:g,onAddAccount:f,onSetDefault:m,onRemoveAccount:w,onPauseToggle:u,onSoloMode:j,onBulkPause:A,onBulkResume:x,isRemovingAccount:v,isPausingAccount:p,isSoloingAccount:N,isBulkPausing:y,isBulkResuming:b}){const[O,C]=o.useState(!1),{privacyMode:R}=ds(),{data:_}=mt(),{data:F}=xt(s),k=pt(),h=ht(),S=F?.presets||[],D=r||s,q=o.useMemo(()=>{if(!_?.models)return[];const X={gemini:["google"],agy:["antigravity"],codex:["openai"],qwen:["alibaba","qwen"],iflow:["iflow"],kiro:["kiro","aws"],ghcp:["github","copilot"],kimi:["kimi","moonshot"]}[D.toLowerCase()]||[D.toLowerCase()];return _.models.filter($e=>X.some(Is=>$e.owned_by.toLowerCase().includes(Is)))},[_,D]),$=(r||s).toLowerCase(),{data:P,isLoading:M,refetch:L,rawJsonContent:Q,rawJsonEdits:B,isRawJsonValid:E,hasChanges:V,currentModel:l,opusModel:I,sonnetModel:J,haikuModel:ee,extendedContextEnabled:ge,toggleExtendedContext:As,handleRawJsonChange:Ps,updateEnvValue:Ms,updateEnvValues:He,saveMutation:Ke,conflictDialog:Ts,handleConflictResolve:qe,missingRequiredFields:Os}=ia(s),Es=o.useMemo(()=>(t.accounts||[]).map(K=>({...K,provider:K.provider||r||s})),[t.accounts,r,s]),{data:_s}=rs({queryKey:["auth-tokens-raw"],queryFn:async()=>{const K=await fetch("/api/settings/auth/tokens/raw");return K.ok?K.json():{apiKey:{value:"ccs-internal-managed"}}},staleTime:6e4}),Ge=_s?.apiKey?.value??"ccs-internal-managed",Ds=K=>{He({ANTHROPIC_BASE_URL:`http://127.0.0.1:${d??Ne}/api/provider/${$}`,ANTHROPIC_AUTH_TOKEN:Ge,...K}),H.success(`Applied "${K.ANTHROPIC_MODEL?.split("/").pop()||"preset"}" preset`)},Rs=(K,X)=>{He({ANTHROPIC_BASE_URL:`http://127.0.0.1:${d??Ne}/api/provider/${$}`,ANTHROPIC_AUTH_TOKEN:Ge,ANTHROPIC_MODEL:K.default,ANTHROPIC_DEFAULT_OPUS_MODEL:K.opus,ANTHROPIC_DEFAULT_SONNET_MODEL:K.sonnet,ANTHROPIC_DEFAULT_HAIKU_MODEL:K.haiku}),H.success(`Applied ${X?`"${X}"`:"custom"} preset`),C(!1)},Ls=(K,X)=>{if(!X){H.error("Please enter a preset name to save");return}k.mutate({profile:s,data:{name:X,...K}}),C(!1)};return e.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[e.jsx(ua,{provider:s,displayName:a,logoProvider:i,data:P,isLoading:M,hasChanges:V,isRawJsonValid:E,isSaving:Ke.isPending,isRemoteMode:c,port:d,onRefetch:L,onSave:()=>Ke.mutate()}),M?e.jsxs("div",{className:"flex-1 flex items-center justify-center",children:[e.jsx(z,{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(ft,{defaultValue:"config",className:"h-full flex flex-col",children:[e.jsx("div",{className:"px-4 pt-4 shrink-0",children:e.jsxs(gt,{className:"w-full",children:[e.jsx(Xe,{value:"config",className:"flex-1",children:"Model Config"}),e.jsx(Xe,{value:"info",className:"flex-1",children:"Info & Usage"})]})}),e.jsxs("div",{className:"flex-1 overflow-hidden flex flex-col",children:[e.jsx(Ye,{value:"config",className:"flex-1 mt-0 border-0 p-0 data-[state=inactive]:hidden flex flex-col overflow-hidden",children:e.jsx(ja,{provider:s,catalog:n,savedPresets:S,currentModel:l,opusModel:I,sonnetModel:J,haikuModel:ee,providerModels:q,extendedContextEnabled:ge,onExtendedContextToggle:As,onApplyPreset:Ds,onUpdateEnvValue:Ms,onOpenCustomPreset:()=>C(!0),onDeletePreset:K=>h.mutate({profile:s,name:K}),isDeletePending:h.isPending,accounts:Es,onAddAccount:f,onSetDefault:m,onRemoveAccount:w,onPauseToggle:u,onSoloMode:j,onBulkPause:A,onBulkResume:x,isRemovingAccount:v,isPausingAccount:p,isSoloingAccount:N,isBulkPausing:y,isBulkResuming:b,privacyMode:R,isRemoteMode:c})}),e.jsx(Ye,{value:"info",className:"h-full mt-0 border-0 p-0 data-[state=inactive]:hidden",children:e.jsx(ca,{provider:s,displayName:a,defaultTarget:g,data:P,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(Ht,{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(jt,{rawJsonContent:Q,isRawJsonValid:E,rawJsonEdits:B,onRawJsonChange:Ps,profileEnv:P?.settings?.env,missingRequiredFields:Os})]})]}),e.jsx(Kt,{open:Ts,title:"File Modified Externally",description:"This settings file was modified by another process. Overwrite with your changes or discard?",confirmText:"Overwrite",variant:"destructive",onConfirm:()=>qe(!0),onCancel:()=>qe(!1)}),e.jsx(la,{open:O,onClose:()=>C(!1),currentValues:{default:l||"",opus:I||"",sonnet:J||"",haiku:ee||""},onApply:Rs,onSave:Ls,isSaving:k.isPending,catalog:n,allModels:q})]})}function va({status:s,isSelected:a,onSelect:t}){const n=s.accounts?.length||0;return e.jsxs("button",{className:G("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(Ue,{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(U,{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(W,{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(Re,{className:"w-3 h-3 text-muted-foreground"}),e.jsx("span",{className:"text-xs text-muted-foreground",children:"Not connected"})]})})]})]})}function Na({variant:s,parentAuth:a,isSelected:t,onSelect:n,onDelete:i,isDeleting:r}){return e.jsxs("button",{className:G("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(Ue,{provider:s.provider,size:"sm"}),e.jsx(bs,{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(U,{variant:"outline",className:"text-[9px] h-4 px-1",children:"variant"}),e.jsx(U,{variant:"outline",className:"text-[9px] h-4 px-1 uppercase",children:s.target||"claude"})]}),e.jsx("div",{className:"flex items-center gap-1.5 mt-0.5",children:a?.authenticated?e.jsxs(e.Fragment,{children:[e.jsx(W,{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(Re,{className:"w-3 h-3 text-muted-foreground"}),e.jsx("span",{className:"text-xs text-muted-foreground",children:"Parent not connected"})]})})]}),e.jsx(T,{variant:"ghost",size:"icon",className:"h-6 w-6 opacity-0 group-hover:opacity-100 hover:text-destructive",onClick:c=>{c.stopPropagation(),i()},disabled:r,children:e.jsx(ws,{className:"w-3 h-3"})})]})}function wa({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(xe,{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(T,{onClick:s,className:"gap-2",children:[e.jsx(me,{className:"w-4 h-4"}),"Quick Setup"]})]})})}function Fa(){const s=ke(),{data:a,isLoading:t}=cs(),{data:n,isFetching:i}=vt(),{data:r}=Nt(),c=wt(),d=bt(),g=kt(),f=Ct(),m=yt(),w=St(),u=At(),j=Pt(),[A,x]=o.useState(()=>typeof window<"u"?localStorage.getItem("cliproxy-selected-provider"):null),[v,p]=o.useState(null),[N,y]=o.useState(!1),[b,O]=o.useState(null),C=o.useMemo(()=>a?.authStatus||[],[a?.authStatus]),R=a?.source==="remote",_=o.useMemo(()=>n?.variants||[],[n?.variants]),F=l=>{x(l),l&&localStorage.setItem("cliproxy-selected-provider",l)},k=o.useMemo(()=>v?null:A&&C.some(l=>l.provider===A)?A:C.length>0&&(C.find(I=>(I.accounts?.length||0)>0)?.provider||C[0]?.provider)||null,[A,v,C]),h=C.find(l=>l.provider===k),S=_.find(l=>l.name===v),D=S?C.find(l=>l.provider===S.provider):void 0,q=(S?.provider||h?.provider||"").toLowerCase().trim(),$=q==="gemini"||q==="agy",P=()=>{s.invalidateQueries({queryKey:["cliproxy"]}),s.invalidateQueries({queryKey:["cliproxy-auth"]})},M=(l,I,J)=>{g.isPending||f.isPending||(J?g.mutate({provider:l,accountId:I}):f.mutate({provider:l,accountId:I}))},L=(l,I)=>{m.isPending||m.mutate({provider:l,accountId:I})},Q=(l,I)=>{w.isPending||w.mutate({provider:l,accountIds:I})},B=(l,I)=>{u.isPending||u.mutate({provider:l,accountIds:I})},E=l=>{F(l),p(null)},V=l=>{p(l),F(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(xe,{className:"w-5 h-5 text-primary"}),e.jsx("h1",{className:"font-semibold",children:r?.backendLabel??"CLIProxy"})]}),e.jsx(T,{variant:"ghost",size:"icon",className:"h-8 w-8",onClick:P,disabled:i,children:e.jsx(De,{className:G("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(T,{variant:"default",size:"sm",className:"w-full gap-2",onClick:()=>y(!0),children:[e.jsx(me,{className:"w-4 h-4"}),"Quick Setup"]})]}),e.jsx(Ee,{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(l=>e.jsx(Mt,{className:"h-14 w-full rounded-lg"},l))}):e.jsx("div",{className:"space-y-1",children:C.map(l=>e.jsx(va,{status:l,isSelected:k===l.provider,onSelect:()=>E(l.provider)},l.provider))}),_.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(bs,{className:"w-3 h-3"}),"Variants"]}),e.jsx("div",{className:"space-y-1",children:_.map(l=>e.jsx(Na,{variant:l,parentAuth:C.find(I=>I.provider===l.provider),isSelected:v===l.name,onSelect:()=>V(l.name),onDelete:()=>j.mutate(l.name),isDeleting:j.isPending},l.name))})]})]})}),e.jsx("div",{className:"p-3 border-t",children:e.jsx(qt,{})}),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:[C.length," provider",C.length!==1?"s":""]}),e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(W,{className:"w-3 h-3 text-green-600"}),C.filter(l=>l.authenticated).length," connected"]})]})})]}),e.jsxs("div",{className:"flex-1 flex flex-col min-w-0 bg-background",children:[$&&e.jsx(ys,{className:"mx-4 mt-4"}),S&&D?e.jsx(is,{provider:S.name,displayName:`${S.name} (${S.provider} variant)`,authStatus:D,catalog:ue[S.provider],logoProvider:S.provider,baseProvider:S.provider,defaultTarget:S.target,isRemoteMode:R,port:S.port,onAddAccount:()=>O({provider:S.provider,displayName:D.displayName,isFirstAccount:(D.accounts?.length||0)===0}),onSetDefault:l=>c.mutate({provider:S.provider,accountId:l}),onRemoveAccount:l=>d.mutate({provider:S.provider,accountId:l}),onPauseToggle:(l,I)=>M(S.provider,l,I),onSoloMode:l=>L(S.provider,l),onBulkPause:l=>Q(S.provider,l),onBulkResume:l=>B(S.provider,l),isRemovingAccount:d.isPending,isPausingAccount:g.isPending||f.isPending,isSoloingAccount:m.isPending,isBulkPausing:w.isPending,isBulkResuming:u.isPending}):h?e.jsx(is,{provider:h.provider,displayName:h.displayName,authStatus:h,catalog:ue[h.provider],isRemoteMode:R,onAddAccount:()=>O({provider:h.provider,displayName:h.displayName,isFirstAccount:(h.accounts?.length||0)===0}),onSetDefault:l=>c.mutate({provider:h.provider,accountId:l}),onRemoveAccount:l=>d.mutate({provider:h.provider,accountId:l}),onPauseToggle:(l,I)=>M(h.provider,l,I),onSoloMode:l=>L(h.provider,l),onBulkPause:l=>Q(h.provider,l),onBulkResume:l=>B(h.provider,l),isRemovingAccount:d.isPending,isPausingAccount:g.isPending||f.isPending,isSoloingAccount:m.isPending,isBulkPausing:w.isPending,isBulkResuming:u.isPending}):e.jsx(wa,{onSetup:()=>y(!0)})]}),e.jsx(Wt,{open:N,onClose:()=>y(!1)}),e.jsx(ea,{open:b!==null,onClose:()=>O(null),provider:b?.provider||"",displayName:b?.displayName||"",isFirstAccount:b?.isFirstAccount||!1})]})}export{Fa as CliproxyPage};
@@ -1 +0,0 @@
1
- import{j as e}from"./radix-ui-DIWAxjEp.js";import{r as c}from"./react-vendor-CNOkPC89.js";import{b5 as N,b6 as C,b7 as w,a_ as y,b0 as G,m as S,b,I as p}from"./index-PWMOllOf.js";import{S as k}from"./switch-s8pp-m8L.js";import{R as j,a1 as A,q as R,ag as L,$ as _}from"./icons-Dk2sL3Mr.js";import"./tanstack-Hn82hibe.js";import"./notifications-B2HqRBj7.js";import"./utils-CzKF5WmX.js";import"./form-utils-Cn_Uld6y.js";import"./code-highlight-BRUf_pqB.js";function V(){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}=V(),{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(_,{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 h}from"./react-vendor-CNOkPC89.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()),s=t=>{const a=M(t);return a.charAt(0).toUpperCase()+a.slice(1)},k=(...t)=>t.filter((a,c,o)=>!!a&&a.trim()!==""&&o.indexOf(a)===c).join(" ").trim(),v=t=>{for(const a in t)if(a.startsWith("aria-")||a==="role"||a==="title")return!0};var x={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 m=h.forwardRef(({color:t="currentColor",size:a=24,strokeWidth:c=2,absoluteStrokeWidth:o,className:d="",children:n,iconNode:r,...y},p)=>h.createElement("svg",{ref:p,...x,width:a,height:a,stroke:t,strokeWidth:o?Number(c)*24/Number(a):c,className:k("lucide",d),...!n&&!v(y)&&{"aria-hidden":"true"},...y},[...r.map(([i,l])=>h.createElement(i,l)),...Array.isArray(n)?n:[n]]));const e=(t,a)=>{const c=h.forwardRef(({className:o,...d},n)=>h.createElement(m,{ref:n,iconNode:a,className:k(`lucide-${_(s(t))}`,`lucide-${t}`,o),...d}));return c.displayName=s(t),c};const g=[["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"}]],M2=e("activity",g);const f=[["rect",{width:"20",height:"5",x:"2",y:"3",rx:"1",key:"1wp1u1"}],["path",{d:"M4 8v11a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8",key:"1s80jp"}],["path",{d:"M10 12h4",key:"a56b0p"}]],v2=e("archive",f);const w=[["path",{d:"M17 7 7 17",key:"15tmo1"}],["path",{d:"M17 17H7V7",key:"1org7z"}]],x2=e("arrow-down-left",w);const $=[["path",{d:"m7 7 10 10",key:"1fmybs"}],["path",{d:"M17 7v10H7",key:"6fjiku"}]],m2=e("arrow-down-right",$);const N=[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]],g2=e("arrow-down",N);const u=[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]],f2=e("arrow-left",u);const z=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]],w2=e("arrow-right",z);const b=[["path",{d:"M7 7h10v10",key:"1tivn9"}],["path",{d:"M7 17 17 7",key:"1vkiza"}]],$2=e("arrow-up-right",b);const q=[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]],N2=e("arrow-up",q);const C=[["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"}]],u2=e("book-open",C);const A=[["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"}]],z2=e("bot",A);const j=[["path",{d:"M21 8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16Z",key:"hh9hay"}],["path",{d:"m3.3 7 8.7 5 8.7-5",key:"g66t2b"}],["path",{d:"M12 22V12",key:"d0xqtd"}]],b2=e("box",j);const H=[["path",{d:"M12 18V5",key:"adv99a"}],["path",{d:"M15 13a4.17 4.17 0 0 1-3-4 4.17 4.17 0 0 1-3 4",key:"1e3is1"}],["path",{d:"M17.598 6.5A3 3 0 1 0 12 5a3 3 0 1 0-5.598 1.5",key:"1gqd8o"}],["path",{d:"M17.997 5.125a4 4 0 0 1 2.526 5.77",key:"iwvgf7"}],["path",{d:"M18 18a4 4 0 0 0 2-7.464",key:"efp6ie"}],["path",{d:"M19.967 17.483A4 4 0 1 1 12 18a4 4 0 1 1-7.967-.517",key:"1gq6am"}],["path",{d:"M6 18a4 4 0 0 1-2-7.464",key:"k1g0md"}],["path",{d:"M6.003 5.125a4 4 0 0 0-2.526 5.77",key:"q97ue3"}]],q2=e("brain",H);const V=[["path",{d:"M12 20v-9",key:"1qisl0"}],["path",{d:"M14 7a4 4 0 0 1 4 4v3a6 6 0 0 1-12 0v-3a4 4 0 0 1 4-4z",key:"uouzyp"}],["path",{d:"M14.12 3.88 16 2",key:"qol33r"}],["path",{d:"M21 21a4 4 0 0 0-3.81-4",key:"1b0z45"}],["path",{d:"M21 5a4 4 0 0 1-3.55 3.97",key:"5cxbf6"}],["path",{d:"M22 13h-4",key:"1jl80f"}],["path",{d:"M3 21a4 4 0 0 1 3.81-4",key:"1fjd4g"}],["path",{d:"M3 5a4 4 0 0 0 3.55 3.97",key:"1d7oge"}],["path",{d:"M6 13H2",key:"82j7cp"}],["path",{d:"m8 2 1.88 1.88",key:"fmnt4t"}],["path",{d:"M9 7.13V6a3 3 0 1 1 6 0v1.13",key:"1vgav8"}]],C2=e("bug",V);const L=[["path",{d:"M16 14v2.2l1.6 1",key:"fo4ql5"}],["path",{d:"M16 2v4",key:"4m81vk"}],["path",{d:"M21 7.5V6a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h3.5",key:"1osxxc"}],["path",{d:"M3 10h5",key:"r794hk"}],["path",{d:"M8 2v4",key:"1cmpym"}],["circle",{cx:"16",cy:"16",r:"6",key:"qoo3c4"}]],A2=e("calendar-clock",L);const S=[["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"}]],j2=e("calendar",S);const B=[["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"}]],H2=e("chart-column",B);const P=[["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"}]],V2=e("chart-pie",P);const R=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],L2=e("check",R);const E=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],S2=e("chevron-down",E);const D=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],B2=e("chevron-left",D);const F=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],P2=e("chevron-right",F);const U=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],R2=e("chevron-up",U);const G=[["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"}]],E2=e("circle-alert",G);const O=[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]],D2=e("circle-check-big",O);const W=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],F2=e("circle-check",W);const T=[["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"}]],U2=e("circle-question-mark",T);const Z=[["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"}]],G2=e("circle-x",Z);const I=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],O2=e("circle",I);const K=[["path",{d:"M12 6v6l4 2",key:"mmk7yg"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],W2=e("clock",K);const X=[["path",{d:"M17.5 19H9a7 7 0 1 1 6.71-9h1.79a4.5 4.5 0 1 1 0 9Z",key:"p7xjir"}]],T2=e("cloud",X);const J=[["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"}]],Z2=e("code-xml",J);const Q=[["path",{d:"m16 18 6-6-6-6",key:"eg8j8"}],["path",{d:"m8 6-6 6 6 6",key:"ppft3o"}]],I2=e("code",Q);const Y=[["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"}]],K2=e("coins",Y);const e1=[["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"}]],X2=e("copy",e1);const a1=[["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"}]],J2=e("cpu",a1);const t1=[["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"}]],Q2=e("database",t1);const c1=[["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"}]],Y2=e("dollar-sign",c1);const o1=[["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"}]],e0=e("download",o1);const n1=[["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"}]],a0=e("ellipsis",n1);const h1=[["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"}]],t0=e("external-link",h1);const d1=[["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"}]],c0=e("eye-off",d1);const y1=[["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"}]],o0=e("eye",y1);const s1=[["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"}]],n0=e("file-braces",s1);const k1=[["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"}]],h0=e("file-code",k1);const r1=[["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:"M12 18v-6",key:"17g6i2"}],["path",{d:"m9 15 3 3 3-3",key:"1npd3o"}]],d0=e("file-down",r1);const p1=[["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"}]],y0=e("file-exclamation-point",p1);const i1=[["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"}]],s0=e("file-text",i1);const l1=[["path",{d:"M10 10.5 8 13l2 2.5",key:"m4t9c1"}],["path",{d:"m14 10.5 2 2.5-2 2.5",key:"14w2eb"}],["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2z",key:"1u1bxd"}]],k0=e("folder-code",l1);const _1=[["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"}]],r0=e("folder-open",_1);const M1=[["path",{d:"m12 14 4-4",key:"9kzdfg"}],["path",{d:"M3.34 19a10 10 0 1 1 17.32 0",key:"19p75a"}]],p0=e("gauge",M1);const v1=[["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"}]],i0=e("git-branch",v1);const x1=[["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"}]],l0=e("github",x1);const m1=[["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"}]],_0=e("globe",m1);const g1=[["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"}]],M0=e("grip-horizontal",g1);const f1=[["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"}]],v0=e("grip-vertical",f1);const w1=[["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",w1);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"}]],m0=e("house",$1);const N1=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]],g0=e("info",N1);const u1=[["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"}]],f0=e("key-round",u1);const z1=[["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"}]],w0=e("key",z1);const b1=[["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"}]],$0=e("laptop",b1);const q1=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],N0=e("loader-circle",q1);const C1=[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 10 0v4",key:"fwvmzm"}]],u0=e("lock",C1);const A1=[["path",{d:"m16 17 5-5-5-5",key:"1bji2h"}],["path",{d:"M21 12H9",key:"dn1m92"}],["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}]],z0=e("log-out",A1);const j1=[["path",{d:"M11 6a13 13 0 0 0 8.4-2.8A1 1 0 0 1 21 4v12a1 1 0 0 1-1.6.8A13 13 0 0 0 11 14H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2z",key:"q8bfy3"}],["path",{d:"M6 14a12 12 0 0 0 2.4 7.2 2 2 0 0 0 3.2-2.4A8 8 0 0 1 10 14",key:"1853fq"}],["path",{d:"M8 6v8",key:"15ugcq"}]],b0=e("megaphone",j1);const H1=[["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"}]],q0=e("monitor",H1);const V1=[["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"}]],C0=e("moon",V1);const L1=[["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"}]],A0=e("network",L1);const S1=[["path",{d:"M11 21.73a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73z",key:"1a0edw"}],["path",{d:"M12 22V12",key:"d0xqtd"}],["polyline",{points:"3.29 7 12 12 20.71 7",key:"ousv84"}],["path",{d:"m7.5 4.27 9 5.15",key:"1c824w"}]],j0=e("package",S1);const B1=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}]],H0=e("panel-left",B1);const P1=[["rect",{x:"14",y:"3",width:"5",height:"18",rx:"1",key:"kaeet6"}],["rect",{x:"5",y:"3",width:"5",height:"18",rx:"1",key:"1wsw3u"}]],V0=e("pause",P1);const R1=[["path",{d:"M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z",key:"10ikf1"}]],L0=e("play",R1);const E1=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],S0=e("plus",E1);const D1=[["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"}]],B0=e("power-off",D1);const F1=[["path",{d:"M12 2v10",key:"mnfbl"}],["path",{d:"M18.4 6.6a9 9 0 1 1-12.77.04",key:"obofu9"}]],P0=e("power",F1);const U1=[["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"}]],R0=e("radio",U1);const G1=[["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"}]],E0=e("refresh-cw",G1);const O1=[["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"}]],D0=e("rotate-ccw",O1);const W1=[["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"}]],F0=e("rotate-cw",W1);const T1=[["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"}]],U0=e("save",T1);const Z1=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],G0=e("search",Z1);const I1=[["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"}]],O0=e("server",I1);const K1=[["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"}]],W0=e("settings-2",K1);const X1=[["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"}]],T0=e("settings",X1);const J1=[["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"}]],Z0=e("shield-check",J1);const Q1=[["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"}]],I0=e("shield",Q1);const Y1=[["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"}]],K0=e("sparkles",Y1);const e2=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]],X0=e("square",e2);const a2=[["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"}]],J0=e("star",a2);const t2=[["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"}]],Q0=e("sun",t2);const c2=[["path",{d:"M12 19h8",key:"baeox8"}],["path",{d:"m4 17 6-6-6-6",key:"1yngyt"}]],Y0=e("terminal",c2);const o2=[["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"}]],ee=e("trash-2",o2);const n2=[["path",{d:"M16 7h6v6",key:"box55l"}],["path",{d:"m22 7-8.5 8.5-5-5L2 17",key:"1t1m79"}]],ae=e("trending-up",n2);const h2=[["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"}]],te=e("triangle-alert",h2);const d2=[["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"}]],ce=e("user",d2);const y2=[["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"}]],oe=e("users",y2);const s2=[["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"}]],ne=e("wand-sparkles",s2);const k2=[["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"}]],he=e("wifi-off",k2);const r2=[["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"}]],de=e("wifi",r2);const p2=[["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"}]],ye=e("wrench",p2);const i2=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],se=e("x",i2);const l2=[["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"}]],ke=e("zap",l2);export{S0 as $,M2 as A,u2 as B,H2 as C,$2 as D,c0 as E,r0 as F,p0 as G,m0 as H,g0 as I,x2 as J,w0 as K,N0 as L,C0 as M,s0 as N,y0 as O,H0 as P,M0 as Q,E0 as R,T0 as S,te as T,oe as U,S2 as V,he as W,se as X,R2 as Y,ke as Z,W0 as _,l0 as a,K0 as a0,E2 as a1,_0 as a2,q2 as a3,O0 as a4,v2 as a5,h0 as a6,B2 as a7,u0 as a8,Y2 as a9,z2 as aA,A2 as aB,b0 as aC,j0 as aD,T2 as aE,$0 as aF,b2 as aG,C2 as aH,d0 as aI,F0 as aJ,X0 as aK,g2 as aL,N2 as aM,Q2 as aa,m2 as ab,j2 as ac,K2 as ad,ae,V2 as af,ee as ag,U0 as ah,G0 as ai,ne as aj,Z2 as ak,w2 as al,n0 as am,f2 as an,e0 as ao,J0 as ap,A0 as aq,k0 as ar,a0 as as,U2 as at,i0 as au,P0 as av,B0 as aw,Z0 as ax,ye as ay,q0 as az,P2 as b,Q0 as c,o0 as d,de as e,I0 as f,x0 as g,D2 as h,O2 as i,L2 as j,f0 as k,X2 as l,t0 as m,ce as n,z0 as o,W2 as p,F2 as q,G2 as r,L0 as s,V0 as t,v0 as u,D0 as v,R0 as w,J2 as x,Y0 as y,I2 as z};
@@ -1 +0,0 @@
1
- import{j as e}from"./radix-ui-DIWAxjEp.js";import{r as i}from"./react-vendor-CNOkPC89.js";import{b5 as P,b6 as $,I as F,b7 as U,a_ as _,b0 as z,m as B,b as O}from"./index-PWMOllOf.js";import{S as K}from"./switch-s8pp-m8L.js";import{y as q,j as D,Y,V,m as J,R as y,a1 as X,q as Z,aD as Q}from"./icons-Dk2sL3Mr.js";import"./tanstack-Hn82hibe.js";import"./notifications-B2HqRBj7.js";import"./utils-CzKF5WmX.js";import"./form-utils-Cn_Uld6y.js";import"./code-highlight-BRUf_pqB.js";function ee(){const{state:s}=P(),a=$(),[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]),g=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 g({providers:{...r,gemini:{...r.gemini,model:d}}}),h(!0),setTimeout(()=>h(!1),2e3)}},[d,s.webSearchConfig,g]),p=i.useCallback(async()=>{const t=s.webSearchConfig?.providers?.opencode?.model??"opencode/grok-code";if(o!==t){const r=s.webSearchConfig?.providers||{};await g({providers:{...r,opencode:{...r.opencode,model:o}}}),u(!0),setTimeout(()=>u(!1),2e3)}},[o,s.webSearchConfig,g]);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:g,saveGeminiModel:x,saveOpencodeModel:p}}function A({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:g,modelPlaceholder:x,showHint:p,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",E=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",I=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(q,{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:W=>S(W.target.value),onBlur:v,placeholder:x,className:"h-8 text-sm font-mono",disabled:h}),g&&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(D,{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(!p),className:`flex items-center gap-2 text-sm hover:underline w-full py-2 ${I}`,children:[p?e.jsx(Y,{className:"w-4 h-4"}):e.jsx(V,{className:"w-4 h-4"}),"How to install ",M," CLI"]}),p&&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 ${E}`,children:r}),e.jsxs("a",{href:w,target:"_blank",rel:"noopener noreferrer",className:"hover:underline inline-flex items-center gap-1",children:[e.jsx(J,{className:"w-3 h-3"}),"View documentation"]})]})]})]})}function me(){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:g,fetchConfig:x,fetchStatus:p,saveConfig:t,saveGeminiModel:r,saveOpencodeModel:w}=ee(),{fetchRawConfig:n}=U(),[C,k]=i.useState(!1),[E,I]=i.useState(!1),[M,W]=i.useState(!1);i.useEffect(()=>{x(),p(),n()},[x,p,n]);const N=s?.providers?.gemini?.enabled??!1,G=s?.providers?.grok?.enabled??!1,L=s?.providers?.opencode?.enabled??!1,H=()=>{const c=s?.providers||{},b=c.gemini?.enabled??!1;t({enabled:!b||G||L,providers:{...c,gemini:{...c.gemini,enabled:!b}}})},R=()=>{const c=s?.providers||{},b=c.grok?.enabled??!1;t({enabled:N||!b||L,providers:{...c,grok:{...c.grok,enabled:!b}}})},T=()=>{const c=s?.providers||{},b=c.opencode?.enabled??!1;t({enabled:N||G||!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(y,{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(_,{variant:"destructive",className:"py-2 shadow-lg",children:[e.jsx(X,{className:"h-4 w-4"}),e.jsx(z,{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(B,{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(O,{variant:"ghost",size:"sm",onClick:p,disabled:l,children:e.jsx(y,{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"}),!a?.geminiCli&&!a?.opencodeCli&&!a?.grokCli&&!l&&e.jsxs("div",{className:"flex flex-col items-center justify-center p-8 border-2 border-dashed rounded-lg text-center bg-muted/30",children:[e.jsx(Q,{className:"w-12 h-12 text-muted-foreground mb-3 opacity-30"}),e.jsx("p",{className:"font-medium text-foreground mb-1",children:"No providers configured"}),e.jsx("p",{className:"text-sm text-muted-foreground mb-4",children:"Install CLI tools to enable web search providers"}),e.jsxs(O,{variant:"outline",size:"sm",onClick:p,children:[e.jsx(y,{className:"w-4 h-4 mr-2"}),"Check for providers"]})]}),e.jsx(A,{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(A,{name:"opencode",label:"OpenCode (web search via Zen)",badge:"FREE",badgeColor:"green",enabled:L,installed:a?.opencodeCli?.installed??!1,statusLoading:l,saving:o,onToggle:T,modelInput:u,setModelInput:S,onModelBlur:w,modelSaved:g,modelPlaceholder:"opencode/grok-code",showHint:E,setShowHint:I,installCmd:"curl -fsSL https://opencode.ai/install | bash",docsUrl:"https://github.com/sst/opencode",hintColor:"purple"}),e.jsx(A,{name:"grok",label:"xAI Grok CLI (web + X search)",badge:"GROK_API_KEY",badgeColor:"blue",enabled:G,installed:a?.grokCli?.installed??!1,statusLoading:l,saving:o,onToggle:R,showHint:M,setShowHint:W,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(O,{variant:"outline",size:"sm",onClick:()=>{x(),n()},disabled:d||o,className:"w-full",children:[e.jsx(y,{className:`w-4 h-4 mr-2 ${d?"animate-spin":""}`}),"Refresh"]})})]})}export{me as default};
@@ -1 +0,0 @@
1
- import{j as e}from"./radix-ui-DIWAxjEp.js";import{r as d}from"./react-vendor-CNOkPC89.js";import{b5 as ye,b6 as je,W as L,I as T,q as ve,r as Ne,s as ke,t as Ce,v as Y,b as Z,b7 as Pe,b8 as Se,b9 as we,a_ as O,b0 as U,m as Ie}from"./index-PWMOllOf.js";import{S as _}from"./switch-s8pp-m8L.js";import{C as R}from"./default-ports-1QQSffYX.js";import{aE as ee,R as V,e as Ee,q as te,W as Te,a1 as Le,aF as Ae,aG as _e,T as X,aH as Re}from"./icons-Dk2sL3Mr.js";import{P as Be}from"./proxy-status-widget-MlyNgoPh.js";import{t as J}from"./notifications-B2HqRBj7.js";import"./tanstack-Hn82hibe.js";import"./utils-CzKF5WmX.js";import"./form-utils-Cn_Uld6y.js";import"./code-highlight-BRUf_pqB.js";import"./alert-dialog-DmrIcJav.js";function De(){const{state:t}=ye(),s=je(),[n,m]=d.useState(null),[h,b]=d.useState(null),[g,u]=d.useState(null),[v,N]=d.useState(null),[f,k]=d.useState(null),C=d.useCallback(async()=>{try{s.setProxyLoading(!0),s.setProxyError(null);const l=await L.cliproxyServer.get();s.setProxyConfig(l)}catch(l){s.setProxyError(l.message)}finally{s.setProxyLoading(!1)}},[s]),P=d.useCallback(async l=>{const i=t.proxyConfig;if(!i)return;const p={remote:{...i.remote,...l.remote},fallback:{...i.fallback,...l.fallback},local:{...i.local,...l.local}};s.setProxyConfig(p),s.setProxyTestResult(null);try{s.setProxySaving(!0),s.setProxyError(null);const a=await L.cliproxyServer.update(l);s.setProxyConfig(a),s.setProxySuccess(!0),setTimeout(()=>s.setProxySuccess(!1),1500)}catch(a){s.setProxyConfig(i),s.setProxyError(a.message)}finally{s.setProxySaving(!1)}},[t.proxyConfig,s]),S=d.useCallback(async l=>{const{host:i,port:p,protocol:a,authToken:w}=l;if(!i){s.setProxyError("Host is required");return}try{s.setProxyTesting(!0),s.setProxyError(null),s.setProxyTestResult(null);const o=p?parseInt(p,10):void 0,I=await L.cliproxyServer.test({host:i,port:o||void 0,protocol:a,authToken:w||void 0});s.setProxyTestResult(I)}catch(o){s.setProxyError(o.message)}finally{s.setProxyTesting(!1)}},[s]);return{config:t.proxyConfig,loading:t.proxyLoading,saving:t.proxySaving,error:t.proxyError,success:t.proxySuccess,testResult:t.proxyTestResult,testing:t.proxyTesting,editedHost:n,setEditedHost:m,editedPort:h,setEditedPort:b,editedAuthToken:g,setEditedAuthToken:u,editedManagementKey:v,setEditedManagementKey:N,editedLocalPort:f,setEditedLocalPort:k,fetchConfig:C,saveConfig:P,testConnection:S}}function Me({config:t,saving:s,displayLocalPort:n,setEditedLocalPort:m,onSaveLocalPort:h,onSaveConfig:b}){const g=t.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:"flex items-center gap-2",children:[e.jsx("label",{className:"text-sm text-muted-foreground",children:"Port"}),e.jsx(T,{type:"text",inputMode:"numeric",value:n,onChange:u=>m(u.target.value.replace(/\D/g,"")),onBlur:h,placeholder:`${R}`,className:"font-mono max-w-32",disabled:s})]}),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(_,{checked:g.auto_start??!0,onCheckedChange:u=>b({local:{...g,auto_start:u}}),disabled:s})]})]})]})}function Ke({config:t,saving:s,testing:n,testResult:m,displayHost:h,displayPort:b,displayAuthToken:g,displayManagementKey:u,setEditedHost:v,setEditedPort:N,setEditedAuthToken:f,setEditedManagementKey:k,onSaveHost:C,onSavePort:P,onSaveAuthToken:S,onSaveManagementKey:l,onSaveConfig:i,onTestConnection:p}){const a=t.remote,w=o=>o==="https"?443:R;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(ee,{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(T,{value:h,onChange:o=>v(o.target.value),onBlur:C,placeholder:"192.168.1.100 or proxy.example.com",className:"font-mono",disabled:s})]}),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: ",w(t.remote.protocol||"http"),")"]})]}),e.jsx(T,{type:"text",inputMode:"numeric",value:b,onChange:o=>N(o.target.value.replace(/\D/g,"")),onBlur:P,placeholder:`Leave empty for ${w(t.remote.protocol||"http")}`,className:"font-mono",disabled:s})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("label",{className:"text-sm text-muted-foreground",children:"Protocol"}),e.jsxs(ve,{value:t.remote.protocol||"http",onValueChange:o=>i({remote:{...a,protocol:o}}),disabled:s,children:[e.jsx(Ne,{children:e.jsx(ke,{})}),e.jsxs(Ce,{children:[e.jsx(Y,{value:"http",children:"HTTP"}),e.jsx(Y,{value:"https",children:"HTTPS"})]})]})]})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("label",{className:"text-sm text-muted-foreground",children:"API Key (optional)"}),e.jsx(T,{type:"password",value:g,onChange:o=>f(o.target.value),onBlur:S,placeholder:"For /v1/* API endpoints",className:"font-mono",disabled:s}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Used for API requests to /v1/chat/completions"})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("label",{className:"text-sm text-muted-foreground",children:"Management Key (optional)"}),e.jsx(T,{type:"password",value:u,onChange:o=>k(o.target.value),onBlur:l,placeholder:"For /v0/management/* endpoints",className:"font-mono",disabled:s}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Used for dashboard management APIs. Falls back to API Key if not set."})]}),e.jsxs("div",{className:"space-y-3 pt-2",children:[e.jsx(Z,{onClick:p,disabled:n||!h,variant:"outline",className:"w-full",children:n?e.jsxs(e.Fragment,{children:[e.jsx(V,{className:"w-4 h-4 mr-2 animate-spin"}),"Testing..."]}):e.jsxs(e.Fragment,{children:[e.jsx(Ee,{className:"w-4 h-4 mr-2"}),"Test Connection"]})}),m&&e.jsx("div",{className:`p-3 rounded-md ${m.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:m.reachable?e.jsxs(e.Fragment,{children:[e.jsx(te,{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 (",m.latencyMs,"ms)"]})]}):e.jsxs(e.Fragment,{children:[e.jsx(Te,{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:m.error||"Connection failed"})]})})})]})]})}const Q="ccs_debug_mode",Fe=["kiro","ghcp"];function Ze(){const{config:t,loading:s,saving:n,error:m,success:h,testResult:b,testing:g,editedHost:u,setEditedHost:v,editedPort:N,setEditedPort:f,editedAuthToken:k,setEditedAuthToken:C,editedManagementKey:P,setEditedManagementKey:S,editedLocalPort:l,setEditedLocalPort:i,fetchConfig:p,saveConfig:a,testConnection:w}=De(),{fetchRawConfig:o}=Pe(),[I,se]=d.useState(()=>{try{return localStorage.getItem(Q)==="true"}catch{return!1}}),re=r=>{se(r);try{localStorage.setItem(Q,String(r))}catch{}},[y,B]=d.useState("plus"),[ae,oe]=d.useState(!1),D=Se(),{data:ne}=we(),G=ne?.running??!1,M=d.useCallback(async()=>{try{const r=await L.cliproxyServer.getBackend();B(r.backend)}catch(r){console.error("[Proxy] Failed to fetch backend:",r)}},[]),K=d.useCallback(async()=>{try{const c=(await L.cliproxy.list()).variants.some(be=>Fe.includes(be.provider));oe(c)}catch(r){console.error("[Proxy] Failed to check variants:",r)}},[]),W=r=>{const c=y;B(r),D.mutate({backend:r},{onError:()=>{B(c)}})};if(d.useEffect(()=>{if(I&&t){const r={...t,remote:{...t.remote,auth_token:t.remote.auth_token?"[REDACTED]":void 0,management_key:t.remote.management_key?"[REDACTED]":void 0}};console.log("[CCS Debug] Debug mode enabled - proxy config:",r)}},[I,t]),d.useEffect(()=>{p(),o(),M(),K()},[p,o,M,K]),s||!t)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(V,{className:"w-5 h-5 animate-spin"}),e.jsx("span",{children:"Loading..."})]})});const x=t.remote.enabled??!1,A=!x&&G,j=t.remote,E=t.fallback,le=t.remote.host??"",ce=t.remote.port!==void 0?t.remote.port.toString():"",de=t.remote.auth_token??"",ie=t.remote.management_key??"",me=(t.local.port??R).toString(),F=u??le,H=N??ce,$=k??de,q=P??ie,z=l??me,xe=()=>{const r=u??F;r!==t.remote.host&&a({remote:{...j,host:r}}),v(null)},ue=()=>{const r=(N??H).trim();if(r===""){t.remote.port!==void 0&&a({remote:{...j,port:void 0}}),f(null);return}const c=Number(r);if(!Number.isInteger(c)||c<1||c>65535){J.error("Port must be an integer between 1 and 65535, or empty for default"),f(null);return}c!==t.remote.port&&a({remote:{...j,port:c}}),f(null)},pe=()=>{const r=k??$;r!==t.remote.auth_token&&a({remote:{...j,auth_token:r}}),C(null)},he=()=>{const r=P??q;r!==t.remote.management_key&&a({remote:{...j,management_key:r||void 0}}),S(null)},ge=()=>{const r=(l??z).trim(),c=r===""?R:Number(r);if(!Number.isInteger(c)||c<1||c>65535){J.error("Local port must be an integer between 1 and 65535"),i(null);return}c!==t.local.port&&a({local:{...t.local,port:c}}),i(null)},fe=()=>{w({host:F,port:H,protocol:t.remote.protocol||"http",authToken:$})};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 ${m||h?"opacity-100 translate-y-0":"opacity-0 -translate-y-2 pointer-events-none"}`,children:[m&&e.jsxs(O,{variant:"destructive",className:"py-2 shadow-lg",children:[e.jsx(Le,{className:"h-4 w-4"}),e.jsx(U,{children:m})]}),h&&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(te,{className:"h-4 w-4 shrink-0"}),e.jsx("span",{className:"text-sm font-medium",children:"Saved"})]})]}),e.jsx(Ie,{className:"flex-1",children:e.jsxs("div",{className:"p-5 space-y-6",children:[e.jsxs("p",{className:"text-sm text-muted-foreground",children:["Configure local or remote ",y==="plus"?"CLIProxy Plus":"CLIProxy"," connection for proxy-based profiles"]}),!x&&e.jsxs("div",{className:"space-y-3",children:[e.jsx("h3",{className:"text-base font-medium",children:"Instance Status"}),e.jsx(Be,{})]}),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:()=>a({remote:{...j,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(Ae,{className:`w-5 h-5 ${x?"text-muted-foreground":"text-primary"}`}),e.jsx("span",{className:"font-medium",children:"Local"})]}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:["Run ",y==="plus"?"CLIProxy Plus":"CLIProxy"," binary on this machine"]})]}),e.jsxs("button",{onClick:()=>a({remote:{...j,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(ee,{className:`w-5 h-5 ${x?"text-primary":"text-muted-foreground"}`}),e.jsx("span",{className:"font-medium",children:"Remote"})]}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:["Connect to a remote ",y==="plus"?"CLIProxy Plus":"CLIProxy"," server"]})]})]})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs("h3",{className:"text-base font-medium flex items-center gap-2",children:[e.jsx(_e,{className:"w-4 h-4"}),"Backend Binary"]}),!x&&G&&e.jsxs(O,{className:"py-2 border-amber-200 bg-amber-50 dark:border-amber-900/50 dark:bg-amber-900/20 [&>svg]:top-2.5",children:[e.jsx(X,{className:"h-4 w-4 text-amber-600"}),e.jsx(U,{className:"text-amber-700 dark:text-amber-400",children:"Stop the running proxy in Instance Status to switch backend."})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsxs("button",{onClick:()=>W("plus"),disabled:D.isPending||A,className:`p-4 rounded-lg border-2 text-left transition-all ${y==="plus"?"border-primary bg-primary/5":"border-border hover:border-muted-foreground/50"} ${A?"opacity-60 cursor-not-allowed":""}`,children:[e.jsxs("div",{className:"flex items-center gap-3 mb-2",children:[e.jsx("span",{className:"font-medium",children:"CLIProxyAPIPlus"}),e.jsx("span",{className:"text-xs px-1.5 py-0.5 rounded bg-green-100 text-green-700 dark:bg-green-900/50 dark:text-green-400",children:"Default"})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Full provider support including Kiro and GitHub Copilot"})]}),e.jsxs("button",{onClick:()=>W("original"),disabled:D.isPending||A,className:`p-4 rounded-lg border-2 text-left transition-all ${y==="original"?"border-primary bg-primary/5":"border-border hover:border-muted-foreground/50"} ${A?"opacity-60 cursor-not-allowed":""}`,children:[e.jsx("div",{className:"flex items-center gap-3 mb-2",children:e.jsx("span",{className:"font-medium",children:"CLIProxyAPI"})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Original binary (Gemini, Codex, Antigravity only)"})]})]}),y==="original"&&ae&&e.jsxs(O,{variant:"destructive",className:"py-2",children:[e.jsx(X,{className:"h-4 w-4"}),e.jsx(U,{children:"Existing Kiro/Copilot variants will not work with CLIProxyAPI. Switch to CLIProxyAPIPlus or remove those variants."})]})]}),x&&e.jsx(Ke,{config:t,saving:n,testing:g,testResult:b,displayHost:F,displayPort:H,displayAuthToken:$,displayManagementKey:q,setEditedHost:v,setEditedPort:f,setEditedAuthToken:C,setEditedManagementKey:S,onSaveHost:xe,onSavePort:ue,onSaveAuthToken:pe,onSaveManagementKey:he,onSaveConfig:a,onTestConnection:fe}),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(_,{checked:E.enabled??!0,onCheckedChange:r=>a({fallback:{...E,enabled:r}}),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(_,{checked:E.auto_start??!1,onCheckedChange:r=>a({fallback:{...E,auto_start:r}}),disabled:n||!x||!E.enabled})]})]})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs("h3",{className:"text-base font-medium flex items-center gap-2",children:[e.jsx(Re,{className:"w-4 h-4"}),"Advanced"]}),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:"Debug Mode"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Enable developer diagnostics in browser console"})]}),e.jsx(_,{checked:I,onCheckedChange:re,disabled:n})]}),I&&e.jsx("p",{className:"text-xs text-amber-600 dark:text-amber-400 pl-0.5",children:"Debug mode enabled. Check browser console for detailed logs."})]})]}),!x&&e.jsx(Me,{config:t,saving:n,displayLocalPort:z,setEditedLocalPort:i,onSaveLocalPort:ge,onSaveConfig:a})]})}),e.jsx("div",{className:"p-4 border-t bg-background",children:e.jsxs(Z,{variant:"outline",size:"sm",onClick:()=>{p(),o(),M(),K()},disabled:s||n,className:"w-full",children:[e.jsx(V,{className:`w-4 h-4 mr-2 ${s?"animate-spin":""}`}),"Refresh"]})})]})}export{Ze as default};