@kaitranntt/ccs 8.2.0-dev.1 → 8.2.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 (224) hide show
  1. package/README.md +12 -0
  2. package/config/base-claude.settings.json +1 -5
  3. package/dist/api/services/cliproxy-profile-bridge.d.ts.map +1 -1
  4. package/dist/api/services/cliproxy-profile-bridge.js +6 -0
  5. package/dist/api/services/cliproxy-profile-bridge.js.map +1 -1
  6. package/dist/api/services/profile-writer.d.ts.map +1 -1
  7. package/dist/api/services/profile-writer.js +18 -8
  8. package/dist/api/services/profile-writer.js.map +1 -1
  9. package/dist/auth/commands/create-command.d.ts.map +1 -1
  10. package/dist/auth/commands/create-command.js +11 -0
  11. package/dist/auth/commands/create-command.js.map +1 -1
  12. package/dist/cliproxy/accounts/account-safety-cross-lane.d.ts +41 -0
  13. package/dist/cliproxy/accounts/account-safety-cross-lane.d.ts.map +1 -0
  14. package/dist/cliproxy/accounts/account-safety-cross-lane.js +177 -0
  15. package/dist/cliproxy/accounts/account-safety-cross-lane.js.map +1 -0
  16. package/dist/cliproxy/accounts/account-safety.d.ts +29 -1
  17. package/dist/cliproxy/accounts/account-safety.d.ts.map +1 -1
  18. package/dist/cliproxy/accounts/account-safety.js +41 -7
  19. package/dist/cliproxy/accounts/account-safety.js.map +1 -1
  20. package/dist/cliproxy/accounts/drain-order.d.ts +277 -0
  21. package/dist/cliproxy/accounts/drain-order.d.ts.map +1 -0
  22. package/dist/cliproxy/accounts/drain-order.js +575 -0
  23. package/dist/cliproxy/accounts/drain-order.js.map +1 -0
  24. package/dist/cliproxy/accounts/pool-state.d.ts +132 -0
  25. package/dist/cliproxy/accounts/pool-state.d.ts.map +1 -0
  26. package/dist/cliproxy/accounts/pool-state.js +201 -0
  27. package/dist/cliproxy/accounts/pool-state.js.map +1 -0
  28. package/dist/cliproxy/accounts/registry.d.ts +17 -1
  29. package/dist/cliproxy/accounts/registry.d.ts.map +1 -1
  30. package/dist/cliproxy/accounts/registry.js +47 -1
  31. package/dist/cliproxy/accounts/registry.js.map +1 -1
  32. package/dist/cliproxy/accounts/types.d.ts +20 -0
  33. package/dist/cliproxy/accounts/types.d.ts.map +1 -1
  34. package/dist/cliproxy/auth/oauth-handler.d.ts.map +1 -1
  35. package/dist/cliproxy/auth/oauth-handler.js +29 -0
  36. package/dist/cliproxy/auth/oauth-handler.js.map +1 -1
  37. package/dist/cliproxy/claude-shadow-warning.d.ts +39 -0
  38. package/dist/cliproxy/claude-shadow-warning.d.ts.map +1 -0
  39. package/dist/cliproxy/claude-shadow-warning.js +187 -0
  40. package/dist/cliproxy/claude-shadow-warning.js.map +1 -0
  41. package/dist/cliproxy/config/base-config-loader.d.ts +6 -5
  42. package/dist/cliproxy/config/base-config-loader.d.ts.map +1 -1
  43. package/dist/cliproxy/config/base-config-loader.js +19 -12
  44. package/dist/cliproxy/config/base-config-loader.js.map +1 -1
  45. package/dist/cliproxy/config/env-builder.d.ts +3 -0
  46. package/dist/cliproxy/config/env-builder.d.ts.map +1 -1
  47. package/dist/cliproxy/config/env-builder.js +158 -20
  48. package/dist/cliproxy/config/env-builder.js.map +1 -1
  49. package/dist/cliproxy/config/generator.d.ts +2 -1
  50. package/dist/cliproxy/config/generator.d.ts.map +1 -1
  51. package/dist/cliproxy/config/generator.js +66 -9
  52. package/dist/cliproxy/config/generator.js.map +1 -1
  53. package/dist/cliproxy/config/thinking-config.d.ts.map +1 -1
  54. package/dist/cliproxy/config/thinking-config.js +2 -0
  55. package/dist/cliproxy/config/thinking-config.js.map +1 -1
  56. package/dist/cliproxy/executor/auth-coordinator.d.ts +4 -0
  57. package/dist/cliproxy/executor/auth-coordinator.d.ts.map +1 -1
  58. package/dist/cliproxy/executor/auth-coordinator.js +5 -1
  59. package/dist/cliproxy/executor/auth-coordinator.js.map +1 -1
  60. package/dist/cliproxy/executor/index.d.ts.map +1 -1
  61. package/dist/cliproxy/executor/index.js +20 -0
  62. package/dist/cliproxy/executor/index.js.map +1 -1
  63. package/dist/cliproxy/model-catalog.d.ts.map +1 -1
  64. package/dist/cliproxy/model-catalog.js +15 -0
  65. package/dist/cliproxy/model-catalog.js.map +1 -1
  66. package/dist/cliproxy/proxy/upstream-response-timeout.d.ts.map +1 -1
  67. package/dist/cliproxy/proxy/upstream-response-timeout.js +8 -1
  68. package/dist/cliproxy/proxy/upstream-response-timeout.js.map +1 -1
  69. package/dist/cliproxy/quota/quota-manager.d.ts +7 -0
  70. package/dist/cliproxy/quota/quota-manager.d.ts.map +1 -1
  71. package/dist/cliproxy/quota/quota-manager.js +19 -1
  72. package/dist/cliproxy/quota/quota-manager.js.map +1 -1
  73. package/dist/cliproxy/routing/pool-onboarding-hint.d.ts +95 -0
  74. package/dist/cliproxy/routing/pool-onboarding-hint.d.ts.map +1 -0
  75. package/dist/cliproxy/routing/pool-onboarding-hint.js +172 -0
  76. package/dist/cliproxy/routing/pool-onboarding-hint.js.map +1 -0
  77. package/dist/cliproxy/routing/pool-opt-in-prompt.d.ts +50 -0
  78. package/dist/cliproxy/routing/pool-opt-in-prompt.d.ts.map +1 -0
  79. package/dist/cliproxy/routing/pool-opt-in-prompt.js +232 -0
  80. package/dist/cliproxy/routing/pool-opt-in-prompt.js.map +1 -0
  81. package/dist/cliproxy/routing/routing-strategy.d.ts +132 -0
  82. package/dist/cliproxy/routing/routing-strategy.d.ts.map +1 -1
  83. package/dist/cliproxy/routing/routing-strategy.js +342 -5
  84. package/dist/cliproxy/routing/routing-strategy.js.map +1 -1
  85. package/dist/commands/bar/help-subcommand.d.ts +2 -0
  86. package/dist/commands/bar/help-subcommand.d.ts.map +1 -0
  87. package/dist/commands/bar/help-subcommand.js +63 -0
  88. package/dist/commands/bar/help-subcommand.js.map +1 -0
  89. package/dist/commands/bar/index.d.ts +1 -1
  90. package/dist/commands/bar/index.d.ts.map +1 -1
  91. package/dist/commands/bar/index.js +11 -2
  92. package/dist/commands/bar/index.js.map +1 -1
  93. package/dist/commands/bar/install-subcommand.d.ts +54 -12
  94. package/dist/commands/bar/install-subcommand.d.ts.map +1 -1
  95. package/dist/commands/bar/install-subcommand.js +291 -69
  96. package/dist/commands/bar/install-subcommand.js.map +1 -1
  97. package/dist/commands/bar/launch-subcommand.d.ts +26 -0
  98. package/dist/commands/bar/launch-subcommand.d.ts.map +1 -1
  99. package/dist/commands/bar/launch-subcommand.js +107 -12
  100. package/dist/commands/bar/launch-subcommand.js.map +1 -1
  101. package/dist/commands/cliproxy/help-subcommand.d.ts.map +1 -1
  102. package/dist/commands/cliproxy/help-subcommand.js +20 -1
  103. package/dist/commands/cliproxy/help-subcommand.js.map +1 -1
  104. package/dist/commands/cliproxy/index.d.ts.map +1 -1
  105. package/dist/commands/cliproxy/index.js +20 -0
  106. package/dist/commands/cliproxy/index.js.map +1 -1
  107. package/dist/commands/cliproxy/order-subcommand.d.ts +16 -0
  108. package/dist/commands/cliproxy/order-subcommand.d.ts.map +1 -0
  109. package/dist/commands/cliproxy/order-subcommand.js +520 -0
  110. package/dist/commands/cliproxy/order-subcommand.js.map +1 -0
  111. package/dist/commands/cliproxy/pool-state-renderer.d.ts +40 -0
  112. package/dist/commands/cliproxy/pool-state-renderer.d.ts.map +1 -0
  113. package/dist/commands/cliproxy/pool-state-renderer.js +220 -0
  114. package/dist/commands/cliproxy/pool-state-renderer.js.map +1 -0
  115. package/dist/commands/cliproxy/pool-subcommand.d.ts +10 -0
  116. package/dist/commands/cliproxy/pool-subcommand.d.ts.map +1 -0
  117. package/dist/commands/cliproxy/pool-subcommand.js +112 -0
  118. package/dist/commands/cliproxy/pool-subcommand.js.map +1 -0
  119. package/dist/commands/cliproxy/quota-subcommand.d.ts.map +1 -1
  120. package/dist/commands/cliproxy/quota-subcommand.js +7 -0
  121. package/dist/commands/cliproxy/quota-subcommand.js.map +1 -1
  122. package/dist/commands/cliproxy/routing-subcommand.d.ts.map +1 -1
  123. package/dist/commands/cliproxy/routing-subcommand.js +19 -0
  124. package/dist/commands/cliproxy/routing-subcommand.js.map +1 -1
  125. package/dist/commands/command-catalog.d.ts.map +1 -1
  126. package/dist/commands/command-catalog.js +1 -0
  127. package/dist/commands/command-catalog.js.map +1 -1
  128. package/dist/commands/help-command.d.ts.map +1 -1
  129. package/dist/commands/help-command.js +6 -1
  130. package/dist/commands/help-command.js.map +1 -1
  131. package/dist/config/schemas/cliproxy.d.ts +37 -0
  132. package/dist/config/schemas/cliproxy.d.ts.map +1 -1
  133. package/dist/config/unified-config-loader.d.ts.map +1 -1
  134. package/dist/config/unified-config-loader.js +3 -0
  135. package/dist/config/unified-config-loader.js.map +1 -1
  136. package/dist/dispatcher/flows/account-flow.d.ts.map +1 -1
  137. package/dist/dispatcher/flows/account-flow.js +9 -0
  138. package/dist/dispatcher/flows/account-flow.js.map +1 -1
  139. package/dist/management/doctor.d.ts.map +1 -1
  140. package/dist/management/doctor.js +10 -0
  141. package/dist/management/doctor.js.map +1 -1
  142. package/dist/proxy/profile-router.d.ts +14 -0
  143. package/dist/proxy/profile-router.d.ts.map +1 -1
  144. package/dist/proxy/profile-router.js +1 -0
  145. package/dist/proxy/profile-router.js.map +1 -1
  146. package/dist/proxy/server/http-helpers.d.ts +5 -0
  147. package/dist/proxy/server/http-helpers.d.ts.map +1 -1
  148. package/dist/proxy/server/http-helpers.js +40 -1
  149. package/dist/proxy/server/http-helpers.js.map +1 -1
  150. package/dist/proxy/server/messages-route.d.ts.map +1 -1
  151. package/dist/proxy/server/messages-route.js +173 -10
  152. package/dist/proxy/server/messages-route.js.map +1 -1
  153. package/dist/proxy/upstream-url.d.ts +42 -2
  154. package/dist/proxy/upstream-url.d.ts.map +1 -1
  155. package/dist/proxy/upstream-url.js +83 -4
  156. package/dist/proxy/upstream-url.js.map +1 -1
  157. package/dist/ui/assets/{Trans-BkttMZOY.js → Trans-RG_sMDEu.js} +1 -1
  158. package/dist/ui/assets/accounts-yTXURc-q.js +1 -0
  159. package/dist/ui/assets/{alert-dialog-Dgbg5gJ1.js → alert-dialog-DjvPgzFs.js} +1 -1
  160. package/dist/ui/assets/api-Ck1dtNEM.js +4 -0
  161. package/dist/ui/assets/{auth-section-DV1ImDLn.js → auth-section-DBnY_LPz.js} +1 -1
  162. package/dist/ui/assets/{backups-section-D7r-Huo_.js → backups-section-Ci-uL4Of.js} +1 -1
  163. package/dist/ui/assets/{channels-CKUk3W1L.js → channels-BeS9O5q0.js} +1 -1
  164. package/dist/ui/assets/{checkbox-B6j6PA4N.js → checkbox-DFeFDZBp.js} +1 -1
  165. package/dist/ui/assets/{claude-extension-B9phgEGW.js → claude-extension-DS5qN19Z.js} +1 -1
  166. package/dist/ui/assets/{cliproxy-CjZiufaQ.js → cliproxy-D7HJH4mZ.js} +1 -1
  167. package/dist/ui/assets/{cliproxy-ai-providers-J_8Tg44E.js → cliproxy-ai-providers-oJQZXrtc.js} +1 -1
  168. package/dist/ui/assets/{cliproxy-control-panel-DOxGnabX.js → cliproxy-control-panel-2mRPEcRj.js} +1 -1
  169. package/dist/ui/assets/codex-D0AUQ6jA.js +30 -0
  170. package/dist/ui/assets/{confirm-dialog-CjwyQ3AU.js → confirm-dialog-B37-CVuq.js} +1 -1
  171. package/dist/ui/assets/{copilot-Nhs4PdOq.js → copilot-KaaW-mko.js} +2 -2
  172. package/dist/ui/assets/{cursor-DqFROSqy.js → cursor-BKiTgYi5.js} +1 -1
  173. package/dist/ui/assets/{droid-CBwAiZcv.js → droid-DHdqGnFw.js} +2 -2
  174. package/dist/ui/assets/{globalenv-section-D9WhcK3S.js → globalenv-section-SfZO97nU.js} +1 -1
  175. package/dist/ui/assets/health-CSRS9O0D.js +1 -0
  176. package/dist/ui/assets/{icons-gI6odJjU.js → icons-DSLG1YsC.js} +1 -1
  177. package/dist/ui/assets/{index-DFYK4jw3.js → index-CGgavq2X.js} +37 -37
  178. package/dist/ui/assets/{index-D--xE6Kq.js → index-ChTYEBCZ.js} +1 -1
  179. package/dist/ui/assets/index-Cu_F55_O.js +1 -0
  180. package/dist/ui/assets/{index-bJvDY0e2.js → index-DJ66NrBH.js} +1 -1
  181. package/dist/ui/assets/index-DWUuSBUe.js +1 -0
  182. package/dist/ui/assets/{index-vK0cF4_0.js → index-DycwEe96.js} +1 -1
  183. package/dist/ui/assets/index-DzFlVVV3.css +1 -0
  184. package/dist/ui/assets/{index-Bssd99Pa.js → index-iQuEEGbH.js} +1 -1
  185. package/dist/ui/assets/{logs-BUA9GCN2.js → logs-tiZ_51mo.js} +1 -1
  186. package/dist/ui/assets/{masked-input-BZdCgWmH.js → masked-input-D9FVoeMA.js} +1 -1
  187. package/dist/ui/assets/proxy-status-widget-2k26d8pS.js +1 -0
  188. package/dist/ui/assets/{raw-json-settings-editor-panel-DuL_4ncA.js → raw-json-settings-editor-panel-CguBh93H.js} +1 -1
  189. package/dist/ui/assets/{searchable-select-BleLprBy.js → searchable-select-C4wShshD.js} +1 -1
  190. package/dist/ui/assets/{separator-De5-VTtx.js → separator-mvGlDdEW.js} +1 -1
  191. package/dist/ui/assets/{shared-Bu81YVUK.js → shared-Ck0yAwbs.js} +1 -1
  192. package/dist/ui/assets/{table-DsXaM2jg.js → table-DrUJOxKL.js} +1 -1
  193. package/dist/ui/assets/updates-BVHBFcq8.js +1 -0
  194. package/dist/ui/assets/{use-accounts-C2OmaTJU.js → use-accounts-DLtuaniS.js} +1 -1
  195. package/dist/ui/index.html +3 -3
  196. package/dist/utils/browser/mcp-installer.d.ts.map +1 -1
  197. package/dist/utils/browser/mcp-installer.js +5 -34
  198. package/dist/utils/browser/mcp-installer.js.map +1 -1
  199. package/dist/utils/claude-user-config-lock.d.ts +9 -0
  200. package/dist/utils/claude-user-config-lock.d.ts.map +1 -0
  201. package/dist/utils/claude-user-config-lock.js +96 -0
  202. package/dist/utils/claude-user-config-lock.js.map +1 -0
  203. package/dist/utils/image-analysis/mcp-installer.d.ts.map +1 -1
  204. package/dist/utils/image-analysis/mcp-installer.js +5 -34
  205. package/dist/utils/image-analysis/mcp-installer.js.map +1 -1
  206. package/dist/utils/websearch/mcp-installer.d.ts.map +1 -1
  207. package/dist/utils/websearch/mcp-installer.js +112 -78
  208. package/dist/utils/websearch/mcp-installer.js.map +1 -1
  209. package/dist/web-server/model-pricing.d.ts.map +1 -1
  210. package/dist/web-server/model-pricing.js +7 -0
  211. package/dist/web-server/model-pricing.js.map +1 -1
  212. package/dist/web-server/usage/codex-local-quota-collector.d.ts.map +1 -1
  213. package/dist/web-server/usage/codex-local-quota-collector.js +11 -9
  214. package/dist/web-server/usage/codex-local-quota-collector.js.map +1 -1
  215. package/package.json +1 -1
  216. package/dist/ui/assets/accounts-CMnafyvZ.js +0 -1
  217. package/dist/ui/assets/api-VhuWZte1.js +0 -4
  218. package/dist/ui/assets/codex-BJuDLXfe.js +0 -30
  219. package/dist/ui/assets/health-CE3lFqFV.js +0 -1
  220. package/dist/ui/assets/index-C6D81JHk.js +0 -1
  221. package/dist/ui/assets/index-DGsfFqiO.js +0 -1
  222. package/dist/ui/assets/index-UEdhhar4.css +0 -1
  223. package/dist/ui/assets/proxy-status-widget-I35xB9u9.js +0 -1
  224. package/dist/ui/assets/updates-C2bOO3Fo.js +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"codex-local-quota-collector.js","sourceRoot":"","sources":["../../../src/web-server/usage/codex-local-quota-collector.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,4CAA8B;AAC9B,gDAAkC;AAClC,iFAA8E;AAoD9E,+EAA+E;AAC/E,MAAM,UAAU,GAAG,GAAG,CAAC;AAEvB,sEAAsE;AACtE,MAAM,cAAc,GAAG,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC;AAErC;;;;GAIG;AACH,MAAM,oBAAoB,GAAG,EAAE,CAAC;AAchC,SAAS,QAAQ,CAAC,KAAc;IAC9B,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC;QAAE,OAAO,IAAI,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,KAAK,GAAG,KAAK,CAAC;IAChB,CAAC;IAED,OAAO;QACL,eAAe,EAAE,sBAAsB,CAAC,IAAI,CAAC;QAC7C,SAAS,EAAE,gBAAgB,CAAC,IAAI,CAAC;QACjC,IAAI,EAAE,IAAI,CAAC,QAAQ;QACnB,KAAK;QACL,SAAS;QACT,OAAO,EAAE,YAAY,CAAC,IAAI,CAAC;KAC5B,CAAC;AACJ,CAAC;AAnDD,gDAmDC"}
1
+ {"version":3,"file":"codex-local-quota-collector.js","sourceRoot":"","sources":["../../../src/web-server/usage/codex-local-quota-collector.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,4CAA8B;AAC9B,gDAAkC;AAClC,iFAA8E;AAoD9E,+EAA+E;AAC/E,MAAM,UAAU,GAAG,GAAG,CAAC;AAEvB,sEAAsE;AACtE,MAAM,cAAc,GAAG,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC;AAErC;;;;GAIG;AACH,MAAM,oBAAoB,GAAG,EAAE,CAAC;AAchC,SAAS,QAAQ,CAAC,KAAc;IAC9B,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC;QAAE,OAAO,IAAI,CAAC;IACrF,OAAO,KAAgC,CAAC;AAC1C,CAAC;AAED,SAAS,cAAc,CAAC,KAAc;IACpC,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC;AAC5E,CAAC;AAED,SAAS,WAAW,CAAC,KAAc;IACjC,MAAM,GAAG,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;IAC5B,IAAI,CAAC,GAAG;QAAE,OAAO,IAAI,CAAC;IACtB,MAAM,WAAW,GAAG,cAAc,CAAC,GAAG,CAAC,cAAc,CAAC,CA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KAAK,MAAM,IAAI,IAAI,WAAW,EAAE,CAAC;QAC/B,MAAM,KAAK,GAAG,MAAM,sBAAsB,CAAC,IAAI,EAAE,aAAa,CAAC,CAAC;QAChE,IAAI,KAAK,EAAE,CAAC;YACV,IAAI,GAAG,KAAK,CAAC;YACb,UAAU,GAAG,IAAI,CAAC;YAClB,MAAM;QACR,CAAC;IACH,CAAC;IACD,IAAI,CAAC,IAAI,IAAI,CAAC,UAAU;QAAE,OAAO,IAAI,CAAC;IAEtC,IAAI,KAAK,GAAG,KAAK,CAAC;IAClB,IAAI,SAAS,GAAkB,IAAI,CAAC;IACpC,IAAI,CAAC;QACH,MAAM,OAAO,GAAG,eAAe,CAAC,UAAU,CAAC,CAAC;QAC5C,KAAK,GAAG,GAAG,GAAG,OAAO,GAAG,cAAc,CAAC;QACvC,IAAI,KAAK;YAAE,SAAS,GAAG,IAAI,IAAI,CAAC,OAAO,CAAC,CAAC,WAAW,EAAE,CAAC;IACzD,CAAC;IAAC,MAAM,CAAC;QACP,mEAAmE;QACnE,KAAK,GAAG,KAAK,CAAC;IAChB,CAAC;IAED,OAAO;QACL,eAAe,EAAE,sBAAsB,CAAC,IAAI,CAAC;QAC7C,SAAS,EAAE,gBAAgB,CAAC,IAAI,CAAC;QACjC,IAAI,EAAE,IAAI,CAAC,QAAQ;QACnB,KAAK;QACL,SAAS;QACT,OAAO,EAAE,YAAY,CAAC,IAAI,CAAC;KAC5B,CAAC;AACJ,CAAC;AAnDD,gDAmDC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kaitranntt/ccs",
3
- "version": "8.2.0-dev.1",
3
+ "version": "8.2.0-dev.10",
4
4
  "description": "Claude Code Switch - Instant profile switching between Claude, GLM, Kimi, and more",
5
5
  "keywords": [
6
6
  "cli",
@@ -1 +0,0 @@
1
- import{j as e}from"./radix-ui-nu4wz29m.js";import{r as k,e as Ae}from"./react-vendor-Bjx91N7w.js";import{e as Pe,f as se,g as De}from"./tanstack-bhJxV1h8.js";import{T as Te,a as Se,b as te,c as Re,d as _e,e as Oe}from"./table-DsXaM2jg.js";import{a as R,ai as q,aj as W,ak as Q,al as J,am as Y,L as S,I as E,z as P,aE as pe,e as p,j as Ge,k as Me,l as ze,m as Le,n as ae,bi as ne,bj as re,bk as ce,B as C,c as $e,C as O,s as M,t as z,a0 as F,b as G,f as Ie,g as He,h as Fe,x as Be}from"./index-DFYK4jw3.js";import{A as Ue,a as Ke,b as Ee,c as Ze,d as Ve,e as Xe,f as qe,g as We}from"./alert-dialog-Dgbg5gJ1.js";import{a as fe,b as Qe,c as Je,d as Ye,e as es,u as ss,f as ts}from"./use-accounts-C2OmaTJU.js";import{b2 as Z,b3 as L,b4 as ee,aI as be,_ as je,b5 as Ne,ai as ye,w as as,b6 as ns,b7 as rs,m as V,at as cs,Q as os,b8 as ds,a7 as ls,$ as ve,a6 as B,T as X,x as is,o as oe,U as xs,a9 as de,Z as le}from"./icons-gI6odJjU.js";import{C as ie}from"./checkbox-B6j6PA4N.js";import"./notifications-B4_o8bcr.js";import"./utils-CzKF5WmX.js";import"./form-utils-CuHzLhJZ.js";import"./charts-eIPy2oG6.js";const xe=64,us=/^[a-zA-Z][a-zA-Z0-9_-]*$/;function ms({account:a,groupSummaries:x,plainCcsLane:t,onClose:m}){const{t:s}=R(),u=fe(),[r,l]=k.useState(a.context_mode==="shared"?"shared":"isolated"),[g,b]=k.useState(a.context_group||"default"),[h,v]=k.useState(a.continuity_mode==="deeper"?"deeper":"standard"),d=k.useMemo(()=>g.trim().toLowerCase().replace(/\s+/g,"-"),[g]),c=k.useMemo(()=>x.find(f=>f.group===d),[x,d]),N=d.length>0&&d.length<=xe&&us.test(d),j=r==="isolated"||N,y=r==="shared"?Math.max((c?.sharedCount??0)-(a.context_mode==="shared"&&a.context_group===d?1:0),0):0,n=r==="shared"?Math.max((c?.deeperCount??0)-(a.continuity_mode==="deeper"&&a.context_group===d?1:0),0):0,o=t?.account_name===a.name,i=!!t&&!o,w=`ccs auth default ${a.name}`,D=`ccs auth backup ${a.name}`,A=(f,I,_,H)=>{if(!["ArrowLeft","ArrowRight","ArrowUp","ArrowDown"].includes(f.key))return;f.preventDefault();const ke=_.indexOf(I),we=f.key==="ArrowLeft"||f.key==="ArrowUp"?-1:1,Ce=(ke+we+_.length)%_.length;H(_[Ce])},$=t?t.kind==="native"?s("continuityOverview.lane.native"):t.kind==="account-default"?s("continuityOverview.lane.accountDefault",{name:t.account_name||""}):t.kind==="account-inherited"?s("continuityOverview.lane.accountInherited",{name:t.account_name||""}):t.kind==="profile-default"?s("continuityOverview.lane.profileDefault",{name:t.profile_name||"default"}):t.label:"",T=()=>{j&&u.mutate({name:a.name,context_mode:r,context_group:r==="shared"?d:void 0,continuity_mode:r==="shared"?h:void 0},{onSuccess:()=>{m()}})},U=f=>{f||m()};return e.jsx(q,{open:!0,onOpenChange:U,children:e.jsxs(W,{className:"sm:max-w-md",children:[e.jsxs(Q,{children:[e.jsx(J,{children:s("editAccountContext.title")}),e.jsx(Y,{children:s("editAccountContext.description",{name:a.name})})]}),e.jsxs("div",{className:"space-y-4 py-2",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx("div",{className:"flex items-center justify-between",children:e.jsx(S,{className:"text-sm font-semibold",children:s("editAccountContext.syncMode")})}),e.jsxs("div",{className:"flex p-0.5 bg-muted/60 hover:bg-muted/80 transition-colors rounded-xl border border-border/40 w-full",role:"radiogroup","aria-label":s("editAccountContext.syncMode"),children:[e.jsxs("button",{type:"button",role:"radio","aria-checked":r==="isolated",tabIndex:r==="isolated"?0:-1,onClick:()=>l("isolated"),onKeyDown:f=>A(f,r,["isolated","shared"],l),className:`flex-1 flex justify-center items-center gap-2 px-3 py-1.5 rounded-[10px] text-sm font-medium transition-all duration-200 overflow-hidden ${r==="isolated"?"bg-background text-blue-600 dark:text-blue-400 shadow-sm ring-1 ring-border/50":"text-muted-foreground hover:text-foreground hover:bg-muted/50"}`,children:[e.jsx(Z,{className:"h-4 w-4 shrink-0"}),e.jsx("span",{className:"truncate",children:s("editAccountContext.isolatedOption")})]}),e.jsxs("button",{type:"button",role:"radio","aria-checked":r==="shared",tabIndex:r==="shared"?0:-1,onClick:()=>l("shared"),onKeyDown:f=>A(f,r,["isolated","shared"],l),className:`flex-1 flex justify-center items-center gap-2 px-3 py-1.5 rounded-[10px] text-sm font-medium transition-all duration-200 overflow-hidden ${r==="shared"?"bg-background text-emerald-600 dark:text-emerald-400 shadow-sm ring-1 ring-border/50":"text-muted-foreground hover:text-foreground hover:bg-muted/50"}`,children:[e.jsx(L,{className:"h-4 w-4 shrink-0"}),e.jsx("span",{className:"truncate",children:s("editAccountContext.sharedOption")})]})]}),e.jsx("p",{className:"text-xs text-muted-foreground pt-1 px-1",children:s(r==="isolated"?"editAccountContext.isolatedModeHint":"editAccountContext.sharedModeHint")})]}),r==="shared"&&e.jsxs("div",{className:"space-y-2",children:[e.jsx(S,{htmlFor:"context-group",children:s("editAccountContext.historySyncGroup")}),e.jsx(E,{id:"context-group",value:g,onChange:f=>b(f.target.value),placeholder:s("editAccountContext.groupPlaceholder"),autoComplete:"off"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:s("editAccountContext.groupHint",{max:xe})}),!N&&e.jsx("p",{className:"text-xs text-destructive",children:s("editAccountContext.invalidGroup")})]}),r==="shared"&&e.jsxs("div",{className:"space-y-2",children:[e.jsx("div",{className:"flex items-center justify-between",children:e.jsx(S,{className:"text-sm font-semibold",children:s("editAccountContext.continuityDepth")})}),e.jsxs("div",{className:"flex p-0.5 bg-muted/60 hover:bg-muted/80 transition-colors rounded-xl border border-border/40 w-full",role:"radiogroup","aria-label":s("editAccountContext.continuityDepth"),children:[e.jsxs("button",{type:"button",role:"radio","aria-checked":h==="standard",tabIndex:h==="standard"?0:-1,onClick:()=>v("standard"),onKeyDown:f=>A(f,h,["standard","deeper"],v),className:`flex-1 flex justify-center items-center gap-2 px-3 py-1.5 rounded-[10px] text-sm font-medium transition-all duration-200 overflow-hidden ${h==="standard"?"bg-background text-emerald-600 dark:text-emerald-400 shadow-sm ring-1 ring-border/50":"text-muted-foreground hover:text-foreground hover:bg-muted/50"}`,children:[e.jsx(L,{className:"h-4 w-4 shrink-0"}),e.jsx("span",{className:"truncate",children:s("editAccountContext.standardOption")})]}),e.jsxs("button",{type:"button",role:"radio","aria-checked":h==="deeper",tabIndex:h==="deeper"?0:-1,onClick:()=>v("deeper"),onKeyDown:f=>A(f,h,["standard","deeper"],v),className:`flex-1 flex justify-center items-center gap-2 px-3 py-1.5 rounded-[10px] text-sm font-medium transition-all duration-200 overflow-hidden ${h==="deeper"?"bg-background text-indigo-600 dark:text-indigo-400 shadow-sm ring-1 ring-border/50":"text-muted-foreground hover:text-foreground hover:bg-muted/50"}`,children:[e.jsx(ee,{className:"h-4 w-4 shrink-0"}),e.jsx("span",{className:"truncate",children:s("editAccountContext.deeperOption")})]})]}),e.jsx("p",{className:"text-xs text-muted-foreground pt-1 px-1",children:s(h==="standard"?"editAccountContext.standardHint":"editAccountContext.deeperHint")})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:s("editAccountContext.credentialsIsolated")}),i&&e.jsx("div",{className:"rounded-[14px] border border-amber-200 bg-amber-50/50 p-4 text-xs shadow-sm dark:border-amber-900/40 dark:bg-amber-900/10",children:e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"font-medium text-foreground",children:s("continuityOverview.plainLaneTitle")}),e.jsx("p",{className:"text-muted-foreground leading-relaxed",children:s("continuityOverview.plainLaneDescription",{lane:$||"plain ccs",name:a.name})}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"rounded-md border bg-background px-2 py-2 font-mono text-[11px] flex items-start gap-2",children:[e.jsx("span",{className:"flex-1 break-all",children:"ccs -r"}),e.jsx(P,{value:"ccs -r",size:"icon"})]}),e.jsxs("div",{className:"rounded-md border bg-background px-2 py-2 font-mono text-[11px] flex items-start gap-2",children:[e.jsx("span",{className:"flex-1 break-all",children:"ccs auth backup default"}),e.jsx(P,{value:"ccs auth backup default",size:"icon"})]}),e.jsxs("div",{className:"rounded-md border bg-background px-2 py-2 font-mono text-[11px] flex items-start gap-2",children:[e.jsx("span",{className:"flex-1 break-all",children:D}),e.jsx(P,{value:D,size:"icon"})]}),e.jsxs("div",{className:"rounded-md border bg-background px-2 py-2 font-mono text-[11px] flex items-start gap-2",children:[e.jsx("span",{className:"flex-1 break-all",children:w}),e.jsx(P,{value:w,size:"icon"})]})]})]})}),e.jsx("div",{className:`rounded-[14px] border p-4 text-xs shadow-sm transition-colors ${r==="isolated"?"bg-blue-50/50 border-blue-200 dark:bg-blue-900/10 dark:border-blue-800/40":"bg-muted/40 border-border/60"}`,children:e.jsxs("div",{className:"flex items-start gap-3",children:[r==="isolated"?e.jsx(be,{className:"h-4 w-4 text-blue-500 mt-0.5 shrink-0"}):e.jsx(je,{className:"h-4 w-4 text-muted-foreground mt-0.5 shrink-0"}),e.jsxs("div",{className:"space-y-1.5 flex-1 text-muted-foreground leading-relaxed",children:[r==="isolated"?e.jsx("p",{className:"text-foreground font-medium selection:bg-blue-200",children:s("editAccountContext.isolatedImplication")}):e.jsxs(e.Fragment,{children:[e.jsxs("p",{children:[e.jsx("span",{className:"text-foreground font-medium",children:s("editAccountContext.sameGroupRule",{group:d})})," ",y>0?s("editAccountContext.sameGroupPeerCount",{count:y}):s("editAccountContext.noSameGroupPeer")]}),h==="deeper"&&e.jsx("p",{children:n>0?s("editAccountContext.deeperReady",{count:n}):e.jsx("span",{className:"text-amber-600 dark:text-amber-500",children:s("editAccountContext.deeperNeedsPeers")})})]}),e.jsx("p",{className:`pt-1.5 text-[11px] ${r==="isolated"?"text-blue-700/70 dark:text-blue-300/60":"text-muted-foreground/70"}`,children:s("editAccountContext.resumeOriginalWarning")})]})]})})]}),e.jsxs(pe,{children:[e.jsx(p,{variant:"outline",onClick:m,disabled:u.isPending,children:s("editAccountContext.cancel")}),e.jsx(p,{onClick:T,disabled:!j||u.isPending,children:u.isPending?s("editAccountContext.saving"):s("editAccountContext.save")})]})]})})}function hs({account:a,onClose:x}){const{t}=R(),m=Qe(),[s,u]=k.useState(a.shared_resource_mode||"shared"),r=()=>{m.mutate({name:a.name,shared_resource_mode:s},{onSuccess:()=>{x()}})};return e.jsx(q,{open:!0,onOpenChange:x,children:e.jsxs(W,{className:"sm:max-w-[425px]",children:[e.jsxs(Q,{children:[e.jsx(J,{children:t("editAccountSharedResources.title")}),e.jsx(Y,{children:t("editAccountSharedResources.description",{name:a.name})})]}),e.jsxs("div",{className:"grid gap-4 py-4",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(S,{htmlFor:"resource-mode",children:t("editAccountSharedResources.resourceMode")}),e.jsxs(Ge,{value:s,onValueChange:l=>u(l),children:[e.jsx(Me,{id:"resource-mode",className:"w-full",children:e.jsx(ze,{placeholder:t("editAccountSharedResources.selectResourceMode")})}),e.jsxs(Le,{children:[e.jsx(ae,{value:"shared",children:e.jsxs("div",{className:"flex flex-col items-start py-1",children:[e.jsx("span",{className:"font-medium text-sm",children:t("editAccountSharedResources.sharedOption")}),e.jsx("span",{className:"text-[11px] text-muted-foreground",children:t("editAccountSharedResources.sharedHint")})]})}),e.jsx(ae,{value:"profile-local",children:e.jsxs("div",{className:"flex flex-col items-start py-1",children:[e.jsx("span",{className:"font-medium text-sm",children:t("editAccountSharedResources.profileLocalOption")}),e.jsx("span",{className:"text-[11px] text-muted-foreground",children:t("editAccountSharedResources.profileLocalHint")})]})})]})]})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsx("p",{className:"text-[11px] font-medium uppercase tracking-wide text-muted-foreground",children:t("editAccountSharedResources.implicationTitle")}),s==="shared"?e.jsxs(ne,{className:"border-emerald-500/20 bg-emerald-500/5",children:[e.jsx(Ne,{className:"h-4 w-4 text-emerald-600 dark:text-emerald-400"}),e.jsx(re,{className:"text-xs font-semibold text-emerald-800 dark:text-emerald-300",children:t("editAccountSharedResources.sharedOption")}),e.jsx(ce,{className:"text-xs text-emerald-700/80 dark:text-emerald-400/80",children:t("editAccountSharedResources.sharedImplication")})]}):e.jsxs(ne,{className:"border-amber-500/20 bg-amber-500/5",children:[e.jsx(ye,{className:"h-4 w-4 text-amber-600 dark:text-amber-400"}),e.jsx(re,{className:"text-xs font-semibold text-amber-800 dark:text-amber-300",children:t("editAccountSharedResources.profileLocalOption")}),e.jsx(ce,{className:"text-xs text-amber-700/80 dark:text-amber-400/80",children:t("editAccountSharedResources.profileLocalImplication")})]})]}),a.shared_resource_inferred&&e.jsxs("div",{className:"flex items-start gap-2 rounded-md bg-muted/50 p-3",children:[e.jsx(as,{className:"h-4 w-4 mt-0.5 text-muted-foreground shrink-0"}),e.jsx("p",{className:"text-[11px] text-muted-foreground",children:t("accountsTable.legacyReview")})]})]}),e.jsxs(pe,{children:[e.jsx(p,{variant:"outline",onClick:x,children:t("editAccountSharedResources.cancel")}),e.jsx(p,{onClick:r,disabled:m.isPending,children:m.isPending?t("editAccountSharedResources.saving"):t("editAccountSharedResources.save")})]})]})})}function ue({data:a,defaultAccount:x,groupSummaries:t,plainCcsLane:m}){const{t:s}=R(),u=Je(),r=Ye(),l=es(),g=fe(),[b,h]=k.useState(null),[v,d]=k.useState(null),[c,N]=k.useState(null),j=[{accessorKey:"name",header:s("accountsTable.name"),size:200,cell:({row:n})=>e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"font-medium",children:n.original.name}),n.original.name===x&&e.jsx("span",{className:"text-xs bg-primary/10 text-primary px-1.5 py-0.5 rounded border border-primary/20",children:s("accountsTable.defaultBadge")})]})},{accessorKey:"type",header:s("accountsTable.type"),size:100,cell:({row:n})=>e.jsx("span",{className:"capitalize text-muted-foreground",children:n.original.type||"oauth"})},{accessorKey:"created",header:s("accountsTable.created"),size:150,cell:({row:n})=>{const o=new Date(n.original.created);return e.jsx("span",{className:"text-muted-foreground",children:o.toLocaleDateString()})}},{accessorKey:"last_used",header:s("accountsTable.lastUsed"),size:150,cell:({row:n})=>{if(!n.original.last_used)return e.jsx("span",{className:"text-muted-foreground/50",children:"-"});const o=new Date(n.original.last_used);return e.jsx("span",{className:"text-muted-foreground",children:o.toLocaleDateString()})}},{id:"context",header:s("accountsTable.historySync"),size:170,cell:({row:n})=>{if(n.original.type==="cliproxy")return e.jsx("span",{className:"text-muted-foreground/50",children:"-"});if((n.original.context_mode||"isolated")==="shared"){const i=n.original.context_group||"default",w=n.original.continuity_mode==="deeper";return e.jsxs("div",{className:"flex flex-col items-start gap-1",children:[e.jsxs("div",{className:"flex items-center gap-1.5 flex-wrap",children:[e.jsx(C,{variant:"outline",className:`font-mono text-[10px] uppercase px-1.5 py-0 border ${w?"text-indigo-700 border-indigo-300/60 bg-indigo-50/50 dark:text-indigo-300 dark:border-indigo-900/40 dark:bg-indigo-900/20":"text-emerald-700 border-emerald-300/60 bg-emerald-50/50 dark:text-emerald-300 dark:border-emerald-900/40 dark:bg-emerald-900/20"}`,children:s(w?"accountsTable.badges.deeper":"accountsTable.badges.shared")}),e.jsx("span",{className:"text-xs font-semibold text-foreground/80",children:i})]}),e.jsx("p",{className:"text-[10px] text-muted-foreground whitespace-nowrap",children:n.original.sameGroupPeerCount>0?s("accountsTable.sameGroupPeerCount",{count:n.original.sameGroupPeerCount}):s("accountsTable.noSameGroupPeer")})]})}return n.original.context_inferred?e.jsxs("div",{className:"flex flex-col items-start gap-1",children:[e.jsx(C,{variant:"outline",className:"text-amber-700 border-amber-300/60 bg-amber-50/50 dark:text-amber-400 dark:border-amber-900/40 dark:bg-amber-900/20 font-mono text-[10px] uppercase px-1.5 py-0",children:s("accountsTable.badges.legacy")}),e.jsx("p",{className:"text-[10px] text-amber-700/80 dark:text-amber-400/80 whitespace-nowrap",children:s("accountsTable.legacyReview")})]}):e.jsx("div",{className:"flex flex-col items-start gap-1.5",children:e.jsx(C,{variant:"secondary",className:"font-mono text-[10px] uppercase px-1.5 py-0 text-muted-foreground bg-muted/60 border-transparent shadow-none",children:s("accountsTable.badges.isolated")})})}},{id:"resources",header:s("accountsTable.sharedResources"),size:150,cell:({row:n})=>{if(n.original.type==="cliproxy")return e.jsx("span",{className:"text-muted-foreground/50",children:"-"});const o=n.original.shared_resource_mode||"shared",i=n.original.shared_resource_inferred;return e.jsxs("div",{className:"flex flex-col items-start gap-1",children:[e.jsx(C,{variant:o==="shared"?"outline":"secondary",className:$e("font-mono text-[10px] uppercase px-1.5 py-0",o==="shared"?"text-emerald-700 border-emerald-300/60 bg-emerald-50/50 dark:text-emerald-300 dark:border-emerald-900/40 dark:bg-emerald-900/20":"text-muted-foreground bg-muted/60 border-transparent shadow-none"),children:s(o==="shared"?"accountsTable.resourcesShared":"accountsTable.resourcesProfileLocal")}),i&&e.jsx("p",{className:"text-[10px] text-amber-700/80 dark:text-amber-400/80 whitespace-nowrap",children:s("accountsTable.legacyReview")})]})}},{id:"actions",header:s("accountsTable.actions"),size:220,cell:({row:n})=>{const o=n.original.name===x,i=u.isPending||r.isPending||g.isPending,w=n.original.type==="cliproxy",D=n.original.context_inferred||n.original.continuity_inferred;return e.jsxs("div",{className:"flex items-center gap-1",children:[!w&&e.jsxs(p,{variant:"outline",size:"sm",className:"h-8 px-2",disabled:i,onClick:()=>d(n.original),title:s("accountsTable.syncTitle"),children:[e.jsx(ns,{className:"w-3.5 h-3.5 mr-1"}),s("accountsTable.sync")]}),!w&&e.jsxs(p,{variant:"outline",size:"sm",className:"h-8 px-2",disabled:i,onClick:()=>N(n.original),title:s("accountsTable.resourcesTitle"),children:[e.jsx(Ne,{className:"w-3.5 h-3.5 mr-1"}),s("accountsTable.sharedResources")]}),!w&&D&&e.jsxs(p,{variant:"ghost",size:"sm",className:"h-8 px-2 text-amber-700 hover:text-amber-700 hover:bg-amber-500/10 dark:text-amber-400 dark:hover:text-amber-400",disabled:i,onClick:()=>g.mutate({name:n.original.name,context_mode:n.original.context_mode==="shared"?"shared":"isolated",context_group:n.original.context_mode==="shared"?n.original.context_group||"default":void 0,continuity_mode:n.original.context_mode==="shared"?n.original.continuity_mode==="deeper"?"deeper":"standard":void 0}),title:s("accountsTable.confirmLegacyTitle"),children:[e.jsx(rs,{className:"w-3 h-3 mr-1"}),s("accountsTable.confirm")]}),e.jsxs(p,{variant:o?"secondary":"default",size:"sm",className:"h-8 px-2",disabled:o||i,onClick:()=>u.mutate(n.original.name),children:[e.jsx(V,{className:`w-3 h-3 mr-1 ${o?"opacity-50":""}`}),s(o?"accountsTable.active":"accountsTable.setDefault")]}),e.jsx(p,{variant:"ghost",size:"sm",className:"h-8 px-2 text-destructive hover:text-destructive hover:bg-destructive/10",disabled:o||i,onClick:()=>h(n.original.name),title:s(o?"accountsTable.cannotDeleteDefault":"accountsTable.deleteAccount"),children:e.jsx(cs,{className:"w-4 h-4"})})]})}}],y=Pe({data:a,columns:j,getCoreRowModel:De()});return a.length===0?e.jsx("div",{className:"text-center py-8 text-muted-foreground",children:s("accountsTable.noAccounts")}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"space-y-4",children:[e.jsx("div",{className:"border rounded-md",children:e.jsxs(Te,{children:[e.jsx(Se,{children:y.getHeaderGroups().map(n=>e.jsx(te,{children:n.headers.map(o=>{const i={name:"w-[180px]",type:"w-[80px]",created:"w-[120px]",last_used:"w-[120px]",context:"w-[150px]",resources:"w-[120px]",actions:"w-[320px]"}[o.id]||"w-auto";return e.jsx(Re,{className:i,children:o.isPlaceholder?null:se(o.column.columnDef.header,o.getContext())},o.id)})},n.id))}),e.jsx(_e,{children:y.getRowModel().rows.map(n=>e.jsx(te,{children:n.getVisibleCells().map(o=>e.jsx(Oe,{children:se(o.column.columnDef.cell,o.getContext())},o.id))},n.id))})]})}),x&&e.jsx("div",{className:"flex justify-end",children:e.jsxs(p,{variant:"outline",size:"sm",onClick:()=>l.mutate(),disabled:l.isPending,children:[e.jsx(os,{className:"w-4 h-4 mr-2"}),s("accountsTable.resetToDefault")]})})]}),v&&e.jsx(ms,{account:v,groupSummaries:t,plainCcsLane:m,onClose:()=>d(null)}),c&&e.jsx(hs,{account:c,onClose:()=>N(null)}),e.jsx(Ue,{open:!!b,onOpenChange:n=>!n&&h(null),children:e.jsxs(Ke,{children:[e.jsxs(Ee,{children:[e.jsx(Ze,{children:s("accountsTable.deleteDialogTitle")}),e.jsx(Ve,{children:s("accountsTable.deleteDialogDesc",{name:b??""})})]}),e.jsxs(Xe,{children:[e.jsx(qe,{children:s("accountsTable.cancel")}),e.jsx(We,{className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",onClick:()=>{b&&(r.mutate(b),h(null))},children:s("accountsTable.delete")})]})]})})]})}function me({totalAccounts:a,isolatedCount:x,sharedPeerGroups:t,deeperReadyGroups:m}){const{t:s}=R(),u=m[0]||t[0]||"daily",r=a<2?"empty":m.length>0?"deeper":t.length>0?"shared":a>=2&&x===a?"isolated":a===0?"empty":"mixed",l=`ccs auth create work2 --share-context --context-group ${u} --deeper-continuity`;return e.jsxs(O,{className:"overflow-hidden",children:[e.jsx(M,{className:"pb-3",children:e.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx(z,{className:"text-lg",children:s("accountRouteGuide.title")}),e.jsx(F,{children:s("accountRouteGuide.description")})]}),e.jsx(C,{variant:r==="deeper"?"default":"secondary",children:s(`accountRouteGuide.status.${r}`)})]})}),e.jsxs(G,{className:"space-y-4",children:[e.jsxs("div",{className:"grid gap-3 md:grid-cols-2 xl:grid-cols-4",children:[e.jsxs("section",{className:"rounded-md border bg-blue-50/50 p-3 text-sm dark:bg-blue-900/10",children:[e.jsxs("div",{className:"flex items-center gap-2 font-semibold",children:[e.jsx(ye,{className:"h-4 w-4 text-blue-600 dark:text-blue-400"}),s("accountRouteGuide.cards.isolated.title")]}),e.jsx("p",{className:"mt-1.5 text-xs leading-relaxed text-muted-foreground",children:s("accountRouteGuide.cards.isolated.desc")})]}),e.jsxs("section",{className:"rounded-md border bg-emerald-50/50 p-3 text-sm dark:bg-emerald-900/10",children:[e.jsxs("div",{className:"flex items-center gap-2 font-semibold",children:[e.jsx(ds,{className:"h-4 w-4 text-emerald-600 dark:text-emerald-400"}),s("accountRouteGuide.cards.select.title")]}),e.jsx("p",{className:"mt-1.5 text-xs leading-relaxed text-muted-foreground",children:s("accountRouteGuide.cards.select.desc")})]}),e.jsxs("section",{className:"rounded-md border bg-sky-50/50 p-3 text-sm dark:bg-sky-900/10",children:[e.jsxs("div",{className:"flex items-center gap-2 font-semibold",children:[e.jsx(ls,{className:"h-4 w-4 text-sky-600 dark:text-sky-400"}),s("accountRouteGuide.cards.settings.title")]}),e.jsx("p",{className:"mt-1.5 text-xs leading-relaxed text-muted-foreground",children:s("accountRouteGuide.cards.settings.desc")})]}),e.jsxs("section",{className:"rounded-md border bg-indigo-50/50 p-3 text-sm dark:bg-indigo-900/10",children:[e.jsxs("div",{className:"flex items-center gap-2 font-semibold",children:[e.jsx(L,{className:"h-4 w-4 text-indigo-600 dark:text-indigo-400"}),s("accountRouteGuide.cards.sync.title")]}),e.jsx("p",{className:"mt-1.5 text-xs leading-relaxed text-muted-foreground",children:s("accountRouteGuide.cards.sync.desc")})]})]}),e.jsxs("div",{className:"grid gap-3 lg:grid-cols-2",children:[e.jsxs("div",{className:"rounded-md border bg-background p-3",children:[e.jsxs("div",{className:"mb-2 flex items-center gap-2 text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:[e.jsx(ve,{className:"h-3.5 w-3.5"}),s("accountRouteGuide.commands.isolated")]}),["ccs auth create work","ccs auth create personal","ccs work","ccs personal"].map(g=>e.jsxs("div",{className:"mt-2 flex items-start gap-2 rounded-md bg-muted px-2 py-2 font-mono text-[11px]",children:[e.jsx("span",{className:"flex-1 break-all",children:g}),e.jsx(P,{value:g,size:"icon"})]},g))]}),e.jsxs("div",{className:"rounded-md border bg-background p-3",children:[e.jsxs("div",{className:"mb-2 flex items-center gap-2 text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:[e.jsx(ee,{className:"h-3.5 w-3.5"}),s("accountRouteGuide.commands.sync")]}),e.jsxs("div",{className:"flex items-start gap-2 rounded-md bg-muted px-2 py-2 font-mono text-[11px]",children:[e.jsx("span",{className:"flex-1 break-all",children:l}),e.jsx(P,{value:l,size:"icon"})]}),e.jsx("p",{className:"mt-2 text-xs leading-relaxed text-muted-foreground",children:s("accountRouteGuide.commands.syncDesc",{group:u})})]})]})]})]})}const K=({titleKey:a,descKey:x})=>{const{t}=R();return e.jsxs(Ie,{children:[e.jsx(He,{asChild:!0,children:e.jsx(p,{variant:"ghost",size:"icon","aria-label":t(a),className:"h-5 w-5 rounded-full hover:bg-muted text-muted-foreground/70 transition-colors",children:e.jsx(je,{className:"h-3 w-3"})})}),e.jsxs(Fe,{className:"w-72 p-4 rounded-xl shadow-lg border-border/50 text-sm",side:"top",align:"center",children:[e.jsx("p",{className:"font-semibold tracking-tight",children:t(a)}),e.jsx("p",{className:"mt-1.5 text-muted-foreground leading-relaxed",children:t(x)})]})]})};function he({totalAccounts:a,primaryAccountName:x,isolatedCount:t,sharedStandardCount:m,deeperSharedCount:s,sharedAloneCount:u,sharedPeerAccountCount:r,deeperReadyAccountCount:l,sharedPeerGroups:g,deeperReadyGroups:b,legacyTargetCount:h,cliproxyCount:v,plainCcsLane:d}){const{t:c}=R(),N=d?d.kind==="native"?c("continuityOverview.lane.native"):d.kind==="account-default"?c("continuityOverview.lane.accountDefault",{name:d.account_name||""}):d.kind==="account-inherited"?c("continuityOverview.lane.accountInherited",{name:d.account_name||""}):d.kind==="profile-default"?c("continuityOverview.lane.profileDefault",{name:d.profile_name||"default"}):d.label:"",j=a<2?"single":g.length===0?t===a?"isolated":"shared-alone":b.length===0?"shared-standard":t>0||u>0||l<r||b.length<g.length?"partial":"ready",y=b[0]||g[0]||"default",n=b.length>0&&(t>0||m>0||g.length>b.length),i={ready:e.jsx(is,{className:"h-6 w-6 text-emerald-600 dark:text-emerald-400"}),"shared-standard":e.jsx(L,{className:"h-6 w-6 text-blue-600 dark:text-blue-400"}),single:e.jsx(be,{className:"h-6 w-6 text-stone-400"}),isolated:e.jsx(Z,{className:"h-6 w-6 text-amber-600 dark:text-amber-400"}),"shared-alone":e.jsx(X,{className:"h-6 w-6 text-amber-600 dark:text-amber-400"}),partial:e.jsx(X,{className:"h-6 w-6 text-amber-600 dark:text-amber-400"})}[j],w=!!x&&d?.account_name===x,D=a>0&&!!d&&(!x||!w),A=a>1&&j!=="ready";return e.jsxs("div",{className:"flex flex-col gap-4",children:[e.jsx(O,{className:"flex flex-col justify-between overflow-hidden relative group p-0 border-border bg-card shadow-sm hover:shadow-md transition-shadow duration-300",children:e.jsxs(G,{className:"p-6 flex flex-col h-full bg-gradient-to-br from-card to-muted/20 space-y-4",children:[e.jsx("div",{className:"flex items-start justify-between gap-4",children:e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-start gap-4",children:[e.jsx("div",{className:"rounded-2xl bg-background p-3 shadow-sm ring-1 ring-border/50 self-start shrink-0",children:i}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsx("h3",{className:"text-lg font-semibold tracking-tight",children:c(`continuityReadiness.messages.${j}.title`,{group:y})}),e.jsx(C,{variant:j==="ready"?"default":"secondary",className:"rounded-full px-2.5 py-0.5 font-medium shadow-sm",children:c(`continuityReadiness.state.${j}`)})]}),e.jsx("p",{className:"text-sm text-muted-foreground max-w-lg leading-relaxed",children:c(`continuityReadiness.messages.${j}.description`,{group:y,count:u})})]})]})}),e.jsxs("div",{className:"mt-auto pt-4 flex flex-wrap items-center gap-2",children:[v>0&&e.jsx(C,{variant:"outline",className:"text-blue-700 bg-blue-50/50 border-blue-200/60 dark:border-blue-900/40 dark:bg-blue-900/20 dark:text-blue-300",children:c("historySyncLearningMap.cliproxyManaged",{count:v})}),h>0&&e.jsx(C,{variant:"outline",className:"text-amber-700 bg-amber-50/50 border-amber-200/60 dark:border-amber-900/40 dark:bg-amber-900/20 dark:text-amber-300",children:c("historySyncLearningMap.legacyConfirmation",{count:h})}),g.length>0&&b.length===0&&e.jsx(C,{variant:"secondary",className:"font-mono text-[11px] px-2 bg-muted/50 text-muted-foreground border-transparent",children:c("continuityOverview.recommendBadge",{group:y})}),n&&e.jsx(C,{variant:"secondary",className:"font-mono text-[11px] px-2 bg-muted/50 text-muted-foreground border-transparent",children:c("continuityOverview.partialBadge",{group:y})})]})]})}),(D||A)&&e.jsx(O,{className:"border-dashed",children:e.jsxs(G,{className:"p-5 space-y-4",children:[D&&e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-semibold text-foreground",children:c("continuityOverview.plainLaneTitle")}),e.jsx("p",{className:"text-sm text-muted-foreground",children:c("continuityOverview.plainLaneDescription",{lane:N||"plain ccs"})})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"rounded-md border bg-background px-2 py-2 font-mono text-[11px] flex items-start gap-2",children:[e.jsx("span",{className:"flex-1 break-all",children:"ccs -r"}),e.jsx(P,{value:"ccs -r",size:"icon"})]}),e.jsxs("div",{className:"rounded-md border bg-background px-2 py-2 font-mono text-[11px] flex items-start gap-2",children:[e.jsx("span",{className:"flex-1 break-all",children:"ccs auth backup default"}),e.jsx(P,{value:"ccs auth backup default",size:"icon"})]}),x?e.jsxs("div",{className:"rounded-md border bg-background px-2 py-2 font-mono text-[11px] flex items-start gap-2",children:[e.jsx("span",{className:"flex-1 break-all",children:`ccs auth default ${x}`}),e.jsx(P,{value:`ccs auth default ${x}`,size:"icon"})]}):e.jsx("p",{className:"text-xs text-muted-foreground",children:c("continuityOverview.setDefaultHint")})]})]}),A&&e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"text-sm font-semibold text-foreground",children:c("continuityReadiness.stepsTitle")}),e.jsxs("ol",{className:"space-y-1 pl-5 text-sm text-muted-foreground",children:[e.jsx("li",{children:c("continuityReadiness.steps.syncBoth")}),e.jsx("li",{children:c("continuityReadiness.steps.sameGroup",{group:y})}),e.jsx("li",{children:c("continuityReadiness.steps.enableDeeper")}),e.jsx("li",{children:c("continuityReadiness.steps.resumeOriginal")})]})]})]})}),e.jsxs("div",{className:"flex flex-col md:flex-row items-center gap-3",children:[e.jsxs("div",{className:"flex-1 w-full flex items-center justify-between p-3.5 rounded-xl border border-blue-300/40 bg-blue-50/50 dark:border-blue-900/30 dark:bg-blue-900/10 shadow-sm transition-colors hover:bg-blue-100/40 dark:hover:bg-blue-900/20",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Z,{className:"h-4 w-4 text-blue-700/80 dark:text-blue-400/80"}),e.jsx("span",{className:"text-xs font-semibold uppercase tracking-wider text-blue-900 dark:text-blue-200",children:c("historySyncLearningMap.isolated")}),e.jsx(K,{titleKey:"accountsPage.isolated",descKey:"accountsPage.isolatedDesc"})]}),e.jsx("span",{className:"text-lg font-mono font-bold text-blue-900 dark:text-blue-200",children:t})]}),e.jsx(B,{className:"hidden md:block h-4 w-4 text-muted-foreground/40 shrink-0"}),e.jsxs("div",{className:"flex-1 w-full flex items-center justify-between p-3.5 rounded-xl border border-emerald-300/40 bg-emerald-50/50 dark:border-emerald-900/30 dark:bg-emerald-900/10 shadow-sm transition-colors hover:bg-emerald-100/40 dark:hover:bg-emerald-900/20",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(L,{className:"h-4 w-4 text-emerald-700/80 dark:text-emerald-400/80"}),e.jsx("span",{className:"text-xs font-semibold uppercase tracking-wider text-emerald-900 dark:text-emerald-200",children:c("historySyncLearningMap.shared")}),e.jsx(K,{titleKey:"accountsPage.sharedStandard",descKey:"accountsPage.sharedStandardDesc"})]}),e.jsx("span",{className:"text-lg font-mono font-bold text-emerald-900 dark:text-emerald-200",children:m})]}),e.jsx(B,{className:"hidden md:block h-4 w-4 text-muted-foreground/40 shrink-0"}),e.jsxs("div",{className:"flex-1 w-full flex items-center justify-between p-3.5 rounded-xl border border-indigo-300/40 bg-indigo-50/50 dark:border-indigo-900/30 dark:bg-indigo-900/10 shadow-sm transition-colors hover:bg-indigo-100/40 dark:hover:bg-indigo-900/20",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(ee,{className:"h-4 w-4 text-indigo-700/80 dark:text-indigo-400/80"}),e.jsx("span",{className:"text-xs font-semibold uppercase tracking-wider text-indigo-900 dark:text-indigo-200",children:c("historySyncLearningMap.deeper")}),e.jsx(K,{titleKey:"accountsPage.sharedDeeper",descKey:"accountsPage.sharedDeeperDesc"})]}),e.jsx("span",{className:"text-lg font-mono font-bold text-indigo-900 dark:text-indigo-200",children:s})]})]})]})}const ge=64;function gs({open:a,onClose:x}){const{t}=R(),[m,s]=k.useState(""),[u,r]=k.useState(!1),[l,g]=k.useState(""),[b,h]=k.useState(!1),[v,d]=k.useState(!1),c=/^[a-zA-Z][a-zA-Z0-9_-]*$/.test(m),N=l.trim().toLowerCase().replace(/\s+/g,"-"),j=N.length===0||N.length<=ge&&/^[a-zA-Z][a-zA-Z0-9_-]*$/.test(N),y=m&&c?[`ccs auth create ${m}`,u?N.length>0?`--context-group ${N}`:"--share-context":"",u&&b?"--deeper-continuity":""].filter(Boolean).join(" "):t("createAuthProfileDialog.commandFallback"),n=async()=>{!c||u&&!j||(await navigator.clipboard.writeText(y),d(!0),setTimeout(()=>d(!1),2e3))},o=()=>{s(""),r(!1),g(""),h(!1),d(!1),x()};return e.jsx(q,{open:a,onOpenChange:i=>!i&&o(),children:e.jsxs(W,{className:"sm:max-w-md",children:[e.jsxs(Q,{children:[e.jsx(J,{children:t("createAuthProfileDialog.title")}),e.jsx(Y,{children:t("createAuthProfileDialog.description")})]}),e.jsxs("div",{className:"space-y-4 py-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(S,{htmlFor:"profile-name",children:t("createAuthProfileDialog.profileName")}),e.jsx(E,{id:"profile-name",value:m,onChange:i=>s(i.target.value),placeholder:t("createAuthProfileDialog.profileNamePlaceholder"),autoComplete:"off"}),m&&!c&&e.jsx("p",{className:"text-xs text-destructive",children:t("createAuthProfileDialog.invalidProfileName")})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(ie,{id:"share-context",checked:u,onCheckedChange:i=>r(i===!0)}),e.jsx(S,{htmlFor:"share-context",className:"cursor-pointer",children:t("createAuthProfileDialog.enableSharedHistory")})]}),u&&e.jsxs("div",{className:"space-y-2 pl-6",children:[e.jsx(S,{htmlFor:"context-group",children:t("createAuthProfileDialog.historySyncGroupOptional")}),e.jsx(E,{id:"context-group",value:l,onChange:i=>g(i.target.value),placeholder:t("createAuthProfileDialog.historySyncGroupPlaceholder"),autoComplete:"off"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:t("createAuthProfileDialog.historySyncGroupHint")}),e.jsxs("div",{className:"flex items-center gap-2 pt-1",children:[e.jsx(ie,{id:"deeper-continuity",checked:b,onCheckedChange:i=>h(i===!0)}),e.jsx(S,{htmlFor:"deeper-continuity",className:"cursor-pointer",children:t("createAuthProfileDialog.deeperContinuity")})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:t("createAuthProfileDialog.deeperContinuityHint")}),l.trim().length>0&&!j&&e.jsx("p",{className:"text-xs text-destructive",children:t("createAuthProfileDialog.invalidContextGroup",{max:ge})})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(S,{children:t("createAuthProfileDialog.command")}),e.jsxs("div",{className:"flex items-center gap-2 p-3 bg-muted rounded-md font-mono text-sm",children:[e.jsx(ve,{className:"w-4 h-4 text-muted-foreground shrink-0"}),e.jsx("code",{className:"flex-1 break-all",children:y}),e.jsx(p,{variant:"ghost",size:"sm",className:"shrink-0 h-8 px-2",onClick:n,disabled:!c||u&&!j,children:v?e.jsx(V,{className:"w-4 h-4 text-green-500"}):e.jsx(oe,{className:"w-4 h-4"})})]})]}),e.jsxs("div",{className:"text-sm text-muted-foreground space-y-1",children:[e.jsx("p",{children:t("createAuthProfileDialog.afterRunPrefix")}),e.jsxs("ol",{className:"list-decimal list-inside pl-2 space-y-0.5",children:[e.jsx("li",{children:t("createAuthProfileDialog.afterRunStep1")}),e.jsx("li",{children:t("createAuthProfileDialog.afterRunStep2")})]}),e.jsx("p",{className:"pt-1",children:t("createAuthProfileDialog.poolingHint")})]}),e.jsxs("div",{className:"flex justify-end gap-2 pt-2",children:[e.jsx(p,{variant:"ghost",onClick:o,children:t("createAuthProfileDialog.close")}),e.jsx(p,{onClick:n,disabled:!c||u&&!j,children:v?e.jsxs(e.Fragment,{children:[e.jsx(V,{className:"w-4 h-4 mr-2"}),t("createAuthProfileDialog.copied")]}):e.jsxs(e.Fragment,{children:[e.jsx(oe,{className:"w-4 h-4 mr-2"}),t("createAuthProfileDialog.copyCommand")]})})]})]})]})})}function Ts(){const{t:a}=R(),x=Ae(),{data:t,isLoading:m}=ss(),s=ts(),[u,r]=k.useState(!1),l=t?.accounts||[],g=t?.cliproxyCount||0,b=t?.legacyContextCount||0,h=t?.legacyContinuityCount||0,v=t?.sharedCount||0,d=t?.sharedStandardCount||0,c=t?.deeperSharedCount||0,N=t?.isolatedCount||0,j=t?.sharedAloneCount||0,y=t?.sharedPeerAccountCount||0,n=t?.deeperReadyAccountCount||0,o=t?.sharedPeerGroups||[],i=t?.deeperReadyGroups||[],w=t?.sharedGroups||[],D=t?.groupSummaries||[],A=t?.plainCcsLane||null,$=l.filter(H=>H.context_inferred||H.continuity_inferred),T=$.length,U=T>0,f=()=>x("/cliproxy?provider=claude"),I=()=>x("/cliproxy?provider=claude&action=auth"),_=()=>s.mutate($);return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"hidden h-full min-h-0 lg:flex",children:[e.jsxs("div",{className:"w-80 border-r flex flex-col bg-muted/20 shrink-0",children:[e.jsxs("div",{className:"p-4 border-b bg-background space-y-2",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(xs,{className:"h-5 w-5 text-primary"}),e.jsx("h1",{className:"font-semibold",children:a("accountsPage.title")})]}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:[a("accountsPage.managePrefix"),e.jsx("code",{className:"mx-1 rounded bg-muted px-1 py-0.5",children:"ccs auth"}),a("accountsPage.manageSuffix")]})]}),e.jsx(Be,{className:"flex-1",children:e.jsxs("div",{className:"p-4 space-y-3",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"text-[11px] font-medium uppercase tracking-wide text-muted-foreground",children:a("accountsPage.primaryActions")}),e.jsxs(p,{size:"sm",className:"w-full justify-start",onClick:()=>r(!0),children:[e.jsx(de,{className:"w-4 h-4 mr-2"}),a("accountsPage.createAccount")]}),e.jsxs(p,{size:"sm",className:"w-full justify-start",onClick:I,children:[e.jsx(le,{className:"w-4 h-4 mr-2"}),a("accountsPage.authClaudeInPool")]}),e.jsxs(p,{variant:"outline",size:"sm",className:"w-full justify-start",onClick:f,children:[a("accountsPage.openClaudePoolSettings"),e.jsx(B,{className:"w-4 h-4 ml-auto"})]})]}),U?e.jsxs("section",{className:"space-y-2",children:[e.jsx("p",{className:"text-[11px] font-medium uppercase tracking-wide text-muted-foreground",children:a("accountsPage.migrationFollowup")}),e.jsxs("div",{className:"rounded-md border border-amber-500/50 bg-amber-500/10 p-3 space-y-3",children:[e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx(X,{className:"h-4 w-4 mt-0.5 text-amber-700 dark:text-amber-400 shrink-0"}),e.jsxs("div",{className:"space-y-1 text-xs",children:[b>0&&e.jsx("p",{className:"text-amber-800 dark:text-amber-300",children:a("accountsPage.legacyContextPending",{count:b})}),h>0&&e.jsx("p",{className:"text-amber-800 dark:text-amber-300",children:a("accountsPage.legacyContinuityPending",{count:h})})]})]}),e.jsx(p,{variant:"secondary",size:"sm",className:"w-full justify-start",onClick:_,disabled:s.isPending||T===0,children:s.isPending?a("accountsPage.confirmingLegacy"):a("accountsPage.confirmLegacy",{count:T})})]})]}):e.jsx("div",{className:"rounded-md border bg-background px-3 py-2 text-xs text-muted-foreground",children:a("accountsPage.noLegacyFollowup")}),e.jsxs(O,{children:[e.jsxs(M,{className:"pb-2",children:[e.jsx(z,{className:"text-sm",children:a("accountsPage.quickCommands")}),e.jsx(F,{children:a("accountsPage.quickCommandsDesc")})]}),e.jsxs(G,{className:"space-y-2",children:[e.jsxs("div",{className:"rounded-md border bg-background px-2 py-2 font-mono text-[11px] flex items-start gap-2",children:[e.jsx("span",{className:"flex-1 break-all",children:"ccs auth create work --share-context --context-group sprint-a --deeper-continuity"}),e.jsx(P,{value:"ccs auth create work --share-context --context-group sprint-a --deeper-continuity",size:"icon"})]}),e.jsxs("div",{className:"rounded-md border bg-background px-2 py-2 font-mono text-[11px] flex items-start gap-2",children:[e.jsx("span",{className:"flex-1 break-all",children:"ccs cliproxy auth claude"}),e.jsx(P,{value:"ccs cliproxy auth claude",size:"icon"})]})]})]})]})})]}),e.jsxs("div",{className:"flex-1 min-w-0 flex flex-col bg-background",children:[e.jsxs("div",{className:"px-5 py-4 border-b bg-background",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(C,{variant:"outline",children:a("accountsPage.workspaceBadge")}),e.jsx(C,{variant:"secondary",children:a("accountsPage.historySyncBadge")}),e.jsx(C,{variant:"secondary",children:a("accountsPage.resourcesBadge")})]}),e.jsx("h2",{className:"mt-2 text-xl font-semibold tracking-tight",children:a("accountsPage.authAccounts")}),e.jsxs("p",{className:"mt-1 text-sm text-muted-foreground",children:[a("accountsPage.tableScopePrefix"),e.jsx("code",{className:"mx-1 rounded bg-muted px-1 py-0.5",children:"ccs auth"}),a("accountsPage.tableScopeMiddle"),e.jsx("code",{className:"mx-1 rounded bg-muted px-1 py-0.5",children:a("accountsTable.sync")}),a("accountsPage.tableScopeSuffix")]})]}),e.jsxs("div",{className:"flex-1 min-h-0 p-5 space-y-4 overflow-y-auto",children:[e.jsx(he,{totalAccounts:l.length,primaryAccountName:l.length===1?l[0]?.name:null,isolatedCount:N,sharedStandardCount:d,deeperSharedCount:c,sharedAloneCount:j,sharedPeerAccountCount:y,deeperReadyAccountCount:n,sharedGroups:w,sharedPeerGroups:o,deeperReadyGroups:i,legacyTargetCount:T,cliproxyCount:g,plainCcsLane:A}),e.jsx(me,{totalAccounts:l.length,isolatedCount:N,sharedPeerGroups:o,deeperReadyGroups:i}),e.jsxs(O,{className:"flex flex-col",children:[e.jsxs(M,{className:"pb-3",children:[e.jsx(z,{className:"text-lg",children:a("accountsPage.accountMatrix")}),e.jsx(F,{children:a("accountsPage.sharedTotalDesc",{count:v})})]}),e.jsx(G,{children:m?e.jsx("div",{className:"text-muted-foreground",children:a("accountsPage.loadingAccounts")}):e.jsx(ue,{data:l,defaultAccount:t?.default??null,groupSummaries:D,plainCcsLane:A})})]})]})]})]}),e.jsxs("div",{className:"p-4 space-y-4 lg:hidden",children:[e.jsxs(O,{children:[e.jsxs(M,{children:[e.jsx(z,{className:"text-lg",children:a("accountsPage.title")}),e.jsxs(F,{children:[a("accountsPage.managePrefix"),e.jsx("code",{className:"mx-1 rounded bg-muted px-1 py-0.5",children:"ccs auth"}),a("accountsPage.mobileManageSuffix")]})]}),e.jsxs(G,{className:"space-y-2",children:[e.jsxs(p,{className:"w-full",onClick:()=>r(!0),children:[e.jsx(de,{className:"w-4 h-4 mr-2"}),a("accountsPage.createAccount")]}),e.jsxs(p,{variant:"outline",className:"w-full",onClick:f,children:[a("accountsPage.openCliProxyClaudePool"),e.jsx(B,{className:"w-4 h-4 ml-2"})]}),e.jsxs(p,{variant:"outline",className:"w-full",onClick:I,children:[a("accountsPage.authClaudeInPool"),e.jsx(le,{className:"w-4 h-4 ml-2"})]}),e.jsx(p,{variant:"outline",className:"w-full",onClick:_,disabled:s.isPending||T===0,children:s.isPending?a("accountsPage.confirmingLegacy"):a("accountsPage.confirmLegacy",{count:T})})]})]}),e.jsx(he,{totalAccounts:l.length,primaryAccountName:l.length===1?l[0]?.name:null,isolatedCount:N,sharedStandardCount:d,deeperSharedCount:c,sharedAloneCount:j,sharedPeerAccountCount:y,deeperReadyAccountCount:n,sharedGroups:w,sharedPeerGroups:o,deeperReadyGroups:i,legacyTargetCount:T,cliproxyCount:g,plainCcsLane:A}),e.jsx(me,{totalAccounts:l.length,isolatedCount:N,sharedPeerGroups:o,deeperReadyGroups:i}),e.jsxs(O,{children:[e.jsx(M,{className:"pb-3",children:e.jsx(z,{className:"text-base",children:a("accountsPage.accountMatrix")})}),e.jsx(G,{children:m?e.jsx("div",{className:"text-muted-foreground",children:a("accountsPage.loadingAccounts")}):e.jsx(ue,{data:l,defaultAccount:t?.default??null,groupSummaries:D,plainCcsLane:A})})]})]}),e.jsx(gs,{open:u,onClose:()=>r(!1)})]})}export{Ts as AccountsPage};
@@ -1,4 +0,0 @@
1
- import{j as e}from"./radix-ui-nu4wz29m.js";import{r as m,e as Xe}from"./react-vendor-Bjx91N7w.js";import{a as _,B as Q,c as I,o as Ze,p as es,q as ss,j as ts,k as as,l as rs,m as ns,n as pe,e as N,x as le,L,I as B,z as Y,A as Ae,D as is,E as os,F as ls,G as cs,S as we,H as te,J as fe,K as Me,M as ds,N as ms,O as Le,Q as Qe,R as Fe,U as us,V as xs,W as Ce,X as ke,Y as ae,Z as hs,_ as Ie,$ as be,C as He,b as Ue,s as ps,t as gs,a0 as fs,d as js,a1 as Ns,a2 as vs,a3 as bs,a4 as ws,a5 as Cs,a6 as ks,a7 as ys,a8 as Ss}from"./index-DFYK4jw3.js";import{a as Ps,u as je,b as ye}from"./tanstack-bhJxV1h8.js";import{C as Ne}from"./confirm-dialog-CjwyQ3AU.js";import{t as T}from"./notifications-B4_o8bcr.js";import{L as re,R as Z,at as Be,au as Os,a9 as ne,_ as Es,av as ze,aa as ie,C as Ke,aw as Ts,a7 as Rs,ax as Ds,p as oe,X as $e,ay as _s,Z as Je,az as qe,n as Se,aA as Pe,aB as As,aC as ge,a6 as Ms,aD as ve,ae as Ls,aE as Qs,w as Ye,aF as Fs,x as We,o as Is,aG as Hs}from"./icons-gI6odJjU.js";import{M as Ge}from"./masked-input-BZdCgWmH.js";import"./utils-CzKF5WmX.js";import"./form-utils-CuHzLhJZ.js";import"./charts-eIPy2oG6.js";import"./alert-dialog-Dgbg5gJ1.js";function Us({className:s,showTooltip:a=!0}){const{t:r}=_(),n=e.jsxs(Q,{variant:"outline",className:I("bg-accent/10 border-accent/30 text-accent","dark:bg-accent/20 dark:border-accent/40 dark:text-accent-foreground",s),children:[e.jsx("img",{src:"/icons/openrouter.svg",alt:"OpenRouter",className:"mr-1 h-3 w-3"}),"OpenRouter"]});return a?e.jsxs(Ze,{children:[e.jsx(es,{asChild:!0,children:n}),e.jsx(ss,{children:e.jsx("p",{children:r("openrouterBadge.integration")})})]}):n}function Oe(s){return[/^ANTHROPIC_AUTH_TOKEN$/,/_API_KEY$/,/_AUTH_TOKEN$/,/^API_KEY$/,/^AUTH_TOKEN$/,/_SECRET$/,/^SECRET$/].some(r=>r.test(s))}function Ve(s){return s?.env?(s.env.ANTHROPIC_BASE_URL||"").toLowerCase().includes("openrouter.ai"):!1}function Bs(s){return{opus:s.ANTHROPIC_DEFAULT_OPUS_MODEL||void 0,sonnet:s.ANTHROPIC_DEFAULT_SONNET_MODEL||void 0,haiku:s.ANTHROPIC_DEFAULT_HAIKU_MODEL||void 0}}function zs(s,a){const r={...s};return a.opus?r.ANTHROPIC_DEFAULT_OPUS_MODEL=a.opus:delete r.ANTHROPIC_DEFAULT_OPUS_MODEL,a.sonnet?r.ANTHROPIC_DEFAULT_SONNET_MODEL=a.sonnet:delete r.ANTHROPIC_DEFAULT_SONNET_MODEL,a.haiku?r.ANTHROPIC_DEFAULT_HAIKU_MODEL=a.haiku:delete r.ANTHROPIC_DEFAULT_HAIKU_MODEL,r}function Ks({profileName:s,target:a,data:r,settings:n,isLoading:i,isSaving:p,isTargetSaving:f,hasChanges:g,isRawJsonValid:t,onTargetChange:u,onRefresh:x,onDelete:j,onSave:P}){const{t:w}=_(),O=p||f,k=i||O;return e.jsxs("div",{className:"px-6 py-4 border-b bg-background flex items-center justify-between shrink-0",children:[e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("h2",{className:"text-lg font-semibold",children:s}),r?.path&&e.jsx(Q,{variant:"outline",className:"text-xs",children:r.path.replace(/^.*\//,"")}),Ve(n)&&e.jsx(Us,{className:"ml-1"})]}),r&&e.jsxs("p",{className:"text-xs text-muted-foreground mt-0.5",children:[w("profileEditor.lastModified"),": ",new Date(r.mtime).toLocaleString()]}),e.jsxs("div",{className:"mt-2 flex items-center gap-2",children:[e.jsxs("span",{className:"text-xs text-muted-foreground",children:[w("profileEditor.defaultTarget"),":"]}),e.jsxs(ts,{value:a,onValueChange:y=>{k||u(y)},disabled:k,children:[e.jsx(as,{className:"h-7 w-[170px] text-xs",disabled:k,children:e.jsx(rs,{})}),e.jsxs(ns,{children:[e.jsx(pe,{value:"claude",children:w("profileEditor.targetClaude")}),e.jsx(pe,{value:"droid",children:w("profileEditor.targetDroid")}),e.jsx(pe,{value:"codex",children:w("profileEditor.targetCodex")})]})]}),f&&e.jsx(re,{className:"w-3.5 h-3.5 animate-spin text-muted-foreground"})]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(N,{variant:"ghost",size:"sm",onClick:x,disabled:k,children:e.jsx(Z,{className:`w-4 h-4 ${i?"animate-spin":""}`})}),j&&e.jsx(N,{variant:"ghost",size:"sm",onClick:j,disabled:O,children:e.jsx(Be,{className:"w-4 h-4 text-destructive"})}),e.jsx(N,{size:"sm",onClick:P,disabled:O||!g||!t,children:p?e.jsxs(e.Fragment,{children:[e.jsx(re,{className:"w-4 h-4 mr-1 animate-spin"}),w("profileEditor.saving")]}):e.jsxs(e.Fragment,{children:[e.jsx(Os,{className:"w-4 h-4 mr-1"}),w("settingsAuth.save")]})})]})]})}function $s({currentSettings:s,newEnvKey:a,newEnvValue:r,onNewEnvKeyChange:n,onNewEnvValueChange:i,onEnvValueChange:p,onAddEnvVar:f}){const{t:g}=_();return e.jsxs(e.Fragment,{children:[e.jsx(le,{className:"flex-1",children:e.jsx("div",{className:"p-4 space-y-4",children:s?.env&&Object.keys(s.env).length>0?e.jsx(e.Fragment,{children:Object.entries(s.env).map(([t,u])=>e.jsxs("div",{className:"space-y-1.5",children:[e.jsxs(L,{className:"text-xs font-medium flex items-center gap-2 text-muted-foreground",children:[t,Oe(t)&&e.jsx(Q,{variant:"secondary",className:"text-[10px] px-1 py-0 h-4",children:g("envEditor.sensitive")})]}),Oe(t)?e.jsx(Ge,{value:u,onChange:x=>p(t,x.target.value),className:"font-mono text-sm h-8"}):e.jsx(B,{value:u,onChange:x=>p(t,x.target.value),className:"font-mono text-sm h-8"})]},t))}):e.jsxs("div",{className:"py-8 text-center text-muted-foreground bg-muted/30 rounded-lg border border-dashed text-sm",children:[e.jsx("p",{children:g("envEditor.none")}),e.jsx("p",{className:"text-xs mt-1 opacity-70",children:g("envEditor.noneHint")})]})})}),e.jsxs("div",{className:"p-4 border-t bg-background shrink-0",children:[e.jsx(L,{className:"text-xs font-medium text-muted-foreground",children:g("envEditor.addVariable")}),e.jsxs("div",{className:"flex gap-2 mt-2",children:[e.jsx(B,{placeholder:g("envEditor.keyPlaceholder"),value:a,onChange:t=>n(t.target.value.toUpperCase()),className:"font-mono text-sm h-8 w-2/5",onKeyDown:t=>t.key==="Enter"&&a.trim()&&f()}),e.jsx(B,{placeholder:g("envEditor.valuePlaceholder"),value:r,onChange:t=>i(t.target.value),className:"font-mono text-sm h-8 flex-1",onKeyDown:t=>t.key==="Enter"&&a.trim()&&f()}),e.jsx(N,{variant:"outline",size:"sm",className:"h-8",onClick:f,disabled:!a.trim(),children:e.jsx(ne,{className:"w-4 h-4"})})]})]})]})}function Js({profileName:s,target:a,data:r}){const{t:n}=_(),i=a==="droid";return e.jsx(le,{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(Es,{className:"w-4 h-4"}),n("profileEditor.profileInfo")]}),e.jsx("div",{className:"space-y-3 bg-card rounded-lg border p-4 shadow-sm",children:r&&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:n("profileEditor.profileName")}),e.jsx("span",{className:"font-mono",children:r.profile})]}),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:n("profileEditor.filePath")}),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:r.path}),e.jsx(Y,{value:r.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:n("profileEditor.lastModified")}),e.jsx("span",{className:"text-xs",children:new Date(r.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:n("profileEditor.defaultTarget")}),e.jsx("span",{className:"font-mono",children:a})]})]})})]}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-sm font-medium mb-3",children:n("profileEditor.quickUsage")}),e.jsxs("div",{className:"space-y-3 bg-card rounded-lg border p-4 shadow-sm",children:[e.jsxs("div",{children:[e.jsx(L,{className:"text-xs text-muted-foreground",children:n("profileEditor.runWithProfile")}),e.jsxs("div",{className:"mt-1 flex gap-2",children:[e.jsxs("code",{className:"flex-1 px-2 py-1.5 bg-muted rounded text-xs font-mono truncate",children:["ccs ",s,' "prompt"']}),e.jsx(Y,{value:`ccs ${s} "prompt"`,size:"icon",className:"h-6 w-6"})]})]}),e.jsxs("div",{children:[e.jsx(L,{className:"text-xs text-muted-foreground",children:n(i?"profileEditor.droidAliasExplicit":"profileEditor.runOnDroid")}),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:`ccs-droid ${s} "prompt"`}),e.jsx(Y,{value:`ccs-droid ${s} "prompt"`,size:"icon",className:"h-6 w-6"})]})]}),e.jsxs("div",{children:[e.jsx(L,{className:"text-xs text-muted-foreground",children:n(i?"profileEditor.overrideToClaude":"profileEditor.runOnDroidWithFlag")}),e.jsxs("div",{className:"mt-1 flex gap-2",children:[e.jsxs("code",{className:"flex-1 px-2 py-1.5 bg-muted rounded text-xs font-mono truncate",children:["ccs ",s," --target ",i?"claude":"droid",' "prompt"']}),e.jsx(Y,{value:`ccs ${s} --target ${i?"claude":"droid"} "prompt"`,size:"icon",className:"h-6 w-6"})]})]}),e.jsxs("div",{children:[e.jsx(L,{className:"text-xs text-muted-foreground",children:n("profileEditor.setAsDefault")}),e.jsxs("div",{className:"mt-1 flex gap-2",children:[e.jsxs("code",{className:"flex-1 px-2 py-1.5 bg-muted rounded text-xs font-mono truncate",children:["ccs default ",s]}),e.jsx(Y,{value:`ccs default ${s}`,size:"icon",className:"h-6 w-6"})]})]})]})]})]})})}function qs({value:s,onChange:a,placeholder:r,className:n}){const{t:i}=_(),[p,f]=m.useState(""),[g,t]=m.useState(null),{models:u,isLoading:x,isError:j,isFetching:P}=Ae(),w=is(),O=m.useMemo(()=>os(u,p,{category:g??void 0}),[u,p,g]),k=m.useMemo(()=>ls(u,2),[u]),y=!p.trim()&&!g,v=m.useMemo(()=>{const l={anthropic:[],openai:[],google:[],meta:[],mistral:[],opensource:[],other:[]};O.forEach(h=>{l[h.category].push(h)});for(const h of Object.keys(l))l[h]=cs(l[h]);return l},[O]),R=m.useCallback(()=>{w()},[w]),b=u.find(l=>l.id===s);return x&&u.length===0?e.jsxs("div",{className:I("space-y-2",n),children:[e.jsx(we,{className:"h-10 w-full"}),e.jsx(we,{className:"h-32 w-full"})]}):e.jsxs("div",{className:I("space-y-2 w-full min-w-0 overflow-hidden",n),children:[e.jsxs("div",{className:"flex gap-2",children:[e.jsxs("div",{className:"relative flex-1",children:[e.jsx(ze,{className:"text-muted-foreground absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2"}),e.jsx(B,{value:p,onChange:l=>f(l.target.value),placeholder:r??i("openrouterModelPicker.searchModels"),className:"pl-9"})]}),e.jsx(N,{variant:"outline",size:"icon",onClick:R,disabled:P,title:"Refresh models",children:P?e.jsx(re,{className:"h-4 w-4 animate-spin"}):e.jsx(Z,{className:"h-4 w-4"})})]}),e.jsxs("div",{className:"flex flex-wrap gap-1",children:[e.jsxs(Q,{variant:g===null?"default":"outline",className:"cursor-pointer",onClick:()=>t(null),children:["All (",u.length,")"]}),Object.keys(te).map(l=>{const h=v[l].length;return h===0?null:e.jsxs(Q,{variant:g===l?"default":"outline",className:"cursor-pointer",onClick:()=>t(l),children:[te[l]," (",h,")"]},l)})]}),b&&e.jsxs("div",{className:"bg-muted rounded-md p-2 text-sm",children:[e.jsx("span",{className:"font-medium",children:b.name}),e.jsxs("span",{className:"text-muted-foreground ml-2",children:[fe(b.pricing)," |"," ",Me(b.context_length)]})]}),e.jsx(le,{className:"h-72 w-full rounded-md border",children:j?e.jsxs("div",{className:"text-destructive p-4 text-center",children:["Failed to load models."," ",e.jsx(N,{variant:"link",onClick:R,children:"Retry"})]}):O.length===0?e.jsxs("div",{className:"text-muted-foreground p-4 text-center",children:['No models found matching "',p,'"']}):e.jsxs("div",{className:"space-y-6 p-3",children:[y&&k.length>0&&e.jsxs("div",{children:[e.jsxs("div",{className:"text-muted-foreground bg-background sticky top-0 mb-2 flex items-center gap-1.5 py-1.5 text-xs font-semibold border-b pb-2",children:[e.jsx(ie,{className:"h-3 w-3 text-accent"}),e.jsx("span",{children:i("openrouterModelPicker.newestModels")})]}),e.jsx("div",{className:"space-y-1",children:k.map(l=>e.jsx(Ee,{model:l,isSelected:l.id===s,onClick:()=>a(l.id),showAge:!0},l.id))})]}),Object.keys(te).map(l=>{const h=v[l];return h.length===0?null:e.jsxs("div",{children:[e.jsx("div",{className:"text-muted-foreground bg-background sticky top-0 mb-2 py-1.5 text-xs font-semibold border-b pb-2",children:te[l]}),e.jsx("div",{className:"space-y-1",children:h.map(c=>e.jsx(Ee,{model:c,isSelected:c.id===s,onClick:()=>a(c.id)},c.id))})]},l)})]})})]})}function Ee({model:s,isSelected:a,onClick:r,showAge:n=!1}){return e.jsxs("button",{type:"button",onClick:r,className:I("group flex w-full items-center gap-2 rounded-md px-3 py-2 text-left text-sm transition-colors","hover:bg-accent hover:text-accent-foreground",a&&"bg-accent text-accent-foreground"),children:[e.jsx("span",{className:"flex-1 min-w-0 truncate font-medium",children:s.name}),e.jsxs("span",{className:I("flex shrink-0 items-center gap-1 text-xs whitespace-nowrap",a?"text-accent-foreground/80":"text-muted-foreground group-hover:text-accent-foreground/80"),children:[n&&s.created&&e.jsx(Q,{variant:"outline",className:I("text-[10px] px-1",a?"border-accent-foreground/30 text-accent-foreground/80":"text-accent border-accent/30 group-hover:text-accent-foreground/80 group-hover:border-accent-foreground/30"),children:ds(s.created)}),s.isFree?e.jsx(Q,{variant:"secondary",className:I("text-[10px] px-1",a?"bg-accent-foreground/20 text-accent-foreground":"group-hover:bg-accent-foreground/20 group-hover:text-accent-foreground"),children:"Free"}):s.isExacto?e.jsxs(e.Fragment,{children:[e.jsx(Q,{variant:"outline",className:I("text-[10px] px-1 border-emerald-500/50 text-emerald-600",a?"border-accent-foreground/30 text-accent-foreground/80":"group-hover:border-accent-foreground/30 group-hover:text-accent-foreground/80"),children:"Exacto"}),e.jsx("span",{className:"tabular-nums",children:fe(s.pricing)})]}):e.jsx("span",{className:"tabular-nums",children:fe(s.pricing)}),e.jsx("span",{className:"tabular-nums",children:Me(s.context_length)})]})]})}function Ys({selectedModel:s,value:a,onChange:r,className:n}){const{t:i}=_(),{models:p}=Ae(),f=m.useMemo(()=>s?ms(s,p):{},[s,p]),g=()=>{r(f)},t=(x,j)=>{r({...a,[x]:j||void 0})},u=s&&Object.keys(f).length>0;return e.jsxs(Le,{className:I("group",n),children:[e.jsxs(Qe,{className:"flex items-center gap-2 text-sm font-medium hover:underline",children:[e.jsx(Ke,{className:"h-4 w-4 transition-transform group-data-[state=open]:rotate-90"}),i("modelTierMapping.title"),e.jsxs("span",{className:"text-muted-foreground font-normal",children:["(",i("modelTierMapping.advanced"),")"]})]}),e.jsxs(Fe,{className:"space-y-3 pt-3",children:[e.jsx("p",{className:"text-muted-foreground text-sm",children:i("modelTierMapping.description")}),u&&e.jsxs(N,{type:"button",variant:"outline",size:"sm",onClick:g,children:[e.jsx(Ts,{className:"mr-1 h-4 w-4"}),i("modelTierMapping.autoSuggest",{provider:s?.split("/")[0]})]}),e.jsxs("div",{className:"grid gap-3",children:[e.jsxs("div",{className:"grid grid-cols-[80px_1fr] items-center gap-2",children:[e.jsx(L,{htmlFor:"tier-opus",className:"text-right",children:"Opus"}),e.jsx(B,{id:"tier-opus",value:a.opus??"",onChange:x=>t("opus",x.target.value),placeholder:i("modelTierMapping.opusPlaceholder")})]}),e.jsxs("div",{className:"grid grid-cols-[80px_1fr] items-center gap-2",children:[e.jsx(L,{htmlFor:"tier-sonnet",className:"text-right",children:"Sonnet"}),e.jsx(B,{id:"tier-sonnet",value:a.sonnet??"",onChange:x=>t("sonnet",x.target.value),placeholder:i("modelTierMapping.sonnetPlaceholder")})]}),e.jsxs("div",{className:"grid grid-cols-[80px_1fr] items-center gap-2",children:[e.jsx(L,{htmlFor:"tier-haiku",className:"text-right",children:"Haiku"}),e.jsx(B,{id:"tier-haiku",value:a.haiku??"",onChange:x=>t("haiku",x.target.value),placeholder:i("modelTierMapping.haikuPlaceholder")})]})]}),e.jsx("p",{className:"text-muted-foreground text-xs",children:i("modelTierMapping.footer")})]})]})}function Ws({profileName:s,target:a,data:r,currentSettings:n,newEnvKey:i,newEnvValue:p,onNewEnvKeyChange:f,onNewEnvValueChange:g,onEnvValueChange:t,onAddEnvVar:u,onEnvBulkChange:x}){const{t:j}=_(),P=Ve(n),w=n?.env,O=m.useMemo(()=>Bs(w??{}),[w]),k=w??{},y=c=>{if(x){const H={...k,ANTHROPIC_MODEL:c,ANTHROPIC_DEFAULT_OPUS_MODEL:c,ANTHROPIC_DEFAULT_SONNET_MODEL:c,ANTHROPIC_DEFAULT_HAIKU_MODEL:c};x(H)}else t("ANTHROPIC_MODEL",c),t("ANTHROPIC_DEFAULT_OPUS_MODEL",c),t("ANTHROPIC_DEFAULT_SONNET_MODEL",c),t("ANTHROPIC_DEFAULT_HAIKU_MODEL",c);T.success(ae.t("commonToast.appliedModelAllTiers"),{duration:2e3})},v=c=>{if(x){const H=zs(k,c);x(H)}else c.opus!==void 0&&t("ANTHROPIC_DEFAULT_OPUS_MODEL",c.opus||""),c.sonnet!==void 0&&t("ANTHROPIC_DEFAULT_SONNET_MODEL",c.sonnet||""),c.haiku!==void 0&&t("ANTHROPIC_DEFAULT_HAIKU_MODEL",c.haiku||"")},[R,b]=m.useState(!1),l=new Set(["ANTHROPIC_AUTH_TOKEN"]),h=Object.entries(k).filter(([c])=>!l.has(c));return e.jsx("div",{className:"h-full w-full min-w-0 flex flex-col",children:e.jsxs(us,{defaultValue:"env",className:"h-full w-full min-w-0 flex flex-col",children:[e.jsx("div",{className:"px-4 pt-4 shrink-0",children:e.jsxs(xs,{className:"w-full",children:[e.jsx(Ce,{value:"env",className:"flex-1",children:P?"Configuration":j("settingsDialog.envTab")}),e.jsx(Ce,{value:"info",className:"flex-1",children:"Info & Usage"})]})}),e.jsxs("div",{className:"flex-1 overflow-hidden flex flex-col min-w-0",children:[e.jsx(ke,{value:"env",className:"flex-1 mt-0 border-0 p-0 data-[state=inactive]:hidden flex flex-col overflow-hidden min-w-0",children:P?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"flex-1 overflow-hidden",children:e.jsxs("div",{className:"h-full overflow-y-auto overflow-x-hidden p-4 space-y-6",children:[e.jsxs("div",{className:"space-y-3",children:[e.jsx(L,{className:"text-sm font-medium",children:"Model Selection"}),e.jsx(qs,{value:k.ANTHROPIC_MODEL,onChange:y,placeholder:"Search OpenRouter models..."})]}),e.jsx(Ys,{selectedModel:k.ANTHROPIC_MODEL,value:O,onChange:v}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(L,{className:"text-sm font-medium",children:j("profileDialog.apiKey")}),e.jsx(Ge,{value:k.ANTHROPIC_AUTH_TOKEN||"",onChange:c=>t("ANTHROPIC_AUTH_TOKEN",c.target.value),placeholder:"sk-or-v1-...",className:"font-mono text-sm"}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:["Get your API key from"," ",e.jsx("a",{href:"https://openrouter.ai/keys",target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline",children:"openrouter.ai/keys"})]})]}),h.length>0&&e.jsxs(Le,{open:R,onOpenChange:b,children:[e.jsxs(Qe,{className:"flex items-center gap-2 text-sm font-medium text-muted-foreground hover:text-foreground transition-colors group",children:[e.jsx(Ke,{className:I("h-4 w-4 transition-transform",R&&"rotate-90")}),e.jsx(Rs,{className:"h-4 w-4"}),e.jsx("span",{children:"Additional Variables"}),e.jsxs("span",{className:"text-xs font-normal opacity-70",children:["(",h.length,")"]})]}),e.jsx(Fe,{className:"pt-4",children:e.jsx("div",{className:"space-y-3 border rounded-lg p-3 bg-muted/30",children:h.map(([c,H])=>e.jsxs("div",{className:"space-y-1",children:[e.jsx(L,{className:"text-xs text-muted-foreground",children:c}),e.jsx(B,{value:H,onChange:J=>t(c,J.target.value),className:"font-mono text-xs h-8"})]},c))})})]})]})}),e.jsxs("div",{className:"p-4 border-t bg-background shrink-0",children:[e.jsx(L,{className:"text-xs font-medium text-muted-foreground",children:j("envEditor.addVariable")}),e.jsxs("div",{className:"flex gap-2 mt-2",children:[e.jsx(B,{placeholder:j("envEditor.keyPlaceholder"),value:i,onChange:c=>f(c.target.value.toUpperCase()),className:"font-mono text-sm h-8 w-2/5",onKeyDown:c=>c.key==="Enter"&&i.trim()&&u()}),e.jsx(B,{placeholder:j("envEditor.valuePlaceholder"),value:p,onChange:c=>g(c.target.value),className:"font-mono text-sm h-8 flex-1",onKeyDown:c=>c.key==="Enter"&&i.trim()&&u()}),e.jsx(N,{variant:"outline",size:"sm",className:"h-8",onClick:u,disabled:!i.trim(),children:e.jsx(ne,{className:"w-4 h-4"})})]})]})]}):e.jsx($s,{currentSettings:n,newEnvKey:i,newEnvValue:p,onNewEnvKeyChange:f,onNewEnvValueChange:g,onEnvValueChange:t,onAddEnvVar:u})}),e.jsx(ke,{value:"info",className:"h-full mt-0 border-0 p-0 data-[state=inactive]:hidden",children:e.jsx(Js,{profileName:s,target:a,data:r})})]})]})})}function Gs({profileName:s,profileTarget:a,onDelete:r,onHasChangesUpdate:n}){const{t:i}=_(),[p,f]=m.useState({}),[g,t]=m.useState(!1),[u,x]=m.useState(null),[j,P]=m.useState(""),[w,O]=m.useState(""),k=Ps(),{data:y,isLoading:v,isError:R,refetch:b}=je({queryKey:["settings",s],queryFn:async()=>{const d=await fetch(`/api/settings/${s}/raw`);if(!d.ok)throw new Error(`Failed to load settings: ${d.status}`);return d.json()}}),l=y?.settings,h=m.useMemo(()=>{if(u!==null)try{return JSON.parse(u)}catch{}if(l)return{...l,env:{...l.env,...p}}},[l,p,u]),c=m.useMemo(()=>u!==null?u:l?JSON.stringify(l,null,2):"",[u,l]),H=m.useCallback(d=>{x(d)},[]),J=m.useCallback(d=>{const C={...h??{}},M=C.ccs_image&&typeof C.ccs_image=="object"?{...C.ccs_image}:{};d?M.native_read=!0:delete M.native_read,Object.keys(M).length>0?C.ccs_image=M:delete C.ccs_image,x(JSON.stringify(C,null,2))},[h]),q=(d,C)=>{const M={...h?.env||{},[d]:C};f(V=>({...V,[d]:C})),x(JSON.stringify({...h,env:M},null,2))},ee=d=>{const C={...h?.env||{},...d};f(M=>({...M,...d})),x(JSON.stringify({...h,env:C},null,2))},U=()=>{if(!j.trim())return;const d=j.trim(),C=w,M={...h?.env||{},[d]:C};f(V=>({...V,[d]:C})),x(JSON.stringify({...h,env:M},null,2)),P(""),O("")},z=m.useMemo(()=>{try{return JSON.parse(c),!0}catch{return!1}},[c]),S=m.useMemo(()=>u!==null?u!==JSON.stringify(l,null,2):Object.keys(p).length>0,[u,p,l]),$=m.useDeferredValue(c),se=m.useMemo(()=>{if(!S||!z)return null;try{return JSON.parse($)}catch{return null}},[S,z,$]),{data:W,isFetching:ce,isError:G,isPlaceholderData:de}=je({queryKey:["settings",s,"image-analysis-status-preview",$],enabled:se!==null,placeholderData:d=>d,queryFn:async()=>{const d=await fetch(`/api/settings/${s}/image-analysis-status`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({settings:se})});if(!d.ok)throw new Error(`Failed to preview image-analysis status: ${d.status}`);return d.json()}}),me=S&&z&&!G?W?.imageAnalysisStatus??y?.imageAnalysisStatus:y?.imageAnalysisStatus,ue=S&&z&&!G&&W?.imageAnalysisStatus?"editor":"saved",xe=S?z?G?"saved":ce&&(!W?.imageAnalysisStatus||de)?"refreshing":"preview":"invalid":"saved",he=h?.ccs_image?.native_read===!0,o=m.useMemo(()=>{const d=["ANTHROPIC_BASE_URL","ANTHROPIC_AUTH_TOKEN"],C=h?.env||{};return d.filter(M=>!C[M]?.trim())},[h]);m.useEffect(()=>{n?.(S)},[S,n]);const D=ye({mutationFn:async()=>{let d;try{d=JSON.parse(c)}catch{d={...y?.settings,env:{...y?.settings?.env,...p}}}const C=await fetch(`/api/settings/${s}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({settings:d,expectedMtime:y?.mtime})});if(C.status===409)throw new Error("CONFLICT");if(!C.ok)throw new Error("Failed to save");return C.json()},onSuccess:()=>{k.invalidateQueries({queryKey:["settings",s]}),k.invalidateQueries({queryKey:["profiles"]}),f({}),x(null),T.success(ae.t("commonToast.settingsSaved"))},onError:d=>{d.message==="CONFLICT"?t(!0):T.error(d.message)}}),E=ye({mutationFn:async d=>(await Ie.profiles.update(s,{target:d}),d),onSuccess:()=>{k.invalidateQueries({queryKey:["profiles"]}),T.success(ae.t("commonToast.defaultTargetUpdated"))},onError:(d,C)=>{const M=C==="droid"?"Factory Droid":C==="codex"?"Codex CLI":"Claude Code",V=d.message.trim()?`: ${d.message}`:"";T.error(ae.t("commonToast.failedUpdateDefaultTarget",{target:M,suffix:V}))}}),F=a||"claude",A=D.isPending||E.isPending,K=async d=>{t(!1),d?(await b(),D.mutate()):(f({}),x(null))};return e.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[e.jsx(Ks,{profileName:s,target:F,data:y,settings:h,isLoading:v,isSaving:D.isPending,isTargetSaving:E.isPending,hasChanges:S,isRawJsonValid:z,onTargetChange:d=>{A||d!==F&&E.mutate(d)},onRefresh:()=>{A||b()},onDelete:r,onSave:()=>{A||D.mutate()}}),v?e.jsxs("div",{className:"flex-1 flex items-center justify-center",children:[e.jsx(re,{className:"w-8 h-8 animate-spin text-muted-foreground"}),e.jsx("span",{className:"ml-3 text-muted-foreground",children:i("settingsDialog.loadingSettings")})]}):R?e.jsx("div",{className:"flex-1 flex items-center justify-center",children:e.jsxs("div",{className:"text-center space-y-3",children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:i("settingsPage.failedLoad")}),e.jsxs(N,{variant:"outline",size:"sm",onClick:()=>b(),children:[e.jsx(Z,{className:"w-4 h-4 mr-1"}),i("apiProfiles.retry")]})]})}):e.jsxs("div",{className:"min-h-0 flex-1 grid grid-cols-[40%_60%] divide-x overflow-hidden",children:[e.jsx("div",{className:"flex min-h-0 min-w-0 flex-col overflow-hidden bg-muted/5",children:e.jsx(Ws,{profileName:s,target:F,data:y,currentSettings:h,newEnvKey:j,newEnvValue:w,onNewEnvKeyChange:P,onNewEnvValueChange:O,onEnvValueChange:q,onEnvBulkChange:ee,onAddEnvVar:U})}),e.jsxs("div",{className:"flex min-h-0 min-w-0 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(Ds,{className:"w-4 h-4 text-muted-foreground"}),e.jsx("span",{className:"text-sm font-medium text-muted-foreground",children:i("rawEditorSection.rawConfig")})]}),e.jsx(hs,{rawJsonContent:c,isRawJsonValid:z,rawJsonEdits:u,settings:l,profileTarget:F,imageAnalysisStatus:me,imageAnalysisStatusSource:ue,imageAnalysisStatusPreviewState:xe,nativeReadPreferenceOverride:he,onToggleNativeRead:J,onChange:H,missingRequiredFields:o})]})]}),e.jsx(Ne,{open:g,title:i("settingsDialog.conflictTitle"),description:i("settingsDialog.conflictDesc"),confirmText:i("settingsDialog.overwrite"),variant:"destructive",onConfirm:()=>K(!0),onCancel:()=>K(!1)})]},s)}const Te="ccs:openrouter-banner-dismissed";function Vs({onCreateClick:s}){const{t:a}=_(),[r,n]=m.useState(!0),{modelCount:i,isLoading:p}=be();m.useEffect(()=>{const g=localStorage.getItem(Te)==="true";n(g)},[]);const f=()=>{localStorage.setItem(Te,"true"),n(!0)};return r?null:e.jsx("div",{className:"bg-gradient-to-r from-accent to-accent/90 text-white px-4 py-3 relative shrink-0",children:e.jsxs("div",{className:"flex items-center justify-between gap-4 max-w-screen-xl mx-auto",children:[e.jsxs("div",{className:"flex items-center gap-3 flex-1 min-w-0",children:[e.jsx("div",{className:"p-1.5 bg-white/20 rounded-md shrink-0",children:e.jsx(ie,{className:"w-4 h-4"})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("p",{className:"font-medium text-sm",children:[a("openrouterBadge.new"),": ",a("openrouterBadge.integration")]}),e.jsx("p",{className:"text-xs text-white/80 truncate",children:a("openrouterBanner.accessModels",{count:p?300:i})})]})]}),e.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[s&&e.jsx(N,{size:"sm",variant:"secondary",onClick:s,className:"bg-white text-accent hover:bg-white/90 h-8",children:a("openrouterBanner.add")}),e.jsxs("a",{href:"https://openrouter.ai",target:"_blank",rel:"noopener noreferrer",className:"text-xs text-white/80 hover:text-white hidden sm:flex items-center gap-1",children:["Learn more",e.jsx(oe,{className:"w-3 h-3"})]}),e.jsxs(N,{size:"icon",variant:"ghost",onClick:f,className:"h-7 w-7 text-white/70 hover:text-white hover:bg-white/20",children:[e.jsx($e,{className:"w-4 h-4"}),e.jsx("span",{className:"sr-only",children:"Dismiss"})]})]})]})})}function Xs(){return je({queryKey:["profiles","local-runtime-readiness"],queryFn:()=>Ie.profiles.getLocalRuntimeReadiness(),staleTime:15e3,refetchOnWindowFocus:!1})}function X({badge:s,badgeClassName:a,className:r,title:n,description:i,visual:p,highlights:f,actionLabel:g,actionClassName:t,onAction:u,footer:x}){return e.jsxs(He,{className:I("flex h-full flex-col border shadow-sm",r),children:[e.jsxs(ps,{className:"space-y-3 pb-3",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[p,e.jsx(Q,{variant:"secondary",className:a,children:s})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(gs,{className:"text-base",children:n}),e.jsx(fs,{className:"text-sm leading-6",children:i})]})]}),e.jsxs(Ue,{className:"mt-auto flex flex-1 flex-col gap-4 pt-0",children:[e.jsx("div",{className:"space-y-2 text-xs text-muted-foreground",children:f.map(j=>e.jsxs("div",{className:"flex items-center gap-2",children:[j.icon,e.jsx("span",{children:j.label})]},j.label))}),e.jsxs(N,{onClick:u,className:t,children:[g,e.jsx(Ms,{className:"ml-2 h-4 w-4"})]}),x?e.jsx("div",{className:"text-xs text-muted-foreground",children:x}):null]})]})}function Re(s,a,r){return s?s.status==="ready"?{badge:r("openrouterQuickStart.localRuntimeReadyBadge"),badgeClassName:"bg-emerald-500/10 text-emerald-700 dark:bg-emerald-500/20 dark:text-emerald-200",actionLabel:r("openrouterQuickStart.localRuntimeUseAction",{label:a}),description:r("openrouterQuickStart.localRuntimeReadyDescription"),footer:r("openrouterQuickStart.localRuntimeReadyFooter",{endpoint:s.endpoint})}:s.status==="missing-model"?{badge:r("openrouterQuickStart.localRuntimeNeedsModelBadge"),badgeClassName:"bg-amber-500/10 text-amber-700 dark:bg-amber-500/20 dark:text-amber-200",actionLabel:r("openrouterQuickStart.localRuntimeFinishAction",{label:a}),description:r("openrouterQuickStart.localRuntimeNeedsModelDescription"),footer:r("openrouterQuickStart.localRuntimeMissingModelFooter",{command:s.commandHint})}:{badge:r("openrouterQuickStart.localRuntimeOfflineBadge"),badgeClassName:"bg-muted text-muted-foreground",actionLabel:r("openrouterQuickStart.localRuntimeSetupAction",{label:a}),description:r("openrouterQuickStart.localRuntimeOfflineDescription"),footer:r("openrouterQuickStart.localRuntimeOfflineFooter",{command:s.commandHint})}:{badge:r("openrouterQuickStart.localRuntimeCheckingBadge"),badgeClassName:"bg-muted text-muted-foreground",actionLabel:r("openrouterQuickStart.localRuntimeSetupAction",{label:a}),description:r("openrouterQuickStart.localRuntimeCheckingDescription"),footer:r("openrouterQuickStart.localRuntimeCheckingFooter")}}function Zs({hasProfiles:s,profileCount:a,onOpenRouterClick:r,onAlibabaCodingPlanClick:n,onCliproxyClick:i,onCustomClick:p,onOllamaClick:f,onLlamacppClick:g}){const{t}=_(),{modelCount:u,isLoading:x}=be(),{data:j}=Xs(),P=x?"300+":`${u}+`,w=s?t("openrouterQuickStart.profileSummaryCount",{count:a}):t("openrouterQuickStart.profileSummaryEmpty"),O=t(s?"openrouterQuickStart.summaryExistingTitle":"openrouterQuickStart.summaryEmptyTitle"),k=s?t("openrouterQuickStart.summaryExistingDescription",{count:a}):t("openrouterQuickStart.summaryEmptyDescription"),y=j?.runtimes.find(l=>l.id==="ollama"),v=j?.runtimes.find(l=>l.id==="llamacpp"),R=Re(y,t("openrouterQuickStart.localOllamaLabel"),t),b=Re(v,t("openrouterQuickStart.localLlamacppLabel"),t);return e.jsx("div",{className:"flex h-full min-h-0 flex-col overflow-auto bg-muted/20 p-4 sm:p-6",children:e.jsxs("div",{className:"mx-auto flex w-full max-w-7xl flex-col gap-5",children:[e.jsx(He,{className:"border-dashed bg-background/90 shadow-sm",children:e.jsxs(Ue,{className:"flex flex-col gap-4 p-5 lg:flex-row lg:items-center lg:justify-between",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsx(Q,{variant:"secondary",children:w}),e.jsx(Q,{variant:"outline",children:t("openrouterQuickStart.summaryBadgeDefaultQuality")}),e.jsx(Q,{variant:"outline",children:t("openrouterQuickStart.summaryBadgeLocalLane")})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("h2",{className:"text-xl font-semibold",children:O}),e.jsx("p",{className:"max-w-3xl text-sm leading-6 text-muted-foreground",children:k})]})]}),e.jsx(N,{variant:"outline",onClick:p,className:"shrink-0",children:t("openrouterQuickStart.createCustomProfile")})]})}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(_s,{className:"h-4 w-4 text-accent"}),e.jsx("h3",{className:"text-sm font-semibold uppercase tracking-[0.12em] text-foreground/70",children:t("openrouterQuickStart.qualityLanesTitle")})]}),e.jsxs("div",{className:"grid gap-4 lg:grid-cols-2",children:[e.jsx(X,{badge:t("openrouterQuickStart.recommended"),title:t("openrouterQuickStart.title"),description:t("openrouterQuickStart.description",{modelCountLabel:P}),visual:e.jsx("div",{className:"rounded-lg bg-accent/10 p-2",children:e.jsx("img",{src:"/icons/openrouter.svg",alt:"OpenRouter",className:"h-5 w-5"})}),highlights:[{icon:e.jsx(Je,{className:"h-3.5 w-3.5 text-accent"}),label:t("openrouterQuickStart.featureOneApi")},{icon:e.jsx(ie,{className:"h-3.5 w-3.5 text-accent"}),label:t("openrouterQuickStart.qualityLaneHighlightDefaultQuality")}],actionLabel:t("openrouterQuickStart.createOpenRouterProfile"),actionClassName:"w-full bg-accent text-white hover:bg-accent/90",onAction:r,footer:e.jsxs(e.Fragment,{children:[t("openrouterQuickStart.getApiKeyAt")," ",e.jsxs("a",{href:"https://openrouter.ai/keys",target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-1 text-accent hover:underline",children:["openrouter.ai/keys",e.jsx(oe,{className:"h-3 w-3"})]})]})}),e.jsx(X,{badge:t("alibabaCodingPlanQuickStart.recommended"),badgeClassName:"bg-orange-500/10 text-orange-700 dark:bg-orange-500/20 dark:text-orange-200",title:t("alibabaCodingPlanQuickStart.title"),description:t("openrouterQuickStart.alibabaLaneDescription"),visual:e.jsx("div",{className:"rounded-lg bg-orange-500/10 p-2",children:e.jsx("img",{src:"/assets/providers/alibabacloud-color.svg",alt:"Alibaba Coding Plan",className:"h-5 w-5"})}),highlights:[{icon:e.jsx(qe,{className:"h-3.5 w-3.5 text-orange-600"}),label:t("alibabaCodingPlanQuickStart.featureEndpoint")},{icon:e.jsx(Se,{className:"h-3.5 w-3.5 text-orange-600"}),label:t("openrouterQuickStart.alibabaLaneHighlightQuality")}],actionLabel:t("alibabaCodingPlanQuickStart.createAlibabaProfile"),actionClassName:"w-full bg-orange-600 text-white hover:bg-orange-600/90",onAction:n,footer:e.jsxs(e.Fragment,{children:[t("alibabaCodingPlanQuickStart.readGuideAt")," ",e.jsxs("a",{href:"https://www.alibabacloud.com/help/en/model-studio/coding-plan",target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-1 text-orange-700 hover:underline dark:text-orange-400",children:["Alibaba Cloud Model Studio",e.jsx(oe,{className:"h-3 w-3"})]})]})})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Pe,{className:"h-4 w-4 text-emerald-600"}),e.jsx("h3",{className:"text-sm font-semibold uppercase tracking-[0.12em] text-foreground/70",children:t("openrouterQuickStart.localRuntimesTitle")})]}),e.jsxs("div",{className:"grid gap-4 lg:grid-cols-2",children:[e.jsx(X,{badge:R.badge,badgeClassName:R.badgeClassName,title:t("openrouterQuickStart.localOllamaTitle"),description:R.description,visual:e.jsx("div",{className:"rounded-lg bg-emerald-500/10 p-2",children:e.jsx("img",{src:"/icons/ollama.svg",alt:"Ollama",className:"h-5 w-5"})}),highlights:[{icon:e.jsx(As,{className:"h-3.5 w-3.5 text-emerald-600"}),label:t("openrouterQuickStart.localOllamaHighlight")},{icon:e.jsx(ie,{className:"h-3.5 w-3.5 text-emerald-600"}),label:y?.detectedModelCount&&y.detectedModelCount>0?t("openrouterQuickStart.localDetectedModels",{count:y.detectedModelCount}):t("openrouterQuickStart.localNoModelsDetected")}],actionLabel:R.actionLabel,actionClassName:"w-full bg-emerald-600 text-white hover:bg-emerald-600/90",onAction:f,footer:e.jsx("span",{children:R.footer})}),e.jsx(X,{badge:b.badge,badgeClassName:b.badgeClassName,title:t("openrouterQuickStart.localLlamacppTitle"),description:b.description,visual:e.jsx("div",{className:"rounded-lg bg-sky-500/10 p-2",children:e.jsx("img",{src:"/assets/providers/llama-cpp.svg",alt:"llama.cpp",className:"h-5 w-5"})}),highlights:[{icon:e.jsx(ge,{className:"h-3.5 w-3.5 text-sky-600"}),label:t("openrouterQuickStart.localLlamacppHighlight")},{icon:e.jsx(Pe,{className:"h-3.5 w-3.5 text-sky-600"}),label:v?.detectedModelCount&&v.detectedModelCount>0?t("openrouterQuickStart.localDetectedModels",{count:v.detectedModelCount}):t("openrouterQuickStart.localWaitingServer")}],actionLabel:b.actionLabel,actionClassName:"w-full bg-sky-600 text-white hover:bg-sky-600/90",onAction:g,footer:e.jsx("span",{children:b.footer})})]})]}),e.jsx("div",{className:"grid gap-4 lg:grid-cols-2",children:e.jsx(X,{badge:t("openrouterQuickStart.runtimeProviderBadge"),badgeClassName:"bg-emerald-500/10 text-emerald-700 dark:bg-emerald-500/20 dark:text-emerald-200",title:t("openrouterQuickStart.runtimeProviderTitle"),description:t("openrouterQuickStart.runtimeProviderManagedDescription"),visual:e.jsx("div",{className:"rounded-lg bg-emerald-500/10 p-2",children:e.jsx(ge,{className:"h-5 w-5 text-emerald-700 dark:text-emerald-300"})}),highlights:[{icon:e.jsx(ge,{className:"h-3.5 w-3.5 text-emerald-600"}),label:t("openrouterQuickStart.runtimeProviderFeatureConnectors")},{icon:e.jsx(Se,{className:"h-3.5 w-3.5 text-emerald-600"}),label:t("openrouterQuickStart.runtimeProviderFeatureSecrets")}],actionLabel:t("openrouterQuickStart.runtimeProviderTitle"),actionClassName:"w-full bg-emerald-600 text-white hover:bg-emerald-600/90",onAction:i,footer:e.jsx("span",{children:t("openrouterQuickStart.runtimeProviderFooter")})})})]})})}function et({onCreateClick:s}){const{t:a}=_();return be(),e.jsx("div",{className:"p-3 border-t bg-gradient-to-r from-accent/5 to-accent/10 dark:from-accent/10 dark:to-accent/15",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"p-1.5 bg-accent/10 dark:bg-accent/20 rounded shrink-0",children:e.jsx("img",{src:"/icons/openrouter.svg",alt:"",className:"w-4 h-4"})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("p",{className:"text-xs font-medium text-accent dark:text-accent-foreground",children:a("openrouterPromoCard.title")}),e.jsx("p",{className:"text-[10px] text-muted-foreground truncate",children:a("openrouterPromoCard.description")})]}),e.jsxs(N,{size:"sm",variant:"ghost",onClick:s,className:"h-7 px-2 text-accent hover:text-accent hover:bg-accent/10 dark:hover:bg-accent/20",children:[e.jsx(Je,{className:"w-3 h-3 mr-1"}),e.jsx("span",{className:"text-xs",children:a("openrouterBanner.add")})]})]})})}function st({onCreateClick:s}){const{t:a}=_();return e.jsx("div",{className:"p-3 border-t bg-gradient-to-r from-orange-500/5 to-orange-500/10 dark:from-orange-500/10 dark:to-orange-500/15",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"p-1.5 bg-orange-500/10 dark:bg-orange-500/20 rounded shrink-0",children:e.jsx("img",{src:"/assets/providers/alibabacloud-color.svg",alt:"",className:"w-4 h-4"})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("p",{className:"text-xs font-medium text-orange-700 dark:text-orange-300",children:a("alibabaCodingPlanPromo.title")}),e.jsx("p",{className:"text-[10px] text-muted-foreground truncate",children:a("alibabaCodingPlanPromo.subtitle")})]}),e.jsxs(N,{size:"sm",variant:"ghost",onClick:s,className:"h-7 px-2 text-orange-700 dark:text-orange-300 hover:text-orange-700 hover:bg-orange-500/10 dark:hover:bg-orange-500/20",children:[e.jsx(qe,{className:"w-3 h-3 mr-1"}),e.jsx("span",{className:"text-xs",children:a("alibabaCodingPlanPromo.add")})]})]})})}const De="ccs:ccs-bar-banner-dismissed",tt="https://github.com/kaitranntt/ccs/blob/main/docs/ccs-bar.md",at=typeof navigator<"u"&&/Mac|iPhone|iPad/i.test(navigator.userAgent||navigator.platform||"");function rt({onInstallClick:s}){const{t:a}=_(),[r,n]=m.useState(!0);m.useEffect(()=>{const p=localStorage.getItem(De)==="true";n(p)},[]);const i=()=>{localStorage.setItem(De,"true"),n(!0)};return!at||r?null:e.jsx("div",{className:"bg-gradient-to-r from-accent to-accent/90 text-white px-4 py-3 relative shrink-0",children:e.jsxs("div",{className:"flex items-center justify-between gap-4 max-w-screen-xl mx-auto",children:[e.jsxs("div",{className:"flex items-center gap-3 flex-1 min-w-0",children:[e.jsx("div",{className:"p-1.5 bg-white/20 rounded-md shrink-0",children:e.jsx(ve,{className:"w-4 h-4"})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("p",{className:"font-medium text-sm",children:[a("ccsBarBanner.new"),": ",a("ccsBarBanner.title")]}),e.jsxs("p",{className:"text-xs text-white/80 truncate",children:[a("ccsBarBanner.description")," ",e.jsx("code",{className:"bg-white/15 rounded px-1 py-0.5 font-mono text-[11px]",children:"ccs bar install"})]})]})]}),e.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[s&&e.jsx(N,{size:"sm",variant:"secondary",onClick:s,className:"bg-white text-accent hover:bg-white/90 h-8",children:a("ccsBarBanner.install")}),e.jsxs("a",{href:tt,target:"_blank",rel:"noopener noreferrer",className:"text-xs text-white/80 hover:text-white hidden sm:flex items-center gap-1",children:["Learn more",e.jsx(oe,{className:"w-3 h-3"})]}),e.jsxs(N,{size:"icon",variant:"ghost",onClick:i,className:"h-7 w-7 text-white/70 hover:text-white hover:bg-white/20",children:[e.jsx($e,{className:"w-4 h-4"}),e.jsx("span",{className:"sr-only",children:"Dismiss"})]})]})]})})}const nt=typeof navigator<"u"&&/Mac|iPhone|iPad/i.test(navigator.userAgent||navigator.platform||"");function it({onInstallClick:s}){const{t:a}=_();return nt?e.jsx("div",{className:"p-3 border-t bg-gradient-to-r from-accent/5 to-accent/10 dark:from-accent/10 dark:to-accent/15",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"p-1.5 bg-accent/10 dark:bg-accent/20 rounded shrink-0",children:e.jsx(ve,{className:"w-4 h-4 text-accent"})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("p",{className:"text-xs font-medium text-accent dark:text-accent-foreground",children:a("ccsBarPromo.title")}),e.jsx("p",{className:"text-[10px] text-muted-foreground truncate",children:a("ccsBarPromo.description")})]}),e.jsxs(N,{size:"sm",variant:"ghost",onClick:s,className:"h-7 px-2 text-accent hover:text-accent hover:bg-accent/10 dark:hover:bg-accent/20",children:[e.jsx(ve,{className:"w-3 h-3 mr-1"}),e.jsx("span",{className:"text-xs",children:a("ccsBarPromo.install")})]})]})}):null}const ot="https://github.com/kaitranntt/ccs/blob/main/docs/ccs-bar.md";function _e(){window.open(ot,"_blank","noopener,noreferrer")}function bt(){const{t:s}=_(),a=Xe(),{data:r,isLoading:n,isError:i,refetch:p}=js(),f=Ns(),g=vs(),t=bs(),u=ws(),x=Cs(),j=ks(),[P,w]=m.useState(null),[O,k]=m.useState(""),[y,v]=m.useState(!1),[R,b]=m.useState("normal"),[l,h]=m.useState(null),[c,H]=m.useState(!1),[J,q]=m.useState(null),ee=m.useRef(null);ys();const U=m.useMemo(()=>r?.profiles||[],[r?.profiles]),z=m.useMemo(()=>U.filter(o=>o.name.toLowerCase().includes(O.toLowerCase())),[U,O]),S=P?U.find(o=>o.name===P):null,$=o=>{c&&P!==o?q(o):w(o)},se=o=>{f.mutate(o,{onSuccess:()=>{P===o&&(w(null),H(!1),q(null)),h(null)}})},W=o=>{v(!1),$(o)},ce=o=>{$(o)},G=(o,D)=>{const E=JSON.stringify(D,null,2)+`
2
- `,F=new Blob([E],{type:"application/json"}),A=URL.createObjectURL(F),K=document.createElement("a");K.href=A,K.download=o,document.body.appendChild(K),K.click(),K.remove(),URL.revokeObjectURL(A)},de=async()=>{try{const o=await g.mutateAsync();if(o.orphans.length===0){T.success(s("apiProfiles.noOrphansFound"));return}const D=o.orphans.filter(K=>K.validation.valid).length;if(!window.confirm(s("apiProfiles.confirmRegisterOrphans",{total:o.orphans.length,valid:D})))return;const F=await t.mutateAsync({}),A=F.skipped.length>0?s("apiProfiles.registeredWithSkipped",{count:F.skipped.length}):"";T.success(s("apiProfiles.registeredProfiles",{count:F.registered.length})+A)}catch(o){T.error(o.message)}},me=async()=>{if(!S)return;const o=window.prompt(s("apiProfiles.copyPrompt",{name:S.name}),`${S.name}-copy`);if(!o)return;const D=o.trim();if(!D){T.error(s("apiProfiles.destinationEmpty"));return}try{const E=await u.mutateAsync({name:S.name,data:{destination:D}});$(D),E.warnings&&E.warnings.length>0&&T.info(E.warnings.join(`
3
- `))}catch(E){T.error(E.message)}},ue=async()=>{if(S)try{const o=await x.mutateAsync({name:S.name});G(`${S.name}.ccs-profile.json`,o.bundle),o.redacted?T.info(s("apiProfiles.exportRedacted")):T.success(s("apiProfiles.exportDownloaded"))}catch(o){T.error(o.message)}},xe=()=>{ee.current?.click()},he=async o=>{const D=o.target.files?.[0];if(o.target.value="",!!D)try{const E=await D.text(),F=JSON.parse(E),A=await j.mutateAsync({bundle:F});A.name&&$(A.name),A.warnings&&A.warnings.length>0&&T.info(A.warnings.join(`
4
- `))}catch(E){T.error(E.message||s("apiProfiles.importFailed"))}};return e.jsxs("div",{className:"flex h-full min-h-0 flex-col overflow-hidden",children:[e.jsx(Vs,{onCreateClick:()=>v(!0)}),e.jsx(rt,{onInstallClick:()=>_e()}),e.jsxs("div",{className:"flex-1 flex min-h-0 overflow-hidden",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:"mb-3 flex items-start justify-between gap-3",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Ls,{className:"w-5 h-5 text-primary"}),e.jsx("div",{className:"min-w-0",children:e.jsx("h1",{className:"font-semibold",children:s("apiProfiles.sidebarTitle")})})]}),e.jsxs("div",{className:"flex shrink-0 items-center gap-1",children:[e.jsx(N,{size:"sm",variant:"outline",onClick:()=>void de(),disabled:g.isPending||t.isPending,"aria-label":s("apiProfiles.discoverOrphans"),title:s("apiProfiles.discoverOrphans"),children:e.jsx(Z,{className:`w-4 h-4 ${g.isPending?"animate-spin":""}`})}),e.jsx(N,{size:"sm",variant:"outline",onClick:xe,disabled:j.isPending,"aria-label":s("apiProfiles.importProfileBundle"),title:s("apiProfiles.importProfileBundle"),children:e.jsx(Qs,{className:"w-4 h-4"})}),e.jsxs(N,{size:"sm",onClick:()=>{v(!0)},children:[e.jsx(ne,{className:"w-4 h-4 mr-1"}),s("apiProfiles.new")]})]})]}),e.jsx("p",{className:"mb-3 text-xs leading-4 text-muted-foreground",children:s("apiProfiles.sidebarSubtitle")}),e.jsxs("div",{className:"relative",children:[e.jsx(ze,{className:"absolute left-2.5 top-2.5 h-4 w-4 text-muted-foreground"}),e.jsx(B,{placeholder:s("apiProfiles.searchPlaceholder"),className:"pl-8 h-9",value:O,onChange:o=>k(o.target.value)})]})]}),e.jsx(le,{className:"flex-1 min-h-0",children:n?e.jsx("div",{className:"p-4 text-sm text-muted-foreground",children:s("apiProfiles.loadingProfiles")}):i?e.jsx("div",{className:"p-4 text-center",children:e.jsxs("div",{className:"space-y-3 py-8",children:[e.jsx(Ye,{className:"w-12 h-12 mx-auto text-destructive/50"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium",children:s("apiProfiles.failedLoadTitle")}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:s("apiProfiles.failedLoadDesc")})]}),e.jsxs(N,{size:"sm",variant:"outline",onClick:()=>p(),children:[e.jsx(Z,{className:"w-4 h-4 mr-1"}),s("apiProfiles.retry")]})]})}):z.length===0?e.jsx("div",{className:"p-4 text-center",children:U.length===0?e.jsxs("div",{className:"space-y-3 py-8",children:[e.jsx(Fs,{className:"w-12 h-12 mx-auto text-muted-foreground/50"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium",children:s("apiProfiles.noProfilesYet")}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:s("apiProfiles.noProfilesDesc")})]}),e.jsxs(N,{size:"sm",variant:"outline",onClick:()=>{v(!0)},children:[e.jsx(ne,{className:"w-4 h-4 mr-1"}),s("apiProfiles.createProfile")]})]}):e.jsx("p",{className:"text-sm text-muted-foreground py-4",children:s("apiProfiles.noProfileMatch",{query:O})})}):e.jsx("div",{className:"p-2 space-y-1",children:z.map(o=>e.jsx(lt,{profile:o,isSelected:P===o.name,onSelect:()=>ce(o.name),onDelete:()=>h(o.name)},o.name))})}),U.length>0&&e.jsx("div",{className:"p-3 border-t bg-background text-xs text-muted-foreground",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{children:s("apiProfiles.profileCount",{count:U.length})}),e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(We,{className:"w-3 h-3 text-green-600"}),s("apiProfiles.configuredCount",{count:U.filter(o=>o.configured).length})]})]})}),e.jsx(et,{onCreateClick:()=>{b("openrouter"),v(!0)}}),e.jsx(st,{onCreateClick:()=>{b("alibaba-coding-plan"),v(!0)}}),e.jsx(it,{onInstallClick:()=>_e()})]}),e.jsx("div",{className:"flex min-h-0 flex-1 flex-col min-w-0 overflow-hidden",children:S?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"px-4 py-2 border-b bg-background flex items-center justify-end gap-2",children:[e.jsxs(N,{size:"sm",variant:"outline",onClick:()=>void me(),disabled:u.isPending,children:[e.jsx(Is,{className:"w-4 h-4 mr-1"}),"Copy"]}),e.jsxs(N,{size:"sm",variant:"outline",onClick:()=>void ue(),disabled:x.isPending,children:[e.jsx(Hs,{className:"w-4 h-4 mr-1"}),"Export"]})]}),e.jsx(Gs,{profileName:S.name,profileTarget:S.target,onDelete:()=>h(S.name),onHasChangesUpdate:H},S.name)]}):e.jsx(Zs,{hasProfiles:U.length>0,profileCount:U.length,onCliproxyClick:()=>{a("/cliproxy/ai-providers")},onOpenRouterClick:()=>{b("openrouter"),v(!0)},onAlibabaCodingPlanClick:()=>{b("alibaba-coding-plan"),v(!0)},onOllamaClick:()=>{b("ollama"),v(!0)},onLlamacppClick:()=>{b("llamacpp"),v(!0)},onCustomClick:()=>{b("normal"),v(!0)}})})]}),e.jsx("input",{ref:ee,type:"file",accept:".json,application/json",className:"hidden",onChange:o=>void he(o)}),e.jsx(Ss,{open:y,onOpenChange:v,onSuccess:W,initialMode:R}),e.jsx(Ne,{open:!!l,title:s("apiProfiles.deleteProfileTitle"),description:s("apiProfiles.deleteProfileDesc",{name:l??""}),confirmText:s("apiProfiles.delete"),variant:"destructive",onConfirm:()=>l&&se(l),onCancel:()=>h(null)}),e.jsx(Ne,{open:!!J,title:s("apiProfiles.unsavedChangesTitle"),description:s("apiProfiles.unsavedChangesDesc",{current:P??"",next:J??""}),confirmText:s("apiProfiles.discardSwitch"),variant:"destructive",onConfirm:()=>{H(!1),w(J),q(null)},onCancel:()=>q(null)})]})}function lt({profile:s,isSelected:a,onSelect:r,onDelete:n}){return e.jsxs("div",{className:I("group flex items-center gap-2 px-3 py-2.5 rounded-md cursor-pointer transition-colors",a?"bg-primary/10 border border-primary/20":"hover:bg-muted border border-transparent"),onClick:r,children:[s.configured?e.jsx(We,{className:"w-4 h-4 text-green-600 shrink-0"}):e.jsx(Ye,{className:"w-4 h-4 text-yellow-600 shrink-0"}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[e.jsx("div",{className:"font-medium text-sm truncate",children:s.name}),e.jsx(Q,{variant:"outline",className:"text-[10px] h-4 px-1.5 uppercase",children:s.target||"claude"})]}),e.jsxs("div",{className:"flex items-center gap-1.5 min-w-0",children:[e.jsx("div",{className:"text-xs text-muted-foreground truncate flex-1",children:s.settingsPath}),e.jsx(Y,{value:s.settingsPath,size:"icon",className:"h-5 w-5 opacity-0 group-hover:opacity-100 transition-opacity"})]})]}),e.jsx(N,{variant:"ghost",size:"icon",className:"h-7 w-7 opacity-0 group-hover:opacity-100 transition-opacity",onClick:i=>{i.stopPropagation(),n()},children:e.jsx(Be,{className:"w-3.5 h-3.5 text-destructive"})})]})}export{bt as ApiPage};
@@ -1,30 +0,0 @@
1
- import{j as e}from"./radix-ui-nu4wz29m.js";import{r as N}from"./react-vendor-Bjx91N7w.js";import{t as U}from"./notifications-B4_o8bcr.js";import{bf as ne,a as T,B as y,T as ns,o as as,p as os,e as C,q as ls,C as I,s as F,t as K,b as W,aJ as ee,j as E,k as D,l as O,m as L,n as b,I as _,x as we,Y as S,bg as Ae,c as Me,bm as is,bn as Ce,bo as cs,U as ds,V as xs,W as oe,X as le,bh as Se}from"./index-DFYK4jw3.js";import{T as Re,a as Ie,b as ce,c as B,d as Fe,e as V}from"./table-DsXaM2jg.js";import{u as je,a as us,b as _e}from"./tanstack-bhJxV1h8.js";import{L as G,aa as ms,aT as hs,at as de,n as ps,aU as fs,aV as js,aC as gs,w as vs,a7 as bs,aW as ws,aX as Ns,aY as ys,ai as ge,p as Te,$ as Cs,m as Ss,o as _s,_ as Ts,S as ks,aO as ke,aZ as Ps,x as Es,I as Ds,T as Os,N as Ls}from"./icons-gI6odJjU.js";import{T as te}from"./Trans-BkttMZOY.js";import{S as ie}from"./separator-De5-VTtx.js";import{R as As}from"./raw-json-settings-editor-panel-DuL_4ncA.js";import"./utils-CzKF5WmX.js";import"./form-utils-CuHzLhJZ.js";import"./charts-eIPy2oG6.js";async function Ms(){const s=await fetch(ne("/codex/profiles"));if(!s.ok)throw new Error("Failed to fetch Codex auth profiles");return s.json()}function Rs(){return je({queryKey:["codex-auth-profiles"],queryFn:Ms,refetchInterval:15e3})}function re({children:s}){return e.jsx("code",{className:"rounded bg-muted px-1 py-0.5 font-mono text-[0.85em] text-foreground",children:s})}function Is(s){if(!s)return"never";try{const t=new Date(s),r=Date.now()-t.getTime(),a=Math.floor(r/6e4);if(a<2)return"just now";if(a<60)return`${a} min ago`;const o=Math.floor(a/60);if(o<24)return`${o}h ago`;const n=Math.floor(o/24);return n===1?"yesterday":`${n}d ago`}catch{return s}}function Ke(s,t){switch(s){case"default":return t("codex.auth.sourceDefault");case"env":return t("codex.auth.sourceEnv");case"explicit-codex-home":return t("codex.auth.sourceExplicitCodexHome")}}function Pe({label:s}){return e.jsx(ns,{children:e.jsxs(as,{children:[e.jsx(os,{asChild:!0,children:e.jsx("span",{tabIndex:0,className:"inline-block",children:e.jsx(C,{variant:"outline",size:"sm",disabled:!0,className:"pointer-events-none",children:s})})}),e.jsx(ls,{children:e.jsx(te,{i18nKey:"codex.auth.terminalOnlyTooltipRich",components:{code:e.jsx(re,{})}})})]})})}function Fs({entry:s,isActive:t,activeSource:r}){const{t:a}=T();return e.jsxs(ce,{className:t?"bg-muted/40":void 0,children:[e.jsx(V,{className:"font-medium",children:e.jsxs("span",{className:"flex items-center gap-2",children:[s.name,t&&r&&e.jsx(y,{variant:"secondary",className:"text-xs",children:a("codex.auth.activeSourceBadge",{source:Ke(r,a)})})]})}),e.jsx(V,{children:s.email??"—"}),e.jsx(V,{children:s.plan??"—"}),e.jsx(V,{children:Is(s.lastUsed)}),e.jsx(V,{children:s.authValid?e.jsx(y,{variant:"secondary",className:"text-xs text-green-700 dark:text-green-400",children:a("codex.auth.statusOk")}):e.jsx(y,{variant:"destructive",className:"text-xs",children:a("codex.auth.statusInvalid")})}),e.jsx(V,{children:e.jsxs("span",{className:"flex gap-1",children:[e.jsx(Pe,{label:a("codex.auth.switchAction")}),e.jsx(Pe,{label:a("codex.auth.removeAction")})]})})]})}function Ks(){const{t:s}=T(),{data:t,isLoading:r,error:a}=Rs();return r?e.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground p-4",children:[e.jsx(G,{className:"h-4 w-4 animate-spin"}),s("codex.auth.loading")]}):a||!t?e.jsx("div",{className:"rounded-md border border-destructive/40 bg-destructive/10 px-4 py-3 text-sm text-destructive",children:s("codex.auth.loadError")}):t.profiles.length===0?e.jsxs("div",{className:"rounded-md border bg-muted/30 px-4 py-3 text-sm text-muted-foreground space-y-1",children:[e.jsx("p",{children:e.jsx(te,{i18nKey:"codex.auth.emptyRegistryRich",components:{code:e.jsx(re,{})}})}),e.jsx("p",{children:e.jsx(te,{i18nKey:"codex.auth.legacyCodexHomeRich",components:{code:e.jsx(re,{})}})})]}):t.active?t.active.source==="explicit-codex-home"&&t.active.name===null?e.jsxs("div",{className:"space-y-3",children:[e.jsx("div",{className:"rounded-md border bg-muted/30 px-4 py-3 text-sm text-muted-foreground",children:e.jsx(te,{i18nKey:"codex.auth.externalCodexHomeRich",values:{path:t.active.codexHome},components:{code:e.jsx(re,{})}})}),e.jsx(ue,{data:t})]}):e.jsxs("div",{className:"space-y-3",children:[e.jsx(Ws,{name:t.active.name,source:t.active.source,profiles:t.profiles}),e.jsx(ue,{data:t})]}):e.jsxs("div",{className:"space-y-3",children:[e.jsx("div",{className:"rounded-md border bg-muted/30 px-4 py-3 text-sm text-muted-foreground",children:e.jsx(te,{i18nKey:"codex.auth.legacyModeRich",components:{code:e.jsx(re,{})}})}),e.jsx(ue,{data:t})]})}function Ws({name:s,source:t,profiles:r}){const{t:a}=T(),o=r.find(n=>n.name===s);return e.jsxs("div",{className:"rounded-md border bg-muted/20 px-4 py-3 text-sm space-y-1",children:[e.jsxs("div",{className:"flex items-center gap-2 font-medium",children:[a("codex.auth.activeProfile"),e.jsx("span",{children:s??a("codex.auth.unknownProfile")}),e.jsx(y,{variant:"secondary",className:"text-xs",children:Ke(t,a)})]}),o&&e.jsxs("div",{className:"text-muted-foreground text-xs space-x-3",children:[o.email&&e.jsx("span",{children:o.email}),o.plan&&e.jsxs("span",{children:[a("codex.auth.planLabel")," ",e.jsx("strong",{children:o.plan})]}),!o.authValid&&e.jsx("span",{className:"text-destructive",children:a("codex.auth.statusInvalid")})]})]})}function ue({data:s}){const{t}=T();return e.jsx("div",{className:"rounded-md border overflow-auto",children:e.jsxs(Re,{children:[e.jsx(Ie,{children:e.jsxs(ce,{children:[e.jsx(B,{children:t("codex.auth.col.name")}),e.jsx(B,{children:t("codex.auth.col.email")}),e.jsx(B,{children:t("codex.auth.col.plan")}),e.jsx(B,{children:t("codex.auth.col.lastUsed")}),e.jsx(B,{children:t("codex.auth.col.status")}),e.jsx(B,{children:t("codex.auth.col.actions")})]})}),e.jsx(Fe,{children:s.profiles.map(r=>e.jsx(Fs,{entry:r,isActive:s.active?.name===r.name,activeSource:s.active?.name===r.name?s.active.source:void 0},r.name))})]})})}function se({title:s,icon:t,badge:r,description:a,disabledReason:o,children:n}){return e.jsxs(I,{children:[e.jsxs(F,{className:"pb-2",children:[e.jsxs(K,{className:"flex items-center gap-2 text-base",children:[t,s,r?e.jsx(y,{variant:"outline",className:"text-[10px] font-normal",children:r}):null]}),a?e.jsx("p",{className:"text-xs text-muted-foreground",children:a}):null]}),e.jsxs(W,{className:"space-y-3",children:[o?e.jsx("p",{className:"text-xs text-amber-600",children:o}):null,n]})]})}function qs({catalog:s,state:t,disabled:r=!1,disabledReason:a,onToggle:o}){const{t:n}=T(),l=new Set(s.map(i=>i.name)),c=Object.entries(t).filter(([i])=>!l.has(i)).sort(([i],[d])=>i.localeCompare(d));return e.jsxs(se,{title:n("codex.features"),badge:"features",icon:e.jsx(ms,{className:"h-4 w-4"}),description:n("codex.featuresDesc"),disabledReason:a,children:[e.jsx("div",{className:"space-y-2",children:s.map(i=>{const d=t[i.name]??null;return e.jsxs("div",{className:"flex items-center justify-between gap-3 rounded-md border px-3 py-2",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("p",{className:"text-sm font-medium",children:i.label}),e.jsx(y,{variant:"outline",className:"font-mono text-[10px]",children:i.name})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:i.description})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[d!==null?e.jsx(C,{variant:"outline",size:"sm",onClick:()=>o(i.name,null),disabled:r,children:n("codex.useDefault")}):null,e.jsx(ee,{checked:d===!0,onCheckedChange:m=>o(i.name,m),disabled:r})]})]},i.name)})}),c.length>0?e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-xs font-medium uppercase tracking-wide text-muted-foreground",children:n("codex.configOnlyFlags")}),e.jsx("p",{className:"text-xs text-muted-foreground",children:n("codex.configOnlyFlagsDesc")})]}),c.map(([i,d])=>e.jsxs("div",{className:"flex items-center justify-between gap-3 rounded-md border border-dashed px-3 py-2",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("p",{className:"text-sm font-medium",children:i}),e.jsx(y,{variant:"secondary",className:"text-[10px]",children:n("codex.existing")})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:n(d===null?"codex.nonBooleanForm":"codex.discoveredFromFile")})]}),d===null?e.jsx(y,{variant:"outline",children:n("codex.rawOnly")}):e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(C,{variant:"outline",size:"sm",onClick:()=>o(i,null),disabled:r,children:n("codex.useDefault")}),e.jsx(ee,{checked:d===!0,onCheckedChange:m=>o(i,m),disabled:r})]})]},i))]}):null]})}const Us={name:"",transport:"stdio",command:null,args:[],url:null,enabled:!0,required:!1,startupTimeoutSec:null,toolTimeoutSec:null,enabledTools:[],disabledTools:[],isCcsManaged:!1,managementSurface:null};function me(s){return s.join(", ")}function he(s){return s.split(",").map(t=>t.trim()).filter(Boolean)}function Bs({initialDraft:s,isNew:t,disabled:r,saving:a,canDelete:o,onSave:n,onDelete:l}){const{t:c}=T(),[i,d]=N.useState(s),m=t&&i.name.trim()==="ccs_browser";return e.jsxs(e.Fragment,{children:[m?e.jsxs("div",{className:"rounded-md border border-amber-500/30 bg-amber-500/10 px-3 py-2 text-sm text-amber-900 dark:text-amber-200",children:[e.jsx("strong",{children:"ccs_browser"})," is reserved for the CCS-managed browser tooling path. Configure it from ",e.jsx("code",{children:"Settings > Browser"})," instead of creating it here."]}):null,e.jsxs("div",{className:"grid gap-3 sm:grid-cols-2",children:[e.jsx(_,{value:i.name,onChange:h=>d(x=>({...x,name:h.target.value})),placeholder:"playwright",disabled:r||!t}),e.jsxs(E,{value:i.transport,onValueChange:h=>d(x=>({...x,transport:h})),disabled:r,children:[e.jsx(D,{children:e.jsx(O,{})}),e.jsxs(L,{children:[e.jsx(b,{value:"stdio",children:c("codex.stdio")}),e.jsx(b,{value:"streamable-http",children:c("codex.streamableHttp")})]})]}),i.transport==="stdio"?e.jsxs(e.Fragment,{children:[e.jsx(_,{value:i.command??"",onChange:h=>d(x=>({...x,command:h.target.value||null})),placeholder:"npx",disabled:r}),e.jsx(_,{value:me(i.args),onChange:h=>d(x=>({...x,args:he(h.target.value)})),placeholder:"@playwright/mcp@latest, --flag",disabled:r})]}):e.jsx(_,{className:"sm:col-span-2",value:i.url??"",onChange:h=>d(x=>({...x,url:h.target.value||null})),placeholder:"https://example.test/mcp",disabled:r}),e.jsx(_,{type:"number",min:1,value:i.startupTimeoutSec??"",onChange:h=>d(x=>({...x,startupTimeoutSec:h.target.value?Number(h.target.value):null})),placeholder:"Startup timeout (sec)",disabled:r}),e.jsx(_,{type:"number",min:1,value:i.toolTimeoutSec??"",onChange:h=>d(x=>({...x,toolTimeoutSec:h.target.value?Number(h.target.value):null})),placeholder:"Tool timeout (sec)",disabled:r}),e.jsx(_,{value:me(i.enabledTools),onChange:h=>d(x=>({...x,enabledTools:he(h.target.value)})),placeholder:"enabled_tools",disabled:r}),e.jsx(_,{value:me(i.disabledTools),onChange:h=>d(x=>({...x,disabledTools:he(h.target.value)})),placeholder:"disabled_tools",disabled:r})]}),e.jsxs("div",{className:"grid gap-3 sm:grid-cols-2",children:[e.jsxs("label",{className:"flex items-center justify-between rounded-md border px-3 py-2 text-sm",children:["Enabled",e.jsx(ee,{checked:i.enabled,onCheckedChange:h=>d(x=>({...x,enabled:h})),disabled:r})]}),e.jsxs("label",{className:"flex items-center justify-between rounded-md border px-3 py-2 text-sm",children:["Required",e.jsx(ee,{checked:i.required,onCheckedChange:h=>d(x=>({...x,required:h})),disabled:r})]})]}),e.jsxs("div",{className:"flex justify-between gap-2",children:[e.jsxs(C,{variant:"outline",onClick:l,disabled:r||a||!o,children:[e.jsx(de,{className:"mr-2 h-4 w-4"}),"Delete"]}),e.jsxs(C,{onClick:()=>n(i.name,{transport:i.transport,command:i.command,args:i.args,url:i.url,enabled:i.enabled,required:i.required,startupTimeoutSec:i.startupTimeoutSec,toolTimeoutSec:i.toolTimeoutSec,enabledTools:i.enabledTools,disabledTools:i.disabledTools}),disabled:r||a||i.name.trim().length===0||m,children:[a?e.jsx(G,{className:"mr-2 h-4 w-4 animate-spin"}):null,"Save MCP server"]})]})]})}function Vs({entries:s,disabled:t=!1,disabledReason:r,saving:a=!1,onSave:o,onDelete:n}){const{t:l}=T(),[c,i]=N.useState("new"),d=N.useMemo(()=>s.find(g=>g.name===c)??null,[s,c]),m=d??Us,h=JSON.stringify(m),x=d?.isCcsManaged&&d.managementSurface==="browser-settings";return e.jsxs(se,{title:"MCP servers",badge:"mcp_servers",icon:e.jsx(hs,{className:"h-4 w-4"}),description:"Manage the safe MCP transport fields. Keep auth headers and bearer tokens in raw TOML.",disabledReason:r,children:[x?e.jsxs("div",{className:"rounded-md border border-amber-500/30 bg-amber-500/10 px-3 py-2 text-sm text-amber-900 dark:text-amber-200",children:[e.jsx("strong",{children:d?.name})," is CCS-managed. Configure browser tooling from"," ",e.jsx("code",{children:"Settings > Browser"}),"; the generic MCP editor is read-only for this entry."]}):null,e.jsxs(E,{value:c,onValueChange:i,disabled:t,children:[e.jsx(D,{children:e.jsx(O,{placeholder:"Select MCP server"})}),e.jsxs(L,{children:[e.jsx(b,{value:"new",children:l("codex.createNewMcpServer")}),s.map(g=>e.jsx(b,{value:g.name,children:g.isCcsManaged?`${g.name} (CCS managed)`:g.name},g.name))]})]}),e.jsx(Bs,{initialDraft:m,isNew:c==="new",disabled:t||!!x,saving:a,canDelete:d!==null&&!x,onDelete:async()=>{d&&(await n(d.name),i("new"))},onSave:async(g,p)=>{await o(g,p),i(g)}},h)]})}const $s={name:"",displayName:null,baseUrl:null,envKey:null,wireApi:"responses",requiresOpenaiAuth:!1,supportsWebsockets:!1},zs={name:"cliproxy",displayName:"CLIProxy Codex",baseUrl:"http://127.0.0.1:8317/api/provider/codex",envKey:"CLIPROXY_API_KEY",wireApi:"responses",requiresOpenaiAuth:!1,supportsWebsockets:!1};function Gs({initialDraft:s,isNew:t,disabled:r,saving:a,canDelete:o,onSave:n,onDelete:l}){const{t:c}=T(),[i,d]=N.useState(s);return e.jsxs(e.Fragment,{children:[t&&e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2 rounded-md border border-dashed px-3 py-2 text-xs text-muted-foreground",children:[e.jsxs("p",{children:["Quick start: apply the CLIProxy Codex preset here, then set"," ",e.jsx("strong",{children:c("codex.defaultProvider")})," to ",e.jsx("code",{children:"cliproxy"})," in Top-level settings."]}),e.jsx(C,{variant:"outline",size:"sm",onClick:()=>d(zs),disabled:r,children:"Use CLIProxy Codex preset"})]}),e.jsxs("div",{className:"grid gap-3 sm:grid-cols-2",children:[e.jsx(_,{value:i.name,onChange:m=>d(h=>({...h,name:m.target.value})),placeholder:"Provider id",disabled:r||!t}),e.jsx(_,{value:i.displayName??"",onChange:m=>d(h=>({...h,displayName:m.target.value||null})),placeholder:"Display name",disabled:r}),e.jsx(_,{value:i.baseUrl??"",onChange:m=>d(h=>({...h,baseUrl:m.target.value||null})),placeholder:"http://127.0.0.1:8317/api/provider/codex",disabled:r}),e.jsx(_,{value:i.envKey??"",onChange:m=>d(h=>({...h,envKey:m.target.value||null})),placeholder:"CLIPROXY_API_KEY",disabled:r})]}),e.jsxs("div",{className:"grid gap-3 sm:grid-cols-3",children:[e.jsxs(E,{value:i.wireApi??"responses",onValueChange:m=>d(h=>({...h,wireApi:m})),disabled:r,children:[e.jsx(D,{children:e.jsx(O,{})}),e.jsx(L,{children:e.jsx(b,{value:"responses",children:c("codex.responses")})})]}),e.jsxs("label",{className:"flex items-center justify-between rounded-md border px-3 py-2 text-sm",children:["Requires OpenAI auth",e.jsx(ee,{checked:i.requiresOpenaiAuth,onCheckedChange:m=>d(h=>({...h,requiresOpenaiAuth:m})),disabled:r})]}),e.jsxs("label",{className:"flex items-center justify-between rounded-md border px-3 py-2 text-sm",children:["Supports websockets",e.jsx(ee,{checked:i.supportsWebsockets,onCheckedChange:m=>d(h=>({...h,supportsWebsockets:m})),disabled:r})]})]}),e.jsxs("div",{className:"flex justify-between gap-2",children:[e.jsxs(C,{variant:"outline",onClick:l,disabled:r||a||!o,children:[e.jsx(de,{className:"mr-2 h-4 w-4"}),"Delete"]}),e.jsxs(C,{onClick:()=>n(i.name,{displayName:i.displayName,baseUrl:i.baseUrl,envKey:i.envKey,wireApi:i.wireApi,requiresOpenaiAuth:i.requiresOpenaiAuth,supportsWebsockets:i.supportsWebsockets}),disabled:r||a||i.name.trim().length===0,children:[a?e.jsx(G,{className:"mr-2 h-4 w-4 animate-spin"}):null,"Save provider"]})]}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:["If you want plain native ",e.jsx("code",{children:"codex"})," to default to CLIProxy, save a provider named"," ",e.jsx("code",{children:"cliproxy"})," with ",e.jsx("code",{children:"CLIPROXY_API_KEY"})," here, then pick"," ",e.jsx("code",{children:"cliproxy"})," in the ",e.jsx("strong",{children:c("codex.defaultProvider")})," control above."]})]})}function Xs({entries:s,disabled:t=!1,disabledReason:r,saving:a=!1,onSave:o,onDelete:n}){const{t:l}=T(),[c,i]=N.useState("new"),d=N.useMemo(()=>s.find(x=>x.name===c)??null,[s,c]),m=d??$s,h=JSON.stringify(m);return e.jsxs(se,{title:"Model providers",badge:"model_providers",icon:e.jsx(ps,{className:"h-4 w-4"}),description:"Edit the common provider fields CCS can support safely. Keep secret migration and inline bearer tokens in raw TOML.",disabledReason:r,children:[e.jsxs(E,{value:c,onValueChange:i,disabled:t,children:[e.jsx(D,{children:e.jsx(O,{placeholder:"Select provider"})}),e.jsxs(L,{children:[e.jsx(b,{value:"new",children:l("codex.createNewProvider")}),s.map(x=>e.jsx(b,{value:x.name,children:x.name},x.name))]})]}),e.jsx(Gs,{initialDraft:m,isNew:c==="new",disabled:t,saving:a,canDelete:d!==null,onDelete:async()=>{d&&(await n(d.name),i("new"))},onSave:async(x,g)=>{await o(x,g),i(x)}},h)]})}function Hs({initialName:s,initialModel:t,initialProvider:r,initialEffort:a,providerNames:o,activeProfile:n,selectedEntryName:l,disabled:c,saving:i,onSave:d,onDelete:m,onSetActive:h}){const{t:x}=T(),[g,p]=N.useState(s),[w,M]=N.useState(t),[q,u]=N.useState(r),[v,X]=N.useState(a);return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"grid gap-3 sm:grid-cols-2",children:[e.jsx(_,{value:g,onChange:j=>p(j.target.value),placeholder:"deep-review",disabled:c||l!==null}),e.jsx(_,{value:w??"",onChange:j=>M(j.target.value||null),placeholder:"gpt-5.4",disabled:c}),e.jsxs(E,{value:q??"__unset__",onValueChange:j=>u(j==="__unset__"?null:j),disabled:c,children:[e.jsx(D,{children:e.jsx(O,{placeholder:x("codex.useGlobalProvider")})}),e.jsxs(L,{children:[e.jsx(b,{value:"__unset__",children:x("codex.useGlobalProvider")}),o.map(j=>e.jsx(b,{value:j,children:j},j))]})]}),e.jsxs(E,{value:v??"__unset__",onValueChange:j=>X(j==="__unset__"?null:j),disabled:c,children:[e.jsx(D,{children:e.jsx(O,{placeholder:x("codex.useGlobalEffort")})}),e.jsxs(L,{children:[e.jsx(b,{value:"__unset__",children:x("codex.useGlobalEffort")}),["minimal","low","medium","high","xhigh"].map(j=>e.jsx(b,{value:j,children:j},j))]})]})]}),e.jsxs("div",{className:"flex justify-between gap-2",children:[e.jsxs("div",{className:"flex gap-2",children:[e.jsxs(C,{variant:"outline",onClick:m,disabled:c||i||!l,children:[e.jsx(de,{className:"mr-2 h-4 w-4"}),"Delete"]}),e.jsx(C,{variant:"outline",onClick:h,disabled:c||i||!l||l===n,children:"Set active"})]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsxs(C,{variant:"outline",onClick:()=>d(g,{model:w,modelProvider:q,modelReasoningEffort:v},!1),disabled:c||i||g.trim().length===0,children:[i?e.jsx(G,{className:"mr-2 h-4 w-4 animate-spin"}):null,"Save profile"]}),e.jsxs(C,{onClick:()=>d(g,{model:w,modelProvider:q,modelReasoningEffort:v},!0),disabled:c||i||g.trim().length===0,children:[i?e.jsx(G,{className:"mr-2 h-4 w-4 animate-spin"}):null,"Save + activate"]})]})]})]})}function Ys({activeProfile:s,entries:t,providerNames:r,disabled:a=!1,disabledReason:o,saving:n=!1,onSave:l,onDelete:c,onSetActive:i}){const{t:d}=T(),[m,h]=N.useState("new"),x=N.useMemo(()=>t.find(p=>p.name===m)??null,[t,m]),g=JSON.stringify(x??{name:"",values:{}});return e.jsxs(se,{title:d("codex.profiles"),badge:"profiles",icon:e.jsx(fs,{className:"h-4 w-4"}),description:"Create reusable Codex overlays and set the active default profile.",disabledReason:o,children:[e.jsxs(E,{value:m,onValueChange:h,disabled:a,children:[e.jsx(D,{children:e.jsx(O,{placeholder:"Select profile"})}),e.jsxs(L,{children:[e.jsx(b,{value:"new",children:d("codex.createNewProfile")}),t.map(p=>e.jsxs(b,{value:p.name,children:[p.name,p.name===s?" (active)":""]},p.name))]})]}),e.jsx(Hs,{initialName:x?.name??"",initialModel:x?.values.model??null,initialProvider:x?.values.modelProvider??null,initialEffort:x?.values.modelReasoningEffort??null,providerNames:r,activeProfile:s,selectedEntryName:x?.name??null,disabled:a,saving:n,onDelete:async()=>{x&&(await c(x.name),h("new"))},onSetActive:async()=>{x&&await i(x.name)},onSave:async(p,w,M)=>{await l(p,w,M),h(p)}},g)]})}function Qs({workspacePath:s,disabled:t,saving:r,onSave:a}){const{t:o}=T(),[n,l]=N.useState(s),[c,i]=N.useState("trusted");return e.jsxs("div",{className:"grid gap-2 sm:grid-cols-[1fr_160px_auto]",children:[e.jsx(_,{value:n,onChange:d=>l(d.target.value),placeholder:"~/repo or /absolute/path",disabled:t}),e.jsxs(E,{value:c,onValueChange:i,disabled:t,children:[e.jsx(D,{children:e.jsx(O,{})}),e.jsxs(L,{children:[e.jsx(b,{value:"trusted",children:o("codex.trusted")}),e.jsx(b,{value:"untrusted",children:o("codex.untrusted")})]})]}),e.jsxs(C,{onClick:()=>a(n,c),disabled:t||r,children:[r?e.jsx(G,{className:"mr-2 h-4 w-4 animate-spin"}):null,"Save trust"]})]})}function Js({workspacePath:s,entries:t,disabled:r=!1,disabledReason:a,saving:o=!1,onSave:n}){const{t:l}=T();return e.jsxs(se,{title:"Project trust",badge:"projects",icon:e.jsx(js,{className:"h-4 w-4"}),description:"Trust current workspaces or remove stale trust entries without opening raw TOML.",disabledReason:a,children:[e.jsxs("p",{className:"text-xs text-muted-foreground",children:["Paths must be absolute or start with ",e.jsx("code",{children:"~/"}),". Relative paths are rejected so CCS does not trust the wrong folder."]}),e.jsx(Qs,{workspacePath:s,disabled:r,saving:o,onSave:n},s),e.jsx(C,{variant:"outline",className:"w-full justify-start",onClick:()=>n(s,"trusted"),disabled:r||o,children:"Trust current workspace"}),e.jsx("div",{className:"space-y-2",children:t.length===0?e.jsx("p",{className:"text-xs text-muted-foreground",children:l("codex.noProjectTrustEntries")}):t.map(c=>e.jsxs("div",{className:"flex items-center justify-between gap-2 rounded-md border px-3 py-2",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("p",{className:"truncate text-sm font-medium",children:c.path}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:["trust_level = ",c.trustLevel]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(C,{variant:"ghost",size:"sm",onClick:()=>n(c.path,c.trustLevel==="trusted"?"untrusted":"trusted"),disabled:r||o,children:"Toggle"}),e.jsx(C,{variant:"ghost",size:"icon",onClick:()=>n(c.path,null),disabled:r||o,children:e.jsx(de,{className:"h-4 w-4"})})]})]},c.path))})]})}const A="__unset__",Zs=105e4,et=272e3,Ee=8e5,De=7e5,st=new Intl.NumberFormat("en-US");function Y(s){return s??A}function Q(s,t){return t&&!s.includes(t)?[t,...s]:s}function pe(s){return st.format(s)}function tt(s){return s?.trim().toLowerCase().startsWith("gpt-5.4")??!1}function rt(s,t){const r={};return t.model!==s.model&&(r.model=t.model),t.modelReasoningEffort!==s.modelReasoningEffort&&(r.modelReasoningEffort=t.modelReasoningEffort),t.modelContextWindow!==s.modelContextWindow&&(r.modelContextWindow=t.modelContextWindow),t.modelAutoCompactTokenLimit!==s.modelAutoCompactTokenLimit&&(r.modelAutoCompactTokenLimit=t.modelAutoCompactTokenLimit),t.modelProvider!==s.modelProvider&&(r.modelProvider=t.modelProvider),t.approvalPolicy!==s.approvalPolicy&&(r.approvalPolicy=t.approvalPolicy),t.sandboxMode!==s.sandboxMode&&(r.sandboxMode=t.sandboxMode),t.webSearch!==s.webSearch&&(r.webSearch=t.webSearch),t.toolOutputTokenLimit!==s.toolOutputTokenLimit&&(r.toolOutputTokenLimit=t.toolOutputTokenLimit),t.personality!==s.personality&&(r.personality=t.personality),r}function nt({initialValues:s,providerNames:t,disabled:r,saving:a,onSave:o}){const{t:n}=T(),[l,c]=N.useState(s),i=Q(["minimal","low","medium","high","xhigh"],l.modelReasoningEffort),d=Q(t,l.modelProvider),m=Q(["on-request","never","untrusted"],l.approvalPolicy),h=Q(["read-only","workspace-write","danger-full-access"],l.sandboxMode),x=Q(["cached","live","disabled"],l.webSearch),g=Q(["none","friendly","pragmatic"],l.personality),p=rt(s,l),w=Object.keys(p).length>0,M=tt(l.model),q=u=>{const v=u.trim();return v.length>0?Number(v):null};return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"grid gap-3 sm:grid-cols-2",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-xs font-medium",children:n("codex.model")}),e.jsx(_,{value:l.model??"",onChange:u=>c(v=>({...v,model:u.target.value||null})),placeholder:"gpt-5.5",disabled:r})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-xs font-medium",children:n("codex.reasoningEffort")}),e.jsxs(E,{value:Y(l.modelReasoningEffort),onValueChange:u=>c(v=>({...v,modelReasoningEffort:u===A?null:u})),disabled:r,children:[e.jsx(D,{children:e.jsx(O,{placeholder:n("codex.useDefault")})}),e.jsxs(L,{children:[e.jsx(b,{value:A,children:n("codex.useDefault")}),i.map(u=>e.jsx(b,{value:u,children:u},u))]})]})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-xs font-medium",children:n("codex.defaultProvider")}),e.jsxs(E,{value:Y(l.modelProvider),onValueChange:u=>c(v=>({...v,modelProvider:u===A?null:u})),disabled:r,children:[e.jsx(D,{children:e.jsx(O,{placeholder:n("codex.useCodexDefault")})}),e.jsxs(L,{children:[e.jsx(b,{value:A,children:n("codex.useCodexDefault")}),d.map(u=>e.jsx(b,{value:u,children:u},u))]})]})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-xs font-medium",children:n("codex.approvalPolicy")}),e.jsxs(E,{value:Y(l.approvalPolicy),onValueChange:u=>c(v=>({...v,approvalPolicy:u===A?null:u})),disabled:r,children:[e.jsx(D,{children:e.jsx(O,{placeholder:n("codex.useDefault")})}),e.jsxs(L,{children:[e.jsx(b,{value:A,children:n("codex.useDefault")}),m.map(u=>e.jsx(b,{value:u,children:u},u))]})]})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-xs font-medium",children:n("codex.sandboxMode")}),e.jsxs(E,{value:Y(l.sandboxMode),onValueChange:u=>c(v=>({...v,sandboxMode:u===A?null:u})),disabled:r,children:[e.jsx(D,{children:e.jsx(O,{placeholder:n("codex.useDefault")})}),e.jsxs(L,{children:[e.jsx(b,{value:A,children:n("codex.useDefault")}),h.map(u=>e.jsx(b,{value:u,children:u},u))]})]})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-xs font-medium",children:n("codex.webSearch")}),e.jsxs(E,{value:Y(l.webSearch),onValueChange:u=>c(v=>({...v,webSearch:u===A?null:u})),disabled:r,children:[e.jsx(D,{children:e.jsx(O,{placeholder:n("codex.useDefault")})}),e.jsxs(L,{children:[e.jsx(b,{value:A,children:n("codex.useDefault")}),x.map(u=>e.jsx(b,{value:u,children:u},u))]})]})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-xs font-medium",children:n("codex.toolOutputTokenLimit")}),e.jsx(_,{type:"number",min:1,value:l.toolOutputTokenLimit??"",onChange:u=>c(v=>({...v,toolOutputTokenLimit:u.target.value?Number(u.target.value):null})),placeholder:"25000",disabled:r})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-xs font-medium",children:n("codex.personality")}),e.jsxs(E,{value:Y(l.personality),onValueChange:u=>c(v=>({...v,personality:u===A?null:u})),disabled:r,children:[e.jsx(D,{children:e.jsx(O,{placeholder:n("codex.useDefault")})}),e.jsxs(L,{children:[e.jsx(b,{value:A,children:n("codex.useDefault")}),g.map(u=>e.jsx(b,{value:u,children:u},u))]})]})]})]}),e.jsxs("div",{className:"space-y-4 rounded-xl border border-amber-500/30 bg-amber-500/5 p-4 shadow-sm dark:bg-amber-400/5",children:[e.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsx(vs,{className:"h-4 w-4 text-amber-600 dark:text-amber-300"}),e.jsx("p",{className:"text-sm font-semibold",children:n("codex.longContextOverride")}),e.jsx(y,{variant:"outline",className:"border-amber-500/40 bg-background/80 text-[10px] uppercase tracking-[0.16em] text-amber-700 dark:text-amber-300",children:"Manual opt-in only"}),e.jsx(y,{variant:"secondary",className:"text-[10px] uppercase tracking-[0.16em] text-muted-foreground",children:M?"GPT-5.4 long-context selected":"GPT-5.4 long-context reference"})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Draft values only. Nothing applies until Save."})]}),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsx(C,{type:"button",variant:"outline",size:"sm",disabled:r,onClick:()=>c(u=>({...u,modelContextWindow:Ee,modelAutoCompactTokenLimit:De})),children:"Fill cautious pair"}),e.jsx(C,{type:"button",variant:"outline",size:"sm",disabled:r,onClick:()=>c(u=>({...u,modelContextWindow:Zs})),children:"Set official max window"}),e.jsx(C,{type:"button",variant:"ghost",size:"sm",disabled:r,onClick:()=>c(u=>({...u,modelContextWindow:null,modelAutoCompactTokenLimit:null})),children:"Clear"})]})]}),e.jsxs("div",{className:"grid gap-2 sm:grid-cols-3",children:[e.jsxs("div",{className:"rounded-lg border bg-background/85 px-3 py-3 shadow-sm shadow-black/5",children:[e.jsx("p",{className:"text-[10px] font-medium uppercase tracking-wide text-muted-foreground",children:"Official max"}),e.jsx("p",{className:"mt-1 font-mono text-base font-semibold text-foreground",children:"1.05M / 1M"}),e.jsx("p",{className:"mt-1 text-[11px] text-muted-foreground",children:n("codex.gptContextCap")})]}),e.jsxs("div",{className:"rounded-lg border bg-background/85 px-3 py-3 shadow-sm shadow-black/5",children:[e.jsx("p",{className:"text-[10px] font-medium uppercase tracking-wide text-muted-foreground",children:"Standard window"}),e.jsx("p",{className:"mt-1 font-mono text-base font-semibold text-foreground",children:pe(et)}),e.jsx("p",{className:"mt-1 text-[11px] text-muted-foreground",children:n("codex.normalUsageWindow")})]}),e.jsxs("div",{className:"rounded-lg border bg-background/85 px-3 py-3 shadow-sm shadow-black/5",children:[e.jsx("p",{className:"text-[10px] font-medium uppercase tracking-wide text-muted-foreground",children:"Above 272K"}),e.jsx("p",{className:"mt-1 font-mono text-base font-semibold text-foreground",children:n("codex.counts2x")}),e.jsx("p",{className:"mt-1 text-[11px] text-muted-foreground",children:n("codex.usageLimitCost")})]})]}),e.jsxs("div",{className:"space-y-3 rounded-lg border bg-background/75 px-3 py-3",children:[e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsx("p",{className:"text-[10px] font-medium uppercase tracking-wide text-muted-foreground",children:"One cautious pair"}),e.jsxs("div",{className:"rounded-full border bg-background px-2.5 py-1 font-mono text-[11px] font-medium",children:["Context ",pe(Ee)]}),e.jsxs("div",{className:"rounded-full border bg-background px-2.5 py-1 font-mono text-[11px] font-medium",children:["Auto-compact ",pe(De)]})]}),e.jsxs("div",{className:"flex flex-wrap items-center gap-1.5",children:[e.jsx(y,{variant:"outline",className:"border-border/70 bg-background/80 text-[10px] uppercase tracking-[0.14em] text-muted-foreground",children:"Not official"}),e.jsx(y,{variant:"outline",className:"border-border/70 bg-background/80 text-[10px] uppercase tracking-[0.14em] text-muted-foreground",children:"Draft only"})]})]}),e.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-[11px] text-muted-foreground",children:[e.jsx("span",{children:n("codex.quickFillWarning")}),!M&&l.model?e.jsxs("span",{children:[e.jsx("code",{children:l.model})," should be checked separately."]}):null]})]}),e.jsxs("div",{className:"grid gap-3 sm:grid-cols-2",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-xs font-medium",children:n("codex.modelContextWindow")}),e.jsx(_,{"aria-label":n("codex.modelContextWindow"),type:"number",min:1,value:l.modelContextWindow??"",onChange:u=>c(v=>({...v,modelContextWindow:q(u.target.value)})),placeholder:"Unset",disabled:r}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:["Writes ",e.jsx("code",{children:"model_context_window"}),". Leave unset to keep Codex defaults."]})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-xs font-medium",children:n("codex.autoCompactTokenLimit")}),e.jsx(_,{"aria-label":n("codex.autoCompactTokenLimit"),type:"number",min:1,value:l.modelAutoCompactTokenLimit??"",onChange:u=>c(v=>({...v,modelAutoCompactTokenLimit:q(u.target.value)})),placeholder:"Unset",disabled:r}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:["Writes ",e.jsx("code",{children:"model_auto_compact_token_limit"}),". Leave unset to keep model defaults."]})]})]}),e.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-[11px] text-muted-foreground",children:[e.jsx("span",{className:"text-[10px] uppercase tracking-[0.14em]",children:"Docs"}),e.jsx("a",{href:"https://platform.openai.com/docs/models",target:"_blank",rel:"noreferrer",className:"underline underline-offset-2 hover:text-foreground",children:"GPT-5 model guide"}),e.jsx("a",{href:"https://openai.com/index/introducing-gpt-5-5/",target:"_blank",rel:"noreferrer",className:"underline underline-offset-2 hover:text-foreground",children:"Release notes"}),e.jsx("a",{href:"https://developers.openai.com/codex/config-reference",target:"_blank",rel:"noreferrer",className:"underline underline-offset-2 hover:text-foreground",children:"Config reference"})]})]}),e.jsx("div",{className:"flex justify-end",children:e.jsxs(C,{onClick:()=>o(p),disabled:r||a||!w,children:[a?e.jsx(G,{className:"mr-2 h-4 w-4 animate-spin"}):null,"Save top-level settings"]})})]})}function at({values:s,providerNames:t,disabled:r=!1,disabledReason:a,saving:o=!1,onSave:n}){return e.jsx(se,{title:"Top-level controls",badge:"config.toml",icon:e.jsx(gs,{className:"h-4 w-4"}),description:"Structured controls for the stable top-level Codex settings users touch most often. Unsupported upstream shapes stay untouched and should be edited in raw TOML.",disabledReason:a,children:e.jsx(nt,{initialValues:s,providerNames:t,disabled:r,saving:o,onSave:n},JSON.stringify(s))})}function ot({workspacePath:s,activeProfile:t,topLevelSettings:r,projectTrustEntries:a,profileEntries:o,modelProviderEntries:n,mcpServerEntries:l,featureCatalog:c,featureState:i,disabled:d,disabledReason:m,saving:h,onPatch:x}){const{t:g}=T();return e.jsx(we,{className:"h-full",children:e.jsxs("div",{className:"space-y-6 pr-1 pb-6",children:[e.jsxs("div",{className:"group relative overflow-hidden rounded-xl border border-border/80 bg-background/50 p-5 shadow-sm transition-all hover:bg-background hover:shadow-md dark:border-border/60",children:[e.jsx("div",{className:"absolute inset-x-0 -top-px h-px bg-gradient-to-r from-transparent via-foreground/15 to-transparent transition-opacity group-hover:via-foreground/30"}),e.jsxs("div",{className:"flex flex-col gap-6 lg:flex-row lg:items-start lg:justify-between",children:[e.jsxs("div",{className:"flex-1 space-y-4",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"flex h-9 w-9 items-center justify-center rounded-lg border border-primary/20 bg-primary/10 text-primary transition-colors group-hover:border-primary/30",children:e.jsx(bs,{className:"h-4 w-4"})}),e.jsx("div",{children:e.jsx("h2",{className:"text-base font-semibold tracking-tight text-foreground",children:g("codex.controlCenter")})})]}),e.jsxs("ul",{className:"grid gap-3 sm:grid-cols-2 text-sm text-muted-foreground",children:[e.jsxs("li",{className:"flex items-start gap-2.5",children:[e.jsx(ws,{className:"h-4 w-4 shrink-0 text-muted-foreground/60 mt-0.5"}),e.jsxs("span",{className:"leading-relaxed",children:["Writes exclusively to user-layer"," ",e.jsx("code",{className:"text-[11px] bg-muted/70 px-1.5 py-0.5 rounded border border-border/50",children:"config.toml"})]})]}),e.jsxs("li",{className:"flex items-start gap-2.5",children:[e.jsx(Ns,{className:"h-4 w-4 shrink-0 text-muted-foreground/60 mt-0.5"}),e.jsx("span",{className:"leading-relaxed",children:"Does not reflect repo trust layers or CLI overrides"})]})]})]}),e.jsx("div",{className:"shrink-0 lg:w-[280px]",children:e.jsx("div",{className:"relative overflow-hidden rounded-lg border border-amber-500/20 bg-amber-500/5 p-4 transition-colors group-hover:border-amber-500/30 group-hover:bg-amber-500/10 dark:border-amber-400/10 dark:bg-amber-400/5",children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx(ys,{className:"mt-0.5 h-4 w-4 shrink-0 text-amber-600 dark:text-amber-400"}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-[11px] font-bold text-amber-700 dark:text-amber-300 uppercase tracking-wider",children:"Formatting Note"}),e.jsx("p",{className:"text-[13px] leading-relaxed text-amber-800/80 dark:text-amber-200/70",children:"Saves normalize TOML formatting and strip comments. Switch to the raw editor if exact layout matters."})]})]})})})]})]}),e.jsx(at,{values:r,providerNames:n.map(p=>p.name),disabled:d,disabledReason:m,saving:h,onSave:p=>x({kind:"top-level",values:p},g("toasts.codexSaved"))}),e.jsx(Js,{workspacePath:s,entries:a,disabled:d,disabledReason:m,saving:h,onSave:(p,w)=>x({kind:"project-trust",path:p,trustLevel:w},w?"Saved project trust entry.":"Removed project trust entry.")}),e.jsx(Ys,{activeProfile:t,entries:o,providerNames:n.map(p=>p.name),disabled:d,disabledReason:m,saving:h,onSave:(p,w,M)=>x({kind:"profile",action:"upsert",name:p,values:w,setAsActive:M},"Saved profile."),onDelete:p=>x({kind:"profile",action:"delete",name:p},"Deleted profile."),onSetActive:p=>x({kind:"profile",action:"set-active",name:p},"Set active profile.")}),e.jsx(Xs,{entries:n,disabled:d,disabledReason:m,saving:h,onSave:(p,w)=>x({kind:"model-provider",action:"upsert",name:p,values:w},"Saved model provider."),onDelete:p=>x({kind:"model-provider",action:"delete",name:p},"Deleted model provider.")}),e.jsx(Vs,{entries:l,disabled:d,disabledReason:m,saving:h,onSave:(p,w)=>x({kind:"mcp-server",action:"upsert",name:p,values:w},"Saved MCP server."),onDelete:p=>x({kind:"mcp-server",action:"delete",name:p},"Deleted MCP server.")}),e.jsx(qs,{catalog:c,state:i,disabled:d,disabledReason:m,onToggle:(p,w)=>x({kind:"feature",feature:p,enabled:w},"Saved feature toggle.")})]})})}const We=`model_provider = "cliproxy"
2
-
3
- [model_providers.cliproxy]
4
- name = "CLIProxy Codex"
5
- base_url = "http://127.0.0.1:8317/api/provider/codex"
6
- env_key = "CLIPROXY_API_KEY"
7
- wire_api = "responses"
8
- requires_openai_auth = false
9
- supports_websockets = false`,lt=["multi_agent","unified_exec","shell_snapshot","apply_patch_freeform","js_repl","runtime_metrics","prevent_idle_sleep","fast_mode","apps","smart_approvals"];function it(){return[{name:"multi_agent",label:S.t("codex.featureMultiAgentLabel"),description:S.t("codex.featureMultiAgentDesc")},{name:"unified_exec",label:S.t("codex.featureUnifiedExecLabel"),description:S.t("codex.featureUnifiedExecDesc")},{name:"shell_snapshot",label:S.t("codex.featureShellSnapshotLabel"),description:S.t("codex.featureShellSnapshotDesc")},{name:"apply_patch_freeform",label:S.t("codex.featureApplyPatchLabel"),description:S.t("codex.featureApplyPatchDesc")},{name:"js_repl",label:S.t("codex.featureJsReplLabel"),description:S.t("codex.featureJsReplDesc")},{name:"runtime_metrics",label:S.t("codex.featureRuntimeMetricsLabel"),description:S.t("codex.featureRuntimeMetricsDesc")},{name:"prevent_idle_sleep",label:S.t("codex.featurePreventIdleSleepLabel"),description:S.t("codex.featurePreventIdleSleepDesc")},{name:"fast_mode",label:S.t("codex.featureFastModeLabel"),description:S.t("codex.featureFastModeDesc")},{name:"apps",label:S.t("codex.featureAppsLabel"),description:S.t("codex.featureAppsDesc")},{name:"smart_approvals",label:S.t("codex.featureSmartApprovalsLabel"),description:S.t("codex.featureSmartApprovalsDesc")}]}function z(s){return typeof s=="object"&&s!==null&&!Array.isArray(s)?s:null}function P(s){return typeof s=="string"&&s.trim().length>0?s.trim():null}function Z(s){return typeof s=="number"&&Number.isFinite(s)?s:null}function fe(s){return Array.isArray(s)?s.filter(t=>typeof t=="string").map(t=>t.trim()):[]}function qe(s){return{model:P(s?.model),modelReasoningEffort:P(s?.model_reasoning_effort),modelContextWindow:Z(s?.model_context_window),modelAutoCompactTokenLimit:Z(s?.model_auto_compact_token_limit),modelProvider:P(s?.model_provider),approvalPolicy:P(s?.approval_policy),sandboxMode:P(s?.sandbox_mode),webSearch:P(s?.web_search),toolOutputTokenLimit:Z(s?.tool_output_token_limit),personality:P(s?.personality)}}function ct(s){const t=z(s?.projects);return t?Object.entries(t).map(([r,a])=>{const o=P(z(a)?.trust_level);return o?{path:r,trustLevel:o}:null}).filter(r=>r!==null).sort((r,a)=>r.path.localeCompare(a.path)):[]}function dt(s){const t=z(s?.profiles);return t?Object.entries(t).map(([r,a])=>({name:r,values:qe(z(a))})).sort((r,a)=>r.name.localeCompare(a.name)):[]}function xt(s){const t=z(s?.model_providers);return t?Object.entries(t).map(([r,a])=>{const o=z(a);return o?{name:r,displayName:P(o.name),baseUrl:P(o.base_url),envKey:P(o.env_key),wireApi:P(o.wire_api),requiresOpenaiAuth:o.requires_openai_auth===!0,supportsWebsockets:o.supports_websockets===!0}:null}).filter(r=>r!==null).sort((r,a)=>r.name.localeCompare(a.name)):[]}function ut(s){const t=z(s?.mcp_servers);return t?Object.entries(t).map(([r,a])=>{const o=z(a);if(!o)return null;const n=P(o.command)?"stdio":"streamable-http",l=Z(o.startup_timeout_ms);return{name:r,transport:n,command:P(o.command),args:fe(o.args),url:P(o.url),enabled:o.enabled!==!1,required:o.required===!0,startupTimeoutSec:Z(o.startup_timeout_sec)??(l!==null?l/1e3:null),toolTimeoutSec:Z(o.tool_timeout_sec),enabledTools:fe(o.enabled_tools),disabledTools:fe(o.disabled_tools),isCcsManaged:r==="ccs_browser",managementSurface:r==="ccs_browser"?"browser-settings":null}}).filter(r=>r!==null).sort((r,a)=>r.name.localeCompare(a.name)):[]}function mt(s){const t=z(s?.features),r={};for(const a of lt){const o=t?.[a];r[a]=typeof o=="boolean"?o:null}if(t)for(const[a,o]of Object.entries(t))a in r||(r[a]=typeof o=="boolean"?o:null);return r}const ht=[{id:"codex-config-basic",label:"Codex Config Basics",url:"https://developers.openai.com/codex/config-basic",description:"Official user-layer setup, config location, and baseline configuration behavior."},{id:"codex-config-advanced",label:"Codex Config Advanced",url:"https://developers.openai.com/codex/config-advanced",description:"Layering, trust, profiles, and advanced config behavior."},{id:"codex-config-reference",label:"Codex Config Reference",url:"https://developers.openai.com/codex/config-reference",description:"Canonical upstream config surface for providers, MCP, features, and trust."},{id:"codex-releases",label:"Codex GitHub Releases",url:"https://github.com/openai/codex/releases",description:"Track upstream release notes and fast-moving CLI changes."}],pt=[{provider:"openai",label:"OpenAI Responses API",apiFormat:"Responses API",url:"https://platform.openai.com/docs/api-reference/responses"}];function ft(s){const t=/https?:\/\/[^\s)]+/g,r=[];let a=0,o;for(;(o=t.exec(s))!==null;){const[n]=o,l=o.index;l>a&&r.push(s.slice(a,l)),r.push(e.jsx("a",{href:n,target:"_blank",rel:"noreferrer",className:"underline underline-offset-2 hover:text-foreground",children:n},`${n}-${l}`)),a=l+n.length}return a<s.length&&r.push(s.slice(a)),r.length>0?r:[s]}function jt({diagnostics:s}){const{t}=T(),r=s.docsReference??{notes:[],links:[],providerDocs:[],providerValues:[],settingsHierarchy:[]},a=r.links.length>0?r.links:ht,o=r.providerDocs.length>0?r.providerDocs:pt;return e.jsx(we,{className:"h-full",children:e.jsxs("div",{className:"space-y-4 pr-1",children:[e.jsxs(I,{children:[e.jsx(F,{className:"pb-2",children:e.jsxs(K,{className:"flex items-center gap-2 text-base",children:[e.jsx(ge,{className:"h-4 w-4"}),"CCS bridge recipe"]})}),e.jsxs(W,{className:"space-y-3 text-sm text-muted-foreground",children:[e.jsxs("div",{className:"space-y-1.5",children:[e.jsxs("p",{children:[e.jsx("strong",{children:t("codex.builtInLabel")})," ",t("codex.builtInCcsxpDesc")]}),e.jsxs("p",{children:[e.jsx("strong",{children:t("codex.nativeRecipeLabel")})," ",t("codex.nativeRecipeDesc")]}),e.jsxs("p",{children:[e.jsx("strong",{children:t("codex.managedBridgeLabel")})," ",t("codex.managedBridgeDesc")]})]}),e.jsx("pre",{className:"overflow-x-auto rounded-md border bg-muted/20 p-3 text-xs text-foreground",children:We}),e.jsxs("ol",{className:"ml-4 list-decimal space-y-1.5 [&>li]:pl-1",children:[e.jsxs("li",{children:["Save the ",e.jsx("code",{children:"cliproxy"})," provider in your user config."]}),e.jsxs("li",{children:["Set top-level ",e.jsx("code",{children:"model_provider"})," to ",e.jsx("code",{children:"cliproxy"}),"."]}),e.jsxs("li",{children:["Export ",e.jsx("code",{children:"CLIPROXY_API_KEY"})," before launching native Codex."]})]}),e.jsxs("p",{children:["CCS-managed browser tooling belongs to ",e.jsx("code",{children:"Settings > Browser"}),". Do not edit the ",e.jsx("code",{children:"ccs_browser"})," entry from the generic MCP card unless you are intentionally overriding the managed path in raw TOML."]})]})]}),e.jsxs(I,{children:[e.jsx(F,{className:"pb-2",children:e.jsxs(K,{className:"flex items-center gap-2 text-base",children:[e.jsx(ge,{className:"h-4 w-4"}),"Upstream notes"]})}),e.jsxs(W,{className:"space-y-2 text-sm",children:[r.notes.length>0&&e.jsx("ul",{className:"ml-4 list-disc space-y-1.5 text-muted-foreground [&>li]:pl-1",children:r.notes.map((n,l)=>e.jsx("li",{children:ft(n)},`${l}-${n}`))}),e.jsx(ie,{}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"text-xs uppercase tracking-wide text-muted-foreground",children:t("codex.codexDocs")}),e.jsx("div",{className:"space-y-1.5",children:a.map(n=>e.jsxs("a",{href:n.url,target:"_blank",rel:"noreferrer",className:"block rounded-md border px-2.5 py-2 transition-colors hover:bg-muted/50",children:[e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsx("span",{className:"text-xs font-medium",children:n.label}),e.jsx(Te,{className:"h-3.5 w-3.5 text-muted-foreground"})]}),e.jsx("p",{className:"mt-0.5 text-[11px] text-muted-foreground",children:n.description}),e.jsx("p",{className:"mt-1 break-all font-mono text-[11px] text-muted-foreground/90 underline underline-offset-2",children:n.url})]},n.id))})]}),e.jsx(ie,{}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"text-xs uppercase tracking-wide text-muted-foreground",children:"Provider / bridge reference"}),e.jsx("div",{className:"space-y-1.5",children:o.map(n=>e.jsxs("a",{href:n.url,target:"_blank",rel:"noreferrer",className:"block rounded-md border px-2.5 py-2 transition-colors hover:bg-muted/50",children:[e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsx("span",{className:"text-xs font-medium",children:n.label}),e.jsx(Te,{className:"h-3.5 w-3.5 text-muted-foreground"})]}),e.jsxs("p",{className:"mt-0.5 text-[11px] text-muted-foreground",children:["provider: ",n.provider," | format: ",n.apiFormat]}),e.jsx("p",{className:"mt-1 break-all font-mono text-[11px] text-muted-foreground/90 underline underline-offset-2",children:n.url})]},`${n.provider}-${n.url}`))})]}),r.providerValues.length>0&&e.jsxs(e.Fragment,{children:[e.jsx(ie,{}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:["Provider values: ",r.providerValues.join(", ")]})]}),r.settingsHierarchy.length>0&&e.jsxs("p",{className:"text-xs text-muted-foreground",children:["Settings hierarchy: ",r.settingsHierarchy.join(" -> ")]})]})]})]})})}function gt(s,t){let r=s.slice(0,t).split(/\r\n|\n|\r/g);return[r.length,r.pop().length+1]}function vt(s,t,r){let a=s.split(/\r\n|\n|\r/g),o="",n=(Math.log10(t+1)|0)+1;for(let l=t-1;l<=t+1;l++){let c=a[l-1];c&&(o+=l.toString().padEnd(n," "),o+=": ",o+=c,o+=`
10
- `,l===t&&(o+=" ".repeat(n+r+2),o+=`^
11
- `))}return o}class f extends Error{line;column;codeblock;constructor(t,r){const[a,o]=gt(r.toml,r.ptr),n=vt(r.toml,a,o);super(`Invalid TOML document: ${t}
12
-
13
- ${n}`,r),this.line=a,this.column=o,this.codeblock=n}}function bt(s,t){let r=0;for(;s[t-++r]==="\\";);return--r&&r%2}function ve(s,t=0,r=s.length){let a=s.indexOf(`
14
- `,t);return s[a-1]==="\r"&&a--,a<=r?a:-1}function xe(s,t){for(let r=t;r<s.length;r++){let a=s[r];if(a===`
15
- `)return r;if(a==="\r"&&s[r+1]===`
16
- `)return r+1;if(a<" "&&a!==" "||a==="")throw new f("control characters are not allowed in comments",{toml:s,ptr:t})}return s.length}function $(s,t,r,a){let o;for(;;){for(;(o=s[t])===" "||o===" "||!r&&(o===`
17
- `||o==="\r"&&s[t+1]===`
18
- `);)t++;if(a||o!=="#")break;t=xe(s,t)}return t}function wt(s,t,r,a,o=!1){if(!a)return t=ve(s,t),t<0?s.length:t;for(let n=t;n<s.length;n++){let l=s[n];if(l==="#")n=ve(s,n);else{if(l===r)return n+1;if(l===a||o&&(l===`
19
- `||l==="\r"&&s[n+1]===`
20
- `))return n}}throw new f("cannot find end of structure",{toml:s,ptr:t})}function Ue(s,t){let r=s[t],a=r===s[t+1]&&s[t+1]===s[t+2]?s.slice(t,t+3):r;t+=a.length-1;do t=s.indexOf(a,++t);while(t>-1&&r!=="'"&&bt(s,t));return t>-1&&(t+=a.length,a.length>1&&(s[t]===r&&t++,s[t]===r&&t++)),t}let Nt=/^(\d{4}-\d{2}-\d{2})?[T ]?(?:(\d{2}):\d{2}(?::\d{2}(?:\.\d+)?)?)?(Z|[-+]\d{2}:\d{2})?$/i;class J extends Date{#s=!1;#t=!1;#e=null;constructor(t){let r=!0,a=!0,o="Z";if(typeof t=="string"){let n=t.match(Nt);n?(n[1]||(r=!1,t=`0000-01-01T${t}`),a=!!n[2],a&&t[10]===" "&&(t=t.replace(" ","T")),n[2]&&+n[2]>23?t="":(o=n[3]||null,t=t.toUpperCase(),!o&&a&&(t+="Z"))):t=""}super(t),isNaN(this.getTime())||(this.#s=r,this.#t=a,this.#e=o)}isDateTime(){return this.#s&&this.#t}isLocal(){return!this.#s||!this.#t||!this.#e}isDate(){return this.#s&&!this.#t}isTime(){return this.#t&&!this.#s}isValid(){return this.#s||this.#t}toISOString(){let t=super.toISOString();if(this.isDate())return t.slice(0,10);if(this.isTime())return t.slice(11,23);if(this.#e===null)return t.slice(0,-1);if(this.#e==="Z")return t;let r=+this.#e.slice(1,3)*60+ +this.#e.slice(4,6);return r=this.#e[0]==="-"?r:-r,new Date(this.getTime()-r*6e4).toISOString().slice(0,-1)+this.#e}static wrapAsOffsetDateTime(t,r="Z"){let a=new J(t);return a.#e=r,a}static wrapAsLocalDateTime(t){let r=new J(t);return r.#e=null,r}static wrapAsLocalDate(t){let r=new J(t);return r.#t=!1,r.#e=null,r}static wrapAsLocalTime(t){let r=new J(t);return r.#s=!1,r.#e=null,r}}let yt=/^((0x[0-9a-fA-F](_?[0-9a-fA-F])*)|(([+-]|0[ob])?\d(_?\d)*))$/,Ct=/^[+-]?\d(_?\d)*(\.\d(_?\d)*)?([eE][+-]?\d(_?\d)*)?$/,St=/^[+-]?0[0-9_]/,_t=/^[0-9a-f]{2,8}$/i,Oe={b:"\b",t:" ",n:`
21
- `,f:"\f",r:"\r",e:"\x1B",'"':'"',"\\":"\\"};function Be(s,t=0,r=s.length){let a=s[t]==="'",o=s[t++]===s[t]&&s[t]===s[t+1];o&&(r-=2,s[t+=2]==="\r"&&t++,s[t]===`
22
- `&&t++);let n=0,l,c="",i=t;for(;t<r-1;){let d=s[t++];if(d===`
23
- `||d==="\r"&&s[t]===`
24
- `){if(!o)throw new f("newlines are not allowed in strings",{toml:s,ptr:t-1})}else if(d<" "&&d!==" "||d==="")throw new f("control characters are not allowed in strings",{toml:s,ptr:t-1});if(l){if(l=!1,d==="x"||d==="u"||d==="U"){let m=s.slice(t,t+=d==="x"?2:d==="u"?4:8);if(!_t.test(m))throw new f("invalid unicode escape",{toml:s,ptr:n});try{c+=String.fromCodePoint(parseInt(m,16))}catch{throw new f("invalid unicode escape",{toml:s,ptr:n})}}else if(o&&(d===`
25
- `||d===" "||d===" "||d==="\r")){if(t=$(s,t-1,!0),s[t]!==`
26
- `&&s[t]!=="\r")throw new f("invalid escape: only line-ending whitespace may be escaped",{toml:s,ptr:n});t=$(s,t)}else if(d in Oe)c+=Oe[d];else throw new f("unrecognized escape sequence",{toml:s,ptr:n});i=t}else!a&&d==="\\"&&(n=t-1,l=!0,c+=s.slice(i,n))}return c+s.slice(i,r-1)}function Tt(s,t,r,a){if(s==="true")return!0;if(s==="false")return!1;if(s==="-inf")return-1/0;if(s==="inf"||s==="+inf")return 1/0;if(s==="nan"||s==="+nan"||s==="-nan")return NaN;if(s==="-0")return a?0n:0;let o=yt.test(s);if(o||Ct.test(s)){if(St.test(s))throw new f("leading zeroes are not allowed",{toml:t,ptr:r});s=s.replace(/_/g,"");let l=+s;if(isNaN(l))throw new f("invalid number",{toml:t,ptr:r});if(o){if((o=!Number.isSafeInteger(l))&&!a)throw new f("integer value cannot be represented losslessly",{toml:t,ptr:r});(o||a===!0)&&(l=BigInt(s))}return l}const n=new J(s);if(!n.isValid())throw new f("invalid value",{toml:t,ptr:r});return n}function kt(s,t,r){let a=s.slice(t,r),o=a.indexOf("#");return o>-1&&(xe(s,o),a=a.slice(0,o)),[a.trimEnd(),o]}function Ne(s,t,r,a,o){if(a===0)throw new f("document contains excessively nested structures. aborting.",{toml:s,ptr:t});let n=s[t];if(n==="["||n==="{"){let[i,d]=n==="["?Dt(s,t,a,o):Et(s,t,a,o);if(r){if(d=$(s,d),s[d]===",")d++;else if(s[d]!==r)throw new f("expected comma or end of structure",{toml:s,ptr:d})}return[i,d]}let l;if(n==='"'||n==="'"){l=Ue(s,t);let i=Be(s,t,l);if(r){if(l=$(s,l),s[l]&&s[l]!==","&&s[l]!==r&&s[l]!==`
27
- `&&s[l]!=="\r")throw new f("unexpected character encountered",{toml:s,ptr:l});l+=+(s[l]===",")}return[i,l]}l=wt(s,t,",",r);let c=kt(s,t,l-+(s[l-1]===","));if(!c[0])throw new f("incomplete key-value declaration: no value specified",{toml:s,ptr:t});return r&&c[1]>-1&&(l=$(s,t+c[1]),l+=+(s[l]===",")),[Tt(c[0],s,t,o),l]}let Pt=/^[a-zA-Z0-9-_]+[ \t]*$/;function be(s,t,r="="){let a=t-1,o=[],n=s.indexOf(r,t);if(n<0)throw new f("incomplete key-value: cannot find end of key",{toml:s,ptr:t});do{let l=s[t=++a];if(l!==" "&&l!==" ")if(l==='"'||l==="'"){if(l===s[t+1]&&l===s[t+2])throw new f("multiline strings are not allowed in keys",{toml:s,ptr:t});let c=Ue(s,t);if(c<0)throw new f("unfinished string encountered",{toml:s,ptr:t});a=s.indexOf(".",c);let i=s.slice(c,a<0||a>n?n:a),d=ve(i);if(d>-1)throw new f("newlines are not allowed in keys",{toml:s,ptr:t+a+d});if(i.trimStart())throw new f("found extra tokens after the string part",{toml:s,ptr:c});if(n<c&&(n=s.indexOf(r,c),n<0))throw new f("incomplete key-value: cannot find end of key",{toml:s,ptr:t});o.push(Be(s,t,c))}else{a=s.indexOf(".",t);let c=s.slice(t,a<0||a>n?n:a);if(!Pt.test(c))throw new f("only letter, numbers, dashes and underscores are allowed in keys",{toml:s,ptr:t});o.push(c.trimEnd())}}while(a+1&&a<n);return[o,$(s,n+1,!0,!0)]}function Et(s,t,r,a){let o={},n=new Set,l;for(t++;(l=s[t++])!=="}"&&l;){if(l===",")throw new f("expected value, found comma",{toml:s,ptr:t-1});if(l==="#")t=xe(s,t);else if(l!==" "&&l!==" "&&l!==`
28
- `&&l!=="\r"){let c,i=o,d=!1,[m,h]=be(s,t-1);for(let p=0;p<m.length;p++){if(p&&(i=d?i[c]:i[c]={}),c=m[p],(d=Object.hasOwn(i,c))&&(typeof i[c]!="object"||n.has(i[c])))throw new f("trying to redefine an already defined value",{toml:s,ptr:t});!d&&c==="__proto__"&&Object.defineProperty(i,c,{enumerable:!0,configurable:!0,writable:!0})}if(d)throw new f("trying to redefine an already defined value",{toml:s,ptr:t});let[x,g]=Ne(s,h,"}",r-1,a);n.add(x),i[c]=x,t=g}}if(!l)throw new f("unfinished table encountered",{toml:s,ptr:t});return[o,t]}function Dt(s,t,r,a){let o=[],n;for(t++;(n=s[t++])!=="]"&&n;){if(n===",")throw new f("expected value, found comma",{toml:s,ptr:t-1});if(n==="#")t=xe(s,t);else if(n!==" "&&n!==" "&&n!==`
29
- `&&n!=="\r"){let l=Ne(s,t-1,"]",r-1,a);o.push(l[0]),t=l[1]}}if(!n)throw new f("unfinished array encountered",{toml:s,ptr:t});return[o,t]}function Le(s,t,r,a){let o=t,n=r,l,c=!1,i;for(let d=0;d<s.length;d++){if(d){if(o=c?o[l]:o[l]={},n=(i=n[l]).c,a===0&&(i.t===1||i.t===2))return null;if(i.t===2){let m=o.length-1;o=o[m],n=n[m].c}}if(l=s[d],(c=Object.hasOwn(o,l))&&n[l]?.t===0&&n[l]?.d)return null;c||(l==="__proto__"&&(Object.defineProperty(o,l,{enumerable:!0,configurable:!0,writable:!0}),Object.defineProperty(n,l,{enumerable:!0,configurable:!0,writable:!0})),n[l]={t:d<s.length-1&&a===2?3:a,d:!1,i:0,c:{}})}if(i=n[l],i.t!==a&&!(a===1&&i.t===3)||(a===2&&(i.d||(i.d=!0,o[l]=[]),o[l].push(o={}),i.c[i.i++]=i={t:1,d:!1,i:0,c:{}}),i.d))return null;if(i.d=!0,a===1)o=c?o[l]:o[l]={};else if(a===0&&c)return null;return[l,o,i.c]}function Ot(s,{maxDepth:t=1e3,integersAsBigInt:r}={}){let a={},o={},n=a,l=o;for(let c=$(s,0);c<s.length;){if(s[c]==="["){let i=s[++c]==="[",d=be(s,c+=+i,"]");if(i){if(s[d[1]-1]!=="]")throw new f("expected end of table declaration",{toml:s,ptr:d[1]-1});d[1]++}let m=Le(d[0],a,o,i?2:1);if(!m)throw new f("trying to redefine an already defined table or value",{toml:s,ptr:c});l=m[2],n=m[1],c=d[1]}else{let i=be(s,c),d=Le(i[0],n,l,0);if(!d)throw new f("trying to redefine an already defined table or value",{toml:s,ptr:c});let m=Ne(s,i[1],void 0,t,r);d[1][d[0]]=m[0],c=m[1]}if(c=$(s,c,!0),s[c]&&s[c]!==`
30
- `&&s[c]!=="\r")throw new f("each key-value declaration must be followed by an end-of-line",{toml:s,ptr:c});c=$(s,c)}return a}function Lt(s){return typeof s=="object"&&s!==null&&!Array.isArray(s)}function At(s){return s.charCodeAt(0)===65279?s.slice(1):s}function Mt(s){const t=At(s);if(!t.trim())return{};const a=Ot(t);if(!Lt(a))throw new Error("TOML root must be a table.");return a}function Ve(s){try{return{config:Mt(s),parseError:null}}catch(t){return{config:null,parseError:t.message}}}async function Rt(){const s=await fetch(ne("/codex/diagnostics"));if(!s.ok)throw new Error("Failed to fetch Codex diagnostics");return s.json()}async function It(){const s=await fetch(ne("/codex/config/raw"));if(!s.ok)throw new Error("Failed to fetch Codex raw config");return s.json()}async function Ft(s){const t=await fetch(ne("/codex/config/raw"),{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(s)});if(t.status===409)throw new Ae("Codex raw config changed externally");if(!t.ok){const r=await t.json().catch(()=>null);throw new Error(r?.error||"Failed to save Codex raw config")}return t.json()}async function Kt(s){const t=await fetch(ne("/codex/config/patch"),{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(s)});if(t.status===409)throw new Ae("Codex config changed externally");if(!t.ok){const r=await t.json().catch(()=>null);throw new Error(r?.error||"Failed to patch Codex config")}return t.json()}function Wt(){const s=us(),t=je({queryKey:["codex-diagnostics"],queryFn:Rt,refetchInterval:1e4}),r=je({queryKey:["codex-raw-config"],queryFn:It}),a=_e({mutationFn:Ft,onSuccess:(n,l)=>{s.setQueryData(["codex-raw-config"],c=>{const i=c?.path??"$CODEX_HOME/config.toml",d=c?.resolvedPath??i,m=Ve(l.rawText);return{path:i,resolvedPath:d,exists:!0,mtime:n.mtime,rawText:l.rawText,config:m.config,parseError:m.parseError,readError:null}}),s.invalidateQueries({queryKey:["codex-diagnostics"]})}}),o=_e({mutationFn:Kt,onSuccess:n=>{s.setQueryData(["codex-raw-config"],n),s.invalidateQueries({queryKey:["codex-diagnostics"]})}});return N.useMemo(()=>({diagnostics:t.data,diagnosticsLoading:t.isLoading,diagnosticsError:t.error,refetchDiagnostics:t.refetch,rawConfig:r.data,rawConfigLoading:r.isLoading,rawConfigError:r.error,refetchRawConfig:r.refetch,saveRawConfig:a.mutate,saveRawConfigAsync:a.mutateAsync,isSavingRawConfig:a.isPending,patchConfig:o.mutate,patchConfigAsync:o.mutateAsync,isPatchingConfig:o.isPending}),[t.data,t.isLoading,t.error,t.refetch,r.data,r.isLoading,r.error,r.refetch,a.mutate,a.mutateAsync,a.isPending,o.mutate,o.mutateAsync,o.isPending])}const qt=[{label:"Start Default",command:"ccs",description:"Launch Claude with default profile"},{label:"GLM Profile",command:"ccs glm",description:"Switch to GLM model"},{label:"Health Check",command:"ccs doctor",description:"Run system diagnostics"},{label:"Delegate Task",command:'ccs glm -p "your task"',description:"Delegate to GLM profile"}];function Ut({snippets:s=qt}){const[t,r]=N.useState(null),{t:a}=T(),o=async(n,l)=>{await navigator.clipboard.writeText(n),r(l),setTimeout(()=>r(null),2e3)};return e.jsxs(I,{children:[e.jsx(F,{className:"pb-3",children:e.jsxs(K,{className:"text-lg flex items-center gap-2",children:[e.jsx(Cs,{className:"w-5 h-5 text-muted-foreground"}),a("quickCommands.title")]})}),e.jsx(W,{children:e.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-2",children:s.map((n,l)=>e.jsxs("div",{className:Me("group flex items-center justify-between gap-2 px-3 py-2","rounded-lg border bg-muted/30 hover:bg-muted/50 transition-colors"),children:[e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("p",{className:"text-xs text-muted-foreground",children:n.label}),e.jsx("code",{className:"text-sm font-mono font-medium truncate block",children:n.command})]}),e.jsx(C,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0 opacity-0 group-hover:opacity-100 transition-opacity",onClick:()=>o(n.command,l),title:n.description,children:t===l?e.jsx(Ss,{className:"h-4 w-4 text-green-600"}):e.jsx(_s,{className:"h-4 w-4"})})]},l))})})]})}function Bt(s){return!s||!Number.isFinite(s)?"N/A":new Date(s).toLocaleString()}function Vt(s){return!s||s<=0?"0 B":s<1024?`${s} B`:s<1024*1024?`${(s/1024).toFixed(1)} KB`:`${(s/(1024*1024)).toFixed(2)} MB`}function k({label:s,value:t,mono:r=!1}){return e.jsxs("div",{className:"flex items-start justify-between gap-3 text-sm",children:[e.jsx("span",{className:"text-muted-foreground shrink-0",children:s}),e.jsx("span",{className:Me("text-right break-all",r&&"font-mono text-xs"),children:t})]})}function $t({diagnostics:s}){const{t}=T(),r=s.config.activeProfile?`codex --profile ${s.config.activeProfile}`:"codex",a=s.binary.supportsConfigOverrides;return e.jsx(we,{className:"h-full",children:e.jsxs("div",{className:"space-y-4 pr-1",children:[e.jsxs(I,{children:[e.jsx(F,{className:"pb-2",children:e.jsxs(K,{className:"flex items-center gap-2 text-base",children:[e.jsx(Ts,{className:"h-4 w-4"}),t("codex.howCodexWorks")]})}),e.jsx(W,{className:"text-sm text-muted-foreground",children:e.jsxs("ul",{className:"ml-4 list-disc space-y-1.5 [&>li]:pl-1",children:[e.jsx("li",{children:t("codex.nativeDesc")}),e.jsxs("li",{children:[e.jsx("strong",{children:t("codex.nativeConfigLabel")})," ",t("codex.nativeConfigDesc")]}),e.jsxs("li",{children:[e.jsx("strong",{children:t("codex.transientOverridesLabel")})," ",t("codex.transientOverridesDesc")]}),e.jsxs("li",{children:[e.jsx("strong",{children:t("codex.cliproxyDefaultLabel")})," ",t("codex.cliproxyDefaultDesc")]}),e.jsx("li",{children:t("codex.apiProfilesDefault")})]})})]}),e.jsxs(I,{children:[e.jsx(F,{className:"pb-2",children:e.jsxs(K,{className:"flex items-center gap-2 text-base",children:[e.jsx(ks,{className:"h-4 w-4"}),t("codex.runtimeInstall")]})}),e.jsxs(W,{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"text-sm text-muted-foreground",children:t("codex.status")}),e.jsx(y,{variant:s.binary.installed?"default":"secondary",children:s.binary.installed?t("codex.detected"):t("codex.notFound")})]}),e.jsx(k,{label:t("codex.detectionSource"),value:s.binary.source,mono:!0}),e.jsx(k,{label:t("codex.binaryPath"),value:s.binary.path||t("codex.notFound"),mono:!0}),e.jsx(k,{label:t("codex.installDirectory"),value:s.binary.installDir||"N/A",mono:!0}),e.jsx(k,{label:t("codex.versionLabel"),value:s.binary.version||"Unknown",mono:!0}),e.jsx(k,{label:t("codex.nativeAliases"),value:"ccs-codex, ccsx",mono:!0}),e.jsx(k,{label:t("codex.ccsProviderShortcut"),value:"ccsxp",mono:!0}),e.jsxs("div",{className:"flex items-center justify-between rounded-md border px-3 py-2",children:[e.jsx("span",{className:"text-sm text-muted-foreground",children:t("codex.configOverrideSupport")}),e.jsx(y,{variant:s.binary.supportsConfigOverrides?"default":"secondary",children:s.binary.supportsConfigOverrides?t("codex.available"):t("codex.missing")})]})]})]}),e.jsxs(I,{children:[e.jsx(F,{className:"pb-2",children:e.jsxs(K,{className:"flex items-center gap-2 text-base",children:[e.jsx(ke,{className:"h-4 w-4"}),t("codex.cliproxyNativeCodex")]})}),e.jsx(W,{className:"space-y-3 text-sm text-muted-foreground",children:a?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"space-y-1.5",children:[e.jsx("p",{children:e.jsx("strong",{children:t("codex.twoSupportedPaths")})}),e.jsxs("ul",{className:"ml-4 list-disc space-y-1 [&>li]:pl-1",children:[e.jsxs("li",{children:[e.jsx("strong",{children:t("codex.builtInLabel")})," ",t("codex.builtInCcsxpDesc")]}),e.jsxs("li",{children:[e.jsx("strong",{children:t("codex.nativeRecipeLabel")})," ",t("codex.nativeRecipeDesc")]})]})]}),e.jsxs("div",{className:"rounded-md border bg-muted/20 p-3",children:[e.jsx("p",{className:"font-medium text-foreground",children:t("codex.codexNativeRecipe")}),e.jsx("pre",{className:"mt-2 overflow-x-auto rounded-md bg-background p-3 text-xs text-foreground",children:We})]}),e.jsxs("ol",{className:"ml-4 list-decimal space-y-1.5 [&>li]:pl-1",children:[e.jsx("li",{children:t("codex.saveProviderNamedCliproxy")}),e.jsx("li",{children:t("codex.inTopLevelSetDefault")}),e.jsx("li",{children:t("codex.exportCliproxyApiKey")})]})]}):e.jsx("p",{children:t("codex.noConfigOverrides")})})]}),e.jsxs(I,{children:[e.jsx(F,{className:"pb-2",children:e.jsxs(K,{className:"flex items-center gap-2 text-base",children:[e.jsx(Ps,{className:"h-4 w-4"}),t("codex.configFile")]})}),e.jsx(W,{className:"space-y-3",children:e.jsxs("div",{className:"rounded-md border p-3 space-y-1.5",children:[e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsx("span",{className:"font-medium text-sm",children:t("codex.userConfig")}),s.file.exists?e.jsx(Es,{className:"h-4 w-4 text-green-600"}):e.jsx(Ds,{className:"h-4 w-4 text-muted-foreground"})]}),e.jsx(k,{label:t("codex.path"),value:s.file.path,mono:!0}),e.jsx(k,{label:t("codex.resolved"),value:s.file.resolvedPath,mono:!0}),e.jsx(k,{label:t("codex.size"),value:Vt(s.file.sizeBytes)}),e.jsx(k,{label:t("codex.lastModified"),value:Bt(s.file.mtimeMs)}),s.file.parseError&&e.jsxs("p",{className:"text-xs text-amber-600",children:[t("codex.tomlWarning"),": ",s.file.parseError]}),s.file.readError&&e.jsxs("p",{className:"text-xs text-destructive",children:[t("codex.readWarning"),": ",s.file.readError]})]})})]}),e.jsxs(I,{children:[e.jsx(F,{className:"pb-2",children:e.jsxs(K,{className:"flex items-center gap-2 text-base",children:[e.jsx(ge,{className:"h-4 w-4"}),t("codex.currentUserLayerSummary")]})}),e.jsxs(W,{className:"space-y-3",children:[e.jsx(k,{label:t("codex.model"),value:s.config.model||t("codex.notSet"),mono:!0}),e.jsx(k,{label:t("codex.defaultProvider"),value:s.config.modelProvider||t("codex.notSet"),mono:!0}),e.jsx(k,{label:t("codex.activeProfile"),value:s.config.activeProfile||t("codex.notSet"),mono:!0}),e.jsx(k,{label:t("codex.approvalPolicy"),value:s.config.approvalPolicy||t("codex.notSet"),mono:!0}),e.jsx(k,{label:t("codex.sandboxMode"),value:s.config.sandboxMode||t("codex.notSet"),mono:!0}),e.jsx(k,{label:t("codex.webSearch"),value:s.config.webSearch||t("codex.notSet"),mono:!0}),e.jsx(ie,{}),e.jsxs("div",{className:"grid grid-cols-2 gap-2 text-xs",children:[e.jsx(y,{variant:"outline",className:"justify-center",children:t("codex.providersCount",{count:s.config.modelProviderCount})}),e.jsx(y,{variant:"outline",className:"justify-center",children:t("codex.profilesCount",{count:s.config.profileCount})}),e.jsx(y,{variant:"outline",className:"justify-center",children:t("codex.enabledFeaturesCount",{count:s.config.enabledFeatures.length})}),e.jsx(y,{variant:"outline",className:"justify-center",children:t("codex.mcpServersCount",{count:s.config.mcpServerCount})})]}),s.config.topLevelKeys.length>0&&e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"text-xs uppercase tracking-wide text-muted-foreground",children:t("codex.userLayerKeysPresent")}),e.jsx("div",{className:"flex flex-wrap gap-1.5",children:s.config.topLevelKeys.map(o=>e.jsx(y,{variant:"secondary",className:"font-mono text-[10px]",children:o},o))})]})]})]}),e.jsx(Ut,{snippets:[{label:t("codex.nativeShortAlias"),command:"ccsx",description:"Launch the short native Codex runtime alias."},{label:t("codex.ccsCodexShortcut"),command:'ccsxp "your prompt"',description:a?t("codex.runBuiltInCodex"):"Requires a Codex build that exposes --config overrides."},{label:t("codex.explicitProviderRoute"),command:'ccs codex --target codex "your prompt"',description:a?t("codex.runBuiltInCodexExplicit"):"Requires a Codex build that exposes --config overrides."},{label:s.config.activeProfile?"Inspect active profile":t("codex.openNativeCodex"),command:r,description:s.config.activeProfile?"Inspect the active named profile directly in native Codex.":"Open native Codex without forcing a named profile overlay."}]}),e.jsxs(I,{children:[e.jsx(F,{className:"pb-2",children:e.jsxs(K,{className:"flex items-center gap-2 text-base",children:[e.jsx(ke,{className:"h-4 w-4"}),t("codex.runtimeVsProvider")]})}),e.jsxs(W,{className:"grid gap-3 md:grid-cols-2",children:[e.jsxs("div",{className:"flex flex-col rounded-md border p-3 text-sm",children:[e.jsx("p",{className:"font-medium text-foreground",children:t("codex.nativeCodexRuntime")}),e.jsxs("ul",{className:"mt-2 flex-grow list-disc space-y-1.5 pl-4 text-muted-foreground [&>li]:pl-1",children:[e.jsx("li",{children:e.jsx("code",{children:"ccs-codex"})}),e.jsx("li",{children:e.jsx("code",{children:"ccsx"})}),e.jsx("li",{children:e.jsx("code",{children:"--target codex"})})]}),e.jsx(y,{variant:"secondary",className:"mt-4 w-fit justify-center font-normal",children:t("codex.honorsSavedNativeConfig")})]}),e.jsxs("div",{className:"flex flex-col rounded-md border p-3 text-sm",children:[e.jsx("p",{className:"font-medium text-foreground",children:t("codex.ccsCodexProvider")}),a?e.jsxs(e.Fragment,{children:[e.jsxs("ul",{className:"mt-2 flex-grow list-disc space-y-1.5 pl-4 text-muted-foreground [&>li]:pl-1",children:[e.jsx("li",{children:e.jsx("code",{children:"ccsxp"})}),e.jsx("li",{children:e.jsx("code",{children:"ccs codex --target codex"})})]}),e.jsx("p",{className:"mt-4 text-muted-foreground",children:t("codex.transientOverridesDesc")})]}):e.jsx("p",{className:"mt-2 text-muted-foreground",children:t("codex.unavailableNoConfig")})]})]})]}),e.jsxs(I,{children:[e.jsx(F,{className:"pb-2",children:e.jsx(K,{className:"text-base",children:t("codex.supportedFlows")})}),e.jsx(W,{children:e.jsxs(Re,{children:[e.jsx(Ie,{children:e.jsxs(ce,{children:[e.jsx(B,{children:t("codex.flow")}),e.jsx(B,{children:t("codex.status")}),e.jsx(B,{children:t("codex.notes")})]})}),e.jsx(Fe,{children:s.supportMatrix.map(o=>e.jsxs(ce,{children:[e.jsx(V,{className:"font-mono text-xs",children:o.label}),e.jsx(V,{children:e.jsx(y,{variant:o.supported?"default":"secondary",children:o.supported?t("codex.yes"):t("codex.no")})}),e.jsx(V,{className:"text-xs text-muted-foreground",children:o.notes})]},o.id))})]})})]}),s.warnings.length>0&&e.jsxs(I,{className:"border-amber-200 bg-amber-50/50 dark:bg-amber-950/20",children:[e.jsx(F,{className:"pb-2",children:e.jsxs(K,{className:"flex items-center gap-2 text-base",children:[e.jsx(Os,{className:"h-4 w-4 text-amber-600"}),t("codex.warningsTitle")]})}),e.jsx(W,{className:"space-y-1.5",children:s.warnings.map(o=>e.jsxs("p",{className:"text-sm text-amber-800 dark:text-amber-300",children:["- ",o]},o))})]})]})})}function ar(){const{t:s}=T(),t=it(),{diagnostics:r,diagnosticsLoading:a,diagnosticsError:o,refetchDiagnostics:n,rawConfig:l,rawConfigLoading:c,rawConfigError:i,refetchRawConfig:d,saveRawConfigAsync:m,isSavingRawConfig:h,patchConfigAsync:x,isPatchingConfig:g}=Wt(),[p,w]=N.useState(null),M=l?.rawText??"",q=p??M,u=p!==null&&p!==M,v=Ve(q),X=v.parseError?{valid:!1,error:v.parseError}:{valid:!0},j=l?.config??null,$e=c||!l||u||l?.parseError!==null||l?.readError!==null,ze=i?"Structured controls unavailable: failed to load the current config.toml.":l?.readError?`Structured controls unavailable: ${l.readError}`:u?X.valid?"Save or discard raw TOML edits before using structured controls.":"Fix or discard raw TOML edits before using structured controls.":l?.parseError?`Structured controls disabled: ${l.parseError}`:null,Ge=N.useMemo(()=>qe(j),[j]),Xe=N.useMemo(()=>ct(j),[j]),He=N.useMemo(()=>dt(j),[j]),Ye=N.useMemo(()=>xt(j),[j]),Qe=N.useMemo(()=>ut(j),[j]),Je=N.useMemo(()=>mt(j),[j]),Ze=R=>{if(R===M){w(null);return}w(R)},es=async()=>{try{if((await Promise.all([n(),d()])).some(H=>!H||H.status==="error"||H.isError||H.error)){U.error(s("toasts.codexRefreshFailed"));return}w(null)}catch(R){U.error(R.message||s("toasts.codexRefreshError"))}},ss=async()=>{if(!X.valid){U.error(s("toasts.codexFixToml"));return}try{await m({rawText:q,expectedMtime:l?.exists?l.mtime:void 0}),w(null),U.success(s("toasts.codexSaved")),await n()}catch(R){Se(R)?U.error(s("toasts.codexChangedExternally")):U.error(R.message||s("toasts.codexSaveFailed"))}},ts=async(R,ye)=>{try{await x({...R,expectedMtime:l?.exists?l.mtime:void 0}),w(null),U.success(ye)}catch(H){Se(H)?U.error(s("toasts.codexChangedExternally")):U.error(H.message||s("toasts.codexUpdateFailed"))}},ae="mt-0 h-full border-0 p-0 data-[state=inactive]:hidden",rs=()=>a?e.jsxs("div",{className:"flex h-full items-center justify-center text-muted-foreground",children:[e.jsx(G,{className:"mr-2 h-5 w-5 animate-spin"}),"Loading Codex diagnostics..."]}):o||!r?e.jsx("div",{className:"flex h-full items-center justify-center px-6 text-center text-destructive",children:"Failed to load Codex diagnostics."}):e.jsxs(ds,{defaultValue:"overview",className:"flex h-full flex-col",children:[e.jsx("div",{className:"shrink-0 px-4 pt-4",children:e.jsxs(xs,{className:"grid w-full grid-cols-4",children:[e.jsx(oe,{value:"overview",children:s("codexPage.overview")}),e.jsx(oe,{value:"controls",children:s("codexPage.controlCenter")}),e.jsx(oe,{value:"docs",children:s("codexPage.docs")}),e.jsx(oe,{value:"auth-profiles",children:s("codexPage.authProfiles")})]})}),e.jsxs("div",{className:"flex-1 min-h-0 overflow-hidden px-4 pb-4 pt-3",children:[e.jsx(le,{value:"overview",className:ae,children:e.jsx($t,{diagnostics:r})}),e.jsx(le,{value:"controls",className:ae,children:e.jsx(ot,{workspacePath:r.workspacePath,activeProfile:r.config.activeProfile,topLevelSettings:Ge,projectTrustEntries:Xe,profileEntries:He,modelProviderEntries:Ye,mcpServerEntries:Qe,featureCatalog:t,featureState:Je,disabled:$e,disabledReason:ze,saving:g,onPatch:ts})}),e.jsx(le,{value:"docs",className:ae,children:e.jsx(jt,{diagnostics:r})}),e.jsx(le,{value:"auth-profiles",className:ae,children:e.jsx("div",{className:"h-full overflow-auto p-1",children:e.jsx(Ks,{})})})]})]});return e.jsx("div",{className:"h-full min-h-0 overflow-hidden",children:e.jsxs(is,{direction:"horizontal",className:"h-full",children:[e.jsx(Ce,{defaultSize:45,minSize:35,children:e.jsx("div",{className:"h-full border-r bg-muted/20",children:rs()})}),e.jsx(cs,{className:"group flex w-2 cursor-col-resize items-center justify-center bg-border transition-colors hover:bg-primary/20",children:e.jsx(Ls,{className:"h-3 w-3 text-muted-foreground group-hover:text-primary"})}),e.jsx(Ce,{defaultSize:55,minSize:35,children:e.jsx(As,{title:"Codex config.toml",pathLabel:l?.path||r?.file.path||"$CODEX_HOME/config.toml",loading:c,parseWarning:X.valid?l?.parseError:X.error,readWarning:l?.readError,value:q,dirty:u,readOnly:!!l?.readError,saving:h,saveDisabled:!u||h||c||!X.valid||!!l?.readError,onChange:R=>{Ze(R)},onSave:ss,onRefresh:es,onDiscard:()=>w(null),language:"toml",exactText:!0,loadingLabel:"Loading config.toml...",parseWarningLabel:"TOML warning",ownershipNotice:e.jsxs("div",{className:"rounded-md border border-amber-200 bg-amber-50/60 px-3 py-2 text-sm text-amber-900 dark:bg-amber-950/20 dark:text-amber-300",children:[e.jsx("p",{className:"font-medium",children:"This file is upstream-owned by Codex CLI."}),e.jsxs("p",{children:["CCS does not keep ",e.jsx("code",{children:"~/.codex/config.toml"})," in sync for you."]}),e.jsxs("p",{children:["CCS-backed Codex launches may apply transient ",e.jsx("code",{children:"-c"})," overrides and",e.jsx("code",{children:" CCS_CODEX_API_KEY"}),"; those effective values may not appear here."]})]})})})]})})}export{ar as CodexPage};